[LLVMdev] X86 -tailcallopt and C calling conversion

NAKAMURA Takumi geek4civic at gmail.com
Tue Jan 4 19:07:26 PST 2011


Hello Evan,

I am sorry for my poor question.
s/ccc/default calling conversion/g ;)
("ccc" should be accepted as calling conversion specifier)

When "-tailcallopt" is specified (GuaranteedTailCallOpt),
tailcall optimizer would not touch functions of default calling conversion.


; for example
define void @caller_c() nounwind {
entry:
  tail call void @callee_c()
  ret void
}
declare void @callee_c() nounwind

define fastcc void @caller_f() nounwind {
entry:
  tail call fastcc void @callee_f()
  ret void
}
declare fastcc void @callee_f() nounwind


On {i686|x86_64}-linux without -tailcallopt,
caller_c:
        jmp     callee_c                # TAILCALL
caller_f:
        jmp     callee_f                # TAILCALL


With -tailcallopt, (on x86-64. simila on i686 too)
caller_c:
        pushq   %rax
        callq   callee_c
        popq    %rax
        ret
caller_f:
        pushq   %rax
        popq    %rax
        jmp     callee_f                # TAILCALL


...Takumi



More information about the llvm-dev mailing list