GCC Middle and Back End API Reference
ipa_icf::sem_item Class Referenceabstract

#include <ipa-icf.h>

Inheritance diagram for ipa_icf::sem_item:
Collaboration diagram for ipa_icf::sem_item:

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_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 Attributes

static hash_map< const_tree, hashval_tm_type_hash_cache
 

Detailed Description

Semantic item is a base class that encapsulates all shared functionality
for both semantic function and variable items.   

Constructor & Destructor Documentation

◆ sem_item() [1/2]

ipa_icf::sem_item::sem_item ( sem_item_type _type,
bitmap_obstack * stack )

References setup().

◆ sem_item() [2/2]

ipa_icf::sem_item::sem_item ( sem_item_type _type,
symtab_node * _node,
bitmap_obstack * stack )

References symtab_node::decl, node, and setup().

◆ ~sem_item()

ipa_icf::sem_item::~sem_item ( )
virtual

Member Function Documentation

◆ add_reference()

void ipa_icf::sem_item::add_reference ( ref_map * refs,
sem_item * target )

◆ 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 )
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(), ggc_alloc(), 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().

◆ 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 )
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(), ggc_alloc(), 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().

◆ dump()

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(), ggc_alloc(), and node.

◆ dump_to_file()

virtual void ipa_icf::sem_item::dump_to_file ( FILE * file)
pure virtual

◆ equals()

virtual bool ipa_icf::sem_item::equals ( sem_item * item,
hash_map< symtab_node *, sem_item * > & ignored_nodes )
pure virtual

◆ equals_wpa()

virtual bool ipa_icf::sem_item::equals_wpa ( sem_item * item,
hash_map< symtab_node *, sem_item * > & ignored_nodes )
pure virtual

◆ get_base_types()

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

◆ get_hash()

◆ hash_referenced_symbol_properties()

void ipa_icf::sem_item::hash_referenced_symbol_properties ( symtab_node * ref,
inchash::hash & hstate,
bool address )
protected
Hash properties that are compared by compare_referenced_symbol_properties.  

References 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, ggc_alloc(), and opt_for_fn.

Referenced by update_hash_by_addr_refs().

◆ init()

virtual void ipa_icf::sem_item::init ( ipa_icf_gimple::func_checker * )
pure virtual

◆ merge()

virtual bool ipa_icf::sem_item::merge ( sem_item * alias_item)
pure virtual

◆ set_hash()

◆ setup()

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

◆ target_supports_symbol_aliases_p()

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().

◆ 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)
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(), get_hash(), ggc_alloc(), hash_referenced_symbol_properties(), i, IPA_REF_ADDR, symtab_node::iterate_reference(), node, symtab_node::order, ipa_ref::referred, 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)
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, get_hash(), ggc_alloc(), global_hash, symtab_node::iterate_reference(), node, and ipa_ref::referring.

Field Documentation

◆ cls

◆ decl

◆ global_hash

hashval_t ipa_icf::sem_item::global_hash

◆ index_in_class

◆ m_hash

hashval_t ipa_icf::sem_item::m_hash
protected

◆ m_hash_set

◆ m_type_hash_cache

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

◆ node

◆ reference_count

unsigned ipa_icf::sem_item::reference_count

Referenced by add_reference(), and setup().

◆ referenced_by_count

unsigned ipa_icf::sem_item::referenced_by_count

◆ refs_set

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

◆ tree_refs

vec<tree> ipa_icf::sem_item::tree_refs

Referenced by setup(), and ~sem_item().

◆ type

◆ usage_index_bitmap

bitmap ipa_icf::sem_item::usage_index_bitmap

Referenced by add_reference(), setup(), and ~sem_item().


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