diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-07 15:55:54 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-07 15:55:54 +0000 |
commit | 803a79880a31323c22b59b221452aa7a5459b42d (patch) | |
tree | d2ea663c799050adc33578f7fb54862612fec7a3 /gcc/ipa-prop.h | |
parent | 654dee1e93e67f45c234744374ebc7db19e53275 (diff) | |
download | gcc-803a79880a31323c22b59b221452aa7a5459b42d.tar.gz |
2012-11-07 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/53787
* ipa-cp.c (ipcp_value_source): New field offset.
(ipcp_agg_lattice): New type.
(ipcp_param_lattices): Likewise, move virt_call from ipcp_lattice here.
(ipcp_agg_lattice_pool): New variable.
(ipa_get_parm_lattices): New function.
(ipa_get_lattice): Turned into ipa_get_scalar_lat, use the above.
Adjusted all callers.
(print_lattice): New function.
(print_all_lattices): Use the above, also print aggregate lattices.
(set_agg_lats_to_bottom): New function.
(set_agg_lats_contain_variable): Likewise.
(set_all_contains_variable): Likewise.
(initialize_node_lattices): Also handle aggregate lattices, set
virt_call in ipcp_param_lattices.
(add_value_source): Handle offsets.
(add_value_to_lattice): Likewise.
(add_scalar_value_to_lattice): New function.
(propagate_vals_accross_pass_through): Use add_scalar_value_to_lattice.
(propagate_vals_accross_ancestor): Likewise.
(propagate_accross_jump_function): Renamed to
propagate_scalar_accross_jump_function, use
add_scalar_value_to_lattice.
(set_check_aggs_by_ref): New function.
(merge_agg_lats_step): Likewise.
(set_chain_of_aglats_contains_variable): Likewise.
(merge_aggregate_lattices): Likewise.
(propagate_constants_accross_call): Also handle aggregate lattices.
(hint_time_bonus): New function.
(context_independent_aggregate_values): Likewise.
(gather_context_independent_values): Also handle agggregate values.
(agg_jmp_p_vec_for_t_vec): New function.
(estimate_local_effects): Also handle agggregate values.
(add_all_node_vals_to_toposort): Likewise.
(ipcp_propagate_stage): Use struct ipcp_param_lattices.
(get_clone_agg_value): New function.
(cgraph_edge_brings_value_p): Also handle agggregate values.
(create_specialized_node): Likewise.
(find_more_values_for_callers_subset): Rename to
find_more_scalar_values_for_callers_subset. Modify dump.
(copy_plats_to_inter): New function.
(intersect_with_plats): Likewise.
(agg_replacements_to_vector): Likewise.
(intersect_with_agg_replacements): Likewise.
(find_aggregate_values_for_callers_subset): Likewise.
(known_aggs_to_agg_replacement_list): Likewise.
(cgraph_edge_brings_all_scalars_for_node): Likewise.
(cgraph_edge_brings_all_agg_vals_for_node): Likewise.
(perhaps_add_new_callers): Old functionality moved to
cgraph_edge_brings_all_scalars_for_node, call it and
cgraph_edge_brings_all_agg_vals_for_node.
(ipcp_val_in_agg_replacements_p): New function.
(decide_about_value): New function.
(decide_whether_version_node): A lot of functionality moved to
decide_about_value. Also handle agggregate values.
(ipcp_driver): Also allocate ipcp_agg_lattice_pool.
(pass_ipa_cp): Fill in new entries.
* ipa-prop.c (ipa_node_agg_replacements): New variable.
(free_parms_ainfo): New function.
(ipa_analyze_node): Use free_parms_ainfo to free stuff.
(ipa_find_agg_cst_for_param): Do not rely on offset ordering.
(ipa_set_node_agg_value_chain): New function.
(ipa_node_removal_hook): Also handle ipa_node_agg_replacements.
(ipa_node_duplication_hook): Likewise.
(ipa_free_all_structures_after_ipa_cp): Also free ipcp_agg_lattice_pool.
(ipa_free_all_structures_after_iinln): Likewise.
(ipa_dump_agg_replacement_values): New function.
(write_agg_replacement_chain): Likewise.
(read_agg_replacement_chain): Likewise.
(ipa_prop_write_all_agg_replacement): Likewise.
(read_replacements_section): Likewise.
(ipa_prop_read_all_agg_replacement): Likewise.
(adjust_agg_replacement_values): Likewise.
(ipcp_transform_function): Likewise.
* ipa-prop.h: Also define heap vector of ipa_agg_jf_item_t and of
ipa_agg_jump_function_t.
(ipa_node_params): Make lattices an array of ipcp_param_lattices.
(ipa_agg_replacement_value): New type and its vector.
(ipa_set_node_agg_value_chain) Declare.
(ipa_node_agg_replacements): Likewise.
(ipa_get_agg_replacements_for_node): New function.
(ipcp_agg_lattice_pool): Declare.
(ipa_dump_agg_replacement_values): Likewise.
(ipa_prop_write_all_agg_replacement): Likewise.
(ipa_prop_read_all_agg_replacement): Likewise.
(ipcp_transform_function): Likewise.
* ipa-inline-analysis.c (estimate_ipcp_clone_size_and_time): Pass around
known aggregates and hints.
* ipa-inline.h: include ipa-prop.h.
(estimate_ipcp_clone_size_and_time): Adjust declaration.
* lto-streamer.h (lto_section_type): New item
LTO_section_ipcp_transform.
* lto-section-in.c (lto_section_name): New element ipcp_trans.
* params.def (PARAM_IPA_CP_LOOP_HINT_BONUS): New parameter.
* Makefile.in (IPA_INLINE_H): New. Use everywhee instead of
ipa-inline.h.
* testsuite/gcc.dg/ipa/ipa-5.c: Adjust.
* testsuite/gcc.dg/ipa/ipcp-agg-1.c: New test.
* testsuite/gcc.dg/ipa/ipcp-agg-2.c: Likewise.
* testsuite/gcc.dg/ipa/ipcp-agg-3.c: Likewise.
* testsuite/gcc.dg/ipa/ipcp-agg-4.c: Likewise.
* testsuite/gcc.dg/ipa/ipcp-agg-5.c: Likewise.
* testsuite/gcc.dg/ipa/ipcp-agg-6.c: Likewise.
* testsuite/gfortran.dg/pr48636.f90: Add -fno-ipa-cp.
* testsuite/gfortran.dg/pr48636-2.f90: New test.
* testsuite/gfortran.dg/pr53787.f90: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-prop.h')
-rw-r--r-- | gcc/ipa-prop.h | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 1fdd8333f01..da6200fbaa4 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -144,6 +144,7 @@ typedef struct GTY(()) ipa_agg_jf_item DEF_VEC_O (ipa_agg_jf_item_t); DEF_VEC_ALLOC_O (ipa_agg_jf_item_t, gc); +DEF_VEC_ALLOC_O (ipa_agg_jf_item_t, heap); /* Aggregate jump function - i.e. description of contents of aggregates passed either by reference or value. */ @@ -159,6 +160,9 @@ struct GTY(()) ipa_agg_jump_function typedef struct ipa_agg_jump_function *ipa_agg_jump_function_p; DEF_VEC_P (ipa_agg_jump_function_p); DEF_VEC_ALLOC_P (ipa_agg_jump_function_p, heap); +typedef struct ipa_agg_jump_function ipa_agg_jump_function_t; +DEF_VEC_P (ipa_agg_jump_function_t); +DEF_VEC_ALLOC_P (ipa_agg_jump_function_t, heap); /* A jump function for a callsite represents the values passed as actual arguments of the callsite. See enum jump_func_type for the various @@ -322,7 +326,7 @@ struct ipa_node_params VEC (ipa_param_descriptor_t, heap) *descriptors; /* Pointer to an array of structures describing individual formal parameters. */ - struct ipcp_lattice *lattices; + struct ipcp_param_lattices *lattices; /* Only for versioned nodes this field would not be NULL, it points to the node that IPA cp cloned from. */ struct cgraph_node *ipcp_orig_node; @@ -380,6 +384,27 @@ ipa_is_param_used (struct ipa_node_params *info, int i) return VEC_index (ipa_param_descriptor_t, info->descriptors, i).used; } +/* Information about replacements done in aggregates for a given node (each + node has its linked list). */ +struct GTY(()) ipa_agg_replacement_value +{ + /* Next item in the linked list. */ + struct ipa_agg_replacement_value *next; + /* Offset within the aggregate. */ + HOST_WIDE_INT offset; + /* The constant value. */ + tree value; + /* The paramter index. */ + int index; +}; + +typedef struct ipa_agg_replacement_value *ipa_agg_replacement_value_p; +DEF_VEC_P (ipa_agg_replacement_value_p); +DEF_VEC_ALLOC_P (ipa_agg_replacement_value_p, gc); + +void ipa_set_node_agg_value_chain (struct cgraph_node *node, + struct ipa_agg_replacement_value *aggvals); + /* ipa_edge_args stores information related to a callsite and particularly its arguments. It can be accessed by the IPA_EDGE_REF macro. */ typedef struct GTY(()) ipa_edge_args @@ -420,6 +445,8 @@ DEF_VEC_ALLOC_O (ipa_edge_args_t, gc); /* Vector where the parameter infos are actually stored. */ extern VEC (ipa_node_params_t, heap) *ipa_node_params_vector; +/* Vector of known aggregate values in cloned nodes. */ +extern GTY(()) VEC (ipa_agg_replacement_value_p, gc) *ipa_node_agg_replacements; /* Vector where the parameter infos are actually stored. */ extern GTY(()) VEC (ipa_edge_args_t, gc) *ipa_edge_args_vector; @@ -487,6 +514,18 @@ ipa_edge_args_info_available_for_edge_p (struct cgraph_edge *edge) ipa_edge_args_vector)); } +/* Return the aggregate replacements for NODE, if there are any. */ + +static inline struct ipa_agg_replacement_value * +ipa_get_agg_replacements_for_node (struct cgraph_node *node) +{ + if ((unsigned) node->uid >= VEC_length (ipa_agg_replacement_value_p, + ipa_node_agg_replacements)) + return NULL; + return VEC_index (ipa_agg_replacement_value_p, ipa_node_agg_replacements, + node->uid); +} + /* Function formal parameters related computations. */ void ipa_initialize_node_params (struct cgraph_node *node); bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs, @@ -517,6 +556,7 @@ void ipcp_verify_propagated_values (void); extern alloc_pool ipcp_values_pool; extern alloc_pool ipcp_sources_pool; +extern alloc_pool ipcp_agg_lattice_pool; /* Structure to describe transformations of formal parameters and actual arguments. Each instance describes one new parameter and they are meant to @@ -589,13 +629,17 @@ void ipa_modify_call_arguments (struct cgraph_edge *, gimple, ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec, ipa_parm_adjustment_vec); void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree); - +void ipa_dump_agg_replacement_values (FILE *f, + struct ipa_agg_replacement_value *av); void ipa_prop_write_jump_functions (void); void ipa_prop_read_jump_functions (void); +void ipa_prop_write_all_agg_replacement (void); +void ipa_prop_read_all_agg_replacement (void); void ipa_update_after_lto_read (void); int ipa_get_param_decl_index (struct ipa_node_params *, tree); tree ipa_value_from_jfunc (struct ipa_node_params *info, struct ipa_jump_func *jfunc); +unsigned int ipcp_transform_function (struct cgraph_node *node); /* From tree-sra.c: */ |