From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31763 invoked by alias); 22 Nov 2003 00:20:19 -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 31755 invoked from network); 22 Nov 2003 00:20:18 -0000 Received: from unknown (HELO localhost.localdomain) (24.7.123.142) by sources.redhat.com with SMTP; 22 Nov 2003 00:20:18 -0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id hAM0KTce021022; Fri, 21 Nov 2003 16:20:29 -0800 Subject: Re: avoid unnecessary register saves for setjmp From: Jim Wilson To: Daniel Jacobowitz Cc: gcc-patches@gcc.gnu.org In-Reply-To: <20031121175503.GA30188@nevyn.them.org> References: <1069393614.1023.66.camel@leaf.tuliptree.org> <20031121175503.GA30188@nevyn.them.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 22 Nov 2003 00:22:00 -0000 Message-Id: <1069460429.1024.128.camel@leaf.tuliptree.org> Mime-Version: 1.0 X-SW-Source: 2003-11/txt/msg01776.txt.bz2 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. > 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. Also, keep in mind that gcc versions from 1.0 to 3.0.4 did not do this extra saving, and setjmp worked fine for them. Users have to use volatile if they want a local variable to live across a setjmp call. > Er... actually, upon second inspection, the code I was referring to was > regs_live_at_setjmp in flow.c. I'm not sure whether the code you are > removing from reload1.c will change the behavior I describe, after > all. This code isn't affected by my patch. -- Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com