OSDN Git Service

PR target/51871
[pf3gnuchains/gcc-fork.git] / gcc / graphite-blocking.c
index f263cde..967de9d 100644 (file)
@@ -23,32 +23,16 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
-#include "ggc.h"
-#include "tree.h"
-#include "rtl.h"
-#include "output.h"
-#include "basic-block.h"
-#include "diagnostic.h"
 #include "tree-flow.h"
 #include "tree-dump.h"
-#include "timevar.h"
 #include "cfgloop.h"
 #include "tree-chrec.h"
 #include "tree-data-ref.h"
-#include "tree-scalar-evolution.h"
-#include "tree-pass.h"
-#include "domwalk.h"
-#include "value-prof.h"
-#include "pointer-set.h"
-#include "gimple.h"
-#include "params.h"
+#include "sese.h"
 
 #ifdef HAVE_cloog
 #include "ppl_c.h"
-#include "sese.h"
 #include "graphite-ppl.h"
-#include "graphite.h"
 #include "graphite-poly.h"
 
 
@@ -105,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;
@@ -167,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
@@ -193,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;
@@ -204,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
 
@@ -237,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)
@@ -253,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);
@@ -281,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