Add copy_special instruction.
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
8ed37e352e
commit
cdf70ccb77
@@ -64,6 +64,7 @@ StackStore = InstructionFormat(VALUE, stack_slot, offset32)
|
|||||||
HeapAddr = InstructionFormat(heap, VALUE, uimm32)
|
HeapAddr = InstructionFormat(heap, VALUE, uimm32)
|
||||||
|
|
||||||
RegMove = InstructionFormat(VALUE, ('src', regunit), ('dst', regunit))
|
RegMove = InstructionFormat(VALUE, ('src', regunit), ('dst', regunit))
|
||||||
|
CopySpecial = InstructionFormat(('src', regunit), ('dst', regunit))
|
||||||
RegSpill = InstructionFormat(
|
RegSpill = InstructionFormat(
|
||||||
VALUE, ('src', regunit), ('dst', entities.stack_slot))
|
VALUE, ('src', regunit), ('dst', entities.stack_slot))
|
||||||
RegFill = InstructionFormat(
|
RegFill = InstructionFormat(
|
||||||
|
|||||||
@@ -537,6 +537,13 @@ regmove = Instruction(
|
|||||||
ins=(x, src, dst),
|
ins=(x, src, dst),
|
||||||
other_side_effects=True)
|
other_side_effects=True)
|
||||||
|
|
||||||
|
copy_special = Instruction(
|
||||||
|
'copy_special', r"""
|
||||||
|
Copies a value from one special register to another. e.g. rbp -> rsp.
|
||||||
|
""",
|
||||||
|
ins=(src, dst),
|
||||||
|
other_side_effects=True)
|
||||||
|
|
||||||
regspill = Instruction(
|
regspill = Instruction(
|
||||||
'regspill', r"""
|
'regspill', r"""
|
||||||
Temporarily divert ``x`` from ``src`` to ``SS``.
|
Temporarily divert ``x`` from ``src`` to ``SS``.
|
||||||
|
|||||||
@@ -236,6 +236,11 @@ pub enum InstructionData {
|
|||||||
src: RegUnit,
|
src: RegUnit,
|
||||||
dst: RegUnit,
|
dst: RegUnit,
|
||||||
},
|
},
|
||||||
|
CopySpecial {
|
||||||
|
opcode: Opcode,
|
||||||
|
src: RegUnit,
|
||||||
|
dst: RegUnit,
|
||||||
|
},
|
||||||
RegSpill {
|
RegSpill {
|
||||||
opcode: Opcode,
|
opcode: Opcode,
|
||||||
arg: Value,
|
arg: Value,
|
||||||
|
|||||||
@@ -358,6 +358,7 @@ impl<'a> Verifier<'a> {
|
|||||||
Load { .. } |
|
Load { .. } |
|
||||||
Store { .. } |
|
Store { .. } |
|
||||||
RegMove { .. } |
|
RegMove { .. } |
|
||||||
|
CopySpecial { .. } |
|
||||||
Trap { .. } |
|
Trap { .. } |
|
||||||
CondTrap { .. } |
|
CondTrap { .. } |
|
||||||
NullAry { .. } => {}
|
NullAry { .. } => {}
|
||||||
|
|||||||
@@ -394,6 +394,19 @@ pub fn write_operands(
|
|||||||
write!(w, " {}, %{} -> %{}", arg, src, dst)
|
write!(w, " {}, %{} -> %{}", arg, src, dst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CopySpecial { src, dst, .. } => {
|
||||||
|
if let Some(isa) = isa {
|
||||||
|
let regs = isa.register_info();
|
||||||
|
write!(
|
||||||
|
w,
|
||||||
|
" {} -> {}",
|
||||||
|
regs.display_regunit(src),
|
||||||
|
regs.display_regunit(dst)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
write!(w, " %{} -> %{}", src, dst)
|
||||||
|
}
|
||||||
|
}
|
||||||
RegSpill { arg, src, dst, .. } => {
|
RegSpill { arg, src, dst, .. } => {
|
||||||
if let Some(isa) = isa {
|
if let Some(isa) = isa {
|
||||||
let regs = isa.register_info();
|
let regs = isa.register_info();
|
||||||
|
|||||||
@@ -2270,6 +2270,15 @@ impl<'a> Parser<'a> {
|
|||||||
dst,
|
dst,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
InstructionFormat::CopySpecial => {
|
||||||
|
let src = self.match_regunit(ctx.unique_isa)?;
|
||||||
|
self.match_token(
|
||||||
|
Token::Arrow,
|
||||||
|
"expected '->' between register units",
|
||||||
|
)?;
|
||||||
|
let dst = self.match_regunit(ctx.unique_isa)?;
|
||||||
|
InstructionData::CopySpecial { opcode, src, dst }
|
||||||
|
}
|
||||||
InstructionFormat::RegSpill => {
|
InstructionFormat::RegSpill => {
|
||||||
let arg = self.match_value("expected SSA value operand")?;
|
let arg = self.match_value("expected SSA value operand")?;
|
||||||
self.match_token(
|
self.match_token(
|
||||||
|
|||||||
Reference in New Issue
Block a user