diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-11-20 20:11:12 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-11-20 20:11:12 -0800 |
commit | 001f91409ce55cc416565e2e28b3a0d4a171d728 (patch) | |
tree | 8f33eea3121c62a923793d4a9fbd33a8b8757435 | |
parent | f54b8332c7fd00cc7b431b3aae2cd015e0cf333f (diff) | |
download | binaryen-001f91409ce55cc416565e2e28b3a0d4a171d728.tar.gz binaryen-001f91409ce55cc416565e2e28b3a0d4a171d728.tar.bz2 binaryen-001f91409ce55cc416565e2e28b3a0d4a171d728.zip |
detect seq sign
-rw-r--r-- | src/emscripten-optimizer/optimizer-shared.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/emscripten-optimizer/optimizer-shared.cpp b/src/emscripten-optimizer/optimizer-shared.cpp index 054716b14..ae346d756 100644 --- a/src/emscripten-optimizer/optimizer-shared.cpp +++ b/src/emscripten-optimizer/optimizer-shared.cpp @@ -123,6 +123,12 @@ AsmType detectType(Ref node, AsmData *asmData, bool inVarDef) { return ASM_NONE; } +static void abort_on(Ref node) { + node->stringify(std::cerr); + std::cerr << '\n'; + abort(); +} + AsmSign detectSign(Ref node) { IString type = node[0]->getIString(); if (type == BINARY) { @@ -135,7 +141,7 @@ AsmSign detectSign(Ref node) { case '|': case '&': case '^': case '<': case '=': case '!': return ASM_SIGNED; case '+': case '-': return ASM_FLEXIBLE; case '*': case '/': return ASM_NONSIGNED; // without a coercion, these are double - default: abort(); + default: abort_on(node); } } else if (type == UNARY_PREFIX) { IString op = node[1]->getIString(); @@ -143,7 +149,7 @@ AsmSign detectSign(Ref node) { case '-': return ASM_FLEXIBLE; case '+': return ASM_NONSIGNED; // XXX double case '~': return ASM_SIGNED; - default: abort(); + default: abort_on(node); } } else if (type == NUM) { double value = node[1]->getNumber(); @@ -157,7 +163,10 @@ AsmSign detectSign(Ref node) { return detectSign(node[2]); } else if (type == CALL) { if (node[1][0] == NAME && node[1][1] == MATH_FROUND) return ASM_NONSIGNED; + } else if (type == SEQ) { + return detectSign(node[2]); } - abort(); + abort_on(node); + abort(); // avoid warning } |