Handle ABI arguments correctly in the reload pass.

Values passed as arguments to calls and return instructions may also be
reload candidates.
This commit is contained in:
Jakob Stoklund Olesen
2017-06-13 15:13:36 -07:00
parent 36f189810e
commit 6381da948f
4 changed files with 86 additions and 20 deletions

View File

@@ -14,10 +14,15 @@ test regalloc
isa riscv enable_e
; In straight-line code, the first value defined is spilled.
; That is the argument.
; That is in order:
; 1. The argument v1.
; 2. The link register.
function %pyramid(i32) -> i32 {
ebb0(v1: i32):
; check: $v1 = spill $(rv1=$V)
; check: $ebb0($(rv1=$V): i32, $(rlink=$V): i32)
; check: $v1 = spill $rv1
; nextln: $(link=$V) = spill $rlink
; not: spill
v2 = iadd_imm v1, 12
v3 = iadd_imm v2, 12
v4 = iadd_imm v3, 12
@@ -29,7 +34,9 @@ ebb0(v1: i32):
v10 = iadd_imm v9, 12
v11 = iadd_imm v10, 12
v12 = iadd_imm v11, 12
v31 = iadd v11, v12
v13 = iadd_imm v12, 12
v32 = iadd v12, v13
v31 = iadd v32, v11
v30 = iadd v31, v10
v29 = iadd v30, v9
v28 = iadd v29, v8
@@ -40,5 +47,7 @@ ebb0(v1: i32):
v23 = iadd v24, v3
v22 = iadd v23, v2
v21 = iadd v22, v1
; check: $(rlink2=$V) = fill $link
return v21
; check: return $v21, $rlink2
}