OSDN Git Service

* ggc.h (GGC_RESIZEVAR): New, reorder macros.
[pf3gnuchains/gcc-fork.git] / gcc / tree-predcom.c
index 7e8d461..32d7fbe 100644 (file)
@@ -1,11 +1,11 @@
 /* Predictive commoning.
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
    
 This file is part of GCC.
    
 GCC is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
 later version.
    
 GCC is distributed in the hope that it will be useful, but WITHOUT
@@ -14,9 +14,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
    
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 /* This file implements the predictive commoning optimization.  Predictive
    commoning can be viewed as CSE around a loop, and with some improvements,
@@ -591,7 +590,8 @@ suitable_reference_p (struct data_reference *a, enum ref_step_type *ref_step)
   tree ref = DR_REF (a), step = DR_STEP (a);
 
   if (!step
-      || !is_gimple_reg_type (TREE_TYPE (ref)))
+      || !is_gimple_reg_type (TREE_TYPE (ref))
+      || tree_could_throw_p (ref))
     return false;
 
   if (integer_zerop (step))
@@ -885,8 +885,8 @@ filter_suitable_components (struct loop *loop, struct component *comps)
 static int
 order_drefs (const void *a, const void *b)
 {
-  const dref *da = a;
-  const dref *db = b;
+  const dref *const da = (const dref *) a;
+  const dref *const db = (const dref *) b;
   int offcmp = double_int_scmp ((*da)->offset, (*db)->offset);
 
   if (offcmp != 0)
@@ -1394,7 +1394,16 @@ mark_virtual_ops_for_renaming (tree stmt)
   tree var;
 
   if (TREE_CODE (stmt) == PHI_NODE)
-    return;
+    {
+      var = PHI_RESULT (stmt);
+      if (is_gimple_reg (var))
+       return;
+
+      if (TREE_CODE (var) == SSA_NAME)
+       var = SSA_NAME_VAR (var);
+      mark_sym_for_renaming (var);
+      return;
+    }
 
   update_stmt (stmt);
 
@@ -1834,7 +1843,7 @@ struct epcc_data
 static void
 execute_pred_commoning_cbck (struct loop *loop, void *data)
 {
-  struct epcc_data *dta = data;
+  struct epcc_data *const dta = (struct epcc_data *) data;
 
   /* Restore phi nodes that were replaced by ssa names before
      tree_transform_and_unroll_loop (see detailed description in
@@ -2380,8 +2389,6 @@ set_alias_info (tree ref, struct data_reference *dr)
     new_type_alias (var, tag, ref);
   else
     var_ann (var)->symbol_mem_tag = tag;
-
-  var_ann (var)->subvars = DR_SUBVARS (dr);
 }
 
 /* Prepare initializers for CHAIN in LOOP.  Returns false if this is
@@ -2583,12 +2590,13 @@ end: ;
 
 /* Runs predictive commoning.  */
 
-void
+unsigned
 tree_predictive_commoning (void)
 {
   bool unrolled = false;
   struct loop *loop;
   loop_iterator li;
+  unsigned ret = 0;
 
   initialize_original_copy_tables ();
   FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
@@ -2599,7 +2607,9 @@ tree_predictive_commoning (void)
   if (unrolled)
     {
       scev_reset ();
-      cleanup_tree_cfg_loop ();
+      ret = TODO_cleanup_cfg;
     }
   free_original_copy_tables ();
+
+  return ret;
 }