If the Graphviz program is available, use it to visualize dot graphs.

llvm-svn: 22429
This commit is contained in:
Chris Lattner 2005-07-14 01:10:55 +00:00
parent 8640f2bdc1
commit 51ded0e1ee
1 changed files with 10 additions and 1 deletions

View File

@ -116,10 +116,19 @@ void SelectionDAG::viewGraph() {
F.close(); F.close();
std::cerr << "\n"; 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; std::cerr << "Running 'dot' program... " << std::flush;
if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename if (system(("dot -Tps -Nfontname=Courier -Gsize=7.5,10 " + Filename
+ " > /tmp/dag.tempgraph.ps").c_str())) { + " > /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 { } else {
std::cerr << "\n"; std::cerr << "\n";
system("gv /tmp/dag.tempgraph.ps"); system("gv /tmp/dag.tempgraph.ps");