aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-04-23 14:05:11 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-04-23 14:05:11 +0000
commitcdb2376773696240929622b1504fa8e2d4c29843 (patch)
tree120a1c15af28d004dc01bf0ac13ef734a28142cb /gcc/profile.c
parent2be3b5ce222dcf49dcca9e9bf3f1f7eb77b64566 (diff)
downloadgcc-cdb2376773696240929622b1504fa8e2d4c29843.zip
gcc-cdb2376773696240929622b1504fa8e2d4c29843.tar.gz
gcc-cdb2376773696240929622b1504fa8e2d4c29843.tar.bz2
Makefile.in (LIBGCC_DEPS): Add gcov headers.
* 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. From-SVN: r65990
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 3472bd0..6a5548b 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -81,26 +81,6 @@ struct bb_info {
gcov_type pred_count;
};
-/* Counts information for a function. */
-typedef struct counts_entry
-{
- /* We hash by */
- char *function_name;
- unsigned section;
-
- /* Store */
- unsigned checksum;
- unsigned n_counts;
- gcov_type *counts;
- unsigned merged;
- gcov_type max_counter;
- gcov_type max_counter_sum;
-
- /* Workspace */
- struct counts_entry *chain;
-
-} counts_entry_t;
-
#define EDGE_INFO(e) ((struct edge_info *) (e)->aux)
#define BB_INFO(b) ((struct bb_info *) (b)->aux)
@@ -110,6 +90,10 @@ typedef struct counts_entry
: ((bb) == EXIT_BLOCK_PTR \
? last_basic_block + 1 : (bb)->index + 1))
+/* Counter summary from the last set of coverage counts read. */
+
+const struct gcov_ctr_summary *profile_info;
+
/* Collect statistics on the performance of this pass for the entire source
file. */
@@ -195,16 +179,13 @@ get_exec_counts ()
num_edges++;
}
- counts = get_coverage_counts (GCOV_TAG_ARC_COUNTS, num_edges);
+ counts = get_coverage_counts (GCOV_COUNTER_ARCS, num_edges, &profile_info);
if (!counts)
return NULL;
- if (rtl_dump_file)
- {
- fprintf(rtl_dump_file, "Merged %i profiles with maximal count %i.\n",
- profile_info.count_profiles_merged,
- (int)profile_info.max_counter_in_program);
- }
+ if (rtl_dump_file && profile_info)
+ fprintf(rtl_dump_file, "Merged %u profiles with maximal count %u.\n",
+ profile_info->runs, (unsigned) profile_info->sum_max);
return counts;
}
@@ -547,7 +528,6 @@ compute_branch_probabilities ()
}
free_aux_for_blocks ();
- find_counters_section (GCOV_TAG_ARC_COUNTS)->present = 1;
}
/* Instrument and/or analyze program behavior based on program flow graph.
@@ -1013,7 +993,7 @@ static rtx
gen_edge_profiler (edgeno)
int edgeno;
{
- rtx ref = coverage_counter_ref (GCOV_TAG_ARC_COUNTS, edgeno);
+ rtx ref = coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno);
rtx tmp;
enum machine_mode mode = GET_MODE (ref);
rtx sequence;