From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 418 invoked by alias); 17 May 2003 22:23:48 -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 382 invoked from network); 17 May 2003 22:23:48 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 17 May 2003 22:23:48 -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 h4HMNjgL014517; Sat, 17 May 2003 18:23:46 -0400 (EDT) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.9/8.12.9/Submit) id h4HMNj3M014515; Sat, 17 May 2003 18:23:45 -0400 (EDT) Message-Id: <200305172223.h4HMNj3M014515@hiauly1.hia.nrc.ca> Subject: Re: Does gcc violate the ia64 ABI? To: hjl@lucon.org (H. J. Lu) Date: Sat, 17 May 2003 23:27:00 -0000 From: "John David Anglin" Cc: gcc@gcc.gnu.org, rth@redhat.com, schwab@suse.de In-Reply-To: <20030517133126.A22720@lucon.org> from "H. J. Lu" at May 17, 2003 01:31:26 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg01672.txt.bz2 > > > 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)