Here's the kind of call I'd like turned into a tail call:
return (*((___host*)((((long*)((___pc)-(1))) + (1 +((-2)))))))(___ps);
and it appears that gcc doesn't want to convert it to a tail call. The
calling function has the same argument sequence.
What should I search for in the .s file to see if this was tail called?
It appears that the assembly code that this is translated into is:
<stuff removed>
movq -864(%rbp), %rax
subq $9, %rax
.loc 1 95837 157
movq (%rax), %rdx
movq -1032(%rbp), %rax
movq %rax, %rdi
call *%rdx
.LVL0:
.L1:
.loc 1 95837 220
movq -24(%rbp), %rax
subq %fs:40, %rax
je .L17743
call __stack_chk_fail@PLT
.L17743:
movq -8(%rbp), %rbx
leave
.cfi_def_cfa 7, 8
ret
This plugin claims to define a musttail attribute, but I'm not sure what
that means, really:
https://github.com/pietro/gcc-musttail-plugin/
Thanks for your help.
Brad
PS: LLVM seems to have a musttail attribute that you use at the call site:
-#define ___PROPER_TAIL_CALL(call) __attribute__((musttail)) return call
Does gcc have something like that?