From 09945884f7461135286357d14f993f9b5c5a329b Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 25 Apr 2019 07:50:15 -0700 Subject: 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. --- src/passes/LegalizeJSInterface.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src/passes/LegalizeJSInterface.cpp') 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 #include "wasm.h" @@ -124,9 +121,9 @@ private: template 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; -- cgit v1.2.3