Use more helper functions on CursorBase to reduce cursor repositioning.
This commit is contained in:
@@ -62,8 +62,7 @@ fn legalize_entry_arguments(func: &mut Function, entry: Ebb) {
|
||||
// Insert position for argument conversion code.
|
||||
// We want to insert instructions before the first instruction in the entry block.
|
||||
// If the entry block is empty, append instructions to it instead.
|
||||
let mut pos = Cursor::new(&mut func.layout);
|
||||
pos.goto_first_inst(entry);
|
||||
let mut pos = Cursor::new(&mut func.layout).at_first_inst(entry);
|
||||
|
||||
// Keep track of the argument types in the ABI-legalized signature.
|
||||
let abi_types = &func.signature.argument_types;
|
||||
|
||||
@@ -137,8 +137,7 @@ fn expand_cond_trap(inst: ir::Inst, func: &mut ir::Function, cfg: &mut ControlFl
|
||||
func.dfg.replace(inst).brz(arg, new_ebb, &[]);
|
||||
}
|
||||
|
||||
let mut pos = FuncCursor::new(func).at_inst(inst);
|
||||
pos.next_inst();
|
||||
let mut pos = FuncCursor::new(func).after_inst(inst);
|
||||
pos.ins().trap();
|
||||
pos.insert_ebb(new_ebb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user