GCC Middle and Back End API Reference
|
#include "gt-coverage.h"
Data Structures | |
struct | coverage_data |
struct | counts_entry |
Typedefs | |
typedef struct counts_entry | counts_entry_t |
Variables | |
static struct coverage_data * | functions_head = 0 |
static struct coverage_data ** | functions_tail = &functions_head |
static unsigned | no_coverage = 0 |
static unsigned | prg_ctr_mask |
static unsigned | fn_ctr_mask |
static tree | fn_v_ctrs [GCOV_COUNTERS] |
static unsigned | fn_n_ctrs [GCOV_COUNTERS] |
static unsigned | fn_b_ctrs [GCOV_COUNTERS] |
static tree | gcov_info_var |
static tree | gcov_fn_info_type |
static tree | gcov_fn_info_ptr_type |
static char * | bbg_file_name |
static unsigned | bbg_file_stamp |
static char * | da_file_name |
static const char *const | ctr_merge_functions [GCOV_COUNTERS] = GCOV_MERGE_FUNCTIONS |
static const char *const | ctr_names [GCOV_COUNTERS] = GCOV_COUNTER_NAMES |
static hash_table< counts_entry > | counts_hash |
typedef struct counts_entry counts_entry_t |
Counts information for a function.
|
static |
Referenced by coverage_obj_fn().
|
static |
Returns a CONSTRUCTOR for a gcov_fn_info. DATA is the coverage data for the function and TYPE is the gcov_fn_info RECORD_TYPE. KEY is the object file key.
References build_constructor(), build_int_cstu(), coverage_data::cfg_checksum, count, coverage_data::ctr_vars, get_gcov_unsigned_t(), coverage_data::ident, coverage_data::lineno_checksum, prg_ctr_mask, and tree_low_cst().
Referenced by coverage_obj_init().
|
static |
Creates the gcov_fn_info RECORD_TYPE.
References build_array_type(), build_index_type(), build_pointer_type(), build_qualified_type(), finish_builtin_struct(), get_gcov_type(), get_gcov_unsigned_t(), lang_hooks_for_types::make_type, TYPE_QUAL_CONST, and lang_hooks::types.
Referenced by coverage_obj_finish().
|
static |
Returns a CONSTRUCTOR for the gcov_info object. INFO_TYPE is the gcov_info structure type, FN_ARY is the array of pointers to function info objects.
References bbg_file_stamp, build_array_type(), build_constructor(), build_index_type(), build_int_cstu(), build_string(), ctr_merge_functions, da_file_name, get_identifier(), prg_ctr_mask, and strlen().
Referenced by coverage_obj_init().
|
static |
Create gcov_info struct. TYPE is the incomplete RECORD_TYPE to be completed, and FN_INFO_PTR_TYPE is a pointer to the function info type.
References build_array_type(), build_function_type_list(), build_index_type(), build_pointer_type(), build_qualified_type(), finish_builtin_struct(), get_gcov_type(), get_gcov_unsigned_t(), and TYPE_QUAL_CONST.
|
static |
Generate the constructor function to call __gcov_init.
References append_to_statement_list(), build_call_expr(), build_function_type_list(), build_pointer_type(), cgraph_build_static_cdtor(), gcov_info_var, and get_identifier().
Referenced by coverage_obj_init().
Referenced by coverage_counter_alloc(), and coverage_obj_fn().
|
static |
Build a coverage variable of TYPE for function FN_DECL. If COUNTER >= 0 it is a counter array, otherwise it is the function structure.
References get_identifier(), len, memcpy(), strlen(), and targetm.
int coverage_begin_function | ( | ) |
Begin output to the notes file for the current function. Writes the function header. Returns nonzero if data should be output.
References bbg_file_name, current_function_decl, expand_location(), gcov_is_error(), gcov_write_length(), gcov_write_string(), gcov_write_tag(), gcov_write_unsigned(), no_coverage, and offset.
Referenced by branch_prob().
|
static |
Generate a checksum for a string. CHKSUM is the current checksum.
References crc32_string(), free(), and offset.
Referenced by coverage_compute_lineno_checksum(), and coverage_compute_profile_id().
unsigned coverage_compute_cfg_checksum | ( | void | ) |
Compute cfg checksum for the current function. The checksum is calculated carefully so that source code changes that doesn't affect the control flow graph won't change the checksum. This is to make the profile data useable across source code change. The downside of this is that the compiler may use potentially wrong profile data - that the source code change has non-trivial impact on the validity of profile data (e.g. the reversed condition) but the compiler won't detect the change and use the wrong profile data.
References crc32_byte(), edge_def::dest, basic_block_def::index, and basic_block_def::succs.
Referenced by branch_prob().
unsigned coverage_compute_lineno_checksum | ( | void | ) |
Compute checksum for the current function. We generate a CRC32.
References coverage_checksum_string(), current_function_decl, and expand_location().
Referenced by branch_prob().
unsigned coverage_compute_profile_id | ( | ) |
Compute profile ID. This is better to be unique in whole program.
References coverage_checksum_string(), symtab_node_base::decl, expand_location(), first_global_object_name, and cgraph_node::symbol.
Referenced by init_node_map().
int coverage_counter_alloc | ( | ) |
Allocate NUM counters of type COUNTER. Returns nonzero if the allocation succeeded.
References build_array_type(), build_var(), current_function_decl, fn_b_ctrs, fn_ctr_mask, fn_n_ctrs, fn_v_ctrs, get_gcov_type(), and no_coverage.
Referenced by branch_prob(), and instrument_values().
void coverage_end_function | ( | ) |
Finish coverage data for the current function. Verify no output error has occurred. Save function coverage counts.
References bbg_file_name, build_array_type(), build_index_type(), coverage_data::cfg_checksum, coverage_data::ctr_vars, current_function_decl, fn_b_ctrs, fn_ctr_mask, coverage_data::fn_decl, fn_n_ctrs, fn_v_ctrs, functions_tail, gcov_is_error(), get_gcov_type(), coverage_data::ident, coverage_data::lineno_checksum, coverage_data::next, prg_ctr_mask, varpool_finalize_decl(), and warning().
Referenced by branch_prob().
void coverage_finish | ( | void | ) |
Performs file-level cleanup. Close notes file, generate coverage variables and constructor.
References bbg_file_name, coverage_obj_finish(), coverage_obj_fn(), coverage_obj_init(), da_file_name, coverage_data::fn_decl, functions_head, gcov_close(), local_tick, and coverage_data::next.
Referenced by ipa_passes().
void coverage_init | ( | ) |
Perform file-level initialization. Read in data file, generate name of notes file.
References bbg_file_name, bbg_file_stamp, da_file_name, error(), gcov_open(), gcov_write_unsigned(), len, local_tick, memcpy(), read_counts_file(), and strlen().
Referenced by do_compile().
|
static |
Referenced by coverage_finish().
|
static |
Finalize the coverage data. Generates the array of pointers to function objects from CTOR. Generate the gcov_info initializer.
References build_array_type(), build_constructor(), build_index_type(), build_info(), build_qualified_type(), gcov_fn_info_ptr_type, gcov_info_var, get_identifier(), TYPE_QUAL_CONST, varpool_finalize_decl(), and vec_safe_length().
|
static |
Generate the coverage function info for FN and DATA. Append a pointer to that object to CTOR and return the appended CTOR.
References build_fn_info(), build_var(), gcov_fn_info_ptr_type, gcov_fn_info_type, gcov_info_var, and varpool_finalize_decl().
Referenced by coverage_finish().
|
static |
Create the gcov_info types and object. Generate the constructor function to call __gcov_init. Does not generate the initializer for the object. Returns TRUE if coverage data is being emitted.
References build_fn_info_type(), build_info_type(), build_init_ctor(), build_pointer_type(), build_qualified_type(), cgraph_dump_file, da_file_name, coverage_data::fn_decl, functions_head, gcov_fn_info_ptr_type, gcov_fn_info_type, gcov_info_var, get_identifier(), lang_hooks_for_types::make_type, coverage_data::next, no_coverage, prg_ctr_mask, TYPE_QUAL_CONST, and lang_hooks::types.
Referenced by coverage_finish().
gcov_type* get_coverage_counts | ( | unsigned | counter, |
unsigned | expected, | ||
unsigned | cfg_checksum, | ||
unsigned | lineno_checksum, | ||
const struct gcov_ctr_summary ** | summary | ||
) |
Returns the counters for a particular tag.
References counts_entry::cfg_checksum, counts_entry::counts, counts_hash, counts_entry::ctr, ctr_names, current_function_decl, da_file_name, counts_entry::ident, inform(), input_location, counts_entry::lineno_checksum, gcov_ctr_summary::num, seen_error(), counts_entry::summary, warning(), and warning_at().
Referenced by compute_value_histograms(), and get_exec_counts().
tree get_gcov_type | ( | void | ) |
Return the type node for gcov_type.
Referenced by build_fn_info_type(), build_info_type(), coverage_counter_alloc(), coverage_end_function(), gimple_divmod_fixed_value_transform(), gimple_init_edge_profiler(), gimple_stringops_transform(), init_ic_make_global_vars(), tree_coverage_counter_addr(), and tree_coverage_counter_ref().
|
static |
Return the type node for gcov_unsigned_t.
Referenced by build_fn_info(), build_fn_info_type(), and build_info_type().
|
static |
Forward declarations.
Read in the counts file, if available.
References counts_hash, and error().
Referenced by coverage_init().
tree tree_coverage_counter_addr | ( | ) |
Generate a tree to access the address of COUNTER NO.
References build_int_cst(), fn_b_ctrs, fn_n_ctrs, fn_v_ctrs, gcov_type_node, and get_gcov_type().
Referenced by gimple_gen_average_profiler(), gimple_gen_ic_profiler(), gimple_gen_ior_profiler(), gimple_gen_one_value_profiler(), and gimple_gen_pow2_profiler().
tree tree_coverage_counter_ref | ( | ) |
Generate a tree to access COUNTER NO.
References build_int_cst(), fn_b_ctrs, fn_n_ctrs, fn_v_ctrs, gcov_type_node, and get_gcov_type().
Referenced by gimple_gen_edge_profiler(), and gimple_gen_interval_profiler().
|
static |
Name of the notes (gcno) output file. The "bbg" prefix is for historical reasons, when the notes file contained only the basic block graph notes. If this is NULL we're not writing to the notes file.
Referenced by coverage_begin_function(), coverage_end_function(), coverage_finish(), and coverage_init().
|
static |
File stamp for notes file.
Referenced by build_info(), and coverage_init().
|
static |
Hash table of count data.
Referenced by get_coverage_counts(), and read_counts_file().
|
static |
The names of merge functions for counters.
Referenced by build_info().
|
static |
Referenced by get_coverage_counts().
|
static |
Name of the count data (gcda) file.
Referenced by build_info(), coverage_finish(), coverage_init(), coverage_obj_init(), and get_coverage_counts().
|
static |
|
static |
Counter information for current function.
Referenced by coverage_counter_alloc(), and coverage_end_function().
|
static |
|
static |
|
static |
Referenced by coverage_finish(), and coverage_obj_init().
|
static |
Referenced by coverage_end_function().
|
static |
Referenced by coverage_obj_finish(), coverage_obj_fn(), and coverage_obj_init().
|
static |
Referenced by coverage_obj_fn(), and coverage_obj_init().
|
static |
Coverage info VAR_DECL and function info type nodes.
Referenced by build_init_ctor(), coverage_obj_finish(), coverage_obj_fn(), and coverage_obj_init().
|
static |
Referenced by coverage_begin_function(), coverage_counter_alloc(), and coverage_obj_init().
|
static |
Cumulative counter information for whole program.
Referenced by build_fn_info(), build_info(), coverage_end_function(), and coverage_obj_init().