GCC Middle and Back End API Reference
coverage.h File Reference
#include "gcov-io.h"
Include dependency graph for coverage.h:
This graph shows which files directly or indirectly include this file:

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_typeget_coverage_counts (unsigned, unsigned, unsigned, unsigned)
 
tree get_gcov_type (void)
 
bool coverage_node_map_initialized_p (void)
 

Function Documentation

◆ coverage_begin_function()

int coverage_begin_function ( unsigned lineno_checksum,
unsigned cfg_checksum )
extern

◆ coverage_compute_cfg_checksum()

unsigned coverage_compute_cfg_checksum ( struct function * fn)
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, ggc_alloc(), basic_block_def::index, n_basic_blocks_for_fn, and basic_block_def::succs.

Referenced by branch_prob(), and ipa_icf::sem_function::init().

◆ coverage_compute_lineno_checksum()

unsigned coverage_compute_lineno_checksum ( void )
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(), ggc_alloc(), and IDENTIFIER_POINTER.

Referenced by branch_prob().

◆ coverage_compute_profile_id()

unsigned coverage_compute_profile_id ( struct cgraph_node * n)
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(), ggc_alloc(), IDENTIFIER_POINTER, TREE_PUBLIC, and symtab_node::unique_name.

Referenced by init_node_map().

◆ coverage_counter_alloc()

int coverage_counter_alloc ( unsigned counter,
unsigned num )
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().

◆ coverage_end_function()

◆ coverage_finish()

◆ coverage_init()

void coverage_init ( const char * filename)
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(), ggc_alloc(), 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().

◆ coverage_node_map_initialized_p()

bool coverage_node_map_initialized_p ( void )
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().

◆ coverage_remove_note_file()

void coverage_remove_note_file ( void )
extern
Remove coverage file if opened.   

References bbg_file_name, gcov_close(), and ggc_alloc().

Referenced by finalize().

◆ get_coverage_counts()

gcov_type * get_coverage_counts ( unsigned ,
unsigned ,
unsigned ,
unsigned  )
extern
Get all the counters for the current function.   

◆ get_gcov_type()

◆ tree_coverage_counter_addr()

tree tree_coverage_counter_addr ( unsigned counter,
unsigned no )
extern

◆ tree_coverage_counter_ref()

tree tree_coverage_counter_ref ( unsigned counter,
unsigned no )
extern