[LLVMdev] Broke my tail (call)

Arnold Schwaighofer arnold.schwaighofer at gmail.com
Tue Feb 24 14:19:27 PST 2009


0, i32 %1)
>>
>> Note that if you have a series of sequential recursive tail calls this
>> move will only performed once (at the bottom of the recursion,
>> respectively when the recursion returns) so it's impact on performance
>> should be minimal.
>
> Hmm, that makes it sound as though the moves between a tail call and the
> following return are redundant?
I am not sure i understand what you mean by redundant.

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.

regards
arnold



More information about the llvm-dev mailing list