GCC Middle and Back End API Reference
ipa-profile.c File Reference

Data Structures

struct  histogram_entry
struct  histogram_hash
struct  ipa_propagate_frequency_data

Functions

static void account_time_size (hash_table< histogram_hash > hashtable, vec< histogram_entry * > &histogram, gcov_type count, int time, int size)
int cmp_counts ()
static void dump_histogram ()
static void ipa_profile_generate_summary ()
static void ipa_profile_write_summary ()
static void ipa_profile_read_summary ()
static bool ipa_propagate_frequency_1 ()
bool contains_hot_call_p ()
bool ipa_propagate_frequency ()
static unsigned int ipa_profile ()
static bool gate_ipa_profile ()
ipa_opt_pass_dmake_pass_ipa_profile ()

Variables

vec< histogram_entry * > histogram
static alloc_pool histogram_pool

Function Documentation

static void account_time_size ( hash_table< histogram_hash hashtable,
vec< histogram_entry * > &  histogram,
gcov_type  count,
int  time,
int  size 
)
static
   Account TIME and SIZE executed COUNT times into HISTOGRAM.
   HASHTABLE is the on-side hash kept to avoid duplicates.  

References pool_alloc().

Referenced by ipa_profile_read_summary().

int cmp_counts ( )
static void dump_histogram ( )
static
   Dump HISTOGRAM to FILE.  

References overall_size.

static bool gate_ipa_profile ( )
static
static unsigned int ipa_profile ( )
static
   Simple ipa profile pass propagating frequencies across the callgraph.  
     Produce speculative calls: we saved common traget from porfiling into
     e->common_target_id.  Now, at link time, we can look up corresponding
     function node and produce speculative call.  
                         Target may be overwritable, but profile says that
                         control flow goes to this particular implementation
                         of N2.  Speculate on the local alias to allow inlining.
static void ipa_profile_generate_summary ( )
static
   Collect histogram from CFG profiles.  
                   No need to do sanity check: gimple_ic_transform already
                   takes away bad histograms.  
                       counter 0 is target, counter 1 is number of execution we called target,
                       counter 2 is total number of executions.  
static void ipa_profile_read_summary ( )
static
static void ipa_profile_write_summary ( )
static
   Serialize the ipa info for lto.  
bool ipa_propagate_frequency ( )
   See if the frequency of NODE can be updated based on frequencies of its
   callers.  
     We can not propagate anything useful about externally visible functions
     nor about virtuals.  
     With profile we can decide on hot/normal based on count.  
     These come either from profile or user hints; never update them.  

References cgraph_node_name(), dump_file, and cgraph_node::only_called_at_startup.

static bool ipa_propagate_frequency_1 ( )
static
   Worker for ipa_propagate_frequency_1.  
             It makes sense to put main() together with the static constructors.
             It will be executed for sure, but rest of functions called from
             main are definitely not at startup only.  
         When profile feedback is available, do not try to propagate too hard;
         counts are already good guide on function frequencies and roundoff
         errors can make us to push function into unlikely section even when
         it is executed by the train run.  Transfer the function only if all
         callers are unlikely executed.  

Referenced by contains_hot_call_p().

ipa_opt_pass_d* make_pass_ipa_profile ( )

Variable Documentation

vec<histogram_entry *> histogram
   Histogram of profile values.
   The histogram is represented as an ordered vector of entries allocated via
   histogram_pool. During construction a separate hashtable is kept to lookup
   duplicate entries.  
alloc_pool histogram_pool
static