aboutsummaryrefslogtreecommitdiff
path: root/gcc/profile.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2011-12-04 18:27:19 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2011-12-04 18:27:19 +0000
commitb724567ea68234e4fa748b4373824cf30b3f6845 (patch)
tree48d2612cbd2d4812c63435c60a1a9865090aa906 /gcc/profile.c
parent13901e4b28c4618bbb8cdde78896dee6a4940fa1 (diff)
downloadgcc-b724567ea68234e4fa748b4373824cf30b3f6845.zip
gcc-b724567ea68234e4fa748b4373824cf30b3f6845.tar.gz
gcc-b724567ea68234e4fa748b4373824cf30b3f6845.tar.bz2
gcov-io.h (struct gcov_info): Replace trailing array with pointer to array.
* gcov-io.h (struct gcov_info): Replace trailing array with pointer to array. * profile.c (branch_prob): Only call renamed coverage_begin_function once. * coverage.h (coverage_begin_output): Rename to ... (coverage_begin_function): ... here. * coverage.c (struct function_list): Rename to ... (struct coverage_data): ... this. Update all uses. (gcov_info_var, gcov_fn_info_type, gcov_fn_info_ptr_type): New globals. (bbg_file_opened, bbg_function_announced): Remove. (get_coverage_counts): Adjust message. (coverage_begin_ouput): Rename to ... (coverage_begin_function): ... here. Move file opening to coverage_init. Adjust for being called only once. (coverage_end_function): Remove bbg file and inhibit further output here on error. (build_info_type): Adjust for change to pointer to array. (build_info): Receive array of function pointers and adjust. (create_coverage): Break into ... (coverage_obj_init, coverage_obj_fn, coverage_obj_finish): ... these, and adjust. (coverage_init): Open the notes file here. Tidy. (coverage_finish): Call coverage_obj_init etc. From-SVN: r181994
Diffstat (limited to 'gcc/profile.c')
-rw-r--r--gcc/profile.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/gcc/profile.c b/gcc/profile.c
index 4110839..201f6cd 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1110,30 +1110,25 @@ branch_prob (void)
lineno_checksum = coverage_compute_lineno_checksum ();
/* Write the data from which gcov can reconstruct the basic block
- graph. */
+ graph and function line numbers */
- /* Basic block flags */
- if (coverage_begin_output (lineno_checksum, cfg_checksum))
+ if (coverage_begin_function (lineno_checksum, cfg_checksum))
{
gcov_position_t offset;
+ /* Basic block flags */
offset = gcov_write_tag (GCOV_TAG_BLOCKS);
for (i = 0; i != (unsigned) (n_basic_blocks); i++)
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 */
- if (coverage_begin_output (lineno_checksum, cfg_checksum))
- {
- gcov_position_t 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)
{
edge e;
@@ -1168,11 +1163,11 @@ branch_prob (void)
gcov_write_length (offset);
}
- }
- /* Line numbers. */
- if (coverage_begin_output (lineno_checksum, cfg_checksum))
- {
+ ENTRY_BLOCK_PTR->index = ENTRY_BLOCK;
+ EXIT_BLOCK_PTR->index = EXIT_BLOCK;
+
+ /* Line numbers. */
/* Initialize the output. */
output_location (NULL, 0, NULL, NULL);
@@ -1217,8 +1212,6 @@ branch_prob (void)
}
}
- ENTRY_BLOCK_PTR->index = ENTRY_BLOCK;
- EXIT_BLOCK_PTR->index = EXIT_BLOCK;
#undef BB_TO_GCOV_INDEX
if (flag_profile_values)