SLP build eventually uses graphds graphs, the following makes its
dump use graphviz format so you can easily visualize it.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        * graphds.cc (dump_graph): Dump in graphviz format.
---
 gcc/graphds.cc | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/gcc/graphds.cc b/gcc/graphds.cc
index 17d08966f53..ed5bfeb2808 100644
--- a/gcc/graphds.cc
+++ b/gcc/graphds.cc
@@ -31,22 +31,17 @@ dump_graph (FILE *f, struct graph *g)
   int i;
   struct graph_edge *e;
 
+  fprintf (f, "digraph {\n");
   for (i = 0; i < g->n_vertices; i++)
     {
-      if (!g->vertices[i].pred
-         && !g->vertices[i].succ)
-       continue;
-
-      fprintf (f, "%d (%d)\t<-", i, g->vertices[i].component);
+      fprintf (f, "\"%d\" [label=\"%d (%d): %p\"];\n",
+              i, i, g->vertices[i].component, g->vertices[i].data);
       for (e = g->vertices[i].pred; e; e = e->pred_next)
-       fprintf (f, " %d", e->src);
-      fprintf (f, "\n");
-
-      fprintf (f, "\t->");
+       fprintf (f, "\"%d\" -> \"%d\" [label=\"%p\"];\n", e->src, e->dest, 
e->data);
       for (e = g->vertices[i].succ; e; e = e->succ_next)
-       fprintf (f, " %d", e->dest);
-      fprintf (f, "\n");
+       fprintf (f, "\"%d\" -> \"%d\";\n", e->src, e->dest);
     }
+  fprintf (f, "}\n");
 }
 
 /* Creates a new graph with N_VERTICES vertices.  */
-- 
2.35.3

Reply via email to