summaryrefslogtreecommitdiff
path: root/src/passes/LegalizeJSInterface.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-04-25 07:50:15 -0700
committerGitHub <noreply@github.com>2019-04-25 07:50:15 -0700
commit09945884f7461135286357d14f993f9b5c5a329b (patch)
tree91e9940c495469d4029bacc3576a97bb8b215908 /src/passes/LegalizeJSInterface.cpp
parentc3ed0f176b36a502ef2e1fd915550a808b8d8f0b (diff)
downloadbinaryen-09945884f7461135286357d14f993f9b5c5a329b.tar.gz
binaryen-09945884f7461135286357d14f993f9b5c5a329b.tar.bz2
binaryen-09945884f7461135286357d14f993f9b5c5a329b.zip
Remove f32 legalization from LegalizeJSInterface (#2052)
As well as i64 splitting this pass was also converting f32 to f64 at the wasm boundry. However it appears this is not actually useful and makes somethings (such as dynamic linking) harder.
Diffstat (limited to 'src/passes/LegalizeJSInterface.cpp')
-rw-r--r--src/passes/LegalizeJSInterface.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp
index 6002c7ad7..cde4373f8 100644
--- a/src/passes/LegalizeJSInterface.cpp
+++ b/src/passes/LegalizeJSInterface.cpp
@@ -29,9 +29,6 @@
// across modules, we still want to legalize dynCalls so JS can call into the
// table even to a signature that is not legal.
//
-// This pass also legalizes according to asm.js FFI rules, which
-// disallow f32s. TODO: an option to not do that, if it matters?
-//
#include <utility>
#include "wasm.h"
@@ -124,9 +121,9 @@ private:
template<typename T>
bool isIllegal(T* t) {
for (auto param : t->params) {
- if (param == i64 || param == f32) return true;
+ if (param == i64) return true;
}
- return t->result == i64 || t->result == f32;
+ return t->result == i64;
}
// Check if an export should be legalized.
@@ -158,9 +155,6 @@ private:
call->operands.push_back(I64Utilities::recreateI64(builder, legal->params.size(), legal->params.size() + 1));
legal->params.push_back(i32);
legal->params.push_back(i32);
- } else if (param == f32) {
- call->operands.push_back(builder.makeUnary(DemoteFloat64, builder.makeGetLocal(legal->params.size(), f64)));
- legal->params.push_back(f64);
} else {
call->operands.push_back(builder.makeGetLocal(legal->params.size(), param));
legal->params.push_back(param);
@@ -177,9 +171,6 @@ private:
block->list.push_back(I64Utilities::getI64Low(builder, index));
block->finalize();
legal->body = block;
- } else if (func->result == f32) {
- legal->result = f64;
- legal->body = builder.makeUnary(PromoteFloat32, call);
} else {
legal->result = func->result;
legal->body = call;
@@ -216,9 +207,6 @@ private:
call->operands.push_back(I64Utilities::getI64High(builder, func->params.size()));
type->params.push_back(i32);
type->params.push_back(i32);
- } else if (param == f32) {
- call->operands.push_back(builder.makeUnary(PromoteFloat32, builder.makeGetLocal(func->params.size(), f32)));
- type->params.push_back(f64);
} else {
call->operands.push_back(builder.makeGetLocal(func->params.size(), param));
type->params.push_back(param);
@@ -232,10 +220,6 @@ private:
Expression* get = builder.makeCall(f->name, {}, call->type);
func->body = I64Utilities::recreateI64(builder, call, get);
type->result = i32;
- } else if (imFunctionType->result == f32) {
- call->type = f64;
- func->body = builder.makeUnary(DemoteFloat64, call);
- type->result = f64;
} else {
call->type = imFunctionType->result;
func->body = call;