Insert copies to support a value being used as multiple return values.
When one value is used multiple times for separate return values, we need to copy it to produce a new value, so that each value can be allocated a different register.
This commit is contained in:
committed by
Benjamin Bouvier
parent
5ea6c57b95
commit
05c0b3bdd1
13
cranelift/filetests/regalloc/multiple-returns.clif
Normal file
13
cranelift/filetests/regalloc/multiple-returns.clif
Normal file
@@ -0,0 +1,13 @@
|
||||
test regalloc
|
||||
target x86_64
|
||||
|
||||
; Return the same value twice. This needs a copy so that each value can be
|
||||
; allocated its own register.
|
||||
function %multiple_returns() -> i64, i64 {
|
||||
ebb0:
|
||||
v2 = iconst.i64 0
|
||||
return v2, v2
|
||||
}
|
||||
; check: v2 = iconst.i64 0
|
||||
; check: v3 = copy v2
|
||||
; check: return v2, v3
|
||||
Reference in New Issue
Block a user