summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/I64ToI32Lowering.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/passes/I64ToI32Lowering.cpp b/src/passes/I64ToI32Lowering.cpp
index a359d22d8..c77ec3963 100644
--- a/src/passes/I64ToI32Lowering.cpp
+++ b/src/passes/I64ToI32Lowering.cpp
@@ -109,6 +109,15 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> {
high->name = makeHighName(curr->name);
module->addGlobal(high);
}
+
+ // For functions that return 64-bit values, we use this global variable
+ // to return the high 32 bits.
+ auto* highBits = new Global();
+ highBits->type = i32;
+ highBits->name = highBitsGlobal;
+ highBits->init = builder->makeConst(Literal(int32_t(0)));
+ highBits->mutable_ = true;
+ module->addGlobal(highBits);
PostWalker<I64ToI32Lowering>::doWalkModule(module);
}