From 852769919c7b28d6e790d5d2701b84ab2f7fd10b Mon Sep 17 00:00:00 2001 From: Matt Deeds Date: Tue, 15 Sep 2015 20:54:35 +0000 Subject: 2015-09-15 Matt Deeds 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 --- gcc/tree-profile.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3