Tweak comments in regalloc code.

This commit is contained in:
Benjamin Bouvier
2019-10-29 18:20:42 +01:00
parent d6b3ca28b4
commit 8c2d9fd32f
2 changed files with 4 additions and 9 deletions

View File

@@ -92,10 +92,8 @@ impl Affinity {
// to change anything.
if constraint.kind != ConstraintKind::Stack && !constraint.regclass.has_subclass(rc)
{
// If the register classes don't overlap, `intersect` returns `Unassigned`, and
// we just keep our previous affinity.
// If the register classes overlap, try to shrink our preferred register class.
if let Some(subclass) = constraint.regclass.intersect_index(reginfo.rc(rc)) {
// This constraint shrinks our preferred register class.
*self = Self::Reg(subclass);
}
}

View File

@@ -389,7 +389,6 @@ impl Liveness {
// The liveness computation needs to visit all uses, but the order doesn't matter.
// TODO: Perhaps this traversal of the function could be combined with a dead code
// elimination pass if we visit a post-order of the dominator tree?
// TODO: Resolve value aliases while we're visiting instructions?
for ebb in func.layout.ebbs() {
// Make sure we have created live ranges for dead EBB parameters.
// TODO: If these parameters are really dead, we could remove them, except for the
@@ -436,11 +435,9 @@ impl Liveness {
impl Index<Value> for Liveness {
type Output = LiveRange;
fn index(&self, index: Value) -> &LiveRange {
match self.ranges.get(index) {
Some(lr) => lr,
None => panic!("{} has no live range", index),
}
self.ranges
.get(index)
.unwrap_or_else(|| panic!("{} has no live range", index))
}
}