//
// 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) {
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
+}