GCC Middle and Back End API Reference
ipa-prop.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "ssa.h"
#include "tree-streamer.h"
#include "cgraph.h"
#include "diagnostic.h"
#include "fold-const.h"
#include "gimple-iterator.h"
#include "gimple-fold.h"
#include "tree-eh.h"
#include "calls.h"
#include "stor-layout.h"
#include "print-tree.h"
#include "gimplify.h"
#include "gimplify-me.h"
#include "gimple-walk.h"
#include "symbol-summary.h"
#include "sreal.h"
#include "ipa-cp.h"
#include "ipa-prop.h"
#include "tree-cfg.h"
#include "tree-dfa.h"
#include "tree-inline.h"
#include "ipa-fnsummary.h"
#include "gimple-pretty-print.h"
#include "ipa-utils.h"
#include "dbgcnt.h"
#include "domwalk.h"
#include "builtins.h"
#include "tree-cfgcleanup.h"
#include "options.h"
#include "symtab-clones.h"
#include "attr-fnspec.h"
#include "gimple-range.h"
#include "value-range-storage.h"
#include "gt-ipa-prop.h"
Include dependency graph for ipa-prop.cc:

Data Structures

struct  ipa_vr_ggc_hash_traits
 
struct  ipa_cst_ref_desc
 
struct  ipa_return_value_summary
 
class  ipa_return_value_sum_t
 
struct  prop_type_change_info
 
struct  ipa_known_agg_contents_list
 
class  analysis_dom_walker
 
class  ipcp_modif_dom_walker
 

Functions

void gt_pch_nx (ipa_vr *&x)
 
void gt_ggc_mx (ipa_vr *&x)
 
static bool ipa_func_spec_opts_forbid_analysis_p (struct cgraph_node *node)
 
static int ipa_get_param_decl_index_1 (vec< ipa_param_descriptor, va_gc > *descriptors, tree ptree)
 
int ipa_get_param_decl_index (class ipa_node_params *info, tree ptree)
 
static void ipa_populate_param_decls (struct cgraph_node *node, vec< ipa_param_descriptor, va_gc > &descriptors)
 
int count_formal_params (tree fndecl)
 
void ipa_dump_param (FILE *file, class ipa_node_params *info, int i)
 
static bool ipa_alloc_node_params (struct cgraph_node *node, int param_count)
 
void ipa_initialize_node_params (struct cgraph_node *node)
 
static void ipa_print_constant_value (FILE *f, tree val)
 
static void ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
 
void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node)
 
void ipa_print_all_jump_functions (FILE *f)
 
static void ipa_set_jf_unknown (struct ipa_jump_func *jfunc)
 
static void ipa_set_jf_cst_copy (struct ipa_jump_func *dst, struct ipa_jump_func *src)
 
static void ipa_set_jf_constant (struct ipa_jump_func *jfunc, tree constant, struct cgraph_edge *cs)
 
static void ipa_set_jf_simple_pass_through (struct ipa_jump_func *jfunc, int formal_id, bool agg_preserved)
 
static void ipa_set_jf_unary_pass_through (struct ipa_jump_func *jfunc, int formal_id, enum tree_code operation)
 
static void ipa_set_jf_arith_pass_through (struct ipa_jump_func *jfunc, int formal_id, tree operand, enum tree_code operation)
 
static void ipa_set_ancestor_jf (struct ipa_jump_func *jfunc, HOST_WIDE_INT offset, int formal_id, bool agg_preserved, bool keep_null)
 
static struct ipa_bb_infoipa_get_bb_info (struct ipa_func_body_info *fbi, basic_block bb)
 
static bool stmt_may_be_vtbl_ptr_store (gimple *stmt)
 
static bool check_stmt_for_type_change (ao_ref *ao, tree vdef, void *data)
 
static bool param_type_may_change_p (tree function, tree arg, gimple *call)
 
static bool detect_type_change_from_memory_writes (ipa_func_body_info *fbi, tree arg, tree base, tree comp_type, gcall *call, HOST_WIDE_INT offset)
 
static bool detect_type_change (ipa_func_body_info *fbi, tree arg, tree base, tree comp_type, gcall *call, HOST_WIDE_INT offset)
 
static bool detect_type_change_ssa (ipa_func_body_info *fbi, tree arg, tree comp_type, gcall *call)
 
static bool mark_modified (ao_ref *ao, tree vdef, void *data)
 
static struct ipa_param_aa_statusfind_dominating_aa_status (struct ipa_func_body_info *fbi, basic_block bb, int index)
 
static struct ipa_param_aa_statusparm_bb_aa_status_for_bb (struct ipa_func_body_info *fbi, basic_block bb, int index)
 
static bool parm_preserved_before_stmt_p (struct ipa_func_body_info *fbi, int index, gimple *stmt, tree parm_load)
 
static int load_from_unmodified_param (struct ipa_func_body_info *fbi, vec< ipa_param_descriptor, va_gc > *descriptors, gimple *stmt)
 
static bool parm_ref_data_preserved_p (struct ipa_func_body_info *fbi, int index, gimple *stmt, tree ref)
 
static bool parm_ref_data_pass_through_p (struct ipa_func_body_info *fbi, int index, gimple *call, tree parm)
 
bool ipa_load_from_parm_agg (struct ipa_func_body_info *fbi, vec< ipa_param_descriptor, va_gc > *descriptors, gimple *stmt, tree op, int *index_p, HOST_WIDE_INT *offset_p, poly_int64 *size_p, bool *by_ref_p, bool *guaranteed_unmodified)
 
static int load_from_unmodified_param_or_agg (struct ipa_func_body_info *fbi, class ipa_node_params *info, gimple *stmt, HOST_WIDE_INT *offset_p, bool *by_ref_p)
 
bool unadjusted_ptr_and_unit_offset (tree op, tree *ret, poly_int64 *offset_ret)
 
static void compute_complex_assign_jump_func (struct ipa_func_body_info *fbi, class ipa_node_params *info, struct ipa_jump_func *jfunc, gcall *call, gimple *stmt, tree name, tree param_type)
 
static tree get_ancestor_addr_info (gimple *assign, tree *obj_p, HOST_WIDE_INT *offset)
 
static void compute_complex_ancestor_jump_func (struct ipa_func_body_info *fbi, class ipa_node_params *info, struct ipa_jump_func *jfunc, gcall *call, gphi *phi)
 
static bool type_like_member_ptr_p (tree type, tree *method_ptr, tree *delta)
 
static tree get_ssa_def_if_simple_copy (tree rhs, gimple **rhs_stmt)
 
static void add_to_agg_contents_list (struct ipa_known_agg_contents_list **plist, struct ipa_known_agg_contents_list *item)
 
static bool clobber_by_agg_contents_list_p (struct ipa_known_agg_contents_list *list, struct ipa_known_agg_contents_list *item)
 
static void build_agg_jump_func_from_list (struct ipa_known_agg_contents_list *list, int value_count, HOST_WIDE_INT arg_offset, struct ipa_jump_func *jfunc)
 
static void analyze_agg_content_value (struct ipa_func_body_info *fbi, struct ipa_load_agg_data *agg_value, gimple *stmt)
 
static bool extract_mem_content (struct ipa_func_body_info *fbi, gimple *stmt, tree base, bool check_ref, struct ipa_known_agg_contents_list *content)
 
static void determine_known_aggregate_parts (struct ipa_func_body_info *fbi, gcall *call, tree arg, tree arg_type, struct ipa_jump_func *jfunc)
 
tree ipa_get_callee_param_type (struct cgraph_edge *e, int i)
 
static ipa_vripa_get_value_range (const vrange &tmp)
 
static void ipa_set_jfunc_vr (ipa_jump_func *jf, const vrange &tmp)
 
static void ipa_set_jfunc_vr (ipa_jump_func *jf, const ipa_vr &vr)
 
static void ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi, struct cgraph_edge *cs)
 
static void ipa_compute_jump_functions_for_bb (struct ipa_func_body_info *fbi, basic_block bb)
 
static tree ipa_get_stmt_member_ptr_load_param (gimple *stmt, bool use_delta, HOST_WIDE_INT *offset_p)
 
static bool ipa_is_ssa_with_stmt_def (tree t)
 
static struct cgraph_edgeipa_note_param_call (struct cgraph_node *node, int param_index, gcall *stmt, bool polymorphic)
 
static void ipa_analyze_indirect_call_uses (struct ipa_func_body_info *fbi, gcall *call, tree target)
 
static void ipa_analyze_virtual_call_uses (struct ipa_func_body_info *fbi, gcall *call, tree target)
 
static void ipa_analyze_call_uses (struct ipa_func_body_info *fbi, gcall *call)
 
static void ipa_analyze_stmt_uses (struct ipa_func_body_info *fbi, gimple *stmt)
 
static bool visit_ref_for_mod_analysis (gimple *, tree op, tree, void *data)
 
static void ipa_analyze_params_uses_in_bb (struct ipa_func_body_info *fbi, basic_block bb)
 
static bool load_from_dereferenced_name (tree expr, tree name)
 
static void ipa_analyze_controlled_uses (struct cgraph_node *node)
 
static void free_ipa_bb_info (struct ipa_bb_info *bi)
 
void ipa_release_body_info (struct ipa_func_body_info *fbi)
 
void ipa_analyze_node (struct cgraph_node *node)
 
static void update_jump_functions_after_inlining (struct cgraph_edge *cs, struct cgraph_edge *e)
 
struct cgraph_edgeipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target, bool speculative)
 
static tree find_constructor_constant_at_offset (tree constructor, HOST_WIDE_INT req_offset)
 
tree ipa_find_agg_cst_from_init (tree scalar, HOST_WIDE_INT offset, bool by_ref)
 
static tree ipa_find_agg_cst_from_jfunc_items (struct ipa_agg_jump_function *agg_jfunc, ipa_node_params *src_info, cgraph_node *src_node, HOST_WIDE_INT offset, bool by_ref)
 
static bool remove_described_reference (symtab_node *symbol, struct ipa_cst_ref_desc *rdesc)
 
static struct ipa_cst_ref_descjfunc_rdesc_usable (struct ipa_jump_func *jfunc)
 
static symtab_nodesymtab_node_for_jfunc (struct ipa_jump_func *jfunc)
 
static bool try_decrement_rdesc_refcount (struct ipa_jump_func *jfunc)
 
static struct cgraph_edgetry_make_edge_direct_simple_call (struct cgraph_edge *ie, struct ipa_jump_func *jfunc, tree target_type, struct cgraph_node *new_root, class ipa_node_params *new_root_info)
 
tree ipa_impossible_devirt_target (struct cgraph_edge *ie, tree target)
 
static struct cgraph_edgetry_make_edge_direct_virtual_call (struct cgraph_edge *ie, struct ipa_jump_func *jfunc, class ipa_polymorphic_call_context ctx, struct cgraph_node *new_root, class ipa_node_params *new_root_info)
 
