Rework br_table to use BlockCall (#5731)
Rework br_table to use BlockCall, allowing us to avoid adding new nodes during ssa construction to hold block arguments. Additionally, many places where we previously matched on InstructionData to extract branch destinations can be replaced with a use of branch_destination or branch_destination_mut.
This commit is contained in:
@@ -377,9 +377,14 @@ mod test {
|
||||
let mut pos = FuncCursor::new(&mut func);
|
||||
|
||||
pos.insert_block(bb0);
|
||||
let jt = pos
|
||||
.func
|
||||
.create_jump_table(JumpTableData::new(bb3, &[bb1, bb2]));
|
||||
let jt_data = JumpTableData::new(
|
||||
pos.func.dfg.block_call(bb3, &[]),
|
||||
&[
|
||||
pos.func.dfg.block_call(bb1, &[]),
|
||||
pos.func.dfg.block_call(bb2, &[]),
|
||||
],
|
||||
);
|
||||
let jt = pos.func.create_jump_table(jt_data);
|
||||
pos.ins().br_table(arg0, jt);
|
||||
|
||||
pos.insert_block(bb1);
|
||||
|
||||
@@ -418,9 +418,14 @@ mod test {
|
||||
let mut pos = FuncCursor::new(&mut func);
|
||||
|
||||
pos.insert_block(bb0);
|
||||
let jt = pos
|
||||
.func
|
||||
.create_jump_table(JumpTableData::new(bb3, &[bb1, bb2]));
|
||||
let jt_data = JumpTableData::new(
|
||||
pos.func.dfg.block_call(bb3, &[]),
|
||||
&[
|
||||
pos.func.dfg.block_call(bb1, &[]),
|
||||
pos.func.dfg.block_call(bb2, &[]),
|
||||
],
|
||||
);
|
||||
let jt = pos.func.create_jump_table(jt_data);
|
||||
pos.ins().br_table(arg0, jt);
|
||||
|
||||
pos.insert_block(bb1);
|
||||
|
||||
Reference in New Issue
Block a user