diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2014-01-12 04:13:17 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2014-01-12 04:13:17 +0000 |
commit | e7084a1c5ccbdf15dfea5dc2b3fe693f265ccfbf (patch) | |
tree | cd917da7a98fc6e589249c603033da61d3c69c8d /llvm/lib/Target/Sparc/SparcCallingConv.td | |
parent | 4bde03023b113536afbb6733b3dcfe6c8540e431 (diff) | |
download | bcm5719-llvm-e7084a1c5ccbdf15dfea5dc2b3fe693f265ccfbf.tar.gz bcm5719-llvm-e7084a1c5ccbdf15dfea5dc2b3fe693f265ccfbf.zip |
The SPARCv9 ABI returns a float in %f0.
This is different from the argument passing convention which puts the
first float argument in %f1.
With this patch, all returned floats are treated as if the 'inreg' flag
were set. This means multiple float return values get packed in %f0,
%f1, %f2, ...
Note that when returning a struct in registers, clang will set the
'inreg' flag on the return value, so that behavior is unchanged. This
also happens when returning a float _Complex.
llvm-svn: 199028
Diffstat (limited to 'llvm/lib/Target/Sparc/SparcCallingConv.td')
-rw-r--r-- | llvm/lib/Target/Sparc/SparcCallingConv.td | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/Target/Sparc/SparcCallingConv.td b/llvm/lib/Target/Sparc/SparcCallingConv.td index acd4ec21de4..dfaaabf344a 100644 --- a/llvm/lib/Target/Sparc/SparcCallingConv.td +++ b/llvm/lib/Target/Sparc/SparcCallingConv.td @@ -103,7 +103,7 @@ def RetCC_Sparc32 : CallingConv<[ // Function return values are passed exactly like function arguments, except a // struct up to 32 bytes in size can be returned in registers. -// Function arguments AND return values. +// Function arguments AND most return values. def CC_Sparc64 : CallingConv<[ // The frontend uses the inreg flag to indicate i32 and float arguments from // structs. These arguments are not promoted to 64 bits, but they can still @@ -118,6 +118,15 @@ def CC_Sparc64 : CallingConv<[ CCCustom<"CC_Sparc64_Full"> ]>; +def RetCC_Sparc64 : CallingConv<[ + // A single f32 return value always goes in %f0. The ABI doesn't specify what + // happens to multiple f32 return values outside a struct. + CCIfType<[f32], CCCustom<"CC_Sparc64_Half">>, + + // Otherwise, return values are passed exactly like arguments. + CCDelegateTo<CC_Sparc64> +]>; + // Callee-saved registers are handled by the register window mechanism. def CSR : CalleeSavedRegs<(add)> { let OtherPreserved = (add (sequence "I%u", 0, 7), |