Skip to content

Commit

Permalink
Backport upstream #2723
Browse files Browse the repository at this point in the history
Co-authored-by: ptitSeb <[email protected]>
  • Loading branch information
nagisa and ptitSeb committed Dec 14, 2021
1 parent a49d1aa commit 65c31b5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/compiler-singlepass/src/codegen_x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1313,16 +1313,12 @@ impl<'a> FuncGen<'a> {
}
match *param {
Location::Imm64(_) => {
// Dummy value slot to be filled with `mov`.
self.assembler.emit_push(Size::S64, Location::GPR(GPR::RAX));

// Use R9 as the temporary register here, since:
// - It is a temporary register that is not used for any persistent value.
// - This register as an argument location is only written to after `sort_call_movs`.'
// Push R9 value slot to be exchange with `mov`.
self.assembler.emit_push(Size::S64, Location::GPR(GPR::R9));
self.machine.reserve_unused_temp_gpr(GPR::R9);
self.assembler
.emit_mov(Size::S64, *param, Location::GPR(GPR::R9));
self.assembler.emit_mov(
self.assembler.emit_xchg(
Size::S64,
Location::GPR(GPR::R9),
Location::Memory(GPR::RSP, 0),
Expand Down

0 comments on commit 65c31b5

Please sign in to comment.