Bump regalloc2 to 0.5.0 (#5345)

* Bump the regalloc2 dependency to 0.5.0
* Replace preg_set_from_machine_env with PRegSet::from
* Vet the regalloc2 update
This commit is contained in:
Trevor Elliott
2022-11-29 11:25:35 -08:00
committed by GitHub
parent 3b76874834
commit f138fc0ed3
6 changed files with 13 additions and 27 deletions

View File

@@ -4,7 +4,7 @@
use alloc::{string::String, vec::Vec};
use core::{fmt::Debug, hash::Hash};
use regalloc2::{Allocation, MachineEnv, Operand, OperandConstraint, PReg, PRegSet, VReg};
use regalloc2::{Allocation, Operand, OperandConstraint, PReg, PRegSet, VReg};
#[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize};
@@ -38,26 +38,6 @@ pub fn first_user_vreg_index() -> usize {
PINNED_VREGS
}
/// Collect the registers from a regalloc2 MachineEnv into a PRegSet.
/// TODO: remove this once it's upstreamed in regalloc2
pub fn preg_set_from_machine_env(machine_env: &MachineEnv) -> PRegSet {
let mut regs = PRegSet::default();
for class in machine_env.preferred_regs_by_class.iter() {
for reg in class.iter() {
regs.add(*reg);
}
}
for class in machine_env.non_preferred_regs_by_class.iter() {
for reg in class.iter() {
regs.add(*reg);
}
}
regs
}
/// A register named in an instruction. This register can be either a
/// virtual register or a fixed physical register. It does not have
/// any constraints applied to it: those can be added later in