Remove PRegData::reg and use PReg::from_index instead

Performance impact is negligible but this is a good cleanup.
This commit is contained in:
Amanieu d'Antras
2022-01-11 04:07:05 +00:00
parent 74928b83fa
commit 053375f049
4 changed files with 4 additions and 12 deletions

View File

@@ -20,7 +20,7 @@ use super::{
use crate::moves::ParallelMoves;
use crate::{
Allocation, Block, Edit, Function, Inst, InstPosition, OperandConstraint, OperandKind,
OperandPos, ProgPoint, RegClass, VReg,
OperandPos, PReg, ProgPoint, RegClass, VReg,
};
use smallvec::{smallvec, SmallVec};
use std::fmt::Debug;
@@ -697,7 +697,7 @@ impl<'a, F: Function> Env<'a, F> {
// Handle multi-fixed-reg constraints by copying.
for fixup in std::mem::replace(&mut self.multi_fixed_reg_fixups, vec![]) {
let from_alloc = self.get_alloc(fixup.pos.inst(), fixup.from_slot as usize);
let to_alloc = Allocation::reg(self.pregs[fixup.to_preg.index()].reg);
let to_alloc = Allocation::reg(PReg::from_index(fixup.to_preg.index()));
log::trace!(
"multi-fixed-move constraint at {:?} from {} to {} for v{}",
fixup.pos,
@@ -715,7 +715,7 @@ impl<'a, F: Function> Env<'a, F> {
self.set_alloc(
fixup.pos.inst(),
fixup.to_slot as usize,
Allocation::reg(self.pregs[fixup.to_preg.index()].reg),
Allocation::reg(PReg::from_index(fixup.to_preg.index())),
);
}