diff options
author | Nathan Froyd <froydnj@gmail.com> | 2018-03-22 13:36:40 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-03-22 10:36:40 -0700 |
commit | f7ebc7c0e53241e4604be5321134d48d640f0a40 (patch) | |
tree | c0566b75c42b5a09f2cd89404957b581f5db4878 /test/wasm2asm.traps.js | |
parent | 4eeec14d343793af27e77620e1e66eda522a8a6b (diff) | |
download | binaryen-f7ebc7c0e53241e4604be5321134d48d640f0a40.tar.gz binaryen-f7ebc7c0e53241e4604be5321134d48d640f0a40.tar.bz2 binaryen-f7ebc7c0e53241e4604be5321134d48d640f0a40.zip |
reorder locals in wasm2asm (#1482)
The documentation for the simplify-locals pass suggests running
reorder-locals after it to clean up unnecessary locals. wasm2asm wasn't
doing this, which meant that generated code had a number of unused
variables. A good minimizer will probably clean that up, but let's go
ahead and clean it up in wasm2asm itself.
Diffstat (limited to 'test/wasm2asm.traps.js')
-rw-r--r-- | test/wasm2asm.traps.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/test/wasm2asm.traps.js b/test/wasm2asm.traps.js index f5b78edcd..481fd24a3 100644 --- a/test/wasm2asm.traps.js +++ b/test/wasm2asm.traps.js @@ -22,31 +22,29 @@ function asmFunc(global, env, buffer) { function $1(x, y) { x = x | 0; y = y | 0; - var $2 = 0, $3 = 0, $4 = 0; return x + y | 0 | 0; } function $2(x, y) { x = x | 0; y = y | 0; - var $2 = 0, $3 = 0, $4 = 0; return (x | 0) / (y | 0) | 0 | 0; } function __wasm_ctz_i32(x) { x = x | 0; - var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0; - if ((x | 0) == (0 | 0)) $9 = 32; else $9 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; - return $9 | 0; + var $1 = 0; + if ((x | 0) == (0 | 0)) $1 = 32; else $1 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; + return $1 | 0; } function __wasm_popcnt_i32(x) { x = x | 0; - var count = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0; + var count = 0, $2 = 0; count = 0; b : { l : do { - $5 = count; + $2 = count; if ((x | 0) == (0 | 0)) break b; x = x & (x - 1 | 0) | 0; count = count + 1 | 0; @@ -54,20 +52,18 @@ function asmFunc(global, env, buffer) { break l; } while (1); }; - return $5 | 0; + return $2 | 0; } function __wasm_rotl_i32(x, k) { x = x | 0; k = k | 0; - var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0; return ((4294967295 >>> (k & 31 | 0) | 0) & x | 0) << (k & 31 | 0) | 0 | (((4294967295 << (32 - (k & 31 | 0) | 0) | 0) & x | 0) >>> (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; } function __wasm_rotr_i32(x, k) { x = x | 0; k = k | 0; - var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0; return ((4294967295 << (k & 31 | 0) | 0) & x | 0) >>> (k & 31 | 0) | 0 | (((4294967295 >>> (32 - (k & 31 | 0) | 0) | 0) & x | 0) << (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; } |