From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8096 invoked by alias); 17 May 2003 20:31:28 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 8043 invoked from network); 17 May 2003 20:31:27 -0000 Received: from unknown (HELO sccrmhc02.attbi.com) (204.127.202.62) by sources.redhat.com with SMTP; 17 May 2003 20:31:27 -0000 Received: from lucon.org (12-234-88-5.client.attbi.com[12.234.88.5]) by attbi.com (sccrmhc02) with ESMTP id <2003051720312700200a7sg7e>; Sat, 17 May 2003 20:31:27 +0000 Received: by lucon.org (Postfix, from userid 1000) id AC74F2C681; Sat, 17 May 2003 13:31:26 -0700 (PDT) Date: Sat, 17 May 2003 20:43:00 -0000 From: "H. J. Lu" To: John David Anglin Cc: gcc@gcc.gnu.org, rth@redhat.com, schwab@suse.de Subject: Re: Does gcc violate the ia64 ABI? Message-ID: <20030517133126.A22720@lucon.org> References: <200305171858.h4HIwT9t014002@hiauly1.hia.nrc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i 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 X-SW-Source: 2003-05/txt/msg01668.txt.bz2 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.