mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-22 19:21:47 +00:00
Use stack IR when emitting text format (#312)
This commit is contained in:
@ -2,44 +2,35 @@
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $v (func))
|
||||
(memory $0 0)
|
||||
(table 1 anyfunc)
|
||||
(table $0 1 anyfunc)
|
||||
(elem (i32.const 0) $null)
|
||||
(export "memory" (memory $0))
|
||||
(export "table" (table $0))
|
||||
(export "fib" (func $recursive/fib))
|
||||
(func $recursive/fib (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $recursive/fib (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(if
|
||||
(i32.le_s
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
(return
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $1
|
||||
(call $recursive/fib
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $0
|
||||
(call $recursive/fib
|
||||
(i32.sub
|
||||
(get_local $0)
|
||||
(i32.const 2)
|
||||
)
|
||||
)
|
||||
)
|
||||
(i32.add
|
||||
(get_local $1)
|
||||
(get_local $0)
|
||||
)
|
||||
get_local $0
|
||||
i32.const 1
|
||||
i32.le_s
|
||||
if
|
||||
i32.const 1
|
||||
return
|
||||
end
|
||||
get_local $0
|
||||
i32.const 1
|
||||
i32.sub
|
||||
call $recursive/fib
|
||||
set_local $1
|
||||
get_local $0
|
||||
i32.const 2
|
||||
i32.sub
|
||||
call $recursive/fib
|
||||
set_local $0
|
||||
get_local $1
|
||||
get_local $0
|
||||
i32.add
|
||||
)
|
||||
(func $null (; 1 ;) (; has Stack IR ;) (type $v)
|
||||
(nop)
|
||||
(func $null (; 1 ;) (type $v)
|
||||
nop
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user