Mass rename Ebb and relatives to Block (#1365)

* Manually rename BasicBlock to BlockPredecessor

BasicBlock is a pair of (Ebb, Inst) that is used to represent the
basic block subcomponent of an Ebb that is a predecessor to an Ebb.

Eventually we will be able to remove this struct, but for now it
makes sense to give it a non-conflicting name so that we can start
to transition Ebb to represent a basic block.

I have not updated any comments that refer to BasicBlock, as
eventually we will remove BlockPredecessor and replace with Block,
which is a basic block, so the comments will become correct.

* Manually rename SSABuilder block types to avoid conflict

SSABuilder has its own Block and BlockData types. These along with
associated identifier will cause conflicts in a later commit, so
they are renamed to be more verbose here.

* Automatically rename 'Ebb' to 'Block' in *.rs

* Automatically rename 'EBB' to 'block' in *.rs

* Automatically rename 'ebb' to 'block' in *.rs

* Automatically rename 'extended basic block' to 'basic block' in *.rs

* Automatically rename 'an basic block' to 'a basic block' in *.rs

* Manually update comment for `Block`

`Block`'s wikipedia article required an update.

* Automatically rename 'an `Block`' to 'a `Block`' in *.rs

* Automatically rename 'extended_basic_block' to 'basic_block' in *.rs

* Automatically rename 'ebb' to 'block' in *.clif

* Manually rename clif constant that contains 'ebb' as substring to avoid conflict

* Automatically rename filecheck uses of 'EBB' to 'BB'

'regex: EBB' -> 'regex: BB'
'$EBB' -> '$BB'

* Automatically rename 'EBB' 'Ebb' to 'block' in *.clif

* Automatically rename 'an block' to 'a block' in *.clif

* Fix broken testcase when function name length increases

Test function names are limited to 16 characters. This causes
the new longer name to be truncated and fail a filecheck test. An
outdated comment was also fixed.
This commit is contained in:
Ryan Hunt
2020-02-07 10:46:47 -06:00
committed by GitHub
parent a136d1cb00
commit 832666c45e
370 changed files with 8090 additions and 7988 deletions

View File

@@ -2,7 +2,7 @@ test cat
test verifier
function %basic(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
block0(v0: i32, v1: i32):
v2 -> v0
v3 -> v1
v4 = iadd.i32 v2, v3
@@ -10,7 +10,7 @@ ebb0(v0: i32, v1: i32):
}
function %transitive() -> i32 {
ebb0:
block0:
v0 = iconst.i32 0
v1 -> v0
v2 -> v1
@@ -20,7 +20,7 @@ ebb0:
}
function %duplicate(i32, i32) -> i32 {
ebb0(v0: i32, v1: i32):
block0(v0: i32, v1: i32):
v2 -> v0
v2 -> v0
v2 -> v0

View File

@@ -3,114 +3,114 @@ test cat
; Jumps with no arguments. The '()' empty argument list is optional.
function %minimal() {
ebb0:
jump ebb1
block0:
jump block1
ebb1:
jump ebb0()
block1:
jump block0()
}
; sameln: function %minimal() fast {
; nextln: ebb0:
; nextln: jump ebb1
; nextln: block0:
; nextln: jump block1
; nextln:
; nextln: ebb1:
; nextln: jump ebb0
; nextln: block1:
; nextln: jump block0
; nextln: }
; Jumps with 1 arg.
function %onearg(i32) {
ebb0(v90: i32):
jump ebb1(v90)
block0(v90: i32):
jump block1(v90)
ebb1(v91: i32):
jump ebb0(v91)
block1(v91: i32):
jump block0(v91)
}
; sameln: function %onearg(i32) fast {
; nextln: ebb0(v90: i32):
; nextln: jump ebb1(v90)
; nextln: block0(v90: i32):
; nextln: jump block1(v90)
; nextln:
; nextln: ebb1(v91: i32):
; nextln: jump ebb0(v91)
; nextln: block1(v91: i32):
; nextln: jump block0(v91)
; nextln: }
; Jumps with 2 args.
function %twoargs(i32, f32) {
ebb0(v90: i32, v91: f32):
jump ebb1(v90, v91)
block0(v90: i32, v91: f32):
jump block1(v90, v91)
ebb1(v92: i32, v93: f32):
jump ebb0(v92, v93)
block1(v92: i32, v93: f32):
jump block0(v92, v93)
}
; sameln: function %twoargs(i32, f32) fast {
; nextln: ebb0(v90: i32, v91: f32):
; nextln: jump ebb1(v90, v91)
; nextln: block0(v90: i32, v91: f32):
; nextln: jump block1(v90, v91)
; nextln:
; nextln: ebb1(v92: i32, v93: f32):
; nextln: jump ebb0(v92, v93)
; nextln: block1(v92: i32, v93: f32):
; nextln: jump block0(v92, v93)
; nextln: }
; Branches with no arguments. The '()' empty argument list is optional.
function %minimal(i32) {
ebb0(v90: i32):
brz v90, ebb1
block0(v90: i32):
brz v90, block1
ebb1:
brnz v90, ebb1()
block1:
brnz v90, block1()
}
; sameln: function %minimal(i32) fast {
; nextln: ebb0(v90: i32):
; nextln: brz v90, ebb1
; nextln: block0(v90: i32):
; nextln: brz v90, block1
; nextln:
; nextln: ebb1:
; nextln: brnz.i32 v90, ebb1
; nextln: block1:
; nextln: brnz.i32 v90, block1
; nextln: }
function %twoargs(i32, f32) {
ebb0(v90: i32, v91: f32):
brz v90, ebb1(v90, v91)
block0(v90: i32, v91: f32):
brz v90, block1(v90, v91)
ebb1(v92: i32, v93: f32):
brnz v90, ebb0(v92, v93)
block1(v92: i32, v93: f32):
brnz v90, block0(v92, v93)
}
; sameln: function %twoargs(i32, f32) fast {
; nextln: ebb0(v90: i32, v91: f32):
; nextln: brz v90, ebb1(v90, v91)
; nextln: block0(v90: i32, v91: f32):
; nextln: brz v90, block1(v90, v91)
; nextln:
; nextln: ebb1(v92: i32, v93: f32):
; nextln: brnz.i32 v90, ebb0(v92, v93)
; nextln: block1(v92: i32, v93: f32):
; nextln: brnz.i32 v90, block0(v92, v93)
; nextln: }
function %jumptable(i32) {
jt200 = jump_table []
jt2 = jump_table [ebb10, ebb40, ebb20, ebb30]
jt2 = jump_table [block10, block40, block20, block30]
ebb10(v3: i32):
br_table v3, ebb50, jt2
block10(v3: i32):
br_table v3, block50, jt2
ebb20:
block20:
trap user2
ebb30:
block30:
trap user3
ebb40:
block40:
trap user4
ebb50:
block50:
trap user1
}
; sameln: function %jumptable(i32) fast {
; check: jt2 = jump_table [ebb10, ebb40, ebb20, ebb30]
; check: jt2 = jump_table [block10, block40, block20, block30]
; check: jt200 = jump_table []
; check: ebb10(v3: i32):
; nextln: br_table v3, ebb50, jt2
; check: block10(v3: i32):
; nextln: br_table v3, block50, jt2
; nextln:
; nextln: ebb20:
; nextln: block20:
; nextln: trap user2
; nextln:
; nextln: ebb30:
; nextln: block30:
; nextln: trap user3
; nextln:
; nextln: ebb40:
; nextln: block40:
; nextln: trap user4
; nextln:
; nextln: ebb50:
; nextln: block50:
; nextln: trap user1
; nextln: }

View File

@@ -2,22 +2,22 @@
test cat
function %mini() {
ebb1:
block1:
return
}
; sameln: function %mini() fast {
; nextln: ebb1:
; nextln: block1:
; nextln: return
; nextln: }
function %r1() -> i32, f32 baldrdash_system_v {
ebb1:
block1:
v1 = iconst.i32 3
v2 = f32const 0.0
return v1, v2
}
; sameln: function %r1() -> i32, f32 baldrdash_system_v {
; nextln: ebb1:
; nextln: block1:
; nextln: v1 = iconst.i32 3
; nextln: v2 = f32const 0.0
; nextln: return v1, v2
@@ -43,7 +43,7 @@ function %direct() {
fn1 = %one() -> i32
fn2 = %two() -> i32, f32
ebb0:
block0:
call fn0()
v1 = call fn1()
v2, v3 = call fn2()
@@ -59,7 +59,7 @@ function %indirect(i64) {
sig1 = () -> i32
sig2 = () -> i32, f32
ebb0(v0: i64):
block0(v0: i64):
v1 = call_indirect sig1, v0()
call_indirect sig0, v1(v0)
v3, v4 = call_indirect sig2, v1()
@@ -74,7 +74,7 @@ function %long_call() {
sig0 = ()
fn0 = %none sig0
ebb0:
block0:
v0 = func_addr.i32 fn0
call_indirect sig0, v0()
return
@@ -85,10 +85,10 @@ ebb0:
; Special purpose function arguments
function %special1(i32 sret, i32 fp, i32 csr, i32 link) -> i32 link, i32 fp, i32 csr, i32 sret {
ebb0(v1: i32, v2: i32, v3: i32, v4: i32):
block0(v1: i32, v2: i32, v3: i32, v4: i32):
return v4, v2, v3, v1
}
; check: function %special1(i32 sret, i32 fp, i32 csr, i32 link) -> i32 link, i32 fp, i32 csr, i32 sret fast {
; check: ebb0(v1: i32, v2: i32, v3: i32, v4: i32):
; check: block0(v1: i32, v2: i32, v3: i32, v4: i32):
; check: return v4, v2, v3, v1
; check: }

View File

@@ -2,63 +2,63 @@ test cat
test verifier
function %iflags(i32) {
ebb200(v0: i32):
block200(v0: i32):
v1 = ifcmp_imm v0, 17
brif eq v1, ebb201
jump ebb400
brif eq v1, block201
jump block400
ebb400:
brif ugt v1, ebb202
jump ebb401
block400:
brif ugt v1, block202
jump block401
ebb401:
block401:
v2 = iconst.i32 34
v3 = ifcmp v0, v2
v4 = trueif eq v3
brnz v4, ebb202
jump ebb402
brnz v4, block202
jump block402
ebb402:
block402:
return
ebb201:
block201:
return
ebb202:
block202:
trap oob
}
; check: v1 = ifcmp_imm v0, 17
; check: brif eq v1, ebb201
; check: brif ugt v1, ebb202
; check: brif eq v1, block201
; check: brif ugt v1, block202
; check: v3 = ifcmp.i32 v0, v2
; check: v4 = trueif eq v3
function %fflags(f32) {
ebb200(v0: f32):
block200(v0: f32):
v1 = f32const 0x34.0p0
v2 = ffcmp v0, v1
brff eq v2, ebb201
jump ebb400
brff eq v2, block201
jump block400
ebb400:
brff ord v2, ebb202
jump ebb401
block400:
brff ord v2, block202
jump block401
ebb401:
block401:
v3 = trueff gt v2
brnz v3, ebb202
jump ebb402
brnz v3, block202
jump block402
ebb402:
block402:
return
ebb201:
block201:
return
ebb202:
block202:
trap oob
}
; check: v2 = ffcmp v0, v1
; check: brff eq v2, ebb201
; check: brff ord v2, ebb202
; check: brff eq v2, block201
; check: brff ord v2, block202
; check: v3 = trueff gt v2

View File

@@ -5,7 +5,7 @@ target riscv32
; regex: WS=[ \t]*
function %foo(i32, i32) {
ebb1(v0: i32 [%x8], v1: i32):
block1(v0: i32 [%x8], v1: i32):
[-,-] v2 = iadd v0, v1
[-] trap heap_oob
[R#1234, %x5, %x11] v6, v7 = iadd_ifcout v2, v0
@@ -14,7 +14,7 @@ ebb1(v0: i32 [%x8], v1: i32):
@a5 [Iret#5] return v0, v8
}
; sameln: function %foo(i32, i32) fast {
; nextln: ebb1(v0: i32 [%x8], v1: i32):
; nextln: block1(v0: i32 [%x8], v1: i32):
; nextln: [-,-]$WS v2 = iadd v0, v1
; nextln: [-]$WS trap heap_oob
; nextln: [R#1234,%x5,%x11]$WS v6, v7 = iadd_ifcout v2, v0

View File

@@ -4,7 +4,7 @@ test verifier
function %vmglobal(i64 vmctx) -> i32 {
gv3 = vmctx
; check: gv3 = vmctx
ebb0(v0: i64):
block0(v0: i64):
v1 = global_value.i32 gv3
; check: v1 = global_value.i32 gv3
return v1
@@ -17,7 +17,7 @@ function %load_and_add_imm(i64 vmctx) -> i32 {
; check: gv2 = vmctx
; check: gv3 = load.i32 notrap aligned gv2-72
; check: gv4 = iadd_imm.i32 gv3, -32
ebb0(v0: i64):
block0(v0: i64):
v1 = global_value.i32 gv4
; check: v1 = global_value.i32 gv4
return v1
@@ -31,7 +31,7 @@ function %backref(i64 vmctx) -> i32 {
; check: gv1 = load.i32 notrap aligned gv2
gv2 = vmctx
; check: gv2 = vmctx
ebb0(v0: i64):
block0(v0: i64):
v1 = global_value.i32 gv1
return v1
}
@@ -41,7 +41,7 @@ function %symbol() -> i32 {
; check: gv0 = symbol %something
gv1 = symbol u8:9
; check: gv1 = symbol u8:9
ebb0:
block0:
v0 = global_value.i32 gv0
; check: v0 = global_value.i32 gv0
v1 = global_value.i32 gv1
@@ -59,7 +59,7 @@ function %sheap(i32, i64 vmctx) -> i64 {
; check: heap1 = static gv5, min 0x0001_0000, bound 0x0001_0000_0000, offset_guard 0x8000_0000
; check: heap2 = static gv5, min 0, bound 0x0001_0000, offset_guard 4096
ebb0(v1: i32, v2: i64):
block0(v1: i32, v2: i64):
v3 = heap_addr.i64 heap1, v1, 0
; check: v3 = heap_addr.i64 heap1, v1, 0
return v3
@@ -75,7 +75,7 @@ function %dheap(i32, i64 vmctx) -> i64 {
; check: heap1 = dynamic gv5, min 0x0001_0000, bound gv6, offset_guard 0x8000_0000
; check: heap2 = dynamic gv5, min 0, bound gv6, offset_guard 4096
ebb0(v1: i32, v2: i64):
block0(v1: i32, v2: i64):
v3 = heap_addr.i64 heap2, v1, 0
; check: v3 = heap_addr.i64 heap2, v1, 0
return v3

View File

@@ -1,16 +1,16 @@
; It is possible to refer to instructions and EBBs that have not yet been
; It is possible to refer to instructions and blocks that have not yet been
; defined in the lexical order.
test cat
; Defining numbers.
function %defs() {
ebb100(v20: i32):
block100(v20: i32):
v1000 = iconst.i32x8 5
v9200 = f64const 0x4.0p0
trap user4
}
; sameln: function %defs() fast {
; nextln: ebb100(v20: i32):
; nextln: block100(v20: i32):
; nextln: v1000 = iconst.i32x8 5
; nextln: v9200 = f64const 0x1.0000000000000p2
; nextln: trap user4
@@ -18,14 +18,14 @@ ebb100(v20: i32):
; Using values.
function %use_value() {
ebb100(v20: i32):
block100(v20: i32):
v1000 = iadd_imm v20, 5
v200 = iadd v20, v1000
jump ebb100(v1000)
jump block100(v1000)
}
; sameln: function %use_value() fast {
; nextln: ebb100(v20: i32):
; nextln: block100(v20: i32):
; nextln: v1000 = iadd_imm v20, 5
; nextln: v200 = iadd v20, v1000
; nextln: jump ebb100(v1000)
; nextln: jump block100(v1000)
; nextln: }

View File

@@ -2,7 +2,7 @@ test cat
test verifier
function %add_i96(i32, i32, i32, i32, i32, i32) -> i32, i32, i32 {
ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
block1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
v10, v11 = iadd_ifcout v1, v4
;check: v10, v11 = iadd_ifcout v1, v4
v20, v21 = iadd_ifcarry v2, v5, v11
@@ -13,7 +13,7 @@ ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
}
function %sub_i96(i32, i32, i32, i32, i32, i32) -> i32, i32, i32 {
ebb1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
block1(v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
v10, v11 = isub_ifbout v1, v4
;check: v10, v11 = isub_ifbout v1, v4
v20, v21 = isub_ifborrow v2, v5, v11

View File

@@ -2,24 +2,24 @@ test cat
; The smallest possible function.
function %minimal() {
ebb0:
block0:
trap user0
}
; sameln: function %minimal() fast {
; nextln: ebb0:
; nextln: block0:
; nextln: trap user0
; nextln: }
; Create and use values.
; Polymorphic instructions with type suffix.
function %ivalues() {
ebb0:
block0:
v0 = iconst.i32 2
v1 = iconst.i8 6
v2 = ishl v0, v1
}
; sameln: function %ivalues() fast {
; nextln: ebb0:
; nextln: block0:
; nextln: v0 = iconst.i32 2
; nextln: v1 = iconst.i8 6
; nextln: v2 = ishl v0, v1
@@ -28,14 +28,14 @@ ebb0:
; Create and use values.
; Polymorphic instructions with type suffix.
function %bvalues() {
ebb0:
block0:
v0 = bconst.b32 true
v1 = bconst.b8 false
v2 = bextend.b32 v1
v3 = bxor v0, v2
}
; sameln: function %bvalues() fast {
; nextln: ebb0:
; nextln: block0:
; nextln: v0 = bconst.b32 true
; nextln: v1 = bconst.b8 false
; nextln: v2 = bextend.b32 v1
@@ -44,33 +44,33 @@ ebb0:
; Polymorphic instruction controlled by second operand.
function %select() {
ebb0(v90: i32, v91: i32, v92: b1):
block0(v90: i32, v91: i32, v92: b1):
v0 = select v92, v90, v91
}
; sameln: function %select() fast {
; nextln: ebb0(v90: i32, v91: i32, v92: b1):
; nextln: block0(v90: i32, v91: i32, v92: b1):
; nextln: v0 = select v92, v90, v91
; nextln: }
; Polymorphic instruction controlled by third operand.
function %selectif() system_v {
ebb0(v95: i32, v96: i32, v97: b1):
block0(v95: i32, v96: i32, v97: b1):
v98 = selectif.i32 eq v97, v95, v96
}
; sameln: function %selectif() system_v {
; nextln: ebb0(v95: i32, v96: i32, v97: b1):
; nextln: block0(v95: i32, v96: i32, v97: b1):
; nextln: v98 = selectif.i32 eq v97, v95, v96
; nextln: }
; Lane indexes.
function %lanes() {
ebb0:
block0:
v0 = iconst.i32x4 2
v1 = extractlane v0, 3
v2 = insertlane v0, 1, v1
}
; sameln: function %lanes() fast {
; nextln: ebb0:
; nextln: block0:
; nextln: v0 = iconst.i32x4 2
; nextln: v1 = extractlane v0, 3
; nextln: v2 = insertlane v0, 1, v1
@@ -78,31 +78,31 @@ ebb0:
; Integer condition codes.
function %icmp(i32, i32) {
ebb0(v90: i32, v91: i32):
block0(v90: i32, v91: i32):
v0 = icmp eq v90, v91
v1 = icmp ult v90, v91
v2 = icmp_imm sge v90, -12
v3 = irsub_imm v91, 45
br_icmp eq v90, v91, ebb0(v91, v90)
br_icmp eq v90, v91, block0(v91, v90)
}
; sameln: function %icmp(i32, i32) fast {
; nextln: ebb0(v90: i32, v91: i32):
; nextln: block0(v90: i32, v91: i32):
; nextln: v0 = icmp eq v90, v91
; nextln: v1 = icmp ult v90, v91
; nextln: v2 = icmp_imm sge v90, -12
; nextln: v3 = irsub_imm v91, 45
; nextln: br_icmp eq v90, v91, ebb0(v91, v90)
; nextln: br_icmp eq v90, v91, block0(v91, v90)
; nextln: }
; Floating condition codes.
function %fcmp(f32, f32) {
ebb0(v90: f32, v91: f32):
block0(v90: f32, v91: f32):
v0 = fcmp eq v90, v91
v1 = fcmp uno v90, v91
v2 = fcmp lt v90, v91
}
; sameln: function %fcmp(f32, f32) fast {
; nextln: ebb0(v90: f32, v91: f32):
; nextln: block0(v90: f32, v91: f32):
; nextln: v0 = fcmp eq v90, v91
; nextln: v1 = fcmp uno v90, v91
; nextln: v2 = fcmp lt v90, v91
@@ -111,12 +111,12 @@ ebb0(v90: f32, v91: f32):
; The bitcast instruction has two type variables: The controlling type variable
; controls the outout type, and the input type is a free variable.
function %bitcast(i32, f32) {
ebb0(v90: i32, v91: f32):
block0(v90: i32, v91: f32):
v0 = bitcast.i8x4 v90
v1 = bitcast.i32 v91
}
; sameln: function %bitcast(i32, f32) fast {
; nextln: ebb0(v90: i32, v91: f32):
; nextln: block0(v90: i32, v91: f32):
; nextln: v0 = bitcast.i8x4 v90
; nextln: v1 = bitcast.i32 v91
; nextln: }
@@ -129,7 +129,7 @@ function %stack() {
ss4 = outgoing_arg 4
ss5 = emergency_slot 4
ebb0:
block0:
v1 = stack_load.i32 ss10
v2 = stack_load.i32 ss10+4
stack_store v1, ss10+2
@@ -142,7 +142,7 @@ ebb0:
; check: ss5 = emergency_slot 4
; check: ss10 = spill_slot 8
; check: ebb0:
; check: block0:
; nextln: v1 = stack_load.i32 ss10
; nextln: v2 = stack_load.i32 ss10+4
; nextln: stack_store v1, ss10+2
@@ -150,7 +150,7 @@ ebb0:
; Memory access instructions.
function %memory(i32) {
ebb0(v1: i32):
block0(v1: i32):
v2 = load.i64 v1
v3 = load.i64 aligned v1
v4 = load.i64 notrap v1
@@ -167,7 +167,7 @@ ebb0(v1: i32):
store_complex v3, v1+v2+0x1
}
; sameln: function %memory(i32) fast {
; nextln: ebb0(v1: i32):
; nextln: block0(v1: i32):
; nextln: v2 = load.i64 v1
; nextln: v3 = load.i64 aligned v1
; nextln: v4 = load.i64 notrap v1
@@ -188,7 +188,7 @@ ebb0(v1: i32):
function %diversion(i32) {
ss0 = spill_slot 4
ebb0(v1: i32):
block0(v1: i32):
regmove v1, %10 -> %20
regmove v1, %20 -> %10
regspill v1, %10 -> ss0
@@ -197,7 +197,7 @@ ebb0(v1: i32):
}
; sameln: function %diversion(i32) fast {
; nextln: ss0 = spill_slot 4
; check: ebb0(v1: i32):
; check: block0(v1: i32):
; nextln: regmove v1, %10 -> %20
; nextln: regmove v1, %20 -> %10
; nextln: regspill v1, %10 -> ss0
@@ -207,20 +207,20 @@ ebb0(v1: i32):
; Register copies.
function %copy_special() {
ebb0:
block0:
copy_special %10 -> %20
copy_special %20 -> %10
return
}
; sameln: function %copy_special() fast {
; nextln: ebb0:
; nextln: block0:
; nextln: copy_special %10 -> %20
; nextln: copy_special %20 -> %10
; nextln: return
; nextln: }
function %cond_traps(i32) {
ebb0(v0: i32):
block0(v0: i32):
trapz v0, stk_ovf
v1 = ifcmp_imm v0, 5
trapif ugt v1, oob
@@ -230,7 +230,7 @@ ebb0(v0: i32):
return
}
; sameln: function %cond_traps(i32)
; nextln: ebb0(v0: i32):
; nextln: block0(v0: i32):
; nextln: trapz v0, stk_ovf
; nextln: v1 = ifcmp_imm v0, 5
; nextln: trapif ugt v1, oob