Move default blocks into jump tables (#5756)

Move the default block off of the br_table instrution, and into the JumpTable that it references.
This commit is contained in:
Trevor Elliott
2023-02-10 08:53:30 -08:00
committed by GitHub
parent 49613be393
commit d99783fc91
21 changed files with 118 additions and 175 deletions

View File

@@ -15,10 +15,6 @@ pub(crate) struct EntityRefs {
/// This is primarily used in control flow instructions.
pub(crate) block_call: OperandKind,
/// A reference to a basic block in the same function.
/// This is primarily used in control flow instructions.
pub(crate) label: OperandKind,
/// A reference to a basic block in the same function, with its arguments provided.
/// This is primarily used in control flow instructions.
pub(crate) block_then: OperandKind,
@@ -63,12 +59,6 @@ impl EntityRefs {
"a basic block in the same function, with its arguments provided.",
),
label: new(
"destination",
"ir::Block",
"a basic block in the same function.",
),
block_then: new(
"block_then",
"ir::BlockCall",

View File

@@ -117,7 +117,6 @@ impl Formats {
branch_table: Builder::new("BranchTable")
.value()
.imm(&entities.label)
.imm(&entities.jump_table)
.build(),

View File

@@ -19,7 +19,6 @@ fn define_control_flow(
) {
let block_call = &Operand::new("block_call", &entities.block_call)
.with_doc("Destination basic block, with its arguments provided");
let label = &Operand::new("label", &entities.label).with_doc("Destination basic block");
ig.push(
Inst::new(
@@ -93,7 +92,7 @@ fn define_control_flow(
"#,
&formats.branch_table,
)
.operands_in(vec![x, label, JT])
.operands_in(vec![x, JT])
.branches(),
);
}