[LLVMdev] RFC: Tail call optimization X86

Arnold Schwaighofer arnold.schwaighofer at gmail.com
Fri Oct 5 15:11:55 PDT 2007


On 5 Oct 2007, at 23:01, Gordon Henriksen wrote:
> Ocaml supports tail calls by never pushing arguments onto the stack.
> On x86, the first five arguments are passed using %eax, %ebx, %ecx, %
> edx, and %esi (left to right) and the sole return value is passed in %
> eax. (Ocaml never performs dynamic allocas, and so always performs
> frame pointer elimination. Floats are passed by reference.) The front-
> end will address the case of additional arguments.
>
> For my implementation of ocamlopt, the most useful LLVM features in
> this area would be would be support for the above cc, and tail calls
> for the inreg case. The former seems to be fairly well trivial;
> hopefully your work could be tweaked to accomplish the latter.

i guess there will have to be a ocamlcc calling convention and some  
tweaks
to X86RegisterInfo.cpp to return the correct calleesaved registers.
  i guess most of my code could be reused for the tail call stuff.

i would be glad to help if/when you need it

regards
arnold




More information about the llvm-dev mailing list