SelectionDAGDumper: Hide [ID=X], [ORD=X] and source locations by default.
authorMatthias Braun <matze@braunis.de>
Fri, 18 Sep 2015 17:57:28 +0000 (17:57 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 18 Sep 2015 17:57:28 +0000 (17:57 +0000)
You can show them with the new -dag-dump-verbose switch.

Differential Revision: http://reviews.llvm.org/D12566

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248011 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
test/DebugInfo/Generic/constant-sdnodes-have-dbg-location.ll
test/DebugInfo/Generic/constantfp-sdnodes-have-dbg-location.ll

index 707cfad3dedf76ce4a65c1fc8bb24c408adb0d4f..f38fcb1efce95352af662ef73eae4cd7f8defa8a 100644 (file)
 #include "llvm/Target/TargetSubtargetInfo.h"
 using namespace llvm;
 
+static cl::opt<bool>
+VerboseDAGDumping("dag-dump-verbose", cl::Hidden,
+                  cl::desc("Display more information when dumping selection "
+                           "DAG nodes."));
+
 std::string SDNode::getOperationName(const SelectionDAG *G) const {
   switch (getOpcode()) {
   default:
@@ -553,26 +558,28 @@ void SDNode::print_details(raw_ostream &OS, const SelectionDAG *G) const {
        << ']';
   }
 
-  if (unsigned Order = getIROrder())
-      OS << " [ORD=" << Order << ']';
+  if (VerboseDAGDumping) {
+    if (unsigned Order = getIROrder())
+        OS << " [ORD=" << Order << ']';
 
-  if (getNodeId() != -1)
-    OS << " [ID=" << getNodeId() << ']';
+    if (getNodeId() != -1)
+      OS << " [ID=" << getNodeId() << ']';
 
-  if (!G)
-    return;
+    if (!G)
+      return;
 
-  DILocation *L = getDebugLoc();
-  if (!L)
-    return;
+    DILocation *L = getDebugLoc();
+    if (!L)
+      return;
 
-  if (auto *Scope = L->getScope())
-    OS << Scope->getFilename();
-  else
-    OS << "<unknown>";
-  OS << ':' << L->getLine();
-  if (unsigned C = L->getColumn())
-    OS << ':' << C;
+    if (auto *Scope = L->getScope())
+      OS << Scope->getFilename();
+    else
+      OS << "<unknown>";
+    OS << ':' << L->getLine();
+    if (unsigned C = L->getColumn())
+      OS << ':' << C;
+  }
 }
 
 static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) {
index b43729fe0052dcddf0fa06dc1b72a20ed8a76461..7fd9b98ba84f5c2c503a444a2d0c46a6490ef8f4 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc -debug < %s 2>&1 | FileCheck %s
+; RUN: llc -debug -dag-dump-verbose < %s 2>&1 | FileCheck %s
 ; REQUIRES: asserts
 
 ; CHECK: t{{[0-9]+}}: i32 = Constant<-1>test.c:4:5
index 36e5b6b507db17e540282449ccaf4662c4458a4d..cb1dda9738e223ec6e4a3d7206c355740cc5b0ce 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc -debug < %s 2>&1 | FileCheck %s
+; RUN: llc -debug -dag-dump-verbose < %s 2>&1 | FileCheck %s
 ; REQUIRES: asserts
 
 ; CHECK: t{{[0-9]+}}: f64 = ConstantFP<1.500000e+00>test.c:3:5