summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsSubtarget.h
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/MipsSubtarget.h
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/MipsSubtarget.h')
-rw-r--r--lib/Target/Mips/MipsSubtarget.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Target/Mips/MipsSubtarget.h b/lib/Target/Mips/MipsSubtarget.h
index f2f0e15887..ef7568a813 100644
--- a/lib/Target/Mips/MipsSubtarget.h
+++ b/lib/Target/Mips/MipsSubtarget.h
@@ -93,6 +93,9 @@ protected:
// InMips16 -- can process Mips16 instructions
bool InMips16Mode;
+ // Mips16 hard float
+ bool InMips16HardFloat;
+
// PreviousInMips16 -- the function we just processed was in Mips 16 Mode
bool PreviousInMips16Mode;
@@ -170,9 +173,12 @@ public:
}
llvm_unreachable("Unexpected mode");
}
- bool inMips16ModeDefault() {
+ bool inMips16ModeDefault() const {
return InMips16Mode;
}
+ bool inMips16HardFloat() const {
+ return inMips16Mode() && InMips16HardFloat;
+ }
bool inMicroMipsMode() const { return InMicroMipsMode; }
bool hasDSP() const { return HasDSP; }
bool hasDSPR2() const { return HasDSPR2; }
@@ -188,7 +194,8 @@ public:
bool hasBitCount() const { return HasBitCount; }
bool hasFPIdx() const { return HasFPIdx; }
- bool allowMixed16_32() const { return AllowMixed16_32;};
+ bool allowMixed16_32() const { return inMips16ModeDefault() |
+ AllowMixed16_32;}
bool os16() const { return Os16;};