Process ghost instruction kills during coloring.

Ghost instructions don't generate code, but they can keep registers
alive. The coloring pass needs to process values killed by ghost
instructions so it knows when the registers are freed up.

Also track register pressure changes from ghost kills in the spiller.
This commit is contained in:
Jakob Stoklund Olesen
2017-06-27 16:04:50 -07:00
parent c073d919f4
commit 165e80d9bf
4 changed files with 69 additions and 3 deletions

View File

@@ -280,6 +280,16 @@ impl LiveValueTracker {
&self.live.values[first_def..])
}
/// Prepare to move past a ghost instruction.
///
/// This is like `process_inst`, except any defs are ignored.
///
/// Returns `(throughs, kills)`.
pub fn process_ghost(&mut self, inst: Inst) -> (&[LiveValue], &[LiveValue]) {
let first_kill = self.live.live_after(inst);
self.live.values.as_slice().split_at(first_kill)
}
/// Drop the values that are now dead after moving past `inst`.
///
/// This removes both live values that were killed by `inst` and dead defines on `inst` itself.