Add trapMode option to asc; Disable flatten/ssa passes for now

This commit is contained in:
dcodeIO
2017-12-09 02:38:17 +01:00
parent 6d8de50565
commit 732068e981
16 changed files with 1339 additions and 1550 deletions

View File

@ -1,5 +1,7 @@
(module
(type $v (func))
(import "env" "external" (func $declare/external))
(memory $0 1)
(data (i32.const 4) "\08")
(export "external" (func $declare/external))
(export "memory" (memory $0))
)

View File

@ -1,5 +1,3 @@
declare function external(): void;
// "unexpected false: module function exports must be found"
// see: https://github.com/WebAssembly/binaryen/issues/1325
export { external };

View File

@ -5,15 +5,11 @@
(export "loopDoInDo" (func $do/loopDoInDo))
(export "memory" (memory $0))
(func $do/loopDo (; 0 ;) (type $iv) (param $0 i32)
(local $1 i32)
(set_local $1
(get_local $0)
)
(loop $continue|0
(br_if $continue|0
(tee_local $1
(tee_local $0
(i32.sub
(get_local $1)
(get_local $0)
(i32.const 1)
)
)
@ -21,10 +17,8 @@
)
)
(func $do/loopDoInDo (; 1 ;) (type $iv) (param $0 i32)
(local $1 i32)
(local $2 i32)
(loop $continue|0
(set_local $1
(set_local $0
(i32.sub
(get_local $0)
(i32.const 1)
@ -32,20 +26,16 @@
)
(loop $continue|1
(br_if $continue|1
(tee_local $2
(tee_local $1
(tee_local $0
(i32.sub
(get_local $1)
(i32.const 1)
)
)
(tee_local $0
(i32.sub
(get_local $0)
(i32.const 1)
)
)
)
)
(br_if $continue|0
(get_local $2)
(get_local $0)
)
)
)

View File

@ -100,7 +100,7 @@
(get_local $4)
(get_global $game-of-life/w)
)
(tee_local $3
(tee_local $2
(select
(i32.sub
(get_local $1)
@ -128,7 +128,7 @@
(get_local $4)
(get_global $game-of-life/w)
)
(tee_local $2
(tee_local $3
(select
(i32.const 0)
(i32.add
@ -150,7 +150,7 @@
(get_local $0)
(get_global $game-of-life/w)
)
(get_local $3)
(get_local $2)
)
)
)
@ -160,7 +160,7 @@
(get_local $0)
(get_global $game-of-life/w)
)
(get_local $2)
(get_local $3)
)
)
)
@ -170,7 +170,7 @@
(get_local $5)
(get_global $game-of-life/w)
)
(get_local $3)
(get_local $2)
)
)
)
@ -190,7 +190,7 @@
(get_local $5)
(get_global $game-of-life/w)
)
(get_local $2)
(get_local $3)
)
)
)
@ -205,38 +205,32 @@
(get_local $1)
)
)
(block
(if
(i32.eqz
(tee_local $3
(i32.lt_s
(get_local $2)
(i32.const 2)
)
(if
(if (result i32)
(tee_local $3
(i32.lt_s
(get_local $2)
(i32.const 2)
)
)
(set_local $3
(i32.gt_s
(get_local $2)
(i32.const 3)
)
(get_local $3)
(i32.gt_s
(get_local $2)
(i32.const 3)
)
)
(if
(get_local $3)
(i32.store8
(i32.store8
(i32.add
(i32.add
(i32.add
(get_global $game-of-life/s)
(i32.mul
(get_local $0)
(get_global $game-of-life/w)
)
(get_global $game-of-life/s)
(i32.mul
(get_local $0)
(get_global $game-of-life/w)
)
(get_local $1)
)
(i32.const 0)
(get_local $1)
)
(i32.const 0)
)
)
(if

View File

@ -44,48 +44,46 @@
)
(unreachable)
)
(if
(tee_local $0
(i32.const 1)
)
(set_local $0
(i32.const 2)
)
)
(if
(i32.eqz
(get_local $0)
(if (result i32)
(tee_local $0
(i32.const 1)
)
(tee_local $0
(i32.const 2)
)
(get_local $0)
)
)
(unreachable)
)
(if
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(set_local $1
(f64.const 2)
)
)
(if
(f64.eq
(get_local $1)
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(tee_local $1
(f64.const 2)
)
(get_local $1)
)
(f64.const 0)
)
(unreachable)
)
(if
(tee_local $0
(i32.const 1)
)
(set_local $0
(i32.const 2)
)
)
(set_global $logical/i
(get_local $0)
(if (result i32)
(tee_local $0
(i32.const 1)
)
(i32.const 2)
(get_local $0)
)
)
(if
(i32.ne
@ -94,19 +92,15 @@
)
(unreachable)
)
(if
(i32.eqz
(set_global $logical/i
(if (result i32)
(tee_local $0
(i32.const 0)
)
)
(set_local $0
(get_local $0)
(i32.const 1)
)
)
(set_global $logical/i
(get_local $0)
)
(if
(i32.ne
(get_global $logical/i)
@ -114,40 +108,36 @@
)
(unreachable)
)
(if
(i64.ne
(tee_local $2
(i64.const 1)
)
(i64.const 0)
)
(set_local $2
(i64.const 2)
)
)
(set_global $logical/I
(get_local $2)
)
(if
(i64.ne
(get_global $logical/I)
(i64.const 2)
)
(unreachable)
)
(if
(i64.eq
(tee_local $2
(if (result i64)
(i64.ne
(tee_local $2
(i64.const 1)
)
(i64.const 0)
)
(i64.const 0)
)
(set_local $2
(i64.const 1)
(i64.const 2)
(get_local $2)
)
)
(if
(i64.ne
(get_global $logical/I)
(i64.const 2)
)
(unreachable)
)
(set_global $logical/I
(get_local $2)
(if (result i64)
(i64.ne
(tee_local $2
(i64.const 0)
)
(i64.const 0)
)
(get_local $2)
(i64.const 1)
)
)
(if
(i64.ne
@ -156,40 +146,36 @@
)
(unreachable)
)
(if
(f32.ne
(tee_local $3
(f32.const 1)
)
(f32.const 0)
)
(set_local $3
(f32.const 2)
)
)
(set_global $logical/f
(get_local $3)
)
(if
(f32.ne
(get_global $logical/f)
(f32.const 2)
)
(unreachable)
)
(if
(f32.eq
(tee_local $3
(if (result f32)
(f32.ne
(tee_local $3
(f32.const 1)
)
(f32.const 0)
)
(f32.const 0)
)
(set_local $3
(f32.const 1)
(f32.const 2)
(get_local $3)
)
)
(if
(f32.ne
(get_global $logical/f)
(f32.const 2)
)
(unreachable)
)
(set_global $logical/f
(get_local $3)
(if (result f32)
(f32.ne
(tee_local $3
(f32.const 0)
)
(f32.const 0)
)
(get_local $3)
(f32.const 1)
)
)
(if
(f32.ne
@ -198,19 +184,17 @@
)
(unreachable)
)
(if
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(set_local $1
(f64.const 2)
)
)
(set_global $logical/F
(get_local $1)
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(f64.const 2)
(get_local $1)
)
)
(if
(f64.ne
@ -219,20 +203,18 @@
)
(unreachable)
)
(if
(f64.eq
(tee_local $1
(set_global $logical/F
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 0)
)
(f64.const 0)
)
(f64.const 0)
)
(set_local $1
(get_local $1)
(f64.const 1)
)
)
(set_global $logical/F
(get_local $1)
)
(if
(f64.ne
(get_global $logical/F)

File diff suppressed because it is too large Load Diff

View File

@ -6,36 +6,15 @@
(export "doSwitchDefaultOmitted" (func $switch/doSwitchDefaultOmitted))
(export "memory" (memory $0))
(func $switch/doSwitch (; 0 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(block $case4|0
(block $case2|0
(if
(i32.ne
(tee_local $1
(block $case0|0
(block $tablify|0
(br_table $case2|0 $case0|0 $case4|0 $case4|0 $tablify|0
(get_local $0)
)
(i32.const 1)
)
(block
(br_if $case2|0
(i32.eqz
(get_local $1)
)
)
(br_if $case4|0
(i32.eq
(get_local $1)
(i32.const 2)
)
)
(br_if $case4|0
(i32.eq
(get_local $1)
(i32.const 3)
)
)
(br $case2|0)
)
(br $case2|0)
)
(return
(i32.const 1)
@ -48,31 +27,18 @@
(i32.const 23)
)
(func $switch/doSwitchDefaultFirst (; 1 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(block $case3|0
(if
(i32.ne
(tee_local $1
(get_local $0)
(block $case1|0
(block $tablify|0
(br_table $case1|0 $case3|0 $case3|0 $tablify|0
(i32.sub
(get_local $0)
(i32.const 1)
)
)
(i32.const 1)
)
(block
(br_if $case3|0
(i32.eq
(get_local $1)
(i32.const 2)
)
)
(br_if $case3|0
(i32.eq
(get_local $1)
(i32.const 3)
)
)
(return
(i32.const 0)
)
(return
(i32.const 0)
)
)
(return
@ -82,31 +48,18 @@
(i32.const 23)
)
(func $switch/doSwitchDefaultOmitted (; 2 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(block $break|0
(block $case2|0
(if
(i32.ne
(tee_local $1
(get_local $0)
)
(i32.const 1)
)
(block
(br_if $case2|0
(i32.eq
(get_local $1)
(i32.const 2)
(block $case0|0
(block $tablify|0
(br_table $case0|0 $case2|0 $case2|0 $tablify|0
(i32.sub
(get_local $0)
(i32.const 1)
)
)
(br_if $case2|0
(i32.eq
(get_local $1)
(i32.const 3)
)
)
(br $break|0)
)
(br $break|0)
)
(return
(i32.const 1)

View File

@ -5,28 +5,14 @@
(export "memory" (memory $0))
(start $start)
(func $start (; 0 ;) (type $v)
(local $0 i32)
(set_global $ternary/a
(tee_local $0
(i32.const 1)
)
(i32.const 1)
)
(set_global $ternary/a
(tee_local $0
(i32.const 1)
)
)
(if
(tee_local $0
(i32.const 1)
)
(set_local $0
(i32.const 1)
)
(unreachable)
(i32.const 1)
)
(set_global $ternary/a
(get_local $0)
(i32.const 1)
)
)
)

View File

@ -66,38 +66,52 @@
)
)
(set_global $unary/i
(i32.add
(get_global $unary/i)
(i32.const 1)
)
)
(set_global $unary/i
(i32.sub
(get_global $unary/i)
(i32.const 1)
)
)
(set_global $unary/i
(i32.add
(tee_local $0
(get_global $unary/i)
(block (result i32)
(set_global $unary/i
(i32.add
(get_global $unary/i)
(i32.const 1)
)
)
(i32.const 1)
(get_global $unary/i)
)
)
(set_global $unary/i
(get_local $0)
)
(set_global $unary/i
(i32.sub
(tee_local $0
(get_global $unary/i)
(block (result i32)
(set_global $unary/i
(i32.sub
(get_global $unary/i)
(i32.const 1)
)
)
(i32.const 1)
(get_global $unary/i)
)
)
(set_global $unary/i
(get_local $0)
(block (result i32)
(set_global $unary/i
(i32.add
(tee_local $0
(get_global $unary/i)
)
(i32.const 1)
)
)
(get_local $0)
)
)
(set_global $unary/i
(block (result i32)
(set_global $unary/i
(i32.sub
(tee_local $0
(get_global $unary/i)
)
(i32.const 1)
)
)
(get_local $0)
)
)
(set_global $unary/I
(i64.add
@ -155,38 +169,52 @@
)
)
(set_global $unary/I
(i64.add
(get_global $unary/I)
(i64.const 1)
)
)
(set_global $unary/I
(i64.sub
(get_global $unary/I)
(i64.const 1)
)
)
(set_global $unary/I
(i64.add
(tee_local $1
(get_global $unary/I)
(block (result i64)
(set_global $unary/I
(i64.add
(get_global $unary/I)
(i64.const 1)
)
)
(i64.const 1)
(get_global $unary/I)
)
)
(set_global $unary/I
(get_local $1)
)
(set_global $unary/I
(i64.sub
(tee_local $1
(get_global $unary/I)
(block (result i64)
(set_global $unary/I
(i64.sub
(get_global $unary/I)
(i64.const 1)
)
)
(i64.const 1)
(get_global $unary/I)
)
)
(set_global $unary/I
(get_local $1)
(block (result i64)
(set_global $unary/I
(i64.add
(tee_local $1
(get_global $unary/I)
)
(i64.const 1)
)
)
(get_local $1)
)
)
(set_global $unary/I
(block (result i64)
(set_global $unary/I
(i64.sub
(tee_local $1
(get_global $unary/I)
)
(i64.const 1)
)
)
(get_local $1)
)
)
(set_global $unary/f
(f32.add
@ -233,38 +261,52 @@
)
)
(set_global $unary/f
(f32.add
(get_global $unary/f)
(f32.const 1)
)
)
(set_global $unary/f
(f32.sub
(get_global $unary/f)
(f32.const 1)
)
)
(set_global $unary/f
(f32.add
(tee_local $2
(get_global $unary/f)
(block (result f32)
(set_global $unary/f
(f32.add
(get_global $unary/f)
(f32.const 1)
)
)
(f32.const 1)
(get_global $unary/f)
)
)
(set_global $unary/f
(get_local $2)
)
(set_global $unary/f
(f32.sub
(tee_local $2
(get_global $unary/f)
(block (result f32)
(set_global $unary/f
(f32.sub
(get_global $unary/f)
(f32.const 1)
)
)
(f32.const 1)
(get_global $unary/f)
)
)
(set_global $unary/f
(get_local $2)
(block (result f32)
(set_global $unary/f
(f32.add
(tee_local $2
(get_global $unary/f)
)
(f32.const 1)
)
)
(get_local $2)
)
)
(set_global $unary/f
(block (result f32)
(set_global $unary/f
(f32.sub
(tee_local $2
(get_global $unary/f)
)
(f32.const 1)
)
)
(get_local $2)
)
)
(set_global $unary/F
(f64.add
@ -313,38 +355,52 @@
)
)
(set_global $unary/F
(f64.add
(get_global $unary/F)
(f64.const 1)
)
)
(set_global $unary/F
(f64.sub
(get_global $unary/F)
(f64.const 1)
)
)
(set_global $unary/F
(f64.add
(tee_local $3
(get_global $unary/F)
(block (result f64)
(set_global $unary/F
(f64.add
(get_global $unary/F)
(f64.const 1)
)
)
(f64.const 1)
(get_global $unary/F)
)
)
(set_global $unary/F
(get_local $3)
)
(set_global $unary/F
(f64.sub
(tee_local $3
(get_global $unary/F)
(block (result f64)
(set_global $unary/F
(f64.sub
(get_global $unary/F)
(f64.const 1)
)
)
(f64.const 1)
(get_global $unary/F)
)
)
(set_global $unary/F
(get_local $3)
(block (result f64)
(set_global $unary/F
(f64.add
(tee_local $3
(get_global $unary/F)
)
(f64.const 1)
)
)
(get_local $3)
)
)
(set_global $unary/F
(block (result f64)
(set_global $unary/F
(f64.sub
(tee_local $3
(get_global $unary/F)
)
(f64.const 1)
)
)
(get_local $3)
)
)
)
)

View File

@ -5,20 +5,14 @@
(export "loopWhileInWhile" (func $while/loopWhileInWhile))
(export "memory" (memory $0))
(func $while/loopWhile (; 0 ;) (type $iv) (param $0 i32)
(local $1 i32)
(set_local $1
(get_local $0)
)
(loop $continue|0
(if
(get_local $1)
(get_local $0)
(block
(set_local $0
(tee_local $1
(i32.sub
(get_local $0)
(i32.const 1)
)
(i32.sub
(get_local $0)
(i32.const 1)
)
)
(br $continue|0)
@ -27,32 +21,24 @@
)
)
(func $while/loopWhileInWhile (; 1 ;) (type $iv) (param $0 i32)
(local $1 i32)
(set_local $1
(get_local $0)
)
(loop $continue|0
(if
(get_local $1)
(get_local $0)
(block
(set_local $0
(tee_local $1
(i32.sub
(get_local $0)
(i32.const 1)
)
(i32.sub
(get_local $0)
(i32.const 1)
)
)
(loop $continue|1
(if
(get_local $1)
(get_local $0)
(block
(set_local $0
(tee_local $1
(i32.sub
(get_local $1)
(i32.const 1)
)
(i32.sub
(get_local $0)
(i32.const 1)
)
)
(br $continue|1)