Skip to content

Commit e09f651

Browse files
authored
Remove pinned VRegs. (#108)
1 parent e41c614 commit e09f651

File tree

6 files changed

+226
-580
lines changed

6 files changed

+226
-580
lines changed

src/checker.rs

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -366,25 +366,8 @@ impl CheckerState {
366366
}
367367
}
368368

369-
fn initial_with_pinned_vregs<F: Function>(f: &F) -> CheckerState {
370-
// Scan the function, looking for all vregs that are pinned
371-
// vregs, gathering them with their PRegs.
372-
let mut pinned_vregs: FxHashMap<VReg, PReg> = FxHashMap::default();
373-
visit_all_vregs(f, |vreg: VReg| {
374-
if let Some(preg) = f.is_pinned_vreg(vreg) {
375-
pinned_vregs.insert(vreg, preg);
376-
}
377-
});
378-
379-
let mut allocs = FxHashMap::default();
380-
for (vreg, preg) in pinned_vregs {
381-
allocs.insert(
382-
Allocation::reg(preg),
383-
CheckerValue::VRegs(std::iter::once(vreg).collect()),
384-
);
385-
}
386-
387-
CheckerState::Allocations(allocs)
369+
fn initial() -> Self {
370+
CheckerState::Allocations(FxHashMap::default())
388371
}
389372
}
390373

@@ -857,7 +840,7 @@ impl<'a, F: Function> Checker<'a, F> {
857840
reftyped_vregs.insert(vreg);
858841
}
859842

860-
bb_in.insert(f.entry_block(), CheckerState::initial_with_pinned_vregs(f));
843+
bb_in.insert(f.entry_block(), CheckerState::default());
861844

862845
let mut stack_pregs = PRegSet::empty();
863846
for &preg in &machine_env.fixed_stack_slots {
@@ -932,21 +915,11 @@ impl<'a, F: Function> Checker<'a, F> {
932915
// move/edit framework, so we don't get allocs for these moves
933916
// in the post-regalloc output, and the embedder is not
934917
// supposed to emit the moves. But we *do* want to check the
935-
// semantic implications, namely definition of new vregs and,
936-
// for moves to/from pinned vregs, the implied register
937-
// constraints. So we emit `ProgramMove` ops that do just
938-
// this.
918+
// semantic implications, namely definition of new vregs. So
919+
// we emit `ProgramMove` ops that do just this.
939920
if let Some((src, dst)) = self.f.is_move(inst) {
940-
let src_preg = self.f.is_pinned_vreg(src.vreg());
941-
let src_op = match src_preg {
942-
Some(preg) => Operand::reg_fixed_use(src.vreg(), preg),
943-
None => Operand::any_use(src.vreg()),
944-
};
945-
let dst_preg = self.f.is_pinned_vreg(dst.vreg());
946-
let dst_op = match dst_preg {
947-
Some(preg) => Operand::reg_fixed_def(dst.vreg(), preg),
948-
None => Operand::any_def(dst.vreg()),
949-
};
921+
let src_op = Operand::any_use(src.vreg());
922+
let dst_op = Operand::any_def(dst.vreg());
950923
let checkinst = CheckerInst::ProgramMove {
951924
inst,
952925
src: src_op,

src/indexset.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ impl AdaptiveMap {
140140
&Self::Large(ref map) => AdaptiveMapIter::Large(map.iter()),
141141
}
142142
}
143+
144+
fn is_empty(&self) -> bool {
145+
match self {
146+
AdaptiveMap::Small { values, .. } => values.iter().all(|&value| value == 0),
147+
AdaptiveMap::Large(m) => m.values().all(|&value| value == 0),
148+
}
149+
}
143150
}
144151

145152
enum AdaptiveMapIter<'a> {
@@ -268,6 +275,11 @@ impl IndexSet {
268275
_ => false,
269276
}
270277
}
278+
279+
/// Is the set empty?
280+
pub(crate) fn is_empty(&self) -> bool {
281+
self.elems.is_empty()
282+
}
271283
}
272284

273285
pub struct SetBitsIter(u64);

0 commit comments

Comments
 (0)