public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Make graph dumps use graphviz format
@ 2024-05-02  7:00 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-05-02  7:00 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-02  7:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-02  7:00 [PATCH] Make graph dumps use graphviz format Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).