GCC Middle and Back End API Reference
|
#include "gcov-io.h"
Go to the source code of this file.
Functions | |
void | coverage_init (const char *) |
void | coverage_finish (void) |
void | coverage_remove_note_file (void) |
int | coverage_begin_function (unsigned, unsigned) |
void | coverage_end_function (unsigned, unsigned) |
unsigned | coverage_compute_cfg_checksum (struct function *fn) |
unsigned | coverage_compute_profile_id (struct cgraph_node *n) |
unsigned | coverage_compute_lineno_checksum (void) |
int | coverage_counter_alloc (unsigned, unsigned) |
tree | tree_coverage_counter_ref (unsigned, unsigned) |
tree | tree_coverage_counter_addr (unsigned, unsigned) |
gcov_type * | get_coverage_counts (unsigned, unsigned, unsigned, unsigned) |
tree | get_gcov_type (void) |
bool | coverage_node_map_initialized_p (void) |
|
extern |
Start outputting coverage information for the current 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, cfun, coverage_node_map_initialized_p(), current_function_decl, current_function_funcdef_no, DECL_ARTIFICIAL, DECL_ASSEMBLER_NAME, DECL_FUNCTION_VERSIONED, DECL_LAMBDA_FUNCTION_P, DECL_SOURCE_LOCATION, expand_location(), gcc_assert, gcov_is_error(), GCOV_TAG_FUNCTION, gcov_write_filename(), gcov_write_length(), gcov_write_string(), gcov_write_tag(), gcov_write_unsigned(), cgraph_node::get(), IDENTIFIER_POINTER, no_coverage, offset, remap_profile_filename(), and warning_at().
Referenced by branch_prob().
|
extern |
Compute the control flow checksum for the function FN given as argument.
Compute cfg checksum for the function FN given as argument. 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(), FOR_EACH_BB_FN, FOR_EACH_EDGE, basic_block_def::index, n_basic_blocks_for_fn, and basic_block_def::succs.
Referenced by branch_prob(), and ipa_icf::sem_function::init().
|
extern |
Compute the line number checksum for the current function.
Compute checksum for the current function. We generate a CRC32.
References coverage_checksum_string(), current_function_decl, DECL_ASSEMBLER_NAME, DECL_SOURCE_LOCATION, expand_location(), and IDENTIFIER_POINTER.
Referenced by branch_prob().
|
extern |
Compute the profile id of function N.
Compute profile ID. This is better to be unique in whole program.
References coverage_checksum_string(), symtab_node::decl, DECL_ASSEMBLER_NAME, DECL_EXTERNAL, DECL_SOURCE_LOCATION, endswith(), expand_location(), first_global_object_name, free(), IDENTIFIER_POINTER, TREE_PUBLIC, and symtab_node::unique_name.
Referenced by init_node_map().
|
extern |
Allocate some counters. Repeatable per function.
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(), no_coverage, and NULL_TREE.
Referenced by branch_prob(), and instrument_values().
|
extern |
Complete the coverage information for the current 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, cfun, coverage_node_map_initialized_p(), coverage_data::ctr_vars, current_function_decl, current_function_funcdef_no, DECL_SIZE, DECL_SIZE_UNIT, varpool_node::finalize_decl(), fn_b_ctrs, fn_ctr_mask, coverage_data::fn_decl, fn_n_ctrs, fn_v_ctrs, functions_tail, gcc_assert, GCOV_COUNTERS, gcov_is_error(), cgraph_node::get(), get_gcov_type(), ggc_alloc(), i, coverage_data::ident, coverage_data::lineno_checksum, coverage_data::next, NULL, NULL_TREE, prg_ctr_mask, cgraph_node::profile_id, size_int, TREE_TYPE, TYPE_SIZE, TYPE_SIZE_UNIT, and warning().
Referenced by branch_prob().
|
extern |
Performs file-level cleanup. Close notes file, generate coverage variables and constructor.
References bbg_file_name, coverage_data::cfg_checksum, coverage_obj_finish(), coverage_obj_fn(), coverage_obj_init(), crc32_unsigned(), da_file_name, coverage_data::fn_decl, functions_head, gcov_close(), coverage_data::ident, coverage_data::lineno_checksum, local_tick, coverage_data::next, and NULL.
Referenced by ipa_passes().
|
extern |
coverage.h - Defines data exported from coverage.cc Copyright (C) 1998-2024 Free Software Foundation, Inc. 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/>.
Perform file-level initialization. Read in data file, generate name of notes file.
References bbg_file_name, bbg_file_stamp, da_file_name, gcc::dump_manager::dump_finish(), gcc::dump_manager::dump_start(), error(), g, GCOV_DATA_SUFFIX, GCOV_NOTE_MAGIC, GCOV_NOTE_SUFFIX, gcov_open(), gcov_write_string(), gcov_write_unsigned(), gcc::context::get_dumps(), gcc::pass_manager::get_pass_profile(), gcc::context::get_passes(), local_tick, mangle_path(), lang_hooks::name, NULL, read_autofdo_file(), read_counts_file(), startswith(), opt_pass::static_pass_number, and warning().
Referenced by do_compile().
|
extern |
Returns true if node graph is initialized. This is used to test if profile_id has been created for cgraph_nodes.
References cgraph_node_map.
Referenced by coverage_begin_function(), coverage_end_function(), and get_coverage_counts().
|
extern |
Remove coverage file if opened.
References bbg_file_name, and gcov_close().
Referenced by finalize().
|
extern |
Get all the counters for the current function.
|
extern |
Return the type node for gcov_type.
References LONG_LONG_TYPE_SIZE, opt_mode< T >::require(), smallest_int_mode_for_size(), lang_hooks_for_types::type_for_mode, and lang_hooks::types.
Referenced by build_fn_info_type(), build_info_type(), coverage_counter_alloc(), coverage_end_function(), gimple_divmod_fixed_value_transform(), gimple_gen_ic_profiler(), gimple_gen_time_profiler(), gimple_init_gcov_profiler(), gimple_stringops_transform(), init_ic_make_global_vars(), tree_coverage_counter_addr(), tree_coverage_counter_ref(), and tree_profiling().
|
extern |
Use a counter address from the most recent allocation.
Generate a tree to access the address of COUNTER NO.
References build4(), build_fold_addr_expr, build_int_cst(), fn_b_ctrs, fn_n_ctrs, fn_v_ctrs, gcc_assert, gcov_type_node, get_gcov_type(), integer_type_node, and NULL.
Referenced by gimple_gen_average_profiler(), gimple_gen_ic_profiler(), gimple_gen_ior_profiler(), gimple_gen_pow2_profiler(), and gimple_gen_topn_values_profiler().
|
extern |
Use a counter from the most recent allocation.
Generate a tree to access COUNTER NO.
References build4(), build_int_cst(), fn_b_ctrs, fn_n_ctrs, fn_v_ctrs, gcc_assert, gcov_type_node, get_gcov_type(), integer_type_node, and NULL.
Referenced by gimple_gen_edge_profiler(), gimple_gen_interval_profiler(), gimple_gen_time_profiler(), and instrument_decisions().