diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-10 19:02:21 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-10 19:02:21 +0000 |
commit | 834f169c095c2ebff5cb9d0376da2c5093e44be4 (patch) | |
tree | 854e36366a2cd453b70412c2e728a48810418a26 /gcc/gcov-io.h | |
parent | e77bfc93deabc0d487b9a212b57e7e4d42d3cdb4 (diff) | |
download | gcc-834f169c095c2ebff5cb9d0376da2c5093e44be4.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66668 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r-- | gcc/gcov-io.h | 103 |
1 files changed, 62 insertions, 41 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h index 2cad103f231..f7396532fff 100644 --- a/gcc/gcov-io.h +++ b/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; } |