diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-25 04:54:59 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-11-25 04:54:59 +0000 |
commit | f77385d317ef19edd093cba04f417ec0556e48a2 (patch) | |
tree | 02e35480ed7c4b55e69634fdedb15db36377cafe /gcc/graphite-poly.c | |
parent | 30f4f4a647d8e4c8fcaa92f0e2f2c775f5b8e398 (diff) | |
download | gcc-f77385d317ef19edd093cba04f417ec0556e48a2.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154562 138bc75d-0d04-0410-961f-82ee72b054a4
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 e97b0a863fd..843640c705d 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 |