Move the stuff that fixes the size, orientation & fonts of graphs to
authorBrian Gaeke <gaeke@uiuc.edu>
Wed, 5 May 2004 06:10:06 +0000 (06:10 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Wed, 5 May 2004 06:10:06 +0000 (06:10 +0000)
the debugging functions that call "dot". These fixed settings have
various problems: for example, the fixed size that is set in the graph
traits classes is not appropriate for turning the dot file into a PNG,
and if TrueType font rendering is being used, the 'Courier' TrueType font
may not be installed. It seems easy enough to specify these things on the
command line, anyhow.

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

include/Support/DOTGraphTraits.h
include/llvm/Support/DOTGraphTraits.h
lib/Analysis/CFGPrinter.cpp
lib/Analysis/DataStructure/Printer.cpp

index 63837b7ddf699bfbf6bf3c1b03b63e67915cee71..7dbc4ff0b656568949a2a214fbe2f4b9ef0e947d 100644 (file)
@@ -33,11 +33,10 @@ struct DefaultDOTGraphTraits {
   static std::string getGraphName(const void *Graph) { return ""; }
 
   /// getGraphProperties - Return any custom properties that should be included
-  /// in the top level graph structure for dot.  By default, we resize the graph
-  /// to fit on a letter size page.
+  /// in the top level graph structure for dot.
   ///
   static std::string getGraphProperties(const void *Graph) {
-    return "\tsize=\"7.5,10\";\n";    // Size to fit on a page
+    return "";
   }
 
   /// getNodeLabel - Given a node and a pointer to the top level graph, return
index 63837b7ddf699bfbf6bf3c1b03b63e67915cee71..7dbc4ff0b656568949a2a214fbe2f4b9ef0e947d 100644 (file)
@@ -33,11 +33,10 @@ struct DefaultDOTGraphTraits {
   static std::string getGraphName(const void *Graph) { return ""; }
 
   /// getGraphProperties - Return any custom properties that should be included
-  /// in the top level graph structure for dot.  By default, we resize the graph
-  /// to fit on a letter size page.
+  /// in the top level graph structure for dot.
   ///
   static std::string getGraphProperties(const void *Graph) {
-    return "\tsize=\"7.5,10\";\n";    // Size to fit on a page
+    return "";
   }
 
   /// getNodeLabel - Given a node and a pointer to the top level graph, return
index 9530f5695abcc5a8be50bdfd9bc1a75f1c29a887..ddd9851b740a8856527deca8f8eeb153303a6051 100644 (file)
@@ -75,10 +75,6 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
     return OutStr;
   }
 
-  static std::string getNodeAttributes(const BasicBlock *N) {
-    return "fontname=Courier";
-  }
-  
   static std::string getEdgeSourceLabel(const BasicBlock *Node,
                                         succ_const_iterator I) {
     // Label source of conditional branches with "T" or "F"
@@ -155,7 +151,8 @@ void Function::viewCFG() const {
   std::cerr << "\n";
 
   std::cerr << "Running 'dot' program... " << std::flush;
-  if (system(("dot -Tps " + Filename + " > /tmp/cfg.tempgraph.ps").c_str())) {
+  if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename
+              + " > /tmp/cfg.tempgraph.ps").c_str())) {
     std::cerr << "Error running dot: 'dot' not in path?\n";
   } else {
     std::cerr << "\n";
index 03058fb38259b7946de1fc38e828265c2af64a22..f6e073adce980f83d4fa39142d6088060c11ff06 100644 (file)
@@ -93,17 +93,12 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
     }
   }
 
-  static const char *getGraphProperties(const DSGraph *G) {
-    return "\tsize=\"10,7.5\";\n"
-           "\trotate=\"90\";\n";
-  }
-
   static std::string getNodeLabel(const DSNode *Node, const DSGraph *Graph) {
     return getCaption(Node, Graph);
   }
 
   static std::string getNodeAttributes(const DSNode *N) {
-    return "shape=Mrecord";//fontname=Courier";
+    return "shape=Mrecord";
   }
   
   /// addCustomGraphFeatures - Use this graph writing hook to emit call nodes
@@ -234,7 +229,7 @@ void DSGraph::viewGraph() const {
   }
   print(F);
   F.close();
-  if (system("dot -Tps /tmp/tempgraph.dot > /tmp/tempgraph.ps"))
+  if (system("dot -Tps -Gsize=10,7.5 -Grotate=90 /tmp/tempgraph.dot > /tmp/tempgraph.ps"))
     std::cerr << "Error running dot: 'dot' not in path?\n";
   system("gv /tmp/tempgraph.ps");
   system("rm /tmp/tempgraph.dot /tmp/tempgraph.ps");