GCC Middle and Back End API Reference
ipa_icf::sem_variable Class Reference

#include <ipa-icf.h>

Inheritance diagram for ipa_icf::sem_variable:
Collaboration diagram for ipa_icf::sem_variable:

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_nodeget_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_variableparse (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_nodenode
 
tree decl
 
unsigned reference_count
 
congruence_classcls
 
unsigned int index_in_class
 
bitmap usage_index_bitmap
 
vec< treetree_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_tm_type_hash_cache
 

Constructor & Destructor Documentation

◆ sem_variable() [1/2]

ipa_icf::sem_variable::sem_variable ( bitmap_obstack * stack)

Referenced by parse().

◆ sem_variable() [2/2]

ipa_icf::sem_variable::sem_variable ( varpool_node * _node,
bitmap_obstack * stack )

Member Function Documentation

◆ add_reference()

◆ compare_referenced_symbol_properties()

bool ipa_icf::sem_item::compare_referenced_symbol_properties ( symtab_node * used_by,
symtab_node * n1,
symtab_node * n2,
bool address )
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(), ggc_alloc(), 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().

◆ compare_symbol_references()

bool ipa_icf::sem_item::compare_symbol_references ( hash_map< symtab_node *, sem_item * > & ignored_nodes,
symtab_node * n1,
symtab_node * n2,
bool address )
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(), ggc_alloc(), 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().

◆ dump()

DEBUG_FUNCTION void ipa_icf::sem_item::dump ( void )
inherited

◆ dump_to_file()

void ipa_icf::sem_variable::dump_to_file ( FILE * file)
finaloverridevirtual
Dump symbol to FILE.   

Implements ipa_icf::sem_item.

References gcc_assert, ggc_alloc(), and print_node().

◆ equals() [1/2]

◆ equals() [2/2]

◆ equals_wpa()

◆ get_base_types()

static bool ipa_icf::sem_item::get_base_types ( tree * t1,
tree * t2 )
staticinherited

◆ get_hash()

hashval_t ipa_icf::sem_variable::get_hash ( void )
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.

◆ get_node()

varpool_node * ipa_icf::sem_variable::get_node ( void )
inline

References ggc_alloc(), and ipa_icf::sem_item::node.

Referenced by init(), merge(), and sem_variable().

◆ hash_referenced_symbol_properties()

void ipa_icf::sem_item::hash_referenced_symbol_properties ( symtab_node * ref,
inchash::hash & hstate,
bool address )
protectedinherited

◆ init()

◆ merge()

◆ parse()

sem_variable * ipa_icf::sem_variable::parse ( varpool_node * node,
bitmap_obstack * stack,
ipa_icf_gimple::func_checker * checker )
static

◆ set_hash()

◆ setup()

void ipa_icf::sem_item::setup ( bitmap_obstack * stack)
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().

◆ target_supports_symbol_aliases_p()

bool ipa_icf::sem_item::target_supports_symbol_aliases_p ( void )
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().

◆ update_hash_by_addr_refs()

void ipa_icf::sem_item::update_hash_by_addr_refs ( hash_map< symtab_node *, sem_item * > & m_symtab_node_map)
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 ipa_ref::address_matters_p(), ipa_icf::sem_item::get_hash(), ggc_alloc(), ipa_icf::sem_item::hash_referenced_symbol_properties(), i, IPA_REF_ADDR, 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.

◆ update_hash_by_local_refs()

void ipa_icf::sem_item::update_hash_by_local_refs ( hash_map< symtab_node *, sem_item * > & m_symtab_node_map)
inherited
Update hash by computed local hash values taken from different
semantic items.
TODO: stronger SCC based hashing would be desirable here.   

References ipa_icf::FUNC, ipa_icf::sem_item::get_hash(), ggc_alloc(), ipa_icf::sem_item::global_hash, symtab_node::iterate_reference(), ipa_icf::sem_item::node, and ipa_ref::referring.

Field Documentation

◆ cls

◆ decl

◆ global_hash

hashval_t ipa_icf::sem_item::global_hash
inherited

◆ index_in_class

◆ m_hash

hashval_t ipa_icf::sem_item::m_hash
protectedinherited

◆ m_hash_set

bool ipa_icf::sem_item::m_hash_set
protectedinherited

◆ m_type_hash_cache

hash_map< const_tree, hashval_t > ipa_icf::sem_item::m_type_hash_cache
staticprivateinherited

◆ node

◆ reference_count

unsigned ipa_icf::sem_item::reference_count
inherited

◆ referenced_by_count

unsigned ipa_icf::sem_item::referenced_by_count
inherited

◆ refs_set

hash_set<symtab_node *> ipa_icf::sem_item::refs_set
inherited

◆ tree_refs

vec<tree> ipa_icf::sem_item::tree_refs
inherited

◆ type

◆ usage_index_bitmap

bitmap ipa_icf::sem_item::usage_index_bitmap
inherited

The documentation for this class was generated from the following files: