diff mbox series

Document cloning for the target_clone attribute.

Message ID 3c01518e-ec86-a4cb-fe93-33d817ba2a14@suse.cz
State New
Headers show
Series Document cloning for the target_clone attribute. | expand

Commit Message

Martin Liška Jan. 6, 2020, 10:05 a.m. UTC
Hi.

The patch is about explanation what happens when
a target_clone function calls a function without
the attribute.

Ready for trunk?
Thanks,
Martin

gcc/ChangeLog:

2020-01-06  Martin Liska  <mliska@suse.cz>

	PR ipa/83411
	* doc/extend.texi: Explain cloning for target_clone
	attribute.
---
  gcc/doc/extend.texi | 6 ++++++
  1 file changed, 6 insertions(+)

Comments

Martin Sebor Jan. 6, 2020, 2:04 p.m. UTC | #1
On 1/6/20 3:05 AM, Martin Liška wrote:
> Hi.
> 
> The patch is about explanation what happens when
> a target_clone function calls a function without
> the attribute.
> 
> Ready for trunk?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2020-01-06  Martin Liska  <mliska@suse.cz>
> 
>      PR ipa/83411
>      * doc/extend.texi: Explain cloning for target_clone
>      attribute.
> ---
>   gcc/doc/extend.texi | 6 ++++++
>   1 file changed, 6 insertions(+)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 05ec62c552b..184146abd10 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3768,6 +3768,12 @@ the @code{ifunc} attribute above) that 
dynamically selects a clone
  suitable for current architecture.  The resolver is created only if there
  is a usage of a function with @code{target_clones} attribute.

+Note that any subsequent call of a function without @code{target_clone}
+from a @code{target_clone} caller will not lead to copying
+(target clone) of the called function.
+If you want to enforce such behaviour,
+we recommend to use @code{flatter} attribute for the caller function.
+

Should that be "the @code{flatten} attribute?"  (Article and
an 'n' rather than an 'r' in "flatten".)

Also, (assuming I'm reading it correctly) would the rest of
the sentence be clearer if it instead read:

   we recommend declaring the calling function with the @code{flatten}
   attribute?

Martin
Jeff Law Jan. 6, 2020, 8:13 p.m. UTC | #2
On Mon, 2020-01-06 at 11:05 +0100, Martin Liška wrote:
> Hi.
> 
> The patch is about explanation what happens when
> a target_clone function calls a function without
> the attribute.
> 
> Ready for trunk?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2020-01-06  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/83411
> 	* doc/extend.texi: Explain cloning for target_clone
> 	attribute.
Shouldn't the docs use "flatten" rather than "flatter"?  OK with that
change.

Jeff
>
Martin Liška Jan. 7, 2020, 9:18 a.m. UTC | #3
On 1/6/20 3:04 PM, Martin Sebor wrote:
> On 1/6/20 3:05 AM, Martin Liška wrote:
>> Hi.
>>
>> The patch is about explanation what happens when
>> a target_clone function calls a function without
>> the attribute.
>>
>> Ready for trunk?
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2020-01-06  Martin Liska  <mliska@suse.cz>
>>
>>      PR ipa/83411
>>      * doc/extend.texi: Explain cloning for target_clone
>>      attribute.
>> ---
>>   gcc/doc/extend.texi | 6 ++++++
>>   1 file changed, 6 insertions(+)
> 
> diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> index 05ec62c552b..184146abd10 100644
> --- a/gcc/doc/extend.texi
> +++ b/gcc/doc/extend.texi
> @@ -3768,6 +3768,12 @@ the @code{ifunc} attribute above) that dynamically selects a clone
>   suitable for current architecture.  The resolver is created only if there
>   is a usage of a function with @code{target_clones} attribute.
> 
> +Note that any subsequent call of a function without @code{target_clone}
> +from a @code{target_clone} caller will not lead to copying
> +(target clone) of the called function.
> +If you want to enforce such behaviour,
> +we recommend to use @code{flatter} attribute for the caller function.
> +

Hello.

> 
> Should that be "the @code{flatten} attribute?"  (Article and
> an 'n' rather than an 'r' in "flatten".)

Yep.

> 
> Also, (assuming I'm reading it correctly) would the rest of
> the sentence be clearer if it instead read:
> 
>    we recommend declaring the calling function with the @code{flatten}
>    attribute?

Sure, seems better to me.
I've just installed the patch with the suggested changed.

Martin

> 
> Martin
>
diff mbox series

Patch

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 05ec62c552b..184146abd10 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -3768,6 +3768,12 @@  the @code{ifunc} attribute above) that dynamically selects a clone
 suitable for current architecture.  The resolver is created only if there
 is a usage of a function with @code{target_clones} attribute.
 
+Note that any subsequent call of a function without @code{target_clone}
+from a @code{target_clone} caller will not lead to copying
+(target clone) of the called function.
+If you want to enforce such behaviour,
+we recommend to use @code{flatter} attribute for the caller function.
+
 @item unused
 @cindex @code{unused} function attribute
 This attribute, attached to a function, means that the function is meant