[LLVMdev] Tail-calling

Arnold Schwaighofer arnold.schwaighofer at gmail.com
Thu Sep 11 23:24:12 PDT 2008


For marking a call site as a tail call you have to call  void
setTailCall(bool isTC = true) on the CallInst. The calling convention
of the function needs to be CallingConv::Fast (currently only fastcc
calls are optimized) and the call has to be in tail position of
course.

To enable tail call optimization in an embedded vm i guess you would
include llvm/Target/TargetOptions.h and set the static variable
PerformTailCallOpt to true.

Take this with a grain of salt or two since i have never done it ;)
but i guess that setting those globals is what
cl::ParseCommandLineOptions does in lli/llc.cpp.

regards arnold

> Quick question, how do you enable tail calls for the JIT when using
> the API, not an external app; in my program it is all internal,
> nothing external is called and the only thing I saw was that one
> global on a quick look through.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list