This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [CHKP] Support returned bounds in thunks expand


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]