change regs_allocated to PRegSet
This commit is contained in:
@@ -457,7 +457,7 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
|
||||
// keep track of which pregs where allocated so we can clear them later on
|
||||
// TODO: wouldnt need this if we look up the inst a vreg was allocated at
|
||||
let mut regs_allocated: SmallVec<[PReg; 8]> = smallvec![];
|
||||
let mut regs_allocated = PRegSet::empty();
|
||||
|
||||
// keep track of which pregs hold late uses/early writes and so are unelligible
|
||||
// as destinations for late writes
|
||||
@@ -493,7 +493,7 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
match op.constraint() {
|
||||
OperandConstraint::FixedReg(reg) => {
|
||||
state.clear_preg(reg);
|
||||
regs_allocated.push(reg);
|
||||
regs_allocated.add(reg);
|
||||
state.allocs[alloc_idx + i] = Allocation::reg(reg);
|
||||
trace!("Chose {} for operand {}", reg, i);
|
||||
late_write_disallow_regs.add(reg);
|
||||
@@ -538,7 +538,7 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
// late uses cannot share a register with late defs
|
||||
late_write_disallow_regs.add(reg);
|
||||
}
|
||||
regs_allocated.push(reg);
|
||||
regs_allocated.add(reg);
|
||||
trace!("Chose {} for operand {}", reg, i);
|
||||
}
|
||||
OperandKind::Def => {
|
||||
@@ -610,13 +610,12 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
state.clear_preg(reg);
|
||||
}
|
||||
state.assign_preg(tmp_reg, vreg);
|
||||
println!("1");
|
||||
state.move_to_stack(tmp_reg, vreg, ProgPoint::after(inst));
|
||||
regs_allocated.push(tmp_reg);
|
||||
regs_allocated.add(tmp_reg);
|
||||
} else {
|
||||
state.alloc_stack_slot(vreg);
|
||||
state.move_to_stack(reg, vreg, ProgPoint::after(inst));
|
||||
regs_allocated.push(reg);
|
||||
regs_allocated.add(reg);
|
||||
}
|
||||
trace!("Chose {} for operand {}", reg, i);
|
||||
}
|
||||
@@ -666,7 +665,7 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
let reg_order = const_state.reg_order(op.class());
|
||||
let mut allocated = false;
|
||||
for ® in reg_order {
|
||||
if regs_allocated.contains(®) {
|
||||
if regs_allocated.contains(reg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -674,7 +673,7 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
debug_assert!(state.pregs[reg.index()].vreg.is_none());
|
||||
|
||||
state.allocs[alloc_idx + i] = Allocation::reg(reg);
|
||||
regs_allocated.push(reg);
|
||||
regs_allocated.add(reg);
|
||||
if op.kind() == OperandKind::Use {
|
||||
if req_refs_on_stack && state.vregs[vreg.vreg()].reftype {
|
||||
panic!("reftype required to be in reg at safepoint");
|
||||
@@ -731,12 +730,12 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
let reg_order = const_state.reg_order(op.class());
|
||||
let mut allocated = false;
|
||||
for ® in reg_order {
|
||||
if regs_allocated.contains(®) || late_write_disallow_regs.contains(reg) {
|
||||
if regs_allocated.contains(reg) || late_write_disallow_regs.contains(reg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// reg should not contain anything
|
||||
regs_allocated.push(reg);
|
||||
regs_allocated.add(reg);
|
||||
state.allocs[alloc_idx + i] = Allocation::reg(reg);
|
||||
|
||||
state.clear_preg(reg);
|
||||
@@ -760,7 +759,7 @@ fn allocate_block_insts<'a, F: Function>(
|
||||
OperandConstraint::Reuse(idx) => {
|
||||
debug_assert!(state.allocs[alloc_idx + idx].is_reg());
|
||||
let preg = state.allocs[alloc_idx + idx].as_reg().unwrap();
|
||||
debug_assert!(regs_allocated.contains(&preg));
|
||||
debug_assert!(regs_allocated.contains(preg));
|
||||
state.allocs[alloc_idx + i] = Allocation::reg(preg);
|
||||
|
||||
state.clear_preg(preg);
|
||||
|
||||
Reference in New Issue
Block a user