Implement a poor man's jump table.

We will eventually support real jump tables, but for now just expand
br_table into a sequence of conditional branches.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-25 10:56:14 -07:00
parent 29dfcf5dfb
commit fdb97da21b
4 changed files with 53 additions and 0 deletions

View File

@@ -48,3 +48,18 @@ function %undefined() {
ebb0:
trap user0
}
function %br_table(i32) {
jt0 = jump_table ebb3, ebb1, 0, ebb2
ebb0(v0: i32):
br_table v0, jt0
trap oob
ebb1:
return
ebb2:
return
ebb3:
return
}