Add regspill and regfill instructions.

These are parallels to the existing regmove instruction, but the divert
the value to and from a stack slot.

Like regmove diversions, this is a temporary diversion that must be
local to the EBB.
This commit is contained in:
Jakob Stoklund Olesen
2017-10-04 12:42:53 -07:00
parent d4aeec6ece
commit dda3efcbdd
9 changed files with 123 additions and 3 deletions

View File

@@ -213,6 +213,18 @@ pub enum InstructionData {
src: RegUnit,
dst: RegUnit,
},
RegSpill {
opcode: Opcode,
arg: Value,
src: RegUnit,
dst: StackSlot,
},
RegFill {
opcode: Opcode,
arg: Value,
src: StackSlot,
dst: RegUnit,
},
Trap { opcode: Opcode, code: ir::TrapCode },
CondTrap {
opcode: Opcode,

View File

@@ -317,6 +317,12 @@ impl<'a> Verifier<'a> {
HeapAddr { heap, .. } => {
self.verify_heap(inst, heap)?;
}
RegSpill { dst, .. } => {
self.verify_stack_slot(inst, dst)?;
}
RegFill { src, .. } => {
self.verify_stack_slot(inst, src)?;
}
// Exhaustive list so we can't forget to add new formats
Unary { .. } |

View File

@@ -385,6 +385,22 @@ pub fn write_operands(
write!(w, " {}, %{} -> %{}", arg, src, dst)
}
}
RegSpill { arg, src, dst, .. } => {
if let Some(isa) = isa {
let regs = isa.register_info();
write!(w, " {}, {} -> {}", arg, regs.display_regunit(src), dst)
} else {
write!(w, " {}, %{} -> {}", arg, src, dst)
}
}
RegFill { arg, src, dst, .. } => {
if let Some(isa) = isa {
let regs = isa.register_info();
write!(w, " {}, {} -> {}", arg, src, regs.display_regunit(dst))
} else {
write!(w, " {}, {} -> %{}", arg, src, dst)
}
}
Trap { code, .. } => write!(w, " {}", code),
CondTrap { arg, code, .. } => write!(w, " {}, {}", arg, code),
}