[LLVMdev] Broke my tail (call)

Jon Harrop jon at ffconsultancy.com
Tue Feb 24 15:39:21 PST 2009


On Tuesday 24 February 2009 22:19:27 Arnold Schwaighofer wrote:
> What i was trying to say is that if you have
>
> i32 a() {
>   %1 = tailcall b()
>    ret %1
> }
>
>
> i32 b() {
>  %1 = tailcall c()
>   ret %1
> }
>
> i32 c() {
>   %1 = tailcall d()
>    ret %1
> }
>
> i32 d() {
>   ret i32 5
> }
>
> only d() will actually perform the return i.e the move of the result
> to register %eax on x86 or in case of a struct return the move to
> whatever registers/(stackslots?) are used to return the elements of
> the struct.

Right but if only d() performs the move then what is going on between the tail 
calls and the returns in a, b, and c that inhibits TCO? I thought they might 
be redundant moves (but I've no idea!).

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list