Re-introduce optional dedicated scratch registers (#117)
* Re-introduce optional dedicated scratch registers Dedicated scratch registers used for resolving move cycles were removed in #51 and replaced with an algorithm to automatically allocate a scratch register as needed. However in many cases, a client will already have a non-allocatable scratch register available for things like extended jumps (see #91). It makes sense to re-use this register for regalloc than potentially spilling an existing register. * Clarify comment
This commit is contained in:
@@ -986,6 +986,9 @@ impl<'a, F: Function> Env<'a, F> {
|
||||
to: pos_prio.pos.next(),
|
||||
});
|
||||
let get_reg = || {
|
||||
if let Some(reg) = self.env.scratch_by_class[regclass as usize] {
|
||||
return Some(Allocation::reg(reg));
|
||||
}
|
||||
while let Some(preg) = scratch_iter.next() {
|
||||
if !self.pregs[preg.index()]
|
||||
.allocations
|
||||
|
||||
Reference in New Issue
Block a user