This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: forcing tail/sibling call optimization
- To: law at redhat dot com
- Subject: Re: forcing tail/sibling call optimization
- From: Andi Kleen <freitag at alancoxonachip dot com>
- Date: 27 Nov 2000 17:07:47 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <32243.975340713@upchuck>
Jeffrey A Law <law@redhat.com> writes:
> > program if it is correct.
> Instead of tagging the return itself, couldn't we use an attribute which
> would (in effect) tell the optimizer that any tail call in the function
> is safe to optimize? Yes, we lose the ability to specify that a specific
> call site is safe to optimize, but we don't have to invent yet another
> GCC extension of dubious value.
Problem I see with that is diagnostics again: e.g. someone depends on a
particular call being a tail call and not allocating new storage. With a
"tail call statement" gcc could easily give a warning or even an error
when the compiler is not able to satisfy that requirement. With the function
wide attribute it would be much harder to enforce it. Every call could
possible be a tail call depending on rather complex, machine dependent rules.
How would you generate the "not a tail call" warning without getting lots
of false positives? With an explicit statement it is clear what to do.
-Andi