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

#include <ipa-icf.h>

Collaboration diagram for ipa_icf::sem_item_optimizer:

Public Member Functions

 sem_item_optimizer ()
 
 ~sem_item_optimizer ()
 
void parse_funcs_and_vars (void)
 
bool execute (void)
 
void dump (void)
 
void checking_verify_classes (void)
 
void verify_classes (void)
 
void write_summary (void)
 
void read_summary (void)
 
void remove_item (sem_item *item)
 
void remove_symtab_node (symtab_node *node)
 
void register_hooks (void)
 
void unregister_hooks (void)
 
void add_class (congruence_class *cls)
 
congruence_class_groupget_group_by_hash (hashval_t hash, sem_item_type type)
 

Static Public Member Functions

static void cgraph_removal_hook (cgraph_node *node, void *data)
 
static void varpool_removal_hook (varpool_node *node, void *data)
 

Data Fields

fibonacci_heap< unsigned, congruence_classworklist
 

Private Member Functions

void update_hash_by_addr_refs ()
 
void update_hash_by_memory_access_type ()
 
void build_hash_based_classes (void)
 
unsigned int parse_nonsingleton_classes (void)
 
void subdivide_classes_by_equality (bool in_wpa=false)
 
unsigned subdivide_classes_by_sensitive_refs ()
 
void dump_cong_classes (void)
 
void build_graph (void)
 
void process_cong_reduction (void)
 
bool merge_classes (unsigned int prev_class_count, unsigned int loaded_symbols)
 
void fixup_points_to_sets (void)
 
void fixup_pt_set (struct pt_solution *pt)
 
void worklist_push (congruence_class *cls)
 
congruence_classworklist_pop ()
 
void do_congruence_step (congruence_class *cls)
 
bool do_congruence_step_for_index (congruence_class *cls, unsigned int index)
 
void read_section (lto_file_decl_data *file_data, const char *data, size_t len)
 
void filter_removed_items (void)
 

Static Private Member Functions

static void add_item_to_class (congruence_class *cls, sem_item *item)
 
static bool release_split_map (congruence_class *const &cls, bitmap const &b, traverse_split_pair *pair)
 
static bool traverse_congruence_split (congruence_class *const &cls, bitmap const &b, traverse_split_pair *pair)
 
static int sort_congruence_split (const void *, const void *)
 

Private Attributes

vec< sem_item * > m_items
 
hash_set< symtab_node * > m_removed_items_set
 
hash_table< congruence_class_hashm_classes
 
unsigned int m_classes_count
 
hash_map< symtab_node *, sem_item * > m_symtab_node_map
 
bool splitter_class_removed
 
cgraph_node_hook_listm_cgraph_node_hooks
 
varpool_node_hook_listm_varpool_node_hooks
 
bitmap_obstack m_bmstack
 
vec< symtab_pairm_merged_variables
 
ref_map m_references
 

Static Private Attributes

static unsigned int class_id = 0
 

Detailed Description

Semantic item optimizer includes all top-level logic
related to semantic equality comparison.   

Constructor & Destructor Documentation

◆ sem_item_optimizer()

ipa_icf::sem_item_optimizer::sem_item_optimizer ( )

◆ ~sem_item_optimizer()

ipa_icf::sem_item_optimizer::~sem_item_optimizer ( )

Member Function Documentation

◆ add_class()

void ipa_icf::sem_item_optimizer::add_class ( congruence_class * cls)
Adds a CLS to hashtable associated by hash value.   

References ipa_icf::congruence_class_group::classes, gcc_assert, get_group_by_hash(), and ipa_icf::congruence_class::members.

Referenced by traverse_congruence_split().

◆ add_item_to_class()

◆ build_graph()

◆ build_hash_based_classes()

void ipa_icf::sem_item_optimizer::build_hash_based_classes ( void )
private

◆ cgraph_removal_hook()

void ipa_icf::sem_item_optimizer::cgraph_removal_hook ( cgraph_node * node,
void * data )
static
Callgraph removal hook called for a NODE with a custom DATA.   

References ipa_icf::optimizer, and remove_symtab_node().

Referenced by register_hooks().

◆ checking_verify_classes()

void ipa_icf::sem_item_optimizer::checking_verify_classes ( void )
Verify congruence classes, if checking is enabled.   

References verify_classes().

Referenced by execute(), and subdivide_classes_by_equality().

◆ do_congruence_step()

void ipa_icf::sem_item_optimizer::do_congruence_step ( congruence_class * cls)
private
Every usage of a congruence class CLS is a candidate that can split the
collection of classes. Bitmap stack BMSTACK is used for bitmap
allocation.   

References BITMAP_ALLOC, BITMAP_FREE, bitmap_ior_into(), do_congruence_step_for_index(), dump_file, dump_flags, EXECUTE_IF_SET_IN_BITMAP, i, ipa_icf::congruence_class::id, m_bmstack, ipa_icf::congruence_class::members, ipa_icf::congruence_class::referenced_by_count, splitter_class_removed, TDF_DETAILS, and usage().

Referenced by process_cong_reduction().

◆ do_congruence_step_for_index()

◆ dump()

void ipa_icf::sem_item_optimizer::dump ( void )

◆ dump_cong_classes()

void ipa_icf::sem_item_optimizer::dump_cong_classes ( void )
private
Debug function prints all informations about congruence classes.   

References dump_file, dump_flags, fmt_size_t, free(), histogram, HOST_SIZE_T_PRINT_UNSIGNED, i, m_classes, m_items, and TDF_DETAILS.

Referenced by execute().

◆ execute()

◆ filter_removed_items()

void ipa_icf::sem_item_optimizer::filter_removed_items ( void )
private

◆ fixup_points_to_sets()

◆ fixup_pt_set()

void ipa_icf::sem_item_optimizer::fixup_pt_set ( struct pt_solution * pt)
private

◆ get_group_by_hash()

congruence_class_group * ipa_icf::sem_item_optimizer::get_group_by_hash ( hashval_t hash,
sem_item_type type )
Gets a congruence class group based on given HASH value and TYPE.   

References ipa_icf::congruence_class_group::classes, free(), ipa_icf::congruence_class_group::hash, m_classes, ipa_icf::congruence_class_group::type, and type().

Referenced by add_class(), and build_hash_based_classes().

◆ merge_classes()

◆ parse_funcs_and_vars()

void ipa_icf::sem_item_optimizer::parse_funcs_and_vars ( void )
Function responsible for visiting all potential functions and
read-only variables that can be merged.   

References FOR_EACH_DEFINED_FUNCTION, FOR_EACH_DEFINED_VARIABLE, m_bmstack, m_items, m_symtab_node_map, ipa_icf::sem_function::parse(), and ipa_icf::sem_variable::parse().

Referenced by ipa_icf::ipa_icf_generate_summary().

◆ parse_nonsingleton_classes()

unsigned int ipa_icf::sem_item_optimizer::parse_nonsingleton_classes ( void )
private
Semantic items in classes having more than one element and initialized.
In case of WPA, we load function body.   

References dump_file, i, and m_items.

Referenced by execute().

◆ process_cong_reduction()

void ipa_icf::sem_item_optimizer::process_cong_reduction ( void )
private

◆ read_section()

◆ read_summary()

void ipa_icf::sem_item_optimizer::read_summary ( void )

◆ register_hooks()

◆ release_split_map()

bool ipa_icf::sem_item_optimizer::release_split_map ( congruence_class *const & cls,
bitmap const & b,
traverse_split_pair * pair )
staticprivate
Disposes split map traverse function. CLS_PTR is pointer to congruence
class, BSLOT is bitmap slot we want to release. DATA is mandatory,
but unused argument.   

References b, and BITMAP_FREE.

Referenced by do_congruence_step_for_index().

◆ remove_item()

void ipa_icf::sem_item_optimizer::remove_item ( sem_item * item)

◆ remove_symtab_node()

void ipa_icf::sem_item_optimizer::remove_symtab_node ( symtab_node * node)
Remove symtab NODE triggered by symtab removal hooks.   

References hash_set< KeyId, Lazy, Traits >::add(), gcc_assert, m_classes, and m_removed_items_set.

Referenced by cgraph_removal_hook(), and varpool_removal_hook().

◆ sort_congruence_split()

int ipa_icf::sem_item_optimizer::sort_congruence_split ( const void * a_,
const void * b_ )
staticprivate
Compare function for sorting pairs in do_congruence_step_f.   

References a, and b.

Referenced by do_congruence_step_for_index().

◆ subdivide_classes_by_equality()

void ipa_icf::sem_item_optimizer::subdivide_classes_by_equality ( bool in_wpa = false)
private
Equality function for semantic items is used to subdivide existing
classes. If IN_WPA, fast equality function is invoked.   

References add_item_to_class(), checking_verify_classes(), class_id, ipa_icf::sem_item::equals(), ipa_icf::sem_item::equals_wpa(), i, m_classes, m_classes_count, m_symtab_node_map, and ipa_icf::congruence_class::members.

Referenced by execute().

◆ subdivide_classes_by_sensitive_refs()

unsigned ipa_icf::sem_item_optimizer::subdivide_classes_by_sensitive_refs ( )
private
Subdivide classes by address references that members of the class
reference. Example can be a pair of functions that have an address
taken from a function. If these addresses are different the class
is split.   

References add_item_to_class(), class_id, gcc_checking_assert, i, m_classes, m_classes_count, ipa_icf::congruence_class::members, ipa_icf::sem_item::node, and worklist_push().

Referenced by process_cong_reduction().

◆ traverse_congruence_split()

bool ipa_icf::sem_item_optimizer::traverse_congruence_split ( congruence_class *const & cls,
bitmap const & b,
traverse_split_pair * pair )
staticprivate
Process split operation for a class given as pointer CLS_PTR,
where bitmap B splits congruence class members. DATA is used
as argument of split pair.   

References add_class(), add_item_to_class(), b, bitmap_bit_p, bitmap_count_bits(), class_id, ipa_icf::congruence_class::dump(), dump(), dump_file, dump_flags, g, gcc_assert, i, ipa_icf::congruence_class::in_worklist, m_classes, m_classes_count, ipa_icf::congruence_class::members, ipa_icf::optimizer, splitter_class_removed, TDF_DETAILS, and worklist_push().

Referenced by do_congruence_step_for_index().

◆ unregister_hooks()

void ipa_icf::sem_item_optimizer::unregister_hooks ( void )

◆ update_hash_by_addr_refs()

◆ update_hash_by_memory_access_type()

void ipa_icf::sem_item_optimizer::update_hash_by_memory_access_type ( )
private

◆ varpool_removal_hook()

void ipa_icf::sem_item_optimizer::varpool_removal_hook ( varpool_node * node,
void * data )
static
Varpool removal hook called for a NODE with a custom DATA.   

References ipa_icf::optimizer, and remove_symtab_node().

Referenced by register_hooks().

◆ verify_classes()

void ipa_icf::sem_item_optimizer::verify_classes ( void )
Verify congruence classes.   

References ipa_icf::sem_item::cls, gcc_assert, i, m_classes, and ipa_icf::congruence_class::members.

Referenced by checking_verify_classes().

◆ worklist_pop()

congruence_class * ipa_icf::sem_item_optimizer::worklist_pop ( void )
private
Pops a class from worklist.  

References ipa_icf::congruence_class::in_worklist, NULL, and worklist.

Referenced by process_cong_reduction().

◆ worklist_push()

void ipa_icf::sem_item_optimizer::worklist_push ( congruence_class * cls)
private

◆ write_summary()

Field Documentation

◆ class_id

unsigned int ipa_icf::sem_item_optimizer::class_id = 0
staticprivate

◆ m_bmstack

◆ m_cgraph_node_hooks

cgraph_node_hook_list* ipa_icf::sem_item_optimizer::m_cgraph_node_hooks
private

Referenced by register_hooks(), and unregister_hooks().

◆ m_classes

◆ m_classes_count

unsigned int ipa_icf::sem_item_optimizer::m_classes_count
private

◆ m_items

◆ m_merged_variables

vec<symtab_pair> ipa_icf::sem_item_optimizer::m_merged_variables
private

◆ m_references

ref_map ipa_icf::sem_item_optimizer::m_references
private

◆ m_removed_items_set

hash_set<symtab_node *> ipa_icf::sem_item_optimizer::m_removed_items_set
private

◆ m_symtab_node_map

◆ m_varpool_node_hooks

varpool_node_hook_list* ipa_icf::sem_item_optimizer::m_varpool_node_hooks
private

Referenced by register_hooks(), and unregister_hooks().

◆ splitter_class_removed

bool ipa_icf::sem_item_optimizer::splitter_class_removed
private

◆ worklist

fibonacci_heap<unsigned, congruence_class> ipa_icf::sem_item_optimizer::worklist

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