OSDN Git Service

2009-05-10 Paul Thomas <pault@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-sink.c
index e56cce0..d0c550d 100644 (file)
@@ -1,5 +1,6 @@
 /* Code sinking for trees
-   Copyright (C) 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004, 2007, 2008, 2009
+   Free Software Foundation, Inc.
    Contributed by Daniel Berlin <dan@dberlin.org>
 
 This file is part of GCC.
@@ -139,7 +140,7 @@ is_hidden_global_store (gimple stmt)
   /* Check virtual definitions.  If we get here, the only virtual
      definitions we should see are those generated by assignment or call
      statements.  */
-  if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_VIRTUAL_DEFS))
+  if (gimple_vdef (stmt))
     {
       tree lhs;
 
@@ -190,7 +191,7 @@ is_hidden_global_store (gimple stmt)
 
        }
       else if (INDIRECT_REF_P (lhs))
-       return may_point_to_global_var (TREE_OPERAND (lhs, 0));
+       return ptr_deref_may_alias_global_p (TREE_OPERAND (lhs, 0));
       else
        gcc_unreachable ();
     }
@@ -301,7 +302,12 @@ statement_sink_location (gimple stmt, basic_block frombb,
      We can't sink statements that have volatile operands.  
 
      We don't want to sink dead code, so anything with 0 immediate uses is not
-     sunk.  
+     sunk.
+
+     Don't sink BLKmode assignments if current function has any local explicit
+     register variables, as BLKmode assignments may involve memcpy or memset
+     calls or, on some targets, inline expansion thereof that sometimes need
+     to use specific hard registers.
 
   */
   code = gimple_assign_rhs_code (stmt);
@@ -311,7 +317,9 @@ statement_sink_location (gimple stmt, basic_block frombb,
       || code == FILTER_EXPR
       || is_hidden_global_store (stmt)
       || gimple_has_volatile_ops (stmt)
-      || !ZERO_SSA_OPERANDS (stmt, SSA_OP_VUSE))
+      || gimple_vuse (stmt)
+      || (cfun->has_local_explicit_reg_vars
+         && TYPE_MODE (TREE_TYPE (gimple_assign_lhs (stmt))) == BLKmode))
     return false;
   
   FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_ALL_DEFS)