static bool update_indirect_edges_after_inlining (struct cgraph_edge *cs, struct cgraph_node *node, vec< cgraph_edge * > *new_edges)
 
static bool propagate_info_to_inlined_callees (struct cgraph_edge *cs, struct cgraph_node *node, vec< cgraph_edge * > *new_edges)
 
static int combine_controlled_uses_counters (int c, int d)
 
static void propagate_controlled_uses (struct cgraph_edge *cs)
 
bool ipa_propagate_indirect_call_infos (struct cgraph_edge *cs, vec< cgraph_edge * > *new_edges)
 
void ipa_check_create_edge_args (void)
 
void ipa_free_all_edge_args (void)
 
void ipa_free_all_node_params (void)
 
void ipcp_transformation_initialize (void)
 
void ipcp_free_transformation_sum (void)
 
void ipa_set_node_agg_value_chain (struct cgraph_node *node, vec< ipa_argagg_value, va_gc > *aggs)
 
static void ipa_add_new_function (cgraph_node *node, void *data)
 
void ipa_register_cgraph_hooks (void)
 
static void ipa_unregister_cgraph_hooks (void)
 
void ipa_free_all_structures_after_ipa_cp (void)
 
void ipa_free_all_structures_after_iinln (void)
 
void ipa_print_node_params (FILE *f, struct cgraph_node *node)
 
void ipa_print_all_params (FILE *f)
 
static void ipa_write_jump_function (struct output_block *ob, struct ipa_jump_func *jump_func)
 
static void ipa_read_jump_function (class lto_input_block *ib, struct ipa_jump_func *jump_func, struct cgraph_edge *cs, class data_in *data_in, bool prevails)
 
static void ipa_write_indirect_edge_info (struct output_block *ob, struct cgraph_edge *cs)
 
static void ipa_read_indirect_edge_info (class lto_input_block *ib, class data_in *data_in, struct cgraph_edge *cs, class ipa_node_params *info)
 
static void ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
 
static void ipa_read_edge_info (class lto_input_block *ib, class data_in *data_in, struct cgraph_edge *e, bool prevails)
 
static void ipa_read_node_info (class lto_input_block *ib, struct cgraph_node *node, class data_in *data_in)
 
void ipa_prop_write_jump_functions (void)
 
static void ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data, size_t len)
 
void ipa_prop_read_jump_functions (void)
 
static bool useful_ipcp_transformation_info_p (ipcp_transformation *ts)
 
void write_ipcp_transformation_info (output_block *ob, cgraph_node *node, ipcp_transformation *ts)
 
static void read_ipcp_transformation_info (lto_input_block *ib, cgraph_node *node, data_in *data_in)
 
void ipcp_write_transformation_summaries (void)
 
static void read_replacements_section (struct lto_file_decl_data *file_data, const char *data, size_t len)
 
void ipcp_read_transformation_summaries (void)
 
static void adjust_agg_replacement_values (cgraph_node *node, ipcp_transformation *ts)
 
tree ipcp_get_aggregate_const (struct function *func, tree parm, bool by_ref, HOST_WIDE_INT bit_offset, HOST_WIDE_INT bit_size)
 
bool ipcp_get_parm_bits (tree parm, tree *value, widest_int *mask)
 
static void ipcp_update_vr (struct cgraph_node *node, ipcp_transformation *ts)
 
unsigned int ipcp_transform_function (struct cgraph_node *node)
 
void ipa_record_return_value_range (Value_Range val)
 
bool ipa_return_value_range (Value_Range &range, tree decl)
 
void ipa_prop_cc_finalize (void)
 
static bool ipa_agg_pass_through_jf_equivalent_p (ipa_pass_through_data *ipt1, ipa_pass_through_data *ipt2, bool agg_jf)
 
static bool ipa_agg_jump_functions_equivalent_p (ipa_agg_jf_item *ajf1, ipa_agg_jf_item *ajf2)
 
bool ipa_jump_functions_equivalent_p (ipa_jump_func *jf1, ipa_jump_func *jf2)
 

Variables

ipa_node_params_tipa_node_params_sum = NULL
 
function_summary< ipcp_transformation * > * ipcp_transformation_sum = NULL
 
ipa_edge_args_sum_tipa_edge_args_sum
 
static hash_table< ipa_vr_ggc_hash_traits > * ipa_vr_hash_table
 
static struct cgraph_node_hook_listfunction_insertion_hook_holder
 
static object_allocator< ipa_cst_ref_descipa_refdesc_pool ("IPA-PROP ref descriptions")
 
static function_summary< ipa_return_value_summary * > * ipa_return_value_sum
 

Function Documentation

◆ add_to_agg_contents_list()

static void add_to_agg_contents_list ( struct ipa_known_agg_contents_list ** plist,
struct ipa_known_agg_contents_list * item )
inlinestatic
Add an aggregate content item into a linked list of
ipa_known_agg_contents_list structure, in which all elements
are sorted ascendingly by offset.   

References ipa_known_agg_contents_list::next, and ipa_known_agg_contents_list::offset.

Referenced by determine_known_aggregate_parts().

◆ adjust_agg_replacement_values()

static void adjust_agg_replacement_values ( cgraph_node * node,
ipcp_transformation * ts )
static
Adjust the aggregate replacements in TS to reflect any parameter removals
which might have already taken place.  If after adjustments there are no
aggregate replacements left, the m_agg_values will be set to NULL.  In other
cases, it may be shrunk.   

References count, gcc_checking_assert, clone_info::get(), ipa_param_adjustments::get_updated_indices(), ggc_alloc(), ggc_free(), i, ipa_argagg_value::index, NULL, and clone_info::param_adjustments.

Referenced by ipcp_transform_function().

◆ analyze_agg_content_value()

static void analyze_agg_content_value ( struct ipa_func_body_info * fbi,
struct ipa_load_agg_data * agg_value,
gimple * stmt )
static
Given an assignment statement STMT, try to collect information into
AGG_VALUE that will be used to construct jump function for RHS of the
assignment, from which content value of an aggregate part comes.

Besides constant and simple pass-through jump functions, also try to
identify whether it matches the following pattern that can be described by
a load-value-from-aggregate jump function, which is a derivative of simple
pass-through jump function.

  foo (int *p)
  {
    ...

    *(q_5 + 4) = *(p_3(D) + 28) op 1;
    bar (q_5);
  }

Here IPA_LOAD_AGG_DATA data structure is informative enough to describe
constant, simple pass-through and load-vale-from-aggregate. If value
is constant, it will be kept in field OPERAND, and field FORMAL_ID is
set to -1. For simple pass-through and load-value-from-aggregate, field
FORMAL_ID specifies the related formal parameter index, and field
OFFSET can be used to distinguish them, -1 means simple pass-through,
otherwise means load-value-from-aggregate.   

