summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-12 10:15:44 -0500
committerAlon Zakai <alonzakai@gmail.com>2015-12-12 10:15:44 -0500
commit9918cd1666e5083286d4db6ea96f1d35b6a59a3b (patch)
tree81d93a674d141a6b8820ac4cb46361136966f6cb
parent56fc0562393cbeab434c3caa3a7cbdfef158c73f (diff)
downloadbinaryen-9918cd1666e5083286d4db6ea96f1d35b6a59a3b.tar.gz
binaryen-9918cd1666e5083286d4db6ea96f1d35b6a59a3b.tar.bz2
binaryen-9918cd1666e5083286d4db6ea96f1d35b6a59a3b.zip
add cfg-stackify.s
-rwxr-xr-xauto_update_tests.py2
-rwxr-xr-xcheck.py2
-rw-r--r--test/dot_s/cfg-stackify.wast464
3 files changed, 466 insertions, 2 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index c47d52f21..cfb2d9e63 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -32,7 +32,7 @@ for t in sorted(os.listdir('test')):
open(t, 'w').write(actual)
-for s in ['minimal.s', 'basics.s', 'call.s']:
+for s in ['minimal.s', 'basics.s', 'call.s', 'cfg-stackify.s']:
print '..', s
wasm = s.replace('.s', '.wast')
full = os.path.join('test', 'dot_s', s)
diff --git a/check.py b/check.py
index 73b654271..9386e6222 100755
--- a/check.py
+++ b/check.py
@@ -214,7 +214,7 @@ for t in spec_tests:
print '\n[ checking .s testcases... ]\n'
-for s in ['minimal.s', 'basics.s', 'call.s']:
+for s in ['minimal.s', 'basics.s', 'call.s', 'cfg-stackify.s']:
print '..', s
wasm = s.replace('.s', '.wast')
full = os.path.join('test', 'dot_s', s)
diff --git a/test/dot_s/cfg-stackify.wast b/test/dot_s/cfg-stackify.wast
new file mode 100644
index 000000000..79a7cbd98
--- /dev/null
+++ b/test/dot_s/cfg-stackify.wast
@@ -0,0 +1,464 @@
+(module
+ (memory 0 4294967295)
+ (func $test0 (param $$0 i32)
+ (local $$1 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$1
+ (i32.const 0)
+ )
+ (loop $BB0_3 $BB0_1
+ (block
+ (set_local $$1
+ (i32.add
+ (i32.const 1)
+ (get_local $$1)
+ )
+ )
+ (br_if
+ (i32.ge_s
+ (get_local $$0)
+ (get_local $$1)
+ )
+ $BB0_3
+ )
+ (call $something)
+ (br $BB0_1)
+ )
+ )
+ (br $fake_return_waka123)
+ )
+ )
+ )
+ (func $test1 (param $$0 i32)
+ (local $$1 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$1
+ (i32.const 0)
+ )
+ (loop $BB1_3 $BB1_1
+ (block
+ (set_local $$1
+ (i32.add
+ (i32.const 1)
+ (get_local $$1)
+ )
+ )
+ (br_if
+ (i32.ge_s
+ (get_local $$0)
+ (get_local $$1)
+ )
+ $BB1_3
+ )
+ (call $something)
+ (br $BB1_1)
+ )
+ )
+ (br $fake_return_waka123)
+ )
+ )
+ )
+ (func $test2 (param $$0 i32) (param $$1 i32)
+ (block $fake_return_waka123
+ (block
+ (block $BB2_2
+ (br_if
+ (i32.lt_s
+ (i32.const 1)
+ (get_local $$1)
+ )
+ $BB2_2
+ )
+ (loop $BB2_1
+ (block
+ (f64.store align=8
+ (get_local $$0)
+ (f64.mul
+ (f64.load align=8
+ (get_local $$0)
+ )
+ (f64.const 3.2)
+ )
+ )
+ (set_local $$1
+ (i32.add
+ (i32.const -1)
+ (get_local $$1)
+ )
+ )
+ (set_local $$0
+ (i32.add
+ (i32.const 8)
+ (get_local $$0)
+ )
+ )
+ (br_if
+ (get_local $$1)
+ $BB2_1
+ )
+ )
+ )
+ )
+ (br $fake_return_waka123)
+ )
+ )
+ )
+ (func $doublediamond (param $$0 i32) (param $$1 i32) (param $$2 i32) (result i32)
+ (local $$3 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$3
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 0)
+ )
+ )
+ (block $BB3_5
+ (block $BB3_2
+ (br_if
+ (get_local $$0)
+ $BB3_2
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 1)
+ )
+ (br $BB3_5)
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 2)
+ )
+ (block $BB3_4
+ (br_if
+ (get_local $$1)
+ $BB3_4
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 3)
+ )
+ (br $BB3_5)
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 4)
+ )
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 5)
+ )
+ (br $fake_return_waka123
+ (get_local $$3)
+ )
+ )
+ )
+ )
+ (func $triangle (param $$0 i32) (param $$1 i32) (result i32)
+ (local $$2 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$2
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 0)
+ )
+ )
+ (block $BB4_2
+ (br_if
+ (get_local $$1)
+ $BB4_2
+ )
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 1)
+ )
+ )
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 2)
+ )
+ (br $fake_return_waka123
+ (get_local $$2)
+ )
+ )
+ )
+ )
+ (func $diamond (param $$0 i32) (param $$1 i32) (result i32)
+ (local $$2 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$2
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 0)
+ )
+ )
+ (block $BB5_3
+ (block $BB5_2
+ (br_if
+ (get_local $$1)
+ $BB5_2
+ )
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 1)
+ )
+ (br $BB5_3)
+ )
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 2)
+ )
+ )
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 3)
+ )
+ (br $fake_return_waka123
+ (get_local $$2)
+ )
+ )
+ )
+ )
+ (func $single_block (param $$0 i32) (result i32)
+ (block $fake_return_waka123
+ (block
+ (br $fake_return_waka123
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 0)
+ )
+ )
+ )
+ )
+ )
+ (func $minimal_loop (param $$0 i32) (result i32)
+ (block
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 0)
+ )
+ (loop $BB7_2 $BB7_1
+ (block
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 1)
+ )
+ (br $BB7_1)
+ )
+ )
+ )
+ )
+ (func $simple_loop (param $$0 i32) (param $$1 i32) (result i32)
+ (local $$2 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$2
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 0)
+ )
+ )
+ (loop $BB8_2 $BB8_1
+ (block
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 1)
+ )
+ (br_if
+ (i32.eq
+ (i32.const 0)
+ (get_local $$1)
+ )
+ $BB8_1
+ )
+ )
+ )
+ (i32.store align=8
+ (get_local $$0)
+ (i32.const 2)
+ )
+ (br $fake_return_waka123
+ (get_local $$2)
+ )
+ )
+ )
+ )
+ (func $doubletriangle (param $$0 i32) (param $$1 i32) (param $$2 i32) (result i32)
+ (local $$3 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$3
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 0)
+ )
+ )
+ (block $BB9_4
+ (br_if
+ (get_local $$0)
+ $BB9_4
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 2)
+ )
+ (block $BB9_3
+ (br_if
+ (get_local $$1)
+ $BB9_3
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 3)
+ )
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 4)
+ )
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 5)
+ )
+ (br $fake_return_waka123
+ (get_local $$3)
+ )
+ )
+ )
+ )
+ (func $ifelse_earlyexits (param $$0 i32) (param $$1 i32) (param $$2 i32) (result i32)
+ (local $$3 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$3
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 0)
+ )
+ )
+ (block $BB10_4
+ (block $BB10_2
+ (br_if
+ (get_local $$0)
+ $BB10_2
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 1)
+ )
+ (br $BB10_4)
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 2)
+ )
+ (br_if
+ (get_local $$1)
+ $BB10_4
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 3)
+ )
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 4)
+ )
+ (br $fake_return_waka123
+ (get_local $$3)
+ )
+ )
+ )
+ )
+ (func $doublediamond_in_a_loop (param $$0 i32) (param $$1 i32) (param $$2 i32) (result i32)
+ (block
+ (loop $BB11_7 $BB11_1
+ (block
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 0)
+ )
+ (block $BB11_6
+ (block $BB11_3
+ (br_if
+ (get_local $$0)
+ $BB11_3
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 1)
+ )
+ (br $BB11_6)
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 2)
+ )
+ (block $BB11_5
+ (br_if
+ (get_local $$1)
+ $BB11_5
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 3)
+ )
+ (br $BB11_6)
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 4)
+ )
+ )
+ (i32.store align=8
+ (get_local $$2)
+ (i32.const 5)
+ )
+ (br $BB11_1)
+ )
+ )
+ )
+ )
+ (func $test3 (param $$0 i32)
+ (block $fake_return_waka123
+ (block
+ (block $BB12_5
+ (br_if
+ (i32.const 0)
+ $BB12_5
+ )
+ (loop $BB12_4 $BB12_1
+ (block
+ (br_if
+ (get_local $$0)
+ $BB12_4
+ )
+ (loop $BB12_3 $BB12_2
+ (block
+ (br_if
+ (i32.ne
+ (get_local $$0)
+ (get_local $$0)
+ )
+ $BB12_2
+ )
+ )
+ )
+ (call $bar)
+ (br $BB12_1)
+ )
+ )
+ (unreachable)
+ )
+ (br $fake_return_waka123)
+ )
+ )
+ )
+)