Put the operation name in each node, put the function name on the graph.
authorChris Lattner <sabre@nondot.org>
Mon, 10 Jan 2005 23:26:00 +0000 (23:26 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 10 Jan 2005 23:26:00 +0000 (23:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19444 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

index 9c483332266ce514f6e9f00d16a5104eb8b55f6a..db094a0a1201097faf595352b39620ee22991a03 100644 (file)
 #include <fstream>
 using namespace llvm;
 
+namespace llvm {
+  template<>
+  struct DOTGraphTraits<SelectionDAG*> : public DefaultDOTGraphTraits {
+    static std::string getGraphName(const SelectionDAG *G) {
+      return G->getMachineFunction().getFunction()->getName();
+    }
+    static std::string getNodeLabel(const SDNode *Node,
+                                    const SelectionDAG *Graph) {
+      return Node->getOperationName();
+    }
+
+    static std::string getNodeAttributes(const SDNode *N) {
+      return "shape=Mrecord";
+    }
+  };
+}
+
 /// viewGraph - Pop up a ghostview window with the reachable parts of the DAG
 /// rendered using 'dot'.
 ///