summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-01-05 10:24:47 -0800
committerAlon Zakai <alonzakai@gmail.com>2016-01-05 10:24:47 -0800
commit6c3b37355c7e24a763e0f6e65829391f5fe29b42 (patch)
treef7b529809abb2aaaec9aa3dba976404f11ca57bf
parent618c1737be20acd60a2653dfd0d65bfed5990480 (diff)
downloadbinaryen-6c3b37355c7e24a763e0f6e65829391f5fe29b42.tar.gz
binaryen-6c3b37355c7e24a763e0f6e65829391f5fe29b42.tar.bz2
binaryen-6c3b37355c7e24a763e0f6e65829391f5fe29b42.zip
RemoveUnusedBrs #32
-rw-r--r--CMakeLists.txt2
-rwxr-xr-xbuild.sh4
-rw-r--r--src/asm2wasm.h1
-rw-r--r--src/passes/RemoveUnusedBrs.cpp41
-rw-r--r--test/emcc_O2_hello_world.fromasm27
-rw-r--r--test/emcc_hello_world.fromasm2291
-rw-r--r--test/passes/remove-unused-brs.txt92
-rw-r--r--test/passes/remove-unused-brs.wast48
-rw-r--r--test/unit.fromasm3
9 files changed, 1335 insertions, 1174 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be3eb3d6d..f1d575635 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@ SET(binaryen-shell_SOURCES
src/passes/LowerIfElse.cpp
src/passes/NameManager.cpp
src/passes/RemoveImports.cpp
+ src/passes/RemoveUnusedBrs.cpp
src/passes/RemoveUnusedNames.cpp
)
ADD_EXECUTABLE(binaryen-shell
@@ -48,6 +49,7 @@ INSTALL(TARGETS binaryen-shell DESTINATION bin)
SET(asm2wasm_SOURCES
src/asm2wasm-main.cpp
src/pass.cpp
+ src/passes/RemoveUnusedBrs.cpp
src/passes/RemoveUnusedNames.cpp
src/emscripten-optimizer/parser.cpp
src/emscripten-optimizer/simple_ast.cpp
diff --git a/build.sh b/build.sh
index a5da9c10e..6ec6e054a 100755
--- a/build.sh
+++ b/build.sh
@@ -2,12 +2,12 @@
echo "building binaryen shell"
g++ -O2 -std=c++11 src/binaryen-shell.cpp src/pass.cpp src/passes/LowerIfElse.cpp src/passes/NameManager.cpp src/passes/RemoveImports.cpp src/passes/RemoveUnusedNames.cpp src/support/colors.cpp -o bin/binaryen-shell -Isrc/ -msse2 -mfpmath=sse # use sse for math, avoid x87, necessarily for proper float rounding on 32-bit
echo "building asm2wasm"
-g++ -O2 -std=c++11 src/asm2wasm-main.cpp src/pass.cpp src/passes/RemoveUnusedNames.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/asm2wasm
+g++ -O2 -std=c++11 src/asm2wasm-main.cpp src/passes/RemoveUnusedBrs.cpp src/pass.cpp src/passes/RemoveUnusedNames.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/asm2wasm
echo "building wasm2asm"
g++ -O2 -std=c++11 src/wasm2asm-main.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/wasm2asm
echo "building s2wasm"
g++ -O2 -std=c++11 src/s2wasm-main.cpp src/support/colors.cpp -Isrc/ -o bin/s2wasm
echo "building interpreter/js"
-em++ -std=c++11 src/wasm-js.cpp src/pass.cpp src/passes/RemoveUnusedNames.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -Oz -s ALLOW_MEMORY_GROWTH=1 -profiling -s DEMANGLE_SUPPORT=1 #-DWASM_JS_DEBUG -DWASM_INTERPRETER_DEBUG=2
+em++ -std=c++11 src/wasm-js.cpp src/pass.cpp src/passes/RemoveUnusedBrs.cpp src/passes/RemoveUnusedNames.cpp src/emscripten-optimizer/parser.cpp src/emscripten-optimizer/simple_ast.cpp src/emscripten-optimizer/optimizer-shared.cpp src/support/colors.cpp -Isrc/ -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -Oz -s ALLOW_MEMORY_GROWTH=1 -profiling -s DEMANGLE_SUPPORT=1 #-DWASM_JS_DEBUG -DWASM_INTERPRETER_DEBUG=2
cat src/js/wasm.js-post.js >> bin/wasm.js
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index ce935666e..e91a9344e 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -1571,6 +1571,7 @@ void Asm2WasmBuilder::optimize() {
// Standard passes
PassRunner passRunner(&allocator);
+ passRunner.add("remove-unused-brs");
passRunner.add("remove-unused-names");
passRunner.run(&wasm);
}
diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp
new file mode 100644
index 000000000..ff50847de
--- /dev/null
+++ b/src/passes/RemoveUnusedBrs.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 WebAssembly Community Group participants
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Removes branches that go to where they go anyhow
+//
+
+#include <wasm.h>
+#include <pass.h>
+
+namespace wasm {
+
+struct RemoveUnusedBrs : public Pass {
+ void visitBlock(Block *curr) override {
+ if (curr->name.isNull()) return;
+ if (curr->list.size() == 0) return;
+ Break* last = curr->list.back()->dyn_cast<Break>();
+ if (!last) return;
+ if (last->value) return;
+ if (last->name == curr->name) {
+ curr->list.pop_back();
+ }
+ }
+};
+
+static RegisterPass<RemoveUnusedBrs> registerPass("remove-unused-brs", "removes breaks from locations that are never branched to");
+
+} // namespace wasm
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm
index 988ce1bab..84e10d632 100644
--- a/test/emcc_O2_hello_world.fromasm
+++ b/test/emcc_O2_hello_world.fromasm
@@ -9255,7 +9255,6 @@
(i32.const 208)
(i32.const -1)
)
- (br $topmost)
)
)
(func $___stdio_write (param $i1 i32) (param $i2 i32) (param $i3 i32) (result i32)
@@ -11883,22 +11882,19 @@
)
)
(func $_cleanup_418 (param $i1 i32)
- (block $topmost
- (if
- (i32.eq
- (i32.load align=4
- (i32.add
- (get_local $i1)
- (i32.const 68)
- )
+ (if
+ (i32.eq
+ (i32.load align=4
+ (i32.add
+ (get_local $i1)
+ (i32.const 68)
)
- (i32.const 0)
- )
- (call $___unlockfile
- (get_local $i1)
)
+ (i32.const 0)
+ )
+ (call $___unlockfile
+ (get_local $i1)
)
- (br $topmost)
)
)
(func $establishStackSpace (param $i1 i32) (param $i2 i32)
@@ -11948,9 +11944,6 @@
(i32.const 0)
)
(func $___unlockfile (param $i1 i32)
- (block $topmost
- (br $topmost)
- )
)
(func $___lockfile (param $i1 i32) (result i32)
(i32.const 0)
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index 0ddfaf49d..bea407a53 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -1605,13 +1605,10 @@
(func $___unlockfile (param $$f i32)
(local $label i32)
(local $sp i32)
- (block $topmost
- (set_local $sp
- (i32.load align=4
- (i32.const 8)
- )
+ (set_local $sp
+ (i32.load align=4
+ (i32.const 8)
)
- (br $topmost)
)
)
(func $___stdio_write (param $$f i32) (param $$buf i32) (param $$len i32) (result i32)
@@ -4670,36 +4667,33 @@
(local $$tobool i32)
(local $label i32)
(local $sp i32)
- (block $topmost
- (set_local $sp
- (i32.load align=4
- (i32.const 8)
- )
+ (set_local $sp
+ (i32.load align=4
+ (i32.const 8)
)
- (set_local $$lockcount
- (i32.add
- (get_local $$p)
- (i32.const 68)
- )
+ )
+ (set_local $$lockcount
+ (i32.add
+ (get_local $$p)
+ (i32.const 68)
)
- (set_local $$0
- (i32.load align=4
- (get_local $$lockcount)
- )
+ )
+ (set_local $$0
+ (i32.load align=4
+ (get_local $$lockcount)
)
- (set_local $$tobool
- (i32.eq
- (get_local $$0)
- (i32.const 0)
- )
+ )
+ (set_local $$tobool
+ (i32.eq
+ (get_local $$0)
+ (i32.const 0)
)
- (if
- (get_local $$tobool)
- (call $___unlockfile
- (get_local $$p)
- )
+ )
+ (if
+ (get_local $$tobool)
+ (call $___unlockfile
+ (get_local $$p)
)
- (br $topmost)
)
)
(func $_printf_core (param $$f i32) (param $$fmt i32) (param $$ap i32) (param $$nl_arg i32) (param $$nl_type i32) (result i32)
@@ -14738,1117 +14732,1114 @@
(local $$expanded95 i32)
(local $label i32)
(local $sp i32)
- (block $topmost
- (set_local $sp
- (i32.load align=4
- (i32.const 8)
- )
+ (set_local $sp
+ (i32.load align=4
+ (i32.const 8)
)
- (set_local $$cmp
- (i32.gt_u
- (get_local $$type)
- (i32.const 20)
- )
+ )
+ (set_local $$cmp
+ (i32.gt_u
+ (get_local $$type)
+ (i32.const 20)
)
- (block $label$break$L1
- (if
- (i32.eq
- (get_local $$cmp)
- (i32.const 0)
+ )
+ (block $label$break$L1
+ (if
+ (i32.eq
+ (get_local $$cmp)
+ (i32.const 0)
+ )
+ (tableswitch $switch$1
+ (i32.sub
+ (get_local $$type)
+ (i32.const 9)
)
- (tableswitch $switch$1
- (i32.sub
- (get_local $$type)
- (i32.const 9)
- )
- (table (case $switch-case$2) (case $switch-case$3) (case $switch-case$4) (case $switch-case$5) (case $switch-case$6) (case $switch-case$7) (case $switch-case$8) (case $switch-case$9) (case $switch-case$10) (case $switch-case$11)) (case $switch-default$12)
- (case $switch-case$2
- (block
- (set_local $$arglist_current
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$0
- (get_local $$arglist_current)
- )
- (set_local $$1
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded28
- (get_local $$1)
- )
- (set_local $$expanded
- (i32.sub
- (get_local $$expanded28)
- (i32.const 1)
- )
- )
- (set_local $$2
- (i32.add
- (get_local $$0)
- (get_local $$expanded)
- )
- )
- (set_local $$3
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ (table (case $switch-case$2) (case $switch-case$3) (case $switch-case$4) (case $switch-case$5) (case $switch-case$6) (case $switch-case$7) (case $switch-case$8) (case $switch-case$9) (case $switch-case$10) (case $switch-case$11)) (case $switch-default$12)
+ (case $switch-case$2
+ (block
+ (set_local $$arglist_current
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$expanded32
- (get_local $$3)
+ )
+ (set_local $$0
+ (get_local $$arglist_current)
+ )
+ (set_local $$1
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded31
- (i32.sub
- (get_local $$expanded32)
- (i32.const 1)
- )
+ )
+ (set_local $$expanded28
+ (get_local $$1)
+ )
+ (set_local $$expanded
+ (i32.sub
+ (get_local $$expanded28)
+ (i32.const 1)
)
- (set_local $$expanded30
- (i32.xor
- (get_local $$expanded31)
- (i32.const -1)
- )
+ )
+ (set_local $$2
+ (i32.add
+ (get_local $$0)
+ (get_local $$expanded)
)
- (set_local $$4
- (i32.and
- (get_local $$2)
- (get_local $$expanded30)
- )
+ )
+ (set_local $$3
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$5
- (get_local $$4)
+ )
+ (set_local $$expanded32
+ (get_local $$3)
+ )
+ (set_local $$expanded31
+ (i32.sub
+ (get_local $$expanded32)
+ (i32.const 1)
)
- (set_local $$6
- (i32.load align=4
- (get_local $$5)
- )
+ )
+ (set_local $$expanded30
+ (i32.xor
+ (get_local $$expanded31)
+ (i32.const -1)
)
- (set_local $$arglist_next
- (i32.add
- (get_local $$5)
- (i32.const 4)
- )
+ )
+ (set_local $$4
+ (i32.and
+ (get_local $$2)
+ (get_local $$expanded30)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next)
+ )
+ (set_local $$5
+ (get_local $$4)
+ )
+ (set_local $$6
+ (i32.load align=4
+ (get_local $$5)
)
- (i32.store align=4
- (get_local $$arg)
- (get_local $$6)
+ )
+ (set_local $$arglist_next
+ (i32.add
+ (get_local $$5)
+ (i32.const 4)
)
- (br $label$break$L1)
- (br $switch$1)
)
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next)
+ )
+ (i32.store align=4
+ (get_local $$arg)
+ (get_local $$6)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$3
- (block
- (set_local $$arglist_current2
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$7
- (get_local $$arglist_current2)
- )
- (set_local $$8
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded35
- (get_local $$8)
- )
- (set_local $$expanded34
- (i32.sub
- (get_local $$expanded35)
- (i32.const 1)
- )
- )
- (set_local $$9
- (i32.add
- (get_local $$7)
- (get_local $$expanded34)
- )
+ )
+ (case $switch-case$3
+ (block
+ (set_local $$arglist_current2
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$10
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ )
+ (set_local $$7
+ (get_local $$arglist_current2)
+ )
+ (set_local $$8
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded39
- (get_local $$10)
+ )
+ (set_local $$expanded35
+ (get_local $$8)
+ )
+ (set_local $$expanded34
+ (i32.sub
+ (get_local $$expanded35)
+ (i32.const 1)
)
- (set_local $$expanded38
- (i32.sub
- (get_local $$expanded39)
- (i32.const 1)
- )
+ )
+ (set_local $$9
+ (i32.add
+ (get_local $$7)
+ (get_local $$expanded34)
)
- (set_local $$expanded37
- (i32.xor
- (get_local $$expanded38)
- (i32.const -1)
- )
+ )
+ (set_local $$10
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$11
- (i32.and
- (get_local $$9)
- (get_local $$expanded37)
- )
+ )
+ (set_local $$expanded39
+ (get_local $$10)
+ )
+ (set_local $$expanded38
+ (i32.sub
+ (get_local $$expanded39)
+ (i32.const 1)
)
- (set_local $$12
- (get_local $$11)
+ )
+ (set_local $$expanded37
+ (i32.xor
+ (get_local $$expanded38)
+ (i32.const -1)
)
- (set_local $$13
- (i32.load align=4
- (get_local $$12)
- )
+ )
+ (set_local $$11
+ (i32.and
+ (get_local $$9)
+ (get_local $$expanded37)
)
- (set_local $$arglist_next3
- (i32.add
- (get_local $$12)
- (i32.const 4)
- )
+ )
+ (set_local $$12
+ (get_local $$11)
+ )
+ (set_local $$13
+ (i32.load align=4
+ (get_local $$12)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next3)
+ )
+ (set_local $$arglist_next3
+ (i32.add
+ (get_local $$12)
+ (i32.const 4)
)
- (set_local $$14
- (i32.lt_s
- (get_local $$13)
- (i32.const 0)
- )
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next3)
+ )
+ (set_local $$14
+ (i32.lt_s
+ (get_local $$13)
+ (i32.const 0)
)
- (set_local $$15
- (i32.shr_s
- (i32.shl
- (get_local $$14)
- (i32.const 31)
- )
+ )
+ (set_local $$15
+ (i32.shr_s
+ (i32.shl
+ (get_local $$14)
(i32.const 31)
)
+ (i32.const 31)
)
- (set_local $$16
- (get_local $$arg)
- )
- (set_local $$17
+ )
+ (set_local $$16
+ (get_local $$arg)
+ )
+ (set_local $$17
+ (get_local $$16)
+ )
+ (i32.store align=4
+ (get_local $$17)
+ (get_local $$13)
+ )
+ (set_local $$18
+ (i32.add
(get_local $$16)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$17)
- (get_local $$13)
- )
- (set_local $$18
- (i32.add
- (get_local $$16)
- (i32.const 4)
- )
- )
- (set_local $$19
- (get_local $$18)
- )
- (i32.store align=4
- (get_local $$19)
- (get_local $$15)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$19
+ (get_local $$18)
+ )
+ (i32.store align=4
+ (get_local $$19)
+ (get_local $$15)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$4
- (block
- (set_local $$arglist_current5
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$20
- (get_local $$arglist_current5)
- )
- (set_local $$21
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded42
- (get_local $$21)
- )
- (set_local $$expanded41
- (i32.sub
- (get_local $$expanded42)
- (i32.const 1)
- )
- )
- (set_local $$22
- (i32.add
- (get_local $$20)
- (get_local $$expanded41)
- )
- )
- (set_local $$23
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ )
+ (case $switch-case$4
+ (block
+ (set_local $$arglist_current5
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$expanded46
- (get_local $$23)
+ )
+ (set_local $$20
+ (get_local $$arglist_current5)
+ )
+ (set_local $$21
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded45
- (i32.sub
- (get_local $$expanded46)
- (i32.const 1)
- )
+ )
+ (set_local $$expanded42
+ (get_local $$21)
+ )
+ (set_local $$expanded41
+ (i32.sub
+ (get_local $$expanded42)
+ (i32.const 1)
)
- (set_local $$expanded44
- (i32.xor
- (get_local $$expanded45)
- (i32.const -1)
- )
+ )
+ (set_local $$22
+ (i32.add
+ (get_local $$20)
+ (get_local $$expanded41)
)
- (set_local $$24
- (i32.and
- (get_local $$22)
- (get_local $$expanded44)
- )
+ )
+ (set_local $$23
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$25
- (get_local $$24)
+ )
+ (set_local $$expanded46
+ (get_local $$23)
+ )
+ (set_local $$expanded45
+ (i32.sub
+ (get_local $$expanded46)
+ (i32.const 1)
)
- (set_local $$26
- (i32.load align=4
- (get_local $$25)
- )
+ )
+ (set_local $$expanded44
+ (i32.xor
+ (get_local $$expanded45)
+ (i32.const -1)
)
- (set_local $$arglist_next6
- (i32.add
- (get_local $$25)
- (i32.const 4)
- )
+ )
+ (set_local $$24
+ (i32.and
+ (get_local $$22)
+ (get_local $$expanded44)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next6)
+ )
+ (set_local $$25
+ (get_local $$24)
+ )
+ (set_local $$26
+ (i32.load align=4
+ (get_local $$25)
)
- (set_local $$27
- (get_local $$arg)
+ )
+ (set_local $$arglist_next6
+ (i32.add
+ (get_local $$25)
+ (i32.const 4)
)
- (set_local $$28
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next6)
+ )
+ (set_local $$27
+ (get_local $$arg)
+ )
+ (set_local $$28
+ (get_local $$27)
+ )
+ (i32.store align=4
+ (get_local $$28)
+ (get_local $$26)
+ )
+ (set_local $$29
+ (i32.add
(get_local $$27)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$28)
- (get_local $$26)
- )
- (set_local $$29
- (i32.add
- (get_local $$27)
- (i32.const 4)
- )
- )
- (set_local $$30
- (get_local $$29)
- )
- (i32.store align=4
- (get_local $$30)
- (i32.const 0)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$30
+ (get_local $$29)
+ )
+ (i32.store align=4
+ (get_local $$30)
+ (i32.const 0)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$5
- (block
- (set_local $$arglist_current8
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$31
- (get_local $$arglist_current8)
- )
- (set_local $$32
- (i32.add
- (i32.const 0)
- (i32.const 8)
- )
- )
- (set_local $$expanded49
- (get_local $$32)
- )
- (set_local $$expanded48
- (i32.sub
- (get_local $$expanded49)
- (i32.const 1)
- )
+ )
+ (case $switch-case$5
+ (block
+ (set_local $$arglist_current8
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$33
- (i32.add
- (get_local $$31)
- (get_local $$expanded48)
- )
+ )
+ (set_local $$31
+ (get_local $$arglist_current8)
+ )
+ (set_local $$32
+ (i32.add
+ (i32.const 0)
+ (i32.const 8)
)
- (set_local $$34
- (i32.add
- (i32.const 0)
- (i32.const 8)
- )
+ )
+ (set_local $$expanded49
+ (get_local $$32)
+ )
+ (set_local $$expanded48
+ (i32.sub
+ (get_local $$expanded49)
+ (i32.const 1)
)
- (set_local $$expanded53
- (get_local $$34)
+ )
+ (set_local $$33
+ (i32.add
+ (get_local $$31)
+ (get_local $$expanded48)
)
- (set_local $$expanded52
- (i32.sub
- (get_local $$expanded53)
- (i32.const 1)
- )
+ )
+ (set_local $$34
+ (i32.add
+ (i32.const 0)
+ (i32.const 8)
)
- (set_local $$expanded51
- (i32.xor
- (get_local $$expanded52)
- (i32.const -1)
- )
+ )
+ (set_local $$expanded53
+ (get_local $$34)
+ )
+ (set_local $$expanded52
+ (i32.sub
+ (get_local $$expanded53)
+ (i32.const 1)
)
- (set_local $$35
- (i32.and
- (get_local $$33)
- (get_local $$expanded51)
- )
+ )
+ (set_local $$expanded51
+ (i32.xor
+ (get_local $$expanded52)
+ (i32.const -1)
)
- (set_local $$36
- (get_local $$35)
+ )
+ (set_local $$35
+ (i32.and
+ (get_local $$33)
+ (get_local $$expanded51)
)
- (set_local $$37
- (get_local $$36)
+ )
+ (set_local $$36
+ (get_local $$35)
+ )
+ (set_local $$37
+ (get_local $$36)
+ )
+ (set_local $$38
+ (get_local $$37)
+ )
+ (set_local $$39
+ (i32.load align=4
+ (get_local $$38)
)
- (set_local $$38
+ )
+ (set_local $$40
+ (i32.add
(get_local $$37)
+ (i32.const 4)
)
- (set_local $$39
- (i32.load align=4
- (get_local $$38)
- )
- )
- (set_local $$40
- (i32.add
- (get_local $$37)
- (i32.const 4)
- )
- )
- (set_local $$41
- (get_local $$40)
- )
- (set_local $$42
- (i32.load align=4
- (get_local $$41)
- )
- )
- (set_local $$arglist_next9
- (i32.add
- (get_local $$36)
- (i32.const 8)
- )
- )
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next9)
+ )
+ (set_local $$41
+ (get_local $$40)
+ )
+ (set_local $$42
+ (i32.load align=4
+ (get_local $$41)
)
- (set_local $$43
- (get_local $$arg)
+ )
+ (set_local $$arglist_next9
+ (i32.add
+ (get_local $$36)
+ (i32.const 8)
)
- (set_local $$44
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next9)
+ )
+ (set_local $$43
+ (get_local $$arg)
+ )
+ (set_local $$44
+ (get_local $$43)
+ )
+ (i32.store align=4
+ (get_local $$44)
+ (get_local $$39)
+ )
+ (set_local $$45
+ (i32.add
(get_local $$43)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$44)
- (get_local $$39)
- )
- (set_local $$45
- (i32.add
- (get_local $$43)
- (i32.const 4)
- )
- )
- (set_local $$46
- (get_local $$45)
- )
- (i32.store align=4
- (get_local $$46)
- (get_local $$42)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$46
+ (get_local $$45)
+ )
+ (i32.store align=4
+ (get_local $$46)
+ (get_local $$42)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$6
- (block
- (set_local $$arglist_current11
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$47
- (get_local $$arglist_current11)
- )
- (set_local $$48
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded56
- (get_local $$48)
- )
- (set_local $$expanded55
- (i32.sub
- (get_local $$expanded56)
- (i32.const 1)
- )
- )
- (set_local $$49
- (i32.add
- (get_local $$47)
- (get_local $$expanded55)
- )
+ )
+ (case $switch-case$6
+ (block
+ (set_local $$arglist_current11
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$50
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ )
+ (set_local $$47
+ (get_local $$arglist_current11)
+ )
+ (set_local $$48
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded60
- (get_local $$50)
+ )
+ (set_local $$expanded56
+ (get_local $$48)
+ )
+ (set_local $$expanded55
+ (i32.sub
+ (get_local $$expanded56)
+ (i32.const 1)
)
- (set_local $$expanded59
- (i32.sub
- (get_local $$expanded60)
- (i32.const 1)
- )
+ )
+ (set_local $$49
+ (i32.add
+ (get_local $$47)
+ (get_local $$expanded55)
)
- (set_local $$expanded58
- (i32.xor
- (get_local $$expanded59)
- (i32.const -1)
- )
+ )
+ (set_local $$50
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$51
- (i32.and
- (get_local $$49)
- (get_local $$expanded58)
- )
+ )
+ (set_local $$expanded60
+ (get_local $$50)
+ )
+ (set_local $$expanded59
+ (i32.sub
+ (get_local $$expanded60)
+ (i32.const 1)
)
- (set_local $$52
- (get_local $$51)
+ )
+ (set_local $$expanded58
+ (i32.xor
+ (get_local $$expanded59)
+ (i32.const -1)
)
- (set_local $$53
- (i32.load align=4
- (get_local $$52)
- )
+ )
+ (set_local $$51
+ (i32.and
+ (get_local $$49)
+ (get_local $$expanded58)
)
- (set_local $$arglist_next12
- (i32.add
- (get_local $$52)
- (i32.const 4)
- )
+ )
+ (set_local $$52
+ (get_local $$51)
+ )
+ (set_local $$53
+ (i32.load align=4
+ (get_local $$52)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next12)
+ )
+ (set_local $$arglist_next12
+ (i32.add
+ (get_local $$52)
+ (i32.const 4)
)
- (set_local $$conv12
- (i32.and
- (get_local $$53)
- (i32.const 65535)
- )
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next12)
+ )
+ (set_local $$conv12
+ (i32.and
+ (get_local $$53)
+ (i32.const 65535)
)
- (set_local $$54
- (i32.shr_s
- (i32.shl
- (get_local $$conv12)
- (i32.const 16)
- )
+ )
+ (set_local $$54
+ (i32.shr_s
+ (i32.shl
+ (get_local $$conv12)
(i32.const 16)
)
+ (i32.const 16)
)
- (set_local $$55
- (i32.lt_s
- (get_local $$54)
- (i32.const 0)
- )
+ )
+ (set_local $$55
+ (i32.lt_s
+ (get_local $$54)
+ (i32.const 0)
)
- (set_local $$56
- (i32.shr_s
- (i32.shl
- (get_local $$55)
- (i32.const 31)
- )
+ )
+ (set_local $$56
+ (i32.shr_s
+ (i32.shl
+ (get_local $$55)
(i32.const 31)
)
+ (i32.const 31)
)
- (set_local $$57
- (get_local $$arg)
- )
- (set_local $$58
+ )
+ (set_local $$57
+ (get_local $$arg)
+ )
+ (set_local $$58
+ (get_local $$57)
+ )
+ (i32.store align=4
+ (get_local $$58)
+ (get_local $$54)
+ )
+ (set_local $$59
+ (i32.add
(get_local $$57)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$58)
- (get_local $$54)
- )
- (set_local $$59
- (i32.add
- (get_local $$57)
- (i32.const 4)
- )
- )
- (set_local $$60
- (get_local $$59)
- )
- (i32.store align=4
- (get_local $$60)
- (get_local $$56)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$60
+ (get_local $$59)
+ )
+ (i32.store align=4
+ (get_local $$60)
+ (get_local $$56)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$7
- (block
- (set_local $$arglist_current14
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$61
- (get_local $$arglist_current14)
- )
- (set_local $$62
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded63
- (get_local $$62)
- )
- (set_local $$expanded62
- (i32.sub
- (get_local $$expanded63)
- (i32.const 1)
- )
- )
- (set_local $$63
- (i32.add
- (get_local $$61)
- (get_local $$expanded62)
- )
- )
- (set_local $$64
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ )
+ (case $switch-case$7
+ (block
+ (set_local $$arglist_current14
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$expanded67
- (get_local $$64)
+ )
+ (set_local $$61
+ (get_local $$arglist_current14)
+ )
+ (set_local $$62
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded66
- (i32.sub
- (get_local $$expanded67)
- (i32.const 1)
- )
+ )
+ (set_local $$expanded63
+ (get_local $$62)
+ )
+ (set_local $$expanded62
+ (i32.sub
+ (get_local $$expanded63)
+ (i32.const 1)
)
- (set_local $$expanded65
- (i32.xor
- (get_local $$expanded66)
- (i32.const -1)
- )
+ )
+ (set_local $$63
+ (i32.add
+ (get_local $$61)
+ (get_local $$expanded62)
)
- (set_local $$65
- (i32.and
- (get_local $$63)
- (get_local $$expanded65)
- )
+ )
+ (set_local $$64
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$66
- (get_local $$65)
+ )
+ (set_local $$expanded67
+ (get_local $$64)
+ )
+ (set_local $$expanded66
+ (i32.sub
+ (get_local $$expanded67)
+ (i32.const 1)
)
- (set_local $$67
- (i32.load align=4
- (get_local $$66)
- )
+ )
+ (set_local $$expanded65
+ (i32.xor
+ (get_local $$expanded66)
+ (i32.const -1)
)
- (set_local $$arglist_next15
- (i32.add
- (get_local $$66)
- (i32.const 4)
- )
+ )
+ (set_local $$65
+ (i32.and
+ (get_local $$63)
+ (get_local $$expanded65)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next15)
+ )
+ (set_local $$66
+ (get_local $$65)
+ )
+ (set_local $$67
+ (i32.load align=4
+ (get_local $$66)
)
- (set_local $$conv17$mask
- (i32.and
- (get_local $$67)
- (i32.const 65535)
- )
+ )
+ (set_local $$arglist_next15
+ (i32.add
+ (get_local $$66)
+ (i32.const 4)
)
- (set_local $$68
- (get_local $$arg)
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next15)
+ )
+ (set_local $$conv17$mask
+ (i32.and
+ (get_local $$67)
+ (i32.const 65535)
)
- (set_local $$69
+ )
+ (set_local $$68
+ (get_local $$arg)
+ )
+ (set_local $$69
+ (get_local $$68)
+ )
+ (i32.store align=4
+ (get_local $$69)
+ (get_local $$conv17$mask)
+ )
+ (set_local $$70
+ (i32.add
(get_local $$68)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$69)
- (get_local $$conv17$mask)
- )
- (set_local $$70
- (i32.add
- (get_local $$68)
- (i32.const 4)
- )
- )
- (set_local $$71
- (get_local $$70)
- )
- (i32.store align=4
- (get_local $$71)
- (i32.const 0)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$71
+ (get_local $$70)
+ )
+ (i32.store align=4
+ (get_local $$71)
+ (i32.const 0)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$8
- (block
- (set_local $$arglist_current17
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$72
- (get_local $$arglist_current17)
- )
- (set_local $$73
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded70
- (get_local $$73)
- )
- (set_local $$expanded69
- (i32.sub
- (get_local $$expanded70)
- (i32.const 1)
- )
- )
- (set_local $$74
- (i32.add
- (get_local $$72)
- (get_local $$expanded69)
- )
+ )
+ (case $switch-case$8
+ (block
+ (set_local $$arglist_current17
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$75
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ )
+ (set_local $$72
+ (get_local $$arglist_current17)
+ )
+ (set_local $$73
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded74
- (get_local $$75)
+ )
+ (set_local $$expanded70
+ (get_local $$73)
+ )
+ (set_local $$expanded69
+ (i32.sub
+ (get_local $$expanded70)
+ (i32.const 1)
)
- (set_local $$expanded73
- (i32.sub
- (get_local $$expanded74)
- (i32.const 1)
- )
+ )
+ (set_local $$74
+ (i32.add
+ (get_local $$72)
+ (get_local $$expanded69)
)
- (set_local $$expanded72
- (i32.xor
- (get_local $$expanded73)
- (i32.const -1)
- )
+ )
+ (set_local $$75
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$76
- (i32.and
- (get_local $$74)
- (get_local $$expanded72)
- )
+ )
+ (set_local $$expanded74
+ (get_local $$75)
+ )
+ (set_local $$expanded73
+ (i32.sub
+ (get_local $$expanded74)
+ (i32.const 1)
)
- (set_local $$77
- (get_local $$76)
+ )
+ (set_local $$expanded72
+ (i32.xor
+ (get_local $$expanded73)
+ (i32.const -1)
)
- (set_local $$78
- (i32.load align=4
- (get_local $$77)
- )
+ )
+ (set_local $$76
+ (i32.and
+ (get_local $$74)
+ (get_local $$expanded72)
)
- (set_local $$arglist_next18
- (i32.add
- (get_local $$77)
- (i32.const 4)
- )
+ )
+ (set_local $$77
+ (get_local $$76)
+ )
+ (set_local $$78
+ (i32.load align=4
+ (get_local $$77)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next18)
+ )
+ (set_local $$arglist_next18
+ (i32.add
+ (get_local $$77)
+ (i32.const 4)
)
- (set_local $$conv22
- (i32.and
- (get_local $$78)
- (i32.const 255)
- )
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next18)
+ )
+ (set_local $$conv22
+ (i32.and
+ (get_local $$78)
+ (i32.const 255)
)
- (set_local $$79
- (i32.shr_s
- (i32.shl
- (get_local $$conv22)
- (i32.const 24)
- )
+ )
+ (set_local $$79
+ (i32.shr_s
+ (i32.shl
+ (get_local $$conv22)
(i32.const 24)
)
+ (i32.const 24)
)
- (set_local $$80
- (i32.lt_s
- (get_local $$79)
- (i32.const 0)
- )
+ )
+ (set_local $$80
+ (i32.lt_s
+ (get_local $$79)
+ (i32.const 0)
)
- (set_local $$81
- (i32.shr_s
- (i32.shl
- (get_local $$80)
- (i32.const 31)
- )
+ )
+ (set_local $$81
+ (i32.shr_s
+ (i32.shl
+ (get_local $$80)
(i32.const 31)
)
+ (i32.const 31)
)
- (set_local $$82
- (get_local $$arg)
- )
- (set_local $$83
+ )
+ (set_local $$82
+ (get_local $$arg)
+ )
+ (set_local $$83
+ (get_local $$82)
+ )
+ (i32.store align=4
+ (get_local $$83)
+ (get_local $$79)
+ )
+ (set_local $$84
+ (i32.add
(get_local $$82)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$83)
- (get_local $$79)
- )
- (set_local $$84
- (i32.add
- (get_local $$82)
- (i32.const 4)
- )
- )
- (set_local $$85
- (get_local $$84)
- )
- (i32.store align=4
- (get_local $$85)
- (get_local $$81)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$85
+ (get_local $$84)
+ )
+ (i32.store align=4
+ (get_local $$85)
+ (get_local $$81)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$9
- (block
- (set_local $$arglist_current20
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$86
- (get_local $$arglist_current20)
- )
- (set_local $$87
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
- )
- (set_local $$expanded77
- (get_local $$87)
- )
- (set_local $$expanded76
- (i32.sub
- (get_local $$expanded77)
- (i32.const 1)
- )
- )
- (set_local $$88
- (i32.add
- (get_local $$86)
- (get_local $$expanded76)
- )
- )
- (set_local $$89
- (i32.add
- (i32.const 0)
- (i32.const 4)
- )
+ )
+ (case $switch-case$9
+ (block
+ (set_local $$arglist_current20
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$expanded81
- (get_local $$89)
+ )
+ (set_local $$86
+ (get_local $$arglist_current20)
+ )
+ (set_local $$87
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$expanded80
- (i32.sub
- (get_local $$expanded81)
- (i32.const 1)
- )
+ )
+ (set_local $$expanded77
+ (get_local $$87)
+ )
+ (set_local $$expanded76
+ (i32.sub
+ (get_local $$expanded77)
+ (i32.const 1)
)
- (set_local $$expanded79
- (i32.xor
- (get_local $$expanded80)
- (i32.const -1)
- )
+ )
+ (set_local $$88
+ (i32.add
+ (get_local $$86)
+ (get_local $$expanded76)
)
- (set_local $$90
- (i32.and
- (get_local $$88)
- (get_local $$expanded79)
- )
+ )
+ (set_local $$89
+ (i32.add
+ (i32.const 0)
+ (i32.const 4)
)
- (set_local $$91
- (get_local $$90)
+ )
+ (set_local $$expanded81
+ (get_local $$89)
+ )
+ (set_local $$expanded80
+ (i32.sub
+ (get_local $$expanded81)
+ (i32.const 1)
)
- (set_local $$92
- (i32.load align=4
- (get_local $$91)
- )
+ )
+ (set_local $$expanded79
+ (i32.xor
+ (get_local $$expanded80)
+ (i32.const -1)
)
- (set_local $$arglist_next21
- (i32.add
- (get_local $$91)
- (i32.const 4)
- )
+ )
+ (set_local $$90
+ (i32.and
+ (get_local $$88)
+ (get_local $$expanded79)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next21)
+ )
+ (set_local $$91
+ (get_local $$90)
+ )
+ (set_local $$92
+ (i32.load align=4
+ (get_local $$91)
)
- (set_local $$conv27$mask
- (i32.and
- (get_local $$92)
- (i32.const 255)
- )
+ )
+ (set_local $$arglist_next21
+ (i32.add
+ (get_local $$91)
+ (i32.const 4)
)
- (set_local $$93
- (get_local $$arg)
+ )
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next21)
+ )
+ (set_local $$conv27$mask
+ (i32.and
+ (get_local $$92)
+ (i32.const 255)
)
- (set_local $$94
+ )
+ (set_local $$93
+ (get_local $$arg)
+ )
+ (set_local $$94
+ (get_local $$93)
+ )
+ (i32.store align=4
+ (get_local $$94)
+ (get_local $$conv27$mask)
+ )
+ (set_local $$95
+ (i32.add
(get_local $$93)
+ (i32.const 4)
)
- (i32.store align=4
- (get_local $$94)
- (get_local $$conv27$mask)
- )
- (set_local $$95
- (i32.add
- (get_local $$93)
- (i32.const 4)
- )
- )
- (set_local $$96
- (get_local $$95)
- )
- (i32.store align=4
- (get_local $$96)
- (i32.const 0)
- )
- (br $label$break$L1)
- (br $switch$1)
)
+ (set_local $$96
+ (get_local $$95)
+ )
+ (i32.store align=4
+ (get_local $$96)
+ (i32.const 0)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$10
- (block
- (set_local $$arglist_current23
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$97
- (get_local $$arglist_current23)
- )
- (set_local $$98
- (i32.add
- (i32.const 0)
- (i32.const 8)
- )
- )
- (set_local $$expanded84
- (get_local $$98)
- )
- (set_local $$expanded83
- (i32.sub
- (get_local $$expanded84)
- (i32.const 1)
- )
- )
- (set_local $$99
- (i32.add
- (get_local $$97)
- (get_local $$expanded83)
- )
- )
- (set_local $$100
- (i32.add
- (i32.const 0)
- (i32.const 8)
- )
+ )
+ (case $switch-case$10
+ (block
+ (set_local $$arglist_current23
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$expanded88
- (get_local $$100)
+ )
+ (set_local $$97
+ (get_local $$arglist_current23)
+ )
+ (set_local $$98
+ (i32.add
+ (i32.const 0)
+ (i32.const 8)
)
- (set_local $$expanded87
- (i32.sub
- (get_local $$expanded88)
- (i32.const 1)
- )
+ )
+ (set_local $$expanded84
+ (get_local $$98)
+ )
+ (set_local $$expanded83
+ (i32.sub
+ (get_local $$expanded84)
+ (i32.const 1)
)
- (set_local $$expanded86
- (i32.xor
- (get_local $$expanded87)
- (i32.const -1)
- )
+ )
+ (set_local $$99
+ (i32.add
+ (get_local $$97)
+ (get_local $$expanded83)
)
- (set_local $$101
- (i32.and
- (get_local $$99)
- (get_local $$expanded86)
- )
+ )
+ (set_local $$100
+ (i32.add
+ (i32.const 0)
+ (i32.const 8)
)
- (set_local $$102
- (get_local $$101)
+ )
+ (set_local $$expanded88
+ (get_local $$100)
+ )
+ (set_local $$expanded87
+ (i32.sub
+ (get_local $$expanded88)
+ (i32.const 1)
)
- (set_local $$103
- (f64.load align=8
- (get_local $$102)
- )
+ )
+ (set_local $$expanded86
+ (i32.xor
+ (get_local $$expanded87)
+ (i32.const -1)
)
- (set_local $$arglist_next24
- (i32.add
- (get_local $$102)
- (i32.const 8)
- )
+ )
+ (set_local $$101
+ (i32.and
+ (get_local $$99)
+ (get_local $$expanded86)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next24)
+ )
+ (set_local $$102
+ (get_local $$101)
+ )
+ (set_local $$103
+ (f64.load align=8
+ (get_local $$102)
)
- (f64.store align=8
- (get_local $$arg)
- (get_local $$103)
+ )
+ (set_local $$arglist_next24
+ (i32.add
+ (get_local $$102)
+ (i32.const 8)
)
- (br $label$break$L1)
- (br $switch$1)
)
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next24)
+ )
+ (f64.store align=8
+ (get_local $$arg)
+ (get_local $$103)
+ )
+ (br $label$break$L1)
+ (br $switch$1)
)
- (case $switch-case$11
- (block
- (set_local $$arglist_current26
- (i32.load align=4
- (get_local $$ap)
- )
- )
- (set_local $$104
- (get_local $$arglist_current26)
- )
- (set_local $$105
- (i32.add
- (i32.const 0)
- (i32.const 8)
- )
- )
- (set_local $$expanded91
- (get_local $$105)
- )
- (set_local $$expanded90
- (i32.sub
- (get_local $$expanded91)
- (i32.const 1)
- )
- )
- (set_local $$106
- (i32.add
- (get_local $$104)
- (get_local $$expanded90)
- )
- )
- (set_local $$107
- (i32.add
- (i32.const 0)
- (i32.const 8)
- )
+ )
+ (case $switch-case$11
+ (block
+ (set_local $$arglist_current26
+ (i32.load align=4
+ (get_local $$ap)
)
- (set_local $$expanded95
- (get_local $$107)
+ )
+ (set_local $$104
+ (get_local $$arglist_current26)
+ )
+ (set_local $$105
+ (i32.add
+ (i32.const 0)
+ (i32.const 8)
)
- (set_local $$expanded94
- (i32.sub
- (get_local $$expanded95)
- (i32.const 1)
- )
+ )
+ (set_local $$expanded91
+ (get_local $$105)
+ )
+ (set_local $$expanded90
+ (i32.sub
+ (get_local $$expanded91)
+ (i32.const 1)
)
- (set_local $$expanded93
- (i32.xor
- (get_local $$expanded94)
- (i32.const -1)
- )
+ )
+ (set_local $$106
+ (i32.add
+ (get_local $$104)
+ (get_local $$expanded90)
)
- (set_local $$108
- (i32.and
- (get_local $$106)
- (get_local $$expanded93)
- )
+ )
+ (set_local $$107
+ (i32.add
+ (i32.const 0)
+ (i32.const 8)
)
- (set_local $$109
- (get_local $$108)
+ )
+ (set_local $$expanded95
+ (get_local $$107)
+ )
+ (set_local $$expanded94
+ (i32.sub
+ (get_local $$expanded95)
+ (i32.const 1)
)
- (set_local $$110
- (f64.load align=8
- (get_local $$109)
- )
+ )
+ (set_local $$expanded93
+ (i32.xor
+ (get_local $$expanded94)
+ (i32.const -1)
)
- (set_local $$arglist_next27
- (i32.add
- (get_local $$109)
- (i32.const 8)
- )
+ )
+ (set_local $$108
+ (i32.and
+ (get_local $$106)
+ (get_local $$expanded93)
)
- (i32.store align=4
- (get_local $$ap)
- (get_local $$arglist_next27)
+ )
+ (set_local $$109
+ (get_local $$108)
+ )
+ (set_local $$110
+ (f64.load align=8
+ (get_local $$109)
)
- (f64.store align=8
- (get_local $$arg)
- (get_local $$110)
+ )
+ (set_local $$arglist_next27
+ (i32.add
+ (get_local $$109)
+ (i32.const 8)
)
- (br $label$break$L1)
- (br $switch$1)
)
- )
- (case $switch-default$12
+ (i32.store align=4
+ (get_local $$ap)
+ (get_local $$arglist_next27)
+ )
+ (f64.store align=8
+ (get_local $$arg)
+ (get_local $$110)
+ )
(br $label$break$L1)
+ (br $switch$1)
)
)
+ (case $switch-default$12
+ (br $label$break$L1)
+ )
)
)
- (br $topmost)
)
)
(func $_fmt_u (param $$0 i32) (param $$1 i32) (param $$s i32) (result i32)
@@ -16178,228 +16169,225 @@
(local $$tobool$i18 i32)
(local $label i32)
(local $sp i32)
- (block $topmost
- (set_local $sp
+ (set_local $sp
+ (i32.load align=4
+ (i32.const 8)
+ )
+ )
+ (i32.store align=4
+ (i32.const 8)
+ (i32.add
(i32.load align=4
(i32.const 8)
)
+ (i32.const 256)
)
- (i32.store align=4
- (i32.const 8)
- (i32.add
- (i32.load align=4
- (i32.const 8)
- )
- (i32.const 256)
+ )
+ (if
+ (i32.ge_s
+ (i32.load align=4
+ (i32.const 8)
)
- )
- (if
- (i32.ge_s
- (i32.load align=4
- (i32.const 8)
- )
- (i32.load align=4
- (i32.const 16)
- )
+ (i32.load align=4
+ (i32.const 16)
)
- (call_import $abort)
)
- (set_local $$pad
- (get_local $sp)
- )
- (set_local $$and
- (i32.and
- (get_local $$fl)
- (i32.const 73728)
- )
+ (call_import $abort)
+ )
+ (set_local $$pad
+ (get_local $sp)
+ )
+ (set_local $$and
+ (i32.and
+ (get_local $$fl)
+ (i32.const 73728)
)
- (set_local $$tobool
- (i32.eq
- (get_local $$and)
- (i32.const 0)
- )
+ )
+ (set_local $$tobool
+ (i32.eq
+ (get_local $$and)
+ (i32.const 0)
)
- (set_local $$cmp
- (i32.gt_s
- (get_local $$w)
- (get_local $$l)
- )
+ )
+ (set_local $$cmp
+ (i32.gt_s
+ (get_local $$w)
+ (get_local $$l)
)
- (set_local $$or$cond
- (i32.and
- (get_local $$cmp)
- (get_local $$tobool)
- )
+ )
+ (set_local $$or$cond
+ (i32.and
+ (get_local $$cmp)
+ (get_local $$tobool)
)
- (block $do-once$0
- (if
- (get_local $$or$cond)
- (block
- (set_local $$sub
- (i32.sub
- (get_local $$w)
- (get_local $$l)
- )
+ )
+ (block $do-once$0
+ (if
+ (get_local $$or$cond)
+ (block
+ (set_local $$sub
+ (i32.sub
+ (get_local $$w)
+ (get_local $$l)
)
- (set_local $$cmp1
- (i32.gt_u
- (get_local $$sub)
- (i32.const 256)
- )
+ )
+ (set_local $$cmp1
+ (i32.gt_u
+ (get_local $$sub)
+ (i32.const 256)
)
- (set_local $$cond
- (if_else
- (get_local $$cmp1)
- (i32.const 256)
- (get_local $$sub)
- )
+ )
+ (set_local $$cond
+ (if_else
+ (get_local $$cmp1)
+ (i32.const 256)
+ (get_local $$sub)
)
- (call $_memset
- (get_local $$pad)
- (get_local $$c)
- (get_local $$cond)
+ )
+ (call $_memset
+ (get_local $$pad)
+ (get_local $$c)
+ (get_local $$cond)
+ )
+ (set_local $$cmp3$14
+ (i32.gt_u
+ (get_local $$sub)
+ (i32.const 255)
)
- (set_local $$cmp3$14
- (i32.gt_u
- (get_local $$sub)
- (i32.const 255)
- )
+ )
+ (set_local $$0
+ (i32.load align=4
+ (get_local $$f)
)
- (set_local $$0
- (i32.load align=4
- (get_local $$f)
- )
+ )
+ (set_local $$and$i$15
+ (i32.and
+ (get_local $$0)
+ (i32.const 32)
)
- (set_local $$and$i$15
- (i32.and
+ )
+ (set_local $$tobool$i$16
+ (i32.eq
+ (get_local $$and$i$15)
+ (i32.const 0)
+ )
+ )
+ (if_else
+ (get_local $$cmp3$14)
+ (block
+ (set_local $$1
+ (i32.sub
+ (get_local $$w)
+ (get_local $$l)
+ )
+ )
+ (set_local $$4
(get_local $$0)
- (i32.const 32)
)
- )
- (set_local $$tobool$i$16
- (i32.eq
- (get_local $$and$i$15)
- (i32.const 0)
+ (set_local $$l$addr$017
+ (get_local $$sub)
)
- )
- (if_else
- (get_local $$cmp3$14)
- (block
- (set_local $$1
- (i32.sub
- (get_local $$w)
- (get_local $$l)
- )
- )
- (set_local $$4
- (get_local $$0)
- )
- (set_local $$l$addr$017
- (get_local $$sub)
- )
- (set_local $$tobool$i18
- (get_local $$tobool$i$16)
- )
- (loop $while-out$1 $while-in$2
- (block
- (if_else
- (get_local $$tobool$i18)
- (block
- (call $___fwritex
- (get_local $$pad)
- (i32.const 256)
+ (set_local $$tobool$i18
+ (get_local $$tobool$i$16)
+ )
+ (loop $while-out$1 $while-in$2
+ (block
+ (if_else
+ (get_local $$tobool$i18)
+ (block
+ (call $___fwritex
+ (get_local $$pad)
+ (i32.const 256)
+ (get_local $$f)
+ )
+ (set_local $$$pre
+ (i32.load align=4
(get_local $$f)
)
- (set_local $$$pre
- (i32.load align=4
- (get_local $$f)
- )
- )
- (set_local $$2
- (get_local $$$pre)
- )
)
(set_local $$2
- (get_local $$4)
+ (get_local $$$pre)
)
)
- (set_local $$sub5
- (i32.add
- (get_local $$l$addr$017)
- (i32.const -256)
- )
+ (set_local $$2
+ (get_local $$4)
)
- (set_local $$cmp3
- (i32.gt_u
- (get_local $$sub5)
- (i32.const 255)
- )
+ )
+ (set_local $$sub5
+ (i32.add
+ (get_local $$l$addr$017)
+ (i32.const -256)
)
- (set_local $$and$i
- (i32.and
+ )
+ (set_local $$cmp3
+ (i32.gt_u
+ (get_local $$sub5)
+ (i32.const 255)
+ )
+ )
+ (set_local $$and$i
+ (i32.and
+ (get_local $$2)
+ (i32.const 32)
+ )
+ )
+ (set_local $$tobool$i
+ (i32.eq
+ (get_local $$and$i)
+ (i32.const 0)
+ )
+ )
+ (if_else
+ (get_local $$cmp3)
+ (block
+ (set_local $$4
(get_local $$2)
- (i32.const 32)
)
- )
- (set_local $$tobool$i
- (i32.eq
- (get_local $$and$i)
- (i32.const 0)
+ (set_local $$l$addr$017
+ (get_local $$sub5)
)
- )
- (if_else
- (get_local $$cmp3)
- (block
- (set_local $$4
- (get_local $$2)
- )
- (set_local $$l$addr$017
- (get_local $$sub5)
- )
- (set_local $$tobool$i18
- (get_local $$tobool$i)
- )
+ (set_local $$tobool$i18
+ (get_local $$tobool$i)
)
- (br $while-out$1)
)
- (br $while-in$2)
- )
- )
- (set_local $$3
- (i32.and
- (get_local $$1)
- (i32.const 255)
+ (br $while-out$1)
)
+ (br $while-in$2)
)
- (if_else
- (get_local $$tobool$i)
- (set_local $$l$addr$0$lcssa21
- (get_local $$3)
- )
- (br $do-once$0)
+ )
+ (set_local $$3
+ (i32.and
+ (get_local $$1)
+ (i32.const 255)
)
)
(if_else
- (get_local $$tobool$i$16)
+ (get_local $$tobool$i)
(set_local $$l$addr$0$lcssa21
- (get_local $$sub)
+ (get_local $$3)
)
(br $do-once$0)
)
)
- (call $___fwritex
- (get_local $$pad)
- (get_local $$l$addr$0$lcssa21)
- (get_local $$f)
+ (if_else
+ (get_local $$tobool$i$16)
+ (set_local $$l$addr$0$lcssa21
+ (get_local $$sub)
+ )
+ (br $do-once$0)
)
)
+ (call $___fwritex
+ (get_local $$pad)
+ (get_local $$l$addr$0$lcssa21)
+ (get_local $$f)
+ )
)
)
- (i32.store align=4
- (i32.const 8)
- (get_local $sp)
- )
- (br $topmost)
+ )
+ (i32.store align=4
+ (i32.const 8)
+ (get_local $sp)
)
)
(func $_malloc (param $$bytes i32) (result i32)
@@ -30407,7 +30395,6 @@
(i32.const 208)
(i32.const -1)
)
- (br $topmost)
)
)
(func $runPostSets
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt
new file mode 100644
index 000000000..b42347fc3
--- /dev/null
+++ b/test/passes/remove-unused-brs.txt
@@ -0,0 +1,92 @@
+(module
+ (memory 16777216 16777216)
+ (func $b0-yes (param $i1 i32)
+ (block $topmost
+ (br $topmost)
+ )
+ )
+ (func $b1 (param $i1 i32)
+ (block $topmost
+ (br $topmost
+ (i32.const 0)
+ )
+ )
+ )
+ (func $b2 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $topmost)
+ )
+ )
+ )
+ (func $b3-yes (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $inner)
+ )
+ )
+ )
+ (func $b4 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $topmost
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $b5 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $inner
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
+(module
+ (memory 16777216 16777216)
+ (func $b0-yes (param $i1 i32)
+ (block $topmost
+ )
+ )
+ (func $b1 (param $i1 i32)
+ (block $topmost
+ (br $topmost
+ (i32.const 0)
+ )
+ )
+ )
+ (func $b2 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $topmost)
+ )
+ )
+ )
+ (func $b3-yes (param $i1 i32)
+ (block $topmost
+ (block $inner
+ )
+ )
+ )
+ (func $b4 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $topmost
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $b5 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $inner
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast
new file mode 100644
index 000000000..e03ba8847
--- /dev/null
+++ b/test/passes/remove-unused-brs.wast
@@ -0,0 +1,48 @@
+(module
+ (memory 16777216 16777216)
+ (func $b0-yes (param $i1 i32)
+ (block $topmost
+ (br $topmost)
+ )
+ )
+ (func $b1 (param $i1 i32)
+ (block $topmost
+ (br $topmost
+ (i32.const 0)
+ )
+ )
+ )
+ (func $b2 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $topmost)
+ )
+ )
+ )
+ (func $b3-yes (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $inner)
+ )
+ )
+ )
+ (func $b4 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $topmost
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ (func $b5 (param $i1 i32)
+ (block $topmost
+ (block $inner
+ (br $inner
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
+
diff --git a/test/unit.fromasm b/test/unit.fromasm
index f6ab08ec7..0eb3bcce4 100644
--- a/test/unit.fromasm
+++ b/test/unit.fromasm
@@ -245,9 +245,6 @@
)
)
(func $blocker
- (block $label$break$L
- (br $label$break$L)
- )
)
(func $frem (result f64)
(call_import $f64-rem