llvm.org GIT mirror llvm / 00ad26f
Add support for other GraphViz display tools. This can help with very large graphs, where dot isn't necessarily the most visually pleasing way of looking at the graph. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75144 91177308-0d34-0410-b5e6-96231b3b80d8 David Greene 11 years ago
4 changed file(s) with 126 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
672672 AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}",
673673 [Define to path to dot program if found or 'echo dot' otherwise])
674674 fi
675 AC_PATH_PROG(FDP, [fdp], [echo fdp])
676 if test "$FDP" != "echo fdp" ; then
677 AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available])
678 dnl If we're targeting for mingw we should emit windows paths, not msys
679 if test "$llvm_cv_os_type" = "MingW" ; then
680 FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
681 fi
682 AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}",
683 [Define to path to fdp program if found or 'echo fdp' otherwise])
684 fi
685 AC_PATH_PROG(NEATO, [neato], [echo neato])
686 if test "$NEATO" != "echo neato" ; then
687 AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available])
688 dnl If we're targeting for mingw we should emit windows paths, not msys
689 if test "$llvm_cv_os_type" = "MingW" ; then
690 NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
691 fi
692 AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}",
693 [Define to path to neato program if found or 'echo neato' otherwise])
694 fi
695 AC_PATH_PROG(TWOPI, [twopi], [echo twopi])
696 if test "$TWOPI" != "echo twopi" ; then
697 AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available])
698 dnl If we're targeting for mingw we should emit windows paths, not msys
699 if test "$llvm_cv_os_type" = "MingW" ; then
700 TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
701 fi
702 AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}",
703 [Define to path to twopi program if found or 'echo twopi' otherwise])
704 fi
705 AC_PATH_PROG(CIRCO, [circo], [echo circo])
706 if test "$CIRCO" != "echo circo" ; then
707 AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available])
708 dnl If we're targeting for mingw we should emit windows paths, not msys
709 if test "$llvm_cv_os_type" = "MingW" ; then
710 CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
711 fi
712 AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}",
713 [Define to path to circo program if found or 'echo circo' otherwise])
714 fi
675715 AC_PATH_PROGS(GV, [gv gsview32], [echo gv])
676716 if test "$GV" != "echo gv" ; then
677717 AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available])
5959 /* Define to 1 if you have the `ceilf' function. */
6060 #undef HAVE_CEILF
6161
62 /* Define if the neat program is available */
63 #undef HAVE_CIRCO
64
6265 /* Define to 1 if you have the `closedir' function. */
6366 #undef HAVE_CLOSEDIR
6467
108111 /* Define to 1 if you have the header file. */
109112 #undef HAVE_FCNTL_H
110113
114 /* Define if the neat program is available */
115 #undef HAVE_FDP
116
111117 /* Define if libffi is available on this platform. */
112118 #undef HAVE_FFI_CALL
113119
266272 /* Define to 1 if you have the `nearbyintf' function. */
267273 #undef HAVE_NEARBYINTF
268274
275 /* Define if the neat program is available */
276 #undef HAVE_NEATO
277
269278 /* Define to 1 if you have the `opendir' function. */
270279 #undef HAVE_OPENDIR
271280
430439 /* Define to 1 if you have the header file. */
431440 #undef HAVE_TERMIOS_H
432441
442 /* Define if the neat program is available */
443 #undef HAVE_TWOPI
444
433445 /* Define to 1 if the system has the type `uint64_t'. */
434446 #undef HAVE_UINT64_T
435447
490502 /* Define if this is Win32ish platform */
491503 #undef LLVM_ON_WIN32
492504
505 /* Define to path to circo program if found or 'echo circo' otherwise */
506 #undef LLVM_PATH_CIRCO
507
493508 /* Define to path to dot program if found or 'echo dot' otherwise */
494509 #undef LLVM_PATH_DOT
495510
496511 /* Define to path to dotty program if found or 'echo dotty' otherwise */
497512 #undef LLVM_PATH_DOTTY
498513
514 /* Define to path to fdp program if found or 'echo fdp' otherwise */
515 #undef LLVM_PATH_FDP
516
499517 /* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */
500518 #undef LLVM_PATH_GRAPHVIZ
501519
502520 /* Define to path to gv program if found or 'echo gv' otherwise */
503521 #undef LLVM_PATH_GV
522
523 /* Define to path to neato program if found or 'echo neato' otherwise */
524 #undef LLVM_PATH_NEATO
525
526 /* Define to path to twopi program if found or 'echo twopi' otherwise */
527 #undef LLVM_PATH_TWOPI
504528
505529 /* Installation prefix directory */
506530 #undef LLVM_PREFIX
6666 }
6767 }
6868
69 void DisplayGraph(const sys::Path& Filename, bool wait=true);
69 namespace GraphProgram {
70 enum Name {
71 DOT,
72 FDP,
73 NEATO,
74 TWOPI,
75 CIRCO
76 };
77 }
78
79 void DisplayGraph(const sys::Path& Filename, bool wait=true, GraphProgram::Name program = GraphProgram::DOT);
7080
7181 template
7282 class GraphWriter {
313323 void ViewGraph(const GraphType& G,
314324 const std::string& Name,
315325 bool ShortNames = false,
316 const std::string& Title = "") {
326 const std::string& Title = "",
327 GraphProgram::Name Program = GraphProgram::DOT) {
317328 sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
318329
319330 if (Filename.isEmpty()) {
320331 return;
321332 }
322333
323 DisplayGraph(Filename);
334 DisplayGraph(Filename, true, Program);
324335 }
325336
326337 } // End llvm namespace
1717 #include "llvm/Config/config.h"
1818 using namespace llvm;
1919
20 void llvm::DisplayGraph(const sys::Path &Filename, bool wait) {
20 void llvm::DisplayGraph(const sys::Path &Filename, bool wait,
21 GraphProgram::Name program) {
2122 std::string ErrMsg;
2223 #if HAVE_GRAPHVIZ
2324 sys::Path Graphviz(LLVM_PATH_GRAPHVIZ);
3435 else {
3536 Filename.eraseFromDisk();
3637 }
37
38 #elif (HAVE_GV && (HAVE_DOT || HAVE_FDP))
38
39 #elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \
40 HAVE_TWOPI || HAVE_CIRCO))
3941 sys::Path PSFilename = Filename;
4042 PSFilename.appendSuffix("ps");
4143
44 sys::Path prog;
45
46 // Set default grapher
47 #if HAVE_CIRCO
48 prog = sys::Path(LLVM_PATH_CIRCO);
49 #endif
50 #if HAVE_TWOPI
51 prog = sys::Path(LLVM_PATH_TWOPI);
52 #endif
53 #if HAVE_NEATO
54 prog = sys::Path(LLVM_PATH_NEATO);
55 #endif
4256 #if HAVE_FDP
43 sys::Path prog(LLVM_PATH_FDP);
44 #else
45 sys::Path prog(LLVM_PATH_DOT);
57 prog = sys::Path(LLVM_PATH_FDP);
58 #endif
59 #if HAVE_DOT
60 prog = sys::Path(LLVM_PATH_DOT);
61 #endif
62
63 // Find which program the user wants
64 #if HAVE_DOT
65 if (program == GraphProgram::DOT) {
66 prog = sys::Path(LLVM_PATH_DOT);
67 }
68 #endif
69 #if (HAVE_FDP)
70 if (program == GraphProgram::FDP) {
71 prog = sys::Path(LLVM_PATH_FDP);
72 }
73 #endif
74 #if (HAVE_NEATO)
75 if (program == GraphProgram::NEATO) {
76 prog = sys::Path(LLVM_PATH_NEATO);
77 }
78 #endif
79 #if (HAVE_TWOPI)
80 if (program == GraphProgram::TWOPI) {
81 prog = sys::Path(LLVM_PATH_TWOPI);
82 }
83 #endif
84 #if (HAVE_CIRCO)
85 if (program == GraphProgram::CIRCO) {
86 prog = sys::Path(LLVM_PATH_CIRCO);
87 }
4688 #endif
4789
4890 std::vector args;