Weddington, Eric schrieb:
>
>> -----Original Message-----
>> From: Georg-Johann Lay [mailto:[email protected]]
>> Sent: Friday, March 11, 2011 6:44 AM
>> To: [email protected]
>> Cc: Denis Chertykov; Anatoly Sokolov; Weddington, Eric; Boyapati, Anitha
>> Subject: [Patch][AVR]: Support tail calls
>>
>> This is a patch to test/review/comment on. It adds tail call
>> optimization to avr backend.
>
> <snip>
>
>> I did not find a way to make this work together with -mcall-prologues.
>> Please let me know if you have suggestion on how call prologues can be
>> combine with tail calls.
>
> Yeah, we're going to have to find a way to make this work with
> -mcall-prologues because that is a very commonly used target optimization
> switch.
"Does not work" means here that tail-call optimization won't be
applied in the presence of -mcall-prologues. The code will be correct,
of course. For any module that is compiled with -mcall-prologues the
patch hat no effect, see avr.c:avr_function_ok_for_sibcall()
+ /* Tail-calling must fail if callee-saved regs are used to pass
+ function args. We must not tail-call when `epilogue_restores'
+ is used. Unfortunalelly, we cannot tell at this point if that
+ actually will happen or not, and we cannot step back from
+ tail-calling. Thus, we inhibit tail-calling with
-mcall-prologues. */
+
+ if (cfun->machine->sibcall_fails
+ || TARGET_CALL_PROLOGUES)
+ {
+ return false;
+ }
Johann