X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Fgraphite-poly.c;h=659839d28ede807e1d8603dfce982165459ccab1;hp=d956ad4df258180fca6cc71af2284b44883d9832;hb=4938b827210d017ca5105b7bd2202ef1b88f809a;hpb=a7d089acd0deada2b8dab5caad02ff0562071b88 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