]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-inline.h (estimate_move_cost): Add speed_p parameter.
authorRichard Biener <rguenther@suse.de>
Thu, 24 Jul 2014 08:08:26 +0000 (08:08 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 24 Jul 2014 08:08:26 +0000 (08:08 +0000)
2014-07-24  Richard Biener  <rguenther@suse.de>

* tree-inline.h (estimate_move_cost): Add speed_p parameter.
* tree-inline.c (estimate_move_cost): Add speed_p parameter
and adjust MOVE_RATIO query accordingly.
(estimate_num_insns): Adjust callers.
* ipa-prop.c (ipa_populate_param_decls): Likewise.
* ipa-cp.c (gather_context_independent_values,
estimate_local_effects): Likewise.
* ipa-split.c (consider_split): Likewise.

From-SVN: r212970

gcc/ChangeLog
gcc/ipa-cp.c
gcc/ipa-prop.c
gcc/ipa-split.c
gcc/tree-inline.c
gcc/tree-inline.h

index e5651660cbb67719d166b0e872a568a2b1adc249..b9542459c9dc91f47f790f882e4747fd6b89a2cd 100644 (file)
@@ -1,3 +1,14 @@
+2014-07-24  Richard Biener  <rguenther@suse.de>
+
+       * tree-inline.h (estimate_move_cost): Add speed_p parameter.
+       * tree-inline.c (estimate_move_cost): Add speed_p parameter
+       and adjust MOVE_RATIO query accordingly.
+       (estimate_num_insns): Adjust callers.
+       * ipa-prop.c (ipa_populate_param_decls): Likewise.
+       * ipa-cp.c (gather_context_independent_values,
+       estimate_local_effects): Likewise.
+       * ipa-split.c (consider_split): Likewise.
+
 2014-07-24  Trevor Saunders  <tsaunders@mozilla.com>
 
        * config/i386/driver-i386.c: Remove names of unused arguments and
index 224b03aa3b595ecfc973e0e66c0cbf0a3139e5d4..9039000745622aecb4b97a94f06a481cccb54199 100644 (file)
@@ -1845,7 +1845,7 @@ gather_context_independent_values (struct ipa_node_params *info,
              (*known_csts)[i] = val->value;
              if (removable_params_cost)
                *removable_params_cost
-                 += estimate_move_cost (TREE_TYPE (val->value));
+                 += estimate_move_cost (TREE_TYPE (val->value), false);
              ret = true;
            }
          else if (plats->virt_call)
@@ -1997,7 +1997,7 @@ estimate_local_effects (struct cgraph_node *node)
            {
              known_csts[i] = val->value;
              known_binfos[i] = NULL_TREE;
-             emc = estimate_move_cost (TREE_TYPE (val->value));
+             emc = estimate_move_cost (TREE_TYPE (val->value), true);
            }
          else if (plats->virt_call)
            {
index 40f696bf960999e4c314c4b1a7ecb144790cb4df..f457b1291e080479f0b3553384f94130ce799bb3 100644 (file)
@@ -204,7 +204,8 @@ ipa_populate_param_decls (struct cgraph_node *node,
   for (parm = fnargs; parm; parm = DECL_CHAIN (parm))
     {
       descriptors[param_num].decl = parm;
-      descriptors[param_num].move_cost = estimate_move_cost (TREE_TYPE (parm));
+      descriptors[param_num].move_cost = estimate_move_cost (TREE_TYPE (parm),
+                                                            true);
       param_num++;
     }
 }
index 0a30b3fe0aa36e0e01bc80431b873d43aa10986c..cba0309262aac06a1059b60c1e7e26a0f6b69e49 100644 (file)
@@ -488,13 +488,14 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
                               SSA_NAME_VERSION (ddef)))
            {
              if (!VOID_TYPE_P (TREE_TYPE (parm)))
-               call_overhead += estimate_move_cost (TREE_TYPE (parm));
+               call_overhead += estimate_move_cost (TREE_TYPE (parm), false);
              num_args++;
            }
        }
     }
   if (!VOID_TYPE_P (TREE_TYPE (current_function_decl)))
-    call_overhead += estimate_move_cost (TREE_TYPE (current_function_decl));
+    call_overhead += estimate_move_cost (TREE_TYPE (current_function_decl),
+                                        false);
 
   if (current->split_size <= call_overhead)
     {
index 20e2aced25710fd917238e05d1343ba8f610cc1a..c5fab40089229bf71942a9def5855085fa0d960f 100644 (file)
@@ -3623,11 +3623,12 @@ tree_inlinable_function_p (tree fn)
   return inlinable;
 }
 
-/* Estimate the cost of a memory move.  Use machine dependent
-   word size and take possible memcpy call into account.  */
+/* Estimate the cost of a memory move of type TYPE.  Use machine dependent
+   word size and take possible memcpy call into account and return
+   cost based on whether optimizing for size or speed according to SPEED_P.  */
 
 int
-estimate_move_cost (tree type)
+estimate_move_cost (tree type, bool speed_p)
 {
   HOST_WIDE_INT size;
 
@@ -3645,7 +3646,7 @@ estimate_move_cost (tree type)
 
   size = int_size_in_bytes (type);
 
-  if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (!optimize_size))
+  if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (speed_p))
     /* Cost of a memcpy call, 3 arguments and the call.  */
     return 4;
   else
@@ -3847,9 +3848,9 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
 
       /* Account for the cost of moving to / from memory.  */
       if (gimple_store_p (stmt))
-       cost += estimate_move_cost (TREE_TYPE (lhs));
+       cost += estimate_move_cost (TREE_TYPE (lhs), weights->time_based);
       if (gimple_assign_load_p (stmt))
-       cost += estimate_move_cost (TREE_TYPE (rhs));
+       cost += estimate_move_cost (TREE_TYPE (rhs), weights->time_based);
 
       cost += estimate_operator_cost (gimple_assign_rhs_code (stmt), weights,
                                      gimple_assign_rhs1 (stmt),
@@ -3923,11 +3924,13 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
 
        cost = decl ? weights->call_cost : weights->indirect_call_cost;
        if (gimple_call_lhs (stmt))
-         cost += estimate_move_cost (TREE_TYPE (gimple_call_lhs (stmt)));
+         cost += estimate_move_cost (TREE_TYPE (gimple_call_lhs (stmt)),
+                                     weights->time_based);
        for (i = 0; i < gimple_call_num_args (stmt); i++)
          {
            tree arg = gimple_call_arg (stmt, i);
-           cost += estimate_move_cost (TREE_TYPE (arg));
+           cost += estimate_move_cost (TREE_TYPE (arg),
+                                       weights->time_based);
          }
        break;
       }
index 13c551666ddf940ac1c412fe26b00ecb0eabf0e4..2a5daaf7f61920586e6c13f5e044fee6ef62a2f2 100644 (file)
@@ -191,7 +191,7 @@ tree maybe_inline_call_in_expr (tree);
 bool tree_inlinable_function_p (tree);
 tree copy_tree_r (tree *, int *, void *);
 tree copy_decl_no_change (tree decl, copy_body_data *id);
-int estimate_move_cost (tree type);
+int estimate_move_cost (tree type, bool);
 int estimate_num_insns (gimple, eni_weights *);
 int estimate_num_insns_fn (tree, eni_weights *);
 int count_insns_seq (gimple_seq, eni_weights *);