[mips] Fix ELF e_flags related to -mabicalls and -mplt.
[oota-llvm.git] / lib / Target / Mips / MipsMachineFunction.cpp
index c32f56c0ddcfc6192847f036985599647299dd38..bc896be4e1de287db2703693cedb0ff5c411cff8 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/IR/Function.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
 
@@ -26,7 +27,7 @@ FixGlobalBaseReg("mips-fix-global-base-reg", cl::Hidden, cl::init(true),
 MipsCallEntry::MipsCallEntry(const StringRef &N) {
 #ifndef NDEBUG
   Name = N;
-  Val = 0;
+  Val = nullptr;
 #endif
 }
 
@@ -64,9 +65,8 @@ MipsFunctionInfo::~MipsFunctionInfo() {
        ++I)
     delete I->getValue();
 
-  for (ValueMap<const GlobalValue *, const MipsCallEntry *>::iterator
-       I = GlobalCallEntries.begin(), E = GlobalCallEntries.end(); I != E; ++I)
-    delete I->second;
+  for (const auto &Entry : GlobalCallEntries)
+    delete Entry.second;
 }
 
 bool MipsFunctionInfo::globalBaseRegSet() const {
@@ -120,25 +120,29 @@ bool MipsFunctionInfo::isEhDataRegFI(int FI) const {
 }
 
 MachinePointerInfo MipsFunctionInfo::callPtrInfo(const StringRef &Name) {
-  StringMap<const MipsCallEntry *>::const_iterator I;
-  I = ExternalCallEntries.find(Name);
+  const MipsCallEntry *&E = ExternalCallEntries[Name];
 
-  if (I != ExternalCallEntries.end())
-    return MachinePointerInfo(I->getValue());
+  if (!E)
+    E = new MipsCallEntry(Name);
 
-  const MipsCallEntry *E = ExternalCallEntries[Name] = new MipsCallEntry(Name);
   return MachinePointerInfo(E);
 }
 
 MachinePointerInfo MipsFunctionInfo::callPtrInfo(const GlobalValue *Val) {
-  ValueMap<const GlobalValue *, const MipsCallEntry *>::const_iterator I;
-  I = GlobalCallEntries.find(Val);
+  const MipsCallEntry *&E = GlobalCallEntries[Val];
 
-  if (I != GlobalCallEntries.end())
-    return MachinePointerInfo(I->second);
+  if (!E)
+    E = new MipsCallEntry(Val);
 
-  const MipsCallEntry *E = GlobalCallEntries[Val] = new MipsCallEntry(Val);
   return MachinePointerInfo(E);
 }
 
+int MipsFunctionInfo::getMoveF64ViaSpillFI(const TargetRegisterClass *RC) {
+  if (MoveF64ViaSpillFI == -1) {
+    MoveF64ViaSpillFI = MF.getFrameInfo()->CreateStackObject(
+        RC->getSize(), RC->getAlignment(), false);
+  }
+  return MoveF64ViaSpillFI;
+}
+
 void MipsFunctionInfo::anchor() { }