summaryrefslogtreecommitdiff
path: root/src/passes/I64ToI32Lowering.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-07-23 17:12:22 -0700
committerGitHub <noreply@github.com>2019-07-23 17:12:22 -0700
commita2741b360b444a26cd87327a3d60a601bb33119f (patch)
treee7ea331a4236f33c4f8e28b8ef30a8a09ab29740 /src/passes/I64ToI32Lowering.cpp
parent0beba8aad60e4bdadcd3fc3e5126e7befb7b7994 (diff)
downloadbinaryen-a2741b360b444a26cd87327a3d60a601bb33119f.tar.gz
binaryen-a2741b360b444a26cd87327a3d60a601bb33119f.tar.bz2
binaryen-a2741b360b444a26cd87327a3d60a601bb33119f.zip
Finalize tail call support (#2246)
Adds tail call support to fuzzer and makes small changes to handle return calls in multiple utilities and passes. Makes larger changes to DAE and inlining passes to properly handle tail calls.
Diffstat (limited to 'src/passes/I64ToI32Lowering.cpp')
-rw-r--r--src/passes/I64ToI32Lowering.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/passes/I64ToI32Lowering.cpp b/src/passes/I64ToI32Lowering.cpp
index e893b6296..5d7d5998c 100644
--- a/src/passes/I64ToI32Lowering.cpp
+++ b/src/passes/I64ToI32Lowering.cpp
@@ -262,9 +262,14 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> {
return call;
}
void visitCall(Call* curr) {
+ if (curr->isReturn &&
+ getModule()->getFunction(curr->target)->result == i64) {
+ Fatal()
+ << "i64 to i32 lowering of return_call values not yet implemented";
+ }
auto* fixedCall = visitGenericCall<Call>(
curr, [&](std::vector<Expression*>& args, Type ty) {
- return builder->makeCall(curr->target, args, ty);
+ return builder->makeCall(curr->target, args, ty, curr->isReturn);
});
// If this was to an import, we need to call the legal version. This assumes
// that legalize-js-interface has been run before.
@@ -275,10 +280,15 @@ struct I64ToI32Lowering : public WalkerPass<PostWalker<I64ToI32Lowering>> {
}
void visitCallIndirect(CallIndirect* curr) {
+ if (curr->isReturn &&
+ getModule()->getFunctionType(curr->fullType)->result == i64) {
+ Fatal()
+ << "i64 to i32 lowering of return_call values not yet implemented";
+ }
visitGenericCall<CallIndirect>(
curr, [&](std::vector<Expression*>& args, Type ty) {
return builder->makeCallIndirect(
- curr->fullType, curr->target, args, ty);
+ curr->fullType, curr->target, args, ty, curr->isReturn);
});
}