X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FLivePhysRegs.cpp;h=7efd941322b388b9af362166aa4964ec869bfa3c;hb=5fa58a5b232be0b8261041a651ed1be3ae8d3848;hp=2e103333c7888453932371e5d8890c502ac957e7;hpb=edf1070ca74f7d646bce2c66db9f443d09e7d1d3;p=oota-llvm.git diff --git a/lib/CodeGen/LivePhysRegs.cpp b/lib/CodeGen/LivePhysRegs.cpp index 2e103333c78..7efd941322b 100644 --- a/lib/CodeGen/LivePhysRegs.cpp +++ b/lib/CodeGen/LivePhysRegs.cpp @@ -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 +}