From b7c9bf289f096dd5338f37a4656f13d7b982fd33 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 9 May 2002 14:54:19 +0200 Subject: final.c (end_final): Use C trees to output data structures for profiling. * final.c (end_final): Use C trees to output data structures for profiling. * Makefile.in (LIBGCC_DEPS): Added missing dependency on gcov-io.h (profile.o): New dependency profile.h (final.o): New dependency profile.h * profile.h: New file. New global structure profile_info. * final.h (count_edges_instrumented_now): Declare. (current_function_cfg_checksum): Declare. (function_list): New structure. (functions_head, functions_tail): New static variables. (end_final): Emits more data, removed some -ax stuff. (final): Stores function names and chcksums. * gcov-io.h (__write_gcov_string): New function. (__read_gcov_string): New function. * gcov.c (read_profile): New function. (create_program_flow_graph): Uses read_profile instead of reading da_file. (read_files): Removed da_file checking, it's done by read_profile now. * libgcc2.c (bb_function_info): New structure. (bb): New field in structure, removed some -ax stuff. (__bb_exit_func): Changed structure of da_file. * profile.c (count_edges_instrumented_now): New global variable. (current_function_cfg_checksum): New global variable. (max_counter_in_program): New global variable. (get_exec_counts): New function. (compute_checksum): New function. (instrument_edges): Sets count_edges_instrumented_now. (compute_branch_probabilities): Uses get_exec_counts instead of reading da_file. (branch_prob): Calls compute_checksum and writes extra data to bbg_file. (init_branch_prob): Removed da_file checking, done in get_exec_counts now. (end_branch_prob): Removed da_file checking, done in get_exec_counts now. * gcov.texi: Updated information about gcov file format. Co-Authored-By: Pavel Nejedly From-SVN: r53326 --- gcc/toplev.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gcc/toplev.c') diff --git a/gcc/toplev.c b/gcc/toplev.c index 572d4c0..4170afd 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -364,6 +364,11 @@ int profile_flag = 0; int profile_arc_flag = 0; +/* Nonzero if we should not attempt to generate thread-safe + code to profile program flow graph arcs. */ + +int flag_unsafe_profile_arcs = 0; + /* Nonzero if generating info for gcov to calculate line test coverage. */ int flag_test_coverage = 0; @@ -1061,6 +1066,8 @@ static const lang_independent_options f_options[] = N_("Support synchronous non-call exceptions") }, {"profile-arcs", &profile_arc_flag, 1, N_("Insert arc based program profiling code") }, + {"unsafe-profile-arcs", &flag_unsafe_profile_arcs, 1, + N_("Avoid thread safety profiling overhead") }, {"test-coverage", &flag_test_coverage, 1, N_("Create data files needed by gcov") }, {"branch-probabilities", &flag_branch_probabilities, 1, @@ -2891,14 +2898,13 @@ rest_of_compilation (decl) close_dump_file (DFI_cfg, print_rtl_with_bb, insns); /* Do branch profiling and static profile estimation passes. */ - if (optimize > 0 || profile_arc_flag || flag_test_coverage - || flag_branch_probabilities) + if (optimize > 0 || cfun->arc_profile || flag_branch_probabilities) { struct loops loops; timevar_push (TV_BRANCH_PROB); open_dump_file (DFI_bp, decl); - if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities) + if (cfun->arc_profile || flag_branch_probabilities) branch_prob (); /* Discover and record the loop depth at the head of each basic -- cgit v1.1