Use EncCursor for reload.rs.

Same deal as for spilling. Place an EncCursor in the context and use
that to reference into the IR function when necessary.
This commit is contained in:
Jakob Stoklund Olesen
2017-08-04 15:02:46 -07:00
parent f15abe7154
commit e904bff420
2 changed files with 98 additions and 133 deletions

View File

@@ -709,8 +709,7 @@ pub trait CursorBase {
fn at_first_inst(mut self, ebb: Ebb) -> Self
where Self: Sized
{
let inst = self.layout().ebbs[ebb].first_inst.expect("Empty EBB");
self.goto_inst(inst);
self.goto_first_inst(ebb);
self
}
@@ -740,6 +739,12 @@ pub trait CursorBase {
self.set_position(CursorPosition::At(inst));
}
/// Go to the first instruction in `ebb`.
fn goto_first_inst(&mut self, ebb: Ebb) {
let inst = self.layout().ebbs[ebb].first_inst.expect("Empty EBB");
self.set_position(CursorPosition::At(inst));
}
/// Go to the top of `ebb` which must be inserted into the layout.
/// At this position, instructions cannot be inserted, but `next_inst()` will move to the first
/// instruction in `ebb`.