@@ -444,7 +444,7 @@ namespace {
444444
445445// Compute the total offset of a GEP chain.
446446static uint64_t TotalOffset (const llvm::DataLayout &dl, llvm::Value *base,
447- llvm::Type *state_type) {
447+ llvm::StructType *state_type) {
448448 uint64_t total_offset = 0 ;
449449 const auto state_size = dl.getTypeAllocSize (state_type);
450450 while (base) {
@@ -481,9 +481,8 @@ static uint64_t TotalOffset(const llvm::DataLayout &dl, llvm::Value *base,
481481
482482static llvm::Value *
483483FinishAddressOf (llvm::IRBuilder<> &ir, const llvm::DataLayout &dl,
484- llvm::Type *state_type, size_t state_size,
485- const Register *reg, unsigned addr_space,
486- llvm::Value *gep) {
484+ llvm::StructType *state_type, size_t state_size,
485+ const Register *reg, unsigned addr_space, llvm::Value *gep) {
487486
488487
489488 auto gep_offset = TotalOffset (dl, gep, state_type);
@@ -548,11 +547,15 @@ FinishAddressOf(llvm::IRBuilder<> &ir, const llvm::DataLayout &dl,
548547} // namespace
549548
550549void Register::ComputeGEPAccessors (const llvm::DataLayout &dl,
551- llvm::Type *state_type) {
552- if (gep_type_at_offset || !state_type ) {
550+ llvm::StructType *state_type) {
551+ if (gep_type_at_offset) {
553552 return ;
554553 }
555554
555+ if (!state_type) {
556+ state_type = arch->state_type ;
557+ }
558+
556559 auto &context = state_type->getContext ();
557560
558561 gep_index_list.push_back (
0 commit comments