Sorry for the wrong advice. I thought the feature was in trunk. Rong, can you submit the callback support to trunk?
David On Wed, Sep 2, 2015 at 1:41 PM, Rong Xu <x...@google.com> wrote: > Matt, > > It seems this patch is for google branch, rather the trunk. The code for > coverage callback function is not in trunk. > > It's ok to submit to google/gcc-4_9 branch. > > Thanks, > > -Rong > > On Wed, Sep 2, 2015 at 10:01 AM, Matt Deeds <mattde...@google.com> wrote: >> >> Hello, Honza. David Li said you might be able to help me get this >> patch into GCC trunk. I sent mail for this on August 27, but didn't >> get a reply. It's a small change to make these two options work >> together: >> >> profile-func-internal-id=0 coverage-callback=1 >> >> Let me know what I can do to get this submitted. >> >> This patch is for svn://gcc.gnu.org/svn/gcc/branches/google/gcc-4_9. I >> add >> support for the profile_func_internal-id in the instrumentation generated >> for >> __coverage_callback. >> >> 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. >> >> I've instrumented a large binary creating over 500 .gcno files and >> confirmed >> that function IDs in these .gcno files match the IDs in >> __coverage_callback. In >> my example, there were typically about one to four functions sharing the >> same >> internal function ID. There were no collisions using profile_id. >> >> >> Index: gcc/tree-profile.c >> =================================================================== >> --- gcc/tree-profile.c (revision 226647) >> +++ gcc/tree-profile.c (working copy) >> @@ -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, > >