|
GCC Middle and Back End API Reference
|

Public Member Functions | |
| ~autofdo_source_profile () | |
| function_instance * | get_function_instance_by_decl (tree decl) const |
| function_instance * | get_function_instance_by_descriptor (function_instance_descriptor) const |
| void | add_function_instance (function_instance *) |
| bool | get_count_info (gimple *stmt, count_info *info, cgraph_node *node=NULL) const |
| bool | get_count_info (location_t gimple_loc, count_info *info, cgraph_node *node=NULL) const |
| gcov_type | get_callsite_total_count (struct cgraph_edge *edge) const |
| bool | update_inlined_ind_target (gcall *stmt, count_info *info, cgraph_node *node) |
| void | remove_icall_target (cgraph_edge *e) |
| void | offline_external_functions () |
| void | offline_unrealized_inlines () |
Static Public Member Functions | |
| static autofdo_source_profile * | create () |
Private Types | |
| typedef std::map< function_instance_descriptor, function_instance * > | name_function_instance_map |
Private Member Functions | |
| autofdo_source_profile () | |
| bool | read () |
| function_instance * | get_function_instance_by_inline_stack (const inline_stack &stack) const |
| name_function_instance_map::const_iterator | find_iter_for_function_instance (function_instance_descriptor descriptor) const |
| function_instance * | find_function_instance (function_instance_descriptor descriptor) const |
| bool | remove_function_instance (function_instance *inst) |
Private Attributes | |
| name_function_instance_map | map_ |
| auto_vec< function_instance * > | duplicate_functions_ |
Profile for all functions.
|
private |
| autofdo::autofdo_source_profile::~autofdo_source_profile | ( | ) |
Member functions for autofdo_source_profile.
References map_.
|
inlineprivate |
Referenced by create().
| void autofdo::autofdo_source_profile::add_function_instance | ( | function_instance * | fn | ) |
Add function instance FN.
References gcc_checking_assert, autofdo::function_instance::get_descriptor(), and map_.
Referenced by offline_external_functions(), and read().
|
inlinestatic |
References autofdo_source_profile(), map, and NULL.
Referenced by autofdo::read_profile().
|
private |
Similar to the above, but return a pointer to the instance instead of an iterator.
References find_iter_for_function_instance(), map_, and NULL.
Referenced by get_function_instance_by_decl(), get_function_instance_by_descriptor(), get_function_instance_by_inline_stack(), offline_external_functions(), offline_unrealized_inlines(), and read().
|
private |
Find the matching function instance which has DESCRIPTOR as its descriptor. If not found, also try checking if an instance exists with the same name which has no associated filename.
References map_, autofdo::function_instance_descriptor::symbol_name(), and autofdo::string_table::unknown_filename.
Referenced by find_function_instance(), and remove_function_instance().
| gcov_type autofdo::autofdo_source_profile::get_callsite_total_count | ( | struct cgraph_edge * | edge | ) | const |
Find total count of the callee of EDGE.
References autofdo::afdo_count_scale, autofdo::afdo_string_table, dump_file, autofdo::dump_inline_stack(), get_function_instance_by_inline_stack(), autofdo::get_inline_stack_in_node(), gimple_location(), NULL, autofdo::raw_symbol_name(), and UNKNOWN_LOCATION.
| bool autofdo::autofdo_source_profile::get_count_info | ( | gimple * | stmt, |
| count_info * | info, | ||
| cgraph_node * | node = NULL ) const |
Find count_info for a given gimple STMT. If found, store the count_info in INFO and return true; otherwise return false.
References gcc_checking_assert, get_count_info(), gimple_location(), and stmt_loc_used_by_debug_info().
Referenced by get_count_info(), and update_inlined_ind_target().
| bool autofdo::autofdo_source_profile::get_count_info | ( | location_t | gimple_loc, |
| count_info * | info, | ||
| cgraph_node * | node = NULL ) const |
References cfun, get_function_instance_by_inline_stack(), autofdo::get_inline_stack_in_node(), LOCATION_LOCUS, and NULL.
| function_instance * autofdo::autofdo_source_profile::get_function_instance_by_decl | ( | tree | decl | ) | const |
For a given DECL, returns the top-level function_instance.
References autofdo::afdo_string_table, DECL_SOURCE_FILE, find_function_instance(), autofdo::get_normalized_path(), and NULL.
| function_instance * autofdo::autofdo_source_profile::get_function_instance_by_descriptor | ( | function_instance_descriptor | descriptor | ) | const |
For a given DESCRIPTOR, return the matching instance if found.
References find_function_instance().
|
private |
Return the function_instance in the profile that correspond to the inline STACK.
References autofdo::afdo_string_table, DECL_SOURCE_FILE, dump_enabled_p(), dump_file, dump_printf_loc(), find_function_instance(), dump_user_location_t::from_location_t(), autofdo::get_normalized_path(), i, MSG_NOTE, MSG_PRIORITY_INTERNALS, NULL, autofdo::raw_symbol_name(), and UNKNOWN_LOCATION.
Referenced by get_callsite_total_count(), get_count_info(), remove_icall_target(), and update_inlined_ind_target().
| void autofdo::autofdo_source_profile::offline_external_functions | ( | ) |
Offline all functions not defined in the current unit. We will not be able to early inline them. Doing so early will get VPT decisions more realistic.
References hash_set< KeyId, Lazy, Traits >::add(), add_function_instance(), autofdo::afdo_string_table, autofdo::function_instance::clear_in_worklist(), hash_set< KeyId, Lazy, Traits >::contains(), DECL_SOURCE_FILE, dump_file, autofdo::function_instance::dump_inline_stack(), duplicate_functions_, lang_hooks::dwarf_name, find_function_instance(), FOR_EACH_DEFINED_FUNCTION, gcc_checking_assert, hash_map< KeyId, Value, Traits >::get(), autofdo::function_instance::get_cgraph_node(), autofdo::function_instance::get_descriptor(), autofdo::function_instance::get_location(), autofdo::get_normalized_path(), i, autofdo::function_instance::in_worklist_p(), autofdo::function_instance::inlined_to(), map_, autofdo::function_instance::match(), autofdo::function_instance::merge(), autofdo::function_instance::offline_if_in_set(), hash_map< KeyId, Value, Traits >::put(), autofdo::raw_symbol_name(), autofdo::function_instance::remove_external_functions(), remove_function_instance(), autofdo::function_instance::set_symbol_name(), autofdo::function_instance::symbol_name(), and UNKNOWN_LOCATION.
| void autofdo::autofdo_source_profile::offline_unrealized_inlines | ( | ) |
Offline all inline functions that are not marked as realized. This will merge their profile into offline versions where available. Also remove all functions we will no longer use.
References autofdo::afdo_string_table, autofdo::function_instance::clear_in_worklist(), DECL_INITIAL, dump_file, autofdo::function_instance::dump_inline_stack(), error_mark_node, find_function_instance(), gcc_checking_assert, autofdo::function_instance::get_cgraph_node(), autofdo::function_instance::get_descriptor(), autofdo::function_instance::in_worklist_p(), autofdo::function_instance::inlined_to(), map_, autofdo::function_instance::merge(), autofdo::function_instance::offline_if_not_realized(), autofdo::function_instance::realized_p(), remove_function_instance(), autofdo::function_instance::set_realized(), autofdo::function_instance::symbol_name(), and autofdo::walk_block().
|
private |
Read AutoFDO profile and returns TRUE on success.
source profile format: GCOV_TAG_AFDO_FUNCTION: 4 bytes LENGTH: 4 bytes NUM_FUNCTIONS: 4 bytes FUNCTION_INSTANCE_1 FUNCTION_INSTANCE_2 ... FUNCTION_INSTANCE_N.
References add_function_instance(), autofdo::afdo_count_scale, afdo_hot_bb_threshold, autofdo::afdo_profile_info, autofdo::afdo_source_profile, autofdo::afdo_string_table, autofdo::afdo_summary_info, dump_file, fatal_error(), find_function_instance(), gcc_checking_assert, gcov_read_counter(), gcov_read_unsigned(), GCOV_TAG_AFDO_FUNCTION, i, inform(), MAX, profile_count::n_bits, PRIu64, autofdo::function_instance::read_function_instance(), set_hot_bb_threshold(), and UNKNOWN_LOCATION.
|
private |
Remove a function instance from the map. Returns true if the entry was actually deleted.
References find_iter_for_function_instance(), autofdo::function_instance::get_descriptor(), and map_.
Referenced by offline_external_functions(), and offline_unrealized_inlines().
| void autofdo::autofdo_source_profile::remove_icall_target | ( | cgraph_edge * | e | ) |
| bool autofdo::autofdo_source_profile::update_inlined_ind_target | ( | gcall * | stmt, |
| count_info * | info, | ||
| cgraph_node * | node ) |
Update value profile INFO for STMT from the inlined indirect callsite. Return true if INFO is updated.
References autofdo::afdo_count_scale, cfun, autofdo::count_info::count, current_function_decl, dump_file, autofdo::dump_inline_stack(), get_count_info(), get_function_instance_by_inline_stack(), autofdo::get_inline_stack_in_node(), gimple_location(), LOCATION_LOCUS, map, NULL, print_gimple_stmt(), autofdo::count_info::targets, and TDF_SLIM.
|
private |
Referenced by offline_external_functions().
|
private |