diff mbox series

[v2,5/5] Add documentation for musttail attribute

Message ID 20240124193134.622934-6-ak@linux.intel.com
State New
Headers show
Series [v2,1/5] Improve must tail in RTL backend | expand

Commit Message

Andi Kleen Jan. 24, 2024, 7:30 p.m. UTC
---
 gcc/doc/extend.texi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Bernhard Reutner-Fischer Jan. 25, 2024, 6:51 a.m. UTC | #1
On 24 January 2024 20:30:45 CET, Andi Kleen <ak@linux.intel.com> wrote:
>---
> gcc/doc/extend.texi | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
>diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
>index 0bc586d120e7..c68d32bed8de 100644
>--- a/gcc/doc/extend.texi
>+++ b/gcc/doc/extend.texi
>@@ -9867,6 +9867,22 @@ foo (int x, int y)
> @code{y} is not actually incremented and the compiler can but does not
> have to optimize it to just @code{return 42 + 42;}.
> 
>+@cindex @code{musttail} statement attribute
>+@item musttail
>+
>+The @code{gnu::musttail} or @code{clang::hottail} attribute

AFAICS this patchset does not handle hottail ?

thanks,

>+can be applied to a return statement that returns the value
>+of a call to indicate that the call must be a tail call
>+that does not allocate extra stack space.
>+
>+@smallexample
>+[[gnu::musttail]] return foo();
>+@end smallexample
>+
>+If the compiler cannot generate a tail call it will generate
>+an error. Tail calls generally require enabling optimization.
>+On some targets they may not be supported.
>+
> @end table
> 
> @node Attribute Syntax
Andi Kleen Jan. 25, 2024, 8:48 a.m. UTC | #2
On Thu, Jan 25, 2024 at 07:51:21AM +0100, rep.dot.nop@gmail.com wrote:
> On 24 January 2024 20:30:45 CET, Andi Kleen <ak@linux.intel.com> wrote:
> >---
> > gcc/doc/extend.texi | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> >diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
> >index 0bc586d120e7..c68d32bed8de 100644
> >--- a/gcc/doc/extend.texi
> >+++ b/gcc/doc/extend.texi
> >@@ -9867,6 +9867,22 @@ foo (int x, int y)
> > @code{y} is not actually incremented and the compiler can but does not
> > have to optimize it to just @code{return 42 + 42;}.
> > 
> >+@cindex @code{musttail} statement attribute
> >+@item musttail
> >+
> >+The @code{gnu::musttail} or @code{clang::hottail} attribute
> 
> AFAICS this patchset does not handle hottail ?

Thanks. Fixed the typo.
-Andi
diff mbox series

Patch

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 0bc586d120e7..c68d32bed8de 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -9867,6 +9867,22 @@  foo (int x, int y)
 @code{y} is not actually incremented and the compiler can but does not
 have to optimize it to just @code{return 42 + 42;}.
 
+@cindex @code{musttail} statement attribute
+@item musttail
+
+The @code{gnu::musttail} or @code{clang::hottail} attribute
+can be applied to a return statement that returns the value
+of a call to indicate that the call must be a tail call
+that does not allocate extra stack space.
+
+@smallexample
+[[gnu::musttail]] return foo();
+@end smallexample
+
+If the compiler cannot generate a tail call it will generate
+an error. Tail calls generally require enabling optimization.
+On some targets they may not be supported.
+
 @end table
 
 @node Attribute Syntax