[fpc-devel] Tail recursion optimization

Daniël Mantione daniel.mantione at freepascal.org
Tue Oct 10 10:56:14 CEST 2006



Op Tue, 10 Oct 2006, schreef Micha Nelissen:

> Florian Klaempfl wrote:
> > Yesterday, I've implemented tail recursion optimization
> > (http://svn.freepascal.org/svn/fpc/trunk/compiler/opttail.pas resulting
> > in
> > http://www.hu.freepascal.org/fpcircbot/cgipastebin?msgid=3D158 pp11 is =
the
> > new
> > compiler, fpc11 the old, both are 2.1.1). It isn't enabled yet because =
it
> > still
> > needs some fine tuning. The question is however when should it be
> > enabled? With
> > -OoTAILREC? -O3? Something different?
> =

> It doesn't always improve performance ? It takes much more code ?

I don't think so, because for tail recursion optimization you assign the =

parameters to the local variables (should not be larger than pushing =

them) and then jump to the start of the procedure (should not be larger =

than calling).

Dani=EBl


More information about the fpc-devel mailing list