diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index a1bda195ff6..c85d40b04f0 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -35,10 +35,30 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Config/alloca.h" #include +#include using namespace llvm; static RegisterAnalysis X("livevars", "Live Variable Analysis"); +void LiveVariables::VarInfo::dump() const { + std::cerr << "Register Defined by: "; + if (DefInst) + std::cerr << *DefInst; + else + std::cerr << "\n"; + std::cerr << " Alive in blocks: "; + for (unsigned i = 0, e = AliveBlocks.size(); i != e; ++i) + if (AliveBlocks[i]) std::cerr << i << ", "; + std::cerr << "\n Killed by:"; + if (Kills.empty()) + std::cerr << " No instructions.\n"; + else { + for (unsigned i = 0, e = Kills.size(); i != e; ++i) + std::cerr << "\n #" << i << ": " << *Kills[i]; + std::cerr << "\n"; + } +} + LiveVariables::VarInfo &LiveVariables::getVarInfo(unsigned RegIdx) { assert(MRegisterInfo::isVirtualRegister(RegIdx) && "getVarInfo: not a virtual register!");