aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Grosser <grosser@fmi.uni-passau.de>2008-01-21 03:33:05 +0000
committerSebastian Pop <sebastian.pop@amd.com>2008-01-21 03:33:05 +0000
commitcf19cd33f86cb41fbb068e59b0e72b4efde6f2a7 (patch)
treec3843814e52ee3e9b53a7912fa5b53a46ae76d04
parent56366ea7358f757f49390b4a1535228a0b9d17a7 (diff)
2008-01-20 Tobias Grosser <grosser@fmi.uni-passau.de>
* graphite.c (dot_all_scops, dot_all_scops_1): New. (find_transform): Call dot_all_1. * graphite.h (dot_all_scops): Declared. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/graphite@131688 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.graphite6
-rw-r--r--gcc/graphite.c97
-rw-r--r--gcc/graphite.h1
3 files changed, 104 insertions, 0 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b37e3e2aea9..3dc39c65e12 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,9 @@
+2008-01-20 Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (dot_all_scops, dot_all_scops_1): New.
+ (find_transform): Call dot_all_1.
+ * graphite.h (dot_all_scops): Declared.
+
2007-12-14 Sebastian Pop <sebastian.pop@amd.com>
* tree-loop-distribution.c: Fix apsi.f ICE.
diff --git a/gcc/graphite.c b/gcc/graphite.c
index b09961ece99..cdaf7a9e3ab 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -48,6 +48,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
VEC (scop_p, heap) *current_scops;
+static bool basic_block_simple_for_scop_p (basic_block);
/* Print the schedules from SCHED. */
@@ -177,6 +178,101 @@ dot_scop (scop_p scop)
system ("dotty /tmp/scop.dot");
}
+/* Pretty print all SCoPs in DOT format and mark them with different colors.
+ If there are not enough colors (8 at the moment), paint later SCoPs gray.
+ Special nodes:
+ - filled node: entry of a SCoP,
+ - node shaped like a box: end of a SCoP,
+ - node with diagonals: critical BB. */
+
+static void
+dot_all_scops_1 (FILE *file)
+{
+ basic_block bb;
+ edge e;
+ edge_iterator ei;
+ scop_p scop;
+ const char* color;
+ int i;
+
+ fprintf (file, "digraph all {\n");
+
+ FOR_ALL_BB (bb)
+ {
+ /* Select color for scop. */
+ for (i = 0; VEC_iterate (scop_p, current_scops, i, scop); i++)
+ if (bb_in_scop_p (bb, scop) || scop->exit == bb || scop->entry == bb)
+ {
+ switch (i)
+ {
+ case 0: /* red */
+ color = "#e41a1c";
+ break;
+ case 1: /* blue */
+ color = "#377eb8";
+ break;
+ case 2: /* green */
+ color = "#4daf4a";
+ break;
+ case 3: /* purple */
+ color = "#984ea3";
+ break;
+ case 4: /* orange */
+ color = "#ff7f00";
+ break;
+ case 5: /* yellow */
+ color = "#ffff33";
+ break;
+ case 6: /* brown */
+ color = "#e41a1c";
+ break;
+ case 7: /* rose */
+ color = "#f781bf";
+ break;
+ default: /* gray */
+ color = "#e41a1c";
+ }
+
+ if (bb == scop->entry)
+ fprintf (file, "%d [style=\"bold,filled\",fillcolor=\"%s\"];\n",
+ bb->index, color);
+ else
+ fprintf (file, "%d [style=\"bold\",color=\"%s\"];\n", bb->index,
+ color);
+ }
+
+ /* Mark blocks not allowed in SCoP. */
+ if (!basic_block_simple_for_scop_p (bb))
+ fprintf (file, "%d [style=\"bold,diagonals,filled\"];\n", bb->index);
+
+ /* Print edges. */
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
+ }
+
+ /* Change the shape of the exit nodes. Don't change the shape of entry
+ nodes, as one node may be exit and entry at once and can not have two
+ different shapes. */
+ for (i = 0; VEC_iterate (scop_p, current_scops, i, scop); i++)
+ fprintf (file, "%d [shape=box];\n", scop->exit->index);
+
+ fputs ("}\n\n", file);
+}
+
+/* Display all SCoPs using dotty. */
+
+void
+dot_all_scops (void)
+{
+ FILE *stream = fopen ("/tmp/allscops.dot", "w");
+ gcc_assert (stream != NULL);
+
+ dot_all_scops_1(stream);
+ fclose (stream);
+
+ system ("dotty /tmp/allscops.dot");
+}
+
static scop_p down_open_scop;
@@ -1252,6 +1348,7 @@ graphite_transform_loops (void)
if (dump_file && (dump_flags & TDF_DETAILS))
{
+ dot_all_scops_1 (dump_file);
print_scops (dump_file, 2);
fprintf (dump_file, "\nnumber of SCoPs: %d\n",
VEC_length (scop_p, current_scops));
diff --git a/gcc/graphite.h b/gcc/graphite.h
index 7ad3cb5076d..d181e9ff13d 100644
--- a/gcc/graphite.h
+++ b/gcc/graphite.h
@@ -93,6 +93,7 @@ extern void debug_scop (scop_p, int);
extern void debug_scops (int);
extern void print_graphite_bb (FILE *, graphite_bb_p, int, int);
extern void dot_scop (scop_p);
+extern void dot_all_scops (void);
/* Return the number of parameters used in SCOP. */