Fix stack pointer offsets for outgoing arguments.

StackSlotKind::OutgoingArg stack slots have an offset that is relative
to our own stack pointer, while all other stack slot kinds have offsets
that are relative to the caller's stack pointer.

Make sure we generate the right sp-relative offsets for outgoing
arguments too.
This commit is contained in:
Jakob Stoklund Olesen
2018-02-21 10:34:41 -08:00
parent 69cc6c8af3
commit 8d388b2218
2 changed files with 29 additions and 5 deletions

View File

@@ -634,6 +634,23 @@ ebb1:
return
}
; Test for the encoding of outgoing_arg stack slots.
function %outargs() {
ss0 = incoming_arg 16, offset -16
ss1 = outgoing_arg 8, offset 8
ss2 = outgoing_arg 8, offset 0
ebb0:
[-,%rcx] v1 = iconst.i64 1
; asm: movq %rcx, 8(%rsp)
[-,ss1] v10 = spill v1 ; bin: 48 89 8c 24 00000008
; asm: movq %rcx, (%rsp)
[-,ss2] v11 = spill v1 ; bin: 48 89 8c 24 00000000
return
}
; Tests for i32 instructions in 64-bit mode.
;
; Note that many i32 instructions can be encoded both with and without a REX