Add unary postfix operator overloading (#309)

This commit is contained in:
Max Graey
2018-10-30 16:23:18 +02:00
committed by Daniel Wirtz
parent d864bef1eb
commit dc4e2060ba
4 changed files with 595 additions and 96 deletions

View File

@ -74,6 +74,7 @@
(global $std/operator-overloading/excl (mut i32) (i32.const 0))
(global $std/operator-overloading/bres (mut i32) (i32.const 0))
(global $std/operator-overloading/incdec (mut i32) (i32.const 0))
(global $std/operator-overloading/tmp (mut i32) (i32.const 0))
(global $std/operator-overloading/ais1 (mut i32) (i32.const 0))
(global $std/operator-overloading/ais2 (mut i32) (i32.const 0))
(global $std/operator-overloading/ais (mut i32) (i32.const 0))
@ -2213,7 +2214,39 @@
)
(get_local $0)
)
(func $start (; 30 ;) (; has Stack IR ;) (type $v)
(func $std/operator-overloading/Tester#postInc (; 30 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32)
(call $std/operator-overloading/Tester#constructor
(i32.add
(i32.load
(get_local $0)
)
(i32.const 1)
)
(i32.add
(i32.load offset=4
(get_local $0)
)
(i32.const 1)
)
)
)
(func $std/operator-overloading/Tester#postDec (; 31 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32)
(call $std/operator-overloading/Tester#constructor
(i32.sub
(i32.load
(get_local $0)
)
(i32.const 1)
)
(i32.sub
(i32.load offset=4
(get_local $0)
)
(i32.const 1)
)
)
)
(func $start (; 32 ;) (; has Stack IR ;) (type $v)
(local $0 i32)
(local $1 i32)
(set_global $~lib/allocator/arena/startOffset
@ -2266,7 +2299,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 137)
(i32.const 147)
(i32.const 0)
)
(unreachable)
@ -2315,7 +2348,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 143)
(i32.const 153)
(i32.const 0)
)
(unreachable)
@ -2365,7 +2398,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 149)
(i32.const 159)
(i32.const 0)
)
(unreachable)
@ -2415,7 +2448,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 155)
(i32.const 165)
(i32.const 0)
)
(unreachable)
@ -2464,7 +2497,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 161)
(i32.const 171)
(i32.const 0)
)
(unreachable)
@ -2514,7 +2547,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 167)
(i32.const 177)
(i32.const 0)
)
(unreachable)
@ -2564,7 +2597,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 173)
(i32.const 183)
(i32.const 0)
)
(unreachable)
@ -2614,7 +2647,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 179)
(i32.const 189)
(i32.const 0)
)
(unreachable)
@ -2664,7 +2697,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 185)
(i32.const 195)
(i32.const 0)
)
(unreachable)
@ -2697,7 +2730,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 191)
(i32.const 201)
(i32.const 0)
)
(unreachable)
@ -2727,7 +2760,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 197)
(i32.const 207)
(i32.const 0)
)
(unreachable)
@ -2745,7 +2778,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 201)
(i32.const 211)
(i32.const 0)
)
(unreachable)
@ -2766,7 +2799,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 205)
(i32.const 215)
(i32.const 0)
)
(unreachable)
@ -2799,7 +2832,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 211)
(i32.const 221)
(i32.const 0)
)
(unreachable)
@ -2832,7 +2865,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 217)
(i32.const 227)
(i32.const 0)
)
(unreachable)
@ -2865,7 +2898,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 223)
(i32.const 233)
(i32.const 0)
)
(unreachable)
@ -2898,7 +2931,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 229)
(i32.const 239)
(i32.const 0)
)
(unreachable)
@ -2941,7 +2974,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 234)
(i32.const 244)
(i32.const 0)
)
(unreachable)
@ -2984,7 +3017,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 239)
(i32.const 249)
(i32.const 0)
)
(unreachable)
@ -3027,7 +3060,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 244)
(i32.const 254)
(i32.const 0)
)
(unreachable)
@ -3074,7 +3107,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 249)
(i32.const 259)
(i32.const 0)
)
(unreachable)
@ -3127,7 +3160,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 254)
(i32.const 264)
(i32.const 0)
)
(unreachable)
@ -3180,7 +3213,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 259)
(i32.const 269)
(i32.const 0)
)
(unreachable)
@ -3225,7 +3258,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 264)
(i32.const 274)
(i32.const 0)
)
(unreachable)
@ -3240,7 +3273,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 265)
(i32.const 275)
(i32.const 0)
)
(unreachable)
@ -3283,7 +3316,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 271)
(i32.const 281)
(i32.const 0)
)
(unreachable)
@ -3319,7 +3352,159 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 274)
(i32.const 284)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/incdec
(call $std/operator-overloading/Tester#constructor
(i32.const 0)
(i32.const 1)
)
)
(set_global $std/operator-overloading/incdec
(call $std/operator-overloading/Tester#postInc
(tee_local $0
(get_global $std/operator-overloading/incdec)
)
)
)
(set_global $std/operator-overloading/tmp
(get_local $0)
)
(if
(tee_local $0
(i32.eqz
(i32.load
(get_global $std/operator-overloading/tmp)
)
)
)
(set_local $0
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/tmp)
)
(i32.const 1)
)
)
)
(if
(i32.eqz
(get_local $0)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 289)
(i32.const 0)
)
(unreachable)
)
)
(if
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/incdec)
)
(i32.const 1)
)
)
(set_local $0
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/incdec)
)
(i32.const 2)
)
)
)
(if
(i32.eqz
(get_local $0)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 290)
(i32.const 0)
)
(unreachable)
)
)
(set_global $std/operator-overloading/incdec
(call $std/operator-overloading/Tester#postDec
(tee_local $0
(get_global $std/operator-overloading/incdec)
)
)
)
(set_global $std/operator-overloading/tmp
(get_local $0)
)
(if
(tee_local $0
(i32.eq
(i32.load
(get_global $std/operator-overloading/tmp)
)
(i32.const 1)
)
)
(set_local $0
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/tmp)
)
(i32.const 2)
)
)
)
(if
(i32.eqz
(get_local $0)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 293)
(i32.const 0)
)
(unreachable)
)
)
(if
(tee_local $0
(i32.eqz
(i32.load
(get_global $std/operator-overloading/incdec)
)
)
)
(set_local $0
(i32.eq
(i32.load offset=4
(get_global $std/operator-overloading/incdec)
)
(i32.const 1)
)
)
)
(if
(i32.eqz
(get_local $0)
)
(block
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 294)
(i32.const 0)
)
(unreachable)
@ -3331,6 +3516,24 @@
(i32.const 2)
)
)
(set_global $std/operator-overloading/ais1
(call $std/operator-overloading/Tester#constructor
(i32.add
(i32.load
(tee_local $0
(get_global $std/operator-overloading/ais1)
)
)
(i32.const 1)
)
(i32.add
(i32.load offset=4
(get_local $0)
)
(i32.const 1)
)
)
)
(set_global $std/operator-overloading/ais2
(call $std/operator-overloading/Tester#constructor
(i32.const 2)
@ -3367,7 +3570,7 @@
(i32.load
(get_global $std/operator-overloading/ais)
)
(i32.const 3)
(i32.const 4)
)
)
(set_local $1
@ -3375,7 +3578,7 @@
(i32.load offset=4
(get_global $std/operator-overloading/ais)
)
(i32.const 5)
(i32.const 6)
)
)
)
@ -3387,7 +3590,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 288)
(i32.const 314)
(i32.const 0)
)
(unreachable)
@ -3399,6 +3602,24 @@
(i32.const 2)
)
)
(set_global $std/operator-overloading/aii1
(call $std/operator-overloading/Tester#constructor
(i32.add
(i32.load
(tee_local $1
(get_global $std/operator-overloading/aii1)
)
)
(i32.const 1)
)
(i32.add
(i32.load offset=4
(get_local $1)
)
(i32.const 1)
)
)
)
(set_global $std/operator-overloading/aii2
(call $std/operator-overloading/Tester#constructor
(i32.const 2)
@ -3435,7 +3656,7 @@
(i32.load
(get_global $std/operator-overloading/aii)
)
(i32.const 3)
(i32.const 4)
)
)
(set_local $0
@ -3443,7 +3664,7 @@
(i32.load offset=4
(get_global $std/operator-overloading/aii)
)
(i32.const 5)
(i32.const 6)
)
)
)
@ -3455,14 +3676,14 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 8)
(i32.const 302)
(i32.const 334)
(i32.const 0)
)
(unreachable)
)
)
)
(func $null (; 31 ;) (; has Stack IR ;) (type $v)
(func $null (; 33 ;) (; has Stack IR ;) (type $v)
(nop)
)
)