public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@specifixinc.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: avoid unnecessary register saves for setjmp
Date: Sat, 22 Nov 2003 00:22:00 -0000	[thread overview]
Message-ID: <1069460429.1024.128.camel@leaf.tuliptree.org> (raw)
In-Reply-To: <20031121175503.GA30188@nevyn.them.org>

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

  reply	other threads:[~2003-11-22  0:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-21  5:54 Jim Wilson
2003-11-21 18:39 ` Daniel Jacobowitz
2003-11-22  0:22   ` Jim Wilson [this message]
2003-11-22  3:57     ` Daniel Jacobowitz
2003-11-22  9:06       ` Jim Wilson
2003-11-22 14:37         ` Richard Earnshaw
2003-11-22 16:33           ` Daniel Jacobowitz
2003-11-27  9:11             ` Zack Weinberg
2003-11-27 17:11               ` Andrew Pinski
2003-11-27 18:23                 ` Zack Weinberg
2003-11-28  5:15                   ` Geert Bosch
2003-11-28 11:14                   ` Richard Earnshaw
2003-11-28 14:02             ` Richard Earnshaw
2003-11-21 20:14 ` Geoff Keating
2003-11-22  0:20   ` Jim Wilson
2003-11-30  9:23   ` Jim Wilson
2003-11-22  4:13 Richard Kenner
2003-12-01  3:29 ` Jim Wilson
2003-11-27  9:19 Chris Lattner
2003-11-27  9:21 ` Andrew Haley
2003-11-27  9:22   ` Chris Lattner
2003-11-27  9:39     ` Andrew Haley
2003-11-27  9:43       ` Chris Lattner
2003-11-27 10:14       ` Zack Weinberg
2003-11-27 10:15         ` Chris Lattner
2003-11-27 11:01           ` Zack Weinberg
2003-11-27 20:28             ` Chris Lattner
2003-11-27 20:51               ` Gabriel Dos Reis
2003-11-27 15:41           ` Jan Vroonhof
2003-11-27 16:23           ` Jan Vroonhof
2003-11-27 10:31         ` Andrew Haley
2003-11-27 10:53           ` Zack Weinberg
     [not found] <5cad8ef043da68f2a3332f00bd6a186a3fc6195b@mail.esmertec.com>
2003-11-27 20:44 ` Chris Lattner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1069460429.1024.128.camel@leaf.tuliptree.org \
    --to=wilson@specifixinc.com \
    --cc=drow@mvista.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).