OSDN Git Service

Remove spurious ChangeLog entry
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa.c
index 4cd86c6..f0bbf3b 100644 (file)
@@ -1,5 +1,5 @@
 /* Miscellaneous SSA utility functions.
 /* Miscellaneous SSA utility functions.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -352,6 +352,10 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
       value = degenerate_phi_result (def_stmt);
       if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
        value = NULL;
       value = degenerate_phi_result (def_stmt);
       if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL))
        value = NULL;
+      /* error_mark_node is what fixup_noreturn_call changes PHI arguments
+        to.  */
+      else if (value == error_mark_node)
+       value = NULL;
     }
   else if (is_gimple_assign (def_stmt))
     {
     }
   else if (is_gimple_assign (def_stmt))
     {
@@ -503,6 +507,37 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi)
     }
 }
 
     }
 }
 
+/* Reset all debug stmts that use SSA_NAME(s) defined in STMT.  */
+
+void
+reset_debug_uses (gimple stmt)
+{
+  ssa_op_iter op_iter;
+  def_operand_p def_p;
+  imm_use_iterator imm_iter;
+  gimple use_stmt;
+
+  if (!MAY_HAVE_DEBUG_STMTS)
+    return;
+
+  FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF)
+    {
+      tree var = DEF_FROM_PTR (def_p);
+
+      if (TREE_CODE (var) != SSA_NAME)
+       continue;
+
+      FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, var)
+       {
+         if (!gimple_debug_bind_p (use_stmt))
+           continue;
+
+         gimple_debug_bind_reset_value (use_stmt);
+         update_stmt (use_stmt);
+       }
+    }
+}
+
 /* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing
    dominated stmts before their dominators, so that release_ssa_defs
    stands a chance of propagating DEFs into debug bind stmts.  */
 /* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing
    dominated stmts before their dominators, so that release_ssa_defs
    stands a chance of propagating DEFs into debug bind stmts.  */
@@ -1183,8 +1218,6 @@ delete_tree_ssa (void)
   if (ssa_operands_active ())
     fini_ssa_operands ();
 
   if (ssa_operands_active ())
     fini_ssa_operands ();
 
-  delete_alias_heapvars ();
-
   htab_delete (cfun->gimple_df->default_defs);
   cfun->gimple_df->default_defs = NULL;
   pt_solution_reset (&cfun->gimple_df->escaped);
   htab_delete (cfun->gimple_df->default_defs);
   cfun->gimple_df->default_defs = NULL;
   pt_solution_reset (&cfun->gimple_df->escaped);
@@ -1273,6 +1306,13 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
          || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
        return false;
 
          || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
        return false;
 
+      /* Preserve conversions to BOOLEAN_TYPE if it is not of precision
+         one.  */
+      if (TREE_CODE (inner_type) != BOOLEAN_TYPE
+         && TREE_CODE (outer_type) == BOOLEAN_TYPE
+         && TYPE_PRECISION (outer_type) != 1)
+       return false;
+
       /* We don't need to preserve changes in the types minimum or
         maximum value in general as these do not generate code
         unless the types precisions are different.  */
       /* We don't need to preserve changes in the types minimum or
         maximum value in general as these do not generate code
         unless the types precisions are different.  */
@@ -1613,10 +1653,11 @@ walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data,
    changed conditionally uninitialized to unconditionally uninitialized.  */
 
 /* Emit a warning for T, an SSA_NAME, being uninitialized.  The exact
    changed conditionally uninitialized to unconditionally uninitialized.  */
 
 /* Emit a warning for T, an SSA_NAME, being uninitialized.  The exact
-   warning text is in MSGID and LOCUS may contain a location or be null.  */
+   warning text is in MSGID and LOCUS may contain a location or be null.
+   WC is the warning code.  */
 
 void
 
 void
-warn_uninit (tree t, const char *gmsgid, void *data)
+warn_uninit (enum opt_code wc, tree t, const char *gmsgid, void *data)
 {
   tree var = SSA_NAME_VAR (t);
   gimple context = (gimple) data;
 {
   tree var = SSA_NAME_VAR (t);
   gimple context = (gimple) data;
@@ -1640,7 +1681,7 @@ warn_uninit (tree t, const char *gmsgid, void *data)
             : DECL_SOURCE_LOCATION (var);
   xloc = expand_location (location);
   floc = expand_location (DECL_SOURCE_LOCATION (cfun->decl));
             : DECL_SOURCE_LOCATION (var);
   xloc = expand_location (location);
   floc = expand_location (DECL_SOURCE_LOCATION (cfun->decl));
-  if (warning_at (location, OPT_Wuninitialized, gmsgid, var))
+  if (warning_at (location, wc, gmsgid, var))
     {
       TREE_NO_WARNING (var) = 1;
 
     {
       TREE_NO_WARNING (var) = 1;
 
@@ -1722,10 +1763,12 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_)
       /* We only do data flow with SSA_NAMEs, so that's all we
         can warn about.  */
       if (data->always_executed)
       /* We only do data flow with SSA_NAMEs, so that's all we
         can warn about.  */
       if (data->always_executed)
-        warn_uninit (t, "%qD is used uninitialized in this function",
+        warn_uninit (OPT_Wuninitialized,
+                    t, "%qD is used uninitialized in this function",
                     data->stmt);
       else if (data->warn_possibly_uninitialized)
                     data->stmt);
       else if (data->warn_possibly_uninitialized)
-        warn_uninit (t, "%qD may be used uninitialized in this function",
+        warn_uninit (OPT_Wuninitialized,
+                    t, "%qD may be used uninitialized in this function",
                     data->stmt);
       *walk_subtrees = 0;
       break;
                     data->stmt);
       *walk_subtrees = 0;
       break;
@@ -1850,7 +1893,7 @@ maybe_rewrite_mem_ref_base (tree *tp)
                        TYPE_SIZE (TREE_TYPE (*tp)),
                        int_const_binop (MULT_EXPR,
                                         bitsize_int (BITS_PER_UNIT),
                        TYPE_SIZE (TREE_TYPE (*tp)),
                        int_const_binop (MULT_EXPR,
                                         bitsize_int (BITS_PER_UNIT),
-                                        TREE_OPERAND (*tp, 1), 0));
+                                        TREE_OPERAND (*tp, 1)));
        }
       else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
               && useless_type_conversion_p (TREE_TYPE (*tp),
        }
       else if (TREE_CODE (TREE_TYPE (sym)) == COMPLEX_TYPE
               && useless_type_conversion_p (TREE_TYPE (*tp),
@@ -2194,6 +2237,17 @@ execute_update_addresses_taken (void)
                  }
              }
 
                  }
              }
 
+           else if (gimple_debug_bind_p (stmt)
+                    && gimple_debug_bind_has_value_p (stmt))
+             {
+               tree *valuep = gimple_debug_bind_get_value_ptr (stmt);
+               tree decl;
+               maybe_rewrite_mem_ref_base (valuep);
+               decl = non_rewritable_mem_ref_base (*valuep);
+               if (decl && symbol_marked_for_renaming (decl))
+                 gimple_debug_bind_reset_value (stmt);
+             }
+
            if (gimple_references_memory_p (stmt)
                || is_gimple_debug (stmt))
              update_stmt (stmt);
            if (gimple_references_memory_p (stmt)
                || is_gimple_debug (stmt))
              update_stmt (stmt);