Reload for spilled call return values.

When the return value from a call has been spilled, the reload pass
needs to insert a spill instruction right after the call instruction
which returns its results in registers.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-29 11:09:21 -07:00
parent 711e5cd644
commit 45888ab84e
3 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
test regalloc
isa riscv enable_e
; regex: V=v\d+
; Check that we can handle a function return value that got spilled.
function %spill_return() -> i32 {
fn0 = function %foo() -> i32 native
ebb0:
v0 = call fn0()
; check: $(reg=$V) = call $fn0
; check: $v0 = spill $reg
v2 = call fn0()
; check: $v2 = call $fn0
return v0
; check: $(reload=$V) = fill $v0
; check: return $reload
}