diff options
Diffstat (limited to 'src/passes/Memory64Lowering.cpp')
-rw-r--r-- | src/passes/Memory64Lowering.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/passes/Memory64Lowering.cpp b/src/passes/Memory64Lowering.cpp index 95dbf4f17..4c2770e3a 100644 --- a/src/passes/Memory64Lowering.cpp +++ b/src/passes/Memory64Lowering.cpp @@ -99,19 +99,20 @@ struct Memory64Lowering : public WalkerPass<PostWalker<Memory64Lowering>> { void visitAtomicNotify(AtomicNotify* curr) { wrapAddress64(curr->ptr); } void visitMemory(Memory* memory) { - for (auto& segment : memory->segments) { - if (!segment.isPassive) { - auto* c = segment.offset->cast<Const>(); - c->value = Literal(static_cast<uint32_t>(c->value.geti64())); - c->type = Type::i32; - } - } // This is visited last. memory->indexType = Type::i32; if (memory->hasMax() && memory->max > Memory::kMaxSize32) { memory->max = Memory::kMaxSize32; } } + + void visitDataSegment(DataSegment* segment) { + if (!segment->isPassive) { + auto* c = segment->offset->cast<Const>(); + c->value = Literal(static_cast<uint32_t>(c->value.geti64())); + c->type = Type::i32; + } + } }; Pass* createMemory64LoweringPass() { return new Memory64Lowering(); } |