[llvm-branch-commits] [llvm-branch] r84648 - in /llvm/branches/Apple/Leela: lib/CodeGen/LiveIntervalAnalysis.cpp test/CodeGen/X86/2009-10-19-EmergencySpill.ll

Bill Wendling isanbard at gmail.com
Tue Oct 20 10:52:25 PDT 2009


Author: void
Date: Tue Oct 20 12:52:24 2009
New Revision: 84648

URL: http://llvm.org/viewvc/llvm-project?rev=84648&view=rev
Log:
$ svn merge -c 84586 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r84586 into '.':
A    test/CodeGen/X86/2009-10-19-EmergencySpill.ll
U    lib/CodeGen/LiveIntervalAnalysis.cpp


Added:
    llvm/branches/Apple/Leela/test/CodeGen/X86/2009-10-19-EmergencySpill.ll
      - copied unchanged from r84586, llvm/trunk/test/CodeGen/X86/2009-10-19-EmergencySpill.ll
Modified:
    llvm/branches/Apple/Leela/lib/CodeGen/LiveIntervalAnalysis.cpp

Modified: llvm/branches/Apple/Leela/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=84648&r1=84647&r2=84648&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Oct 20 12:52:24 2009
@@ -2603,7 +2603,19 @@
            tri_->isSuperRegister(*AS, SpillReg));
 
   bool Cut = false;
-  LiveInterval &pli = getInterval(SpillReg);
+  SmallVector<unsigned, 4> PRegs;
+  if (hasInterval(SpillReg))
+    PRegs.push_back(SpillReg);
+  else {
+    SmallSet<unsigned, 4> Added;
+    for (const unsigned* AS = tri_->getSubRegisters(SpillReg); *AS; ++AS)
+      if (Added.insert(*AS) && hasInterval(*AS)) {
+        PRegs.push_back(*AS);
+        for (const unsigned* ASS = tri_->getSubRegisters(*AS); *ASS; ++ASS)
+          Added.insert(*ASS);
+      }
+  }
+
   SmallPtrSet<MachineInstr*, 8> SeenMIs;
   for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(li.reg),
          E = mri_->reg_end(); I != E; ++I) {
@@ -2613,8 +2625,12 @@
       continue;
     SeenMIs.insert(MI);
     LiveIndex Index = getInstructionIndex(MI);
-    if (pli.liveAt(Index)) {
-      vrm.addEmergencySpill(SpillReg, MI);
+    for (unsigned i = 0, e = PRegs.size(); i != e; ++i) {
+      unsigned PReg = PRegs[i];
+      LiveInterval &pli = getInterval(PReg);
+      if (!pli.liveAt(Index))
+        continue;
+      vrm.addEmergencySpill(PReg, MI);
       LiveIndex StartIdx = getLoadIndex(Index);
       LiveIndex EndIdx = getNextSlot(getStoreIndex(Index));
       if (pli.isInOneLiveRange(StartIdx, EndIdx)) {
@@ -2626,12 +2642,12 @@
         Msg << "Ran out of registers during register allocation!";
         if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {
           Msg << "\nPlease check your inline asm statement for invalid "
-               << "constraints:\n";
+              << "constraints:\n";
           MI->print(Msg, tm_);
         }
         llvm_report_error(Msg.str());
       }
-      for (const unsigned* AS = tri_->getSubRegisters(SpillReg); *AS; ++AS) {
+      for (const unsigned* AS = tri_->getSubRegisters(PReg); *AS; ++AS) {
         if (!hasInterval(*AS))
           continue;
         LiveInterval &spli = getInterval(*AS);





More information about the llvm-branch-commits mailing list