aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-04-30 13:01:43 +0200
committerRichard Biener <rguenther@suse.de>2024-05-02 09:01:11 +0200
commitc59708fba3f98a4cc257741b88216b6caf6b4a87 (patch)
tree94b65da87abef57260a48422dd1d5bb3abe728d0 /gcc
parent5176402d6fdbf131d176b5f43ac6449c1bda072b (diff)
downloadgcc-c59708fba3f98a4cc257741b88216b6caf6b4a87.zip
gcc-c59708fba3f98a4cc257741b88216b6caf6b4a87.tar.gz
gcc-c59708fba3f98a4cc257741b88216b6caf6b4a87.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/graphds.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/gcc/graphds.cc b/gcc/graphds.cc
index 17d0896..ed5bfeb 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. */