Make this use the new autoconf support for finding the executables for
authorChris Lattner <sabre@nondot.org>
Thu, 14 Jul 2005 05:33:13 +0000 (05:33 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 14 Jul 2005 05:33:13 +0000 (05:33 +0000)
gv and Graphviz.

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

lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

index fbe6cdb9c55de3b174ccfdbc3d977e60247c17ea..3e685f34538dfa95d8959427e5b3d5580ef5a1a2 100644 (file)
@@ -103,9 +103,7 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
 ///
 void SelectionDAG::viewGraph() {
 // This code is only for debugging!
-#ifdef NDEBUG
-  std::cerr << "SelectionDAG::viewGraph is only available in debug builds!\n";
-#else
+#ifndef NDEBUG
   std::string Filename = "/tmp/dag." +
     getMachineFunction().getFunction()->getName() + ".dot";
   std::cerr << "Writing '" << Filename << "'... ";
@@ -122,21 +120,26 @@ void SelectionDAG::viewGraph() {
 
 #ifdef HAVE_GRAPHVIZ
   std::cerr << "Running 'Graphviz' program... " << std::flush;
-  if (system(("Graphviz " + Filename).c_str())) {
+  if (system((LLVM_PATH_GRAPHVIZ " " + Filename).c_str())) {
     std::cerr << "Error viewing graph: 'Graphviz' not in path?\n";
   } else {
     return;
   }
 #endif
 
+#ifdef HAVE_GV
   std::cerr << "Running 'dot' program... " << std::flush;
   if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename
               + " > /tmp/dag.tempgraph.ps").c_str())) {
     std::cerr << "Error viewing graph: 'dot' not in path?\n";
   } else {
     std::cerr << "\n";
-    system("gv /tmp/dag.tempgraph.ps");
+    system(LLVM_PATH_GV " /tmp/dag.tempgraph.ps");
   }
   system(("rm " + Filename + " /tmp/dag.tempgraph.ps").c_str());
+  return;
 #endif
+#endif
+  std::cerr << "SelectionDAG::viewGraph is only available in debug builds on "
+            << "systems with Graphviz or gv!\n";
 }