[LLVMdev] tail call optimization
Evan Cheng
evan.cheng at apple.com
Mon Jul 17 15:46:50 PDT 2006
llvm already know if a call is a tail call. There are some backend
codegen work that needs to be done. It's on my todo list. Just
haven't gotten to it yet...
Evan
On Jul 15, 2006, at 4:44 PM, Rafael EspĂndola wrote:
> compiling:
>
> void f(void);
> void g(void) {
> f();
> }
>
> With GCC 4.0.3 (-Os) produces the code
>
> pushl %ebp
> movl %esp, %ebp
> popl %ebp
> jmp f
>
> With llvm-gcc the result is
>
> subl $4, %esp
> call f
> addl $4, %esp
> ret
>
> Note that llvm-gcc automatically removes the frame pointer, but
> doesn't use a tail call as GCC does. LLVM has support for a tail
> calling convention. Is it missing a pass that tries to "promote" a
> regular call to a tail call?
>
> Thanks,
> Rafael
> _______________________________________________
> 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