summaryrefslogtreecommitdiff
path: root/src/passes/Memory64Lowering.cpp
diff options
context:
space:
mode:
authorWouter van Oortmerssen <aardappel@gmail.com>2021-02-25 13:18:34 -0800
committerGitHub <noreply@github.com>2021-02-25 13:18:34 -0800
commit7977ad58a367f49555c70ea5f0f0f6ab06b28903 (patch)
tree92afec6d6555f653c863a372fbfddcc66fd1d9ba /src/passes/Memory64Lowering.cpp
parent04c1515acb354714af3d07fe2a3b65b2bb0398ab (diff)
downloadbinaryen-7977ad58a367f49555c70ea5f0f0f6ab06b28903.tar.gz
binaryen-7977ad58a367f49555c70ea5f0f0f6ab06b28903.tar.bz2
binaryen-7977ad58a367f49555c70ea5f0f0f6ab06b28903.zip
Support 64-bit data segment init-exps in Memory64 (#3593)
This as a consequence of https://reviews.llvm.org/D95651
Diffstat (limited to 'src/passes/Memory64Lowering.cpp')
-rw-r--r--src/passes/Memory64Lowering.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/passes/Memory64Lowering.cpp b/src/passes/Memory64Lowering.cpp
index cee174b63..5e1004797 100644
--- a/src/passes/Memory64Lowering.cpp
+++ b/src/passes/Memory64Lowering.cpp
@@ -91,6 +91,11 @@ struct Memory64Lowering : public WalkerPass<PostWalker<Memory64Lowering>> {
}
void visitMemory(Memory* memory) {
+ for (auto& segment : memory->segments) {
+ 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;
}