From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31504 invoked by alias); 17 May 2003 18:58:34 -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 31449 invoked from network); 17 May 2003 18:58:33 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 17 May 2003 18:58:33 -0000 Received: from hiauly1.hia.nrc.ca (hiauly1.hia.nrc.ca [127.0.0.1] (may be forged)) by hiauly1.hia.nrc.ca (8.12.9/8.12.9) with ESMTP id h4HIwVgL014004; Sat, 17 May 2003 14:58:31 -0400 (EDT) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.9/8.12.9/Submit) id h4HIwT9t014002; Sat, 17 May 2003 14:58:29 -0400 (EDT) Message-Id: <200305171858.h4HIwT9t014002@hiauly1.hia.nrc.ca> Subject: Re: Does gcc violate the ia64 ABI? To: gcc@gcc.gnu.org, rth@redhat.com, schwab@suse.de, hjl@lucon.org Date: Sat, 17 May 2003 18:58:00 -0000 From: "John David Anglin" MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg01665.txt.bz2 > 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. 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 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. 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. Dave -- J. David Anglin dave.anglin@nrc-cnrc.gc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6602)