This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Does gcc violate the ia64 ABI?
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: hjl at lucon dot org (H. J. Lu)
- Cc: gcc at gcc dot gnu dot org, rth at redhat dot com, schwab at suse dot de
- Date: Sat, 17 May 2003 18:23:44 -0400 (EDT)
- Subject: Re: Does gcc violate the ia64 ABI?
> > > Gcc can skip gp save/restore across a local call. Right now, gcc
> > > saves and restores gp across a local call.
> >
> > Your example shows a tail-call to foo. Gp is obviously valid at the call.
> > There is no return in your example, so 'd' doesn't apply.
> >
>
> What did you by "no return"? Where does it go?
The return is in "foo". A tall call to an external function may
change gp.
> > two optimizations is more beneficial. I would judge that the latter
> > treatment would be in slight violation of the ia64 ABI, but the violation
> > would be local to a translation unit.
>
> A violation is a violation. There is no slight violation.
I was describing the pa treatment where there isn't similar wording
about the validity of gp at procedure return.
> > We currently do the latter optimization on the pa but I am wondering
> > if it would be better to skip the gp save/restore across local calls
> > instead.
>
>
> That is safe according to the ia64 psABI.
Read carefully what 'c' says:
> c. Any procedure call (indirect or direct) may modify gp - unless the call
> is known to be local to the load module.
This is talking about what happens in a procedure call. It's not talking
about what happens to gp in the body of a procedure. 'c' and 'd' don't
guarantee that gp won't be modified when a local call returns. For that,
you need to know if it is valid for a function to make an external
tail call, what happens to gp in the return path, etc.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)