Commit b724567e by Nathan Sidwell Committed by Nathan Sidwell

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
parent 13901e4b
2011-12-04 Nathan Sidwell <nathan@acm.org>
* 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.
2011-12-04 Ira Rosen <ira.rosen@linaro.org>
PR middle-end/51285
......@@ -26,13 +26,12 @@ along with GCC; see the file COPYING3. If not see
extern void coverage_init (const char *);
extern void coverage_finish (void);
/* Complete the coverage information for the current function. Once
per function. */
extern void coverage_end_function (unsigned, unsigned);
/* Start outputting coverage information for the current
function. Repeatable per function. */
extern int coverage_begin_output (unsigned, unsigned);
function. */
extern int coverage_begin_function (unsigned, unsigned);
/* Complete the coverage information for the current function. */
extern void coverage_end_function (unsigned, unsigned);
/* Compute the control flow checksum for the current function. */
extern unsigned coverage_compute_cfg_checksum (void);
......
......@@ -448,8 +448,8 @@ struct gcov_info
unused) */
unsigned n_functions; /* number of functions */
const struct gcov_fn_info *functions[0]; /* pointers to function
information */
const struct gcov_fn_info *const *functions; /* pointer to pointers
to function information */
};
/* Register a new object file module. */
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment