Remove register class from SpillSlot (#80)

* Remove register class from `SpillSlot`

The register allocator was already allowing moves between spillslots and
registers of different classes, so this PR formalizes this by making
spillslots independent of register class.

This also fixes #79 by properly tracking the register class of an
`InsertedMove` with the `to_vreg` field which turns out to never
be `None` in practice. Removing the `Option` allows the register
class of the `VReg` to be used when building the per-class move lists.

Fixes #79

* Address review feedback
This commit is contained in:
Amanieu d'Antras
2022-09-21 05:05:23 +08:00
committed by GitHub
parent 3db1b7199b
commit 906a053208
6 changed files with 40 additions and 74 deletions

View File

@@ -440,7 +440,7 @@ impl<'a, F: Function> Env<'a, F> {
#[derive(Clone, Debug)]
pub struct SpillSlotData {
pub ranges: LiveRangeSet,
pub class: RegClass,
pub slots: u32,
pub alloc: Allocation,
}
@@ -580,7 +580,7 @@ pub struct InsertedMove {
pub pos_prio: PosWithPrio,
pub from_alloc: Allocation,
pub to_alloc: Allocation,
pub to_vreg: Option<VReg>,
pub to_vreg: VReg,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]