Implement coloring::iterate_solution().

It can happen that the currently live registers are blocking a smaller
register class completely, so the only way of solving the allocation
problem is to turn some of the live-through registers into solver
variables.

When the quick_solve attempt fails, try to free up registers in the
critical register class by turning live-through values into solver
variables.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-29 14:38:30 -07:00
parent 86e22e7de5
commit 51a6901a7f
5 changed files with 181 additions and 6 deletions

View File

@@ -167,7 +167,7 @@ impl RegClassData {
}
/// Returns true if `other` is a subclass of this register class.
/// A register class is considerd to be a subclass of itself.
/// A register class is considered to be a subclass of itself.
pub fn has_subclass<RCI: Into<RegClassIndex>>(&self, other: RCI) -> bool {
self.subclasses & (1 << other.into().0) != 0
}
@@ -276,6 +276,11 @@ impl RegInfo {
pub fn rc(&self, idx: RegClassIndex) -> RegClass {
&self.classes[idx.index()]
}
/// Get the top-level register class containing `rc`.
pub fn toprc(&self, rc: RegClass) -> RegClass {
&self.classes[rc.toprc as usize]
}
}
/// Temporary object that holds enough information to print a register unit.