GCC Middle and Back End API Reference
|
#include "version.h"
#include "gcov-counter.def"
Go to the source code of this file.
Data Structures | |
struct | gcov_kvp |
struct | gcov_summary |
Typedefs | |
typedef unsigned | gcov_unsigned_t |
typedef unsigned | gcov_position_t |
Enumerations | |
enum | { GCOV_COUNTERS } |
Functions | |
GCOV_LINKAGE int | gcov_magic (gcov_unsigned_t, gcov_unsigned_t) |
GCOV_LINKAGE int | gcov_open (const char *, int) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE int | gcov_close (void) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE gcov_unsigned_t | gcov_read_unsigned (void) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE gcov_type | gcov_read_counter (void) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE void | gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE const char * | gcov_read_string (void) |
GCOV_LINKAGE void | gcov_sync (gcov_position_t, gcov_unsigned_t) |
char * | mangle_path (char const *base) |
GCOV_LINKAGE void | gcov_write (const void *, unsigned) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE void | gcov_write_unsigned (gcov_unsigned_t) ATTRIBUTE_HIDDEN |
GCOV_LINKAGE void | gcov_write_string (const char *) |
GCOV_LINKAGE void | gcov_write_filename (const char *) |
GCOV_LINKAGE gcov_position_t | gcov_write_tag (gcov_unsigned_t) |
GCOV_LINKAGE void | gcov_write_length (gcov_position_t) |
#define ATTRIBUTE_HIDDEN |
#define DEF_GCOV_COUNTER | ( | COUNTER, | |
NAME, | |||
MERGE_FN ) |
Counters that are collected.
#define GCOV_ARC_FAKE (1 << 1) |
Referenced by branch_prob(), read_graph_file(), and tag_arcs().
#define GCOV_ARC_FALLTHROUGH (1 << 2) |
Referenced by branch_prob(), read_graph_file(), and tag_arcs().
#define GCOV_ARC_FALSE (1 << 4) |
Referenced by branch_prob(), and read_graph_file().
#define GCOV_ARC_ON_TREE (1 << 0) |
Arc flags.
Referenced by branch_prob(), read_graph_file(), and tag_arcs().
#define GCOV_ARC_TRUE (1 << 3) |
Referenced by branch_prob(), and read_graph_file().
#define GCOV_BLOCK_UNEXPECTED (1 << 1) |
Basic block flags.
#define GCOV_COUNTER_FOR_TAG | ( | TAG | ) |
Convert a tag to a counter.
Referenced by read_counts_file(), and tag_counters().
#define GCOV_DATA_MAGIC ((gcov_unsigned_t)0x67636461) /* "gcda" @endverbatim */ |
File magic. Must not be palindromes.
Referenced by dump_gcov_file(), read_count_file(), read_counts_file(), and autofdo::read_profile().
#define GCOV_DATA_SUFFIX ".gcda" |
File suffixes.
Referenced by coverage_init(), and create_file_names().
#define gcov_error | ( | ... | ) |
#define GCOV_FILENAME_MAGIC ((gcov_unsigned_t)0x6763666e) /* "gcfn" @endverbatim */ |
#define GCOV_FIRST_VALUE_COUNTER GCOV_COUNTER_V_INTERVAL |
The first of counters used for value profiling. They must form a consecutive interval and their order must match the order of HIST_TYPEs in value-prof.h.
#define GCOV_LAST_VALUE_COUNTER (GCOV_COUNTERS - 1) |
The last of counters used for value profiling.
#define GCOV_LINKAGE extern |
#define GCOV_LOCKED 0 |
gcov_type is typedef'd elsewhere for the compiler
#define GCOV_LOCKED_WITH_LOCKING 0 |
#define GCOV_N_VALUE_COUNTERS (GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1) |
Number of counters used for value profiling.
Referenced by compute_value_histograms().
#define gcov_nonruntime_assert | ( | EXPR | ) |
Referenced by gcov_open(), gcov_sync(), and gcov_write_length().
#define GCOV_NOTE_MAGIC ((gcov_unsigned_t)0x67636e6f) /* "gcno" @endverbatim */ |
Referenced by coverage_init(), dump_gcov_file(), and read_graph_file().
#define GCOV_NOTE_SUFFIX ".gcno" |
Referenced by coverage_init(), and create_file_names().
#define GCOV_TAG_AFDO_FILE_NAMES ((gcov_unsigned_t)0xaa000000) |
Referenced by autofdo::string_table::read().
#define GCOV_TAG_AFDO_FUNCTION ((gcov_unsigned_t)0xac000000) |
Referenced by autofdo::autofdo_source_profile::read().
#define GCOV_TAG_AFDO_WORKING_SET ((gcov_unsigned_t)0xaf000000) |
#define GCOV_TAG_ARCS ((gcov_unsigned_t)0x01430000) |
Referenced by branch_prob(), and read_graph_file().
#define GCOV_TAG_ARCS_LENGTH | ( | NUM | ) |
#define GCOV_TAG_ARCS_NUM | ( | LENGTH | ) |
Referenced by read_graph_file(), and tag_arcs().
#define GCOV_TAG_BLOCKS ((gcov_unsigned_t)0x01410000) |
Referenced by branch_prob(), and read_graph_file().
#define GCOV_TAG_CONDS ((gcov_unsigned_t)0x01470000) |
Referenced by branch_prob(), and read_graph_file().
#define GCOV_TAG_CONDS_LENGTH | ( | NUM | ) |
#define GCOV_TAG_CONDS_NUM | ( | LENGTH | ) |
Referenced by read_graph_file(), and tag_conditions().
#define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000) |
#define GCOV_TAG_COUNTER_LENGTH | ( | NUM | ) |
Referenced by read_count_file().
#define GCOV_TAG_COUNTER_NUM | ( | LENGTH | ) |
Referenced by read_counts_file(), and tag_counters().
#define GCOV_TAG_FOR_COUNTER | ( | COUNT | ) |
Convert a counter index to a tag.
Referenced by read_count_file().
#define GCOV_TAG_FUNCTION ((gcov_unsigned_t)0x01000000) |
Referenced by coverage_begin_function(), read_count_file(), read_counts_file(), and read_graph_file().
#define GCOV_TAG_FUNCTION_LENGTH (3 * GCOV_WORD_SIZE) |
Referenced by read_count_file().
#define GCOV_TAG_IS_COUNTER | ( | TAG | ) |
Check whether a tag is a counter tag.
Referenced by dump_gcov_file(), and read_counts_file().
#define GCOV_TAG_IS_SUBLEVEL | ( | TAG, | |
SUB ) |
Return nonzero if SUB is at a sublevel to TAG.
#define GCOV_TAG_IS_SUBTAG | ( | TAG, | |
SUB ) |
Return nonzero if SUB is an immediate subtag of TAG.
Referenced by dump_gcov_file(), and read_graph_file().
#define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000) |
Referenced by output_location(), and read_graph_file().
#define GCOV_TAG_MASK | ( | TAG | ) |
The tag level mask has 1's in the position of the inner levels, & the lsb of the current level, and zero on the current and outer levels.
Referenced by dump_gcov_file().
#define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) |
Referenced by read_count_file(), and read_counts_file().
#define GCOV_TAG_OBJECT_SUMMARY_LENGTH (2 * GCOV_WORD_SIZE) |
#define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000) /* Obsolete @endverbatim */ |
#define GCOV_TOPN_DISK_COUNTERS 2 |
Number of top N counters in disk representation.
#define GCOV_TOPN_MAXIMUM_TRACKED_VALUES 32 |
Maximum number of tracked TOP N value profiles.
Referenced by dump_ic_profile(), ipa_profile_generate_summary(), ipa_profile_read_edge_summary(), and ipa_profile_write_edge_summary().
#define GCOV_TOPN_MEM_COUNTERS 3 |
Number of top N counters when being in memory.
Referenced by gimple_find_values_to_profile().
#define GCOV_UNSIGNED2STRING | ( | ARRAY, | |
VALUE ) |
Convert a magic or version number to a 4 character string.
Referenced by dump_gcov_file(), read_count_file(), read_counts_file(), and read_graph_file().
#define GCOV_WORD_SIZE 4 |
The record tags. Values [1..3f] are for tags which may be in either file. Values [41..9f] for those in the note file and [a1..ff] for the data file. The tag value zero is used as an explicit end of file marker -- it is not required to be present. All length values are in bytes.
Referenced by gcov_read_words(), and gcov_write_length().
typedef unsigned gcov_position_t |
typedef unsigned gcov_unsigned_t |
About the host
anonymous enum |
GCOV_LINKAGE int gcov_close | ( | void | ) |
Close the current gcov file. Flushes data to disk. Returns nonzero on failure or error flag set.
References gcov_var::error, gcov_var::file, GCOV_FILE_WRITE_ERROR, and gcov_var::mode.
Referenced by coverage_finish(), coverage_remove_note_file(), dump_gcov_file(), read_count_file(), read_counts_file(), and read_graph_file().
GCOV_LINKAGE int gcov_magic | ( | gcov_unsigned_t | magic, |
gcov_unsigned_t | expected ) |
Functions for reading and writing gcov files. In libgcov you can open the file for reading then writing. Elsewhere you can open the file either for reading or for writing. When reading a file you may use the gcov_read_* functions, gcov_sync, gcov_position, and gcov_error. When writing a file you may use the gcov_write* functions and gcov_error. When a file is to be rewritten you use the functions for reading, then gcov_rewrite then the functions for writing. Your file may become corrupted if you break these invariants.
Check if MAGIC is EXPECTED. Use it to determine endianness of the file. Returns +1 for same endian, -1 for other endian and zero for not EXPECTED.
References gcov_var::endian.
Referenced by dump_gcov_file(), read_count_file(), read_counts_file(), and read_graph_file().
GCOV_LINKAGE int gcov_open | ( | const char * | name, |
int | mode ) |
Available everywhere.
Open a gcov file. NAME is the name of the file to open and MODE indicates whether a new file should be created, or an existing file opened. If MODE is >= 0 an existing file will be opened, if possible, and if MODE is <= 0, a new file will be created. Use MODE=0 to attempt to reopen an existing file and then fall back on creating a new one. If MODE > 0, the file will be opened in read-only mode. Otherwise it will be opened for modification. Return zero on failure, non-zero on success.
References gcov_var::endian, errno, gcov_var::error, fdopen, gcov_var::file, fopen, GCOV_FILE_NO_ERROR, GCOV_MODE_STDIN, gcov_nonruntime_assert, LONG_MAX, gcov_var::mode, O_BINARY, O_RDONLY, and SEEK_SET.
Referenced by coverage_init(), dump_gcov_file(), read_count_file(), read_counts_file(), read_graph_file(), and autofdo::read_profile().
GCOV_LINKAGE gcov_type gcov_read_counter | ( | void | ) |
Read counter value from a coverage file. Sets error flag on file error, overflow flag on overflow
References gcov_var::error, from_file(), GCOV_FILE_COUNTER_OVERFLOW, and gcov_read_words().
Referenced by autofdo::autofdo_source_profile::read(), read_count_file(), read_counts_file(), autofdo::function_instance::read_function_instance(), and tag_counters().
GCOV_LINKAGE const char * gcov_read_string | ( | void | ) |
We need to expose the below function when compiling for gcov-tool.
Read string from coverage file. Allocate the buffer for the string from the heap or die. Return a pointer to the string, or NULL on empty string.
References gcov_read_bytes(), and gcov_read_unsigned().
Referenced by dump_gcov_file(), autofdo::string_table::read(), read_graph_file(), tag_function(), and tag_lines().
GCOV_LINKAGE void gcov_read_summary | ( | struct gcov_summary * | summary | ) |
References gcov_read_unsigned(), gcov_summary::runs, and gcov_summary::sum_max.
Referenced by read_count_file(), and tag_summary().
GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned | ( | void | ) |
Read unsigned value from a coverage file. Sets error flag on file error, overflow flag on overflow
References from_file(), and gcov_read_words().
Referenced by dump_gcov_file(), autofdo::fake_read_autofdo_module_profile(), gcov_read_string(), gcov_read_summary(), autofdo::autofdo_source_profile::read(), autofdo::string_table::read(), read_count_file(), read_counts_file(), autofdo::function_instance::read_function_instance(), read_graph_file(), autofdo::read_profile(), tag_arcs(), tag_blocks(), tag_conditions(), tag_function(), and tag_lines().
GCOV_LINKAGE void gcov_sync | ( | gcov_position_t | base, |
gcov_unsigned_t | length ) |
We need to expose the below function when compiling for gcov-tool.
Reset to a known position. BASE should have been obtained from gcov_position, LENGTH should be a record length.
References gcov_var::file, GCOV_MODE_STDIN, gcov_nonruntime_assert, gcov_var::mode, and SEEK_SET.
Referenced by dump_gcov_file(), read_count_file(), read_counts_file(), and read_graph_file().
GCOV_LINKAGE void gcov_write | ( | const void * | data, |
unsigned | length ) |
Available outside gcov
Write DATA of LENGTH characters to coverage file.
References gcov_var::error, gcov_var::file, GCOV_FILE_WRITE_ERROR, and r.
GCOV_LINKAGE void gcov_write_filename | ( | const char * | filename | ) |
Write FILENAME to coverage file. Sets error flag on file error, overflow flag on overflow
References free(), gcov_write_string(), and NULL.
Referenced by coverage_begin_function(), and output_location().
GCOV_LINKAGE void gcov_write_length | ( | gcov_position_t | position | ) |
Write a record length using POSITION, which was returned by gcov_write_tag. The current file position is the end of the record, and is restored before returning. Returns nonzero on overflow.
References current_position, gcov_nonruntime_assert, gcov_position(), gcov_seek(), GCOV_WORD_SIZE, gcov_write_unsigned(), and gcov_var::mode.
Referenced by branch_prob(), and coverage_begin_function().
GCOV_LINKAGE void gcov_write_string | ( | const char * | string | ) |
Available only in compiler
Write STRING to coverage file. Sets error flag on file error, overflow flag on overflow
References gcov_var::error, gcov_var::file, GCOV_FILE_WRITE_ERROR, gcov_write_unsigned(), and r.
Referenced by branch_prob(), coverage_begin_function(), coverage_init(), and gcov_write_filename().
GCOV_LINKAGE gcov_position_t gcov_write_tag | ( | gcov_unsigned_t | tag | ) |
Write a tag TAG and reserve space for the record length. Return a value to be used for gcov_write_length.
References gcov_position(), and gcov_write_unsigned().
Referenced by branch_prob(), coverage_begin_function(), and output_location().
GCOV_LINKAGE void gcov_write_unsigned | ( | gcov_unsigned_t | value | ) |
Write unsigned VALUE to coverage file.
References gcov_var::error, gcov_var::file, GCOV_FILE_WRITE_ERROR, and r.
Referenced by branch_prob(), coverage_begin_function(), coverage_init(), gcov_write_length(), gcov_write_string(), gcov_write_tag(), and output_location().
char * mangle_path | ( | char const * | base | ) |
Mangle filename path of BASE and output new allocated pointer with mangled path.
Referenced by coverage_init(), get_gcov_intermediate_filename(), and mangle_name().