From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11685 invoked by alias); 22 Nov 2003 03:08:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 11677 invoked from network); 22 Nov 2003 03:08:08 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 22 Nov 2003 03:08:08 -0000 Received: from drow by nevyn.them.org with local (Exim 4.24 #1 (Debian)) id 1ANO80-00060R-4F; Fri, 21 Nov 2003 22:08:08 -0500 Date: Sat, 22 Nov 2003 03:57:00 -0000 From: Daniel Jacobowitz To: Jim Wilson Cc: gcc-patches@gcc.gnu.org Subject: Re: avoid unnecessary register saves for setjmp Message-ID: <20031122030808.GA23061@nevyn.them.org> Mail-Followup-To: Jim Wilson , gcc-patches@gcc.gnu.org References: <1069393614.1023.66.camel@leaf.tuliptree.org> <20031121175503.GA30188@nevyn.them.org> <1069460429.1024.128.camel@leaf.tuliptree.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1069460429.1024.128.camel@leaf.tuliptree.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2003-11/txt/msg01791.txt.bz2 On Fri, Nov 21, 2003 at 04:20:29PM -0800, Jim Wilson wrote: > On Fri, 2003-11-21 at 09:55, Daniel Jacobowitz wrote: > > I recently spent some time investigating this same code. I was working > > on an ARM target with the iWMMXt extension set, which includes a number > > of additional registers. The existing setjmp implementation on that > > target did not save them, but things worked anyway; I dug, and this was > > how. > > We could perhaps use NON_SAVING_SETJMP for this, but I think fixing > setjmp is a better solution. Assuming it needs to save any of the > iWMMXt registers. > > > Speaking of Altivec, at least the GNU/Linux glibc setjmp implementation > > doesn't save Altivec registers either. I posted a patch for this about > > three years ago and it was never incorporated. So we may see problems > > reported from that side. > > PR 12817 is from people asking gcc to not save the altivec registers > around setjmp, because it isn't supposed to. So at least some PowerPC > folks believe that this register saving is wrong. If your setjmp saves them, sure. Here's the difficulty: changing the size of jmp_buf. Lately (last three years or so) there have been a rash of ISA extensions implemented which would require incompatible changes to jmp_buf for a widely deployed architecture. This is remarkably painful. > > I discussed this on IRC with a few people; I don't remember who all of > > them were, but definitely including H-P. My conclusion from the > > discussion was that the setjmp standard library function is _not_ > > mandated by C99 to save all registers. I do not know of any psABI > > documents which specify the saved registers either. So I am a little > > uncomfortable with your patch. > > Yes, setjmp is not required to save registers. Gcc knows this, and > avoids allocating pseudos to registers if the pseudo lives across a > setjmp. We don't need to save unused registers to make this work. Sure - but that assumes that all unused call-saved registers are restored by the setjmp. So then it is required to save registers to get reasonable behavior. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer