diff options
author | Nathan Froyd <froydnj@gmail.com> | 2018-03-20 17:51:02 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-03-20 14:51:02 -0700 |
commit | 4eeec14d343793af27e77620e1e66eda522a8a6b (patch) | |
tree | ccd5c51721abede7f98ac16aa78c38bbf0472877 /src/passes/I64ToI32Lowering.cpp | |
parent | 267e4b55f8c2f598ea5ea44d5df88d83bfb3ebac (diff) | |
download | binaryen-4eeec14d343793af27e77620e1e66eda522a8a6b.tar.gz binaryen-4eeec14d343793af27e77620e1e66eda522a8a6b.tar.bz2 binaryen-4eeec14d343793af27e77620e1e66eda522a8a6b.zip |
add the highbits global to the IR (#1483)
We were using the global to return 64-bit values from functions, but
said global wasn't actually present in the IR. This omission caused the
generated code to fail validation.
Diffstat (limited to 'src/passes/I64ToI32Lowering.cpp')
-rw-r--r-- | src/passes/I64ToI32Lowering.cpp | 9 |
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); } |