public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Bernd Edlinger <bernd.edlinger@hotmail.de>,
	       Jakub Jelinek <jakub@redhat.com>,
	Dimitar Dimitrov <dimitar@dinux.eu>,
	       Christophe Lyon <christophe.lyon@linaro.org>,
	       Thomas Preudhomme <thomas.preudhomme@linaro.org>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	       richard.sandiford@arm.com
Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807
Date: Fri, 11 Jan 2019 12:18:00 -0000	[thread overview]
Message-ID: <20190111121814.GG14180@gate.crashing.org> (raw)
In-Reply-To: <87zhs84374.fsf@arm.com>

On Thu, Jan 10, 2019 at 09:23:27PM +0000, Richard Sandiford wrote:
> Segher Boessenkool <segher@kernel.crashing.org> writes:
> > On Tue, Jan 08, 2019 at 12:03:06PM +0000, Richard Sandiford wrote:
> >> Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
> >> > Meanwhile I found out, that the stack clobber has only been ignored up to
> >> > gcc-5 (at least with lra targets, not really sure about reload targets).
> >> > From gcc-6 on, with the exception of PR arm/77904 which was a regression due
> >> > to the underlying lra change, but fixed later, and back-ported to gcc-6.3.0,
> >> > this works for all targets I tried so far.
> >> >
> >> > To me, it starts to look like a rather unique and useful feature, that I would
> >> > like to keep working.
> >> 
> >> Not sure what you mean by "unique".  But forcing a frame is a bit of
> >> a slippery concept.  Force it where?  For the asm only, or the whole
> >> function?  This depends on optimisation and hasn't been consistent
> >> across GCC versions, since it depends on the shrink-wrapping
> >> optimisation.  (There was a similar controversy a while ago about
> >> to what extent -fno-omit-frame-pointer should "force a frame".)
> >
> > It's not forcing a frame currently: it's just setting frame_pointer_needed.
> > Whatever happens from that is the target's business.
> 
> Do you mean the asm clobber or -fno-omit-frame-pointer?  If the option,
> then yeah, and that was exactly what was controversial :-)

I meant the asm clobber.  LRA sets frame_pointer_needed to 1 because the
stack pointer is clobbered, on many targets anyway:

          /* If we modify the source of an elimination rule, disable
             it.  Do the same if it is the destination and not the
             hard frame register.  */
          for (ep = reg_eliminate;
               ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
               ep++)
            if (ep->from_rtx == XEXP (x, 0)
                || (ep->to_rtx == XEXP (x, 0)
                    && ep->to_rtx != hard_frame_pointer_rtx))
              setup_can_eliminate (ep, false);

and setup_can_eliminate has

  if (! value
      && ep->from == FRAME_POINTER_REGNUM && ep->to == STACK_POINTER_REGNUM)
    frame_pointer_needed = 1;

> >> The effect on the redzone seems like something that should be specified
> >> explicitly rather than as an (accidental?) side effect of listing the
> >> sp in the clobber list.  Maybe this would be another use for the "asm
> >> attributes" proposal.  "noreturn" was another attribute suggested on
> >> IRC yesterday.
> >
> > Redzone is target-dependent.
> 
> Right.  Target-dependent asm attributes wouldn't be a problem though.

It's harder to document, which means it is harder to get right (and get
people to _use_ it correctly), as well.

> Most other things about an asm are target-dependent anyway.

Very true.

> > "noreturn"...  What would that mean, *exactly*?  It cannot execute any
> > code the compiler can see, so such asm is better off as real asm anyway
> > (not inline asm).
> 
> "Exactly" is a strong word, and this wasn't my proposal, but...

"Exactly", as in, "please do enough hand-waving to cover all available
space" ;-)

There are many details that aren't quite obvious, but they do matter for
how usable and useful this extension would be.

> I think it would act like a noreturn call to an unknown function.

Except it won't behave like a call otherwise (on Power all calls force a
stack frame, for example; and on all targets noreturn calls do the same
currently I think?)

> Output operands wouldn't make sense, and arguably clobbers wouldn't
> either.

Yeah.


Segher

  parent reply	other threads:[~2019-01-11 12:18 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-16 14:36 Bernd Edlinger
2018-12-16 16:14 ` Dimitar Dimitrov
2018-12-17 11:47   ` Richard Sandiford
2018-12-17 12:54     ` Christophe Lyon
2018-12-17 13:35       ` Richard Sandiford
2018-12-17 13:42         ` Christophe Lyon
2018-12-17 14:05           ` Bernd Edlinger
2018-12-17 14:10         ` Bernd Edlinger
2018-12-17 15:55     ` Segher Boessenkool
2018-12-17 18:46       ` Richard Sandiford
2018-12-17 20:15         ` Bernd Edlinger
2018-12-19  6:40           ` Dimitar Dimitrov
2018-12-19  9:29             ` Segher Boessenkool
2018-12-18 14:16     ` Bernd Edlinger
2018-12-18 15:14       ` Bernd Edlinger
2019-01-07  9:23   ` Jakub Jelinek
2019-01-07 21:51     ` Bernd Edlinger
2019-01-08 12:03       ` Richard Sandiford
2019-01-10 13:21         ` Segher Boessenkool
2019-01-10 21:23           ` Richard Sandiford
2019-01-10 21:26             ` Jakub Jelinek
2019-01-10 21:56               ` Richard Sandiford
2019-01-11 12:26                 ` Segher Boessenkool
2019-01-10 22:32             ` Bernd Edlinger
2019-01-11 12:18             ` Segher Boessenkool [this message]
2019-01-11 12:23               ` Richard Sandiford
2019-01-11 22:59         ` Jeff Law
2019-01-17 14:27           ` Christophe Lyon
2019-01-18  9:49             ` Richard Sandiford
  -- strict thread matches above, loose matches on Subject: below --
2018-12-09 10:09 Dimitar Dimitrov
2018-12-10 11:21 ` Richard Sandiford
2018-12-10 19:36   ` Dimitar Dimitrov
2018-12-11 15:52     ` Richard Sandiford
2018-12-12  9:42       ` Christophe Lyon
2018-12-12 10:03         ` Christophe Lyon
2018-12-12 16:39           ` Dimitar Dimitrov
2018-12-12 10:30         ` Thomas Preudhomme
2018-12-12 11:21           ` Thomas Preudhomme
2018-12-12 13:19             ` Christophe Lyon
2018-12-12 15:13               ` Christophe Lyon
2018-12-12 15:35                 ` Thomas Preudhomme
2018-12-12 16:26               ` Dimitar Dimitrov
2018-12-13 14:49                 ` Segher Boessenkool
2018-12-13 22:21                   ` Dimitar Dimitrov
2018-12-14  8:52                     ` Segher Boessenkool
2018-12-16  8:43                       ` Dimitar Dimitrov
2018-12-17 15:23                         ` Segher Boessenkool
2018-12-14 13:49               ` Richard Sandiford
2018-12-15 15:38                 ` Segher Boessenkool
2018-12-12 11:24 ` Andreas Schwab

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=20190111121814.GG14180@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=bernd.edlinger@hotmail.de \
    --cc=christophe.lyon@linaro.org \
    --cc=dimitar@dinux.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=richard.sandiford@arm.com \
    --cc=thomas.preudhomme@linaro.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).