GCC Middle and Back End API Reference
|
#include <ipa-icf.h>
Public Member Functions | |
sem_variable (bitmap_obstack *stack) | |
sem_variable (varpool_node *_node, bitmap_obstack *stack) | |
void | init (ipa_icf_gimple::func_checker *) final override |
hashval_t | get_hash (void) final override |
bool | merge (sem_item *alias_item) final override |
void | dump_to_file (FILE *file) final override |
bool | equals (sem_item *item, hash_map< symtab_node *, sem_item * > &ignored_nodes) final override |
bool | equals_wpa (sem_item *item, hash_map< symtab_node *, sem_item * > &ignored_nodes) final override |
varpool_node * | get_node (void) |
DEBUG_FUNCTION void | dump (void) |
void | add_reference (ref_map *map, sem_item *target) |
void | set_hash (hashval_t hash) |
void | update_hash_by_addr_refs (hash_map< symtab_node *, sem_item * > &m_symtab_node_map) |
void | update_hash_by_local_refs (hash_map< symtab_node *, sem_item * > &m_symtab_node_map) |
bool | target_supports_symbol_aliases_p (void) |
Static Public Member Functions | |
static sem_variable * | parse (varpool_node *node, bitmap_obstack *stack, ipa_icf_gimple::func_checker *checker) |
static bool | get_base_types (tree *t1, tree *t2) |
Data Fields | |
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 | |
void | setup (bitmap_obstack *stack) |
Static Private Member Functions | |
static bool | equals (tree t1, tree t2) |
Static Private Attributes | |
static hash_map< const_tree, hashval_t > | m_type_hash_cache |
ipa_icf::sem_variable::sem_variable | ( | bitmap_obstack * | stack | ) |
Referenced by parse().
ipa_icf::sem_variable::sem_variable | ( | varpool_node * | _node, |
bitmap_obstack * | stack ) |
References gcc_checking_assert, get_node(), and ipa_icf::sem_item::node.
Add reference to a semantic TARGET.
References hash_set< KeyId, Lazy, Traits >::add(), bitmap_set_bit, hash_map< KeyId, Value, Traits >::get_or_insert(), ipa_icf::sem_item::node, ipa_icf::sem_item::reference_count, ipa_icf::sem_item::referenced_by_count, ipa_icf::sem_item::refs_set, and ipa_icf::sem_item::usage_index_bitmap.
Referenced by ipa_icf::sem_item_optimizer::build_graph().
|
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 ipa_icf::sem_function::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 ipa_icf::sem_function::equals_wpa(), 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.
|
finaloverridevirtual |
|
finaloverridevirtual |
Returns true if the item equals to ITEM given as argument.
Implements ipa_icf::sem_item.
References ipa_icf_gimple::func_checker::compatible_types_p(), ipa_icf::sem_item::decl, symtab_node::decl, DECL_INITIAL, dump_file, dump_flags, symtab_node::dump_name(), dyn_cast(), equals(), error_mark_node, gcc_assert, ipa_icf::sem_item::node, return_false_with_msg, TDF_DETAILS, TREE_TYPE, ipa_icf::sem_item::type, and ipa_icf::VAR.
Compares trees T1 and T2 for semantic equality.
References array_ref_element_size(), array_ref_low_bound(), vector_builder< tree, tree, tree_vector_builder >::binary_encoded_nelts(), CASE_CONVERT, ipa_icf_gimple::func_checker::compatible_types_p(), CONSTRUCTOR_ELTS, count, decl_in_symtab_p(), equals(), FIXED_VALUES_IDENTICAL, i, constructor_elt::index, int_size_in_bytes(), known_eq, real_identical(), return_false, return_false_with_msg, return_with_debug, wi::to_poly_offset(), TREE_CODE, TREE_FIXED_CST, TREE_IMAGPART, tree_int_cst_equal(), TREE_OPERAND, TREE_REAL_CST, TREE_REALPART, TREE_STRING_LENGTH, TREE_STRING_POINTER, TREE_TYPE, TYPE_MODE, TYPE_PRECISION, constructor_elt::value, vec_safe_length(), VECTOR_CST_ENCODED_ELT, and VECTOR_CST_NELTS.
|
finaloverridevirtual |
Fast equality function based on knowledge known in WPA.
Implements ipa_icf::sem_item.
References ipa_ref::address_matters_p(), ipa_icf::sem_item::compare_symbol_references(), ipa_icf::sem_item::decl, DECL_IN_TEXT_SECTION, DECL_SECTION_NAME, DECL_SIZE, DECL_TLS_MODEL, DECL_VIRTUAL_P, gcc_assert, i, symtab_node::implicit_section, symtab_node::iterate_reference(), ipa_icf::sem_item::node, NULL, symtab_node::num_references(), OEP_ONLY_CONST, operand_equal_p(), ipa_ref::referred, return_false_with_msg, TREE_TYPE, ipa_icf::sem_item::type, TYPE_ADDR_SPACE, ipa_ref::use, and ipa_icf::VAR.
|
finaloverridevirtual |
References independent hash function.
Implements ipa_icf::sem_item.
References gcc_checking_assert, ipa_icf::sem_item::m_hash, and ipa_icf::sem_item::m_hash_set.
|
inline |
References dyn_cast(), and ipa_icf::sem_item::node.
Referenced by init(), merge(), and sem_variable().
|
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().
|
finaloverridevirtual |
Semantic variable initialization function.
Implements ipa_icf::sem_item.
References inchash::hash::add_int(), symtab_node::decl, DECL_INITIAL, inchash::hash::end(), gcc_assert, get_node(), ipa_icf_gimple::func_checker::hash_operand(), symtab_node::lto_file_data, ipa_icf::sem_item::m_hash_set, ipa_icf::sem_item::node, and ipa_icf::sem_item::set_hash().
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::alias, symtab_node::analyzed, AUTO_DUMP_SCOPE, varpool_node::call_for_symbol_and_aliases(), symtab_node::can_be_discarded_p(), ipa_icf::clear_decl_rtl(), varpool_node::create_alias(), ipa_icf::sem_item::decl, symtab_node::decl, DECL_ALIGN, decl_binds_to_current_def_p(), DECL_COMDAT_GROUP, DECL_EXTERNAL, DECL_IN_CONSTANT_POOL, DECL_INITIAL, DECL_SECTION_NAME, dump_enabled_p(), dump_printf(), dump_user_location_t::from_function_decl(), gcc_assert, get_node(), symtab_node::implicit_section, MSG_MISSED_OPTIMIZATION, MSG_OPTIMIZED_LOCATIONS, ipa_icf::sem_item::node, NULL, symtab_node::remove_all_references(), symtab_node::resolution, symtab_node::resolve_alias(), SANITIZE_ADDRESS, sanitize_flags_p(), ipa_icf::set_addressable(), ipa_icf::sem_item::target_supports_symbol_aliases_p(), TREE_ADDRESSABLE, TREE_ASM_WRITTEN, ipa_icf::sem_item::type, and ipa_icf::VAR.
|
static |
Parser function that visits a varpool NODE.
References symtab_node::alias, symtab_node::decl, DECL_HARD_REGISTER, init(), ipa_icf::sem_item::node, NULL, sem_variable(), and TREE_THIS_VOLATILE.
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 ipa_icf::sem_function::merge(), and 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.
|
inherited |
|
inherited |
|
inherited |
Referenced by ipa_icf::sem_item::update_hash_by_local_refs().
|
inherited |
|
protectedinherited |
Referenced by ipa_icf::sem_function::get_hash(), get_hash(), and ipa_icf::sem_item::set_hash().
|
protectedinherited |
Referenced by ipa_icf::sem_function::get_hash(), get_hash(), init(), and ipa_icf::sem_item::set_hash().
|
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(), ipa_icf::sem_function::equals(), equals(), ipa_icf::sem_function::equals_private(), ipa_icf::sem_function::equals_wpa(), equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), ipa_icf::sem_function::get_node(), get_node(), ipa_icf::sem_function::init(), init(), ipa_icf::sem_function::merge(), merge(), ipa_icf::sem_item_optimizer::merge_classes(), ipa_icf::sem_function::parse(), parse(), ipa_icf::sem_item_optimizer::remove_item(), ipa_icf::sem_item::sem_item(), 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 ipa_icf::sem_function::equals_private().
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(), ipa_icf::sem_function::equals(), equals(), ipa_icf::sem_function::equals_private(), ipa_icf::sem_function::equals_wpa(), equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), ipa_icf::sem_function::merge(), 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().