refactor(mir): phase260 p0.2 hide legacy edge-args reads behind BasicBlock API
- Add block.return_env() getter for Return env metadata - Update instruction_rewriter.rs to use block.return_env() - Update exit_collection.rs to use block.return_env() - Prepare for Phase 260 P2 (jump_args deletion) This consolidates all legacy edge-args reads through BasicBlock API, enabling clean deletion of jump_args field in P2.
This commit is contained in:
@ -360,6 +360,20 @@ impl BasicBlock {
|
||||
})
|
||||
}
|
||||
|
||||
/// Get edge-args from the current terminator (migration helper)
|
||||
///
|
||||
/// Jump uses its edge-args operand when present, otherwise falls back to
|
||||
/// stored metadata. Return relies on stored metadata.
|
||||
pub fn edge_args_from_terminator(&self) -> Option<EdgeArgs> {
|
||||
match self.terminator {
|
||||
Some(MirInstruction::Jump { ref edge_args, .. }) => {
|
||||
edge_args.clone().or_else(|| self.legacy_edge_args())
|
||||
}
|
||||
Some(MirInstruction::Return { .. }) => self.legacy_edge_args(),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a predecessor
|
||||
pub fn add_predecessor(&mut self, pred: BasicBlockId) {
|
||||
self.predecessors.insert(pred);
|
||||
|
||||
Reference in New Issue
Block a user