summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsCallingConv.td
diff options
context:
space:
mode:
authorReed Kotler <rkotler@mips.com>2013-05-10 22:25:39 +0000
committerReed Kotler <rkotler@mips.com>2013-05-10 22:25:39 +0000
commit46090914b783b632618268f2a5c99aab83732688 (patch)
treee13bf35f88f92d052548cf5fbf84de1b8451d5f5 /lib/Target/Mips/MipsCallingConv.td
parent1197e38f3338b8db76f0fa38c2687c65b2bcea5c (diff)
downloadllvm-46090914b783b632618268f2a5c99aab83732688.tar.gz
llvm-46090914b783b632618268f2a5c99aab83732688.tar.bz2
llvm-46090914b783b632618268f2a5c99aab83732688.tar.xz
Checkin in of first of several patches to finish implementation of
mips16/mips32 floating point interoperability. This patch fixes returns from mips16 functions so that if the function was in fact called by a mips32 hard float routine, then values that would have been returned in floating point registers are so returned. Mips16 mode has no floating point instructions so there is no way to load values into floating point registers. This is needed when returning float, double, single complex, double complex in the Mips ABI. Helper functions in libc for mips16 are available to do this. For efficiency purposes, these helper functions have a different calling convention from normal Mips calls. Registers v0,v1,a0,a1 are used to pass parameters instead of a0,a1,a2,a3. This is because v0,v1,a0,a1 are the natural registers used to return floating point values in soft float. These values can then be moved to the appropriate floating point registers with no extra cost. The only register that is modified is ra in this call. The helper functions make sure that the return values are in the floating point registers that they would be in if soft float was not in effect (which it is for mips16, though the soft float is implemented using a mips32 library that uses hard float). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsCallingConv.td')
-rw-r--r--lib/Target/Mips/MipsCallingConv.td10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsCallingConv.td b/lib/Target/Mips/MipsCallingConv.td
index 462def76cc..6e8c5d24a8 100644
--- a/lib/Target/Mips/MipsCallingConv.td
+++ b/lib/Target/Mips/MipsCallingConv.td
@@ -196,6 +196,13 @@ def CC_Mips_FastCC : CallingConv<[
CCDelegateTo<CC_MipsN_FastCC>
]>;
+//==
+
+def CC_Mips16RetHelper : CallingConv<[
+ // Integer arguments are passed in integer registers.
+ CCIfType<[i32], CCAssignToReg<[V0, V1, A0, A1]>>
+]>;
+
//===----------------------------------------------------------------------===//
// Mips Calling Convention Dispatch
//===----------------------------------------------------------------------===//
@@ -223,3 +230,6 @@ def CSR_N32 : CalleeSavedRegs<(add D31_64, D29_64, D27_64, D25_64, D24_64,
def CSR_N64 : CalleeSavedRegs<(add (sequence "D%u_64", 31, 24), RA_64, FP_64,
GP_64, (sequence "S%u_64", 7, 0))>;
+
+def CSR_Mips16RetHelper :
+ CalleeSavedRegs<(add V0, V1, (sequence "A%u", 3, 0), S0, S1)>;