GCC Middle and Back End API Reference
autofdo::function_instance Class Reference

Public Types

typedef auto_vec< function_instance * > function_instance_stack
 

Public Member Functions

 ~function_instance ()
 
int name () const
 
gcov_type total_count () const
 
gcov_type head_count () const
 
function_instanceget_function_instance_by_decl (unsigned lineno, tree decl) const
 
bool get_count_info (location_t loc, count_info *info) const
 
gcov_type find_icall_target_map (gcall *stmt, icall_target_map *map) const
 
gcov_type total_annotated_count () const
 
void mark_annotated (location_t loc)
 

Static Public Member Functions

static function_instanceread_function_instance (function_instance_stack *stack, gcov_type head_count)
 

Private Types

typedef std::pair< unsigned, unsigned > callsite
 
typedef std::map< callsite, function_instance * > callsite_map
 
typedef std::map< unsigned, count_infoposition_count_map
 

Private Member Functions

 function_instance (unsigned name, gcov_type head_count)
 

Private Attributes

unsigned name_
 
gcov_type total_count_
 
gcov_type head_count_
 
callsite_map callsites
 
position_count_map pos_counts
 

Detailed Description

Profile of a function instance:
 1. total_count of the function.
 2. head_count (entry basic block count) of the function (only valid when
    function is a top-level function_instance, i.e. it is the original copy
    instead of the inlined copy).
 3. map from source location (decl_lineno) to profile (count_info).
 4. map from callsite to callee function_instance.   

Member Typedef Documentation

◆ callsite

std::pair<unsigned, unsigned> autofdo::function_instance::callsite
private

◆ callsite_map

◆ function_instance_stack

◆ position_count_map

Constructor & Destructor Documentation

◆ ~function_instance()

autofdo::function_instance::~function_instance ( )
Member functions for function_instance.   

References callsites.

◆ function_instance()

autofdo::function_instance::function_instance ( unsigned name,
gcov_type head_count )
inlineprivate

Referenced by read_function_instance().

Member Function Documentation

◆ find_icall_target_map()

gcov_type autofdo::function_instance::find_icall_target_map ( gcall * stmt,
icall_target_map * map ) const
Read the inlined indirect call target profile for STMT and store it in
MAP, return the total count for all inlined indirect calls.   

References autofdo::afdo_string_table, callsites, cgraph_node::get_for_asmname(), get_identifier(), autofdo::string_table::get_name(), autofdo::get_relative_location_for_stmt(), and NULL.

Referenced by autofdo::autofdo_source_profile::update_inlined_ind_target().

◆ get_count_info()

bool autofdo::function_instance::get_count_info ( location_t loc,
count_info * info ) const
Store the profile info for LOC in INFO. Return TRUE if profile info
is found.   

References pos_counts.

Referenced by autofdo::autofdo_source_profile::get_count_info().

◆ get_function_instance_by_decl()

function_instance * autofdo::function_instance::get_function_instance_by_decl ( unsigned lineno,
tree decl ) const

◆ head_count()

gcov_type autofdo::function_instance::head_count ( ) const
inline

◆ mark_annotated()

void autofdo::function_instance::mark_annotated ( location_t loc)

◆ name()

int autofdo::function_instance::name ( ) const
inline

◆ read_function_instance()

function_instance * autofdo::function_instance::read_function_instance ( function_instance_stack * stack,
gcov_type head_count )
static
Read the profile and create a function_instance with head count as
HEAD_COUNT. Recursively read callsites to create nested function_instances
too. STACK is used to track the recursive creation process.   
function instance profile format:

ENTRY_COUNT: 8 bytes
NAME_INDEX: 4 bytes
NUM_POS_COUNTS: 4 bytes
NUM_CALLSITES: 4 byte
POS_COUNT_1:
  POS_1_OFFSET: 4 bytes
  NUM_TARGETS: 4 bytes
  COUNT: 8 bytes
  TARGET_1:
    VALUE_PROFILE_TYPE: 4 bytes
    TARGET_IDX: 8 bytes
    COUNT: 8 bytes
  TARGET_2
  ...
  TARGET_n
POS_COUNT_2
...
POS_COUNT_N
CALLSITE_1:
  CALLSITE_1_OFFSET: 4 bytes
  FUNCTION_INSTANCE_PROFILE (nested)
CALLSITE_2
...
CALLSITE_n.   

References callsites, count, function_instance(), gcov_read_counter(), gcov_read_unsigned(), head_count(), i, name(), offset, pos_counts, and read_function_instance().

Referenced by autofdo::autofdo_source_profile::read(), and read_function_instance().

◆ total_annotated_count()

gcov_type autofdo::function_instance::total_annotated_count ( ) const
Sum of counts that is used during annotation.   

References callsites, pos_counts, and total_annotated_count().

Referenced by total_annotated_count().

◆ total_count()

gcov_type autofdo::function_instance::total_count ( ) const
inline

Field Documentation

◆ callsites

◆ head_count_

gcov_type autofdo::function_instance::head_count_
private

Referenced by head_count().

◆ name_

unsigned autofdo::function_instance::name_
private

Referenced by name().

◆ pos_counts

position_count_map autofdo::function_instance::pos_counts
private

◆ total_count_

gcov_type autofdo::function_instance::total_count_
private

Referenced by total_count().


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