#include "params.h"
#ifdef HAVE_cloog
-#include "cloog/cloog.h"
#include "ppl_c.h"
#include "sese.h"
#include "graphite-ppl.h"
return true;
}
-/* Returns true when strip mining with STRIDE of the loop around PBB
- at DEPTH is profitable. */
+/* Returns true when strip mining with STRIDE of the loop LST is
+ profitable. */
static bool
-pbb_strip_mine_profitable_p (poly_bb_p pbb,
- graphite_dim_t depth,
- int stride)
+lst_strip_mine_profitable_p (lst_p lst, int stride)
{
- Value niter, strip_stride;
+ mpz_t niter, strip_stride;
bool res;
+ gcc_assert (LST_LOOP_P (lst));
mpz_init (strip_stride);
mpz_init (niter);
+
mpz_set_si (strip_stride, stride);
- pbb_number_of_iterations_at_time (pbb, psct_dynamic_dim (pbb, depth), niter);
+ lst_niter_for_loop (lst, niter);
res = (mpz_cmp (niter, strip_stride) > 0);
+
mpz_clear (strip_stride);
mpz_clear (niter);
-
return res;
}
{
bool res = false;
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
res |= lst_do_strip_mine_loop (l, depth);
return res;
|| !LST_LOOP_P (lst))
return false;
- for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+ FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l)
res |= lst_do_strip_mine (l);
depth = lst_depth (lst);
if (depth >= 0
- && pbb_strip_mine_profitable_p (LST_PBB (lst_find_first_pbb (lst)),
- depth, stride))
+ && lst_strip_mine_profitable_p (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. */
+/* Strip mines all the loops in SCOP. Returns true when some loops
+ have been strip-mined. */
bool
scop_do_strip_mine (scop_p scop)
{
- bool transform_done = false;
-
- store_scattering (scop);
-
- transform_done = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop));
-
- if (!transform_done)
- return false;
-
- if (!graphite_legal_transform (scop))
- {
- restore_scattering (scop);
- return false;
- }
-
- return transform_done;
+ return lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop));
}
/* Loop blocks all the loops in SCOP. Returns true when we manage to
strip_mined = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop));
interchanged = scop_do_interchange (scop);
- /* If we don't interchange loops, then the strip mine is not
- profitable, and the transform is not a loop blocking. */
- if (!interchanged
- || !graphite_legal_transform (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)
{
restore_scattering (scop);
return false;