Print debug information for SDNodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103227 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-05-07 01:09:21 +00:00
parent 281d65d004
commit cc751bb99c

View File

@ -15,6 +15,7 @@
#include "SDNodeOrdering.h"
#include "SDNodeDbgValue.h"
#include "llvm/Constants.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Function.h"
#include "llvm/GlobalAlias.h"
@ -6008,6 +6009,21 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
if (getNodeId() != -1)
OS << " [ID=" << getNodeId() << ']';
DebugLoc dl = getDebugLoc();
if (G && !dl.isUnknown()) {
DIScope
Scope(dl.getScope(G->getMachineFunction().getFunction()->getContext()));
OS << " dbg:";
// Omit the directory, since it's usually long and uninteresting.
if (Scope.Verify())
OS << Scope.getFilename();
else
OS << "<unknown>";
OS << ':' << dl.getLine();
if (dl.getCol() != 0)
OS << ':' << dl.getCol();
}
}
void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const {