diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-04 14:31:23 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-04 14:32:40 -0800 |
commit | 3d9dd361a2d7f5d3a26d0c95ea9f7c6cdd502ceb (patch) | |
tree | de36eb46bd4678a5e58065309c2f01c7f5c26bd9 | |
parent | 3f57e66627adff9e6ff5ef4ce4533f69b37e57c2 (diff) | |
download | binaryen-3d9dd361a2d7f5d3a26d0c95ea9f7c6cdd502ceb.tar.gz binaryen-3d9dd361a2d7f5d3a26d0c95ea9f7c6cdd502ceb.tar.bz2 binaryen-3d9dd361a2d7f5d3a26d0c95ea9f7c6cdd502ceb.zip |
use a br_if on do-while loops
-rw-r--r-- | src/asm2wasm.h | 6 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.wast | 12 | ||||
-rw-r--r-- | test/emcc_hello_world.wast | 4 |
3 files changed, 10 insertions, 12 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index 7785ece5a..27f7edffb 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -1333,11 +1333,9 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { breakStack.pop_back(); Break *continuer = allocator.alloc<Break>(); continuer->name = in; - If *condition = allocator.alloc<If>(); - condition->condition = process(ast[1]); - condition->ifTrue = continuer; + continuer->condition = process(ast[1]); Block *block = blockify(ret->body); - block->list.push_back(condition); + block->list.push_back(continuer); ret->body = block; return ret; } else if (what == LABEL) { diff --git a/test/emcc_O2_hello_world.wast b/test/emcc_O2_hello_world.wast index 66d772963..5be2f095c 100644 --- a/test/emcc_O2_hello_world.wast +++ b/test/emcc_O2_hello_world.wast @@ -4652,12 +4652,12 @@ ) ) ) - (if + (br_if (i32.ne (get_local $i63) (i32.const 0) ) - (br $do-in$29) + $do-in$29 ) ) ) @@ -6652,7 +6652,7 @@ (get_local $i63) (i32.const 7) ) - (if + (br_if (i32.lt_u (i32.shr_u (i32.add @@ -6666,7 +6666,7 @@ (i32.const 0) ) ) - (br $do-in$47) + $do-in$47 ) ) ) @@ -7350,12 +7350,12 @@ (i32.const 1) ) ) - (if + (br_if (i32.ne (get_local $i5) (i32.const 32) ) - (br $do-in$51) + $do-in$51 ) ) ) diff --git a/test/emcc_hello_world.wast b/test/emcc_hello_world.wast index d33811b80..2edc07d4d 100644 --- a/test/emcc_hello_world.wast +++ b/test/emcc_hello_world.wast @@ -2438,12 +2438,12 @@ (i32.const 4) ) ) - (if + (br_if (i32.lt_s (get_local $dest) (get_local $stop) ) - (br $do-in$1) + $do-in$1 ) ) ) |