Move the initial stack pointer adjustment to after the CSR pushes.
This commit is contained in:
committed by
Jakob Stoklund Olesen
parent
ebcbd54f61
commit
a75248d2cf
@@ -4,12 +4,14 @@ set is_compressed
|
|||||||
isa intel haswell
|
isa intel haswell
|
||||||
|
|
||||||
function %foo() {
|
function %foo() {
|
||||||
|
ss0 = local 168
|
||||||
ebb0:
|
ebb0:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
; check: function %foo(i64 fp [%rbp], i64 csr [%rbx], i64 csr [%r12], i64 csr [%r13], i64 csr [%r14], i64 csr [%r15]) -> i64 fp [%rbp], i64 csr [%rbx], i64 csr [%r12], i64 csr [%r13], i64 csr [%r14], i64 csr [%r15] native {
|
; check: function %foo(i64 fp [%rbp], i64 csr [%rbx], i64 csr [%r12], i64 csr [%r13], i64 csr [%r14], i64 csr [%r15]) -> i64 fp [%rbp], i64 csr [%rbx], i64 csr [%r12], i64 csr [%r13], i64 csr [%r14], i64 csr [%r15] native {
|
||||||
; nextln: ss0 = incoming_arg 48, offset -48
|
; nextln: ss0 = local 168, offset -216
|
||||||
|
; nextln: ss1 = incoming_arg 48, offset -48
|
||||||
; check: ebb0(v0: i64 [%rbp], v1: i64 [%rbx], v2: i64 [%r12], v3: i64 [%r13], v4: i64 [%r14], v5: i64 [%r15]):
|
; check: ebb0(v0: i64 [%rbp], v1: i64 [%rbx], v2: i64 [%r12], v3: i64 [%r13], v4: i64 [%r14], v5: i64 [%r15]):
|
||||||
; nextln: x86_push v0
|
; nextln: x86_push v0
|
||||||
; nextln: copy_special %rsp -> %rbp
|
; nextln: copy_special %rsp -> %rbp
|
||||||
@@ -18,6 +20,8 @@ ebb0:
|
|||||||
; nextln: x86_push v3
|
; nextln: x86_push v3
|
||||||
; nextln: x86_push v4
|
; nextln: x86_push v4
|
||||||
; nextln: x86_push v5
|
; nextln: x86_push v5
|
||||||
|
; nextln: adjust_sp_imm -168
|
||||||
|
; nextln: adjust_sp_imm 168
|
||||||
; nextln: v11 = x86_pop.i64
|
; nextln: v11 = x86_pop.i64
|
||||||
; nextln: v10 = x86_pop.i64
|
; nextln: v10 = x86_pop.i64
|
||||||
; nextln: v9 = x86_pop.i64
|
; nextln: v9 = x86_pop.i64
|
||||||
|
|||||||
@@ -234,10 +234,6 @@ fn insert_prologue(
|
|||||||
RU::rbp as RegUnit,
|
RU::rbp as RegUnit,
|
||||||
);
|
);
|
||||||
|
|
||||||
if stack_size > 0 {
|
|
||||||
pos.ins().adjust_sp_imm(Imm64::new(-stack_size));
|
|
||||||
}
|
|
||||||
|
|
||||||
for reg in csrs.iter() {
|
for reg in csrs.iter() {
|
||||||
// Append param to entry EBB
|
// Append param to entry EBB
|
||||||
let csr_arg = pos.func.dfg.append_ebb_param(ebb, csr_type);
|
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
|
// Remember it so we can push it momentarily
|
||||||
pos.ins().x86_push(csr_arg);
|
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.
|
/// Find all `return` instructions and insert epilogues before them.
|
||||||
|
|||||||
Reference in New Issue
Block a user