From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10033 invoked by alias); 19 May 2003 15:02:09 -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 9989 invoked from network); 19 May 2003 15:02:08 -0000 Received: from unknown (HELO localhost.localdomain) (195.113.19.66) by sources.redhat.com with SMTP; 19 May 2003 15:02:08 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h4JF21qO001512; Mon, 19 May 2003 17:02:01 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id h4JF21LM001506; Mon, 19 May 2003 17:02:01 +0200 Date: Mon, 19 May 2003 15:06:00 -0000 From: Jakub Jelinek To: "H. J. Lu" Cc: Richard Henderson , Fergus Henderson , John David Anglin , gcc@gcc.gnu.org, schwab@suse.de Subject: Re: Does gcc violate the ia64 ABI? Message-ID: <20030519150200.GB16629@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek References: <20030517202234.A28227@lucon.org> <200305182251.h4IMpsCD017880@hiauly1.hia.nrc.ca> <20030519030139.GA23221@ceres.cs.mu.oz.au> <20030519053855.GA25079@redhat.com> <20030519075540.A17193@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030519075540.A17193@lucon.org> User-Agent: Mutt/1.4i X-SW-Source: 2003-05/txt/msg01761.txt.bz2 On Mon, May 19, 2003 at 07:55:40AM -0700, H. J. Lu wrote: > > Only tail calls to provably local functions, apparently. > > I think that's pretty stupid, considering how cheap it is > > to reload the gp... > > I disagree. Gcc can still do tail calls to external functions as long > as it reloads gp, which gcc is already doing when gp is used after > the call, like in this code > > --- > extern void bar (); > > static void > bar1 () > { > bar (); > } > > extern int x; > > void > foo () > { > bar1 (); > x += 1; > } > --- > > I think we just need to change the code from > > reload_gp = gp is used after the tail call > > to > > reload_gp = the tail call is external > > It may be a win since we won't reload gp for the local call even if > gp is used after the tail call. Besides, you have said reloading gp > is cheap. I don't see fixing gcc will hurt performance. If bar1 has to reload gp after bar returns, then certainly the call to bar cannot be a tail call (as a tail call returns from bar stright to foo). Jakub