GCC Middle and Back End API Reference
ipa-utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ipa_dfs_info
 

Typedefs

typedef odr_type_dodr_type
 

Functions

void ipa_print_order (FILE *, const char *, struct cgraph_node **, int)
 
int ipa_reduced_postorder (struct cgraph_node **, bool, bool(*ignore_edge)(struct cgraph_edge *))
 
void ipa_free_postorder_info (void)
 
vec< cgraph_node * > ipa_get_nodes_in_cycle (struct cgraph_node *)
 
bool ipa_edge_within_scc (struct cgraph_edge *)
 
int ipa_reverse_postorder (struct cgraph_node **)
 
tree get_base_var (tree)
 
void ipa_merge_profiles (struct cgraph_node *dst, struct cgraph_node *src, bool preserve_body=false)
 
bool recursive_call_p (tree, tree)
 
bool stmt_may_terminate_function_p (function *fun, gimple *stmt, bool assume_return_or_eh)
 
bitmap find_always_executed_bbs (function *fun, bool assume_return_or_eh)
 
bool finite_function_p ()
 
bool builtin_safe_for_const_function_p (bool *, tree)
 
bool ipa_make_function_const (cgraph_node *, bool, bool)
 
bool ipa_make_function_pure (cgraph_node *, bool, bool)
 
bool ipa_propagate_frequency (struct cgraph_node *node)
 
void ipa_profile_cc_finalize (void)
 
void ipa_icf_cc_finalize (void)
 
void ipa_sra_cc_finalize (void)
 
void build_type_inheritance_graph (void)
 
void rebuild_type_inheritance_graph (void)
 
void update_type_inheritance_graph (void)
 
vec< cgraph_node * > possible_polymorphic_call_targets (tree, HOST_WIDE_INT, ipa_polymorphic_call_context, bool *copletep=NULL, void **cache_token=NULL, bool speuclative=false)
 
odr_type get_odr_type (tree, bool insert=false)
 
bool odr_type_p (const_tree)
 
bool possible_polymorphic_call_target_p (tree ref, gimple *stmt, struct cgraph_node *n)
 
void dump_possible_polymorphic_call_targets (FILE *, tree, HOST_WIDE_INT, const ipa_polymorphic_call_context &, bool verbose=true)
 
bool possible_polymorphic_call_target_p (tree, HOST_WIDE_INT, const ipa_polymorphic_call_context &, struct cgraph_node *)
 
tree polymorphic_ctor_dtor_p (tree, bool)
 
tree inlined_polymorphic_ctor_dtor_block_p (tree, bool)
 
bool decl_maybe_in_construction_p (tree, tree, gimple *, tree)
 
tree vtable_pointer_value_to_binfo (const_tree)
 
bool vtable_pointer_value_to_vtable (const_tree, tree *, unsigned HOST_WIDE_INT *)
 
tree subbinfo_with_vtable_at_offset (tree, unsigned HOST_WIDE_INT, tree)
 
void compare_virtual_tables (varpool_node *, varpool_node *)
 
bool type_all_derivations_known_p (const_tree)
 
bool type_known_to_have_no_derivations_p (tree)
 
bool contains_polymorphic_type_p (const_tree)
 
void register_odr_type (tree)
 
bool types_must_be_same_for_odr (tree, tree)
 
bool types_odr_comparable (tree, tree)
 
cgraph_nodetry_speculative_devirtualization (tree, HOST_WIDE_INT, ipa_polymorphic_call_context)
 
void warn_types_mismatch (tree t1, tree t2, location_t loc1=UNKNOWN_LOCATION, location_t loc2=UNKNOWN_LOCATION)
 
bool odr_or_derived_type_p (const_tree t)
 
bool odr_types_equivalent_p (tree type1, tree type2)
 
bool odr_type_violation_reported_p (tree type)
 
tree prevailing_odr_type (tree type)
 
void enable_odr_based_tbaa (tree type)
 
bool odr_based_tbaa_p (const_tree type)
 
void set_type_canonical_for_odr_type (tree type, tree canonical)
 
void warn_function_returns_nonnull (tree)
 
void register_odr_enum (tree type)
 
vec< cgraph_node * > possible_polymorphic_call_targets (struct cgraph_edge *e, bool *completep=NULL, void **cache_token=NULL, bool speculative=false)
 
vec< cgraph_node * > possible_polymorphic_call_targets (tree ref, gimple *call, bool *completep=NULL, void **cache_token=NULL)
 
void dump_possible_polymorphic_call_targets (FILE *f, struct cgraph_edge *e, bool verbose=true)
 
bool possible_polymorphic_call_target_p (struct cgraph_edge *e, struct cgraph_node *n)
 
bool polymorphic_type_binfo_p (const_tree binfo)
 
bool type_with_linkage_p (const_tree t)
 
bool type_in_anonymous_namespace_p (const_tree t)
 
const charget_odr_name_for_type (tree type)
 
bool lto_streaming_expected_p ()
 

Variables

bool thunk_expansion
 

Typedef Documentation

◆ odr_type

Function Documentation

◆ build_type_inheritance_graph()

◆ builtin_safe_for_const_function_p()

bool builtin_safe_for_const_function_p ( bool * looping,
tree callee )
Recognize special cases of builtins that are by themselves not const
but function using them is.   

References BUILT_IN_NORMAL, CASE_BUILT_IN_ALLOCA, DECL_BUILT_IN_CLASS, DECL_FUNCTION_CODE(), and ggc_alloc().

Referenced by check_call(), and propagate_pure_const().

◆ compare_virtual_tables()

void compare_virtual_tables ( varpool_node * prevailing,
varpool_node * vtable )

◆ contains_polymorphic_type_p()

◆ decl_maybe_in_construction_p()

bool decl_maybe_in_construction_p ( tree base,
tree outer_type,
gimple * call,
tree function )
We know that the instance is stored in variable or parameter
(not dynamically allocated) and we want to disprove the fact
that it may be in construction at invocation of CALL.

BASE represents memory location where instance is stored.
If BASE is NULL, it is assumed to be global memory.
OUTER_TYPE is known type of the instance or NULL if not
known.

For the variable to be in construction we actually need to
be in constructor of corresponding global variable or
the inline stack of CALL must contain the constructor.
Check this condition.  This check works safely only before
IPA passes, because inline stacks may become out of date
later.   

References auto_var_in_fn_p(), BLOCK_SUPERCONTEXT, DECL_ABSTRACT_ORIGIN, DECL_CXX_CONSTRUCTOR_P, DECL_CXX_DESTRUCTOR_P, DECL_P, DECL_STRUCT_FUNCTION, ECF_CONST, ECF_PURE, flags_from_decl_or_type(), gcc_assert, ggc_alloc(), gimple_block(), inlined_polymorphic_ctor_dtor_block_p(), is_global_var(), polymorphic_type_binfo_p(), TREE_CODE, TREE_TYPE, TYPE_BINFO, TYPE_MAIN_VARIANT, TYPE_METHOD_BASETYPE, types_odr_comparable(), types_same_for_odr(), and VAR_P.

Referenced by symbol_table::create_edge(), and ipa_polymorphic_call_context::ipa_polymorphic_call_context().

◆ dump_possible_polymorphic_call_targets() [1/2]

◆ dump_possible_polymorphic_call_targets() [2/2]

void dump_possible_polymorphic_call_targets ( FILE * f,
struct cgraph_edge * e,
bool verbose = true )
inline

◆ enable_odr_based_tbaa()

void enable_odr_based_tbaa ( tree type)
Set tbaa_enabled flag for TYPE.   

References get_odr_type(), and odr_type_d::tbaa_enabled.

◆ find_always_executed_bbs()

bitmap find_always_executed_bbs ( function * fun,
bool assume_return_or_eh )
Return bitmap of all basic blocks whose first statements are known to
execute on every invocation of the function.

If assume_return_or_eh we can further assume that the function ends
either by retrn statement or EH (no trapping or infinite loops).
This is useful when sumarizing function in passes like ipa-modref.

Seeing assume_return_or_eh to false is used to prove that given
statmeent will be executed even if the function gets into infinite
loop or trap.   

References BITMAP_ALLOC, bitmap_print(), bitmap_set_bit, calculate_dominance_info(), CDI_DOMINATORS, function::decl, dom_info_available_p(), dominated_by_p(), dump_file, dump_flags, ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_PURE, EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, finite_loop_p(), basic_block_def::flags, flags_from_decl_or_type(), FOR_EACH_EDGE, gcc_obstack_init, ggc_alloc(), gsi_end_p(), gsi_next_nondebug(), gsi_start_nondebug_after_labels_bb(), gsi_stmt(), basic_block_def::index, mark_dfs_back_edges(), MAX, MIN, NULL, obstack, basic_block_def::preds, si, single_succ_edge(), stmt_may_terminate_function_p(), basic_block_def::succs, TDF_DETAILS, visited, and worklist.

◆ finite_function_p()

◆ get_base_var()

tree get_base_var ( tree t)
Given a memory reference T, will return the variable at the bottom
of the access.  Unlike get_base_address, this will recurse through
INDIRECT_REFS.   

References CONSTANT_CLASS_P, ggc_alloc(), SSA_VAR_P, TREE_CODE, and TREE_OPERAND.

Referenced by symtab_node::maybe_create_reference(), and record_reference().

◆ get_odr_name_for_type()

const char * get_odr_name_for_type ( tree type)
inline
If TYPE has mangled ODR name, return it.  Otherwise return NULL.
The function works only when free_lang_data is run.   

References DECL_ASSEMBLER_NAME, DECL_ASSEMBLER_NAME_SET_P, ggc_alloc(), IDENTIFIER_POINTER, NULL, NULL_TREE, TREE_CODE, and TYPE_NAME.

Referenced by debug_tree_odr_name(), and warn_types_mismatch().

◆ get_odr_type()

◆ inlined_polymorphic_ctor_dtor_block_p()

tree inlined_polymorphic_ctor_dtor_block_p ( tree block,
bool check_clones )
Return a FUNCTION_DECL if BLOCK represents a constructor or destructor.
If CHECK_CLONES is true, also check for clones of ctor/dtors.   

References block_ultimate_origin(), ggc_alloc(), NULL, NULL_TREE, polymorphic_ctor_dtor_p(), and TREE_CODE.

Referenced by decl_maybe_in_construction_p(), noncall_stmt_may_be_vtbl_ptr_store(), param_type_may_change_p(), and remove_unused_scope_block_p().

◆ ipa_edge_within_scc()

◆ ipa_free_postorder_info()

void ipa_free_postorder_info ( void )
Deallocate all ipa_dfs_info structures pointed to by the aux pointer of call
graph nodes.   

References symtab_node::aux, FOR_EACH_DEFINED_FUNCTION, free(), and NULL.

Referenced by free_toporder_info(), inline_small_functions(), propagate(), propagate_malloc(), propagate_nothrow(), and propagate_pure_const().

◆ ipa_get_nodes_in_cycle()

vec< cgraph_node * > ipa_get_nodes_in_cycle ( struct cgraph_node * node)
Get the set of nodes for the cycle in the reduced call graph starting
from NODE.   

References symtab_node::aux, ggc_alloc(), and vNULL.

Referenced by propagate(), and propagate_constants_topo().

◆ ipa_icf_cc_finalize()

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

References NULL, and ipa_icf::optimizer.

Referenced by toplev::finalize().

◆ ipa_make_function_const()

bool ipa_make_function_const ( struct cgraph_node * node,
bool looping,
bool local )
Make function const and output warning.  If LOCAL is true,
return true if anything changed.  Otherwise return true if
we may have introduced removale ctors.   

References cgraph_node::call_for_symbol_and_aliases(), cdtor_p(), dbg_cnt(), symtab_node::decl, DECL_LOOPING_CONST_OR_PURE_P, dump_file, symtab_node::dump_name(), ggc_alloc(), NULL, cgraph_node::set_const_flag(), skip_function_for_local_pure_const(), TREE_READONLY, and warn_function_const().

Referenced by propagate_pure_const().

◆ ipa_make_function_pure()

bool ipa_make_function_pure ( struct cgraph_node * node,
bool looping,
bool local )
Make function const and output warning.  If LOCAL is true,
return true if anything changed.  Otherwise return true if
we may have introduced removale ctors.   

References cgraph_node::call_for_symbol_and_aliases(), cdtor_p(), dbg_cnt(), symtab_node::decl, DECL_LOOPING_CONST_OR_PURE_P, DECL_PURE_P, dump_file, symtab_node::dump_name(), ggc_alloc(), NULL, cgraph_node::set_pure_flag(), skip_function_for_local_pure_const(), TREE_READONLY, and warn_function_pure().

Referenced by propagate_pure_const().

◆ ipa_merge_profiles()

void ipa_merge_profiles ( struct cgraph_node * dst,
struct cgraph_node * src,
bool preserve_body )
SRC and DST are going to be merged.  Take SRC's profile and merge it into
DST so it is not going to be lost.  Possibly destroy SRC's body on the way
unless PRESERVE_BODY is set.   

References symtab_node::alias, BASIC_BLOCK_FOR_FN, cgraph_edge::call_stmt, cgraph_node::callees, hash_table< Descriptor, Lazy, Allocator >::clear_slot(), compute_fn_summary(), compute_function_frequency(), copy_node(), basic_block_def::count, cgraph_node::count, cgraph_edge::count, symtab_node::decl, DECL_ARGUMENTS, DECL_INITIAL, DECL_RESULT, DECL_STRUCT_FUNCTION, symtab_node::definition, profile_count::dump(), symbol_table::dump_file, symtab_node::dump_name(), EDGE_COUNT, EDGE_SUCC, ENTRY_BLOCK_PTR_FOR_FN, hash_table< Descriptor, Lazy, Allocator >::find_slot(), cgraph_edge::first_speculative_call_target(), lto_in_decl_state::fn_decl, FOR_ALL_BB_FN, cgraph_node::frequency, lto_file_decl_data::function_decl_states, gcc_assert, cgraph_node::get_untransformed_body(), ggc_alloc(), gimple_bb(), i, basic_block_def::index, cgraph_node::indirect_calls, profile_count::initialized_p(), profile_count::ipa(), last_basic_block_for_fn, symtab_node::lto_file_data, cgraph_edge::make_speculative(), n_basic_blocks_for_fn, cgraph_edge::next_callee, profile_count::nonzero_p(), NULL, pop_cfun(), cgraph_node::profile_id, push_cfun(), cgraph_edge::redirect_callee(), cgraph_node::release_body(), cgraph_edge::resolve_speculation(), scale_ipa_profile_for_fn(), cgraph_edge::speculative, cgraph_edge::speculative_call_for_target(), symtab, cgraph_node::thunk, cgraph_node::tp_first_run, update_max_bb_count(), and profile_count::zero().

Referenced by ipa_icf::sem_function::merge().

◆ ipa_print_order()

void ipa_print_order ( FILE * out,
const char * note,
struct cgraph_node ** order,
int count )
In ipa-utils.cc   
Utilities for ipa analysis.
   Copyright (C) 2005-2024 Free Software Foundation, Inc.
   Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>

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/>.   
Debugging function for postorder and inorder code. NOTE is a string
that is printed before the nodes are printed.  ORDER is an array of
cgraph_nodes that has COUNT useful nodes in it.   

References count, ggc_alloc(), and i.

Referenced by propagate(), propagate_nothrow(), and propagate_pure_const().

◆ ipa_profile_cc_finalize()

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

References call_sums, and NULL.

Referenced by toplev::finalize().

◆ ipa_propagate_frequency()

◆ ipa_reduced_postorder()

int ipa_reduced_postorder ( struct cgraph_node ** order,
bool reduce,
bool(*)(struct cgraph_edge *) ignore_edge )
Topsort the call graph by caller relation.  Put the result in ORDER.

The REDUCE flag is true if you want the cycles reduced to single nodes.
You can use ipa_get_nodes_in_cycle to obtain a vector containing all real
call graph nodes in a reduced node.

Set ALLOW_OVERWRITABLE if nodes with such availability should be included.
IGNORE_EDGE, if non-NULL is a hook that may make some edges insignificant
for the topological sort.    

References symtab_node::aux, AVAIL_INTERPOSABLE, symbol_table::cgraph_count, env, FOR_EACH_DEFINED_FUNCTION, free(), cgraph_node::get_availability(), cgraph_node::get_uid(), ggc_alloc(), ipa_dfs_info::new_node, ipa_dfs_info::next_cycle, NULL, ipa_dfs_info::on_stack, searchc_env::reduce, searchc_env::result, searchc(), and symtab.

Referenced by build_toporder_info(), inline_small_functions(), propagate(), propagate_nothrow(), and propagate_pure_const().

◆ ipa_reverse_postorder()

◆ ipa_sra_cc_finalize()

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

References call_sums, func_sums, ggc_delete(), and NULL.

Referenced by toplev::finalize().

◆ lto_streaming_expected_p()

bool lto_streaming_expected_p ( )
inline

◆ odr_based_tbaa_p()

bool odr_based_tbaa_p ( const_tree type)
True if canonical type of TYPE is determined using ODR name.   

References get_odr_type(), odr_hash, RECORD_OR_UNION_TYPE_P, and odr_type_d::tbaa_enabled.

Referenced by gimple_canonical_types_compatible_p(), and record_component_aliases().

◆ odr_or_derived_type_p()

bool odr_or_derived_type_p ( const_tree t)
Return true if T is either ODR type or compound type based from it.
If the function return true, we know that T is a type originating from C++
source even at link-time.   

References compound_type_base(), ggc_alloc(), odr_or_derived_type_p(), odr_type_p(), TREE_CHAIN, TREE_CODE, TREE_TYPE, TREE_VALUE, TYPE_ARG_TYPES, TYPE_MAIN_VARIANT, and TYPE_METHOD_BASETYPE.

Referenced by odr_or_derived_type_p(), odr_types_equivalent_p(), and type_mismatch_p().

◆ odr_type_p()

◆ odr_type_violation_reported_p()

bool odr_type_violation_reported_p ( tree type)
Return true if we reported some ODR violation on TYPE.   

References get_odr_type(), and odr_type_d::odr_violated.

◆ odr_types_equivalent_p()

bool odr_types_equivalent_p ( tree type1,
tree type2 )
Return true if TYPE1 and TYPE2 are equivalent for One Definition Rule.   

References gcc_checking_assert, ggc_alloc(), NULL, odr_or_derived_type_p(), odr_types_equivalent_p(), UNKNOWN_LOCATION, and visited.

◆ polymorphic_ctor_dtor_p()

tree polymorphic_ctor_dtor_p ( tree fn,
bool check_clones )
Return a FUNCTION_DECL if FN represent a constructor or destructor.
If CHECK_CLONES is true, also check for clones of ctor/dtors.   

References DECL_ABSTRACT_ORIGIN, DECL_CXX_CONSTRUCTOR_P, DECL_CXX_DESTRUCTOR_P, ECF_CONST, ECF_PURE, flags_from_decl_or_type(), ggc_alloc(), NULL_TREE, TREE_CODE, and TREE_TYPE.

Referenced by inlined_polymorphic_ctor_dtor_block_p(), and remove_unused_locals().

◆ polymorphic_type_binfo_p()

bool polymorphic_type_binfo_p ( const_tree binfo)
inline
Return true if BINFO corresponds to a type with virtual methods. 

Every type has several BINFOs.  One is the BINFO associated by the type
while other represents bases of derived types.  The BINFOs representing
bases do not have BINFO_VTABLE pointer set when this is the single
inheritance (because vtables are shared).  Look up the BINFO of type
and check presence of its vtable.   

References BINFO_TYPE, BINFO_VTABLE, ggc_alloc(), and TYPE_BINFO.

Referenced by add_type_duplicate(), build_type_inheritance_graph(), compare_virtual_tables(), contains_polymorphic_type_p(), decl_maybe_in_construction_p(), get_odr_type(), odr_types_equivalent_p(), possible_placement_new(), record_known_type(), record_target_from_binfo(), record_targets_from_bases(), ipa_polymorphic_call_context::restrict_to_inner_class(), and subbinfo_with_vtable_at_offset().

◆ possible_polymorphic_call_target_p() [1/3]

bool possible_polymorphic_call_target_p ( struct cgraph_edge * e,
struct cgraph_node * n )
inline
Return true if N can be possibly target of a polymorphic call of
E.   

References cgraph_edge::indirect_info, cgraph_indirect_call_info::otr_token, cgraph_indirect_call_info::otr_type, and possible_polymorphic_call_target_p().

◆ possible_polymorphic_call_target_p() [2/3]

bool possible_polymorphic_call_target_p ( tree ref,
gimple * stmt,
struct cgraph_node * n )
Return true if N can be possibly target of a polymorphic call of
OBJ_TYPE_REF expression REF in STMT.   

References current_function_decl, ggc_alloc(), gimple_call_fn(), obj_type_ref_class(), OBJ_TYPE_REF_TOKEN, possible_polymorphic_call_target_p(), and tree_to_uhwi().

Referenced by possible_polymorphic_call_target_p().

◆ possible_polymorphic_call_target_p() [3/3]

◆ possible_polymorphic_call_targets() [1/3]

vec< cgraph_node * > possible_polymorphic_call_targets ( struct cgraph_edge * e,
bool * completep = NULL,
void ** cache_token = NULL,
bool speculative = false )
inline
Return vector containing possible targets of polymorphic call E.
If COMPLETEP is non-NULL, store true if the list is complete. 
CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
in the target cache.  If user needs to visit every target list
just once, it can memoize them.

Returned vector is placed into cache.  It is NOT caller's responsibility
to free it.  The vector can be freed on cgraph_remove_node call if
the particular node is a virtual function present in the cache.   

References ggc_alloc(), cgraph_edge::indirect_info, cgraph_indirect_call_info::otr_token, cgraph_indirect_call_info::otr_type, and possible_polymorphic_call_targets().

◆ possible_polymorphic_call_targets() [2/3]

vec< cgraph_node * > possible_polymorphic_call_targets ( tree ref,
gimple * call,
bool * completep = NULL,
void ** cache_token = NULL )
inline
Same as above but taking OBJ_TYPE_REF as an parameter.   

References current_function_decl, ggc_alloc(), obj_type_ref_class(), OBJ_TYPE_REF_TOKEN, possible_polymorphic_call_targets(), and tree_to_uhwi().

◆ possible_polymorphic_call_targets() [3/3]

vec< cgraph_node * > possible_polymorphic_call_targets ( tree otr_type,
HOST_WIDE_INT otr_token,
ipa_polymorphic_call_context context,
bool * completep,
void ** cache_token,
bool speculative )
Return vector containing possible targets of polymorphic call of type
OTR_TYPE calling method OTR_TOKEN within type of OTR_OUTER_TYPE and OFFSET.
If INCLUDE_BASES is true, walk also base types of OUTER_TYPES containing
OTR_TYPE and include their virtual method.  This is useful for types
possibly in construction or destruction where the virtual table may
temporarily change to one of base types.  INCLUDE_DERIVED_TYPES make
us to walk the inheritance graph for all derivations.

If COMPLETEP is non-NULL, store true if the list is complete. 
CACHE_TOKEN (if non-NULL) will get stored to an unique ID of entry
in the target cache.  If user needs to visit every target list
just once, it can memoize them.

If SPECULATIVE is set, the list will not contain targets that
are not speculatively taken.

Returned vector is placed into cache.  It is NOT caller's responsibility
to free it.  The vector can be freed on cgraph_remove_node call if
the particular node is a virtual function present in the cache.   

References symbol_table::add_cgraph_removal_hook(), symbol_table::add_varpool_removal_hook(), odr_type_d::all_derivations_known, BINFO_VTABLE, cached_polymorphic_call_targets, ipa_polymorphic_call_context::clear_outer_type(), ipa_polymorphic_call_context::clear_speculation(), polymorphic_call_target_d::context, decl_warn_count::count, decl_warn_count::decl, DECL_CONTEXT, DECL_CXX_DESTRUCTOR_P, DECL_FINAL_P, final_warning_record::decl_warnings, odr_type_d::derived_types, devirt_node_removal_hook(), devirt_variable_node_removal_hook(), decl_warn_count::dyn_count, final_warning_record::dyn_count, final_warning_records, hash_table< Descriptor, Lazy, Allocator >::find_slot(), gcc_assert, hash_map< KeyId, Value, Traits >::get(), get_binfo_at_offset(), get_odr_type(), hash_map< KeyId, Value, Traits >::get_or_insert(), ggc_alloc(), gimple_get_virt_method_for_binfo(), final_warning_record::grow_type_warnings(), i, odr_type_d::id, inserted, ipa_polymorphic_call_context::invalid, ipa_polymorphic_call_context::maybe_derived_type, ipa_polymorphic_call_context::maybe_in_construction, maybe_record_node(), MIN, polymorphic_call_target_d::n_odr_types, NULL, odr_hash, odr_types, odr_violation_reported, ipa_polymorphic_call_context::offset, polymorphic_call_target_d::otr_token, ipa_polymorphic_call_context::outer_type, polymorphic_call_target_hash, possible_polymorphic_call_targets_1(), record_targets_from_bases(), ipa_polymorphic_call_context::restrict_to_inner_class(), polymorphic_call_target_d::speculative, ipa_polymorphic_call_context::speculative_maybe_derived_type, ipa_polymorphic_call_context::speculative_offset, ipa_polymorphic_call_context::speculative_outer_type, symtab, timevar_pop(), timevar_push(), TREE_CODE, TREE_TYPE, type(), odr_type_d::type, polymorphic_call_target_d::type, type_all_derivations_known_p(), TYPE_BINFO, TYPE_FINAL_P, TYPE_MAIN_VARIANT, type_or_derived_type_possibly_instantiated_p(), type_possibly_instantiated_p(), final_warning_record::type_warnings, types_same_for_odr(), vNULL, and profile_count::zero().

Referenced by compute_ltrans_boundary(), dump_possible_polymorphic_call_targets(), eliminate_dom_walker::eliminate_stmt(), fold_gimple_assign(), gimple_fold_call(), ipa_devirt(), ipa_get_indirect_edge_target_1(), possible_polymorphic_call_target_p(), possible_polymorphic_call_targets(), possible_polymorphic_call_targets(), try_make_edge_direct_virtual_call(), try_speculative_devirtualization(), walk_polymorphic_call_targets(), and walk_polymorphic_call_targets().

◆ prevailing_odr_type()

tree prevailing_odr_type ( tree type)
Return type that in ODR type hash prevailed TYPE.  Be careful and punt
on ODR violations.   

References get_odr_type(), odr_type_d::odr_violated, type(), and odr_type_d::type.

Referenced by get_alias_set().

◆ rebuild_type_inheritance_graph()

void rebuild_type_inheritance_graph ( void )
Force rebuilding type inheritance graph from scratch.
This is use to make sure that we do not keep references to types
which was not visible to free_lang_data.   

References free_polymorphic_call_targets_hash(), NULL, odr_hash, and odr_types_ptr.

◆ recursive_call_p()

bool recursive_call_p ( tree func,
tree dest )
Return true if call to DEST is known to be self-recusive
call withing FUNC.   

References symtab_node::alias, AVAIL_AVAILABLE, FOR_EACH_ALIAS, gcc_assert, cgraph_node::get_create(), and ggc_alloc().

Referenced by check_call(), estimate_bb_frequencies(), find_tail_calls(), predict_loops(), and tree_bb_level_predictions().

◆ register_odr_enum()

void register_odr_enum ( tree t)
Register ODR enum so we later stream record about its values.   

References ggc_alloc(), odr_enums, and vec_safe_push().

◆ register_odr_type()

◆ set_type_canonical_for_odr_type()

void set_type_canonical_for_odr_type ( tree type,
tree canonical )
Set TYPE_CANONICAL of type and all its variants and duplicates
to CANONICAL.   

References FOR_EACH_VEC_ELT, get_odr_type(), ggc_alloc(), i, odr_type_d::type, TYPE_CANONICAL, TYPE_NEXT_VARIANT, and odr_type_d::types.

◆ stmt_may_terminate_function_p()

bool stmt_may_terminate_function_p ( function * fun,
gimple * stmt,
bool assume_return_or_eh )
Return true if stmt may terminate execution of function.
If assume_return_or_eh we can further assume that the function ends
either by retrn statement or EH (no trapping or infinite loops).   

References ECF_CONST, ECF_LOOPING_CONST_OR_PURE, ECF_PURE, get_modref_function_summary(), ggc_alloc(), gimple_asm_volatile_p(), gimple_call_flags(), gimple_could_trap_p(), NULL, modref_summary::side_effects, and stmt_can_throw_external().

Referenced by find_always_executed_bbs().

◆ subbinfo_with_vtable_at_offset()

◆ try_speculative_devirtualization()

cgraph_node * try_speculative_devirtualization ( tree otr_type,
HOST_WIDE_INT otr_token,
ipa_polymorphic_call_context ctx )
Try to speculatively devirtualize call to OTR_TYPE with OTR_TOKEN with
context CTX.   

References AVAIL_INTERPOSABLE, DECL_ARTIFICIAL, DECL_EXTERNAL, ggc_alloc(), i, likely_target_p(), NULL, and possible_polymorphic_call_targets().

Referenced by ipa_get_indirect_edge_target_1(), and try_make_edge_direct_virtual_call().

◆ type_all_derivations_known_p()

bool type_all_derivations_known_p ( const_tree t)
Return TRUE if all derived types of T are known and thus
we may consider the walk of derived type complete.

This is typically true only for final anonymous namespace types and types
defined within functions (that may be COMDAT and thus shared across units,
but with the same set of derived types).   

References decl_function_context(), ggc_alloc(), NULL, TREE_CODE, TYPE_FINAL_P, type_in_anonymous_namespace_p(), and TYPE_NAME.

Referenced by get_odr_type(), possible_polymorphic_call_targets(), possible_polymorphic_call_targets_1(), and type_known_to_have_no_derivations_p().

◆ type_in_anonymous_namespace_p()

◆ type_known_to_have_no_derivations_p()

bool type_known_to_have_no_derivations_p ( tree t)
Return true if type is known to have no derivations.   

References get_odr_type(), odr_hash, type_all_derivations_known_p(), and TYPE_FINAL_P.

Referenced by ipa_polymorphic_call_context::restrict_to_inner_class().

◆ type_with_linkage_p()

◆ types_must_be_same_for_odr()

◆ types_odr_comparable()

bool types_odr_comparable ( tree t1,
tree t2 )

◆ update_type_inheritance_graph()

void update_type_inheritance_graph ( void )

◆ vtable_pointer_value_to_binfo()

tree vtable_pointer_value_to_binfo ( const_tree t)
T is known constant value of virtual table pointer.  Return BINFO of the
instance type.   

References DECL_CONTEXT, ggc_alloc(), NULL_TREE, offset, subbinfo_with_vtable_at_offset(), TYPE_BINFO, and vtable_pointer_value_to_vtable().

◆ vtable_pointer_value_to_vtable()

bool vtable_pointer_value_to_vtable ( const_tree t,
tree * v,
unsigned HOST_WIDE_INT * offset )
T is known constant value of virtual table pointer.
Store virtual table to V and its offset to OFFSET. 
Return false if T does not look like virtual table reference.   

References DECL_VIRTUAL_P, ggc_alloc(), offset, TREE_CODE, TREE_OPERAND, and tree_to_uhwi().

Referenced by extr_type_from_vtbl_ptr_store(), gimple_get_virt_method_for_binfo(), ipa_get_indirect_edge_target_1(), subbinfo_with_vtable_at_offset(), try_make_edge_direct_virtual_call(), and vtable_pointer_value_to_binfo().

◆ warn_function_returns_nonnull()

void warn_function_returns_nonnull ( tree decl)

References ggc_alloc(), and suggest_attribute().

Referenced by execute_ranger_vrp().

◆ warn_types_mismatch()

void warn_types_mismatch ( tree t1,
tree t2,
location_t loc1,
location_t loc2 )
Types T1 and T2 was found to be incompatible in a context they can't
(either used to declare a symbol of same assembler name or unified by
ODR rule).  We already output warning about this, but if possible, output
extra information on how the types mismatch.

This is hard to do in general.  We basically handle the common cases.

If LOC1 and LOC2 are meaningful locations, use it in the case the types
themselves do not have one.   

References BUILTINS_LOCATION, COMPLETE_TYPE_P, count, DECL_NAME, DECL_SOURCE_LOCATION, expand_location(), free(), gcc_assert, get_odr_name_for_type(), ggc_alloc(), i1, i2, inform(), NULL, operand_equal_p(), POINTER_TYPE_P, prototype_p(), TREE_CHAIN, TREE_CODE, TREE_TYPE, TREE_VALUE, TYPE_ARG_TYPES, TYPE_DOMAIN, type_in_anonymous_namespace_p(), TYPE_MAIN_VARIANT, TYPE_MAX_VALUE, type_mismatch_p(), TYPE_NAME, type_with_linkage_p(), types_odr_comparable(), types_same_for_odr(), UNKNOWN_LOCATION, and warn_types_mismatch().

Referenced by add_type_duplicate(), odr_types_equivalent_p(), and warn_types_mismatch().

Variable Documentation

◆ thunk_expansion

bool thunk_expansion
extern
HACK alert: this is used to communicate with ipa-inline-transform that
thunk is being expanded and there is no need to clear the polymorphic
call target cache.   

Referenced by devirt_node_removal_hook(), and inline_call().