diff options
author | Jan Hubicka <jh@suse.cz> | 2013-08-03 10:23:55 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-08-03 08:23:55 +0000 |
commit | 0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4 (patch) | |
tree | 6893c12531b17830080c226b0ab4329896a5a588 /gcc/ipa-prop.c | |
parent | 563430f7f3c7d4c2358dd2acaf33258d7f0b0c57 (diff) | |
download | gcc-0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4.zip gcc-0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4.tar.gz gcc-0e8853eefb91d4a81bb45eb25db4dd95dc2cf1c4.tar.bz2 |
ipa-cp.c (gather_context_independent_values): Use ipa_get_param_move_cost.
* ipa-cp.c (gather_context_independent_values): Use ipa_get_param_move_cost.
(get_replacement_map): Remove PARAM; move parameter folding into tree-inline.c
(create_specialized_node): Update.
* ipa-prop.c (ipa_populate_param_decls): Do not look for origins;
assert that we have gimple body; update move_cost.
(count_formal_params): Assert that we have gimple body.
(ipa_dump_param): New function.
(ipa_alloc_node_params): Break out from ...
(ipa_initialize_node_params): ... here.
(ipa_get_vector_of_formal_parms): ICE when used in WPA.
(ipa_write_node_info): Stream move costs.
(ipa_read_node_info): Read move costs.
(ipa_update_after_lto_read): Do not recompute node params.
* ipa-prop.h (ipa_param_descriptor): Add move_cost.
(ipa_get_param): Check we are not in WPA.
(ipa_get_param_move_cost): New.
* tree-inline.c (tree_function_versioning): Fold replacement as needed.
* ipa-inline-analysis.c (inline_node_duplication_hook): Expect only
parm numbers to be present.
* gcc.dg/ipa/ipa-1.c: Update.
* gcc.dg/ipa/ipa-2.c: Update.
* gcc.dg/ipa/ipa-3.c: Update.
* gcc.dg/ipa/ipa-4.c: Update.
* gcc.dg/ipa/ipa-5.c: Update.
* gcc.dg/ipa/ipa-7.c: Update.
* gcc.dg/ipa/ipa-8.c: Update.
* gcc.dg/ipa/ipcp-1.c: Update.
* gcc.dg/ipa/ipcp-2.c: Update.
From-SVN: r201462
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 59 |
1 files changed, 40 insertions, 19 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index bf9e903..ef4dff7 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -130,16 +130,14 @@ ipa_populate_param_decls (struct cgraph_node *node, tree parm; int param_num; - /* We do not copy DECL_ARGUMENTS to virtual clones. */ - while (node->clone_of) - node = node->clone_of; - fndecl = node->symbol.decl; + gcc_assert (gimple_has_body_p (fndecl)); fnargs = DECL_ARGUMENTS (fndecl); param_num = 0; for (parm = fnargs; parm; parm = DECL_CHAIN (parm)) { descriptors[param_num].decl = parm; + descriptors[param_num].move_cost = estimate_move_cost (TREE_TYPE (parm)); param_num++; } } @@ -151,6 +149,7 @@ count_formal_params (tree fndecl) { tree parm; int count = 0; + gcc_assert (gimple_has_body_p (fndecl)); for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) count++; @@ -158,6 +157,33 @@ count_formal_params (tree fndecl) return count; } +/* Return the declaration of Ith formal parameter of the function corresponding + to INFO. Note there is no setter function as this array is built just once + using ipa_initialize_node_params. */ + +void +ipa_dump_param (FILE *file, struct ipa_node_params *info, int i) +{ + fprintf (file, "param #%i", i); + if (info->descriptors[i].decl) + { + fprintf (file, " "); + print_generic_expr (file, info->descriptors[i].decl, 0); + } +} + +/* Initialize the ipa_node_params structure associated with NODE + to hold PARAM_COUNT parameters. */ + +void +ipa_alloc_node_params (struct cgraph_node *node, int param_count) +{ + struct ipa_node_params *info = IPA_NODE_REF (node); + + if (!info->descriptors.exists () && param_count) + info->descriptors.safe_grow_cleared (param_count); +} + /* Initialize the ipa_node_params structure associated with NODE by counting the function parameters, creating the descriptors and populating their param_decls. */ @@ -169,15 +195,8 @@ ipa_initialize_node_params (struct cgraph_node *node) if (!info->descriptors.exists ()) { - int param_count; - gcc_assert (!node->clone_of); - - param_count = count_formal_params (node->symbol.decl); - if (param_count) - { - info->descriptors.safe_grow_cleared (param_count); - ipa_populate_param_decls (node, info->descriptors); - } + ipa_alloc_node_params (node, count_formal_params (node->symbol.decl)); + ipa_populate_param_decls (node, info->descriptors); } } @@ -3064,6 +3083,7 @@ ipa_get_vector_of_formal_parms (tree fndecl) int count; tree parm; + gcc_assert (!flag_wpa); count = count_formal_params (fndecl); args.create (count); for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) @@ -3856,6 +3876,9 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node) node_ref = lto_symtab_encoder_encode (encoder, (symtab_node) node); streamer_write_uhwi (ob, node_ref); + streamer_write_uhwi (ob, ipa_get_param_count (info)); + for (j = 0; j < ipa_get_param_count (info); j++) + streamer_write_uhwi (ob, ipa_get_param_move_cost (info, j)); bp = bitpack_create (ob->main_stream); gcc_assert (info->uses_analysis_done || ipa_get_param_count (info) == 0); @@ -3896,8 +3919,11 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node, struct cgraph_edge *e; struct bitpack_d bp; - ipa_initialize_node_params (node); + ipa_alloc_node_params (node, streamer_read_uhwi (ib)); + for (k = 0; k < ipa_get_param_count (info); k++) + info->descriptors[k].move_cost = streamer_read_uhwi (ib); + bp = streamer_read_bitpack (ib); if (ipa_get_param_count (info) != 0) info->uses_analysis_done = true; @@ -4049,13 +4075,8 @@ ipa_prop_read_jump_functions (void) void ipa_update_after_lto_read (void) { - struct cgraph_node *node; - ipa_check_create_node_params (); ipa_check_create_edge_args (); - - FOR_EACH_DEFINED_FUNCTION (node) - ipa_initialize_node_params (node); } void |