3 ms·
When you right-click on the file and choose Compile to Wat (second last menu item), you can see the WASM text directly. This is the output of the Fibonacci exa
by andsoitis 3y ago
When you right-click on the file and choose Compile to Wat (second last menu item), you can see the WASM text directly.
This is the output of the Fibonacci example:
(module (import "spectest" "print_i32" (func $printi (param $i i32)))
(memory $rael.memory (export "memory") 1)
(table $rael.global funcref (elem))
(func $fib.fn/2 (param $n/1 i32) (result i32) (local $x/12 i32)
(local.get $n/1) (local.set $x/12)
(block $join:11 (local.get $x/12) (i32.const 0) (i32.eq)
(if (result i32) (then (i32.const 0))
(else (local.get $x/12) (i32.const 1) (i32.eq)
(if (result i32) (then (i32.const 1)) (else (br $join:11)))))
(return))
(local.get $n/1) (i32.const 1) (i32.sub) (call $fib.fn/2) (local.get $n/1)
(i32.const 2) (i32.sub) (call $fib.fn/2) (i32.add))
(func $fib2.fn/1 (param $num/2 i32) (result i32) (local $n/4 i32)
(local $acc1/5 i32) (local $acc2/6 i32) (local $x/16 i32)
(block $join:3 (local.get $num/2) (i32.const 0) (i32.const 1)
(local.set $acc2/6) (local.set $acc1/5) (local.set $n/4) (br $join:3))
(loop $join:3 (result i32) (local.get $n/4) (local.set $x/16)
(block $join:15
(block $join:14
(block $join:13 (local.get $x/16) (i32.const 0) (i32.eq)
(if (result i32) (then (br $join:13))
(else (local.get $x/16) (i32.const 1) (i32.eq)
(if (result i32) (then (br $join:14)) (else (br $join:15)))))
(return))
(local.get $acc1/5) (return))
(local.get $acc2/6) (return))
(local.get $n/4) (i32.const 1) (i32.sub) (local.get $acc2/6)
(local.get $acc1/5) (local.get $acc2/6) (i32.add) (local.set $acc2/6)
(local.set $acc1/5) (local.set $n/4) (br $join:3)))
(func $init/3 (i32.const 3) (call $fib.fn/2) (call $printi) (i32.const 46)
(call $fib2.fn/1) (call $printi))
(export "_start" (func $init/3)))