diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-02-20 09:42:51 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-02-20 09:42:51 -0800 |
commit | 2ab6820706ba72f333b710b4c097a745d5ea13a8 (patch) | |
tree | 45a783be83b6f6453ecbcd27e5ababf7deaf285d /tools | |
parent | c66c3baef3b4a21620421bed67264d9db40d1354 (diff) |
eliminate variables through break/continue/return
Diffstat (limited to 'tools')
-rw-r--r-- | tools/eliminator/eliminator-test-output.js | 11 | ||||
-rw-r--r-- | tools/eliminator/eliminator-test.js | 13 | ||||
-rw-r--r-- | tools/eliminator/eliminator.coffee | 3 |
3 files changed, 21 insertions, 6 deletions
diff --git a/tools/eliminator/eliminator-test-output.js b/tools/eliminator/eliminator-test-output.js index d914a5da..aac21e87 100644 --- a/tools/eliminator/eliminator-test-output.js +++ b/tools/eliminator/eliminator-test-output.js @@ -117,4 +117,13 @@ function f3($s, $tree, $k) { } HEAP32[($s + 2908 + ($storemerge_in << 2) | 0) >> 2] = $0; } -// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2", "f3"] +function llvm3_1() { + while (check()) { + if ($curri_01 % $zj_0 == 0) { + break; + } + var $j_0 = $aj_0 + 1; + run($j_0 / 2); + } +} +// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1"] diff --git a/tools/eliminator/eliminator-test.js b/tools/eliminator/eliminator-test.js index 35bed0bb..55f74d67 100644 --- a/tools/eliminator/eliminator-test.js +++ b/tools/eliminator/eliminator-test.js @@ -130,5 +130,14 @@ function f3($s, $tree, $k) { } HEAP32[($s + 2908 + ($storemerge_in << 2) | 0) >> 2] = $0; } -// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2", "f3"] - +function llvm3_1() { + while (check()) { + var $inc = $aj_0 + 1; + if ($curri_01 % $zj_0 == 0) { + break; + } + var $j_0 = $inc; + run($j_0 / 2); + } +} +// EMSCRIPTEN_GENERATED_FUNCTIONS: ["f", "g", "h", "py", "r", "t", "f2", "f3", "llvm3_1"] diff --git a/tools/eliminator/eliminator.coffee b/tools/eliminator/eliminator.coffee index b78a5a7e..ba91aa89 100644 --- a/tools/eliminator/eliminator.coffee +++ b/tools/eliminator/eliminator.coffee @@ -49,9 +49,6 @@ NODES_WITHOUT_SIDE_EFFECTS = # Nodes which may break control flow. Moving a variable beyond them may have # side effects. CONTROL_FLOW_NODES = - return: true - break: true - continue: true new: true throw: true call: true |