Make the legalizer completely non-recursive
[oota-llvm.git] / lib / CodeGen / LiveInterval.cpp
index ffa4caab06f13960aa4d0af45ef919cd0db8b41b..2cbb46b082ed614d86d4b669a5754567dc465c18 100644 (file)
@@ -18,8 +18,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "LiveInterval.h"
+#include "llvm/CodeGen/LiveInterval.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Target/MRegisterInfo.h"
 #include <algorithm>
 #include <iostream>
 #include <map>
@@ -351,17 +352,22 @@ void LiveRange::dump() const {
   std::cerr << *this << "\n";
 }
 
-
-std::ostream& llvm::operator<<(std::ostream& os, const LiveInterval& li) {
-  os << "%reg" << li.reg << ',' << li.weight;
-  if (li.empty())
-    return os << "EMPTY";
-
-  os << " = ";
-  for (LiveInterval::Ranges::const_iterator i = li.ranges.begin(),
-         e = li.ranges.end(); i != e; ++i)
-    os << *i;
-  return os;
+void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
+  if (MRI && MRegisterInfo::isPhysicalRegister(reg))
+    OS << MRI->getName(reg);
+  else
+    OS << "%reg" << reg;
+
+  OS << ',' << weight;
+
+  if (empty())
+    OS << "EMPTY";
+  else {
+    OS << " = ";
+    for (LiveInterval::Ranges::const_iterator I = ranges.begin(),
+           E = ranges.end(); I != E; ++I)
+    OS << *I;
+  }
 }
 
 void LiveInterval::dump() const {