diff options
author | Jan Hubicka <jh@suse.cz> | 2013-08-09 20:23:23 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-08-09 18:23:23 +0000 |
commit | 2fa3d31bd6bb9274abaa3a7d59cc88e9a6112194 (patch) | |
tree | 58562426672deca3c5be2e63eabd43cdf4af64ae /gcc/coverage.c | |
parent | 36849c21ccee087a778360d3a5dce38d1f7dd586 (diff) | |
download | gcc-2fa3d31bd6bb9274abaa3a7d59cc88e9a6112194.zip gcc-2fa3d31bd6bb9274abaa3a7d59cc88e9a6112194.tar.gz gcc-2fa3d31bd6bb9274abaa3a7d59cc88e9a6112194.tar.bz2 |
cgraph.h (cgraph_node): Add profile_id.
* cgraph.h (cgraph_node): Add profile_id.
* value-prof.c (cgraph_node_map): Turn into pointer_map.
(init_node_map): Rewrite to handle hashes increas of incremental
IDs.
(del_node_map): Update.
(find_func_by_funcdef_no): Replace by ...
(find_func_by_profile_id): ... this one.
(gimple_ic_transform): Do not remove useful histograms when
speculation is not done; dump info when indirect call removal
can happen at LTO.
* value-prof.h (find_func_by_profile_id, gimple_ic): Declare.
* gcov-io.h (__gcov_indirect_call_profiler): Replace by ...
(__gcov_indirect_call_profiler_v2): .. this one.
* profile.h (init_node_map): Update.
* coverage.c (coverage_compute_profile_id): New function.
* coverage.h (coverage_compute_profile_id): Declare.
* tree-profile.c (init_ic_make_global_vars): Make
__gcov_indirect_call_callee and __gcov_indirect_call_counters global.
(gimple_init_edge_profiler): Update prototype of
__gcov_indirect_call_profiler.
(gimple_gen_ic_func_profiler): Simplify.
(tree_profiling): Use init_node_map
From-SVN: r201634
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r-- | gcc/coverage.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c index 7c395f4..9b664cf 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -539,6 +539,28 @@ coverage_compute_lineno_checksum (void) return chksum; } +/* Compute profile ID. This is better to be unique in whole program. */ + +unsigned +coverage_compute_profile_id (struct cgraph_node *n) +{ + expanded_location xloc + = expand_location (DECL_SOURCE_LOCATION (n->symbol.decl)); + unsigned chksum = xloc.line; + + chksum = coverage_checksum_string (chksum, xloc.file); + chksum = coverage_checksum_string + (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->symbol.decl))); + if (first_global_object_name) + chksum = coverage_checksum_string + (chksum, first_global_object_name); + chksum = coverage_checksum_string + (chksum, aux_base_name); + + /* Non-negative integers are hopefully small enough to fit in all targets. */ + return chksum & 0x7fffffff; +} + /* Compute cfg checksum for the current function. The checksum is calculated carefully so that source code changes that doesn't affect the control flow graph |