Remove regs from MachineEnv

It isn't exactly clear what purpose it serves.
This commit is contained in:
Amanieu d'Antras
2021-09-16 09:14:07 +01:00
parent af527aca88
commit 358c831b31
3 changed files with 5 additions and 9 deletions

View File

@@ -589,7 +589,6 @@ pub fn machine_env() -> MachineEnv {
[regs.iter().cloned().skip(24).collect(), vec![]];
let scratch_by_class: [PReg; 2] = [PReg::new(31, RegClass::Int), PReg::new(0, RegClass::Float)];
MachineEnv {
regs,
preferred_regs_by_class,
non_preferred_regs_by_class,
scratch_by_class,

View File

@@ -105,8 +105,11 @@ impl<'a, F: Function> Env<'a, F> {
allocations: LiveRangeSet::new(),
},
);
for &preg in &self.env.regs {
self.pregs[preg.index()].reg = preg;
for i in 0..=PReg::MAX {
let preg_int = PReg::new(i, RegClass::Int);
self.pregs[preg_int.index()].reg = preg_int;
let preg_float = PReg::new(i, RegClass::Float);
self.pregs[preg_float.index()].reg = preg_float;
}
// Create VRegs from the vreg count.
for idx in 0..self.func.num_vregs() {

View File

@@ -1139,12 +1139,6 @@ pub enum Edit {
/// as well.
#[derive(Clone, Debug)]
pub struct MachineEnv {
/// Physical registers. Every register that might be mentioned in
/// any constraint must be listed here, even if it is not
/// allocatable (present in one of
/// `{preferred,non_preferred}_regs_by_class`).
pub regs: Vec<PReg>,
/// Preferred physical registers for each class. These are the
/// registers that will be allocated first, if free.
pub preferred_regs_by_class: [Vec<PReg>; 2],