diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.graphite | 9 | ||||
-rw-r--r-- | gcc/graphite-blocking.c | 71 | ||||
-rw-r--r-- | gcc/graphite-poly.c | 2 | ||||
-rw-r--r-- | gcc/graphite-poly.h | 36 |
4 files changed, 98 insertions, 20 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index e58bf04..2d59c3b 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,5 +1,14 @@ 2009-10-14 Sebastian Pop <sebastian.pop@amd.com> + * graphite-blocking.c (pbb_do_strip_mine): Removed. + (lst_do_strip_mine_loop): New. + (lst_do_strip_mine): New. + (scop_do_strip_mine): Call lst_do_strip_mine. + * graphite-poly.h (lst_add_loop_under_loop): New. + (lst_find_first_pbb): New. + +2009-10-14 Sebastian Pop <sebastian.pop@amd.com> + * graphite-poly.c (loop_to_lst): Fix LST creation. 2009-10-14 Tobias Grosser <grosser@fim.uni-passau.de> diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c index 9bd793b..b5f5acd 100644 --- a/gcc/graphite-blocking.c +++ b/gcc/graphite-blocking.c @@ -195,42 +195,75 @@ pbb_strip_mine_profitable_p (poly_bb_p pbb, return res; } -/* Strip mines all the loops around PBB. Nothing profitable in all this: - this is just a driver function. */ +/* Strip-mines all the loops of LST that are considered profitable to + strip-mine. Return true if it did strip-mined some loops. */ static bool -pbb_do_strip_mine (poly_bb_p pbb) +lst_do_strip_mine_loop (lst_p lst, int depth) { - graphite_dim_t s_dim; + int i; + lst_p l; int stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE); - bool transform_done = false; + poly_bb_p pbb; - for (s_dim = 0; s_dim < pbb_nb_dynamic_scattering_transform (pbb); s_dim++) - if (pbb_strip_mine_profitable_p (pbb, psct_dynamic_dim (pbb, s_dim), - stride)) - { - ppl_dimension_type d = psct_dynamic_dim (pbb, s_dim); - transform_done |= pbb_strip_mine_time_depth (pbb, d, stride); - s_dim++; - } + if (!lst) + return false; - return transform_done; + if (LST_LOOP_P (lst)) + { + bool res = false; + + for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++) + res |= lst_do_strip_mine_loop (l, depth); + + return res; + } + + pbb = LST_PBB (lst); + return pbb_strip_mine_time_depth (pbb, psct_dynamic_dim (pbb, depth), + stride); } +/* Strip-mines all the loops of LST that are considered profitable to + strip-mine. Return true if it did strip-mined some loops. */ + +static bool +lst_do_strip_mine (lst_p lst) +{ + int i; + lst_p l; + bool res = false; + int stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE); + + if (!lst + || !LST_LOOP_P (lst)) + return false; + + for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++) + res |= lst_do_strip_mine (l); + + if (pbb_strip_mine_profitable_p (LST_PBB (lst_find_first_pbb (lst)), + lst_depth (lst), stride)) + { + res |= lst_do_strip_mine_loop (lst, lst_depth (lst)); + lst_add_loop_under_loop (lst); + } + + return res; +} + + /* Strip mines all the loops in SCOP. Nothing profitable in all this: this is just a driver function. */ bool scop_do_strip_mine (scop_p scop) { - poly_bb_p pbb; - int i; bool transform_done = false; store_scattering (scop); - for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++) - transform_done |= pbb_do_strip_mine (pbb); + transform_done = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop)); if (!transform_done) return false; @@ -241,7 +274,7 @@ scop_do_strip_mine (scop_p scop) return false; } - return true; + return transform_done; } #endif diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 6373337..af18afb 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -796,7 +796,7 @@ pbb_number_of_iterations_at_time (poly_bb_p pbb, them into the bigger polyhedron that has the following format: t0..t_{n-1} | l0..l_{nlcl-1} | i0..i_{niter-1} | g0..g_{nparm-1}. t0..t_{n-1} are time dimensions (scattering dimensions) - l0..l_{nclc-1} are local variables in scatterin function + l0..l_{nclc-1} are local variables in scattering function i0..i_{niter-1} are original iteration variables g0..g_{nparam-1} are global parameters. */ diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 3c82e68..64a082e 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -693,6 +693,21 @@ copy_lst (lst_p lst) return new_lst_stmt (LST_PBB (lst)); } +/* Adds a new loop under the loop LST. */ + +static inline void +lst_add_loop_under_loop (lst_p lst) +{ + VEC (lst_p, heap) *seq = VEC_alloc (lst_p, heap, 1); + lst_p l = new_lst_loop (LST_SEQ (lst)); + + gcc_assert (LST_LOOP_P (lst)); + + LST_LOOP_FATHER (l) = lst; + VEC_quick_push (lst_p, seq, l); + LST_SEQ (lst) = seq; +} + /* Returns the loop depth of LST. */ static inline int @@ -765,6 +780,27 @@ find_lst_loop (lst_p stmt, int loop_depth) return loop; } +/* Return the LST node corresponding to PBB. */ + +static inline lst_p +lst_find_first_pbb (lst_p lst) +{ + int i; + lst_p l; + + if (!lst) + return NULL; + + if (LST_LOOP_P (lst)) + for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++) + { + lst_p res = lst_find_first_pbb (l); + if (res) + return res; + } + + return lst; +} /* A SCOP is a Static Control Part of the program, simple enough to be represented in polyhedral form. */ |