summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsRegisterInfo.cpp
diff options
context:
space:
mode:
authorReed Kotler <rkotler@mips.com>2014-02-14 19:16:39 +0000
committerReed Kotler <rkotler@mips.com>2014-02-14 19:16:39 +0000
commitfba2a769a1f9a05437b1d98c99bb827fb7b44482 (patch)
tree2f27e565d98af82965000a7c6ee2435e95c9d5d7 /lib/Target/Mips/MipsRegisterInfo.cpp
parent034b8f9d3184babb42d8ae2d9aae8620b30af2d9 (diff)
downloadllvm-fba2a769a1f9a05437b1d98c99bb827fb7b44482.tar.gz
llvm-fba2a769a1f9a05437b1d98c99bb827fb7b44482.tar.bz2
llvm-fba2a769a1f9a05437b1d98c99bb827fb7b44482.tar.xz
This patch has two main functions:
1) Fix a specific bug when certain conversion functions are called in a program compiled as mips16 with hard float and the program is linked as c++. There are two libraries that are reversed in the link order with gcc/g++ and clang/clang++ for mips16 in this case and the proper stubs will then not be called. These stubs are normally handled in the Mips16HardFloat pass but in this case we don't know at that time that we need to generate the stubs. This must all be handled later in code generation and we have moved this functionality to MipsAsmPrinter. When linked as C (gcc or clang) the proper stubs are linked in from libc. 2) Set up the infrastructure to handle 90% of what is in the Mips16HardFloat pass in this new area of MipsAsmPrinter. This is a more logical place to handle this and we have known for some time that we needed to move the code later and not implement it using inline asm as we do now but it was not clear exactly where to do this and what mechanism should be used. Now it's clear to us how to do this and this patch contains the infrastructure to move most of this to MipsAsmPrinter but the actual moving will be done in a follow on patch. The same infrastructure is used to fix this current bug as described in #1. This change was requested by the list during the original putback of the Mips16HardFloat pass but was not practical for us do at that time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsRegisterInfo.cpp')
-rw-r--r--lib/Target/Mips/MipsRegisterInfo.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Target/Mips/MipsRegisterInfo.cpp b/lib/Target/Mips/MipsRegisterInfo.cpp
index 14c96a0697..c6563708b2 100644
--- a/lib/Target/Mips/MipsRegisterInfo.cpp
+++ b/lib/Target/Mips/MipsRegisterInfo.cpp
@@ -187,11 +187,12 @@ getReservedRegs(const MachineFunction &MF) const {
// Reserve RA if in mips16 mode.
if (Subtarget.inMips16Mode()) {
+ const MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
Reserved.set(Mips::RA);
Reserved.set(Mips::RA_64);
Reserved.set(Mips::T0);
Reserved.set(Mips::T1);
- if (MF.getFunction()->hasFnAttribute("saveS2"))
+ if (MF.getFunction()->hasFnAttribute("saveS2") || MipsFI->hasSaveS2())
Reserved.set(Mips::S2);
}