OSDN Git Service

* params.def (PARAM_INLINE_UNIT_GROWTH): Set to 30.
[pf3gnuchains/gcc-fork.git] / gcc / ipa-prop.c
index cdbf94b..55ff37c 100644 (file)
@@ -15,8 +15,8 @@ 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, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 #include "config.h"
 #include "system.h"
@@ -167,7 +167,7 @@ static inline void
 ipa_method_tree_map_create (struct cgraph_node *mt)
 {
   IPA_NODE_REF (mt)->ipa_param_tree =
-    xcalloc (ipa_method_formal_count (mt), sizeof (tree));
+    XCNEWVEC (tree, ipa_method_formal_count (mt));
 }
 
 /* Create modify structure for MT.  */
@@ -175,7 +175,7 @@ static inline void
 ipa_method_modify_create (struct cgraph_node *mt)
 {
   ((struct ipa_node *) mt->aux)->ipa_mod =
-    xcalloc (ipa_method_formal_count (mt), sizeof (bool));
+    XCNEWVEC (bool, ipa_method_formal_count (mt));
 }
 
 /* Set modify of I-th formal of MT to VAL.  */
@@ -244,15 +244,17 @@ static void
 ipa_method_modify_stmt (struct cgraph_node *mt, tree stmt)
 {
   int i, j;
+  tree parm_decl;
 
   switch (TREE_CODE (stmt))
     {
-    case MODIFY_EXPR:
-      if (TREE_CODE (TREE_OPERAND (stmt, 0)) == PARM_DECL)
+    case GIMPLE_MODIFY_STMT:
+         if (TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == PARM_DECL)
        {
-         i = ipa_method_tree_map (mt, TREE_OPERAND (stmt, 0));
+         parm_decl = GIMPLE_STMT_OPERAND (stmt, 0);
+         i = ipa_method_tree_map (mt, parm_decl);
          if (i >= 0)
-            ipa_method_modify_set (mt, i, true);
+           ipa_method_modify_set (mt, i, true);
        }
       break;
     case ASM_EXPR:
@@ -292,11 +294,15 @@ ipa_method_compute_modify (struct cgraph_node *mt)
   block_stmt_iterator bsi;
   tree stmt, parm_tree;
 
+  if (ipa_method_formal_count (mt) == 0)
+    return;
+
   ipa_method_modify_init (mt);
   decl = mt->decl;
   count = ipa_method_formal_count (mt);
   /* ??? Handle pending sizes case. Set all parameters 
      of the method to be modified.  */
+
   if (DECL_UNINLINABLE (decl))
     {
       for (j = 0; j < count; j++)
@@ -307,7 +313,8 @@ ipa_method_compute_modify (struct cgraph_node *mt)
   for (j = 0; j < count; j++)
     {
       parm_tree = ipa_method_get_tree (mt, j);
-      if (TREE_ADDRESSABLE (parm_tree))
+      if (!is_gimple_reg (parm_tree) 
+         && TREE_ADDRESSABLE (parm_tree))
        ipa_method_modify_set (mt, j, true);
     }
   body = DECL_SAVED_TREE (decl);
@@ -378,7 +385,8 @@ ipa_callsite_param_set_info_type_formal (struct cgraph_edge *cs, int i,
 /* Set int-valued INFO_TYPE1 as 'info_type' field of 
    jump function (ipa_jump_func struct) of argument I of callsite CS.  */
 static inline void
-ipa_callsite_param_set_info_type (struct cgraph_edge *cs, int i, tree info_type1)
+ipa_callsite_param_set_info_type (struct cgraph_edge *cs, int i,
+                                 tree info_type1)
 {
   ipa_callsite_param (cs, i)->info_type.value = info_type1;
 }
@@ -388,7 +396,7 @@ static inline void
 ipa_callsite_param_map_create (struct cgraph_edge *cs)
 {
   IPA_EDGE_REF (cs)->ipa_param_map =
-    xcalloc (ipa_callsite_param_count (cs), sizeof (struct ipa_jump_func));
+    XCNEWVEC (struct ipa_jump_func, ipa_callsite_param_count (cs));
 }
 
 /* Return the call expr tree related to callsite CS.  */
@@ -431,10 +439,12 @@ void
 ipa_callsite_compute_param (struct cgraph_edge *cs)
 {
   tree call_tree;
-  tree arg, cst_decl, arg_type, formal_type;
+  tree arg, cst_decl;
   int arg_num;
   int i;
   struct cgraph_node *mt;
+  tree parm_decl;
+  struct function *curr_cfun;
 
   if (ipa_callsite_param_count (cs) == 0)
     return;
@@ -449,26 +459,30 @@ ipa_callsite_compute_param (struct cgraph_edge *cs)
       /* If the formal parameter was passed as argument, we store 
          FORMAL_IPATYPE and its index in the caller as the jump function 
          of this argument.  */
-      if (TREE_CODE (TREE_VALUE (arg)) == PARM_DECL)
+      if ((TREE_CODE (TREE_VALUE (arg)) == SSA_NAME
+          && TREE_CODE (SSA_NAME_VAR (TREE_VALUE (arg))) == PARM_DECL)
+         || TREE_CODE (TREE_VALUE (arg)) == PARM_DECL)
        {
          mt = ipa_callsite_caller (cs);
-         i = ipa_method_tree_map (mt, TREE_VALUE (arg));
-         if (i < 0 || ipa_method_is_modified (mt, i))
+         parm_decl =
+           TREE_CODE (TREE_VALUE (arg)) ==
+           PARM_DECL ? TREE_VALUE (arg) : SSA_NAME_VAR (TREE_VALUE (arg));
+          
+         i = ipa_method_tree_map (mt, parm_decl);
+         if (TREE_CODE (TREE_VALUE (arg)) == SSA_NAME 
+             && IS_VALID_TREE_MAP_INDEX (i)) 
+           {
+              curr_cfun = DECL_STRUCT_FUNCTION (mt->decl);
+             if (!gimple_default_def (curr_cfun, parm_decl) 
+                 || gimple_default_def (curr_cfun, parm_decl) != TREE_VALUE (arg))
+                   ipa_method_modify_set (mt, i, true); 
+            }
+         if (!IS_VALID_TREE_MAP_INDEX (i) || ipa_method_is_modified (mt, i))
            ipa_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
          else
            {
-               arg_type = TREE_TYPE (TREE_VALUE (arg));
-               formal_type = TREE_TYPE (ipa_method_get_tree (cs->callee, arg_num));
-               if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
-                   && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type)
-                   && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
-                                            TYPE_ATTRIBUTES (formal_type)))
-                 {
-                   ipa_callsite_param_set_type (cs, arg_num, FORMAL_IPATYPE);
-                   ipa_callsite_param_set_info_type_formal (cs, arg_num, i);
-                 }
-               else
-                 ipa_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
+             ipa_callsite_param_set_type (cs, arg_num, FORMAL_IPATYPE);
+             ipa_callsite_param_set_info_type_formal (cs, arg_num, i);
            }
        }
       /* If a constant value was passed as argument, 
@@ -477,47 +491,26 @@ ipa_callsite_compute_param (struct cgraph_edge *cs)
       else if (TREE_CODE (TREE_VALUE (arg)) == INTEGER_CST
               || TREE_CODE (TREE_VALUE (arg)) == REAL_CST)
        {
-         arg_type = TREE_TYPE (TREE_VALUE (arg));
-         formal_type = TREE_TYPE (ipa_method_get_tree (cs->callee, arg_num));
-         if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
-             && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type)
-             && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
-                                      TYPE_ATTRIBUTES (formal_type)))
-           {
-             ipa_callsite_param_set_type (cs, arg_num, CONST_IPATYPE);
-             ipa_callsite_param_set_info_type (cs, arg_num, TREE_VALUE (arg));
-           }
-         else
-           ipa_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
+         ipa_callsite_param_set_type (cs, arg_num, CONST_IPATYPE);
+         ipa_callsite_param_set_info_type (cs, arg_num,
+                                           TREE_VALUE (arg));
        }
       /* This is for the case of Fortran. If the address of a const_decl 
          was passed as argument then we store 
-         CONST_IPATYPE_REF/CONST_IPATYPE_REF and the costant 
+         CONST_IPATYPE_REF/CONST_IPATYPE_REF and the constant 
          value as the jump function corresponding to this argument.  */
       else if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR
               && TREE_CODE (TREE_OPERAND (TREE_VALUE (arg), 0)) ==
               CONST_DECL)
        {
          cst_decl = TREE_OPERAND (TREE_VALUE (arg), 0);
-         arg_type = TREE_TYPE (DECL_INITIAL (cst_decl));
-         formal_type =
-           TREE_TYPE (TREE_TYPE (ipa_method_get_tree (cs->callee, arg_num)));
          if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST
              || TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST)
            {
-             if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
-                 && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type)
-                 && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
-                                          TYPE_ATTRIBUTES (formal_type)))
-
-               {
-                 ipa_callsite_param_set_type (cs, arg_num,
-                                              CONST_IPATYPE_REF);
-                 ipa_callsite_param_set_info_type (cs, arg_num, DECL_INITIAL (cst_decl));
-
-               }
-             else
-               ipa_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
+             ipa_callsite_param_set_type (cs, arg_num,
+                                          CONST_IPATYPE_REF);
+             ipa_callsite_param_set_info_type (cs, arg_num,
+                                               DECL_INITIAL (cst_decl));
            }
        }
       else