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?


> > > 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)


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