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:
@@ -708,8 +708,8 @@ macro_rules! def {
|
||||
}
|
||||
|
||||
// Helper macro to define legalization recipes.
|
||||
macro_rules! ebb {
|
||||
// An basic block definition, splitting the current block in 2.
|
||||
macro_rules! block {
|
||||
// a basic block definition, splitting the current block in 2.
|
||||
($block: ident) => {
|
||||
ExprBuilder::block($block).assign_to(Vec::new())
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ pub(crate) struct InstructionContent {
|
||||
/// Indices in operands_out of output operands that are values.
|
||||
pub value_results: Vec<usize>,
|
||||
|
||||
/// True for instructions that terminate the EBB.
|
||||
/// True for instructions that terminate the block.
|
||||
pub is_terminator: bool,
|
||||
/// True for all branch or jump instructions.
|
||||
pub is_branch: bool,
|
||||
|
||||
@@ -450,7 +450,7 @@ fn gen_opcodes(all_inst: &AllInstructions, fmt: &mut Formatter) {
|
||||
all_inst,
|
||||
|inst| inst.is_terminator,
|
||||
"is_terminator",
|
||||
"True for instructions that terminate the EBB",
|
||||
"True for instructions that terminate the block",
|
||||
fmt,
|
||||
);
|
||||
gen_bool_accessor(
|
||||
|
||||
@@ -474,7 +474,7 @@ fn gen_transform<'a>(
|
||||
// If we are adding some blocks, we need to recall the original block, such that we can
|
||||
// recompute it.
|
||||
if !transform.block_pool.is_empty() {
|
||||
fmt.line("let orig_ebb = pos.current_ebb().unwrap();");
|
||||
fmt.line("let orig_block = pos.current_block().unwrap();");
|
||||
}
|
||||
|
||||
// If we're going to delete `inst`, we need to detach its results first so they can be
|
||||
@@ -486,14 +486,14 @@ fn gen_transform<'a>(
|
||||
// Emit new block creation.
|
||||
for block in &transform.block_pool {
|
||||
let var = transform.var_pool.get(block.name);
|
||||
fmtln!(fmt, "let {} = pos.func.dfg.make_ebb();", var.name);
|
||||
fmtln!(fmt, "let {} = pos.func.dfg.make_block();", var.name);
|
||||
}
|
||||
|
||||
// Emit the destination pattern.
|
||||
for &def_index in &transform.dst {
|
||||
if let Some(block) = transform.block_pool.get(def_index) {
|
||||
let var = transform.var_pool.get(block.name);
|
||||
fmtln!(fmt, "pos.insert_ebb({});", var.name);
|
||||
fmtln!(fmt, "pos.insert_block({});", var.name);
|
||||
}
|
||||
emit_dst_inst(
|
||||
transform.def_pool.get(def_index),
|
||||
@@ -507,7 +507,7 @@ fn gen_transform<'a>(
|
||||
let def_next_index = transform.def_pool.next_index();
|
||||
if let Some(block) = transform.block_pool.get(def_next_index) {
|
||||
let var = transform.var_pool.get(block.name);
|
||||
fmtln!(fmt, "pos.insert_ebb({});", var.name);
|
||||
fmtln!(fmt, "pos.insert_block({});", var.name);
|
||||
}
|
||||
|
||||
// Delete the original instruction if we didn't have an opportunity to replace it.
|
||||
@@ -520,14 +520,14 @@ fn gen_transform<'a>(
|
||||
if transform.def_pool.get(transform.src).apply.inst.is_branch {
|
||||
// A branch might have been legalized into multiple branches, so we need to recompute
|
||||
// the cfg.
|
||||
fmt.line("cfg.recompute_ebb(pos.func, pos.current_ebb().unwrap());");
|
||||
fmt.line("cfg.recompute_block(pos.func, pos.current_block().unwrap());");
|
||||
}
|
||||
} else {
|
||||
// Update CFG for the new blocks.
|
||||
fmt.line("cfg.recompute_ebb(pos.func, orig_ebb);");
|
||||
fmt.line("cfg.recompute_block(pos.func, orig_block);");
|
||||
for block in &transform.block_pool {
|
||||
let var = transform.var_pool.get(block.name);
|
||||
fmtln!(fmt, "cfg.recompute_ebb(pos.func, {});", var.name);
|
||||
fmtln!(fmt, "cfg.recompute_block(pos.func, {});", var.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ fn new(format_field_name: &'static str, rust_type: &'static str, doc: &'static s
|
||||
}
|
||||
|
||||
pub(crate) struct EntityRefs {
|
||||
/// A reference to an extended basic block in the same function.
|
||||
/// A reference to a basic block in the same function.
|
||||
/// This is primarliy used in control flow instructions.
|
||||
pub(crate) ebb: OperandKind,
|
||||
pub(crate) block: OperandKind,
|
||||
|
||||
/// A reference to a stack slot declared in the function preamble.
|
||||
pub(crate) stack_slot: OperandKind,
|
||||
@@ -33,17 +33,17 @@ pub(crate) struct EntityRefs {
|
||||
/// A reference to a table declared in the function preamble.
|
||||
pub(crate) table: OperandKind,
|
||||
|
||||
/// A variable-sized list of value operands. Use for Ebb and function call arguments.
|
||||
/// A variable-sized list of value operands. Use for Block and function call arguments.
|
||||
pub(crate) varargs: OperandKind,
|
||||
}
|
||||
|
||||
impl EntityRefs {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
ebb: new(
|
||||
block: new(
|
||||
"destination",
|
||||
"ir::Ebb",
|
||||
"An extended basic block in the same function.",
|
||||
"ir::Block",
|
||||
"a basic block in the same function.",
|
||||
),
|
||||
stack_slot: new("stack_slot", "ir::StackSlot", "A stack slot"),
|
||||
|
||||
@@ -64,7 +64,7 @@ impl EntityRefs {
|
||||
A variable size list of `value` operands.
|
||||
|
||||
Use this to represent arguments passed to a function call, arguments
|
||||
passed to an extended basic block, or a variable number of results
|
||||
passed to a basic block, or a variable number of results
|
||||
returned from an instruction.
|
||||
"#,
|
||||
),
|
||||
|
||||
@@ -140,25 +140,25 @@ impl Formats {
|
||||
.value()
|
||||
.build(),
|
||||
|
||||
jump: Builder::new("Jump").imm(&entities.ebb).varargs().build(),
|
||||
jump: Builder::new("Jump").imm(&entities.block).varargs().build(),
|
||||
|
||||
branch: Builder::new("Branch")
|
||||
.value()
|
||||
.imm(&entities.ebb)
|
||||
.imm(&entities.block)
|
||||
.varargs()
|
||||
.build(),
|
||||
|
||||
branch_int: Builder::new("BranchInt")
|
||||
.imm(&imm.intcc)
|
||||
.value()
|
||||
.imm(&entities.ebb)
|
||||
.imm(&entities.block)
|
||||
.varargs()
|
||||
.build(),
|
||||
|
||||
branch_float: Builder::new("BranchFloat")
|
||||
.imm(&imm.floatcc)
|
||||
.value()
|
||||
.imm(&entities.ebb)
|
||||
.imm(&entities.block)
|
||||
.varargs()
|
||||
.build(),
|
||||
|
||||
@@ -166,13 +166,13 @@ impl Formats {
|
||||
.imm(&imm.intcc)
|
||||
.value()
|
||||
.value()
|
||||
.imm(&entities.ebb)
|
||||
.imm(&entities.block)
|
||||
.varargs()
|
||||
.build(),
|
||||
|
||||
branch_table: Builder::new("BranchTable")
|
||||
.value()
|
||||
.imm(&entities.ebb)
|
||||
.imm(&entities.block)
|
||||
.imm(&entities.jump_table)
|
||||
.build(),
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ fn define_control_flow(
|
||||
imm: &Immediates,
|
||||
entities: &EntityRefs,
|
||||
) {
|
||||
let EBB = &Operand::new("EBB", &entities.ebb).with_doc("Destination extended basic block");
|
||||
let args = &Operand::new("args", &entities.varargs).with_doc("EBB arguments");
|
||||
let block = &Operand::new("block", &entities.block).with_doc("Destination basic block");
|
||||
let args = &Operand::new("args", &entities.varargs).with_doc("block arguments");
|
||||
|
||||
ig.push(
|
||||
Inst::new(
|
||||
@@ -27,13 +27,13 @@ fn define_control_flow(
|
||||
r#"
|
||||
Jump.
|
||||
|
||||
Unconditionally jump to an extended basic block, passing the specified
|
||||
EBB arguments. The number and types of arguments must match the
|
||||
destination EBB.
|
||||
Unconditionally jump to a basic block, passing the specified
|
||||
block arguments. The number and types of arguments must match the
|
||||
destination block.
|
||||
"#,
|
||||
&formats.jump,
|
||||
)
|
||||
.operands_in(vec![EBB, args])
|
||||
.operands_in(vec![block, args])
|
||||
.is_terminator(true)
|
||||
.is_branch(true),
|
||||
);
|
||||
@@ -42,9 +42,9 @@ fn define_control_flow(
|
||||
Inst::new(
|
||||
"fallthrough",
|
||||
r#"
|
||||
Fall through to the next EBB.
|
||||
Fall through to the next block.
|
||||
|
||||
This is the same as `jump`, except the destination EBB must be
|
||||
This is the same as `jump`, except the destination block must be
|
||||
the next one in the layout.
|
||||
|
||||
Jumps are turned into fall-through instructions by the branch
|
||||
@@ -53,7 +53,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.jump,
|
||||
)
|
||||
.operands_in(vec![EBB, args])
|
||||
.operands_in(vec![block, args])
|
||||
.is_terminator(true)
|
||||
.is_branch(true),
|
||||
);
|
||||
@@ -81,7 +81,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.branch,
|
||||
)
|
||||
.operands_in(vec![c, EBB, args])
|
||||
.operands_in(vec![c, block, args])
|
||||
.is_branch(true),
|
||||
);
|
||||
|
||||
@@ -96,7 +96,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.branch,
|
||||
)
|
||||
.operands_in(vec![c, EBB, args])
|
||||
.operands_in(vec![c, block, args])
|
||||
.is_branch(true),
|
||||
);
|
||||
}
|
||||
@@ -124,14 +124,14 @@ fn define_control_flow(
|
||||
and take the branch if the condition is true:
|
||||
|
||||
```text
|
||||
br_icmp ugt v1, v2, ebb4(v5, v6)
|
||||
br_icmp ugt v1, v2, block4(v5, v6)
|
||||
```
|
||||
|
||||
is semantically equivalent to:
|
||||
|
||||
```text
|
||||
v10 = icmp ugt, v1, v2
|
||||
brnz v10, ebb4(v5, v6)
|
||||
brnz v10, block4(v5, v6)
|
||||
```
|
||||
|
||||
Some RISC architectures like MIPS and RISC-V provide instructions that
|
||||
@@ -140,7 +140,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.branch_icmp,
|
||||
)
|
||||
.operands_in(vec![Cond, x, y, EBB, args])
|
||||
.operands_in(vec![Cond, x, y, block, args])
|
||||
.is_branch(true),
|
||||
);
|
||||
|
||||
@@ -154,7 +154,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.branch_int,
|
||||
)
|
||||
.operands_in(vec![Cond, f, EBB, args])
|
||||
.operands_in(vec![Cond, f, block, args])
|
||||
.is_branch(true),
|
||||
);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.branch_float,
|
||||
)
|
||||
.operands_in(vec![Cond, f, EBB, args])
|
||||
.operands_in(vec![Cond, f, block, args])
|
||||
.is_branch(true),
|
||||
);
|
||||
}
|
||||
@@ -188,8 +188,8 @@ fn define_control_flow(
|
||||
Indirect branch via jump table.
|
||||
|
||||
Use ``x`` as an unsigned index into the jump table ``JT``. If a jump
|
||||
table entry is found, branch to the corresponding EBB. If no entry was
|
||||
found or the index is out-of-bounds, branch to the given default EBB.
|
||||
table entry is found, branch to the corresponding block. If no entry was
|
||||
found or the index is out-of-bounds, branch to the given default block.
|
||||
|
||||
Note that this branch instruction can't pass arguments to the targeted
|
||||
blocks. Split critical edges as needed to work around this.
|
||||
@@ -202,7 +202,7 @@ fn define_control_flow(
|
||||
"#,
|
||||
&formats.branch_table,
|
||||
)
|
||||
.operands_in(vec![x, EBB, JT])
|
||||
.operands_in(vec![x, block, JT])
|
||||
.is_terminator(true)
|
||||
.is_branch(true),
|
||||
);
|
||||
@@ -1407,7 +1407,7 @@ pub(crate) fn define(
|
||||
satisfy instruction constraints.
|
||||
|
||||
The register diversions created by this instruction must be undone
|
||||
before the value leaves the EBB. At the entry to a new EBB, all live
|
||||
before the value leaves the block. At the entry to a new block, all live
|
||||
values must be in their originally assigned registers.
|
||||
"#,
|
||||
&formats.reg_move,
|
||||
|
||||
@@ -197,9 +197,9 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
|
||||
let al = var("al");
|
||||
let ah = var("ah");
|
||||
let cc = var("cc");
|
||||
let ebb = var("ebb");
|
||||
let ebb1 = var("ebb1");
|
||||
let ebb2 = var("ebb2");
|
||||
let block = var("block");
|
||||
let block1 = var("block1");
|
||||
let block2 = var("block2");
|
||||
let ptr = var("ptr");
|
||||
let flags = var("flags");
|
||||
let offset = var("off");
|
||||
@@ -269,7 +269,7 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
|
||||
);
|
||||
|
||||
narrow.legalize(
|
||||
def!(brz.I128(x, ebb, vararg)),
|
||||
def!(brz.I128(x, block, vararg)),
|
||||
vec![
|
||||
def!((xl, xh) = isplit(x)),
|
||||
def!(
|
||||
@@ -287,18 +287,18 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
|
||||
)
|
||||
),
|
||||
def!(c = band(a, b)),
|
||||
def!(brnz(c, ebb, vararg)),
|
||||
def!(brnz(c, block, vararg)),
|
||||
],
|
||||
);
|
||||
|
||||
narrow.legalize(
|
||||
def!(brnz.I128(x, ebb1, vararg)),
|
||||
def!(brnz.I128(x, block1, vararg)),
|
||||
vec![
|
||||
def!((xl, xh) = isplit(x)),
|
||||
def!(brnz(xl, ebb1, vararg)),
|
||||
def!(jump(ebb2, Literal::empty_vararg())),
|
||||
ebb!(ebb2),
|
||||
def!(brnz(xh, ebb1, vararg)),
|
||||
def!(brnz(xl, block1, vararg)),
|
||||
def!(jump(block2, Literal::empty_vararg())),
|
||||
block!(block2),
|
||||
def!(brnz(xh, block1, vararg)),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -619,13 +619,13 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
|
||||
|
||||
for &ty in &[I8, I16] {
|
||||
widen.legalize(
|
||||
def!(brz.ty(x, ebb, vararg)),
|
||||
vec![def!(a = uextend.I32(x)), def!(brz(a, ebb, vararg))],
|
||||
def!(brz.ty(x, block, vararg)),
|
||||
vec![def!(a = uextend.I32(x)), def!(brz(a, block, vararg))],
|
||||
);
|
||||
|
||||
widen.legalize(
|
||||
def!(brnz.ty(x, ebb, vararg)),
|
||||
vec![def!(a = uextend.I32(x)), def!(brnz(a, ebb, vararg))],
|
||||
def!(brnz.ty(x, block, vararg)),
|
||||
vec![def!(a = uextend.I32(x)), def!(brnz(a, block, vararg))],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user