https://gcc.gnu.org/g:c59708fba3f98a4cc257741b88216b6caf6b4a87

commit r15-104-gc59708fba3f98a4cc257741b88216b6caf6b4a87
Author: Richard Biener <rguent...@suse.de>
Date:   Tue Apr 30 13:01:43 2024 +0200

    Make graph dumps use graphviz format
    
    SLP build eventually uses graphds graphs, the following makes its
    dump use graphviz format so you can easily visualize it.
    
            * graphds.cc (dump_graph): Dump in graphviz format.

Diff:
---
 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.  */

Reply via email to