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

Functions

static void init_ic_make_global_vars ()
void gimple_init_edge_profiler ()
void gimple_gen_edge_profiler ()
static tree prepare_instrumented_value ()
void gimple_gen_interval_profiler ()
void gimple_gen_pow2_profiler ()
void gimple_gen_one_value_profiler ()
void gimple_gen_ic_profiler ()
void gimple_gen_ic_func_profiler ()
void gimple_gen_const_delta_profiler (histogram_value value, unsigned tag, unsigned base)
void gimple_gen_average_profiler ()
void gimple_gen_ior_profiler ()
static unsigned int tree_profiling ()
static bool gate_tree_profile_ipa ()
simple_ipa_opt_passmake_pass_ipa_tree_profile ()

Variables

static tree gcov_type_node
static tree tree_interval_profiler_fn
static tree tree_pow2_profiler_fn
static tree tree_one_value_profiler_fn
static tree tree_indirect_call_profiler_fn
static tree tree_average_profiler_fn
static tree tree_ior_profiler_fn
static tree ic_void_ptr_var
static tree ic_gcov_type_ptr_var
static tree ptr_void

Function Documentation

static bool gate_tree_profile_ipa ( )
static
   When profile instrumentation, use or test coverage shall be performed.  
void gimple_gen_average_profiler ( )
   Output instructions as GIMPLE trees to increment the average histogram
   counter.  VALUE is the expression whose value is profiled.  TAG is the
   tag of the section for counters, BASE is offset of the counter position.  

Referenced by instrument_values().

void gimple_gen_const_delta_profiler ( histogram_value  value,
unsigned  tag,
unsigned  base 
)
   Output instructions as GIMPLE trees for code to find the most common value
   of a difference between two evaluations of an expression.
   VALUE is the expression whose value is profiled.  TAG is the tag of the
   section for counters, BASE is offset of the counter position.  
     FIXME implement this.  

Referenced by instrument_values().

void gimple_gen_edge_profiler ( )
   Output instructions as GIMPLE trees to increment the edge
   execution count, and insert them on E.  We rely on
   gsi_insert_on_edge to preserve the order.  

Referenced by instrument_edges().

void gimple_gen_ic_func_profiler ( void  )
   Output instructions as GIMPLE trees for code to find the most
   common called function in indirect call. Insert instructions at the
   beginning of every possible called function.
     Insert code:

    stmt1: __gcov_indirect_call_profiler_v2 (profile_id,
                                             &current_function_decl)
     Workaround for binutils bug 14342.  Once it is fixed, remove lto path.  
     Set __gcov_indirect_call_callee to 0,
     so that calls from other modules won't get misattributed
     to the last caller of the current callee. 
void gimple_gen_ic_profiler ( )
   Output instructions as GIMPLE trees for code to find the most
   common called function in indirect call.
   VALUE is the call expression whose indirect callee is profiled.
   TAG is the tag of the section for counters, BASE is offset of the
   counter position.  
     Insert code:

    stmt1: __gcov_indirect_call_counters = get_relevant_counter_ptr ();
    stmt2: tmp1 = (void *) (indirect call argument value)
    stmt3: __gcov_indirect_call_callee = tmp1;

Referenced by instrument_values().

void gimple_gen_interval_profiler ( )
   Output instructions as GIMPLE trees to increment the interval histogram
   counter.  VALUE is the expression whose value is profiled.  TAG is the
   tag of the section for counters, BASE is offset of the counter position.  

Referenced by instrument_values().

void gimple_gen_ior_profiler ( )
   Output instructions as GIMPLE trees to increment the ior histogram
   counter.  VALUE is the expression whose value is profiled.  TAG is the
   tag of the section for counters, BASE is offset of the counter position.  

Referenced by instrument_values().

void gimple_gen_one_value_profiler ( )
   Output instructions as GIMPLE trees for code to find the most common value.
   VALUE is the expression whose value is profiled.  TAG is the tag of the
   section for counters, BASE is offset of the counter position.  

