diff options
author | Sebastian Pop <sebastian.pop@amd.com> | 2009-11-25 04:54:59 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-11-25 04:54:59 +0000 |
commit | a36d12e2779468da79e41d35c1049e8635121bde (patch) | |
tree | 02e35480ed7c4b55e69634fdedb15db36377cafe /gcc/graphite-poly.c | |
parent | a0dd14403d8cd1bbf4d47eec81b7eae81c9605d3 (diff) | |
download | gcc-a36d12e2779468da79e41d35c1049e8635121bde.zip gcc-a36d12e2779468da79e41d35c1049e8635121bde.tar.gz gcc-a36d12e2779468da79e41d35c1049e8635121bde.tar.bz2 |
graphite-poly.c (print_scop): Print SCOP_ORIGINAL_SCHEDULE and SCOP_TRANSFORMED_SCHEDULE.
2009-10-06 Sebastian Pop <sebastian.pop@amd.com>
* graphite-poly.c (print_scop): Print SCOP_ORIGINAL_SCHEDULE and
SCOP_TRANSFORMED_SCHEDULE.
(loop_to_lst): New.
(scop_to_lst): New.
(print_lst): New.
(debug_lst): New.
* graphite-poly.h (lst_p): New.
(struct lst): New.
(LST_LOOP_P): New.
(LST_LOOP_FATHER): New.
(LST_PBB): New.
(LST_SEQ): New.
(scop_to_lst): Declared.
(print_lst): Declared.
(debug_lst): Declared.
(new_lst_loop): New.
(new_lst_stmt): New.
(copy_lst): New.
(lst_depth): New.
(lst_dewey_number): New.
(struct scop): Add original_schedule and transformed_schedule fields.
(SCOP_ORIGINAL_SCHEDULE): New.
(SCOP_TRANSFORMED_SCHEDULE): New.
* graphite-sese-to-poly.c (build_poly_scop): Call scop_to_lst.
From-SVN: r154562
Diffstat (limited to 'gcc/graphite-poly.c')
-rw-r--r-- | gcc/graphite-poly.c | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index e97b0a8..843640c 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -643,6 +643,14 @@ print_scop (FILE *file, scop_p scop) print_pbb (file, pbb); fprintf (file, ")\n"); + + fprintf (file, "original_lst (\n"); + print_lst (file, SCOP_ORIGINAL_SCHEDULE (scop), 0); + fprintf (file, ")\n"); + + fprintf (file, "transformed_lst (\n"); + print_lst (file, SCOP_TRANSFORMED_SCHEDULE (scop), 0); + fprintf (file, ")\n"); } /* Print to STDERR the domain of PBB. */ @@ -807,5 +815,92 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb, ppl_delete_Pointset_Powerset_C_Polyhedron (ext_domain); } +/* Translates LOOP to LST. */ + +static lst_p +loop_to_lst (loop_p loop, VEC (poly_bb_p, heap) *bbs, int *i) +{ + poly_bb_p pbb; + VEC (lst_p, heap) *seq = VEC_alloc (lst_p, heap, 5); + + for (; VEC_iterate (poly_bb_p, bbs, *i, pbb); (*i)++) + { + lst_p stmt; + basic_block bb = GBB_BB (PBB_BLACK_BOX (pbb)); + + if (bb->loop_father == loop) + stmt = new_lst_stmt (pbb); + else + { + if (flow_bb_inside_loop_p (loop, bb)) + stmt = loop_to_lst (loop->inner, bbs, i); + else + { + loop_p next = loop; + + while ((next = next->next) + && !flow_bb_inside_loop_p (next, bb)); + + if (!next) + return new_lst_loop (seq); + + stmt = loop_to_lst (next, bbs, i); + } + } + + VEC_safe_push (lst_p, heap, seq, stmt); + } + + return new_lst_loop (seq); +} + +/* Reads the original scattering of the SCOP and returns an LST + representing it. */ + +void +scop_to_lst (scop_p scop) +{ + poly_bb_p pbb = VEC_index (poly_bb_p, SCOP_BBS (scop), 0); + loop_p loop = outermost_loop_in_sese (SCOP_REGION (scop), GBB_BB (PBB_BLACK_BOX (pbb))); + int i = 0; + + SCOP_ORIGINAL_SCHEDULE (scop) = loop_to_lst (loop, SCOP_BBS (scop), &i); + SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (SCOP_ORIGINAL_SCHEDULE (scop)); +} + +/* Print LST to FILE with INDENT spaces of indentation. */ + +void +print_lst (FILE *file, lst_p lst, int indent) +{ + if (!lst) + return; + + indent_to (file, indent); + + if (LST_LOOP_P (lst)) + { + int i; + lst_p l; + + fprintf (file, "%d (loop", lst_dewey_number (lst)); + + for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++) + print_lst (file, l, indent + 2); + + fprintf (file, ")"); + } + else + fprintf (file, "%d stmt_%d", lst_dewey_number (lst), pbb_index (LST_PBB (lst))); +} + +/* Print LST to STDERR. */ + +void +debug_lst (lst_p lst) +{ + print_lst (stderr, lst, 0); +} + #endif |