When printing MemOperand nodes, only use print() for
authorDan Gohman <gohman@apple.com>
Thu, 17 Jul 2008 21:12:16 +0000 (21:12 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 17 Jul 2008 21:12:16 +0000 (21:12 +0000)
PseudoSourceValue values, which never have names. Use getName()
for all other values, because we want to print just a short summary
of the value, not the entire instruction.

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

lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

index cdfdf6f9a222391fa3e9cdc8c50f5f4e0e2c09f6..a9b07afc90f87445a3a41805345d615c48a6ce7e 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/PseudoSourceValue.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/GraphWriter.h"
@@ -155,13 +156,19 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
     else
       Op += "<null>";
   } else if (const MemOperandSDNode *M = dyn_cast<MemOperandSDNode>(Node)) {
-    if (M->MO.getValue()) {
+    const Value *V = M->MO.getValue();
+    Op += '<';
+    if (!V) {
+      Op += "(unknown)";
+    } else if (const PseudoSourceValue *PSV = dyn_cast<PseudoSourceValue>(V)) {
+      // PseudoSourceValues don't have names, so use their print method.
       std::ostringstream SS;
       M->MO.getValue()->print(SS);
-      Op += "<" + SS.str() + "+" + itostr(M->MO.getOffset()) + ">";
+      Op += SS.str();
     } else {
-      Op += "<(unknown)+" + itostr(M->MO.getOffset()) + ">";
+      Op += V->getName();
     }
+    Op += '+' + itostr(M->MO.getOffset()) + '>';
   } else if (const ARG_FLAGSSDNode *N = dyn_cast<ARG_FLAGSSDNode>(Node)) {
     Op = Op + " AF=" + N->getArgFlags().getArgFlagsString();
   } else if (const VTSDNode *N = dyn_cast<VTSDNode>(Node)) {