Commit a96bf0d3 by Martin Liska Committed by Martin Liska

Make coverage_compute_cfg_checksum callable with arg.

	* coverage.h (coverage_compute_cfg_checksum): Argument added.
	* coverage.c (coverage_compute_cfg_checksum): Likewise.
	* profile.c (branch_prob): Likewise.

From-SVN: r211217
parent 7d2268ea
2014-06-04 Martin Liska <mliska@suse.cz>
* coverage.h (coverage_compute_cfg_checksum): Argument added.
* coverage.c (coverage_compute_cfg_checksum): Likewise.
* profile.c (branch_prob): Likewise.
2014-06-04 Martin Jambor <mjambor@suse.cz> 2014-06-04 Martin Jambor <mjambor@suse.cz>
PR ipa/61340 PR ipa/61340
......
...@@ -583,7 +583,7 @@ coverage_compute_profile_id (struct cgraph_node *n) ...@@ -583,7 +583,7 @@ coverage_compute_profile_id (struct cgraph_node *n)
return chksum & 0x7fffffff; return chksum & 0x7fffffff;
} }
/* Compute cfg checksum for the current function. /* Compute cfg checksum for the function FN given as argument.
The checksum is calculated carefully so that The checksum is calculated carefully so that
source code changes that doesn't affect the control flow graph source code changes that doesn't affect the control flow graph
won't change the checksum. won't change the checksum.
...@@ -594,12 +594,12 @@ coverage_compute_profile_id (struct cgraph_node *n) ...@@ -594,12 +594,12 @@ coverage_compute_profile_id (struct cgraph_node *n)
but the compiler won't detect the change and use the wrong profile data. */ but the compiler won't detect the change and use the wrong profile data. */
unsigned unsigned
coverage_compute_cfg_checksum (void) coverage_compute_cfg_checksum (struct function *fn)
{ {
basic_block bb; basic_block bb;
unsigned chksum = n_basic_blocks_for_fn (cfun); unsigned chksum = n_basic_blocks_for_fn (fn);
FOR_EACH_BB_FN (bb, cfun) FOR_EACH_BB_FN (bb, fn)
{ {
edge e; edge e;
edge_iterator ei; edge_iterator ei;
......
...@@ -32,8 +32,8 @@ extern int coverage_begin_function (unsigned, unsigned); ...@@ -32,8 +32,8 @@ extern int coverage_begin_function (unsigned, unsigned);
/* Complete the coverage information for the current function. */ /* Complete the coverage information for the current function. */
extern void coverage_end_function (unsigned, unsigned); extern void coverage_end_function (unsigned, unsigned);
/* Compute the control flow checksum for the current function. */ /* Compute the control flow checksum for the function FN given as argument. */
extern unsigned coverage_compute_cfg_checksum (void); extern unsigned coverage_compute_cfg_checksum (struct function *fn);
/* Compute the profile id of function N. */ /* Compute the profile id of function N. */
extern unsigned coverage_compute_profile_id (struct cgraph_node *n); extern unsigned coverage_compute_profile_id (struct cgraph_node *n);
......
...@@ -1195,7 +1195,7 @@ branch_prob (void) ...@@ -1195,7 +1195,7 @@ branch_prob (void)
the checksum in only once place, since it depends on the shape the checksum in only once place, since it depends on the shape
of the control flow which can change during of the control flow which can change during
various transformations. */ various transformations. */
cfg_checksum = coverage_compute_cfg_checksum (); cfg_checksum = coverage_compute_cfg_checksum (cfun);
lineno_checksum = coverage_compute_lineno_checksum (); lineno_checksum = coverage_compute_lineno_checksum ();
/* Write the data from which gcov can reconstruct the basic block /* Write the data from which gcov can reconstruct the basic block
......
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