OSDN Git Service

2012-02-02 Vladimir Makarov <vmakarov@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / graphite.c
index 819116d..b013447 100644 (file)
@@ -1,5 +1,5 @@
 /* Gimple Represented as Polyhedra.
-   Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Sebastian Pop <sebastian.pop@inria.fr>.
 
 This file is part of GCC.
@@ -35,44 +35,27 @@ 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 "basic-block.h"
-#include "diagnostic.h"
+#include "diagnostic-core.h"
 #include "tree-flow.h"
-#include "toplev.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 "value-prof.h"
-#include "pointer-set.h"
-#include "gimple.h"
 #include "sese.h"
-#include "predict.h"
+#include "dbgcnt.h"
 
 #ifdef HAVE_cloog
 
-/* The CLooG header file is not -Wc++-compat ready as of 2009-05-11.
-   This #pragma should be removed when it is ready.  */
-#if GCC_VERSION >= 4003
-#pragma GCC diagnostic warning "-Wc++-compat"
-#endif
-
-#include "cloog/cloog.h"
 #include "ppl_c.h"
 #include "graphite-ppl.h"
-#include "graphite.h"
 #include "graphite-poly.h"
 #include "graphite-scop-detection.h"
 #include "graphite-clast-to-gimple.h"
 #include "graphite-sese-to-poly.h"
 
+CloogState *cloog_state;
+
 /* Print global statistics to FILE.  */
 
 static void
@@ -196,7 +179,7 @@ print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
 
   scop_p scop;
 
-  for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+  FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
     print_graphite_scop_statistics (file, scop);
 }
 
@@ -205,7 +188,12 @@ print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
 static bool
 graphite_initialize (void)
 {
-  if (number_of_loops () <= 1)
+  int ppl_initialized;
+
+  if (number_of_loops () <= 1
+      /* FIXME: This limit on the number of basic blocks of a function
+        should be removed when the SCOP detection is faster.  */
+      || n_basic_blocks > PARAM_VALUE (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION))
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
        print_global_statistics (dump_file);
@@ -213,8 +201,14 @@ graphite_initialize (void)
       return false;
     }
 
+  scev_reset ();
   recompute_all_dominators ();
   initialize_original_copy_tables ();
+
+  ppl_initialized = ppl_initialize ();
+  gcc_assert (ppl_initialized == 0);
+
+  cloog_state = cloog_state_malloc ();
   cloog_initialize ();
 
   if (dump_file && dump_flags)
@@ -231,15 +225,17 @@ graphite_finalize (bool need_cfg_cleanup_p)
 {
   if (need_cfg_cleanup_p)
     {
+      scev_reset ();
       cleanup_tree_cfg ();
       profile_status = PROFILE_ABSENT;
       release_recorded_exits ();
       tree_estimate_probability ();
     }
 
+  cloog_state_free (cloog_state);
   cloog_finalize ();
+  ppl_finalize ();
   free_original_copy_tables ();
-  free_aux_in_new_loops ();
 
   if (dump_file && dump_flags)
     print_loops (dump_file, 3);
@@ -270,27 +266,16 @@ graphite_transform_loops (void)
 
   bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
 
-  for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
-    {
-      bool transform_done = false;
-
-      if (!build_poly_scop (scop))
-       continue;
-
-      if (apply_poly_transforms (scop))
-       transform_done = gloog (scop, bb_pbb_mapping);
-      else
-       check_poly_representation (scop);
+  FOR_EACH_VEC_ELT (scop_p, scops, i, scop)
+    if (dbg_cnt (graphite_scop))
+      {
+       build_poly_scop (scop);
 
-      if (transform_done)
-       {
-         scev_reset ();
+       if (POLY_SCOP_P (scop)
+           && apply_poly_transforms (scop)
+           && gloog (scop, bb_pbb_mapping))
          need_cfg_cleanup_p = true;
-       }
-    }
-
-  if (flag_loop_parallelize_all)
-    mark_loops_parallel (bb_pbb_mapping);
+      }
 
   htab_delete (bb_pbb_mapping);
   free_scops (scops);