References AGGREGATE_TYPE_P, commutative_tree_code(), contains_bitfld_component_ref_p(), CONVERT_EXPR_CODE_P, get_ssa_def_if_simple_copy(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_class(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, gimple_phi_arg_def(), gimple_phi_num_args(), GIMPLE_SINGLE_RHS, GIMPLE_UNARY_RHS, ipa_get_param_decl_index(), is_gimple_assign(), is_gimple_ip_invariant(), load_from_unmodified_param_or_agg(), NULL_TREE, SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, swap_tree_comparison(), tcc_comparison, tcc_unary, TREE_CODE, TREE_CODE_CLASS, TREE_THIS_VOLATILE, TREE_TYPE, and useless_type_conversion_p().

Referenced by extract_mem_content().

◆ build_agg_jump_func_from_list()

◆ check_stmt_for_type_change()

static bool check_stmt_for_type_change ( ao_ref * ao,
tree vdef,
void * data )
static
Callback of walk_aliased_vdefs and a helper function for detect_type_change
to check whether a particular statement may modify the virtual table
pointerIt stores its result into DATA, which points to a
prop_type_change_info structure.   

References ggc_alloc(), SSA_NAME_DEF_STMT, and stmt_may_be_vtbl_ptr_store().

Referenced by detect_type_change_from_memory_writes().

◆ clobber_by_agg_contents_list_p()

static bool clobber_by_agg_contents_list_p ( struct ipa_known_agg_contents_list * list,
struct ipa_known_agg_contents_list * item )
inlinestatic
Check whether a given aggregate content is clobbered by certain element in
a linked list of ipa_known_agg_contents_list.   

References ipa_known_agg_contents_list::next, ipa_known_agg_contents_list::offset, and ipa_known_agg_contents_list::size.

Referenced by determine_known_aggregate_parts().

◆ combine_controlled_uses_counters()

static int combine_controlled_uses_counters ( int c,
int d )
static
Combine two controlled uses counts as done during inlining.   

References IPA_UNDESCRIBED_USE.

Referenced by propagate_controlled_uses().

◆ compute_complex_ancestor_jump_func()

static void compute_complex_ancestor_jump_func ( struct ipa_func_body_info * fbi,
class ipa_node_params * info,
struct ipa_jump_func * jfunc,
gcall * call,
gphi * phi )
static
Given that an actual argument is an SSA_NAME that is a result of a phi
statement PHI, try to find out whether NAME is in fact a
multiple-inheritance typecast from a descendant into an ancestor of a formal
parameter and thus can be described by an ancestor jump function and if so,
write the appropriate function into JFUNC.

Essentially we want to match the following pattern:

  if (obj_2(D) != 0B)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  iftmp.1_3 = &obj_2(D)->D.1762;

<bb 4>:
  # iftmp.1_1 = PHI <iftmp.1_3(3), 0B(2)>
  D.1879_6 = middleman_1 (iftmp.1_1, i_5(D));
  return D.1879_6;   

References EDGE_PRED, expr, get_ancestor_addr_info(), ggc_alloc(), gimple_bb(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_phi_num_args(), gsi_last_bb(), i, integer_zerop(), ipa_get_param_decl_index(), ipa_set_ancestor_jf(), offset, parm_ref_data_pass_through_p(), PHI_ARG_DEF, POINTER_TYPE_P, single_pred(), single_pred_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, TREE_OPERAND, and TREE_TYPE.

Referenced by ipa_compute_jump_functions_for_edge().

◆ compute_complex_assign_jump_func()

static void compute_complex_assign_jump_func ( struct ipa_func_body_info * fbi,
class ipa_node_params * info,
struct ipa_jump_func * jfunc,
gcall * call,
gimple * stmt,
tree name,
tree param_type )
static
Given that an actual argument is an SSA_NAME (given in NAME) and is a result
of an assignment statement STMT, try to determine whether we are actually
handling any of the following cases and construct an appropriate jump
function into JFUNC if so:

1) The passed value is loaded from a formal parameter which is not a gimple
register (most probably because it is addressable, the value has to be
scalar) and we can guarantee the value has not changed.  This case can
therefore be described by a simple pass-through jump function.  For example:

   foo (int a)
   {
     int a.0;

     a.0_2 = a;
     bar (a.0_2);

2) The passed value can be described by a simple arithmetic pass-through
jump function. E.g.

   foo (int a)
   {
     int D.2064;

     D.2064_4 = a.1(D) + 4;
     bar (D.2064_4);

This case can also occur in combination of the previous one, e.g.:

   foo (int a, int z)
   {
     int a.0;
     int D.2064;

     a.0_3 = a;
     D.2064_4 = a.0_3 + 4;
     foo (D.2064_4);

3) The passed value is an address of an object within another one (which
also passed by reference).  Such situations are described by an ancestor
jump function and describe situations such as:

  B::foo() (struct B * const this)
  {
    struct A * D.1845;

    D.1845_2 = &this_1(D)->D.1748;
    A::bar (D.1845_2);

INFO is the structure describing individual parameters access different
stages of IPA optimizations.  PARMS_AINFO contains the information that is
only needed for intraprocedural analysis.   

References CONVERT_EXPR_CODE_P, ipa_node_params::descriptors, get_ref_base_and_extent_hwi(), ggc_alloc(), gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_class(), gimple_assign_rhs_code(), GIMPLE_BINARY_RHS, GIMPLE_SINGLE_RHS, GIMPLE_UNARY_RHS, ipa_get_param_decl_index(), ipa_set_ancestor_jf(), ipa_set_jf_arith_pass_through(), ipa_set_jf_simple_pass_through(), ipa_set_jf_unary_pass_through(), is_gimple_ip_invariant(), load_from_unmodified_param(), mem_ref_offset(), offset, parm_ref_data_pass_through_p(), POINTER_TYPE_P, SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, tcc_comparison, TREE_CODE, TREE_CODE_CLASS, TREE_OPERAND, TREE_TYPE, and useless_type_conversion_p().

Referenced by ipa_compute_jump_functions_for_edge().

◆ count_formal_params()

◆ detect_type_change()

static bool detect_type_change ( ipa_func_body_info * fbi,
tree arg,
tree base,
tree comp_type,
gcall * call,
HOST_WIDE_INT offset )
static
Detect whether the dynamic type of ARG of COMP_TYPE may have changed.
If it is, return true.  ARG is the object itself (not a pointer
to it, unless dereferenced).  BASE is the base of the memory access as
returned by get_ref_base_and_extent, as is the offset.   

References current_function_decl, detect_type_change_from_memory_writes(), ggc_alloc(), offset, param_type_may_change_p(), TREE_CODE, and TREE_OPERAND.

Referenced by ipa_analyze_virtual_call_uses().

◆ detect_type_change_from_memory_writes()

static bool detect_type_change_from_memory_writes ( ipa_func_body_info * fbi,
tree arg,
tree base,
tree comp_type,
gcall * call,
HOST_WIDE_INT offset )
static
Detect whether the dynamic type of ARG of COMP_TYPE has changed (before
callsite CALL) by looking for assignments to its virtual table pointer.  If
it is, return true.  ARG is the object itself (not a pointer
to it, unless dereferenced).  BASE is the base of the memory access as
returned by get_ref_base_and_extent, as is the offset. 

This is helper function for detect_type_change and detect_type_change_ssa
that does the heavy work which is usually unnecesary.   

References ao_ref_init(), BINFO_VTABLE, check_stmt_for_type_change(), DECL_P, gcc_checking_assert, get_base_address(), ggc_alloc(), gimple_vuse(), handled_component_p(), NULL, offset, POINTER_SIZE, TREE_CODE, TYPE_BINFO, TYPE_MAIN_VARIANT, and walk_aliased_vdefs().

Referenced by detect_type_change(), and detect_type_change_ssa().

◆ detect_type_change_ssa()

static bool detect_type_change_ssa ( ipa_func_body_info * fbi,
tree arg,
tree comp_type,
gcall * call )
static
Like detect_type_change but ARG is supposed to be a non-dereferenced pointer
SSA name (its dereference will become the base and the offset is assumed to
be zero).   

References build2(), build_int_cst(), current_function_decl, detect_type_change_from_memory_writes(), gcc_checking_assert, ggc_alloc(), param_type_may_change_p(), POINTER_TYPE_P, ptr_type_node, TREE_CODE, and TREE_TYPE.

Referenced by ipa_analyze_virtual_call_uses().

◆ determine_known_aggregate_parts()

static void determine_known_aggregate_parts ( struct ipa_func_body_info * fbi,
gcall * call,
tree arg,
tree arg_type,
struct ipa_jump_func * jfunc )
static
Traverse statements from CALL backwards, scanning whether an aggregate given
in ARG is filled in constants or values that are derived from caller's
formal parameter in the way described by some kinds of jump functions.  FBI
is the context of the caller function for interprocedural analysis.  ARG can
either be an aggregate expression or a pointer to an aggregate.  ARG_TYPE is
the type of the aggregate, JFUNC is the jump function for the aggregate.   

References add_to_agg_contents_list(), AGGREGATE_TYPE_P, ao_ref_init(), ao_ref_init_from_ptr_and_size(), arg_type, BITMAP_FREE, build_agg_jump_func_from_list(), clobber_by_agg_contents_list_p(), DECL_P, extract_mem_content(), gcc_checking_assert, get_continuation_for_phi(), get_ref_base_and_extent_hwi(), ggc_alloc(), gimple_vuse(), NULL, NULL_TREE, opt_for_fn, POINTER_TYPE_P, r, SSA_NAME_DEF_STMT, stmt_may_clobber_ref_p_1(), TREE_CODE, tree_fits_uhwi_p(), TREE_OPERAND, tree_to_uhwi(), TREE_TYPE, TYPE_SIZE, UINT_MAX, and visited.

Referenced by ipa_compute_jump_functions_for_edge().

◆ extract_mem_content()

static bool extract_mem_content ( struct ipa_func_body_info * fbi,
gimple * stmt,
tree base,
bool check_ref,
struct ipa_known_agg_contents_list * content )
static
If STMT is a memory store to the object whose address is BASE, extract
information (offset, size, and value) into CONTENT, and return true,
otherwise we conservatively assume the whole object is modified with
unknown content, and return false.  CHECK_REF means that access to object
is expected to be in form of MEM_REF expression.   

References analyze_agg_content_value(), get_ref_base_and_extent_hwi(), ggc_alloc(), gimple_assign_lhs(), integer_zerop(), is_gimple_assign(), NULL, TREE_CODE, TREE_OPERAND, and TREE_TYPE.

Referenced by determine_known_aggregate_parts().

◆ find_constructor_constant_at_offset()

static tree find_constructor_constant_at_offset ( tree constructor,
HOST_WIDE_INT req_offset )
static

◆ find_dominating_aa_status()

static struct ipa_param_aa_status * find_dominating_aa_status ( struct ipa_func_body_info * fbi,
basic_block bb,
int index )
static
Find the nearest valid aa status for parameter specified by INDEX that
dominates BB.   

References CDI_DOMINATORS, get_immediate_dominator(), ggc_alloc(), ipa_get_bb_info(), NULL, and ipa_bb_info::param_aa_statuses.

Referenced by parm_bb_aa_status_for_bb().

◆ free_ipa_bb_info()

static void free_ipa_bb_info ( struct ipa_bb_info * bi)
static

◆ get_ancestor_addr_info()

static tree get_ancestor_addr_info ( gimple * assign,
tree * obj_p,
HOST_WIDE_INT * offset )
static
Extract the base, offset and MEM_REF expression from a statement ASSIGN if
it looks like:

iftmp.1_3 = &obj_2(D)->D.1762;

The base of the MEM_REF must be a default definition SSA NAME of a
parameter.  Return NULL_TREE if it looks otherwise.  If case of success, the
whole MEM_REF expression is returned and the offset calculated from any
handled components and the MEM_REF itself is stored into *OFFSET.  The whole
RHS stripped off the ADDR_EXPR is stored into *OBJ_P.   

References expr, get_ref_base_and_extent_hwi(), ggc_alloc(), gimple_assign_rhs1(), gimple_assign_single_p(), mem_ref_offset(), NULL_TREE, offset, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, and TREE_OPERAND.

Referenced by compute_complex_ancestor_jump_func(), and ipa_analyze_virtual_call_uses().

◆ get_ssa_def_if_simple_copy()

static tree get_ssa_def_if_simple_copy ( tree rhs,
gimple ** rhs_stmt )
inlinestatic
If RHS is an SSA_NAME and it is defined by a simple copy assign statement,
return the rhs of its defining statement, and this statement is stored in
*RHS_STMT.  Otherwise return RHS as it is.   

References ggc_alloc(), gimple_assign_rhs1(), gimple_assign_single_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, and TREE_CODE.

Referenced by analyze_agg_content_value().

◆ gt_ggc_mx()

void gt_ggc_mx ( ipa_vr *& x)

References gt_ggc_mx().

Referenced by gt_ggc_mx().

◆ gt_pch_nx()

void gt_pch_nx ( ipa_vr *& x)

References gt_pch_nx().

Referenced by gt_pch_nx().

◆ ipa_add_new_function()

static void ipa_add_new_function ( cgraph_node * node,
void * data )
static
Analyze newly added function into callgraph.   

References cgraph_node::has_gimple_body_p(), and ipa_analyze_node().

Referenced by ipa_register_cgraph_hooks().

◆ ipa_agg_jump_functions_equivalent_p()

static bool ipa_agg_jump_functions_equivalent_p ( ipa_agg_jf_item * ajf1,
ipa_agg_jf_item * ajf2 )
static
Return true if the two aggregate jump functions are known to be equivalent.
The function can be used before the IPA phase of IPA-CP or inlining because
it cannot cope with refdesc changes these passes can carry out.   

References gcc_unreachable, ggc_alloc(), ipa_agg_pass_through_jf_equivalent_p(), IPA_JF_CONST, IPA_JF_LOAD_AGG, IPA_JF_PASS_THROUGH, types_compatible_p(), and values_equal_for_ipcp_p().

Referenced by ipa_jump_functions_equivalent_p().

◆ ipa_agg_pass_through_jf_equivalent_p()

static bool ipa_agg_pass_through_jf_equivalent_p ( ipa_pass_through_data * ipt1,
ipa_pass_through_data * ipt2,
bool agg_jf )
static
Return true if the two pass_through components of two jump functions are
known to be equivalent.  AGG_JF denotes whether they are part of aggregate
functions or not.  The function can be used before the IPA phase of IPA-CP
or inlining because it cannot cope with refdesc changes these passes can
carry out.   

References gcc_assert, ggc_alloc(), NULL_TREE, and values_equal_for_ipcp_p().

Referenced by ipa_agg_jump_functions_equivalent_p(), and ipa_jump_functions_equivalent_p().

◆ ipa_alloc_node_params()

static bool ipa_alloc_node_params ( struct cgraph_node * node,
int param_count )
static
If necessary, allocate vector of parameter descriptors in info of NODE.
Return true if they were allocated, false if not.   

References ipa_node_params::descriptors, ipa_node_params_sum, and vec_safe_grow_cleared().

Referenced by ipa_initialize_node_params(), and ipa_read_node_info().

◆ ipa_analyze_call_uses()

◆ ipa_analyze_controlled_uses()

◆ ipa_analyze_indirect_call_uses()

static void ipa_analyze_indirect_call_uses ( struct ipa_func_body_info * fbi,
gcall * call,
tree target )
static
Analyze the CALL and examine uses of formal parameters of the caller NODE
(described by INFO).  PARMS_AINFO is a pointer to a vector containing
intermediate information about each formal parameter.  Currently it checks
whether the call calls a pointer that is a formal parameter and if so, the
parameter is marked with the called flag and an indirect call graph edge
describing the call is created.  This is very simple for ordinary pointers
represented in SSA but not-so-nice when it comes to member pointers.  The
ugly part of this function does nothing more than trying to match the
pattern of such a call.  Look up the documentation of macro
TARGET_PTRMEMFUNC_VBIT_LOCATION for details.  An example of such a pattern
is the gimple dump below, the call is on the last line:

  <bb 2>:
    f$__delta_5 = f.__delta;
    f$__pfn_24 = f.__pfn;

or
  <bb 2>:
    f$__delta_5 = MEM[(struct  *)&f];
    f$__pfn_24 = MEM[(struct  *)&f + 4B];

and a few lines below:

  <bb 5>
    D.2496_3 = (int) f$__pfn_24;
    D.2497_4 = D.2496_3 & 1;
    if (D.2497_4 != 0)
      goto <bb 3>;
    else
      goto <bb 4>;

  <bb 6>:
    D.2500_7 = (unsigned int) f$__delta_5;
    D.2501_8 = &S + D.2500_7;
    D.2502_9 = (int (*__vtbl_ptr_type) (void) * *) D.2501_8;
    D.2503_10 = *D.2502_9;
    D.2504_12 = f$__pfn_24 + -1;
    D.2505_13 = (unsigned int) D.2504_12;
    D.2506_14 = D.2503_10 + D.2505_13;
    D.2507_15 = *D.2506_14;
    iftmp.11_16 = (String:: *) D.2507_15;

  <bb 7>:
    # iftmp.11_1 = PHI <iftmp.11_16(3), f$__pfn_24(2)>
    D.2500_19 = (unsigned int) f$__delta_5;
    D.2508_20 = &S + D.2500_19;
    D.2493_21 = iftmp.11_1 (D.2508_20, 4);

Such patterns are results of simple calls to a member pointer:

  int doprinting (int (MyString::* f)(int) const)
  {
    MyString S ("somestring");

    return (S.*f)(4);
  }

Moreover, the function also looks for called pointers loaded from aggregates
passed by value or reference.   

References cgraph_indirect_call_info::agg_contents, cgraph_indirect_call_info::by_ref, CONVERT_EXPR_CODE_P, d1, d2, ipa_node_params::descriptors, EDGE_PRED, ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_bb(), gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_phi_num_args(), gsi_last_bb(), cgraph_indirect_call_info::guaranteed_unmodified, cgraph_edge::indirect_info, integer_onep(), integer_zerop(), ipa_get_param_decl_index(), ipa_get_stmt_member_ptr_load_param(), ipa_is_ssa_with_stmt_def(), ipa_load_from_parm_agg(), ipa_note_param_call(), is_gimple_assign(), cgraph_indirect_call_info::member_ptr, NULL, cgraph_indirect_call_info::offset, offset, parm_preserved_before_stmt_p(), parm_ref_data_preserved_p(), PHI_ARG_DEF, POINTER_TYPE_P, ptrmemfunc_vbit_in_delta, single_pred(), single_pred_p(), single_succ(), single_succ_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TARGET_PTRMEMFUNC_VBIT_LOCATION, TREE_CODE, and TREE_TYPE.

Referenced by ipa_analyze_call_uses().

◆ ipa_analyze_node()

◆ ipa_analyze_params_uses_in_bb()

static void ipa_analyze_params_uses_in_bb ( struct ipa_func_body_info * fbi,
basic_block bb )
static
Scan the statements in BB and inspect the uses of formal parameters.  Store
the findings in various structures of the associated ipa_node_params
structure, such as parameter flags, notes etc.  FBI holds various data about
the function being analyzed.   

References ggc_alloc(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), ipa_analyze_stmt_uses(), is_gimple_debug(), visit_ref_for_mod_analysis(), and walk_stmt_load_store_addr_ops().

Referenced by analysis_dom_walker::before_dom_children().

◆ ipa_analyze_stmt_uses()

static void ipa_analyze_stmt_uses ( struct ipa_func_body_info * fbi,
gimple * stmt )
static
Analyze the call statement STMT with respect to formal parameters (described
in INFO) of caller given by FBI->NODE.  Currently it only checks whether
formal parameters are called.   

References ggc_alloc(), ipa_analyze_call_uses(), and is_gimple_call().

Referenced by ipa_analyze_params_uses_in_bb().

◆ ipa_analyze_virtual_call_uses()

static void ipa_analyze_virtual_call_uses ( struct ipa_func_body_info * fbi,
gcall * call,
tree target )
static
Analyze a CALL to an OBJ_TYPE_REF which is passed in TARGET and if the
object referenced in the expression is a formal parameter of the caller
FBI->node (described by FBI->info), create a call note for the
statement.   

References detect_type_change(), detect_type_change_ssa(), expr, gcc_assert, get_ancestor_addr_info(), ggc_alloc(), cgraph_edge::indirect_info, ipa_get_param_decl_index(), ipa_note_param_call(), obj_type_ref_class(), OBJ_TYPE_REF_OBJECT, OBJ_TYPE_REF_TOKEN, SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, TREE_OPERAND, and tree_to_uhwi().

Referenced by ipa_analyze_call_uses().

◆ ipa_check_create_edge_args()

void ipa_check_create_edge_args ( void )
Ensure that array of edge arguments infos is big enough to accommodate a
structure for all edges and reallocates it if not.  Also, allocate
associated hash tables is they do not already exist.   

References hash_table< Descriptor, Lazy, Allocator >::create_ggc(), ggc_alloc(), ipa_edge_args_sum, ipa_vr_hash_table, and symtab.

Referenced by ipa_analyze_node(), ipa_prop_read_jump_functions(), ipa_register_cgraph_hooks(), ipcp_driver(), and update_indirect_edges_after_inlining().

◆ ipa_compute_jump_functions_for_bb()

◆ ipa_compute_jump_functions_for_edge()

static void ipa_compute_jump_functions_for_edge ( struct ipa_func_body_info * fbi,
struct cgraph_edge * cs )
static
Compute jump function for all arguments of callsite CS and insert the
information in the jump_functions array in the ipa_edge_args corresponding
to this callsite.   

References AGGREGATE_TYPE_P, wi::bit_and_not(), cgraph_edge::call_stmt, cgraph_edge::caller, cfun, compute_complex_ancestor_jump_func(), compute_complex_assign_jump_func(), symtab_node::decl, determine_known_aggregate_parts(), wide_int_storage::from(), gcc_assert, ipa_polymorphic_call_context::get_dynamic_type(), get_pointer_alignment_1(), get_range_query(), ggc_alloc(), gimple_call_arg(), gimple_call_internal_p(), gimple_call_num_args(), ipa_edge_args_sum, ipa_func_spec_opts_forbid_analysis_p(), ipa_get_callee_param_type(), ipa_get_ith_jump_func(), ipa_get_ith_polymorhic_call_context(), ipa_get_jf_ancestor_agg_preserved(), ipa_get_jf_pass_through_agg_preserved(), ipa_get_param_decl_index(), IPA_JF_ANCESTOR, IPA_JF_PASS_THROUGH, ipa_node_params_sum, ipa_set_jf_constant(), ipa_set_jf_simple_pass_through(), ipa_set_jfunc_vr(), ipa_supports_p(), is_gimple_assign(), is_gimple_ip_invariant(), is_gimple_reg_type(), is_global_var(), wi::mask(), Value_Range::nonzero_p(), NULL, opt_for_fn, parm_preserved_before_stmt_p(), parm_ref_data_pass_through_p(), POINTER_TYPE_P, range_cast(), Value_Range::set_nonzero(), Value_Range::set_varying(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, TREE_READONLY, tree_single_nonzero_warnv_p(), TREE_TYPE, TYPE_PRECISION, Value_Range::undefined_p(), UNSIGNED, Value_Range::update_bitmask(), ipa_polymorphic_call_context::useless_p(), VAR_P, vec_free(), and vec_safe_grow_cleared().

Referenced by ipa_compute_jump_functions_for_bb().

◆ ipa_dump_param()

void ipa_dump_param ( FILE * file,
class ipa_node_params * info,
int i )
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.  

References ipa_node_params::descriptors, ggc_alloc(), i, and print_generic_expr().

Referenced by decide_about_value(), estimate_local_effects(), find_more_contexts_for_caller_subset(), find_more_scalar_values_for_callers_subset(), get_replacement_map(), and ipa_print_node_params().

◆ ipa_find_agg_cst_from_init()

tree ipa_find_agg_cst_from_init ( tree scalar,
HOST_WIDE_INT offset,
bool by_ref )
Check whether SCALAR could be used to look up an aggregate interprocedural
invariant from a static constructor and if so, return it.  Otherwise return
NULL.  

References DECL_INITIAL, find_constructor_constant_at_offset(), ggc_alloc(), is_global_var(), NULL, offset, TREE_CODE, TREE_OPERAND, TREE_READONLY, and VAR_P.

Referenced by evaluate_conditions_for_known_args(), ipa_get_indirect_edge_target_1(), try_make_edge_direct_simple_call(), and try_make_edge_direct_virtual_call().

◆ ipa_find_agg_cst_from_jfunc_items()

static tree ipa_find_agg_cst_from_jfunc_items ( struct ipa_agg_jump_function * agg_jfunc,
ipa_node_params * src_info,
cgraph_node * src_node,
HOST_WIDE_INT offset,
bool by_ref )
static
Retrieve value from AGG_JFUNC for the given OFFSET or return NULL if there
is none.  BY_REF specifies whether the value has to be passed by reference
or by value.   

References ggc_alloc(), ipa_agg_value_from_jfunc(), NULL_TREE, and offset.

Referenced by try_make_edge_direct_simple_call(), and try_make_edge_direct_virtual_call().

◆ ipa_free_all_edge_args()

void ipa_free_all_edge_args ( void )
Free all ipa_edge structures.   

References ggc_delete(), ipa_edge_args_sum, and NULL.

Referenced by ipa_free_all_structures_after_iinln(), and ipa_free_all_structures_after_ipa_cp().

◆ ipa_free_all_node_params()

void ipa_free_all_node_params ( void )

◆ ipa_free_all_structures_after_iinln()

void ipa_free_all_structures_after_iinln ( void )
Free all ipa_node_params and all ipa_edge_args structures if they are no
longer needed after indirect inlining.   

References ipa_free_all_edge_args(), ipa_free_all_node_params(), ipa_refdesc_pool, ipa_unregister_cgraph_hooks(), ipcp_agg_lattice_pool, ipcp_cst_values_pool, ipcp_poly_ctx_values_pool, and ipcp_sources_pool.

◆ ipa_free_all_structures_after_ipa_cp()

void ipa_free_all_structures_after_ipa_cp ( void )
Free all ipa_node_params and all ipa_edge_args structures if they are no
longer needed after ipa-cp.   

References ggc_alloc(), ipa_free_all_edge_args(), ipa_free_all_node_params(), ipa_refdesc_pool, ipa_unregister_cgraph_hooks(), ipcp_agg_lattice_pool, ipcp_cst_values_pool, ipcp_poly_ctx_values_pool, and ipcp_sources_pool.

Referenced by ipcp_driver().

◆ ipa_func_spec_opts_forbid_analysis_p()

static bool ipa_func_spec_opts_forbid_analysis_p ( struct cgraph_node * node)
static
Return true if DECL_FUNCTION_SPECIFIC_OPTIMIZATION of the decl associated
with NODE should prevent us from analyzing it for the purposes of IPA-CP.   

References DECL_FUNCTION_SPECIFIC_OPTIMIZATION, ggc_alloc(), and opt_for_fn.

Referenced by ipa_analyze_node(), and ipa_compute_jump_functions_for_edge().

◆ ipa_get_bb_info()

static struct ipa_bb_info * ipa_get_bb_info ( struct ipa_func_body_info * fbi,
basic_block bb )
static
Get IPA BB information about the given BB.  FBI is the context of analyzis
of this function body.   

References gcc_checking_assert, ggc_alloc(), and basic_block_def::index.

Referenced by find_dominating_aa_status(), ipa_analyze_node(), ipa_compute_jump_functions_for_bb(), and parm_bb_aa_status_for_bb().

◆ ipa_get_callee_param_type()

tree ipa_get_callee_param_type ( struct cgraph_edge * e,
int i )

◆ ipa_get_param_decl_index()

◆ ipa_get_param_decl_index_1()

static int ipa_get_param_decl_index_1 ( vec< ipa_param_descriptor, va_gc > * descriptors,
tree ptree )
static
Return index of the formal whose tree is PTREE in function which corresponds
to INFO.   

References count, ggc_alloc(), i, and vec_safe_length().

Referenced by ipa_get_param_decl_index(), ipa_load_from_parm_agg(), and load_from_unmodified_param().

◆ ipa_get_stmt_member_ptr_load_param()

static tree ipa_get_stmt_member_ptr_load_param ( gimple * stmt,
bool use_delta,
HOST_WIDE_INT * offset_p )
static
If STMT looks like a statement loading a value from a member pointer formal
parameter, return that parameter and store the offset of the field to
*OFFSET_P, if it is non-NULL.  Otherwise return NULL (but *OFFSET_P still
might be clobbered).  If USE_DELTA, then we look for a use of the delta
field rather than the pfn.   

References byte_position(), ggc_alloc(), gimple_assign_rhs1(), gimple_assign_single_p(), int_bit_position(), integer_nonzerop(), NULL_TREE, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, tree_int_cst_equal(), TREE_OPERAND, TREE_TYPE, and type_like_member_ptr_p().

Referenced by ipa_analyze_indirect_call_uses().

◆ ipa_get_value_range()

static ipa_vr * ipa_get_value_range ( const vrange & tmp)
static
Return a pointer to an ipa_vr just like TMP, but either find it in
ipa_vr_hash_table or allocate it in GC memory.   

References inchash::add_vrange(), ggc_alloc(), and ipa_vr_hash_table.

Referenced by ipa_record_return_value_range(), and ipa_set_jfunc_vr().

◆ ipa_impossible_devirt_target()

tree ipa_impossible_devirt_target ( struct cgraph_edge * ie,
tree target )
Return the target to be used in cases of impossible devirtualization.  IE
and target (the latter can be NULL) are dumped when dumping is enabled.   

References builtin_decl_unreachable(), cgraph_edge::caller, DECL_ASSEMBLER_NAME, dump_file, symtab_node::dump_name(), cgraph_node::get_create(), ggc_alloc(), and IDENTIFIER_POINTER.

Referenced by ipa_get_indirect_edge_target_1(), and try_make_edge_direct_virtual_call().

◆ ipa_initialize_node_params()

void ipa_initialize_node_params ( struct cgraph_node * node)
Initialize the ipa_node_params structure associated with NODE by counting
the function parameters, creating the descriptors and populating their
param_decls.   

References count_formal_params(), symtab_node::decl, ipa_node_params::descriptors, ipa_alloc_node_params(), ipa_node_params_sum, and ipa_populate_param_decls().

Referenced by analyze_function_body(), and ipa_analyze_node().

◆ ipa_is_ssa_with_stmt_def()

static bool ipa_is_ssa_with_stmt_def ( tree t)
static
Returns true iff T is an SSA_NAME defined by a statement.   

References SSA_NAME_IS_DEFAULT_DEF, and TREE_CODE.

Referenced by ipa_analyze_indirect_call_uses().

◆ ipa_jump_functions_equivalent_p()

bool ipa_jump_functions_equivalent_p ( ipa_jump_func * jf1,
ipa_jump_func * jf2 )
Return true if the two jump functions are known to be equivalent.  The
function can be used before the IPA phase of IPA-CP or inlining because it
cannot cope with refdesc changes these passes can carry out.   

References gcc_assert, gcc_unreachable, ggc_alloc(), i, ipa_agg_jump_functions_equivalent_p(), ipa_agg_pass_through_jf_equivalent_p(), ipa_get_jf_constant(), IPA_JF_ANCESTOR, IPA_JF_CONST, IPA_JF_PASS_THROUGH, IPA_JF_UNKNOWN, jfunc_rdesc_usable(), values_equal_for_ipcp_p(), and vec_safe_length().

Referenced by ipa_icf_gimple::func_checker::compare_gimple_call().

◆ ipa_load_from_parm_agg()

bool ipa_load_from_parm_agg ( struct ipa_func_body_info * fbi,
vec< ipa_param_descriptor, va_gc > * descriptors,
gimple * stmt,
tree op,
int * index_p,
HOST_WIDE_INT * offset_p,
poly_int64 * size_p,
bool * by_ref_p,
bool * guaranteed_unmodified )
Return true if we can prove that OP is a memory reference loading
data from an aggregate passed as a parameter.

The function works in two modes.  If GUARANTEED_UNMODIFIED is NULL, it return
false if it cannot prove that the value has not been modified before the
load in STMT.  If GUARANTEED_UNMODIFIED is not NULL, it will return true even
if it cannot prove the value has not been modified, in that case it will
store false to *GUARANTEED_UNMODIFIED, otherwise it will store true there.

INFO and PARMS_AINFO describe parameters of the current function (but the
latter can be NULL), STMT is the load statement.  If function returns true,
*INDEX_P, *OFFSET_P and *BY_REF is filled with the parameter index, offset
within the aggregate and whether it is a load from a value passed by
reference respectively.

Return false if the offset divided by BITS_PER_UNIT would not fit into an
unsigned int.   

References DECL_P, get_ref_base_and_extent_hwi(), ggc_alloc(), integer_zerop(), ipa_get_param_decl_index_1(), load_from_unmodified_param(), parm_preserved_before_stmt_p(), parm_ref_data_preserved_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, TREE_OPERAND, TREE_THIS_VOLATILE, and UINT_MAX.

Referenced by ipcp_modif_dom_walker::before_dom_children(), ipa_analyze_indirect_call_uses(), load_from_unmodified_param_or_agg(), and unmodified_parm_or_parm_agg_item().

◆ ipa_make_edge_direct_to_target()

◆ ipa_note_param_call()

static struct cgraph_edge * ipa_note_param_call ( struct cgraph_node * node,
int param_index,
gcall * stmt,
bool polymorphic )
static
Find the indirect call graph edge corresponding to STMT and mark it as a
call to a parameter number PARAM_INDEX.  NODE is the caller.  Return the
indirect call graph edge.
If POLYMORPHIC is true record is as a destination of polymorphic call.   

References cgraph_indirect_call_info::agg_contents, cgraph_node::get_edge(), cgraph_indirect_call_info::guaranteed_unmodified, cgraph_edge::indirect_info, ipa_node_params_sum, ipa_set_param_used_by_indirect_call(), ipa_set_param_used_by_polymorphic_call(), cgraph_indirect_call_info::member_ptr, cgraph_indirect_call_info::param_index, and cgraph_indirect_call_info::polymorphic.

Referenced by ipa_analyze_indirect_call_uses(), and ipa_analyze_virtual_call_uses().

◆ ipa_populate_param_decls()

static void ipa_populate_param_decls ( struct cgraph_node * node,
vec< ipa_param_descriptor, va_gc > & descriptors )
static
Populate the param_decl field in parameter DESCRIPTORS that correspond to
NODE.   

References symtab_node::decl, DECL_ARGUMENTS, DECL_CHAIN, estimate_move_cost(), gcc_assert, gcc_checking_assert, ggc_alloc(), gimple_has_body_p(), and TREE_TYPE.

Referenced by ipa_initialize_node_params(), and ipcp_transform_function().

◆ ipa_print_all_jump_functions()

void ipa_print_all_jump_functions ( FILE * f)
Print ipa_jump_func data structures of all nodes in the call graph to F.   

References FOR_EACH_FUNCTION, ggc_alloc(), and ipa_print_node_jump_functions().

Referenced by ipcp_driver().

◆ ipa_print_all_params()

void ipa_print_all_params ( FILE * f)
Print ipa_tree_map data structures of all functions in the
callgraph to F.   

References FOR_EACH_FUNCTION, ggc_alloc(), and ipa_print_node_params().

Referenced by ipcp_driver().

◆ ipa_print_constant_value()

static void ipa_print_constant_value ( FILE * f,
tree val )
static
Print VAL which is extracted from a jump function to F.   

References DECL_IN_CONSTANT_POOL, DECL_INITIAL, ggc_alloc(), print_generic_expr(), TREE_CODE, and TREE_OPERAND.

Referenced by ipa_print_node_jump_functions_for_edge().

◆ ipa_print_node_jump_functions()

◆ ipa_print_node_jump_functions_for_edge()

◆ ipa_print_node_params()

◆ ipa_prop_cc_finalize()

void ipa_prop_cc_finalize ( void )
Reset all state within ipa-prop.cc so that we can rerun the compiler
within the same process.  For use by toplev::finalize.   

References function_insertion_hook_holder, ggc_delete(), ipa_edge_args_sum, ipa_node_params_sum, NULL, symbol_table::remove_cgraph_insertion_hook(), and symtab.

Referenced by toplev::finalize().

◆ ipa_prop_read_jump_functions()

◆ ipa_prop_read_section()

◆ ipa_prop_write_jump_functions()

◆ ipa_propagate_indirect_call_infos()

bool ipa_propagate_indirect_call_infos ( struct cgraph_edge * cs,
vec< cgraph_edge * > * new_edges )
Update jump functions and call note functions on inlining the call site CS.
CS is expected to lead to a node already cloned by
cgraph_clone_inline_nodes.  Newly discovered indirect edges will be added to
*NEW_EDGES, unless NEW_EDGES is NULL.  Return true iff a new edge(s) were +
created.   

References cgraph_edge::callee, changed, ipa_cst_ref_desc::cs, FOR_EACH_VEC_ELT, gcc_assert, ggc_alloc(), i, ipa_edge_args_sum, ipa_get_jf_constant_rdesc(), IPA_JF_CONST, ipa_node_params_sum, ipcp_transformation_sum, propagate_controlled_uses(), propagate_info_to_inlined_callees(), and ipa_edge_args_sum_t::remove().

Referenced by inline_call().

◆ ipa_read_edge_info()

◆ ipa_read_indirect_edge_info()

static void ipa_read_indirect_edge_info ( class lto_input_block * ib,
class data_in * data_in,
struct cgraph_edge * cs,
class ipa_node_params * info )
static
Read in parts of cgraph_indirect_call_info corresponding to CS that are
relevant to indirect inlining from IB.   

References bp_unpack_value(), ggc_alloc(), cgraph_edge::indirect_info, ipa_set_param_used_by_indirect_call(), ipa_set_param_used_by_polymorphic_call(), stream_read_tree, streamer_read_bitpack(), and streamer_read_hwi().

Referenced by ipa_read_node_info().

◆ ipa_read_jump_function()

◆ ipa_read_node_info()

◆ ipa_record_return_value_range()

◆ ipa_register_cgraph_hooks()

◆ ipa_release_body_info()

void ipa_release_body_info ( struct ipa_func_body_info * fbi)
Release body info FBI.   

References FOR_EACH_VEC_ELT, free_ipa_bb_info(), ggc_alloc(), and i.

Referenced by analyze_function_body(), and ipa_analyze_node().

◆ ipa_return_value_range()

bool ipa_return_value_range ( Value_Range & range,
tree decl )

◆ ipa_set_ancestor_jf()

static void ipa_set_ancestor_jf ( struct ipa_jump_func * jfunc,
HOST_WIDE_INT offset,
int formal_id,
bool agg_preserved,
bool keep_null )
static

◆ ipa_set_jf_arith_pass_through()

static void ipa_set_jf_arith_pass_through ( struct ipa_jump_func * jfunc,
int formal_id,
tree operand,
enum tree_code operation )
static

◆ ipa_set_jf_constant()

◆ ipa_set_jf_cst_copy()

static void ipa_set_jf_cst_copy ( struct ipa_jump_func * dst,
struct ipa_jump_func * src )
static
Set JFUNC to be a copy of another jmp (to be used by jump function
combination code).  The two functions will share their rdesc.   

References ipa_jump_func::jump_func_value::constant, gcc_checking_assert, IPA_JF_CONST, ipa_jump_func::type, and ipa_jump_func::value.

Referenced by update_jump_functions_after_inlining().

◆ ipa_set_jf_simple_pass_through()

static void ipa_set_jf_simple_pass_through ( struct ipa_jump_func * jfunc,
int formal_id,
bool agg_preserved )
static

◆ ipa_set_jf_unary_pass_through()

static void ipa_set_jf_unary_pass_through ( struct ipa_jump_func * jfunc,
int formal_id,
enum tree_code operation )
static
Set JFUNC to be an unary pass through jump function.   

References ggc_alloc(), IPA_JF_PASS_THROUGH, and NULL_TREE.

Referenced by compute_complex_assign_jump_func(), ipa_read_jump_function(), and update_jump_functions_after_inlining().

◆ ipa_set_jf_unknown()

static void ipa_set_jf_unknown ( struct ipa_jump_func * jfunc)
static
Set jfunc to be a know-really nothing jump function.   

References ggc_alloc(), and IPA_JF_UNKNOWN.

Referenced by ipa_read_jump_function(), and update_jump_functions_after_inlining().

◆ ipa_set_jfunc_vr() [1/2]

static void ipa_set_jfunc_vr ( ipa_jump_func * jf,
const ipa_vr & vr )
static

◆ ipa_set_jfunc_vr() [2/2]

static void ipa_set_jfunc_vr ( ipa_jump_func * jf,
const vrange & tmp )
static
Assign to JF a pointer to a range just like TMP but either fetch a
copy from ipa_vr_hash_table or allocate a new on in GC memory.   

References ggc_alloc(), and ipa_get_value_range().

Referenced by ipa_compute_jump_functions_for_edge(), ipa_read_jump_function(), and ipa_set_jfunc_vr().

◆ ipa_set_node_agg_value_chain()

void ipa_set_node_agg_value_chain ( struct cgraph_node * node,
vec< ipa_argagg_value, va_gc > * aggs )
Set the aggregate replacements of NODE to be AGGVALS.   

References ipcp_transformation_initialize(), ipcp_transformation_sum, and ipcp_transformation::m_agg_values.

Referenced by create_specialized_node().

◆ ipa_unregister_cgraph_hooks()

static void ipa_unregister_cgraph_hooks ( void )
static

◆ ipa_write_indirect_edge_info()

static void ipa_write_indirect_edge_info ( struct output_block * ob,
struct cgraph_edge * cs )
static
Stream out parts of cgraph_indirect_call_info corresponding to CS that are
relevant to indirect inlining to OB.   

References bitpack_create(), bp_pack_value(), gcc_assert, ggc_alloc(), cgraph_edge::indirect_info, output_block::main_stream, stream_write_tree, streamer_write_bitpack(), and streamer_write_hwi().

Referenced by ipa_write_node_info().

◆ ipa_write_jump_function()

◆ ipa_write_node_info()

◆ ipcp_free_transformation_sum()

void ipcp_free_transformation_sum ( void )
Release the IPA CP transformation summary.   

References ggc_free(), ipcp_transformation_sum, and NULL.

Referenced by ipa_cp_cc_finalize().

◆ ipcp_get_aggregate_const()

tree ipcp_get_aggregate_const ( struct function * func,
tree parm,
bool by_ref,
HOST_WIDE_INT bit_offset,
HOST_WIDE_INT bit_size )
If IPA-CP discovered a constant in parameter PARM at OFFSET of a given SIZE
- whether passed by reference or not is given by BY_REF - return that
constant.  Otherwise return NULL_TREE.  The is supposed to be used only
after clone materialization and transformation is done (because it asserts
that killed constants have been pruned).  

References ipa_argagg_value::by_ref, function::decl, gcc_assert, cgraph_node::get(), ggc_alloc(), ipcp_get_transformation_summary(), ipa_argagg_value::killed, ipa_func_body_info::node, NULL_TREE, tree_to_poly_int64(), TREE_TYPE, TYPE_SIZE, and ipa_argagg_value::value.

Referenced by vn_reference_lookup_2().

◆ ipcp_get_parm_bits()

◆ ipcp_read_transformation_summaries()

void ipcp_read_transformation_summaries ( void )

◆ ipcp_transform_function()

◆ ipcp_transformation_initialize()

void ipcp_transformation_initialize ( void )
Initialize IPA CP transformation summary and also allocate any necessary hash
tables if they do not already exist.   

References hash_table< Descriptor, Lazy, Allocator >::create_ggc(), ipcp_transformation_t::create_ggc(), ipa_vr_hash_table, ipcp_transformation_sum, NULL, and symtab.

Referenced by ipa_set_node_agg_value_chain(), ipcp_store_vr_results(), and read_ipcp_transformation_info().

◆ ipcp_update_vr()

◆ ipcp_write_transformation_summaries()

◆ jfunc_rdesc_usable()

static struct ipa_cst_ref_desc * jfunc_rdesc_usable ( struct ipa_jump_func * jfunc)
static
If JFUNC has a reference description with refcount different from
IPA_UNDESCRIBED_USE, return the reference description, otherwise return
NULL.  JFUNC must be a constant jump function.   

References ggc_alloc(), ipa_get_jf_constant_rdesc(), IPA_UNDESCRIBED_USE, NULL, and ipa_cst_ref_desc::refcount.

Referenced by ipa_edge_args_sum_t::duplicate(), ipa_jump_functions_equivalent_p(), propagate_controlled_uses(), and try_decrement_rdesc_refcount().

◆ load_from_dereferenced_name()

static bool load_from_dereferenced_name ( tree expr,
tree name )
static
Return true EXPR is a load from a dereference of SSA_NAME NAME.   

References get_base_address(), ggc_alloc(), TREE_CODE, and TREE_OPERAND.

Referenced by ipa_analyze_controlled_uses().

◆ load_from_unmodified_param()

static int load_from_unmodified_param ( struct ipa_func_body_info * fbi,
vec< ipa_param_descriptor, va_gc > * descriptors,
gimple * stmt )
static
If STMT is an assignment that loads a value from an parameter declaration,
return the index of the parameter in ipa_node_params which has not been
modified.  Otherwise return -1.   

References ggc_alloc(), gimple_assign_rhs1(), gimple_assign_single_p(), ipa_get_param_decl_index_1(), parm_preserved_before_stmt_p(), and TREE_CODE.

Referenced by compute_complex_assign_jump_func(), ipa_load_from_parm_agg(), and load_from_unmodified_param_or_agg().

◆ load_from_unmodified_param_or_agg()

static int load_from_unmodified_param_or_agg ( struct ipa_func_body_info * fbi,
class ipa_node_params * info,
gimple * stmt,
HOST_WIDE_INT * offset_p,
bool * by_ref_p )
static
If STMT is an assignment that loads a value from a parameter declaration,
or from an aggregate passed as the parameter either by value or reference,
return the index of the parameter in ipa_node_params.  Otherwise return -1.

FBI holds gathered information about the function.  INFO describes
parameters of the function, STMT is the assignment statement.  If it is a
memory load from an aggregate, *OFFSET_P is filled with offset within the
aggregate, and *BY_REF_P specifies whether the aggregate is passed by
reference.   

References AGGREGATE_TYPE_P, contains_bitfld_component_ref_p(), ipa_node_params::descriptors, gcc_assert, ggc_alloc(), gimple_assign_load_p(), gimple_assign_rhs1(), handled_component_p(), ipa_get_type(), ipa_load_from_parm_agg(), load_from_unmodified_param(), TREE_CODE, TREE_OPERAND, TREE_THIS_VOLATILE, tree_to_poly_int64(), TREE_TYPE, and TYPE_SIZE.

Referenced by analyze_agg_content_value().

◆ mark_modified()

static bool mark_modified ( ao_ref * ao,
tree vdef,
void * data )
static
Callback of walk_aliased_vdefs.  Flags that it has been invoked to the
boolean variable pointed to by DATA.   

References b.

Referenced by parm_preserved_before_stmt_p(), parm_ref_data_pass_through_p(), and parm_ref_data_preserved_p().

◆ param_type_may_change_p()

static bool param_type_may_change_p ( tree function,
tree arg,
gimple * call )
static
See if ARG is PARAM_DECl describing instance passed by pointer
or reference in FUNCTION.  Return false if the dynamic type may change
in between beggining of the function until CALL is invoked.

Generally functions are not allowed to change type of such instances,
but they call destructors.  We assume that methods cannot destroy the THIS
pointer.  Also as a special cases, constructor and destructors may change
type of the THIS pointer.   

References BLOCK_SUPERCONTEXT, DECL_ARGUMENTS, DECL_CXX_CONSTRUCTOR_P, DECL_CXX_DESTRUCTOR_P, DECL_STRUCT_FUNCTION, ECF_CONST, ECF_PURE, flags_from_decl_or_type(), ggc_alloc(), gimple_block(), inlined_polymorphic_ctor_dtor_block_p(), SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, and TREE_TYPE.

Referenced by detect_type_change(), and detect_type_change_ssa().

◆ parm_bb_aa_status_for_bb()

static struct ipa_param_aa_status * parm_bb_aa_status_for_bb ( struct ipa_func_body_info * fbi,
basic_block bb,
int index )
static
Get AA status structure for the given BB and parameter with INDEX.  Allocate
structures and/or intialize the result with a dominating description as
necessary.   

References find_dominating_aa_status(), gcc_checking_assert, ggc_alloc(), ipa_get_bb_info(), and ipa_bb_info::param_aa_statuses.

Referenced by parm_preserved_before_stmt_p(), parm_ref_data_pass_through_p(), and parm_ref_data_preserved_p().

◆ parm_preserved_before_stmt_p()

static bool parm_preserved_before_stmt_p ( struct ipa_func_body_info * fbi,
int index,
gimple * stmt,
tree parm_load )
static
Return true if a load from a formal parameter PARM_LOAD is known to retrieve
a value known not to be modified in this function before reaching the
statement STMT.  FBI holds information about the function we have so far
gathered but do not survive the summary building stage.   

References ao_ref_init(), gcc_assert, gcc_checking_assert, get_base_address(), ggc_alloc(), gimple_bb(), gimple_vuse(), mark_modified(), NULL, NULL_TREE, parm_bb_aa_status_for_bb(), TREE_CODE, TREE_READONLY, and walk_aliased_vdefs().

Referenced by ipa_analyze_indirect_call_uses(), ipa_compute_jump_functions_for_edge(), ipa_load_from_parm_agg(), and load_from_unmodified_param().

◆ parm_ref_data_pass_through_p()

static bool parm_ref_data_pass_through_p ( struct ipa_func_body_info * fbi,
int index,
gimple * call,
tree parm )
static
Return true if the data pointed to by PARM (which is a parameter with INDEX)
is known to be unmodified in this function before reaching call statement
CALL into which it is passed.  FBI describes the function body.   

References ao_ref_init_from_ptr_and_size(), ggc_alloc(), gimple_bb(), gimple_vuse(), mark_modified(), NULL, NULL_TREE, parm_bb_aa_status_for_bb(), POINTER_TYPE_P, TREE_TYPE, and walk_aliased_vdefs().

Referenced by compute_complex_ancestor_jump_func(), compute_complex_assign_jump_func(), and ipa_compute_jump_functions_for_edge().

◆ parm_ref_data_preserved_p()

static bool parm_ref_data_preserved_p ( struct ipa_func_body_info * fbi,
int index,
gimple * stmt,
tree ref )
static
Return true if memory reference REF (which must be a load through parameter
with INDEX) loads data that are known to be unmodified in this function
before reaching statement STMT.   

References ao_ref_init(), gcc_checking_assert, ggc_alloc(), gimple_bb(), gimple_vuse(), mark_modified(), NULL, parm_bb_aa_status_for_bb(), and walk_aliased_vdefs().

Referenced by ipa_analyze_indirect_call_uses(), and ipa_load_from_parm_agg().

◆ propagate_controlled_uses()

◆ propagate_info_to_inlined_callees()

static bool propagate_info_to_inlined_callees ( struct cgraph_edge * cs,
struct cgraph_node * node,
vec< cgraph_edge * > * new_edges )
static
Recursively traverse subtree of NODE (including node) made of inlined
cgraph_edges when CS has been inlined and invoke
update_indirect_edges_after_inlining on all nodes and
update_jump_functions_after_inlining on all non-inlined edges that lead out
of this subtree.  Newly discovered indirect edges will be added to
*NEW_EDGES, unless NEW_EDGES is NULL.  Return true iff a new edge(s) were
created.   

References cgraph_edge::callee, cgraph_node::callees, ggc_alloc(), cgraph_node::indirect_calls, cgraph_edge::inline_failed, cgraph_edge::next_callee, propagate_info_to_inlined_callees(), update_indirect_edges_after_inlining(), and update_jump_functions_after_inlining().

Referenced by ipa_propagate_indirect_call_infos(), and propagate_info_to_inlined_callees().

◆ read_ipcp_transformation_info()

◆ read_replacements_section()

◆ remove_described_reference()

static bool remove_described_reference ( symtab_node * symbol,
struct ipa_cst_ref_desc * rdesc )
static
Remove a reference to SYMBOL from the list of references of a node given by
reference description RDESC.  Return true if the reference has been
successfully found and removed.   

References cgraph_edge::call_stmt, cgraph_edge::caller, ipa_cst_ref_desc::cs, dump_file, symtab_node::dump_name(), symtab_node::find_reference(), ggc_alloc(), IPA_REF_ADDR, and cgraph_edge::lto_stmt_uid.

Referenced by propagate_controlled_uses(), and try_decrement_rdesc_refcount().

◆ stmt_may_be_vtbl_ptr_store()

static bool stmt_may_be_vtbl_ptr_store ( gimple * stmt)
static
Return true if STMT can modify a virtual method table pointer.

This function makes special assumptions about both constructors and
destructors which are all the functions that are allowed to alter the VMT
pointers.  It assumes that destructors begin with assignment into all VMT
pointers and that constructors essentially look in the following way:

1) The very first thing they do is that they call constructors of ancestor
sub-objects that have them.

2) Then VMT pointers of this and all its ancestors is set to new values
corresponding to the type corresponding to the constructor.

3) Only afterwards, other stuff such as constructor of member sub-objects
and the code written by the user is run.  Only this may include calling
virtual functions, directly or indirectly.

There is no way to call a constructor of an ancestor sub-object in any
other way.

This means that we do not have to care whether constructors get the correct
type information because they will always change it (in fact, if we define
the type to be given by the VMT pointer, it is undefined).

The most important fact to derive from the above is that if, for some
statement in the section 3, we try to detect whether the dynamic type has
changed, we can safely ignore all calls as we examine the function body
backwards until we reach statements in section 2 because these calls cannot
be ancestor constructors or destructors (if the input is not bogus) and so
do not change the dynamic type (this holds true only for automatically
allocated objects but at the moment we devirtualize only these).  We then
must detect that statements in section 2 change the dynamic type and can try
to derive the new type.  That is enough and we can stop, we will never see
the calls into constructors of sub-objects in this code.  Therefore we can
safely ignore all call statements that we traverse.

References AGGREGATE_TYPE_P, DECL_VIRTUAL_P, ggc_alloc(), gimple_assign_lhs(), gimple_clobber_p(), is_gimple_assign(), is_gimple_call(), POINTER_TYPE_P, TREE_CODE, TREE_OPERAND, and TREE_TYPE.

Referenced by check_stmt_for_type_change().

◆ symtab_node_for_jfunc()

static symtab_node * symtab_node_for_jfunc ( struct ipa_jump_func * jfunc)
static
If the value of constant jump function JFUNC is an address of a function
declaration, return the associated call graph node.  Otherwise return
NULL.   

References gcc_checking_assert, symtab_node::get(), ggc_alloc(), ipa_get_jf_constant(), IPA_JF_CONST, NULL, TREE_CODE, and TREE_OPERAND.

Referenced by ipa_edge_args_sum_t::duplicate(), try_decrement_rdesc_refcount(), and try_make_edge_direct_simple_call().

◆ try_decrement_rdesc_refcount()

static bool try_decrement_rdesc_refcount ( struct ipa_jump_func * jfunc)
static
If JFUNC is a constant jump function with a usable rdesc, decrement its
refcount and if it hits zero, remove reference to SYMBOL from the caller of
the edge specified in the rdesc.  Return false if either the symbol or the
reference could not be found, otherwise return true.   

References ggc_alloc(), IPA_JF_CONST, jfunc_rdesc_usable(), ipa_cst_ref_desc::refcount, remove_described_reference(), and symtab_node_for_jfunc().

Referenced by ipa_edge_args_sum_t::remove(), and try_make_edge_direct_simple_call().

◆ try_make_edge_direct_simple_call()

static struct cgraph_edge * try_make_edge_direct_simple_call ( struct cgraph_edge * ie,
struct ipa_jump_func * jfunc,
tree target_type,
struct cgraph_node * new_root,
class ipa_node_params * new_root_info )
static
Try to find a destination for indirect edge IE that corresponds to a simple
call or a call of a member function pointer and where the destination is a
pointer formal parameter described by jump function JFUNC.  TARGET_TYPE is
the type of the parameter to which the result of JFUNC is passed.  If it can
be determined, return the newly direct edge, otherwise return NULL.
NEW_ROOT and NEW_ROOT_INFO is the node and its info that JFUNC lattices are
relative to.   

References cgraph_indirect_call_info::agg_contents, cgraph_indirect_call_info::by_ref, cgraph_edge::callee, gcc_checking_assert, ggc_alloc(), cgraph_indirect_call_info::guaranteed_unmodified, cgraph_edge::indirect_info, ipa_find_agg_cst_from_init(), ipa_find_agg_cst_from_jfunc_items(), IPA_JF_CONST, ipa_make_edge_direct_to_target(), ipa_value_from_jfunc(), NULL, NULL_TREE, cgraph_indirect_call_info::offset, symtab_node_for_jfunc(), and try_decrement_rdesc_refcount().

Referenced by update_indirect_edges_after_inlining().

◆ try_make_edge_direct_virtual_call()

static struct cgraph_edge * try_make_edge_direct_virtual_call ( struct cgraph_edge * ie,
struct ipa_jump_func * jfunc,
class ipa_polymorphic_call_context ctx,
struct cgraph_node * new_root,
class ipa_node_params * new_root_info )
static
Try to find a destination for indirect edge IE that corresponds to a virtual
call based on a formal parameter which is described by jump function JFUNC
and if it can be determined, make it direct and return the direct edge.
Otherwise, return NULL.  CTX describes the polymorphic context that the
parameter the call is based on brings along with it.  NEW_ROOT and
NEW_ROOT_INFO is the node and its info that JFUNC lattices are relative
to.   

References cgraph_indirect_call_info::by_ref, cgraph_edge::caller, ipa_polymorphic_call_context::combine_with(), cgraph_indirect_call_info::context, symtab_node::decl, fndecl_built_in_p(), gcc_assert, cgraph_node::get(), cgraph_node::get_create(), ggc_alloc(), gimple_get_virt_method_for_vtable(), cgraph_edge::in_polymorphic_cdtor, cgraph_edge::indirect_info, ipa_find_agg_cst_from_init(), ipa_find_agg_cst_from_jfunc_items(), ipa_get_jf_constant(), ipa_impossible_devirt_target(), IPA_JF_CONST, ipa_make_edge_direct_to_target(), cgraph_edge::maybe_hot_p(), NULL, NULL_TREE, cgraph_indirect_call_info::offset, offset, ipa_polymorphic_call_context::offset_by(), opt_for_fn, cgraph_indirect_call_info::otr_token, cgraph_indirect_call_info::otr_type, ipa_polymorphic_call_context::possible_dynamic_type_change(), possible_polymorphic_call_target_p(), possible_polymorphic_call_targets(), cgraph_edge::speculative, try_speculative_devirtualization(), cgraph_indirect_call_info::vptr_changed, and vtable_pointer_value_to_vtable().

Referenced by update_indirect_edges_after_inlining().

◆ type_like_member_ptr_p()

static bool type_like_member_ptr_p ( tree type,
tree * method_ptr,
tree * delta )
static
Inspect the given TYPE and return true iff it has the same structure (the
same number of fields of the same types) as a C++ member pointer.  If
METHOD_PTR and DELTA are non-NULL, store the trees representing the
corresponding fields there.   

References DECL_CHAIN, DECL_FIELD_OFFSET, ggc_alloc(), INTEGRAL_TYPE_P, POINTER_TYPE_P, TREE_CODE, tree_fits_uhwi_p(), TREE_TYPE, and TYPE_FIELDS.

Referenced by ipa_get_stmt_member_ptr_load_param().

◆ unadjusted_ptr_and_unit_offset()

bool unadjusted_ptr_and_unit_offset ( tree op,
tree * ret,
poly_int64 * offset_ret )
Walk pointer adjustemnts from OP (such as POINTER_PLUS and ADDR_EXPR)
to find original pointer.  Initialize RET to the pointer which results from
the walk.
If offset is known return true and initialize OFFSET_RET.   

References get_addr_base_and_unit_offset(), get_base_address(), ggc_alloc(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_single_p(), i, is_gimple_assign(), mem_ref_offset(), offset, ptrdiff_tree_p(), SSA_NAME_DEF_STMT, SSA_NAME_IS_DEFAULT_DEF, TREE_CODE, and TREE_OPERAND.

◆ update_indirect_edges_after_inlining()

static bool update_indirect_edges_after_inlining ( struct cgraph_edge * cs,
struct cgraph_node * node,
vec< cgraph_edge * > * new_edges )
static

◆ update_jump_functions_after_inlining()

static void update_jump_functions_after_inlining ( struct cgraph_edge * cs,
struct cgraph_edge * e )
static
Update the jump functions associated with call graph edge E when the call
graph edge CS is being inlined, assuming that E->caller is already (possibly
indirectly) inlined into CS->callee and that E has not been inlined.   

References ipa_jump_func::agg, ipa_pass_through_data::agg_preserved, ipa_ancestor_jf_data::agg_preserved, ipa_jump_func::jump_func_value::ancestor, ipa_load_agg_data::by_ref, ipa_agg_jump_function::by_ref, ipa_agg_jf_item::jump_func_agg_value::constant, ipa_jump_func::jump_func_value::constant, count, FOR_EACH_VEC_ELT, FOR_EACH_VEC_SAFE_ELT, ipa_pass_through_data::formal_id, ipa_ancestor_jf_data::formal_id, gcc_assert, gcc_checking_assert, gcc_unreachable, ggc_alloc(), i, cgraph_edge::in_polymorphic_cdtor, ipa_edge_args_sum, ipa_get_cs_argument_count(), ipa_get_ith_jump_func(), ipa_get_ith_polymorhic_call_context(), ipa_get_jf_ancestor_agg_preserved(), ipa_get_jf_ancestor_formal_id(), ipa_get_jf_ancestor_keep_null(), ipa_get_jf_ancestor_offset(), ipa_get_jf_ancestor_type_preserved(), ipa_get_jf_pass_through_agg_preserved(), ipa_get_jf_pass_through_formal_id(), ipa_get_jf_pass_through_operand(), ipa_get_jf_pass_through_operation(), ipa_get_jf_pass_through_refdesc_decremented(), ipa_get_jf_pass_through_type_preserved(), IPA_JF_ANCESTOR, IPA_JF_CONST, IPA_JF_LOAD_AGG, IPA_JF_PASS_THROUGH, IPA_JF_UNKNOWN, ipa_set_ancestor_jf(), ipa_set_jf_arith_pass_through(), ipa_set_jf_cst_copy(), ipa_set_jf_simple_pass_through(), ipa_set_jf_unary_pass_through(), ipa_set_jf_unknown(), ipa_zap_jf_refdesc(), ipa_agg_jump_function::items, ipa_agg_jf_item::jftype, ipa_ancestor_jf_data::keep_null, ipa_agg_jf_item::jump_func_agg_value::load_agg, ipa_load_agg_data::offset, ipa_ancestor_jf_data::offset, ipa_agg_jf_item::offset, ipa_polymorphic_call_context::offset_by(), ipa_pass_through_data::operation, ipa_agg_jf_item::jump_func_agg_value::pass_through, ipa_jump_func::jump_func_value::pass_through, ipa_polymorphic_call_context::possible_dynamic_type_change(), tcc_unary, TREE_CODE_CLASS, ipa_jump_func::type, ipa_polymorphic_call_context::useless_p(), ipa_constant_data::value, ipa_agg_jf_item::value, ipa_jump_func::value, vec_safe_copy(), and vec_safe_grow_cleared().

Referenced by propagate_info_to_inlined_callees().

◆ useful_ipcp_transformation_info_p()

static bool useful_ipcp_transformation_info_p ( ipcp_transformation * ts)
static
Return true if the IPA-CP transformation summary TS is non-NULL and contains
useful info.   

References ggc_alloc(), and vec_safe_is_empty().

Referenced by ipcp_write_transformation_summaries().

◆ visit_ref_for_mod_analysis()

static bool visit_ref_for_mod_analysis ( gimple * ,
tree op,
tree ,
void * data )
static
Callback of walk_stmt_load_store_addr_ops for the visit_load.
If OP is a parameter declaration, mark it as used in the info structure
passed in DATA.   

References gcc_assert, get_base_address(), ggc_alloc(), ipa_get_param_decl_index(), ipa_set_param_used(), and TREE_CODE.

Referenced by ipa_analyze_params_uses_in_bb().

◆ write_ipcp_transformation_info()

Variable Documentation

◆ function_insertion_hook_holder

struct cgraph_node_hook_list* function_insertion_hook_holder
static
Holders of ipa cgraph hooks:  

Referenced by ipa_prop_cc_finalize(), ipa_register_cgraph_hooks(), and ipa_unregister_cgraph_hooks().

◆ ipa_edge_args_sum

◆ ipa_node_params_sum

ipa_node_params_t* ipa_node_params_sum = NULL
Interprocedural analyses.
   Copyright (C) 2005-2024 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Function summary where the parameter infos are actually stored.  

Referenced by add_all_node_vals_to_toposort(), adjust_references_in_caller(), analyze_function_body(), calls_same_node_or_its_all_contexts_clone_p(), cgraph_edge_brings_all_agg_vals_for_node(), cgraph_edge_brings_all_scalars_for_node(), cgraph_edge_brings_value_p(), cgraph_edge_brings_value_p(), check_argument_count(), create_specialized_node(), decide_about_value(), decide_whether_version_node(), ipa_edge_args_sum_t::duplicate(), ipa_fn_summary_t::duplicate(), ipa_cached_call_context::duplicate_from(), early_inliner(), ipa_call_context::equal_to(), estimate_calls_size_and_time(), estimate_local_effects(), evaluate_properties_for_edge(), find_aggregate_values_for_callers_subset(), find_more_contexts_for_caller_subset(), find_more_scalar_values_for_callers_subset(), gather_caller_stats(), get_info_about_necessary_edges(), good_cloning_opportunity_p(), has_undead_caller_from_outside_scc_p(), identify_dead_nodes(), initialize_node_lattices(), inline_read_section(), ipa_alloc_node_params(), ipa_analyze_controlled_uses(), ipa_analyze_node(), ipa_check_create_node_params(), ipa_compute_jump_functions_for_edge(), ipa_free_all_node_params(), ipa_initialize_node_params(), ipa_merge_fn_summary_after_inlining(), ipa_note_param_call(), ipa_print_node_params(), ipa_prop_cc_finalize(), ipa_prop_write_jump_functions(), ipa_propagate_indirect_call_infos(), ipa_read_node_info(), ipa_write_node_info(), ipcp_discover_new_direct_edges(), ipcp_propagate_stage(), ipcp_store_vr_results(), ipcp_verify_propagated_values(), ipcp_versionable_function_p(), ipa_icf::sem_function::param_used_p(), pop_node_from_stack(), print_all_lattices(), propagate_aggregate_lattice(), propagate_aggs_across_jump_function(), propagate_bits_across_jump_function(), propagate_constants_across_call(), propagate_constants_topo(), propagate_context_across_jump_function(), propagate_controlled_uses(), propagate_scalar_across_jump_function(), propagate_vr_across_jump_function(), push_agg_values_for_index_from_edge(), push_node_to_stack(), remap_edge_params(), self_recursive_agg_pass_through_p(), self_recursive_pass_through_p(), set_single_call_flag(), spread_undeadness(), update_indirect_edges_after_inlining(), and want_remove_some_param_p().

◆ ipa_refdesc_pool

◆ ipa_return_value_sum

function_summary<ipa_return_value_summary *>* ipa_return_value_sum
static
Variable hoding the return value summary.   

Referenced by ipa_record_return_value_range(), and ipa_return_value_range().

◆ ipa_vr_hash_table

hash_table<ipa_vr_ggc_hash_traits>* ipa_vr_hash_table
static
Hash table for avoid repeated allocations of equal ranges.   

Referenced by ipa_check_create_edge_args(), ipa_get_value_range(), ipa_record_return_value_range(), and ipcp_transformation_initialize().

◆ ipcp_transformation_sum