X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fgraphite-blocking.c;h=967de9d94627c58253f6792a60bb16f54369ed40;hb=a62aa377b4ef69d833d284fe4a5c2ee9c96bc9d3;hp=bcd077a8310876da1c70d3f73143da72ec9be3ee;hpb=1e5b7b1fcdadf68cbdd4b0c85243242d8326dc05;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c index bcd077a8310..967de9d9462 100644 --- a/gcc/graphite-blocking.c +++ b/gcc/graphite-blocking.c @@ -89,7 +89,7 @@ along with GCC; see the file COPYING3. If not see # } */ -static bool +static void pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride) { ppl_dimension_type iter, dim, strip; @@ -151,8 +151,6 @@ pbb_strip_mine_time_depth (poly_bb_p pbb, int time_depth, int stride) ppl_Polyhedron_add_constraint (res, new_cstr); ppl_delete_Constraint (new_cstr); } - - return true; } /* Returns true when strip mining with STRIDE of the loop LST is @@ -177,10 +175,10 @@ lst_strip_mine_profitable_p (lst_p lst, int stride) return res; } -/* Strip-mines all the loops of LST with STRIDE. Return true if it - did strip-mined some loops. */ +/* Strip-mines all the loops of LST with STRIDE. Return the number of + loops strip-mined. */ -static bool +static int lst_do_strip_mine_loop (lst_p lst, int depth, int stride) { int i; @@ -188,26 +186,26 @@ lst_do_strip_mine_loop (lst_p lst, int depth, int stride) poly_bb_p pbb; if (!lst) - return false; + return 0; if (LST_LOOP_P (lst)) { - bool res = false; + int res = 0; FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l) - res |= lst_do_strip_mine_loop (l, depth, stride); + res += lst_do_strip_mine_loop (l, depth, stride); return res; } pbb = LST_PBB (lst); - return pbb_strip_mine_time_depth (pbb, psct_dynamic_dim (pbb, depth), - stride); + pbb_strip_mine_time_depth (pbb, psct_dynamic_dim (pbb, depth), stride); + return 1; } /* Strip-mines all the loops of LST with STRIDE. When STRIDE is zero, - read the stride from the PARAM_LOOP_BLOCK_TILE_SIZE. Return true - if it did strip-mined some loops. + read the stride from the PARAM_LOOP_BLOCK_TILE_SIZE. Return the + number of strip-mined loops. Strip mining transforms a loop @@ -221,12 +219,12 @@ lst_do_strip_mine_loop (lst_p lst, int depth, int stride) | S (i = k + j); */ -static bool +static int lst_do_strip_mine (lst_p lst, int stride) { int i; lst_p l; - bool res = false; + int res = 0; int depth; if (!stride) @@ -237,23 +235,23 @@ lst_do_strip_mine (lst_p lst, int stride) return false; FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l) - res |= lst_do_strip_mine (l, stride); + res += lst_do_strip_mine (l, stride); depth = lst_depth (lst); if (depth >= 0 && lst_strip_mine_profitable_p (lst, stride)) { - res |= lst_do_strip_mine_loop (lst, lst_depth (lst), stride); + res += lst_do_strip_mine_loop (lst, lst_depth (lst), stride); lst_add_loop_under_loop (lst); } return res; } -/* Strip mines all the loops in SCOP. Returns true when some loops - have been strip-mined. */ +/* Strip mines all the loops in SCOP. Returns the number of + strip-mined loops. */ -bool +int scop_do_strip_mine (scop_p scop, int stride) { return lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), stride); @@ -265,27 +263,22 @@ scop_do_strip_mine (scop_p scop, int stride) bool scop_do_block (scop_p scop) { - bool strip_mined = false; - bool interchanged = false; - store_scattering (scop); - strip_mined = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), 0); - interchanged = scop_do_interchange (scop); - - /* If we don't interchange loops, the strip mine alone will not be - profitable, and the transform is not a loop blocking: so revert - the transform. */ - if (!interchanged) + /* If we don't strip mine at least two loops, or not interchange + loops, the strip mine alone will not be profitable, and the + transform is not a loop blocking: so revert the transform. */ + if (lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), 0) < 2 + || scop_do_interchange (scop) == 0) { restore_scattering (scop); return false; } - else if (strip_mined && interchanged - && dump_file && (dump_flags & TDF_DETAILS)) + + if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "SCoP will be loop blocked.\n"); - return strip_mined || interchanged; + return true; } #endif