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:
@@ -11,8 +11,8 @@ isa intel haswell
|
||||
|
||||
; Tests from binary32.cton affected by allones_funcaddrs.
|
||||
function %I32() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
ebb0:
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ isa intel haswell
|
||||
|
||||
; Tests from binary64.cton affected by allones_funcaddrs.
|
||||
function %I64() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
ebb0:
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ isa intel haswell
|
||||
;
|
||||
|
||||
function %I32() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
gv0 = globalsym %some_gv
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ isa intel haswell
|
||||
|
||||
; Tests for i64 instructions.
|
||||
function %I64() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
gv0 = globalsym %some_gv
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ isa intel haswell
|
||||
|
||||
; Tests for i64 instructions.
|
||||
function %I64() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
gv0 = globalsym %some_gv
|
||||
|
||||
@@ -641,8 +641,8 @@ ebb1:
|
||||
; encodings which are chosen by default. Switching to non-REX encodings should
|
||||
; be done by an instruction shrinking pass.
|
||||
function %I32() {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
ss0 = incoming_arg 8, offset 0
|
||||
ss1 = incoming_arg 1024, offset -1024
|
||||
|
||||
@@ -76,9 +76,9 @@ ebb0(v0: i32, v999: i64):
|
||||
; check: $ebb0(
|
||||
; nextln: trap heap_oob
|
||||
; check: ebb1:
|
||||
; nextln: v2 = iconst.i64 0
|
||||
; nextln: v3 = load.f32 v2+16
|
||||
; nextln: return v3
|
||||
; nextln: v1 = iconst.i64 0
|
||||
; nextln: v2 = load.f32 v1+16
|
||||
; nextln: return v2
|
||||
; nextln: }
|
||||
v1 = heap_addr.i64 heap0, v0, 0x1000_0001
|
||||
v2 = load.f32 v1+16
|
||||
|
||||
@@ -3,8 +3,8 @@ test binemit
|
||||
isa riscv
|
||||
|
||||
function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||
fn0 = function %foo()
|
||||
sig0 = ()
|
||||
fn0 = function %foo()
|
||||
|
||||
ebb0(v9999: i32):
|
||||
[-,%x10] v1 = iconst.i32 1
|
||||
|
||||
@@ -27,7 +27,7 @@ function %parse_encoding(i32 [%x5]) -> i32 [%x10] {
|
||||
; check: sig5 = () -> f32 [0] native
|
||||
|
||||
; function + signature
|
||||
fn15 = function %bar(i32 [%x10]) -> b1 [%x10] native
|
||||
fn0 = function %bar(i32 [%x10]) -> b1 [%x10] native
|
||||
; check: sig6 = (i32 [%x10]) -> b1 [%x10] native
|
||||
; nextln: fn0 = sig6 %bar
|
||||
|
||||
|
||||
@@ -25,22 +25,22 @@ ebb3(v30: i32):
|
||||
}
|
||||
; sameln:function %multiple_blocks(i32) -> i32 {
|
||||
; nextln: ebb0(v0: i32):
|
||||
; nextln: v2 = iconst.i32 1
|
||||
; nextln: v3 = iconst.i32 2
|
||||
; nextln: v4 = iadd v2, v3
|
||||
; nextln: v9 = iadd v2, v4
|
||||
; nextln: v11 = iconst.i32 1
|
||||
; nextln: v12 = iconst.i32 2
|
||||
; nextln: v13 = iadd v11, v12
|
||||
; nextln: v31 = iadd v11, v13
|
||||
; nextln: jump ebb1(v0)
|
||||
; nextln:
|
||||
; nextln: ebb1(v1: i32):
|
||||
; nextln: brz v1, ebb2(v1)
|
||||
; nextln: v5 = isub v1, v2
|
||||
; nextln: brz v5, ebb3(v5)
|
||||
; nextln: v6 = isub v1, v2
|
||||
; nextln: jump ebb1(v6)
|
||||
; nextln: ebb1(v10: i32):
|
||||
; nextln: brz v10, ebb2(v10)
|
||||
; nextln: v15 = isub v10, v11
|
||||
; nextln: brz v15, ebb3(v15)
|
||||
; nextln: v14 = isub v10, v11
|
||||
; nextln: jump ebb1(v14)
|
||||
; nextln:
|
||||
; nextln: ebb2(v7: i32):
|
||||
; nextln: return v7
|
||||
; nextln: ebb2(v20: i32):
|
||||
; nextln: return v20
|
||||
; nextln:
|
||||
; nextln: ebb3(v8: i32):
|
||||
; nextln: jump ebb1(v8)
|
||||
; nextln: ebb3(v30: i32):
|
||||
; nextln: jump ebb1(v30)
|
||||
; nextln: }
|
||||
|
||||
@@ -33,23 +33,23 @@ ebb4(v30: i32):
|
||||
; nextln: v2 = iconst.i32 1
|
||||
; nextln: v3 = iconst.i32 2
|
||||
; nextln: v4 = iadd v2, v3
|
||||
; nextln: v8 = iconst.i32 1
|
||||
; nextln: v12 = iconst.i32 1
|
||||
; nextln: jump ebb1(v0)
|
||||
; nextln:
|
||||
; nextln: ebb1(v1: i32):
|
||||
; nextln: v5 = isub v1, v2
|
||||
; nextln: v9 = iadd.i32 v8, v5
|
||||
; nextln: v15 = iadd.i32 v12, v5
|
||||
; nextln: jump ebb2(v5, v5)
|
||||
; nextln:
|
||||
; nextln: ebb2(v6: i32, v7: i32):
|
||||
; nextln: brz v7, ebb3(v6)
|
||||
; nextln: v10 = isub v7, v8
|
||||
; nextln: jump ebb2(v6, v10)
|
||||
; nextln: ebb2(v10: i32, v11: i32):
|
||||
; nextln: brz v11, ebb3(v10)
|
||||
; nextln: v13 = isub v11, v12
|
||||
; nextln: jump ebb2(v10, v13)
|
||||
; nextln:
|
||||
; nextln: ebb3(v11: i32):
|
||||
; nextln: brz v11, ebb4(v11)
|
||||
; nextln: jump ebb1(v11)
|
||||
; nextln: ebb3(v20: i32):
|
||||
; nextln: brz v20, ebb4(v20)
|
||||
; nextln: jump ebb1(v20)
|
||||
; nextln:
|
||||
; nextln: ebb4(v12: i32):
|
||||
; nextln: return v12
|
||||
; nextln: ebb4(v30: i32):
|
||||
; nextln: return v30
|
||||
; nextln: }
|
||||
|
||||
@@ -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: }
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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: }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
test verifier
|
||||
|
||||
function %deref_cycle() {
|
||||
gv1 = deref(gv2)-32 ; error: deref cycle: [gv0, gv1]
|
||||
gv1 = deref(gv2)-32 ; error: deref cycle: [gv1, gv2]
|
||||
gv2 = deref(gv1)
|
||||
|
||||
ebb1:
|
||||
|
||||
@@ -61,7 +61,7 @@ impl SubTest for TestDomtree {
|
||||
for src_ebb in tail.split_whitespace() {
|
||||
let ebb = match context.details.map.lookup_str(src_ebb) {
|
||||
Some(AnyEntity::Ebb(ebb)) => ebb,
|
||||
_ => return Err(format!("expected EBB: {}", src_ebb)),
|
||||
_ => return Err(format!("expected defined EBB, got {}", src_ebb)),
|
||||
};
|
||||
|
||||
// Annotations say that `inst` is the idom of `ebb`.
|
||||
|
||||
Reference in New Issue
Block a user