GCC Middle and Back End API Reference
|
#include <ipa-icf.h>
Public Member Functions | |
sem_item (sem_item_type _type, bitmap_obstack *stack) | |
sem_item (sem_item_type _type, symtab_node *_node, bitmap_obstack *stack) | |
virtual | ~sem_item () |
DEBUG_FUNCTION void | dump (void) |
virtual void | init (ipa_icf_gimple::func_checker *)=0 |
void | add_reference (ref_map *map, sem_item *target) |
virtual bool | equals_wpa (sem_item *item, hash_map< symtab_node *, sem_item * > &ignored_nodes)=0 |
virtual bool | equals (sem_item *item, hash_map< symtab_node *, sem_item * > &ignored_nodes)=0 |
virtual hashval_t | get_hash (void)=0 |
void | set_hash (hashval_t hash) |
virtual bool | merge (sem_item *alias_item)=0 |
virtual void | dump_to_file (FILE *file)=0 |
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 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 Attributes | |
static hash_map< const_tree, hashval_t > | m_type_hash_cache |
Semantic item is a base class that encapsulates all shared functionality for both semantic function and variable items.
ipa_icf::sem_item::sem_item | ( | sem_item_type | _type, |
bitmap_obstack * | stack ) |
References setup().
ipa_icf::sem_item::sem_item | ( | sem_item_type | _type, |
symtab_node * | _node, | ||
bitmap_obstack * | stack ) |
References symtab_node::decl, node, and setup().
|
virtual |
References BITMAP_FREE, tree_refs, and usage_index_bitmap.
Add reference to a semantic TARGET.
References hash_set< KeyId, Lazy, Traits >::add(), bitmap_set_bit, hash_map< KeyId, Value, Traits >::get_or_insert(), node, reference_count, referenced_by_count, refs_set, and usage_index_bitmap.
Referenced by ipa_icf::sem_item_optimizer::build_graph().
|
staticprotected |
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 compare_symbol_references(), and ipa_icf::sem_function::merge().
|
protected |
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, compare_referenced_symbol_properties(), symtab_node::equal_address_to(), hash_map< KeyId, Value, Traits >::get(), is_a(), 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 ipa_icf::sem_variable::equals_wpa().
DEBUG_FUNCTION void ipa_icf::sem_item::dump | ( | void | ) |
Dump function for debugging purpose.
References symtab_node::decl, dump_file, symtab_node::dump_name(), ipa_icf::FUNC, get_hash(), and node.
|
pure virtual |
Implemented in ipa_icf::sem_function, and ipa_icf::sem_variable.
Referenced by ipa_icf::sem_item_optimizer::merge_classes().
|
pure virtual |
Implemented in ipa_icf::sem_function, and ipa_icf::sem_variable.
Referenced by ipa_icf::sem_item_optimizer::subdivide_classes_by_equality().
|
pure virtual |
Implemented in ipa_icf::sem_function, and ipa_icf::sem_variable.
Referenced by ipa_icf::sem_item_optimizer::subdivide_classes_by_equality().
|
pure virtual |
Implemented in ipa_icf::sem_function, and ipa_icf::sem_variable.
Referenced by ipa_icf::sem_item_optimizer::build_graph(), ipa_icf::sem_item_optimizer::build_hash_based_classes(), dump(), update_hash_by_addr_refs(), and update_hash_by_local_refs().
|
protected |
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 update_hash_by_addr_refs().
|
pure virtual |
Implemented in ipa_icf::sem_function, and ipa_icf::sem_variable.
Implemented in ipa_icf::sem_function, and ipa_icf::sem_variable.
Referenced by ipa_icf::sem_item_optimizer::merge_classes().
void ipa_icf::sem_item::set_hash | ( | hashval_t | hash | ) |
|
private |
Initialize internal data structures. Bitmap STACK is used for bitmap memory allocation process.
References BITMAP_ALLOC, gcc_checking_assert, node, reference_count, tree_refs, and usage_index_bitmap.
Referenced by sem_item(), and sem_item().
bool ipa_icf::sem_item::target_supports_symbol_aliases_p | ( | void | ) |
Return true if target supports alias symbols.
References gcc_checking_assert, and TARGET_SUPPORTS_ALIASES.
Referenced by ipa_icf::sem_function::merge(), and ipa_icf::sem_variable::merge().
void ipa_icf::sem_item::update_hash_by_addr_refs | ( | hash_map< symtab_node *, sem_item * > & | m_symtab_node_map | ) |
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(), get_hash(), hash_referenced_symbol_properties(), i, IPA_REF_ADDR, is_a(), symtab_node::iterate_reference(), node, symtab_node::order, ipa_ref::referred, set_hash(), symtab_node::ultimate_alias_target(), and ipa_ref::use.
void ipa_icf::sem_item::update_hash_by_local_refs | ( | hash_map< symtab_node *, sem_item * > & | m_symtab_node_map | ) |
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, get_hash(), global_hash, symtab_node::iterate_reference(), node, and ipa_ref::referring.
congruence_class* ipa_icf::sem_item::cls |
tree ipa_icf::sem_item::decl |
Referenced by ipa_icf::sem_variable::equals(), ipa_icf::sem_function::equals_private(), ipa_icf::sem_function::equals_wpa(), ipa_icf::sem_variable::equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), ipa_icf::sem_function::merge(), ipa_icf::sem_variable::merge(), and ipa_icf::sem_item_optimizer::merge_classes().
hashval_t ipa_icf::sem_item::global_hash |
Referenced by update_hash_by_local_refs().
unsigned int ipa_icf::sem_item::index_in_class |
|
protected |
Referenced by ipa_icf::sem_function::get_hash(), ipa_icf::sem_variable::get_hash(), and set_hash().
|
protected |
|
staticprivate |
symtab_node* ipa_icf::sem_item::node |
Referenced by add_reference(), ipa_icf::sem_item_optimizer::build_graph(), compare_symbol_references(), dump(), ipa_icf::sem_function::equals(), ipa_icf::sem_variable::equals(), ipa_icf::sem_function::equals_private(), ipa_icf::sem_function::equals_wpa(), ipa_icf::sem_variable::equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), ipa_icf::sem_function::get_node(), ipa_icf::sem_variable::get_node(), ipa_icf::sem_function::init(), ipa_icf::sem_variable::init(), ipa_icf::sem_function::merge(), ipa_icf::sem_variable::merge(), ipa_icf::sem_item_optimizer::merge_classes(), ipa_icf::sem_function::parse(), ipa_icf::sem_variable::parse(), ipa_icf::sem_item_optimizer::remove_item(), sem_item(), ipa_icf::sem_variable::sem_variable(), setup(), ipa_icf::sem_item_optimizer::subdivide_classes_by_sensitive_refs(), gdbhooks.TreePrinter::to_string(), update_hash_by_addr_refs(), and update_hash_by_local_refs().
unsigned ipa_icf::sem_item::reference_count |
Referenced by add_reference(), and setup().
unsigned ipa_icf::sem_item::referenced_by_count |
Referenced by ipa_icf::sem_item_optimizer::add_item_to_class(), and add_reference().
hash_set<symtab_node *> ipa_icf::sem_item::refs_set |
Referenced by add_reference(), and ipa_icf::sem_function::equals_private().
Referenced by setup(), and ~sem_item().
sem_item_type ipa_icf::sem_item::type |
Referenced by ipa_icf::sem_item_optimizer::build_graph(), ipa_icf::sem_item_optimizer::build_hash_based_classes(), ipa_icf::sem_function::equals(), ipa_icf::sem_variable::equals(), ipa_icf::sem_function::equals_private(), ipa_icf::sem_function::equals_wpa(), ipa_icf::sem_variable::equals_wpa(), ipa_icf::sem_item_optimizer::filter_removed_items(), ipa_icf::sem_function::merge(), ipa_icf::sem_variable::merge(), and ipa_icf::sem_item_optimizer::merge_classes().
bitmap ipa_icf::sem_item::usage_index_bitmap |
Referenced by add_reference(), setup(), and ~sem_item().