This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Indirect C-function calls not sibcall-optimised?
On Tue, Jul 16, 2002 at 02:52:10PM +1000, Andreas Bauer wrote:
> > One has to allocate the address to a call-clobbered that does not
> > overlap the argument registers.
>
> Ok, but how does that differ from a "normal call"? I guess, I still don't
> see the rationale behind it.
In a normal call, one can use call-saved registers to hold the
address, since you'll be returning to the current function, and
can thus properly restore the call-saved register.
Think about it -- in a tail call you must have (1) all call-saved
registers restored to the state your caller expects (2) all
argument registers loaded as the called function expects and
(3) a place to hold the address of the called function. And
sometimes (4) scratch registers to accomplish nr 1.
For some targets, e.g. ARM, *all* call-clobbered registers are
used for argument passing, so when calling a function with four
arguments there is no space for nr 3.
r~