Remove the concept of non-dense jump tables.

WebAssembly doesn't have non-dense jump tables, and higher-level users
are better served by the facilities in lib/frontend/src/switch.rs for
working with non-dense switches.

This eliminates the concept of "absent" jump table entries, which
were represented as "0" in the text format.

Also, jump table contents are now enclosed in `[` and `]`, so that
we can unambiguously display empty jump tables. Previously, empty jump
tables were displayed as if they had a single absent entry.
This commit is contained in:
Dan Gohman
2018-10-04 10:35:31 -07:00
parent dc9221a70c
commit 1098eafb45
22 changed files with 113 additions and 208 deletions

View File

@@ -1405,7 +1405,7 @@ ebb0:
; Tests for i64 jump table instructions.
function %I64_JT(i64 [%rdi]) {
jt0 = jump_table ebb1, ebb2, ebb3
jt0 = jump_table [ebb1, ebb2, ebb3]
ebb0(v0: i64 [%rdi]):
; Note: The next two lines will need to change whenever instructions are

View File

@@ -4,7 +4,7 @@ target x86_64
function u0:0(i64) system_v {
ss0 = explicit_slot 1
jt0 = jump_table ebb1
jt0 = jump_table [ebb1]
ebb0(v0: i64):
v1 = stack_addr.i64 ss0

View File

@@ -81,8 +81,8 @@ ebb1(v92: i32, v93: f32):
; nextln: }
function %jumptable(i32) {
jt200 = jump_table 0, 0
jt2 = jump_table 0, 0, ebb10, ebb40, ebb20, ebb30
jt200 = jump_table []
jt2 = jump_table [ebb10, ebb40, ebb20, ebb30]
ebb10(v3: i32):
br_table v3, ebb50, jt2
@@ -97,8 +97,8 @@ ebb50:
trap user1
}
; sameln: function %jumptable(i32) fast {
; check: jt2 = jump_table 0, 0, ebb10, ebb40, ebb20, ebb30
; check: jt200 = jump_table 0
; check: jt2 = jump_table [ebb10, ebb40, ebb20, ebb30]
; check: jt200 = jump_table []
; check: ebb10(v3: i32):
; nextln: br_table v3, ebb50, jt2
; nextln:

View File

@@ -68,7 +68,7 @@ function %fn_call_incorrect_arg_type(i64) {
; TODO: Should we instead just verify that jump tables contain no EBBs that take arguments? This
; error doesn't occur if no instruction uses the jump table.
function %jump_table_args() {
jt1 = jump_table ebb1
jt1 = jump_table [ebb1]
ebb0:
v0 = iconst.i32 0
br_table v0, ebb2, jt1 ; error: takes no arguments, but had target ebb1 with 1 arguments

View File

@@ -48,7 +48,7 @@ ebb0:
}
function %br_table(i32) {
jt0 = jump_table ebb3, ebb1, 0, ebb2
jt0 = jump_table [ebb3, ebb1, ebb2]
ebb0(v0: i32):
br_table v0, ebb4, jt0