This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: forcing tail/sibling call optimization
On Thu, Jan 04, 2001 at 10:53:15AM +1100, Fergus Henderson wrote:
> How can it query the target? The query needed is not just "does this
> target support tail calls", it is "does this target support *this*
> tail call", and the answer can depend on lots of stuff that the front
> end doesn't want to know about.
See FUNCTION_OK_FOR_SIBCALL; cfun->decl must be valid during the
query so that the target can compare return types (see the x86
version for why this matters).
> I don't think that will work. The "require" bit is pretty useless
> until GCC supports tail calls consistently, because AFAICT the
> front-end can't safely set it, at least not without encoding too much
> knowledge of the target and of GCC back-end limitations.
Well, that depends. If the language requires the conversion,
then the front end should just set the bit. For the most part,
I believe that most of the common targets do support tail calls
in some form, so I wouldn't let that worry you overmuch.
In any case, whether the bit means "suggest" and failure elicits
a warning or whether it means "require" and failure elicits an
error is a mere detail at present.
r~