diff options
author | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-09 16:05:46 +0000 |
---|---|---|
committer | jamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-09 16:05:46 +0000 |
commit | 0d4911880dc3b06519afdf1ebd28b17430505a16 (patch) | |
tree | b4b8ef818a3ba89f292cf70e40875c201119ffe6 /gcc/ipa-prop.h | |
parent | 572e04f21d928aa5142ec896f9e8f7662ad088e1 (diff) | |
download | gcc-0d4911880dc3b06519afdf1ebd28b17430505a16.tar.gz |
2012-08-09 Martin Jambor <mjambor@suse.cz>
* cgraph.h (cgraph_indirect_call_info): Field anc_offse renamd to
offset, updated all users. New field agg_contents.
* ipa-prop.h (jump_func_type): Removed IPA_JF_CONST_MEMBER_PTR.
(ipa_pass_through_data): New field agg_preserved.
(ipa_ancestor_jf_data): Likewise.
(ipa_member_ptr_cst): Removed.
(ipa_agg_jf_item): New type.
(ipa_agg_jump_function): Likewise.
(ipa_jump_func): New field agg. Removed field member_cst.
(ipa_get_jf_pass_through_agg_preserved): New function.
(ipa_get_jf_ancestor_agg_preserved): Likewise.
(ipa_get_jf_member_ptr_pfn): Removed.
(ipa_find_agg_cst_for_param): Declare.
(ipa_load_from_parm_agg): Likewise.
* ipa-prop.c (param_analysis_info): Fields modified and
visited_statements rename to parm_modified and parm_visited_statements
respectively, added fields ref_modified, ref_visited_statements,
pt_modified and pt_visited_statements.
(ipa_print_node_jump_functions_for_edge): Do not dump const member
functions. Dump agg_preserved flags and aggregate jump functions.
(ipa_set_jf_simple_pass_through): Set also agg_preserved.
(ipa_set_ancestor_jf): Likewise.
(ipa_set_jf_arith_pass_through): Clear agg_preserved.
(ipa_set_jf_member_ptr_cst): Removed.
(is_parm_modified_before_stmt): Logic reversed, renamed to
parm_preserved_before_stmt_p. Cache visited bitmap only for
naked DECL parameters. All callers updated.
(load_from_unmodified_param): Allow NULL parms_ainfo.
(parm_ref_data_preserved_p): New function.
(parm_ref_data_pass_through_p): Likewise.
(ipa_load_from_parm_agg_1): Likewise.
(ipa_load_from_parm_agg): Likewise.
(compute_complex_assign_jump_func): Check if aggregate contents are
preserved.
(compute_complex_ancestor_jump_func): Likewise.
(compute_scalar_jump_functions): Removed.
(type_like_member_ptr_p): Also check field position are known and
sane.
(compute_pass_through_member_ptrs): Removed.
(determine_cst_member_ptr): Likewise.
(ipa_known_agg_contents_list): New type.
(determine_known_aggregate_parts): New function.
(compute_cst_member_ptr_arguments): Removed.
(ipa_compute_jump_functions_for_edge): Compute all kinds of jump
functions (scalar, aggregate and member pointer).
(ipa_get_member_ptr_load_param): Incorporate into
ipa_get_stmt_member_ptr_load_param, also pass back an offset.
(ipa_note_param_call): Clear agg_contents.
(ipa_analyze_indirect_call_uses): Also look for simple pointers loaded
from aggregates. In such cases, store offset of the called field.
(ipa_analyze_node): Initialize new fields of param_analysis_info.
(update_jump_functions_after_inlining): Handle aggregate contents.
(ipa_find_agg_cst_for_param): New function.
(try_make_edge_direct_simple_call): Handle called aggregate values.
(update_indirect_edges_after_inlining): Make sure aggregate preserving
jump functions comply with type compatibility requirements.
(ipa_edge_duplication_hook): Copy also aggregate jump functions.
(ipa_write_jump_function): Stream agg_preserved flags and aggregate
jump functions. Do not stream member pointer constant jump functions.
(ipa_read_jump_function): Likewise.
(ipa_write_indirect_edge_info): Stream new cgraph_indirect_call_info
fields.
(ipa_read_indirect_edge_info): Likewise.
* testsuite/gcc.dg/ipa/iinline-4.c: New test.
* testsuite/gcc.dg/ipa/iinline-5.c: Likewise.
* testsuite/gcc.dg/ipa/iinline-6.c: Likewise.
* testsuite/gcc.dg/ipa/iinline-7.c: Likewise.
* testsuite/gcc.dg/lto/20120723_0.c: Likewise.
* testsuite/gcc.dg/lto/20120723_1.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190260 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-prop.h')
-rw-r--r-- | gcc/ipa-prop.h | 83 |
1 files changed, 67 insertions, 16 deletions
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 7faa3e1eec0..489e5d859b8 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -44,10 +44,6 @@ along with GCC; see the file COPYING3. If not see argument. Unknown - neither of the above. - IPA_JF_CONST_MEMBER_PTR stands for C++ member pointers, it is a special - constant in this regard because it is in fact a structure consisting of two - values. Other constants are represented with IPA_JF_CONST. - IPA_JF_ANCESTOR is a special pass-through jump function, which means that the result is an address of a part of the object pointed to by the formal parameter to which the function refers. It is mainly intended to represent @@ -74,7 +70,6 @@ enum jump_func_type IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */ IPA_JF_KNOWN_TYPE, /* represented by field known_type */ IPA_JF_CONST, /* represented by field costant */ - IPA_JF_CONST_MEMBER_PTR, /* represented by field member_cst */ IPA_JF_PASS_THROUGH, /* represented by field pass_through */ IPA_JF_ANCESTOR /* represented by field ancestor */ }; @@ -104,6 +99,13 @@ struct GTY(()) ipa_pass_through_data arithmetic operation where the caller's parameter is the first operand and operand field from this structure is the second one. */ enum tree_code operation; + /* When the passed value is a pointer, it is set to true only when we are + certain that no write to the object it points to has occurred since the + caller functions started execution, except for changes noted in the + aggregate part of the jump function (see description of + ipa_agg_jump_function). The flag is used only when the operation is + NOP_EXPR. */ + bool agg_preserved; }; /* Structure holding data required to describe an ancestor pass-through @@ -117,21 +119,56 @@ struct GTY(()) ipa_ancestor_jf_data tree type; /* Number of the caller's formal parameter being passed. */ int formal_id; + /* Flag with the same meaning like agg_preserve in ipa_pass_through_data. */ + bool agg_preserved; }; -/* Structure holding a C++ member pointer constant. Holds a pointer to the - method and delta offset. */ -struct GTY(()) ipa_member_ptr_cst +/* An element in an aggegate part of a jump function describing a known value + at a given offset. When it is part of a pass-through jump function with + agg_preserved set or an ancestor jump function with agg_preserved set, all + unlisted positions are assumed to be preserved but the value can be a type + node, which means that the particular piece (starting at offset and having + the size of the type) is clobbered with an unknown value. When + agg_preserved is false or the type of the containing jump function is + different, all unlisted parts are assumed to be unknown and all values must + fullfill is_gimple_ip_invariant. */ + +typedef struct GTY(()) ipa_agg_jf_item +{ + /* The offset at which the known value is located within the aggregate. */ + HOST_WIDE_INT offset; + + /* The known constant or type if this is a clobber. */ + tree value; +} ipa_agg_jf_item_t; + +DEF_VEC_O (ipa_agg_jf_item_t); +DEF_VEC_ALLOC_O (ipa_agg_jf_item_t, gc); + +/* Aggregate jump function - i.e. description of contents of aggregates passed + either by reference or value. */ + +struct GTY(()) ipa_agg_jump_function { - tree pfn; - tree delta; + /* Description of the individual items. */ + VEC (ipa_agg_jf_item_t, gc) *items; + /* True if the data was passed by reference (as opposed to by value). */ + bool by_ref; }; +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); + /* A jump function for a callsite represents the values passed as actual arguments of the callsite. See enum jump_func_type for the various types of jump functions supported. */ typedef struct GTY (()) ipa_jump_func { + /* Aggregate contants description. See struct ipa_agg_jump_function and its + description. */ + struct ipa_agg_jump_function agg; + enum jump_func_type type; /* Represents a value of a jump function. pass_through is used only in jump function context. constant represents the actual constant in constant jump @@ -140,7 +177,6 @@ typedef struct GTY (()) ipa_jump_func { struct ipa_known_type_data GTY ((tag ("IPA_JF_KNOWN_TYPE"))) known_type; tree GTY ((tag ("IPA_JF_CONST"))) constant; - struct ipa_member_ptr_cst GTY ((tag ("IPA_JF_CONST_MEMBER_PTR"))) member_cst; struct ipa_pass_through_data GTY ((tag ("IPA_JF_PASS_THROUGH"))) pass_through; struct ipa_ancestor_jf_data GTY ((tag ("IPA_JF_ANCESTOR"))) ancestor; } GTY ((desc ("%1.type"))) value; @@ -214,6 +250,15 @@ ipa_get_jf_pass_through_operation (struct ipa_jump_func *jfunc) return jfunc->value.pass_through.operation; } +/* Return the agg_preserved flag of a pass through jump functin JFUNC. */ + +static inline bool +ipa_get_jf_pass_through_agg_preserved (struct ipa_jump_func *jfunc) +{ + gcc_checking_assert (jfunc->type == IPA_JF_PASS_THROUGH); + return jfunc->value.pass_through.agg_preserved; +} + /* Return the offset of an ancestor jump function JFUNC. */ static inline HOST_WIDE_INT @@ -242,13 +287,13 @@ ipa_get_jf_ancestor_formal_id (struct ipa_jump_func *jfunc) return jfunc->value.ancestor.formal_id; } -/* Return the pfn part of a member pointer constant jump function JFUNC. */ +/* Return the agg_preserved flag of an ancestor jump functin JFUNC. */ -static inline tree -ipa_get_jf_member_ptr_pfn (struct ipa_jump_func *jfunc) +static inline bool +ipa_get_jf_ancestor_agg_preserved (struct ipa_jump_func *jfunc) { - gcc_checking_assert (jfunc->type == IPA_JF_CONST_MEMBER_PTR); - return jfunc->value.member_cst.pfn; + gcc_checking_assert (jfunc->type == IPA_JF_ANCESTOR); + return jfunc->value.ancestor.agg_preserved; } /* Summary describing a single formal parameter. */ @@ -456,6 +501,12 @@ struct cgraph_edge *ipa_make_edge_direct_to_target (struct cgraph_edge *, tree); /* Functions related to both. */ void ipa_analyze_node (struct cgraph_node *); +/* Aggregate jump function related functions. */ +tree ipa_find_agg_cst_for_param (struct ipa_agg_jump_function *, HOST_WIDE_INT, + bool); +bool ipa_load_from_parm_agg (struct ipa_node_params *, gimple, tree, int *, + HOST_WIDE_INT *, bool *); + /* Debugging interface. */ void ipa_print_node_params (FILE *, struct cgraph_node *node); void ipa_print_all_params (FILE *); |