Move the initial stack pointer adjustment to after the CSR pushes.

This commit is contained in:
Tyler McMullen
2017-12-04 16:03:04 -08:00
committed by Jakob Stoklund Olesen
parent ebcbd54f61
commit a75248d2cf
2 changed files with 9 additions and 5 deletions

View File

@@ -234,10 +234,6 @@ fn insert_prologue(
RU::rbp as RegUnit,
);
if stack_size > 0 {
pos.ins().adjust_sp_imm(Imm64::new(-stack_size));
}
for reg in csrs.iter() {
// Append param to entry EBB
let csr_arg = pos.func.dfg.append_ebb_param(ebb, csr_type);
@@ -248,6 +244,10 @@ fn insert_prologue(
// Remember it so we can push it momentarily
pos.ins().x86_push(csr_arg);
}
if stack_size > 0 {
pos.ins().adjust_sp_imm(Imm64::new(-stack_size));
}
}
/// Find all `return` instructions and insert epilogues before them.