Don't renumber entities in the parser.

This makes it easier to debug testcases:
 - the entity numbers in a .cton file match the entity numbers used
   within Cretonne.
 - serializing and deserializing doesn't cause indices to change.

One disadvantage is that if a .cton file uses sparse entity numbers,
deserializing to the in-memory form doesn't compact it. However, the
text format is not intended to be performance-critical, so this isn't
expected to be a big burden.
This commit is contained in:
Dan Gohman
2018-02-15 21:13:25 -08:00
parent c846ec1626
commit a5b00b173e
22 changed files with 677 additions and 650 deletions

View File

@@ -95,19 +95,18 @@ ebb40:
trap user4
}
; sameln: function %jumptable(i32) native {
; nextln: jt0 = jump_table 0
; nextln: jt1 = jump_table 0, 0, ebb0, ebb3, ebb1, ebb2
; nextln:
; nextln: ebb0($v3: i32):
; nextln: br_table $v3, jt1
; check: jt2 = jump_table 0, 0, ebb10, ebb40, ebb20, ebb30
; check: jt200 = jump_table 0
; check: ebb10($v3: i32):
; nextln: br_table $v3, jt2
; nextln: trap user1
; nextln:
; nextln: ebb1:
; nextln: ebb20:
; nextln: trap user2
; nextln:
; nextln: ebb2:
; nextln: ebb30:
; nextln: trap user3
; nextln:
; nextln: ebb3:
; nextln: ebb40:
; nextln: trap user4
; nextln: }

View File

@@ -6,7 +6,7 @@ ebb1:
return
}
; sameln: function %mini() native {
; nextln: ebb0:
; nextln: ebb1:
; nextln: return
; nextln: }
@@ -17,7 +17,7 @@ ebb1:
return v1, v2
}
; sameln: function %r1() -> i32, f32 spiderwasm {
; nextln: ebb0:
; nextln: ebb1:
; nextln: $v1 = iconst.i32 3
; nextln: $v2 = f32const 0.0
; nextln: return $v1, $v2
@@ -30,12 +30,12 @@ function %signatures() {
fn8 = function %bar(i32) -> b1
}
; sameln: function %signatures() native {
; nextln: $sig10 = () native
; nextln: $sig11 = (i32, f64) -> i32, b1 spiderwasm
; nextln: sig2 = (i32) -> b1 native
; nextln: $fn5 = $sig11 %foo
; nextln: $fn8 = sig2 %bar
; nextln: }
; check: $sig10 = () native
; check: $sig11 = (i32, f64) -> i32, b1 spiderwasm
; check: sig12 = (i32) -> b1 native
; check: $fn5 = $sig11 %foo
; check: $fn8 = sig12 %bar
; check: }
function %direct() {
fn0 = function %none()

View File

@@ -30,8 +30,8 @@ ebb100(v20: i32):
jump ebb100(v1000)
}
; sameln: function %use_value() native {
; nextln: ebb0($v20: i32):
; nextln: ebb100($v20: i32):
; nextln: $v1000 = iadd_imm $v20, 5
; nextln: $v200 = iadd $v20, $v1000
; nextln: jump ebb0($v1000)
; nextln: jump ebb100($v1000)
; nextln: }

View File

@@ -58,8 +58,8 @@ ebb0(v95: i32, v96: i32, v97: b1):
v98 = selectif.i32 eq v97, v95, v96
}
; sameln: function %selectif() native {
; nextln: ebb0(v0: i32, v1: i32, v2: b1):
; nextln: v3 = selectif.i32 eq v2, v0, v1
; nextln: ebb0(v95: i32, v96: i32, v97: b1):
; nextln: v98 = selectif.i32 eq v97, v95, v96
; nextln: }
; Lane indexes.
@@ -136,11 +136,11 @@ ebb0:
stack_store v2, ss2
}
; sameln: function %stack() native {
; nextln: $ss10 = spill_slot 8
; nextln: $ss2 = local 4
; nextln: $ss3 = incoming_arg 4, offset 8
; nextln: $ss4 = outgoing_arg 4
; nextln: $ss5 = emergency_slot 4
; check: $ss2 = local 4
; check: $ss3 = incoming_arg 4, offset 8
; check: $ss4 = outgoing_arg 4
; check: $ss5 = emergency_slot 4
; check: $ss10 = spill_slot 8
; check: ebb0:
; nextln: $v1 = stack_load.i32 $ss10