From 51ded0e1eecbbe7ff6d533cb2e5f928efb3cc41c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 14 Jul 2005 01:10:55 +0000 Subject: If the Graphviz program is available, use it to visualize dot graphs. llvm-svn: 22429 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp index d4c1dcd3b8a..8ab6783d561 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp @@ -116,10 +116,19 @@ void SelectionDAG::viewGraph() { F.close(); std::cerr << "\n"; +#ifdef HAVE_GRAPHVIZ + std::cerr << "Running 'Graphviz' program... " << std::flush; + if (system(("Graphviz " + Filename).c_str())) { + std::cerr << "Error viewing graph: 'Graphviz' not in path?\n"; + } else { + return; + } +#endif + 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 running dot: 'dot' not in path?\n"; + std::cerr << "Error viewing graph: 'dot' not in path?\n"; } else { std::cerr << "\n"; system("gv /tmp/dag.tempgraph.ps"); -- cgit v1.2.3