This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Does gcc violate the ia64 ABI?


On Mon, May 19, 2003 at 07:55:40AM -0700, H. J. Lu wrote:
> > Only tail calls to provably local functions, apparently.
> > I think that's pretty stupid, considering how cheap it is
> > to reload the gp...
> 
> I disagree. Gcc can still do tail calls to external functions as long
> as it reloads gp, which gcc is already doing when gp is used after
> the call, like in this code
> 
> ---
> extern void bar ();
> 
> static void
> bar1 ()
> {
>   bar ();
> }
> 
> extern int x;
> 
> void
> foo ()
> {
>   bar1 ();
>   x += 1;
> }
> ---
> 
> I think we just need to change the code from
> 
> 	reload_gp = gp is used after the tail call
> 
> to
> 
> 	reload_gp = the tail call is external
> 
> It may be a win since we won't reload gp for the local call even if
> gp is used after the tail call. Besides, you have said reloading gp
> is cheap. I don't see fixing gcc will hurt performance.

If bar1 has to reload gp after bar returns, then certainly the call to bar
cannot be a tail call (as a tail call returns from bar stright to foo).

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]