Assign call arguments to stack slots.
When making an outgoing call, some arguments may have to be passed on the stack. Allocate OutgoingArg stack slots for these arguments and write them immediately before the outgoing call instruction. Do the same for incoming function arguments on the stack, but use IncomingArg stack slots instead. This was previously done in the spiller, but we move it to the legalizer so it is done at the same time as outgoing stack arguments. These stack slot assignments are done in the legalizer before live range analysis because the outgoing arguments usually are in different SSSA values with their own short live ranges.
This commit is contained in:
@@ -3,6 +3,8 @@ test legalizer
|
||||
isa riscv
|
||||
|
||||
; regex: V=v\d+
|
||||
; regex: SS=ss\d+
|
||||
; regex: WS=\s+
|
||||
|
||||
function %int_split_args(i64) -> i64 {
|
||||
ebb0(v0: i64):
|
||||
@@ -118,3 +120,15 @@ ebb0(v0: i32, v1: f32x2):
|
||||
; check: call_indirect $sig1, $v0($V, $V)
|
||||
return
|
||||
}
|
||||
|
||||
; Call a function that takes arguments on the stack.
|
||||
function %stack_args(i32) {
|
||||
; check: $(ss0=$SS) = outgoing_arg 4
|
||||
fn1 = function %foo(i64, i64, i64, i64, i32)
|
||||
ebb0(v0: i32):
|
||||
v1 = iconst.i64 1
|
||||
call fn1(v1, v1, v1, v1, v0)
|
||||
; check: [GPsp#48,$ss0]$WS $(v0s=$V) = spill $v0
|
||||
; check: call $fn1($(=.*), $v0s)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user