public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: gcc@gcc.gnu.org, rth@redhat.com, schwab@suse.de
Subject: Re: Does gcc violate the ia64 ABI?
Date: Sat, 17 May 2003 20:43:00 -0000	[thread overview]
Message-ID: <20030517133126.A22720@lucon.org> (raw)
In-Reply-To: <200305171858.h4HIwT9t014002@hiauly1.hia.nrc.ca>; from dave@hiauly1.hia.nrc.ca on Sat, May 17, 2003 at 02:58:29PM -0400

On Sat, May 17, 2003 at 02:58:29PM -0400, John David Anglin wrote:
> > On Fri, May 16, 2003 at 05:43:18PM -0700, Richard Henderson wrote:
> > > On Fri, May 16, 2003 at 03:25:08PM -0700, H. J. Lu wrote:
> > > > d. At procedure return, gp must be valid (for the returning prodecure).
> > > > This allows the compiler to optimize calls known to be local (i.e., the
> > > > exceptions to Rule 'c').
> > > 
> > > I was not aware of this clause.  I'd have sworn it wasn't a part
> > > of the ABI at one time...
> > > 
> > > Indeed, if this clause is truely correct, then virtually all of
> > > the tail-call possibilities on ia64 are invalid.  Yes, statics
> > > still can be done, but that's not nearly as frequent.
> > 
> > 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?

> Note that skipping the gp save/restore across a local call is a "compiler"
> optimization.  If you save and restore gp across local calls, then
> it's likely possible to skip the save and restore across the last call in
> a function if gp is not used after the last call, including the return
> path to the caller.  I don't have a good feeling as to which of these

You don't have to save and restore gp as long as you can prove gp is
not changed. It has nothing to do if gp is used or not, according to
the ia64 psABI.

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

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


 H.J.

  reply	other threads:[~2003-05-17 20:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-17 18:58 John David Anglin
2003-05-17 20:43 ` H. J. Lu [this message]
2003-05-17 23:27   ` John David Anglin
2003-05-17 23:45     ` H. J. Lu
2003-05-18  3:22       ` John David Anglin
2003-05-18  4:10         ` H. J. Lu
2003-05-18 23:00           ` John David Anglin
2003-05-19  3:08             ` Fergus Henderson
2003-05-19  6:18               ` Richard Henderson
2003-05-19 15:00                 ` H. J. Lu
2003-05-19 15:06                   ` Jakub Jelinek
2003-05-19 15:27                     ` H. J. Lu
2003-05-19 20:43                       ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2003-05-16 23:37 John David Anglin
2003-05-16 21:55 H. J. Lu
2003-05-16 22:10 ` Andreas Schwab
2003-05-16 22:27   ` H. J. Lu
2003-05-17  0:50     ` Richard Henderson
2003-05-17  5:52       ` H. J. Lu
2003-05-17 18:58         ` Richard Henderson
2003-05-17 22:02           ` H. J. Lu
2003-05-18  0:08             ` Richard Henderson
2003-05-18  3:10               ` H. J. Lu
2003-05-20 23:21               ` H. J. Lu
2003-05-21  3:22                 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030517133126.A22720@lucon.org \
    --to=hjl@lucon.org \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=gcc@gcc.gnu.org \
    --cc=rth@redhat.com \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).