[LLVMdev] Tail Call Optimisation

Jon Harrop jon at ffconsultancy.com
Mon Jan 4 03:03:37 PST 2010

On Monday 04 January 2010 05:16:40 Jeffrey Yasskin wrote:
> On Sun, Jan 3, 2010 at 10:50 PM, Jon Harrop <jon at ffconsultancy.com> wrote:
> > LLVM's TCO already handles mutual recursion.
> Only for fastcc functions


> compiled with -tailcallopt, right?

If you use the compiler, yes.

> http://llvm.org/docs/CodeGenerator.html#tailcallopt
> I believe gcc manages to support tail calls in many more cases, and
> this restriction in llvm confuses lots of newcomers. It would be very
> worthwhile if someone wanted to remove it.

That's interesting. What tail calls can be supported without changing the 
calling convention and would it not simply be easier to switch to the fastcc 
convention between internal functions to achieve the same effect from outside 
LLVM? Conversely, if TCO is implemented for the cc convention, what will be 
the point of fastcc?

Dr Jon Harrop, Flying Frog Consultancy Ltd.

More information about the llvm-dev mailing list