mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-11 12:05:50 +08:00
defaults.h (GCOV_TYPE_SIZE): Remove.
* defaults.h (GCOV_TYPE_SIZE): Remove. * gcov-io.h (gcov_type): Set to specific mode int on target. (gcov_unsigned_t, gcov_position_t): New. (GCOV_TYPE_NODE): New. (GCOV_TAG_SUMMARY_LENGTH): Adjust. (GCOV_COUNTERS_SUMMABLE): New. (gcov_ctr_summary, gcov_sumary, gcov_fn_info, gcov_merge_fn, gcov_ctr_info, gcov_info): Adjust types. (gcov_var): Adjust types. (gcov_write_unsigned, gcov_write_tag, gcov_write_length, gcov_write_tag_length, gcov_write_summary, gcov_read_unsigned, gcov_read_summary): Adjust gcov types. (gcov_position, gcov_sync, gcov_seek): Adjust gcov types. * gcov-io.c (gcov_write_unsigned, gcov_write_tag, gcov_write_length, gcov_write_tag_length, gcov_write_summary, gcov_read_unsigned, gcov_read_summary): Adjust gcov types. * libgcov.c (gcov_crc32, gcov_version_mismatch, gcov_exit, __gcov_init, __gcov_merge_add): Adjust gcov types. * coverage.c (ctr_merge_functions): Constify. (ctr_names): New. (read_counts_file): Adjust gcov types. Only summarize & merge summable counters. (coverage_counter_ref): Use GCOV_TYPE_NODE. (build_fn_info_type, build_fn_info_value, build_ctr_info_type, build_ctr_info_value, build_gcov_info): Adjust types. * profile.c (branch_prob): Adjust gcov types. * gcov_dump (dump_file): Adjust gcov types. From-SVN: r66668
This commit is contained in:
parent
bac45eb9ff
commit
9b514d2586
@ -1,3 +1,33 @@
|
||||
2003-05-10 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* defaults.h (GCOV_TYPE_SIZE): Remove.
|
||||
* gcov-io.h (gcov_type): Set to specific mode int on target.
|
||||
(gcov_unsigned_t, gcov_position_t): New.
|
||||
(GCOV_TYPE_NODE): New.
|
||||
(GCOV_TAG_SUMMARY_LENGTH): Adjust.
|
||||
(GCOV_COUNTERS_SUMMABLE): New.
|
||||
(gcov_ctr_summary, gcov_sumary, gcov_fn_info, gcov_merge_fn,
|
||||
gcov_ctr_info, gcov_info): Adjust types.
|
||||
(gcov_var): Adjust types.
|
||||
(gcov_write_unsigned, gcov_write_tag,
|
||||
gcov_write_length, gcov_write_tag_length, gcov_write_summary,
|
||||
gcov_read_unsigned, gcov_read_summary): Adjust gcov types.
|
||||
(gcov_position, gcov_sync, gcov_seek): Adjust gcov types.
|
||||
* gcov-io.c (gcov_write_unsigned, gcov_write_tag,
|
||||
gcov_write_length, gcov_write_tag_length, gcov_write_summary,
|
||||
gcov_read_unsigned, gcov_read_summary): Adjust gcov types.
|
||||
* libgcov.c (gcov_crc32, gcov_version_mismatch, gcov_exit,
|
||||
__gcov_init, __gcov_merge_add): Adjust gcov types.
|
||||
* coverage.c (ctr_merge_functions): Constify.
|
||||
(ctr_names): New.
|
||||
(read_counts_file): Adjust gcov types. Only summarize & merge
|
||||
summable counters.
|
||||
(coverage_counter_ref): Use GCOV_TYPE_NODE.
|
||||
(build_fn_info_type, build_fn_info_value, build_ctr_info_type,
|
||||
build_ctr_info_value, build_gcov_info): Adjust types.
|
||||
* profile.c (branch_prob): Adjust gcov types.
|
||||
* gcov_dump (dump_file): Adjust gcov types.
|
||||
|
||||
2003-05-10 Richard Earnshaw <rearnsha@arm.com>
|
||||
|
||||
* arm.md (DOM_CC_X_AND_Y, DOM_CC_NX_OR_Y, DOM_CC_X_OR_Y): New
|
||||
|
@ -99,7 +99,8 @@ static htab_t counts_hash = NULL;
|
||||
static GTY(()) rtx ctr_labels[GCOV_COUNTERS];
|
||||
|
||||
/* The names of merge functions for counters. */
|
||||
static const char *ctr_merge_functions[GCOV_COUNTERS] = GCOV_MERGE_FUNCTIONS;
|
||||
static const char *const ctr_merge_functions[GCOV_COUNTERS] = GCOV_MERGE_FUNCTIONS;
|
||||
static const char *const ctr_names[GCOV_COUNTERS] = GCOV_COUNTER_NAMES;
|
||||
|
||||
/* Forward declarations. */
|
||||
static hashval_t htab_counts_entry_hash PARAMS ((const void *));
|
||||
@ -151,8 +152,9 @@ htab_counts_entry_del (of)
|
||||
static void
|
||||
read_counts_file ()
|
||||
{
|
||||
unsigned fn_ident = 0;
|
||||
unsigned version, ix, checksum = -1;
|
||||
gcov_unsigned_t fn_ident = 0;
|
||||
gcov_unsigned_t version, checksum = -1;
|
||||
unsigned ix;
|
||||
counts_entry_t *summaried = NULL;
|
||||
unsigned seen_summary = 0;
|
||||
|
||||
@ -168,7 +170,7 @@ read_counts_file ()
|
||||
else if ((version = gcov_read_unsigned ()) != GCOV_VERSION)
|
||||
{
|
||||
char v[4], e[4];
|
||||
unsigned required = GCOV_VERSION;
|
||||
gcov_unsigned_t required = GCOV_VERSION;
|
||||
|
||||
for (ix = 4; ix--; required >>= 8, version >>= 8)
|
||||
{
|
||||
@ -186,8 +188,8 @@ read_counts_file ()
|
||||
htab_counts_entry_del);
|
||||
while (!gcov_is_eof ())
|
||||
{
|
||||
unsigned tag, length;
|
||||
unsigned long offset;
|
||||
gcov_unsigned_t tag, length;
|
||||
gcov_position_t offset;
|
||||
int error;
|
||||
|
||||
tag = gcov_read_unsigned ();
|
||||
@ -259,17 +261,25 @@ read_counts_file ()
|
||||
htab_delete (counts_hash);
|
||||
break;
|
||||
}
|
||||
|
||||
/* This should always be true for a just allocated entry,
|
||||
and always false for an existing one. Check this way, in
|
||||
case the gcov file is corrupt. */
|
||||
if (!entry->chain || summaried != entry)
|
||||
else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE)
|
||||
{
|
||||
warning ("cannot merge separate %s counters for function %u",
|
||||
ctr_names[elt.ctr], fn_ident);
|
||||
goto skip_merge;
|
||||
}
|
||||
|
||||
if (elt.ctr < GCOV_COUNTERS_SUMMABLE
|
||||
/* This should always be true for a just allocated entry,
|
||||
and always false for an existing one. Check this way, in
|
||||
case the gcov file is corrupt. */
|
||||
&& (!entry->chain || summaried != entry))
|
||||
{
|
||||
entry->chain = summaried;
|
||||
summaried = entry;
|
||||
}
|
||||
for (ix = 0; ix != n_counts; ix++)
|
||||
entry->counts[ix] += gcov_read_counter ();
|
||||
skip_merge:;
|
||||
}
|
||||
gcov_sync (offset, length);
|
||||
if ((error = gcov_is_error ()))
|
||||
@ -332,7 +342,8 @@ get_coverage_counts (unsigned counter, unsigned expected,
|
||||
rtx
|
||||
coverage_counter_ref (unsigned counter, unsigned no)
|
||||
{
|
||||
enum machine_mode mode = mode_for_size (GCOV_TYPE_SIZE, MODE_INT, 0);
|
||||
unsigned gcov_size = tree_low_cst (TYPE_SIZE (GCOV_TYPE_NODE), 1);
|
||||
enum machine_mode mode = mode_for_size (gcov_size, MODE_INT, 0);
|
||||
rtx ref;
|
||||
|
||||
if (!ctr_labels[counter])
|
||||
@ -350,8 +361,7 @@ coverage_counter_ref (unsigned counter, unsigned no)
|
||||
}
|
||||
|
||||
no += prg_n_ctrs[counter];
|
||||
ref = plus_constant (ctr_labels[counter],
|
||||
GCOV_TYPE_SIZE / BITS_PER_UNIT * no);
|
||||
ref = plus_constant (ctr_labels[counter], gcov_size / BITS_PER_UNIT * no);
|
||||
ref = gen_rtx_MEM (mode, ref);
|
||||
set_mem_alias_set (ref, new_alias_set ());
|
||||
|
||||
@ -489,10 +499,10 @@ build_fn_info_type (counters)
|
||||
tree array_type;
|
||||
|
||||
/* ident */
|
||||
fields = build_decl (FIELD_DECL, NULL_TREE, unsigned_type_node);
|
||||
fields = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
|
||||
|
||||
/* checksum */
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_type_node);
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
|
||||
TREE_CHAIN (field) = fields;
|
||||
fields = field;
|
||||
|
||||
@ -525,14 +535,14 @@ build_fn_info_value (function, type)
|
||||
|
||||
/* ident */
|
||||
value = tree_cons (fields,
|
||||
convert (unsigned_type_node,
|
||||
convert (unsigned_intSI_type_node,
|
||||
build_int_2 (function->ident, 0)),
|
||||
value);
|
||||
fields = TREE_CHAIN (fields);
|
||||
|
||||
/* checksum */
|
||||
value = tree_cons (fields,
|
||||
convert (unsigned_type_node,
|
||||
convert (unsigned_intSI_type_node,
|
||||
build_int_2 (function->checksum, 0)),
|
||||
value);
|
||||
fields = TREE_CHAIN (fields);
|
||||
@ -562,26 +572,24 @@ build_ctr_info_type ()
|
||||
{
|
||||
tree type = (*lang_hooks.types.make_type) (RECORD_TYPE);
|
||||
tree field, fields = NULL_TREE;
|
||||
tree gcov_ptr_type = build_pointer_type (GCOV_TYPE_NODE);
|
||||
tree gcov_merge_fn_type;
|
||||
|
||||
|
||||
/* counters */
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_type_node);
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
|
||||
TREE_CHAIN (field) = fields;
|
||||
fields = field;
|
||||
|
||||
/* values */
|
||||
field = build_decl (FIELD_DECL, NULL_TREE,
|
||||
build_pointer_type (make_signed_type (GCOV_TYPE_SIZE)));
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, gcov_ptr_type);
|
||||
TREE_CHAIN (field) = fields;
|
||||
fields = field;
|
||||
|
||||
/* merge */
|
||||
gcov_merge_fn_type =
|
||||
build_function_type_list (
|
||||
void_type_node,
|
||||
build_pointer_type (make_signed_type (GCOV_TYPE_SIZE)),
|
||||
unsigned_type_node,
|
||||
NULL_TREE);
|
||||
build_function_type_list (void_type_node,
|
||||
gcov_ptr_type, unsigned_type_node,
|
||||
NULL_TREE);
|
||||
field = build_decl (FIELD_DECL, NULL_TREE,
|
||||
build_pointer_type (gcov_merge_fn_type));
|
||||
TREE_CHAIN (field) = fields;
|
||||
@ -607,7 +615,7 @@ build_ctr_info_value (counter, type)
|
||||
|
||||
/* counters */
|
||||
value = tree_cons (fields,
|
||||
convert (unsigned_type_node,
|
||||
convert (unsigned_intSI_type_node,
|
||||
build_int_2 (prg_n_ctrs[counter], 0)),
|
||||
value);
|
||||
fields = TREE_CHAIN (fields);
|
||||
@ -641,9 +649,7 @@ build_ctr_info_value (counter, type)
|
||||
DECL_ARTIFICIAL (fn) = 1;
|
||||
TREE_NOTHROW (fn) = 1;
|
||||
value = tree_cons (fields,
|
||||
build1 (ADDR_EXPR,
|
||||
TREE_TYPE (fields),
|
||||
fn),
|
||||
build1 (ADDR_EXPR, TREE_TYPE (fields), fn),
|
||||
value);
|
||||
|
||||
value = build_constructor (type, nreverse (value));
|
||||
@ -680,10 +686,10 @@ build_gcov_info ()
|
||||
const_type = build_qualified_type (type, TYPE_QUAL_CONST);
|
||||
|
||||
/* Version ident */
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, long_unsigned_type_node);
|
||||
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_intSI_type_node);
|
||||
TREE_CHAIN (field) = fields;
|
||||
fields = field;
|
||||
value = tree_cons (field, convert (long_unsigned_type_node,
|
||||
value = tree_cons (field, convert (unsigned_intSI_type_node,
|
||||
build_int_2 (GCOV_VERSION, 0)),
|
||||
value);
|
||||
|
||||
|
@ -404,15 +404,6 @@ do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \
|
||||
#define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
|
||||
#endif
|
||||
|
||||
/* Type used by GCOV counters. Use 64bit data type if target supports
|
||||
it. */
|
||||
#if LONG_TYPE_SIZE >= 64
|
||||
#define GCOV_TYPE_SIZE LONG_TYPE_SIZE
|
||||
#else
|
||||
#define GCOV_TYPE_SIZE LONG_LONG_TYPE_SIZE
|
||||
#endif
|
||||
|
||||
|
||||
/* By default, the preprocessor should be invoked the same way in C++
|
||||
as in C. */
|
||||
#ifndef CPLUSPLUS_CPP_SPEC
|
||||
|
@ -241,7 +241,8 @@ dump_file (filename)
|
||||
if ((error = gcov_is_error ()))
|
||||
{
|
||||
printf (error < 0 ? "%s:counter overflow at %lu\n" :
|
||||
"%s:read error at %lu\n", filename, gcov_position ());
|
||||
"%s:read error at %lu\n", filename,
|
||||
(long unsigned) gcov_position ());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ gcov_write_bytes (unsigned bytes)
|
||||
appropriately. */
|
||||
|
||||
GCOV_LINKAGE void
|
||||
gcov_write_unsigned (unsigned value)
|
||||
gcov_write_unsigned (gcov_unsigned_t value)
|
||||
{
|
||||
unsigned char *buffer = gcov_write_bytes (4);
|
||||
unsigned ix;
|
||||
@ -261,10 +261,10 @@ gcov_write_string (const char *string)
|
||||
/* Write a tag TAG and reserve space for the record length. Return a
|
||||
value to be used for gcov_write_length. */
|
||||
|
||||
GCOV_LINKAGE unsigned long
|
||||
gcov_write_tag (unsigned tag)
|
||||
GCOV_LINKAGE gcov_position_t
|
||||
gcov_write_tag (gcov_unsigned_t tag)
|
||||
{
|
||||
unsigned long result = gcov_var.position;
|
||||
gcov_position_t result = gcov_var.position;
|
||||
unsigned char *buffer = gcov_write_bytes (8);
|
||||
unsigned ix;
|
||||
|
||||
@ -285,11 +285,11 @@ gcov_write_tag (unsigned tag)
|
||||
overflow. */
|
||||
|
||||
GCOV_LINKAGE void
|
||||
gcov_write_length (unsigned long position)
|
||||
gcov_write_length (gcov_position_t position)
|
||||
{
|
||||
if (position)
|
||||
{
|
||||
unsigned length = gcov_var.position - position - 8;
|
||||
gcov_unsigned_t length = gcov_var.position - position - 8;
|
||||
unsigned char *buffer = &gcov_var.buffer[position + 4];
|
||||
unsigned ix;
|
||||
|
||||
@ -300,12 +300,13 @@ gcov_write_length (unsigned long position)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* IN_LIBGCOV */
|
||||
|
||||
/* Write a tag TAG and length LENGTH. */
|
||||
|
||||
GCOV_LINKAGE void
|
||||
gcov_write_tag_length (unsigned tag, unsigned length)
|
||||
gcov_write_tag_length (gcov_unsigned_t tag, gcov_unsigned_t length)
|
||||
{
|
||||
unsigned char *buffer = gcov_write_bytes (8);
|
||||
unsigned ix;
|
||||
@ -325,19 +326,18 @@ gcov_write_tag_length (unsigned tag, unsigned length)
|
||||
return;
|
||||
}
|
||||
|
||||
#if IN_LIBGCOV
|
||||
/* Write a summary structure to the gcov file. Return non-zero on
|
||||
overflow. */
|
||||
|
||||
GCOV_LINKAGE void
|
||||
gcov_write_summary (unsigned tag, const struct gcov_summary *summary)
|
||||
gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
|
||||
{
|
||||
unsigned ix;
|
||||
const struct gcov_ctr_summary *csum;
|
||||
|
||||
gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH);
|
||||
gcov_write_unsigned (summary->checksum);
|
||||
for (csum = summary->ctrs, ix = GCOV_COUNTERS; ix--; csum++)
|
||||
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
|
||||
{
|
||||
gcov_write_unsigned (csum->num);
|
||||
gcov_write_unsigned (csum->runs);
|
||||
@ -372,10 +372,10 @@ gcov_read_bytes (unsigned bytes)
|
||||
/* Read unsigned value from a coverage file. Sets error flag on file
|
||||
error, overflow flag on overflow */
|
||||
|
||||
GCOV_LINKAGE unsigned
|
||||
GCOV_LINKAGE gcov_unsigned_t
|
||||
gcov_read_unsigned ()
|
||||
{
|
||||
unsigned value = 0;
|
||||
gcov_unsigned_t value = 0;
|
||||
unsigned ix;
|
||||
const unsigned char *buffer = gcov_read_bytes (4);
|
||||
|
||||
@ -442,7 +442,7 @@ gcov_read_summary (struct gcov_summary *summary)
|
||||
struct gcov_ctr_summary *csum;
|
||||
|
||||
summary->checksum = gcov_read_unsigned ();
|
||||
for (csum = summary->ctrs, ix = GCOV_COUNTERS; ix--; csum++)
|
||||
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
|
||||
{
|
||||
csum->num = gcov_read_unsigned ();
|
||||
csum->runs = gcov_read_unsigned ();
|
||||
|
103
gcc/gcov-io.h
103
gcc/gcov-io.h
@ -158,29 +158,48 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#define GCC_GCOV_IO_H
|
||||
|
||||
#if IN_LIBGCOV
|
||||
#if LONG_TYPE_SIZE == GCOV_TYPE_SIZE
|
||||
typedef long gcov_type;
|
||||
/* About the target */
|
||||
|
||||
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
|
||||
typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
|
||||
#if LONG_LONG_TYPE_SIZE > 32
|
||||
typedef signed gcov_type __attribute__ ((mode (DI)));
|
||||
#else
|
||||
typedef long long gcov_type;
|
||||
typedef signed gcov_type __attribute__ ((mode (SI)));
|
||||
#endif
|
||||
|
||||
#if defined (TARGET_HAS_F_SETLKW)
|
||||
#define GCOV_LOCKED 1
|
||||
#else
|
||||
#define GCOV_LOCKED 0
|
||||
#endif
|
||||
|
||||
#else /* !IN_LIBGCOV */
|
||||
#if defined (HOST_HAS_F_SETLKW)
|
||||
#define GCOV_LOCKED 1
|
||||
#else
|
||||
#define GCOV_LOCKED 0
|
||||
#endif
|
||||
/* About the host */
|
||||
|
||||
typedef unsigned gcov_unsigned_t;
|
||||
typedef unsigned gcov_position_t;
|
||||
/* gcov_type is typedef'd elsewhere for the compiler */
|
||||
#if IN_GCOV
|
||||
#define GCOV_LINKAGE static
|
||||
typedef HOST_WIDEST_INT gcov_type;
|
||||
#if IN_GCOV > 0
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#else /*!IN_GCOV */
|
||||
#if LONG_LONG_TYPE_SIZE > 32
|
||||
#define GCOV_TYPE_NODE intDI_type_node
|
||||
#else
|
||||
#define GCOV_TYPE_NODE intSI_type_node
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (HOST_HAS_F_SETLKW)
|
||||
#define GCOV_LOCKED 1
|
||||
#else
|
||||
#define GCOV_LOCKED 0
|
||||
#endif
|
||||
|
||||
#endif /* !IN_LIBGCOV */
|
||||
|
||||
/* In gcov we want function linkage to be static, so we do not
|
||||
@ -247,10 +266,12 @@ typedef HOST_WIDEST_INT gcov_type;
|
||||
#define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 8)
|
||||
#define GCOV_TAG_OBJECT_SUMMARY ((unsigned)0xa1000000)
|
||||
#define GCOV_TAG_PROGRAM_SUMMARY ((unsigned)0xa3000000)
|
||||
#define GCOV_TAG_SUMMARY_LENGTH (1 * 4 + GCOV_COUNTERS * (2 * 4 + 3 * 8))
|
||||
#define GCOV_TAG_SUMMARY_LENGTH (1 * 4 + GCOV_COUNTERS_SUMMABLE * (2 * 4 + 3 * 8))
|
||||
|
||||
/* Counters that are collected. */
|
||||
#define GCOV_COUNTER_ARCS 0 /* Arc transitions. */
|
||||
#define GCOV_COUNTERS_SUMMABLE 1 /* Counters which can be
|
||||
summaried. */
|
||||
#define GCOV_COUNTERS 1
|
||||
|
||||
/* A list of human readable names of the counters */
|
||||
@ -296,18 +317,18 @@ typedef HOST_WIDEST_INT gcov_type;
|
||||
/* Cumulative counter data. */
|
||||
struct gcov_ctr_summary
|
||||
{
|
||||
unsigned num; /* number of counters. */
|
||||
unsigned runs; /* number of program runs */
|
||||
gcov_type sum_all; /* sum of all counters accumulated. */
|
||||
gcov_type run_max; /* maximum value on a single run. */
|
||||
gcov_type sum_max; /* sum of individual run max values. */
|
||||
gcov_unsigned_t num; /* number of counters. */
|
||||
gcov_unsigned_t runs; /* number of program runs */
|
||||
gcov_type sum_all; /* sum of all counters accumulated. */
|
||||
gcov_type run_max; /* maximum value on a single run. */
|
||||
gcov_type sum_max; /* sum of individual run max values. */
|
||||
};
|
||||
|
||||
/* Object & program summary record. */
|
||||
struct gcov_summary
|
||||
{
|
||||
unsigned checksum; /* checksum of program */
|
||||
struct gcov_ctr_summary ctrs[GCOV_COUNTERS];
|
||||
gcov_unsigned_t checksum; /* checksum of program */
|
||||
struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE];
|
||||
};
|
||||
|
||||
/* Structures embedded in coveraged program. The structures generated
|
||||
@ -320,34 +341,34 @@ struct gcov_summary
|
||||
explicitly calculate the correct array stride. */
|
||||
struct gcov_fn_info
|
||||
{
|
||||
unsigned ident; /* unique ident of function */
|
||||
unsigned checksum; /* function checksum */
|
||||
gcov_unsigned_t ident; /* unique ident of function */
|
||||
gcov_unsigned_t checksum; /* function checksum */
|
||||
unsigned n_ctrs[0]; /* instrumented counters */
|
||||
};
|
||||
|
||||
/* Type of function used to merge counters. */
|
||||
typedef void (*gcov_merge_fn) (gcov_type *, unsigned);
|
||||
typedef void (*gcov_merge_fn) (gcov_type *, gcov_unsigned_t);
|
||||
|
||||
/* Information about counters. */
|
||||
struct gcov_ctr_info
|
||||
{
|
||||
unsigned num; /* number of counters. */
|
||||
gcov_type *values; /* their values. */
|
||||
gcov_merge_fn merge; /* The function used to merge them. */
|
||||
gcov_unsigned_t num; /* number of counters. */
|
||||
gcov_type *values; /* their values. */
|
||||
gcov_merge_fn merge; /* The function used to merge them. */
|
||||
};
|
||||
|
||||
/* Information about a single object file. */
|
||||
struct gcov_info
|
||||
{
|
||||
unsigned long version; /* expected version number */
|
||||
gcov_unsigned_t version; /* expected version number */
|
||||
struct gcov_info *next; /* link to next, used by libgcc */
|
||||
|
||||
const char *filename; /* output file name */
|
||||
|
||||
unsigned n_functions; /* number of functions */
|
||||
unsigned n_functions; /* number of functions */
|
||||
const struct gcov_fn_info *functions; /* table of functions */
|
||||
|
||||
unsigned ctr_mask; /* mask of counters instrumented. */
|
||||
unsigned ctr_mask; /* mask of counters instrumented. */
|
||||
struct gcov_ctr_info counts[0]; /* count data. The number of bits
|
||||
set in the ctr_mask field
|
||||
determines how big this array
|
||||
@ -372,8 +393,8 @@ extern void __gcov_merge_add (gcov_type *, unsigned);
|
||||
GCOV_LINKAGE struct gcov_var
|
||||
{
|
||||
FILE *file;
|
||||
size_t position;
|
||||
size_t length;
|
||||
gcov_position_t position;
|
||||
gcov_position_t length;
|
||||
size_t alloc;
|
||||
unsigned modified;
|
||||
int error;
|
||||
@ -385,31 +406,31 @@ GCOV_LINKAGE int gcov_open (const char */*name*/, int /*truncate*/);
|
||||
GCOV_LINKAGE int gcov_close (void);
|
||||
#if !IN_GCOV
|
||||
GCOV_LINKAGE unsigned char *gcov_write_bytes (unsigned);
|
||||
GCOV_LINKAGE void gcov_write_unsigned (unsigned);
|
||||
GCOV_LINKAGE void gcov_write_unsigned (gcov_unsigned_t);
|
||||
#if IN_LIBGCOV
|
||||
GCOV_LINKAGE void gcov_write_counter (gcov_type);
|
||||
#else
|
||||
GCOV_LINKAGE void gcov_write_string (const char *);
|
||||
#endif
|
||||
#if !IN_LIBGCOV
|
||||
GCOV_LINKAGE unsigned long gcov_write_tag (unsigned);
|
||||
GCOV_LINKAGE void gcov_write_length (unsigned long /*position*/);
|
||||
#endif
|
||||
GCOV_LINKAGE void gcov_write_tag_length (unsigned, unsigned);
|
||||
#if IN_LIBGCOV
|
||||
GCOV_LINKAGE void gcov_write_summary (unsigned, const struct gcov_summary *);
|
||||
GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t);
|
||||
GCOV_LINKAGE void gcov_write_length (gcov_position_t /*position*/);
|
||||
#else
|
||||
GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t);
|
||||
GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
|
||||
const struct gcov_summary *);
|
||||
#endif
|
||||
#endif /* !IN_GCOV */
|
||||
GCOV_LINKAGE const unsigned char *gcov_read_bytes (unsigned);
|
||||
GCOV_LINKAGE unsigned gcov_read_unsigned (void);
|
||||
GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void);
|
||||
GCOV_LINKAGE gcov_type gcov_read_counter (void);
|
||||
#if !IN_LIBGCOV
|
||||
GCOV_LINKAGE const char *gcov_read_string (void);
|
||||
#endif
|
||||
GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *);
|
||||
static unsigned long gcov_position (void);
|
||||
static void gcov_sync (unsigned long /*base*/, unsigned /*length */);
|
||||
static void gcov_seek (unsigned long /*position*/);
|
||||
static gcov_position_t gcov_position (void);
|
||||
static void gcov_sync (gcov_position_t /*base*/, gcov_unsigned_t /*length */);
|
||||
static void gcov_seek (gcov_position_t /*position*/);
|
||||
static void gcov_rewrite (void);
|
||||
static int gcov_is_eof (void);
|
||||
static int gcov_is_error (void);
|
||||
@ -419,7 +440,7 @@ GCOV_LINKAGE time_t gcov_time (void);
|
||||
|
||||
/* Save the current position in the gcov file. */
|
||||
|
||||
static inline unsigned long
|
||||
static inline gcov_position_t
|
||||
gcov_position (void)
|
||||
{
|
||||
return gcov_var.position;
|
||||
@ -429,7 +450,7 @@ gcov_position (void)
|
||||
gcov_save_position, LENGTH should be a record length, or zero. */
|
||||
|
||||
static inline void
|
||||
gcov_sync (unsigned long base, unsigned length)
|
||||
gcov_sync (gcov_position_t base, gcov_unsigned_t length)
|
||||
{
|
||||
if (gcov_var.buffer)
|
||||
{
|
||||
@ -446,7 +467,7 @@ gcov_sync (unsigned long base, unsigned length)
|
||||
/* Move to the end of the gcov file. */
|
||||
|
||||
static inline void
|
||||
gcov_seek (unsigned long base)
|
||||
gcov_seek (gcov_position_t base)
|
||||
{
|
||||
gcov_var.position = base < gcov_var.length ? base : gcov_var.length;
|
||||
}
|
||||
|
@ -79,12 +79,12 @@ static struct gcov_info *gcov_list;
|
||||
|
||||
/* A program checksum allows us to distinguish program data for an
|
||||
object file included in multiple programs. */
|
||||
static unsigned gcov_crc32;
|
||||
static gcov_unsigned_t gcov_crc32;
|
||||
|
||||
static void
|
||||
gcov_version_mismatch (struct gcov_info *ptr, unsigned version)
|
||||
gcov_version_mismatch (struct gcov_info *ptr, gcov_unsigned_t version)
|
||||
{
|
||||
unsigned expected = GCOV_VERSION;
|
||||
gcov_unsigned_t expected = GCOV_VERSION;
|
||||
unsigned ix;
|
||||
char e[4], v[4];
|
||||
|
||||
@ -123,11 +123,11 @@ gcov_exit (void)
|
||||
unsigned t_ix;
|
||||
|
||||
for (t_ix = 0, ci_ptr = gi_ptr->counts, cs_ptr = this_program.ctrs;
|
||||
t_ix != GCOV_COUNTERS; t_ix++, cs_ptr++)
|
||||
t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++, cs_ptr++)
|
||||
if ((1 << t_ix) & gi_ptr->ctr_mask)
|
||||
{
|
||||
const gcov_type *c_ptr;
|
||||
unsigned c_num;
|
||||
gcov_unsigned_t c_num;
|
||||
|
||||
cs_ptr->num += ci_ptr->num;
|
||||
for (c_num = ci_ptr->num, c_ptr = ci_ptr->values; c_num--; c_ptr++)
|
||||
@ -140,7 +140,7 @@ gcov_exit (void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Now write the data */
|
||||
/* Now merge each file */
|
||||
for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
|
||||
{
|
||||
struct gcov_summary this_object;
|
||||
@ -154,18 +154,18 @@ gcov_exit (void)
|
||||
struct gcov_ctr_summary *cs_obj, *cs_tobj, *cs_prg, *cs_tprg, *cs_all;
|
||||
int error;
|
||||
int merging;
|
||||
unsigned tag, length;
|
||||
unsigned long summary_pos = ~0UL;
|
||||
gcov_unsigned_t tag, length;
|
||||
gcov_position_t summary_pos = ~(gcov_position_t)0;
|
||||
|
||||
/* Totals for this object file. */
|
||||
memset (&this_object, 0, sizeof (this_object));
|
||||
for (t_ix = c_ix = 0,
|
||||
ci_ptr = gi_ptr->counts, cs_ptr = this_object.ctrs;
|
||||
t_ix != GCOV_COUNTERS; t_ix++, cs_ptr++)
|
||||
t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++, cs_ptr++)
|
||||
if ((1 << t_ix) & gi_ptr->ctr_mask)
|
||||
{
|
||||
const gcov_type *c_ptr;
|
||||
unsigned c_num;
|
||||
gcov_unsigned_t c_num;
|
||||
|
||||
cs_ptr->num += ci_ptr->num;
|
||||
values[c_ix] = ci_ptr->values;
|
||||
@ -258,7 +258,7 @@ gcov_exit (void)
|
||||
/* Check program & object summary */
|
||||
while (!gcov_is_eof ())
|
||||
{
|
||||
unsigned long base = gcov_position ();
|
||||
gcov_position_t base = gcov_position ();
|
||||
int is_program;
|
||||
|
||||
tag = gcov_read_unsigned ();
|
||||
@ -295,7 +295,7 @@ gcov_exit (void)
|
||||
cs_obj = object.ctrs, cs_tobj = this_object.ctrs,
|
||||
cs_prg = program.ctrs, cs_tprg = this_program.ctrs,
|
||||
cs_all = all.ctrs;
|
||||
t_ix != GCOV_COUNTERS;
|
||||
t_ix != GCOV_COUNTERS_SUMMABLE;
|
||||
t_ix++, cs_obj++, cs_tobj++, cs_prg++, cs_tprg++, cs_all++)
|
||||
{
|
||||
if ((1 << t_ix) & gi_ptr->ctr_mask)
|
||||
@ -340,8 +340,7 @@ gcov_exit (void)
|
||||
program.checksum = gcov_crc32;
|
||||
|
||||
/* Write out the data. */
|
||||
gcov_write_unsigned (GCOV_DATA_MAGIC);
|
||||
gcov_write_unsigned (GCOV_VERSION);
|
||||
gcov_write_tag_length (GCOV_DATA_MAGIC, GCOV_VERSION);
|
||||
|
||||
/* Write execution counts for each function. */
|
||||
for (f_ix = gi_ptr->n_functions, fi_ptr = gi_ptr->functions; f_ix--;
|
||||
@ -396,16 +395,16 @@ __gcov_init (struct gcov_info *info)
|
||||
else
|
||||
{
|
||||
const char *ptr = info->filename;
|
||||
unsigned crc32 = gcov_crc32;
|
||||
gcov_unsigned_t crc32 = gcov_crc32;
|
||||
|
||||
do
|
||||
{
|
||||
unsigned ix;
|
||||
unsigned value = *ptr << 24;
|
||||
gcov_unsigned_t value = *ptr << 24;
|
||||
|
||||
for (ix = 8; ix--; value <<= 1)
|
||||
{
|
||||
unsigned feedback;
|
||||
gcov_unsigned_t feedback;
|
||||
|
||||
feedback = (value ^ crc32) & 0x80000000 ? 0x04c11db7 : 0;
|
||||
crc32 <<= 1;
|
||||
@ -456,9 +455,7 @@ __gcov_flush (void)
|
||||
an array COUNTERS of N_COUNTERS old counters and it reads the same number
|
||||
of counters from the gcov file. */
|
||||
void
|
||||
__gcov_merge_add (counters, n_counters)
|
||||
gcov_type *counters;
|
||||
unsigned n_counters;
|
||||
__gcov_merge_add (gcov_type *counters, unsigned n_counters)
|
||||
{
|
||||
for (; n_counters; counters++, n_counters--)
|
||||
*counters += gcov_read_counter ();
|
||||
|
@ -670,22 +670,25 @@ branch_prob ()
|
||||
if (rtl_dump_file)
|
||||
fprintf (rtl_dump_file, "%d ignored edges\n", ignored_edges);
|
||||
|
||||
/* Write the .bbg data from which gcov can reconstruct the basic block
|
||||
graph. First output the number of basic blocks, and then for every
|
||||
edge output the source and target basic block numbers.
|
||||
NOTE: The format of this file must be compatible with gcov. */
|
||||
/* Write the data from which gcov can reconstruct the basic block
|
||||
graph. */
|
||||
|
||||
/* Basic block flags */
|
||||
if (coverage_begin_output ())
|
||||
{
|
||||
long offset;
|
||||
gcov_position_t offset;
|
||||
|
||||
/* Basic block flags */
|
||||
offset = gcov_write_tag (GCOV_TAG_BLOCKS);
|
||||
for (i = 0; i != (unsigned) (n_basic_blocks + 2); i++)
|
||||
gcov_write_unsigned (0);
|
||||
gcov_write_length (offset);
|
||||
|
||||
/* Arcs */
|
||||
}
|
||||
|
||||
/* Arcs */
|
||||
if (coverage_begin_output ())
|
||||
{
|
||||
gcov_position_t offset;
|
||||
|
||||
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
|
||||
{
|
||||
edge e;
|
||||
@ -716,12 +719,11 @@ branch_prob ()
|
||||
}
|
||||
}
|
||||
|
||||
/* Output line number information about each basic block for GCOV
|
||||
utility. */
|
||||
/* Line numbers. */
|
||||
if (coverage_begin_output ())
|
||||
{
|
||||
char const *prev_file_name = NULL;
|
||||
long offset;
|
||||
gcov_position_t offset;
|
||||
|
||||
FOR_EACH_BB (bb)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user