[llvm-commits] [llvm] r150840 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Lang Hames lhames at gmail.com
Fri Feb 17 13:29:41 PST 2012


Author: lhames
Date: Fri Feb 17 15:29:41 2012
New Revision: 150840

URL: http://llvm.org/viewvc/llvm-project?rev=150840&view=rev
Log:
Add support for regmask slots to HMEditor. Also fixes a comment error.

Modified:
    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=150840&r1=150839&r2=150840&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Feb 17 15:29:41 2012
@@ -1069,7 +1069,6 @@
     assert(intervalRangesSane(li) && "Broke live interval moving use.");
   }
 
-  // Returns the new
   void moveUseUp(SlotIndex oldIdx, LiveRange& lr, LiveInterval& li) {
     bool liveThrough = lr.end > oldIdx.getRegSlot();
     if (liveThrough)
@@ -1098,7 +1097,7 @@
   }
 
   // Update intervals for all operands of mi from oldIndex to newIndex.
-  void moveAllOperands(MachineInstr* mi, SlotIndex oldIdx) {
+  void moveAllOperandsFrom(MachineInstr* mi, SlotIndex oldIdx) {
     // Figure out the direction we're moving.
     bool movingUp = newIdx < oldIdx;
 
@@ -1109,6 +1108,11 @@
          mopItr != mopEnd; ++mopItr) {
       const MachineOperand& mop = *mopItr;
 
+      if (mop.isRegMask()) {
+        updateRegMaskSlots(oldIdx);
+        continue;
+      }
+
       if (!mop.isReg() || mop.getReg() == 0)
         continue;
 
@@ -1249,6 +1253,16 @@
       moveUseDown(oldIdx, *lr, li, mbb);
     }
   }
+
+  void updateRegMaskSlots(SlotIndex oldIdx) {
+    SmallVectorImpl<SlotIndex>::iterator rmItr =
+      std::lower_bound(lis.RegMaskSlots.begin(), lis.RegMaskSlots.end(),
+                       oldIdx);
+    assert(*rmItr == oldIdx && "No RegMask at oldIdx.");
+    *rmItr = newIdx;
+    assert(*prior(rmItr) < *rmItr && *rmItr < *next(rmItr) &&
+           "RegSlots out of order. Did you move one call across another?");
+  }
 };
 
 void LiveIntervals::handleMove(MachineInstr* mi) {
@@ -1263,5 +1277,5 @@
   assert(!mi->isBundled() && "Can't handle bundled instructions yet.");
 
   HMEditor hme(*this, newIndex);
-  hme.moveAllOperands(mi, oldIndex);
+  hme.moveAllOperandsFrom(mi, oldIndex);
 }





More information about the llvm-commits mailing list