Put comment printing under asm-verbose.
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index cac92530df8fa92769371e32ce92414e358319d7..0428105551064541dd6eea7da9436ef9d9fa92af 100644 (file)
@@ -373,11 +373,13 @@ void LiveInterval::scaleNumbering(unsigned factor) {
   for (vni_iterator VNI = vni_begin(), VNIE = vni_end(); VNI != VNIE; ++VNI) {
     VNInfo *vni = *VNI;
 
-    vni->def = InstrSlots::scale(vni->def, factor);
+    if (vni->isDefAccurate())
+      vni->def = InstrSlots::scale(vni->def, factor);
 
     for (unsigned i = 0; i < vni->kills.size(); ++i) {
-      if (vni->kills[i] != 0)
-        vni->kills[i] = InstrSlots::scale(vni->kills[i], factor);
+      if (!vni->kills[i].isPHIKill)
+        vni->kills[i].killIdx =
+          InstrSlots::scale(vni->kills[i].killIdx, factor);
     }
   }
 }
@@ -501,7 +503,7 @@ void LiveInterval::join(LiveInterval &Other, const int *LHSValNoAssignments,
     InsertPos = addRangeFrom(*I, InsertPos);
   }
 
-  weight += Other.weight;
+  ComputeJoinedWeight(Other);
 
   // Update regalloc hint if currently there isn't one.
   if (TargetRegisterInfo::isVirtualRegister(reg) &&
@@ -791,6 +793,29 @@ unsigned LiveInterval::getSize() const {
   return Sum;
 }
 
+/// ComputeJoinedWeight - Set the weight of a live interval Joined
+/// after Other has been merged into it.
+void LiveInterval::ComputeJoinedWeight(const LiveInterval &Other) {
+  // If either of these intervals was spilled, the weight is the
+  // weight of the non-spilled interval.  This can only happen with
+  // iterative coalescers.
+
+  if (weight == HUGE_VALF &&
+      !TargetRegisterInfo::isPhysicalRegister(reg)) {
+    // Remove this assert if you have an iterative coalescer
+    assert(0 && "Joining to spilled interval");
+    weight = Other.weight;
+  }
+  else if (Other.weight != HUGE_VALF) {
+    weight += Other.weight;
+  }
+  else {
+    // Otherwise the weight stays the same
+    // Remove this assert if you have an iterative coalescer
+    assert(0 && "Joining from spilled interval");
+  }
+}
+
 std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) {
   return os << '[' << LR.start << ',' << LR.end << ':' << LR.valno->id << ")";
 }
@@ -839,7 +864,9 @@ void LiveInterval::print(std::ostream &OS,
         if (ee || vni->hasPHIKill()) {
           OS << "-(";
           for (unsigned j = 0; j != ee; ++j) {
-            OS << vni->kills[j];
+            OS << vni->kills[j].killIdx;
+            if (vni->kills[j].isPHIKill)
+              OS << "*";
             if (j != ee-1)
               OS << " ";
           }