machinst x64: expand encoding names a bit;

This avoids one, two, and three letter structures names, which makes the
code easier to read (while a bit more verbose).
This commit is contained in:
Benjamin Bouvier
2020-06-11 15:09:45 +02:00
parent ef5de04d32
commit b2a0718404
6 changed files with 607 additions and 369 deletions

View File

@@ -280,7 +280,7 @@ impl ABIBody for X64ABIBody {
return Inst::mov_r_r(/*is64=*/ true, from_reg.to_reg(), to_reg);
} else if from_reg.get_class() == RegClass::V128 {
// TODO: How to support Movss. Should is64 always be true?
return Inst::xmm_r_r(SSE_Op::SSE2_Movsd, from_reg.to_reg(), to_reg);
return Inst::xmm_r_r(SseOpcode::Movsd, from_reg.to_reg(), to_reg);
}
unimplemented!("moving from non-int arg to vreg {:?}", from_reg.get_class());
}
@@ -317,7 +317,7 @@ impl ABIBody for X64ABIBody {
))
} else if to_reg.get_class() == RegClass::V128 {
ret.push(Inst::xmm_r_r(
SSE_Op::SSE2_Movsd,
SseOpcode::Movsd,
from_reg.to_reg(),
Writable::<Reg>::from_reg(to_reg.to_reg()),
))
@@ -388,7 +388,7 @@ impl ABIBody for X64ABIBody {
// The "traditional" pre-preamble
// RSP before the call will be 0 % 16. So here, it is 8 % 16.
insts.push(Inst::push64(RMI::reg(r_rbp)));
insts.push(Inst::push64(RegMemImm::reg(r_rbp)));
// RSP is now 0 % 16
insts.push(Inst::mov_r_r(true, r_rsp, w_rbp));
}
@@ -401,7 +401,7 @@ impl ABIBody for X64ABIBody {
let r_reg = reg.to_reg();
match r_reg.get_class() {
RegClass::I64 => {
insts.push(Inst::push64(RMI::reg(r_reg.to_reg())));
insts.push(Inst::push64(RegMemImm::reg(r_reg.to_reg())));
callee_saved_used += 8;
}
_ => unimplemented!(),
@@ -434,8 +434,8 @@ impl ABIBody for X64ABIBody {
if frame_size > 0 {
insts.push(Inst::alu_rmi_r(
true,
RMI_R_Op::Sub,
RMI::imm(frame_size as u32),
AluRmiROpcode::Sub,
RegMemImm::imm(frame_size as u32),
w_rsp,
));
}
@@ -462,8 +462,8 @@ impl ABIBody for X64ABIBody {
insts.push(Inst::alu_rmi_r(
true,
RMI_R_Op::Add,
RMI::imm(frame_size as u32),
AluRmiROpcode::Add,
RegMemImm::imm(frame_size as u32),
w_rsp,
));
}