OSDN Git Service

* gcc.dg/vect/O3-vect-pr34223.c: Check vect_int_mult.
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-copyrename.c
index e06de4c..d30e237 100644 (file)
@@ -1,12 +1,12 @@
 /* Rename SSA copies.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
    Contributed by Andrew MacLeod <amacleod@redhat.com>
 
 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)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GCC is distributed in the hope that it will be useful,
@@ -15,22 +15,22 @@ MERCHANTABILITY or 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/>.  */
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
+#include "gimple.h"
 #include "flags.h"
 #include "basic-block.h"
 #include "function.h"
 #include "diagnostic.h"
 #include "bitmap.h"
 #include "tree-flow.h"
-#include "tree-gimple.h"
+#include "gimple.h"
 #include "tree-inline.h"
 #include "timevar.h"
 #include "hashtab.h"
@@ -240,7 +240,7 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
     }
 
   /* Don't coalesce if the two variables aren't type compatible.  */
-  if (!lang_hooks.types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)))
+  if (!types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)))
     {
       if (debug)
        fprintf (debug, " : Incompatible types.  No coalesce.\n");
@@ -250,8 +250,11 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
   /* Don't coalesce if the aliasing sets of the types are different.  */
   if (POINTER_TYPE_P (TREE_TYPE (root1))
       && POINTER_TYPE_P (TREE_TYPE (root2))
-      && get_alias_set (TREE_TYPE (TREE_TYPE (root1)))
-          != get_alias_set (TREE_TYPE (TREE_TYPE (root2))))
+      && ((get_alias_set (TREE_TYPE (TREE_TYPE (root1)))
+          != get_alias_set (TREE_TYPE (TREE_TYPE (root2))))
+         || ((DECL_P (root1) && !MTAG_P (root1))
+             && (DECL_P (root2) && !MTAG_P (root2))
+             && DECL_NO_TBAA_P (root1) != DECL_NO_TBAA_P (root2))))
     {
       if (debug)
        fprintf (debug, " : 2 different aliasing sets. No coalesce.\n");
@@ -298,8 +301,9 @@ rename_ssa_copies (void)
 {
   var_map map;
   basic_block bb;
-  block_stmt_iterator bsi;
-  tree phi, stmt, var, part_var;
+  gimple_stmt_iterator gsi;
+  tree var, part_var;
+  gimple stmt, phi;
   unsigned x;
   FILE *debug;
   bool updated = false;
@@ -314,16 +318,15 @@ rename_ssa_copies (void)
   FOR_EACH_BB (bb)
     {
       /* Scan for real copies.  */
-      for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
        {
-         stmt = bsi_stmt (bsi); 
-         if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
+         stmt = gsi_stmt (gsi);
+         if (gimple_assign_ssa_name_copy_p (stmt))
            {
-             tree lhs = GIMPLE_STMT_OPERAND (stmt, 0);
-             tree rhs = GIMPLE_STMT_OPERAND (stmt, 1);
+             tree lhs = gimple_assign_lhs (stmt);
+             tree rhs = gimple_assign_rhs1 (stmt);
 
-              if (TREE_CODE (lhs) == SSA_NAME && TREE_CODE (rhs) == SSA_NAME)
-               updated |= copy_rename_partition_coalesce (map, lhs, rhs, debug);
+             updated |= copy_rename_partition_coalesce (map, lhs, rhs, debug);
            }
        }
     }
@@ -331,18 +334,21 @@ rename_ssa_copies (void)
   FOR_EACH_BB (bb)
     {
       /* Treat PHI nodes as copies between the result and each argument.  */
-      for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+      for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
         {
-          int i;
-         tree res = PHI_RESULT (phi);
+          size_t i;
+         tree res;
+
+         phi = gsi_stmt (gsi);
+         res = gimple_phi_result (phi);
 
          /* Do not process virtual SSA_NAMES.  */
          if (!is_gimple_reg (SSA_NAME_VAR (res)))
            continue;
 
-          for (i = 0; i < PHI_NUM_ARGS (phi); i++)
+          for (i = 0; i < gimple_phi_num_args (phi); i++)
             {
-              tree arg = PHI_ARG_DEF (phi, i);
+              tree arg = gimple_phi_arg (phi, i)->def;
               if (TREE_CODE (arg) == SSA_NAME)
                updated |= copy_rename_partition_coalesce (map, res, arg, debug);
             }
@@ -387,8 +393,10 @@ gate_copyrename (void)
   return flag_tree_copyrename != 0;
 }
 
-struct tree_opt_pass pass_rename_ssa_copies = 
-{  
+struct gimple_opt_pass pass_rename_ssa_copies = 
+{
+ {
+  GIMPLE_PASS,
   "copyrename",                                /* name */
   gate_copyrename,                     /* gate */
   rename_ssa_copies,                   /* execute */
@@ -400,7 +408,6 @@ struct tree_opt_pass pass_rename_ssa_copies =
   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 */
+ }
 }; 
-