[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Printer.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 15 21:05:00 PDT 2002


Changes in directory llvm/lib/Analysis/DataStructure:

Printer.cpp updated: 1.16 -> 1.17

---
Log message:

     * Print the "return" node in the graphs



---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/Printer.cpp
diff -u llvm/lib/Analysis/DataStructure/Printer.cpp:1.16 llvm/lib/Analysis/DataStructure/Printer.cpp:1.17
--- llvm/lib/Analysis/DataStructure/Printer.cpp:1.16	Tue Oct 15 20:43:11 2002
+++ llvm/lib/Analysis/DataStructure/Printer.cpp	Tue Oct 15 21:04:36 2002
@@ -146,7 +146,7 @@
     O << "\tNode0x1" << "[ plaintext=circle, label =\""
       << escapeLabel("returning") << "\"];\n";
     writeEdge(O, (void*)1, "", -1, RetNode, "arrowtail=tee,color=gray63");
-  }    
+  }
 
   // Output all of the call nodes...
   for (unsigned i = 0, e = FunctionCalls.size(); i != e; ++i) {
@@ -193,6 +193,23 @@
   static int getEdgeSourceLabel(DSNode *Node, DSNode::iterator I) {
     assert(Node == I.getNode() && "Iterator not for this node!");
     return Node->getMergeMapLabel(I.getOffset());
+  }
+
+  /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes
+  /// and the return node.
+  ///
+  static void addCustomGraphFeatures(DSGraph *G, GraphWriter<DSGraph*> &GW) {
+    // Output the returned value pointer...
+    if (G->getRetNode().getNode() != 0) {
+      // Output the return node...
+      GW.emitSimpleNode((void*)1, "plaintext=circle", "returning");
+
+      // Add edge from return node to real destination
+      int RetEdgeDest = G->getRetNode().getOffset();
+      if (RetEdgeDest == 0) RetEdgeDest = -1;
+      GW.emitEdge((void*)1, -1, G->getRetNode().getNode(),
+                  RetEdgeDest, "arrowtail=tee,color=gray63");
+    }
   }
 };
 





More information about the llvm-commits mailing list