Allow for special purpose function arguments and return values.

Enumerate a set of special purposes for function arguments that general
purpose code needs to know about. Some of these argument purposes will
only appear in the signature of the current function, representing
things the prologue and epilogues need to know about like the link
register and callee-saved registers.

Get rid of the 'inreg' argument flag. Arguments can be pre-assigned to a
specific register instead.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-17 15:04:00 -07:00
parent d3235eb81f
commit 7e9bdcf059
6 changed files with 116 additions and 18 deletions

View File

@@ -68,3 +68,13 @@ ebb0(v0: i64):
; check: call_indirect $sig0, $v1($v0)
; check: $v3, $v4 = call_indirect $sig2, $v1()
; check: return
; Special purpose function arguments
function special1(i32 sret, i32 fp, i32 csr, i32 link) -> i32 link, i32 fp, i32 csr, i32 sret {
ebb0(v1: i32, v2: i32, v3: i32):
return v4, v2, v3, v1
}
; check: function special1(i32 sret, i32 fp, i32 link) -> i32 link, i32 fp, i32 sret {
; check: ebb0($v1: i32, $v2: i32, $v3: i32):
; check: return $v3, $v2, $v1
; check: }