summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog.graphite6
-rw-r--r--gcc/graphite-dependences.c2
-rw-r--r--gcc/graphite-poly.c62
-rw-r--r--gcc/graphite-poly.h1
4 files changed, 70 insertions, 1 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 576c7b6d09c..382dcbae348 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,11 @@
2009-10-13 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-poly.c (dot_lst_1): New.
+ (dot_lst): New.
+ * graphite-poly.h (dot_lst): Declared.
+
+2009-10-13 Sebastian Pop <sebastian.pop@amd.com>
+
* graphite-dependences.c (dot_deps_stmt_1): New.
(dot_deps_stmt): New.
* graphite-dependences.h (dot_deps_stmt): Declared.
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 5be1647bc66..5480a36a6d6 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -908,7 +908,7 @@ dot_deps_stmt (scop_p scop)
x = system ("dotty /tmp/scopdeps.dot");
#else
- dot_deps_1 (stderr, scop);
+ dot_deps_stmt_1 (stderr, scop);
#endif
}
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index d956ad4df25..659839d28ed 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -906,5 +906,67 @@ debug_lst (lst_p lst)
print_lst (stderr, lst, 0);
}
+/* Pretty print to FILE the loop statement tree LST in DOT format. */
+
+static void
+dot_lst_1 (FILE *file, lst_p lst)
+{
+ if (!lst)
+ return;
+
+ if (LST_LOOP_P (lst))
+ {
+ int i;
+ lst_p l;
+
+ if (!LST_LOOP_FATHER (lst))
+ fprintf (file, "L -> L_%d_%d\n",
+ lst_depth (lst),
+ lst_dewey_number (lst));
+ else
+ fprintf (file, "L_%d_%d -> L_%d_%d\n",
+ lst_depth (LST_LOOP_FATHER (lst)),
+ lst_dewey_number (LST_LOOP_FATHER (lst)),
+ lst_depth (lst),
+ lst_dewey_number (lst));
+
+ for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ dot_lst_1 (file, l);
+ }
+
+ else
+ fprintf (file, "L_%d_%d -> S_%d\n",
+ lst_depth (LST_LOOP_FATHER (lst)),
+ lst_dewey_number (LST_LOOP_FATHER (lst)),
+ pbb_index (LST_PBB (lst)));
+
+}
+
+/* Display the LST using dotty. */
+
+void
+dot_lst (lst_p lst)
+{
+ /* When debugging, enable the following code. This cannot be used
+ in production compilers because it calls "system". */
+#if 0
+ int x;
+ FILE *stream = fopen ("/tmp/lst.dot", "w");
+ gcc_assert (stream);
+
+ fputs ("digraph all {\n", stream);
+ dot_lst_1 (stream, lst);
+ fputs ("}\n\n", stream);
+ fclose (stream);
+
+ x = system ("dotty /tmp/lst.dot");
+#else
+ fputs ("digraph all {\n", stderr);
+ dot_lst_1 (stderr, lst);
+ fputs ("}\n\n", stderr);
+
+#endif
+}
+
#endif
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index f059834b072..3c82e68cd9c 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -636,6 +636,7 @@ struct lst {
void scop_to_lst (scop_p);
void print_lst (FILE *, lst_p, int);
void debug_lst (lst_p);
+void dot_lst (lst_p);
/* Creates a new LST loop with SEQ. */