[Patch 1/2][ipa] Add target hook to sanitize cloned declaration's attributes

Andre Vieira (lists) andre.simoesdiasvieira@arm.com
Tue Oct 15 11:14:00 GMT 2019


Hi,

I have changed the name to make the target hook more general and not 
create the illusion it is related to sanitizers.

Is this OK for trunk?

Cheers,
Andre

gcc/ChangeLog:

2019-10-15  Andre Vieira  <andre.simoesdiasvieira@arm.com>

	* cgraphclones.c(create_clone): Call new target hook when
         creating a new node.
         (create_version_clone_with_body): Likewise.
         * target.def(modify_clone_cgraph_node): New target hook.
         * targhooks.c(default_modify_clone_cgraph_node): New.
         * targhooks.h(default_modify_clone_cgraph_node): New.
         * doc/tm.texi.in: Include new TARGET_MODIFY_CLONE_CGRAPH_NODE.
         * doc/tm.texi: Regenerated

On 09/10/2019 16:35, Andre Vieira (lists) wrote:
> Adding Jakub to CC'
> 
> On 09/10/2019 16:29, Andre Vieira (lists) wrote:
>> Hi Martin,
>>
>> I see thank you. For my particular use case I only need to strip 
>> attributes for local symbols.  However, if I were to claim it is only 
>> used for non-externally visible clones than I would also need to make 
>> sure they are non-externally visible now and put something in place 
>> that checks this in the future.  I feel it's easier and more flexible 
>> to leave it up to the users of the hook to check it themselves using 
>> DECL_EXTERNAL.  I will mention it in the description though.
>>
>> Cheers,
>> Andre
>>
>> gcc/ChangeLog:
>>
>> 2019-10-09  Andre Vieira  <andre.simoesdiasvieira@arm.com>
>>
>>      * cgraphclones.c(create_clone): Call new target hook when
>>          creating a new node.
>>          (create_version_clone): Likewise.
>>          (create_version_clone_with_body): Likewise.
>>          * target.def(sanitize_clone_attributes): New target hook.
>>          * targhooks.c(default_sanitize_clone_attributes): New.
>>          * targhooks.h(default_sanitize_clone_attributes): New.
>>          * doc/tm.texi.in: Document new target hook.
>>          * doc/tm.texi: Regenerated
>>
>> On 09/10/2019 12:43, Martin Jambor wrote:
>>> Hi,
>>>
>>> On Wed, Oct 09 2019, Andre Vieira (lists) wrote:
>>>> Hi Martin,
>>>>
>>>> Thanks for the suggestion.  I have moved the target hook to the
>>>> following functions:
>>>> 'create_clone'
>>>> 'create_version_clone'
>>>
>>> I am not sure that calling the hook in create_version_clone is what you
>>> want.  It should perhaps be made clearer in the API but unlike
>>> (functions that call) create_clone and create_version_clone_with_body,
>>> the result is not a local symbol but it may also be an externally
>>> visible "version" of the original.  OpenMP uses it to create nodes for
>>> external declarations (not definitions!) of variants of functions marked
>>> with omp declare simd and the function calling it in trans-mem.c also
>>> apparently uses it to create possibly externally visible clones.
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmse_ipa_1_4.patch
Type: text/x-patch
Size: 5302 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191015/84855894/attachment.bin>


More information about the Gcc-patches mailing list