Files
wasmtime/tests/parser/branch.cton
Jakob Stoklund Olesen cdc2638f96 Parse branch and jump instructions.
These instruction formats take EBB references with lists of argument values. For
EBBs with no arguments, the argument value list may be omitted.
2016-07-05 15:23:42 -07:00

46 lines
740 B
Plaintext

; Parsing branches and jumps.
; Jumps with no arguments. The '()' empty argument list is optional.
function minimal() {
ebb0:
jump ebb1
ebb1:
jump ebb0()
}
; Jumps with 1 arg.
function onearg(i32) {
ebb0(vx0: i32):
jump ebb1(vx0)
ebb1(vx1: i32):
jump ebb0(vx1)
}
; Jumps with 2 args.
function twoargs(i32, f32) {
ebb0(vx0: i32, vx1: f32):
jump ebb1(vx0, vx1)
ebb1(vx2: i32, vx3: f32):
jump ebb0(vx2, vx3)
}
; Branches with no arguments. The '()' empty argument list is optional.
function minimal(i32) {
ebb0(vx0: i32):
brz vx0, ebb1
ebb1:
brnz vx0, ebb1()
}
function twoargs(i32, f32) {
ebb0(vx0: i32, vx1: f32):
brz vx0, ebb1(vx0, vx1)
ebb1(vx2: i32, vx3: f32):
brnz vx0, ebb0(vx2, vx3)
}