References force_gimple_operand_gsi(), gsi_for_stmt(), GSI_SAME_STMT, histogram_value_t::hvalue, make_temp_ssa_name(), histogram_value_t::stmt, tree_coverage_counter_addr(), unshare_expr(), and histogram_value_t::value.

Referenced by instrument_values().

void gimple_gen_pow2_profiler ( )
   Output instructions as GIMPLE trees to increment the power of two histogram
   counter.  VALUE is the expression whose value is profiled.  TAG is the tag
   of the section for counters, BASE is offset of the counter position.  

References force_gimple_operand_gsi(), gimple_build_call(), gsi_for_stmt(), gsi_insert_before(), GSI_NEW_STMT, GSI_SAME_STMT, histogram_value_t::hvalue, prepare_instrumented_value(), histogram_value_t::stmt, and tree_coverage_counter_addr().

Referenced by instrument_values().

void gimple_init_edge_profiler ( void  )
   Create the type and function decls for the interface with gcov.  
         void (*) (gcov_type *, gcov_type, int, unsigned)  
         void (*) (gcov_type *, gcov_type)  
         void (*) (gcov_type *, gcov_type)  
         Workaround for binutils bug 14342.  Once it is fixed, remove lto path.  
             void (*) (gcov_type, void *)  
             void (*) (gcov_type, void *)  
         void (*) (gcov_type *, gcov_type)  
         LTO streamer needs assembler names.  Because we create these decls
         late, we need to initialize them by hand.  

References build_fn_decl(), build_function_type_list(), build_pointer_type(), get_gcov_type(), get_identifier(), and init_ic_make_global_vars().

static void init_ic_make_global_vars ( )
static
@verbatim 

Do initialization work for the edge profiler.

   Add code:
   __thread gcov*       __gcov_indirect_call_counters; // pointer to actual counter
   __thread  void*      __gcov_indirect_call_callee; // actual callee address
     Workaround for binutils bug 14342.  Once it is fixed, remove lto path.  
     Workaround for binutils bug 14342.  Once it is fixed, remove lto path.  

Referenced by gimple_init_edge_profiler().

simple_ipa_opt_pass* make_pass_ipa_tree_profile ( )
static tree prepare_instrumented_value ( )
static
   Emits code to get VALUE to instrument at GSI, and returns the
   variable containing the value.  

Referenced by gimple_gen_pow2_profiler().

static unsigned int tree_profiling ( )
static
   Profile all functions in the callgraph.  
     This is a small-ipa pass that gets called only once, from
     cgraphunit.c:ipa_passes().  
         Don't profile functions produced for builtin stuff.  
         Local pure-const may imply need to fixup the cfg.  
         The above could hose dominator info.  Currently there is
         none coming in, this is a safety valve.  It should be
         easy to adjust it, if and when there is some.  
     Drop pure/const flags from instrumented functions.  
         Don't profile functions produced for builtin stuff.  
     Update call statements and rebuild the cgraph.  
         Don't profile functions produced for builtin stuff.  
         re-merge split blocks.  

Variable Documentation

tree gcov_type_node
static
@verbatim 

Calculate branch probabilities, and basic block execution counts. Copyright (C) 1990-2013 Free Software Foundation, Inc. Contributed by James E. Wilson, UC Berkeley/Cygnus Support; based on some ideas from Dain Samples of UC Berkeley. Further mangling by Bob Manson, Cygnus Support. Converted to use trees by Dale Johannesen, Apple Computer.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

   Generate basic block profile instrumentation and auxiliary files.
   Tree-based version.  See profile.c for overview.  

Referenced by coverage_counter_alloc().

tree ic_gcov_type_ptr_var
static
tree ic_void_ptr_var
static
tree ptr_void
static
tree tree_average_profiler_fn
static
tree tree_indirect_call_profiler_fn
static
tree tree_interval_profiler_fn
static
tree tree_ior_profiler_fn
static
tree tree_one_value_profiler_fn
static
tree tree_pow2_profiler_fn
static