Match MachineFunction::UsedPhysRegs changes.
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index e2a3bbaaf0bf69b7ab794f6b22f451ce5e7b5aac..45c1dd03da5881e46a9ba7a876e20ebf057c1c13 100644 (file)
@@ -24,6 +24,7 @@
 #include "llvm/Target/MRegisterInfo.h"
 #include <algorithm>
 #include <map>
+#include <ostream>
 using namespace llvm;
 
 // An example for liveAt():
@@ -348,6 +349,8 @@ void LiveInterval::join(LiveInterval &Other, int *LHSValNoAssignments,
   ValueNumberInfo.clear();
   ValueNumberInfo.append(NewValueNumberInfo.begin(), NewValueNumberInfo.end());
   weight += Other.weight;
+  if (Other.preference && !preference)
+    preference = Other.preference;
 }
 
 /// MergeRangesInAsValue - Merge all of the intervals in RHS into this live
@@ -466,6 +469,13 @@ void LiveInterval::MergeValueNumberInto(unsigned V1, unsigned V2) {
   }
 }
 
+unsigned LiveInterval::getSize() const {
+  unsigned Sum = 0;
+  for (const_iterator I = begin(), E = end(); I != E; ++I)
+    Sum += I->end - I->start;
+  return Sum;
+}
+
 std::ostream& llvm::operator<<(std::ostream& os, const LiveRange &LR) {
   return os << '[' << LR.start << ',' << LR.end << ':' << LR.ValId << ")";
 }
@@ -474,7 +484,7 @@ void LiveRange::dump() const {
   cerr << *this << "\n";
 }
 
-void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const {
+void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
   if (MRI && MRegisterInfo::isPhysicalRegister(reg))
     OS << MRI->getName(reg);
   else
@@ -509,3 +519,8 @@ void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const {
 void LiveInterval::dump() const {
   cerr << *this << "\n";
 }
+
+
+void LiveRange::print(std::ostream &os) const {
+  os << *this;
+}