Index: include/llvm/CodeGen/SelectionDAG.h =================================================================== --- include/llvm/CodeGen/SelectionDAG.h +++ include/llvm/CodeGen/SelectionDAG.h @@ -1352,6 +1352,9 @@ ArrayRef GetDbgValues(const SDNode* SD) const { return DbgInfo->getSDDbgValues(SD); } + const ArrayRef GetDbgValues(const SDNode* SD) const { + return DbgInfo->getSDDbgValues(SD); + } public: /// Return true if there are any SDDbgValue nodes associated @@ -1360,12 +1363,20 @@ SDDbgInfo::DbgIterator DbgBegin() { return DbgInfo->DbgBegin(); } SDDbgInfo::DbgIterator DbgEnd() { return DbgInfo->DbgEnd(); } + SDDbgInfo::DbgIterator DbgBegin() const { return DbgInfo->DbgBegin(); } + SDDbgInfo::DbgIterator DbgEnd() const { return DbgInfo->DbgEnd(); } SDDbgInfo::DbgIterator ByvalParmDbgBegin() { return DbgInfo->ByvalParmDbgBegin(); } + SDDbgInfo::DbgIterator ByvalParmDbgEnd() { + return DbgInfo->ByvalParmDbgEnd(); + } - SDDbgInfo::DbgIterator ByvalParmDbgEnd() { + SDDbgInfo::DbgIterator ByvalParmDbgBegin() const { + return DbgInfo->ByvalParmDbgBegin(); + } + SDDbgInfo::DbgIterator ByvalParmDbgEnd() const { return DbgInfo->ByvalParmDbgEnd(); } Index: lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "SDNodeDbgValue.h" #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" #include "llvm/ADT/None.h" @@ -56,6 +57,10 @@ VerboseDAGDumping("dag-dump-verbose", cl::Hidden, cl::desc("Display more information when dumping selection " "DAG nodes.")); +static cl::opt +VerboseDbgDAGDumping("dag-dump-verbose-dbg", cl::Hidden, + cl::desc("Display more information when dumping selection " + "DAG nodes.")); std::string SDNode::getOperationName(const SelectionDAG *G) const { switch (getOpcode()) { @@ -677,7 +682,15 @@ << ']'; } - if (VerboseDAGDumping) { + if (VerboseDbgDAGDumping) { + if (G && getHasDebugValue()) { + if (!G->GetDbgValues(this).empty()) + OS << " [NoOfDbgValues=" << G->GetDbgValues(this).size() << ']'; + } else if (getHasDebugValue()) + OS << " [NoOfDbgValues>0]"; + } + + if (VerboseDAGDumping || VerboseDbgDAGDumping) { if (unsigned Order = getIROrder()) OS << " [ORD=" << Order << ']'; @@ -723,6 +736,8 @@ /// Return true if this node is so simple that we should just print it inline /// if it appears as an operand. static bool shouldPrintInline(const SDNode &Node) { + if (VerboseDAGDumping || VerboseDbgDAGDumping) + return false; if (Node.getOpcode() == ISD::EntryToken) return false; return Node.getNumOperands() == 0; @@ -754,6 +769,25 @@ if (getRoot().getNode()) DumpNodes(getRoot().getNode(), 2, this); dbgs() << "\n\n"; + + SDDbgInfo::DbgIterator DI = DbgBegin(); + SDDbgInfo::DbgIterator DE = DbgEnd(); + for (; DI != DE; ++DI) { + dbgs() << "SDDbgValue:" + << " Kind=" << (*DI)->getKind() + << " Order=" << (*DI)->getOrder() + << " Var=" << (*DI)->getVariable()->getName() + << "\n\n"; + } + DI = ByvalParmDbgBegin(); + DE = ByvalParmDbgEnd(); + for (; DI != DE; ++DI) { + dbgs() << "Byval SDDbgValue:" + << " Kind=" << (*DI)->getKind() + << " Order=" << (*DI)->getOrder() + << " Var=" << (*DI)->getVariable()->getName() + << "\n\n"; + } } #endif