This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [CHKP] Support returned bounds in thunks expand
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 8 Apr 2015 02:28:45 +0300
- Subject: Re: [CHKP] Support returned bounds in thunks expand
- Authentication-results: sourceware.org; auth=none
- References: <20150306141531 dot GA27860 at msticlxl57 dot ims dot intel dot com> <CAMbmDYa1kQoWtn=SJNZ7rNidnu7g8RE5Pcwh_oMMV16tT3fFSg at mail dot gmail dot com> <20150402205551 dot GJ21276 at atrey dot karlin dot mff dot cuni dot cz> <CAMbmDYY8yYNoCy4hX_zBdKMcg1j=f9nwS_nXdUimUPFdm_mUMA at mail dot gmail dot com> <20150403170510 dot GO21276 at atrey dot karlin dot mff dot cuni dot cz> <20150407141133 dot GC11622 at msticlxl57 dot ims dot intel dot com> <20150407203319 dot GA91010 at kam dot mff dot cuni dot cz>
2015-04-07 23:33 GMT+03:00 Jan Hubicka <hubicka@ucw.cz>:
>> > >
>> > > The problem with instrumented call is that instrumented function
>> > > returns two values and call lhs gets only the first one. Thus we
>> > > generate bndret call to get the second one to build own return with
>> > > two values.
>> >
>> > I see, patch is OK then (preferably merging as much as possible with ipa-split)
>> >
>> > Honza
>>
>> Here is a refactored version with common code moved to tree-chkp.c. Bootstrapped and tested on x86_64-unknown-linux-gnu. Does it look OK?
>>
>> Thanks,
>> Ilya
>> --
>> gcc/
>>
>> 2015-04-07 Ilya Enkovich <ilya.enkovich@intel.com>
>>
>> * tree-chkp.h (chkp_insert_retbnd_call): New.
>> * tree-chkp.c (chkp_insert_retbnd_call): New.
>> * ipa-split.c (insert_bndret_call_after): Remove.
>> (split_function): Use chkp_insert_retbnd_call.
>> * cgraphunit.c (cgraph_node::expand_thunk): Build returned
>> bounds for instrumented functions.
>>
>> gcc/testsuite/
>>
>> 2015-04-07 Ilya Enkovich <ilya.enkovich@intel.com>
>>
>> * gcc/testsuite/gcc.target/i386/thunk-retbnd.c: New.
>
> OK, thanks!
>> @@ -1697,6 +1698,17 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
>> gsi_insert_after (&bsi, call, GSI_NEW_STMT);
>> if (!alias_is_noreturn)
>> {
>> + if (instrumentation_clone
>> + && !DECL_BY_REFERENCE (resdecl)
>> + && restmp
>> + && BOUNDED_P (restmp))
>> + {
>> + resbnd = chkp_insert_retbnd_call (NULL, restmp, &bsi);
>> + create_edge (get_create (gimple_call_fndecl (gsi_stmt (bsi))),
>> + as_a <gcall *> (gsi_stmt (bsi)),
>> + callees->count, callees->frequency);
>> + }
>
> Is there any reasons the rtbnd builtin call is not gimple_call_internal_p?
> That way we would not need to worry about representing this in callgraph.
Function called to get returned bounds (similar to many other
instrumentation functions) is target dependent. Internal function
usage would require significant redesign.
Thanks,
Ilya
>
> Honza