summaryrefslogtreecommitdiff
path: root/src/passes/TrapMode.cpp
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-11-08 12:24:27 -0800
committerGitHub <noreply@github.com>2020-11-08 12:24:27 -0800
commit47607d445b62c98017ce4b9c6cc69b61fae85aa5 (patch)
treee9c3350b96e21183c95f61cbf4fcfba8cf7257ab /src/passes/TrapMode.cpp
parentc8249b553f89ede0b4dedd6c00fe7f9f7e745de2 (diff)
downloadbinaryen-47607d445b62c98017ce4b9c6cc69b61fae85aa5.tar.gz
binaryen-47607d445b62c98017ce4b9c6cc69b61fae85aa5.tar.bz2
binaryen-47607d445b62c98017ce4b9c6cc69b61fae85aa5.zip
Remove dead code and unused includes. NFC. (#3328)
Specifically try to cleanup use of asm_v_wasm.h and asmjs constants.
Diffstat (limited to 'src/passes/TrapMode.cpp')
-rw-r--r--src/passes/TrapMode.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/passes/TrapMode.cpp b/src/passes/TrapMode.cpp
index f3cf3c63c..528357d4a 100644
--- a/src/passes/TrapMode.cpp
+++ b/src/passes/TrapMode.cpp
@@ -20,7 +20,6 @@
// generates a check and replaces the result with zero in that case.
//
-#include "asm_v_wasm.h"
#include "asmjs/shared-constants.h"
#include "ir/trapping.h"
#include "mixed_arena.h"
@@ -38,6 +37,18 @@ Name I64U_REM("i64u-rem");
Name I64S_DIV("i64s-div");
Name I64U_DIV("i64u-div");
+static Expression* ensureDouble(Expression* expr, MixedArena& allocator) {
+ if (expr->type == Type::f32) {
+ auto conv = allocator.alloc<Unary>();
+ conv->op = PromoteFloat32;
+ conv->value = expr;
+ conv->type = Type::f64;
+ return conv;
+ }
+ assert(expr->type == Type::f64);
+ return expr;
+}
+
Name getBinaryFuncName(Binary* curr) {
switch (curr->op) {
case RemSInt32: