GCC Middle and Back End API Reference
|
#include <ipa-icf.h>
Static Public Member Functions | |
static sem_function * | parse (cgraph_node *node, bitmap_obstack *stack, ipa_icf_gimple::func_checker *checker) |
static bool | get_base_types (tree *t1, tree *t2) |
Data Fields | |
eh_region | region_tree |
unsigned int | arg_count |
unsigned int | edge_count |
vec< unsigned int > | bb_sizes |
hashval_t | cfg_checksum |
hashval_t | gcode_hash |
auto_vec< tree > | memory_access_types |
unsigned | ssa_names_size |
vec< ipa_icf_gimple::sem_bb * > | bb_sorted |
hashval_t | m_alias_sets_hash |
sem_item_type | type |
symtab_node * | node |
tree | decl |
unsigned | reference_count |
congruence_class * | cls |
unsigned int | index_in_class |
bitmap | usage_index_bitmap |
vec< tree > | tree_refs |
hash_set< symtab_node * > | refs_set |
hashval_t | global_hash |
unsigned | referenced_by_count |
Protected Member Functions | |
void | hash_referenced_symbol_properties (symtab_node *ref, inchash::hash &hstate, bool address) |
bool | compare_symbol_references (hash_map< symtab_node *, sem_item * > &ignored_nodes, symtab_node *n1, symtab_node *n2, bool address) |
Static Protected Member Functions | |
static bool | compare_referenced_symbol_properties (symtab_node *used_by, symtab_node *n1, symtab_node *n2, bool address) |
Protected Attributes | |
hashval_t | m_hash |
bool | m_hash_set |
Private Member Functions | |
hashval_t | get_bb_hash (const ipa_icf_gimple::sem_bb *basic_block) |
bool | compare_phi_node (basic_block bb1, basic_block bb2) |
bool | bb_dict_test (vec< int > *bb_dict, int source, int target) |
bool | compare_edge_flags (cgraph_edge *e1, cgraph_edge *e2) |
bool | equals_private (sem_item *item) |
void | setup (bitmap_obstack *stack) |
Private Attributes | |
ipa_icf_gimple::func_checker * | m_checker |
sem_function * | m_compared_func |
Static Private Attributes | |
static hash_map< const_tree, hashval_t > | m_type_hash_cache |
ipa_icf::sem_function::sem_function | ( | bitmap_obstack * | stack | ) |
ipa_icf::sem_function::sem_function | ( | cgraph_node * | _node, |
bitmap_obstack * | stack ) |
Add reference to a semantic TARGET.
References hash_set< KeyId, Lazy, Traits >::add(), bitmap_set_bit, ipa_icf::sem_item::node, ipa_icf::sem_item::reference_count, ipa_icf::sem_item::referenced_by_count, refs, ipa_icf::sem_item::refs_set, and ipa_icf::sem_item::usage_index_bitmap.
Referenced by ipa_icf::sem_item_optimizer::build_graph().
Basic blocks dictionary BB_DICT returns true if SOURCE index BB corresponds to TARGET.
Referenced by equals_private().
|
private |
If cgraph edges E1 and E2 are indirect calls, verify that ECF flags are the same.
References cgraph_indirect_call_info::ecf_flags, cgraph_edge::indirect_info, and return_false_with_msg.
Referenced by equals_wpa().
|
private |
For given basic blocks BB1 and BB2 (from functions FUNC1 and FUNC), return true if phi nodes are semantically equivalent in these blocks .
References ipa_icf_gimple::func_checker::compare_edge(), ipa_icf_gimple::func_checker::compare_operand(), gcc_assert, gimple_phi_arg(), gimple_phi_arg_edge(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_next_nonvirtual_phi(), gsi_start_nonvirtual_phis(), i, m_checker, NULL, ipa_icf_gimple::func_checker::OP_NORMAL, gphi_iterator::phi(), return_false, and return_false_with_msg.
Referenced by equals_private().
bool ipa_icf::sem_function::compare_polymorphic_p | ( | void | ) |
Return true if polymorphic comparison must be processed.
References cgraph_edge::callee, symtab_node::decl, symtab_node::definition, get_node(), cgraph_edge::next_callee, NULL, and opt_for_fn.
Referenced by equals_wpa().
|
staticprotectedinherited |
Compare properties of symbols N1 and N2 that does not affect semantics of symbol itself but affects semantics of its references from USED_BY (which may be NULL if it is unknown). If comparison is false, symbols can still be merged but any symbols referring them can't. If ADDRESS is true, do extra checking needed for IPA_REF_ADDR. TODO: We can also split attributes to those that determine codegen of a function body/variable constructor itself and those that are used when referring to it.
References attribute_list_equal(), AVAIL_INTERPOSABLE, comp_type_attributes(), symtab_node::decl, DECL_ALIGN, DECL_ATTRIBUTES, DECL_CONTEXT, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, DECL_FINAL_P, DECL_IS_OPERATOR_NEW_P, DECL_IS_REPLACEABLE_OPERATOR, DECL_UNINLINABLE, DECL_VIRTUAL_P, symtab_node::get_availability(), is_a(), opt_for_fn, return_false_with_msg, TREE_TYPE, and types_must_be_same_for_odr().
Referenced by ipa_icf::sem_item::compare_symbol_references(), and merge().
|
protectedinherited |
For a given symbol table nodes N1 and N2, we check that FUNCTION_DECLs point to a same function. Comparison can be skipped if IGNORED_NODES contains these nodes. ADDRESS indicate if address is taken.
References AVAIL_INTERPOSABLE, ipa_icf::sem_item::compare_referenced_symbol_properties(), symtab_node::equal_address_to(), hash_map< KeyId, Value, Traits >::get(), is_a(), ipa_icf::sem_item::node, return_false_with_msg, symtab_node::semantically_equivalent_p(), and symtab_node::ultimate_alias_target().
Referenced by equals_wpa(), and ipa_icf::sem_variable::equals_wpa().
Perform additional check needed to match types function parameters that are used. Unlike for normal decls it matters if type is TYPE_RESTRICT and we make an assumption that REFERENCE_TYPE parameters are always non-NULL.
References ipa_icf_gimple::func_checker::compatible_types_p(), opt_for_fn, POINTER_TYPE_P, return_false_with_msg, TREE_CODE, and TYPE_RESTRICT.
Referenced by equals_private(), and equals_wpa().
|
inherited |
Dump function for debugging purpose.
References symtab_node::decl, dump_file, symtab_node::dump_name(), ipa_icf::FUNC, ipa_icf::sem_item::get_hash(), and ipa_icf::sem_item::node.
|
inlinefinaloverridevirtual |
Implements ipa_icf::sem_item.
References dump_function_to_file(), gcc_assert, and TDF_DETAILS.
|
finaloverridevirtual |
Returns true if the item equals to ITEM given as argument.
Implements ipa_icf::sem_item.
References dump_file, dump_flags, symtab_node::dump_name(), equals_private(), ipa_icf::FUNC, gcc_assert, m_checker, ipa_icf::sem_item::node, NULL, TDF_DETAILS, and ipa_icf::sem_item::type.
Processes function equality comparison.
References bb_dict_test(), bb_sorted, cfg_checksum, ipa_icf_gimple::func_checker::compare_bb(), ipa_icf_gimple::func_checker::compare_decl(), ipa_icf_gimple::func_checker::compare_edge(), compare_phi_node(), compatible_parm_types_p(), ipa_icf::sem_item::decl, DECL_ARGUMENTS, DECL_CHAIN, DECL_STATIC_CHAIN, dyn_cast(), edge_count, ei_cond(), ei_next(), ei_start, ipa_icf::FUNC, gcc_assert, i, m_checker, m_compared_func, ipa_icf::sem_item::node, opt_for_fn, param_used_p(), ipa_icf_gimple::func_checker::parse_labels(), basic_block_def::preds, ipa_icf::sem_item::refs_set, return_false, return_false_with_msg, TREE_TYPE, ipa_icf::sem_item::type, and types_compatible_p().
Referenced by equals().
|
finaloverridevirtual |
Fast equality function based on knowledge known in WPA.
Implements ipa_icf::sem_item.
References ipa_ref::address_matters_p(), attribute_list_equal(), cgraph_edge::callee, comp_type_attributes(), compare_edge_flags(), compare_polymorphic_p(), ipa_icf::sem_item::compare_symbol_references(), compatible_parm_types_p(), ipa_icf_gimple::func_checker::compatible_polymorphic_types_p(), ipa_icf_gimple::func_checker::compatible_types_p(), ipa_icf::sem_item::decl, DECL_ATTRIBUTES, DECL_CXX_CONSTRUCTOR_P, DECL_CXX_DESTRUCTOR_P, DECL_FUNCTION_PERSONALITY, DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK, DECL_STATIC_CHAIN, dump_file, dump_flags, dyn_cast(), flags_from_decl_or_type(), cgraph_node::former_thunk_p(), ipa_icf::FUNC, gcc_assert, thunk_info::get(), i, symtab_node::iterate_reference(), m_compared_func, cgraph_edge::next_callee, ipa_icf::sem_item::node, NULL, symtab_node::num_references(), opt_for_fn, opts_for_fn(), param_used_p(), ipa_ref::referred, return_false_with_msg, target_opts_for_fn(), TDF_DETAILS, cgraph_node::thunk, TREE_CHAIN, TREE_CODE, TREE_TYPE, TREE_VALUE, ipa_icf::sem_item::type, TYPE_ARG_TYPES, TYPE_METHOD_BASETYPE, types_compatible_p(), and ipa_ref::use.
|
private |
Calculates hash value based on a BASIC_BLOCK.
References inchash::hash::add_int(), and inchash::hash::end().
Referenced by get_hash().
|
finaloverridevirtual |
References independent hash function.
Implements ipa_icf::sem_item.
References inchash::hash::add_flag(), inchash::hash::add_hwi(), inchash::hash::add_int(), arg_count, bb_sizes, bb_sorted, cfg_checksum, DECL_CXX_CONSTRUCTOR_P, DECL_CXX_DESTRUCTOR_P, DECL_FUNCTION_SPECIFIC_OPTIMIZATION, DECL_FUNCTION_SPECIFIC_TARGET, DECL_STATIC_CHAIN, inchash::hash::end(), gcode_hash, get_bb_hash(), i, ipa_icf::sem_item::m_hash, ipa_icf::sem_item::m_hash_set, inchash::hash::merge_hash(), ipa_icf::sem_item::set_hash(), TREE_OPTIMIZATION, and TREE_TARGET_OPTION.
Referenced by ipa_icf::sem_item_optimizer::update_hash_by_memory_access_type().
|
inline |
References dyn_cast(), and ipa_icf::sem_item::node.
Referenced by compare_polymorphic_p(), init(), merge(), and param_used_p().
|
protectedinherited |
Hash properties that are compared by compare_referenced_symbol_properties.
References inchash::hash::add_flag(), inchash::hash::add_int(), symtab_node::decl, DECL_ALIGN, DECL_DECLARED_INLINE_P, DECL_DISREGARD_INLINE_LIMITS, DECL_IS_OPERATOR_NEW_P, DECL_UNINLINABLE, DECL_VIRTUAL_P, ipa_icf::FUNC, is_a(), and opt_for_fn.
Referenced by ipa_icf::sem_item::update_hash_by_addr_refs().
void ipa_icf::sem_function::hash_stmt | ( | gimple * | stmt, |
inchash::hash & | hstate ) |
Improve accumulated hash for HSTATE based on a gimple statement STMT.
References inchash::hash::add_flag(), inchash::hash::add_int(), ao_ref_alias_ptr_type(), ao_ref_base_alias_ptr_type(), ao_ref_init(), as_a(), CF_BRANCH, ipa_icf_gimple::func_checker::classify_operands(), ipa_icf_gimple::func_checker::get_operand_access_type(), gimple_assign_rhs_code(), gimple_call_nocf_check_p(), gimple_num_ops(), gimple_op(), gimple_switch_index(), ipa_icf_gimple::func_checker::hash_operand(), i, lto_streaming_expected_p(), m_checker, map, memory_access_types, NULL_TREE, ipa_icf_gimple::func_checker::OP_MEMORY, ipa_icf_gimple::func_checker::OP_NORMAL, and variably_modified_type_p().
Referenced by init().
|
finaloverridevirtual |
Semantic item initialization function.
Implements ipa_icf::sem_item.
References inchash::hash::add_int(), arg_count, bb_sizes, bb_sorted, cfg_checksum, inchash::hash::commit_flag(), count_formal_params(), coverage_compute_cfg_checksum(), symtab_node::decl, DECL_STRUCT_FUNCTION, dyn_cast(), EDGE_COUNT, edge_count, function::eh, ei_cond(), ei_next(), ei_start, inchash::hash::end(), FOR_EACH_BB_FN, gcc_assert, gcode_hash, thunk_info::get(), get_node(), cgraph_node::get_untransformed_body(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_next_nonvirtual_phi(), gsi_start_bb(), gsi_start_nonvirtual_phis(), gsi_stmt(), thunk_info::hash(), ipa_icf_gimple::func_checker::hash_operand(), hash_stmt(), i, iterative_hash_host_wide_int(), m_checker, n_edges_for_fn, ipa_icf::sem_item::node, NULL, ipa_icf_gimple::func_checker::OP_NORMAL, basic_block_def::preds, eh_status::region_tree, region_tree, si, ssa_names_size, SSANAMES, basic_block_def::succs, and cgraph_node::thunk.
Referenced by parse().
Merges instance with an ALIAS_ITEM, where alias, thunk or redirection can be applied.
Implements ipa_icf::sem_item.
References symtab_node::address_matters_p(), symtab_node::address_taken, AUTO_DUMP_SCOPE, AVAIL_INTERPOSABLE, symtab_node::body_removed, symbol_table::call_cgraph_insertion_hooks(), symbol_table::call_cgraph_removal_hooks(), cgraph_node::call_for_symbol_and_aliases(), cgraph_node::call_for_symbol_thunks_and_aliases(), symtab_node::can_be_discarded_p(), cgraph_node::can_remove_if_no_direct_calls_p(), ipa_icf::clear_decl_rtl(), symtab_node::comdat_local_p(), ipa_icf::sem_item::compare_referenced_symbol_properties(), cgraph_node::create_alias(), cgraph_node::create_wrapper(), ipa_icf::sem_item::decl, symtab_node::decl, DECL_ATTRIBUTES, decl_binds_to_current_def_p(), DECL_COMDAT_GROUP, DECL_EXTERNAL, DECL_NO_INLINE_WARNING_P, DECL_SECTION_NAME, DECL_STATIC_CHAIN, DECL_VIRTUAL_P, dump_enabled_p(), dump_printf(), dyn_cast(), dump_user_location_t::from_function_decl(), ipa_icf::FUNC, gcc_assert, cgraph_node::get_availability(), symtab_node::get_comdat_group(), get_node(), symtab_node::has_aliases_p(), cgraph_node::has_thunk_p(), cgraph_node::icf_merged, symtab_node::implicit_section, symtab_node::in_same_comdat_group_p(), ipa_fn_summaries, ipa_merge_profiles(), ipa_size_summaries, cgraph_node::local_p(), lookup_attribute(), cgraph_node::merged_comdat, MSG_MISSED_OPTIMIZATION, MSG_NOTE, MSG_OPTIMIZED_LOCATIONS, ipa_icf::sem_item::node, symtab_node::noninterposable_alias(), NULL, ipa_icf::redirect_all_callers(), cgraph_node::release_body(), symtab_node::reset(), symtab_node::resolution, symtab_node::resolve_alias(), ipa_icf::set_local(), stdarg_p(), symtab, ipa_icf::sem_item::target_supports_symbol_aliases_p(), TREE_TYPE, and ipa_icf::sem_item::type.
bool ipa_icf::sem_function::param_used_p | ( | unsigned int | i | ) |
Return true if parameter I may be used.
References ipa_node_params::descriptors, get_node(), i, ipa_is_param_used(), ipa_node_params_sum, NULL, and vec_safe_length().
Referenced by equals_private(), and equals_wpa().
|
static |
For a given call graph NODE, the function constructs new semantic function item.
References symtab_node::decl, DECL_ATTRIBUTES, DECL_STATIC_CONSTRUCTOR, DECL_STATIC_DESTRUCTOR, DECL_STRUCT_FUNCTION, init(), lookup_attribute_by_prefix(), ipa_icf::sem_item::node, NULL, and sem_function().
Referenced by ipa_icf::sem_item_optimizer::parse_funcs_and_vars().
|
inherited |
|
privateinherited |
Initialize internal data structures. Bitmap STACK is used for bitmap memory allocation process.
References BITMAP_ALLOC, gcc_checking_assert, ipa_icf::sem_item::node, ipa_icf::sem_item::reference_count, ipa_icf::sem_item::tree_refs, and ipa_icf::sem_item::usage_index_bitmap.
Referenced by ipa_icf::sem_item::sem_item(), and ipa_icf::sem_item::sem_item().
|
inherited |
Return true if target supports alias symbols.
References gcc_checking_assert, and TARGET_SUPPORTS_ALIASES.
Referenced by merge(), and ipa_icf::sem_variable::merge().
|
inherited |
Update hash by address sensitive references. We iterate over all sensitive references (address_matters_p) and we hash ultimate alias target of these nodes, which can improve a semantic item hash. Also hash in referenced symbols properties. This can be done at any time (as the properties should not change), but it is convenient to do it here while we walk the references anyway.
References inchash::hash::add_int(), ipa_ref::address_matters_p(), dyn_cast(), inchash::hash::end(), ipa_icf::sem_item::get_hash(), ipa_icf::sem_item::hash_referenced_symbol_properties(), i, IPA_REF_ADDR, is_a(), symtab_node::iterate_reference(), ipa_icf::sem_item::node, symtab_node::order, ipa_ref::referred, ipa_icf::sem_item::set_hash(), symtab_node::ultimate_alias_target(), and ipa_ref::use.
|
inherited |
Update hash by computed local hash values taken from different semantic items. TODO: stronger SCC based hashing would be desirable here.
References dyn_cast(), ipa_icf::FUNC, ipa_icf::sem_item::get_hash(), ipa_icf::sem_item::global_hash, symtab_node::iterate_reference(), ipa_icf::sem_item::node, and ipa_ref::referring.
unsigned int ipa_icf::sem_function::arg_count |
Referenced by get_hash(), and init().
vec<unsigned int> ipa_icf::sem_function::bb_sizes |
Referenced by get_hash(), init(), sem_function(), sem_function(), and ~sem_function().
vec<ipa_icf_gimple::sem_bb *> ipa_icf::sem_function::bb_sorted |
Referenced by equals_private(), get_hash(), init(), sem_function(), sem_function(), and ~sem_function().
hashval_t ipa_icf::sem_function::cfg_checksum |
Referenced by equals_private(), get_hash(), and init().
|
inherited |
|
inherited |
unsigned int ipa_icf::sem_function::edge_count |
Referenced by equals_private(), and init().
hashval_t ipa_icf::sem_function::gcode_hash |
Referenced by get_hash(), and init().
|
inherited |
Referenced by ipa_icf::sem_item::update_hash_by_local_refs().
|
inherited |
hashval_t ipa_icf::sem_function::m_alias_sets_hash |
|
private |
Referenced by compare_phi_node(), equals(), equals_private(), hash_stmt(), and init().
|
private |
Referenced by equals_private(), and equals_wpa().
|
protectedinherited |
Referenced by get_hash(), ipa_icf::sem_variable::get_hash(), and ipa_icf::sem_item::set_hash().
|
protectedinherited |
|
staticprivateinherited |
|
inherited |
Referenced by ipa_icf::sem_item::add_reference(), ipa_icf::sem_item_optimizer::build_graph(), ipa_icf::sem_item::compare_symbol_references(), ipa_icf::sem_item::dump(), equals(), ipa_icf::sem_variable::equals(), equals_private(), equals_wpa(), ipa_icf::sem_variable::equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), get_node(), ipa_icf::sem_variable::get_node(), init(), ipa_icf::sem_variable::init(), merge(), ipa_icf::sem_variable::merge(), ipa_icf::sem_item_optimizer::merge_classes(), parse(), ipa_icf::sem_variable::parse(), ipa_icf::sem_item_optimizer::remove_item(), ipa_icf::sem_item::sem_item(), ipa_icf::sem_variable::sem_variable(), ipa_icf::sem_item::setup(), ipa_icf::sem_item_optimizer::subdivide_classes_by_sensitive_refs(), gdbhooks.TreePrinter::to_string(), ipa_icf::sem_item::update_hash_by_addr_refs(), and ipa_icf::sem_item::update_hash_by_local_refs().
|
inherited |
Referenced by ipa_icf::sem_item::add_reference(), and ipa_icf::sem_item::setup().
|
inherited |
Referenced by ipa_icf::sem_item_optimizer::add_item_to_class(), and ipa_icf::sem_item::add_reference().
|
inherited |
Referenced by ipa_icf::sem_item::add_reference(), and equals_private().
unsigned ipa_icf::sem_function::ssa_names_size |
Referenced by init().
Referenced by ipa_icf::sem_item::setup(), and ipa_icf::sem_item::~sem_item().
|
inherited |
Referenced by ipa_icf::sem_item_optimizer::build_graph(), ipa_icf::sem_item_optimizer::build_hash_based_classes(), equals(), ipa_icf::sem_variable::equals(), equals_private(), equals_wpa(), ipa_icf::sem_variable::equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), merge(), ipa_icf::sem_variable::merge(), and ipa_icf::sem_item_optimizer::merge_classes().
|
inherited |
Referenced by ipa_icf::sem_item::add_reference(), ipa_icf::sem_item::setup(), and ipa_icf::sem_item::~sem_item().