summaryrefslogtreecommitdiff
path: root/gcc/gcov-io.h
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-23 14:05:11 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-23 14:05:11 +0000
commitab6a34f2f7b7c7505a1feeeabdf1d87329eb8878 (patch)
tree120a1c15af28d004dc01bf0ac13ef734a28142cb /gcc/gcov-io.h
parent7a3f89b5bee6e8b4191cd7653cc259deaa8a3100 (diff)
downloadgcc-ab6a34f2f7b7c7505a1feeeabdf1d87329eb8878.tar.gz
* Makefile.in (LIBGCC_DEPS): Add gcov headers.
(libgcov.a): Depends on LIBGCC_DEPS. * basic-block.h (profile_info): Moved here from coverage.h. Made a pointer. * coverage.c (struct function_list): Fixed array of counter types. (struct counts_entry): Keyed by counter type, contains summary. (profile_info): Moved to profile.c. (prg_ctr_mask, prg_n_ctrs, fn_ctr_mask, fn_n_ctrs): New global vars. (profiler_label): Remove. (ctr_labels): New. (set_purpose, label_for_tag, build_counter_section_fields, build_counter_section_value, build_counter_section_data_fields, build_counter_section_data_values, build_function_info_fields, build_function_info_value, gcov_info_fields, gcov_info_value): Remove. (build_fn_info_type, build_fn_info_value, build_ctr_info_type, build_ctr_info_value, build_gcov_info): New. (htab_counts_entry_hash, htab_counts_entry_eq): Adjust. (reads_counts_file): Adjust. (get_coverage_counts): Takes counter number. Add summary parameter. Adjust. (coverage_counter_ref): Tkaes counter number. Adjust. Lazily create counter array labels. (coverage_end_function): Adjust. (create_coverage): Adjust. (find_counters_section): Remove. * coverage.h (MAX_COUNTER_SECTIONS): Remove. (struct section_info, struct profile_info): Remove. (profile_info): Moved to basic-block.h. (coverage_counter_ref): Takes a counter number. (get_coverage_counts): Takes a counter number. Added summary parameter. (find_counters_section): Remove. * gcov-dump.c (tag_arc_counts): Rename to ... (tag_counters): ... here. Adjust. (tag_table): Move tag_counters to 3rd entry. Remove PROGRAM_PLACEHOLDER and PROGRAM_INCORRECT entries. (dump_file): Check for counter tag values here. (tag_summary): Adjust. * gcov-io.c (gcov_write_summary, gcov_read_summary): Adjust. * gcov-io.h (GCOV_LOCKED): New. (GCOV_TAG_ARC_COUNTS): Rename to ... (GCOV_TAG_COUNTS_BASE): ... here. (GCOV_TAG_PLACEHOLDER_SUMMARY, GCOV_TAG_INCORRECT_SUMMARY): Remove. (GCOV_COUNTER_ARCS, GCOV_COUNTERS, GCOV_NAMES): New. (GCOV_TAG_FOR_COUNTER, GCOV_COUNTER_FOR_TAG, GCOV_TAG_IS_COUNTER): New. (struct gcov_ctr_summary): New. (struct gcov_summary): Adjust. (struct gcov_counter_section): Remove. struct gcov_counter_section_data): Remove. (struct gcov_function_info): Rename to ... (struct gcov_fn_info): ... here. Adjust. (struct gcov_ctr_info): New. (struct gcov_info): Adjust. * gcov.c (read_count_file): Adjust. (output_lines): Adjust. * libgcov.c (gcov_exit): Adjust. (__gcov_flush): Adjust. * mklibgcc.in (libgcc2_c_dep): Add gcov headers. * predict.c (maybe_hot_bb_p, probably_cold_bb_p, probably_never_executed_bb_p, compute_frequency_function): Adjust profile_info use. * profile.c (struct counts_entry): Remove. (profile_info): Define here. (get_exec_counts): Adjust get_coverage_counts call. (compute_branch_probablilities): Remove find_counters_section call. (gen_edge_profiler): Adjust coverage_counter_ref call. * tracer.c (tail_duplicate): Adjust profile_info use. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65990 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r--gcc/gcov-io.h89
1 files changed, 55 insertions, 34 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index d2beb1bbf2f..7f881999779 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -127,8 +127,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
function-data: announce_function arc_counts
announce_function: header string:name int32:checksum
arc_counts: header int64:count*
- summary: in32:checksum int32:runs int32:arcs int64:sum int64:max \
- int64:sum_max
+ summary: int32:checksum {count-summary}GCOV_COUNTERS
+ count-summary: int32:num int32:runs int64:sum
+ int64:max int64:sum_max
The ANNOUNCE_FUNCTION record is the same as that in the BBG file,
but without the source location.
@@ -160,6 +161,11 @@ typedef long gcov_type;
#else
typedef long long gcov_type;
#endif
+#if defined (TARGET_HAS_F_SETLKW)
+#define GCOV_LOCKED 1
+#else
+#define GCOV_LOCKED 0
+#endif
#endif /* IN_LIBGCOV */
#if IN_GCOV
typedef HOST_WIDEST_INT gcov_type;
@@ -201,11 +207,26 @@ typedef HOST_WIDEST_INT gcov_type;
#define GCOV_TAG_BLOCKS ((unsigned)0x01410000)
#define GCOV_TAG_ARCS ((unsigned)0x01430000)
#define GCOV_TAG_LINES ((unsigned)0x01450000)
-#define GCOV_TAG_ARC_COUNTS ((unsigned)0x01a10000)
+#define GCOV_TAG_COUNTER_BASE ((unsigned)0x01a10000) /* First counter */
#define GCOV_TAG_OBJECT_SUMMARY ((unsigned)0xa1000000)
#define GCOV_TAG_PROGRAM_SUMMARY ((unsigned)0xa3000000)
-#define GCOV_TAG_PLACEHOLDER_SUMMARY ((unsigned)0xa5000000)
-#define GCOV_TAG_INCORRECT_SUMMARY ((unsigned)0xa7000000)
+
+/* Counters that are collected. */
+#define GCOV_COUNTER_ARCS 0 /* Arc transitions. */
+#define GCOV_COUNTERS 1
+
+/* A list of human readable names of the counters */
+#define GCOV_COUNTER_NAMES {"arcs"}
+
+/* Convert a counter index to a tag. */
+#define GCOV_TAG_FOR_COUNTER(COUNT) \
+ (GCOV_TAG_COUNTER_BASE + ((COUNT) << 17))
+/* Convert a tag to a counter. */
+#define GCOV_COUNTER_FOR_TAG(TAG) \
+ (((TAG) - GCOV_TAG_COUNTER_BASE) >> 17)
+/* Check whether a tag is a counter tag. */
+#define GCOV_TAG_IS_COUNTER(TAG) \
+ (!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG (TAG) < GCOV_COUNTERS)
/* 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
@@ -231,44 +252,43 @@ typedef HOST_WIDEST_INT gcov_type;
/* Structured records. */
+/* 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. */
+};
+
/* Object & program summary record. */
struct gcov_summary
{
unsigned checksum; /* checksum of program */
- unsigned runs; /* number of program runs */
- unsigned arcs; /* number of instrumented arcs */
- gcov_type arc_sum; /* sum of all arc counters */
- gcov_type arc_max_one; /* max counter on any one run */
- gcov_type arc_sum_max; /* sum of max_one */
+ struct gcov_ctr_summary ctrs[GCOV_COUNTERS];
};
/* Structures embedded in coveraged program. The structures generated
by write_profile must match these. */
-/* Information about section of counters for a function. */
-struct gcov_counter_section
-{
- unsigned tag; /* Tag of the section. */
- unsigned n_counters; /* Number of counters in the section. */
-};
-
#if IN_LIBGCOV
-/* Information about section of counters for an object file. */
-struct gcov_counter_section_data
+/* Information about a single function. This uses the trailing array
+ idiom. The number of counters is determined from the counter_mask
+ in gcov_info. We hold an array of function info, so have to
+ explicitly calculate the correct array stride. */
+struct gcov_fn_info
{
- unsigned tag; /* Tag of the section. */
- unsigned n_counters; /* Number of counters in the section. */
- gcov_type *counters; /* The data. */
+ const char *name; /* (mangled) name of function */
+ unsigned checksum; /* function checksum */
+ unsigned n_ctrs[0]; /* instrumented counters */
};
-/* Information about a single function. */
-struct gcov_function_info
+/* Information about counters. */
+struct gcov_ctr_info
{
- const char *name; /* (mangled) name of function */
- unsigned checksum; /* function checksum */
- unsigned n_counter_sections; /* Number of types of counters */
- const struct gcov_counter_section *counter_sections;
- /* The section descriptions */
+ unsigned num; /* number of counters. */
+ gcov_type *values; /* their values. */
};
/* Information about a single object file. */
@@ -278,14 +298,15 @@ struct gcov_info
struct gcov_info *next; /* link to next, used by libgcc */
const char *filename; /* output file name */
- long wkspc; /* libgcc workspace */
unsigned n_functions; /* number of functions */
- const struct gcov_function_info *functions; /* table of functions */
+ const struct gcov_fn_info *functions; /* table of functions */
- unsigned n_counter_sections; /* Number of types of counters */
- const struct gcov_counter_section_data *counter_sections;
- /* The data to be put into the sections. */
+ 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
+ is. */
};
/* Register a new object file module. */