Disable each MachineFunctionPass for 'optnone' functions, unless that
[oota-llvm.git] / lib / CodeGen / LivePhysRegs.cpp
index 2e103333c7888453932371e5d8890c502ac957e7..7efd941322b388b9af362166aa4964ec869bfa3c 100644 (file)
@@ -9,18 +9,16 @@
 //
 // This file implements the LivePhysRegs utility for tracking liveness of
 // physical registers across machine instructions in forward or backward order.
+// A more detailed description can be found in the corresponding header file.
 //
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/LivePhysRegs.h"
 #include "llvm/CodeGen/MachineInstrBundle.h"
+#include "llvm/Support/Debug.h"
 using namespace llvm;
 
 
-/// We assume the high bits of a physical super-register are not preserved
-/// unless the instruction has an implicit-use operand reading the
-/// super-register.
-
 /// \brief Remove all registers from the set that get clobbered by the register
 /// mask.
 void LivePhysRegs::removeRegsInMask(const MachineOperand &MO) {
@@ -89,3 +87,28 @@ void LivePhysRegs::stepForward(const MachineInstr &MI) {
   for (unsigned i = 0, e = Defs.size(); i != e; ++i)
     addReg(Defs[i]);
 }
+
+/// Prin the currently live registers to OS.
+void LivePhysRegs::print(raw_ostream &OS) const {
+  OS << "Live Registers:";
+  if (!TRI) {
+    OS << " (uninitialized)\n";
+    return;
+  }
+
+  if (empty()) {
+    OS << " (empty)\n";
+    return;
+  }
+
+  for (const_iterator I = begin(), E = end(); I != E; ++I)
+    OS << " " << PrintReg(*I, TRI);
+  OS << "\n";
+}
+
+/// Dumps the currently live registers to the debug output.
+void LivePhysRegs::dump() const {
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+  dbgs() << "  " << *this;
+#endif
+}