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/gcov.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/gcov.c')
-rw-r--r-- | gcc/gcov.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c index d4823991d14..318ce6046ba 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -57,10 +57,10 @@ along with Gcov; see the file COPYING3. If not see /* The code validates that the profile information read in corresponds to the code currently being compiled. Rather than checking for - identical files, the code below computes a checksum on the CFG + identical files, the code below compares a checksum on the CFG (based on the order of basic blocks and the arcs in the CFG). If - the CFG checksum in the gcda file match the CFG checksum for the - code currently being compiled, the profile data will be used. */ + the CFG checksum in the gcda file match the CFG checksum in the + gcno file, the profile data will be used. */ /* This is the size of the buffer used to read in source file lines. */ @@ -177,7 +177,10 @@ typedef struct function_info /* The graph contains at least one fake incoming edge. */ unsigned has_catch : 1; - /* Array of basic blocks. */ + /* Array of basic blocks. Like in GCC, the entry block is + at blocks[0] and the exit block is at blocks[1]. */ +#define ENTRY_BLOCK (0) +#define EXIT_BLOCK (1) block_t *blocks; unsigned num_blocks; unsigned blocks_executed; @@ -1363,21 +1366,21 @@ solve_flow_graph (function_t *fn) bbg_file_name, fn->name); else { - if (fn->blocks[0].num_pred) + if (fn->blocks[ENTRY_BLOCK].num_pred) fnotice (stderr, "%s:'%s' has arcs to entry block\n", bbg_file_name, fn->name); else /* We can't deduce the entry block counts from the lack of predecessors. */ - fn->blocks[0].num_pred = ~(unsigned)0; + fn->blocks[ENTRY_BLOCK].num_pred = ~(unsigned)0; - if (fn->blocks[fn->num_blocks - 1].num_succ) + if (fn->blocks[EXIT_BLOCK].num_succ) fnotice (stderr, "%s:'%s' has arcs from exit block\n", bbg_file_name, fn->name); else /* Likewise, we can't deduce exit block counts from the lack of its successors. */ - fn->blocks[fn->num_blocks - 1].num_succ = ~(unsigned)0; + fn->blocks[EXIT_BLOCK].num_succ = ~(unsigned)0; } /* Propagate the measured counts, this must be done in the same @@ -1637,7 +1640,7 @@ add_branch_counts (coverage_t *coverage, const arc_t *arc) } } -/* Format a HOST_WIDE_INT as either a percent ratio, or absolute +/* Format a GCOV_TYPE integer as either a percent ratio, or absolute count. If dp >= 0, format TOP/BOTTOM * 100 to DP decimal places. If DP is zero, no decimal point is printed. Only print 100% when TOP==BOTTOM and only print 0% when TOP=0. If dp < 0, then simply @@ -2266,8 +2269,9 @@ output_lines (FILE *gcov_file, const source_t *src) { for (; fn && fn->line == line_num; fn = fn->line_next) { - arc_t *arc = fn->blocks[fn->num_blocks - 1].pred; - gcov_type return_count = fn->blocks[fn->num_blocks - 1].count; + arc_t *arc = fn->blocks[EXIT_BLOCK].pred; + gcov_type return_count = fn->blocks[EXIT_BLOCK].count; + gcov_type called_count = fn->blocks[ENTRY_BLOCK].count; for (; arc; arc = arc->pred_next) if (arc->fake) @@ -2275,9 +2279,9 @@ output_lines (FILE *gcov_file, const source_t *src) fprintf (gcov_file, "function %s", fn->name); fprintf (gcov_file, " called %s", - format_gcov (fn->blocks[0].count, 0, -1)); + format_gcov (called_count, 0, -1)); fprintf (gcov_file, " returned %s", - format_gcov (return_count, fn->blocks[0].count, 0)); + format_gcov (return_count, called_count, 0)); fprintf (gcov_file, " blocks executed %s", format_gcov (fn->blocks_executed, fn->num_blocks - 2, 0)); fprintf (gcov_file, "\n"); |