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:
@@ -349,8 +349,11 @@ where
|
||||
// Interpret a Cranelift instruction.
|
||||
Ok(match inst.opcode() {
|
||||
Opcode::Jump => {
|
||||
let block = inst.branch_destination()[0];
|
||||
continue_at(block)?
|
||||
if let InstructionData::Jump { destination, .. } = inst {
|
||||
continue_at(destination)?
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
Opcode::Brif => {
|
||||
if let InstructionData::Brif {
|
||||
@@ -383,7 +386,7 @@ where
|
||||
.copied()
|
||||
.unwrap_or(jt_data.default_block());
|
||||
|
||||
ControlFlow::ContinueAt(jump_target, SmallVec::new())
|
||||
continue_at(jump_target)?
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user