OSDN Git Service

2008-04-28 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-dce.c
index 7da5cdf..95457eb 100644 (file)
@@ -1,5 +1,6 @@
 /* Dead code elimination pass for the GNU compiler.
-   Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+   Free Software Foundation, Inc.
    Contributed by Ben Elliston <bje@redhat.com>
    and Andrew MacLeod <amacleod@redhat.com>
    Adapted to use control dependence by Steven Bosscher, SUSE Labs.
@@ -8,7 +9,7 @@ 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
@@ -17,9 +18,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/>.  */
 
 /* Dead code elimination.
 
@@ -277,7 +277,7 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
      can then remove the block and labels.  */
   switch (TREE_CODE (stmt))
     {
-    case BIND_EXPR:
+    case PREDICT_EXPR:
     case LABEL_EXPR:
     case CASE_LABEL_EXPR:
       mark_stmt_necessary (stmt, false);
@@ -286,6 +286,7 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
     case ASM_EXPR:
     case RESX_EXPR:
     case RETURN_EXPR:
+    case CHANGE_DYNAMIC_TYPE_EXPR:
       mark_stmt_necessary (stmt, true);
       return;
 
@@ -591,7 +592,7 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb)
       basic_block post_dom_bb;
 
       /* The post dominance info has to be up-to-date.  */
-      gcc_assert (dom_computed[CDI_POST_DOMINATORS] == DOM_OK);
+      gcc_assert (dom_info_state (CDI_POST_DOMINATORS) == DOM_OK);
       /* Get the immediate post dominator of bb.  */
       post_dom_bb = get_immediate_dominator (CDI_POST_DOMINATORS, bb);
 
@@ -702,6 +703,7 @@ eliminate_unnecessary_stmts (void)
                          == SSA_NAME)
                      && !TEST_BIT (processed, SSA_NAME_VERSION (name)))
                    {
+                     tree oldlhs = GIMPLE_STMT_OPERAND (t, 0);
                      something_changed = true;
                      if (dump_file && (dump_flags & TDF_DETAILS))
                        {
@@ -715,6 +717,7 @@ eliminate_unnecessary_stmts (void)
                      maybe_clean_or_replace_eh_stmt (t, call);
                      mark_symbols_for_renaming (call);
                      pop_stmt_changes (bsi_stmt_ptr (i));
+                     release_ssa_name (oldlhs);
                    }
                  notice_special_calls (call);
                }
@@ -898,8 +901,10 @@ gate_dce (void)
   return flag_tree_dce != 0;
 }
 
-struct tree_opt_pass pass_dce =
+struct gimple_opt_pass pass_dce =
 {
+ {
+  GIMPLE_PASS,
   "dce",                               /* name */
   gate_dce,                            /* gate */
   tree_ssa_dce,                                /* execute */
@@ -911,12 +916,14 @@ struct tree_opt_pass pass_dce =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_dump_func | TODO_verify_ssa,    /* todo_flags_finish */
-  0                                    /* letter */
+  TODO_dump_func | TODO_verify_ssa     /* todo_flags_finish */
+ }
 };
 
-struct tree_opt_pass pass_dce_loop =
+struct gimple_opt_pass pass_dce_loop =
 {
+ {
+  GIMPLE_PASS,
   "dceloop",                           /* name */
   gate_dce,                            /* gate */
   tree_ssa_dce_loop,                   /* execute */
@@ -928,12 +935,14 @@ struct tree_opt_pass pass_dce_loop =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_dump_func | TODO_verify_ssa,    /* todo_flags_finish */
-  0                                    /* letter */
+  TODO_dump_func | TODO_verify_ssa     /* todo_flags_finish */
+ }
 };
 
-struct tree_opt_pass pass_cd_dce =
+struct gimple_opt_pass pass_cd_dce =
 {
+ {
+  GIMPLE_PASS,
   "cddce",                             /* name */
   gate_dce,                            /* gate */
   tree_ssa_cd_dce,                     /* execute */
@@ -946,6 +955,6 @@ struct tree_opt_pass pass_cd_dce =
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
   TODO_dump_func | TODO_verify_ssa
-  | TODO_verify_flow,                  /* todo_flags_finish */
-  0                                    /* letter */
+  | TODO_verify_flow                   /* todo_flags_finish */
+ }
 };