Add fixed_nonallocatable constraints when appropriate (#5253)
Plumb the set of allocatable registers through the OperandCollector and use it validate uses of fixed-nonallocatable registers, like %rsp on x86_64.
This commit is contained in:
@@ -1369,6 +1369,7 @@ impl MachInstEmit for Inst {
|
||||
}
|
||||
&Inst::MovFromPReg { rd, rm } => {
|
||||
let rd = allocs.next_writable(rd);
|
||||
allocs.next_fixed_nonallocatable(rm);
|
||||
let rm: Reg = rm.into();
|
||||
debug_assert!([
|
||||
regs::fp_reg(),
|
||||
@@ -1383,6 +1384,7 @@ impl MachInstEmit for Inst {
|
||||
Inst::Mov { size, rd, rm }.emit(&[], sink, emit_info, state);
|
||||
}
|
||||
&Inst::MovToPReg { rd, rm } => {
|
||||
allocs.next_fixed_nonallocatable(rd);
|
||||
let rd: Writable<Reg> = Writable::from_reg(rd.into());
|
||||
let rm = allocs.next(rm);
|
||||
debug_assert!([
|
||||
|
||||
Reference in New Issue
Block a user