diff options
author | Matt Deeds <mattdeeds@google.com> | 2015-09-15 20:54:35 +0000 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2015-09-15 20:54:35 +0000 |
commit | 852769919c7b28d6e790d5d2701b84ab2f7fd10b (patch) | |
tree | 27e0f3f6c375932d69c973dea454ba8c2cbb7cd5 | |
parent | 7df77e3f83e2ce18542c671a49016d3d910daf92 (diff) |
2015-09-15 Matt Deeds <mattdeeds@google.com>
Add support for the profile-func-internal-id parameter to the coverage callback.
Without this change, the function identifier passed to __coverage_callback
(enabled with param=coverage-callback=1) does not match the values emitted in
the .gcno file. Because the function profile_id is typically more unique
(typically 32 bits) than the function internal id (typically 16 bits), it can be
desirable to have the profile_id used to identify a function as opposed to the
function internal id.
* gcc/tree-profile.c (gimple_gen_edge_profiler): Add support for the
profile-func-internal-id parameter to the coverage callback
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9@227810 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/tree-profile.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 6e1d643cec9..9504da45cd2 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -864,8 +864,20 @@ gimple_gen_edge_profiler (int edgeno, edge e) { gimple call; tree tree_edgeno = build_int_cst (gcov_type_node, edgeno); - tree tree_uid = build_int_cst (gcov_type_node, + + tree tree_uid; + if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID)) + { + tree_uid = build_int_cst (gcov_type_node, current_function_funcdef_no); + } + else + { + gcc_assert (coverage_node_map_initialized_p ()); + + tree_uid = build_int_cst + (gcov_type_node, cgraph_get_node (current_function_decl)->profile_id); + } tree callback_fn_type = build_function_type_list (void_type_node, gcov_type_node, |