diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-23 09:24:21 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-07-23 09:24:21 +0000 |
commit | 3e7f455be4c3653889012a1edf9831c8a3d2ea22 (patch) | |
tree | 5452a2b7de063eb5483f6c69af68f3b173a2adc9 /gcc/profile.c | |
parent | c2d9cb261aaa50145a8863defd6075181cf2b2c4 (diff) | |
download | gcc-3e7f455be4c3653889012a1edf9831c8a3d2ea22.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/profile.c')
-rw-r--r-- | gcc/profile.c | 80 |
1 files changed, 18 insertions, 62 deletions
diff --git a/gcc/profile.c b/gcc/profile.c index f8debfc38d4..3d0689afac3 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -143,46 +143,15 @@ instrument_edges (struct edge_list *el) static void instrument_values (histogram_values values) { - unsigned i, t; + unsigned i; /* Emit code to generate the histograms before the insns. */ for (i = 0; i < VEC_length (histogram_value, values); i++) { histogram_value hist = VEC_index (histogram_value, values, i); - switch (hist->type) - { - case HIST_TYPE_INTERVAL: - t = GCOV_COUNTER_V_INTERVAL; - break; - - case HIST_TYPE_POW2: - t = GCOV_COUNTER_V_POW2; - break; - - case HIST_TYPE_SINGLE_VALUE: - t = GCOV_COUNTER_V_SINGLE; - break; - - case HIST_TYPE_CONST_DELTA: - t = GCOV_COUNTER_V_DELTA; - break; + unsigned t = COUNTER_FOR_HIST_TYPE (hist->type); - case HIST_TYPE_INDIR_CALL: - t = GCOV_COUNTER_V_INDIR; - break; - - case HIST_TYPE_AVERAGE: - t = GCOV_COUNTER_AVERAGE; - break; - - case HIST_TYPE_IOR: - t = GCOV_COUNTER_IOR; - break; - - default: - gcc_unreachable (); - } if (!coverage_counter_alloc (t, hist->n_counters)) continue; @@ -870,9 +839,6 @@ compute_value_histograms (histogram_values values, unsigned cfg_checksum, free (histogram_counts[t]); } -/* The entry basic block will be moved around so that it has index=1, - there is nothing at index 0 and the exit is at n_basic_block. */ -#define BB_TO_GCOV_INDEX(bb) ((bb)->index - 1) /* When passed NULL as file_name, initialize. When passed something else, output the necessary commands to change line to LINE and offset to FILE_NAME. */ @@ -899,7 +865,7 @@ output_location (char const *file_name, int line, if (!*offset) { *offset = gcov_write_tag (GCOV_TAG_LINES); - gcov_write_unsigned (BB_TO_GCOV_INDEX (bb)); + gcov_write_unsigned (bb->index); name_differs = line_differs=true; } @@ -919,19 +885,22 @@ output_location (char const *file_name, int line, } } -/* Instrument and/or analyze program behavior based on program flow graph. - In either case, this function builds a flow graph for the function being - compiled. The flow graph is stored in BB_GRAPH. +/* Instrument and/or analyze program behavior based on program the CFG. + + This function creates a representation of the control flow graph (of + the function being compiled) that is suitable for the instrumentation + of edges and/or converting measured edge counts to counts on the + complete CFG. When FLAG_PROFILE_ARCS is nonzero, this function instruments the edges in the flow graph that are needed to reconstruct the dynamic behavior of the - flow graph. + flow graph. This data is written to the gcno file for gcov. When FLAG_BRANCH_PROBABILITIES is nonzero, this function reads auxiliary - information from a data file containing edge count information from previous - executions of the function being compiled. In this case, the flow graph is - annotated with actual execution counts, which are later propagated into the - rtl for optimization purposes. + information from the gcda file containing edge count information from + previous executions of the function being compiled. In this case, the + control flow graph is annotated with actual execution counts by + compute_branch_probabilities(). Main entry point of this file. */ @@ -1145,8 +1114,7 @@ branch_prob (void) lineno_checksum = coverage_compute_lineno_checksum (); /* Write the data from which gcov can reconstruct the basic block - graph and function line numbers */ - + graph and function line numbers (the gcno file). */ if (coverage_begin_function (lineno_checksum, cfg_checksum)) { gcov_position_t offset; @@ -1157,12 +1125,6 @@ branch_prob (void) gcov_write_unsigned (0); gcov_write_length (offset); - /* Keep all basic block indexes nonnegative in the gcov output. - Index 0 is used for entry block, last index is for exit - block. */ - ENTRY_BLOCK_PTR->index = 1; - EXIT_BLOCK_PTR->index = last_basic_block; - /* Arcs */ FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb) { @@ -1170,7 +1132,7 @@ branch_prob (void) edge_iterator ei; offset = gcov_write_tag (GCOV_TAG_ARCS); - gcov_write_unsigned (BB_TO_GCOV_INDEX (bb)); + gcov_write_unsigned (bb->index); FOR_EACH_EDGE (e, ei, bb->succs) { @@ -1191,7 +1153,7 @@ branch_prob (void) && e->src->next_bb == e->dest) flag_bits |= GCOV_ARC_FALLTHROUGH; - gcov_write_unsigned (BB_TO_GCOV_INDEX (e->dest)); + gcov_write_unsigned (e->dest->index); gcov_write_unsigned (flag_bits); } } @@ -1199,9 +1161,6 @@ branch_prob (void) gcov_write_length (offset); } - ENTRY_BLOCK_PTR->index = ENTRY_BLOCK; - EXIT_BLOCK_PTR->index = EXIT_BLOCK; - /* Line numbers. */ /* Initialize the output. */ output_location (NULL, 0, NULL, NULL); @@ -1247,8 +1206,6 @@ branch_prob (void) } } -#undef BB_TO_GCOV_INDEX - if (flag_profile_values) gimple_find_values_to_profile (&values); @@ -1391,8 +1348,7 @@ find_spanning_tree (struct edge_list *el) } } - FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) - bb->aux = NULL; + clear_aux_for_blocks (); } /* Perform file-level initialization for branch-prob processing. */ |