[LLVMdev] Tail Call Optimisation
Jon Harrop
jon at ffconsultancy.com
Sun Jan 3 20:50:07 PST 2010
On Monday 04 January 2010 03:33:06 Simon Harris wrote:
> On 04/01/2010, at 3:01 PM, Jon Harrop wrote:
> > I am certainly interested in tail calls because my HLVM project relies
> > upon LLVM's tail call elimination. However, I do not understand what tail
> > calls LLVM is not currently eliminating that you plan to eliminate?
>
> Mutual recursion for a start:
>
> def a(n)
> n <= 0 ? "DONE" : b(n - 1)
> end
>
> def b(n)
> n <= 0 ? "DONE" : a(n - 1)
> end
>
> a(10000000)
>
> Boom!
LLVM's TCO already handles mutual recursion.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
More information about the llvm-dev
mailing list