diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-23 09:24:21 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-23 09:24:21 +0000 |
commit | 9696c52909efcdb631f5fd7e8a8261656a25cc1b (patch) | |
tree | 5452a2b7de063eb5483f6c69af68f3b173a2adc9 /gcc/tree-profile.c | |
parent | 678400b3589e37edc90647ce3744347301effbed (diff) | |
download | gcc-9696c52909efcdb631f5fd7e8a8261656a25cc1b.zip gcc-9696c52909efcdb631f5fd7e8a8261656a25cc1b.tar.gz gcc-9696c52909efcdb631f5fd7e8a8261656a25cc1b.tar.bz2 |
opts.c (common_handle_option): Do not set flag_value_profile_transformations for -fprofile-generate.
* opts.c (common_handle_option): Do not set
flag_value_profile_transformations for -fprofile-generate.
* profile.c (instrument_values): Use COUNTER_FOR_HIST_TYPE.
(BB_TO_GCOV_INDEX): Remove.
(output_location): Don't use it.
(branch_prob): Likewise. Don't fiddle with the index of
ENTRY_BLOCK_PTR and EXIT_BLOCK_PTR. Use clear_aux_for_blocks.
(find_spanning_tree):
* gcov.c (struct function_info): Document that blocks 0 and 1
are the entry resp. exit blocks in gcov, too, like in GCC itself.
(solve_flow_graph): Use ENTRY_BLOCK and EXIT_BLOCK for special
blocks identification.
(output_lines): Likewise.
* value-prof.c (gimple_value_profile_transformations): Do not
test flag_value_profile_transformations again.
(gimple_ic_transform): Take a gimple_stmt_iterator like all other
transformation functions.
(gimple_values_to_profile):
Don't test flag_value_profile_transformations
* tree-profile.c (tree_profiling): Assert that the cgraph is in
the CGRAPH_STATE_IPA_SSA state.
Do not set, or look at, after_tree_profile.
* function.h (struct function): Remove after_tree_profile bit.
* omp-low.c (expand_omp_taskreg): Don't set after_tree_profile.
* tree-inline.c (initialize_cfun): Don't copy it.
* lto-streamer-out.c (output_struct_function_base): Don't stream it.
* lto-streamer-in.c (input_struct_function_base): Likewise.
From-SVN: r189778
Diffstat (limited to 'gcc/tree-profile.c')
-rw-r--r-- | gcc/tree-profile.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index ba6c6ed..4187953 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -100,6 +100,8 @@ init_ic_make_global_vars (void) varpool_finalize_decl (ic_gcov_type_ptr_var); } +/* Create the type and function decls for the interface with gcov. */ + void gimple_init_edge_profiler (void) { @@ -332,8 +334,9 @@ gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base) /* Insert code: - __gcov_indirect_call_counters = get_relevant_counter_ptr (); - __gcov_indirect_call_callee = (void *) indirect call argument; + stmt1: __gcov_indirect_call_counters = get_relevant_counter_ptr (); + stmt2: tmp1 = (void *) (indirect call argument value) + stmt3: __gcov_indirect_call_callee = tmp1; */ tmp1 = create_tmp_reg (ptr_void, "PROF"); @@ -368,6 +371,13 @@ gimple_gen_ic_func_profiler (void) gimple_init_edge_profiler (); + /* Insert code: + + stmt1: __gcov_indirect_call_profiler (__gcov_indirect_call_counters, + current_function_funcdef_no, + ¤t_function_decl, + __gcov_indirect_call_callee); + */ gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR)); cur_func = force_gimple_operand_gsi (&gsi, @@ -461,12 +471,9 @@ tree_profiling (void) { struct cgraph_node *node; - /* Don't profile functions produced at destruction time, particularly - the gcov datastructure initializer. Don't profile if it has been - already instrumented either (when OpenMP expansion creates - child function from already instrumented body). */ - if (cgraph_state == CGRAPH_STATE_FINISHED) - return 0; + /* This is a small-ipa pass that gets called only once, from + cgraphunit.c:ipa_passes(). */ + gcc_assert (cgraph_state == CGRAPH_STATE_IPA_SSA); init_node_map(); @@ -476,8 +483,7 @@ tree_profiling (void) continue; /* Don't profile functions produced for builtin stuff. */ - if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION - || DECL_STRUCT_FUNCTION (node->symbol.decl)->after_tree_profile) + if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION) continue; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); @@ -489,6 +495,7 @@ tree_profiling (void) /* Local pure-const may imply need to fixup the cfg. */ if (execute_fixup_cfg () & TODO_cleanup_cfg) cleanup_tree_cfg (); + branch_prob (); if (! flag_branch_probabilities @@ -519,8 +526,7 @@ tree_profiling (void) continue; /* Don't profile functions produced for builtin stuff. */ - if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION - || DECL_STRUCT_FUNCTION (node->symbol.decl)->after_tree_profile) + if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION) continue; cgraph_set_const_flag (node, false, false); @@ -538,8 +544,7 @@ tree_profiling (void) continue; /* Don't profile functions produced for builtin stuff. */ - if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION - || DECL_STRUCT_FUNCTION (node->symbol.decl)->after_tree_profile) + if (DECL_SOURCE_LOCATION (node->symbol.decl) == BUILTINS_LOCATION) continue; push_cfun (DECL_STRUCT_FUNCTION (node->symbol.decl)); @@ -556,7 +561,6 @@ tree_profiling (void) } } - cfun->after_tree_profile = 1; update_ssa (TODO_update_ssa); rebuild_cgraph_edges (); |