[llvm-commits] [llvm] r75144 - in /llvm/trunk: autoconf/configure.ac include/llvm/Config/config.h.in include/llvm/Support/GraphWriter.h lib/Support/GraphWriter.cpp
David Greene
greened at obbligato.org
Thu Jul 9 10:06:18 PDT 2009
Author: greened
Date: Thu Jul 9 12:06:18 2009
New Revision: 75144
URL: http://llvm.org/viewvc/llvm-project?rev=75144&view=rev
Log:
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.
Modified:
llvm/trunk/autoconf/configure.ac
llvm/trunk/include/llvm/Config/config.h.in
llvm/trunk/include/llvm/Support/GraphWriter.h
llvm/trunk/lib/Support/GraphWriter.cpp
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=75144&r1=75143&r2=75144&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Thu Jul 9 12:06:18 2009
@@ -673,6 +673,46 @@
AC_DEFINE_UNQUOTED([LLVM_PATH_DOT],"$DOT${EXEEXT}",
[Define to path to dot program if found or 'echo dot' otherwise])
fi
+AC_PATH_PROG(FDP, [fdp], [echo fdp])
+if test "$FDP" != "echo fdp" ; then
+ AC_DEFINE([HAVE_FDP],[1],[Define if the neat program is available])
+ dnl If we're targeting for mingw we should emit windows paths, not msys
+ if test "$llvm_cv_os_type" = "MingW" ; then
+ FDP=`echo $FDP | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
+ fi
+ AC_DEFINE_UNQUOTED([LLVM_PATH_FDP],"$FDP${EXEEXT}",
+ [Define to path to fdp program if found or 'echo fdp' otherwise])
+fi
+AC_PATH_PROG(NEATO, [neato], [echo neato])
+if test "$NEATO" != "echo neato" ; then
+ AC_DEFINE([HAVE_NEATO],[1],[Define if the neat program is available])
+ dnl If we're targeting for mingw we should emit windows paths, not msys
+ if test "$llvm_cv_os_type" = "MingW" ; then
+ NEATO=`echo $NEATO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
+ fi
+ AC_DEFINE_UNQUOTED([LLVM_PATH_NEATO],"$NEATO${EXEEXT}",
+ [Define to path to neato program if found or 'echo neato' otherwise])
+fi
+AC_PATH_PROG(TWOPI, [twopi], [echo twopi])
+if test "$TWOPI" != "echo twopi" ; then
+ AC_DEFINE([HAVE_TWOPI],[1],[Define if the neat program is available])
+ dnl If we're targeting for mingw we should emit windows paths, not msys
+ if test "$llvm_cv_os_type" = "MingW" ; then
+ TWOPI=`echo $TWOPI | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
+ fi
+ AC_DEFINE_UNQUOTED([LLVM_PATH_TWOPI],"$TWOPI${EXEEXT}",
+ [Define to path to twopi program if found or 'echo twopi' otherwise])
+fi
+AC_PATH_PROG(CIRCO, [circo], [echo circo])
+if test "$CIRCO" != "echo circo" ; then
+ AC_DEFINE([HAVE_CIRCO],[1],[Define if the neat program is available])
+ dnl If we're targeting for mingw we should emit windows paths, not msys
+ if test "$llvm_cv_os_type" = "MingW" ; then
+ CIRCO=`echo $CIRCO | sed 's/^\/\([[A-Za-z]]\)\//\1:\//' `
+ fi
+ AC_DEFINE_UNQUOTED([LLVM_PATH_CIRCO],"$CIRCO${EXEEXT}",
+ [Define to path to circo program if found or 'echo circo' otherwise])
+fi
AC_PATH_PROGS(GV, [gv gsview32], [echo gv])
if test "$GV" != "echo gv" ; then
AC_DEFINE([HAVE_GV],[1],[Define if the gv program is available])
Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=75144&r1=75143&r2=75144&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Thu Jul 9 12:06:18 2009
@@ -60,6 +60,9 @@
/* Define to 1 if you have the `ceilf' function. */
#undef HAVE_CEILF
+/* Define if the neat program is available */
+#undef HAVE_CIRCO
+
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
@@ -109,6 +112,9 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
+/* Define if the neat program is available */
+#undef HAVE_FDP
+
/* Define if libffi is available on this platform. */
#undef HAVE_FFI_CALL
@@ -267,6 +273,9 @@
/* Define to 1 if you have the `nearbyintf' function. */
#undef HAVE_NEARBYINTF
+/* Define if the neat program is available */
+#undef HAVE_NEATO
+
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
@@ -431,6 +440,9 @@
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
+/* Define if the neat program is available */
+#undef HAVE_TWOPI
+
/* Define to 1 if the system has the type `uint64_t'. */
#undef HAVE_UINT64_T
@@ -491,18 +503,30 @@
/* Define if this is Win32ish platform */
#undef LLVM_ON_WIN32
+/* Define to path to circo program if found or 'echo circo' otherwise */
+#undef LLVM_PATH_CIRCO
+
/* Define to path to dot program if found or 'echo dot' otherwise */
#undef LLVM_PATH_DOT
/* Define to path to dotty program if found or 'echo dotty' otherwise */
#undef LLVM_PATH_DOTTY
+/* Define to path to fdp program if found or 'echo fdp' otherwise */
+#undef LLVM_PATH_FDP
+
/* Define to path to Graphviz program if found or 'echo Graphviz' otherwise */
#undef LLVM_PATH_GRAPHVIZ
/* Define to path to gv program if found or 'echo gv' otherwise */
#undef LLVM_PATH_GV
+/* Define to path to neato program if found or 'echo neato' otherwise */
+#undef LLVM_PATH_NEATO
+
+/* Define to path to twopi program if found or 'echo twopi' otherwise */
+#undef LLVM_PATH_TWOPI
+
/* Installation prefix directory */
#undef LLVM_PREFIX
Modified: llvm/trunk/include/llvm/Support/GraphWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=75144&r1=75143&r2=75144&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GraphWriter.h (original)
+++ llvm/trunk/include/llvm/Support/GraphWriter.h Thu Jul 9 12:06:18 2009
@@ -67,7 +67,17 @@
}
}
-void DisplayGraph(const sys::Path& Filename, bool wait=true);
+namespace GraphProgram {
+ enum Name {
+ DOT,
+ FDP,
+ NEATO,
+ TWOPI,
+ CIRCO
+ };
+}
+
+void DisplayGraph(const sys::Path& Filename, bool wait=true, GraphProgram::Name program = GraphProgram::DOT);
template<typename GraphType>
class GraphWriter {
@@ -314,14 +324,15 @@
void ViewGraph(const GraphType& G,
const std::string& Name,
bool ShortNames = false,
- const std::string& Title = "") {
+ const std::string& Title = "",
+ GraphProgram::Name Program = GraphProgram::DOT) {
sys::Path Filename = WriteGraph(G, Name, ShortNames, Title);
if (Filename.isEmpty()) {
return;
}
- DisplayGraph(Filename);
+ DisplayGraph(Filename, true, Program);
}
} // End llvm namespace
Modified: llvm/trunk/lib/Support/GraphWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/GraphWriter.cpp?rev=75144&r1=75143&r2=75144&view=diff
==============================================================================
--- llvm/trunk/lib/Support/GraphWriter.cpp (original)
+++ llvm/trunk/lib/Support/GraphWriter.cpp Thu Jul 9 12:06:18 2009
@@ -18,7 +18,8 @@
#include "llvm/Config/config.h"
using namespace llvm;
-void llvm::DisplayGraph(const sys::Path &Filename, bool wait) {
+void llvm::DisplayGraph(const sys::Path &Filename, bool wait,
+ GraphProgram::Name program) {
std::string ErrMsg;
#if HAVE_GRAPHVIZ
sys::Path Graphviz(LLVM_PATH_GRAPHVIZ);
@@ -35,15 +36,56 @@
else {
Filename.eraseFromDisk();
}
-
-#elif (HAVE_GV && (HAVE_DOT || HAVE_FDP))
+
+#elif (HAVE_GV && (HAVE_DOT || HAVE_FDP || HAVE_NEATO || \
+ HAVE_TWOPI || HAVE_CIRCO))
sys::Path PSFilename = Filename;
PSFilename.appendSuffix("ps");
+ sys::Path prog;
+
+ // Set default grapher
+#if HAVE_CIRCO
+ prog = sys::Path(LLVM_PATH_CIRCO);
+#endif
+#if HAVE_TWOPI
+ prog = sys::Path(LLVM_PATH_TWOPI);
+#endif
+#if HAVE_NEATO
+ prog = sys::Path(LLVM_PATH_NEATO);
+#endif
#if HAVE_FDP
- sys::Path prog(LLVM_PATH_FDP);
-#else
- sys::Path prog(LLVM_PATH_DOT);
+ prog = sys::Path(LLVM_PATH_FDP);
+#endif
+#if HAVE_DOT
+ prog = sys::Path(LLVM_PATH_DOT);
+#endif
+
+ // Find which program the user wants
+#if HAVE_DOT
+ if (program == GraphProgram::DOT) {
+ prog = sys::Path(LLVM_PATH_DOT);
+ }
+#endif
+#if (HAVE_FDP)
+ if (program == GraphProgram::FDP) {
+ prog = sys::Path(LLVM_PATH_FDP);
+ }
+#endif
+#if (HAVE_NEATO)
+ if (program == GraphProgram::NEATO) {
+ prog = sys::Path(LLVM_PATH_NEATO);
+ }
+#endif
+#if (HAVE_TWOPI)
+ if (program == GraphProgram::TWOPI) {
+ prog = sys::Path(LLVM_PATH_TWOPI);
+ }
+#endif
+#if (HAVE_CIRCO)
+ if (program == GraphProgram::CIRCO) {
+ prog = sys::Path(LLVM_PATH_CIRCO);
+ }
#endif
std::vector<const char*> args;
More information about the llvm-commits
mailing list