public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>,
	Jeff Law <suzanne.jeff.law@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][RFA/RFC] Stack clash mitigation patch 02/08
Date: Mon, 17 Jul 2017 17:46:00 -0000	[thread overview]
Message-ID: <12b5442a-da33-c5ff-b076-6ebcb8a12802@redhat.com> (raw)
In-Reply-To: <59437b9f-e0d8-02dd-06fd-1b2542213cf0@redhat.com>

On 07/13/2017 04:54 PM, Jeff Law wrote:
> On 07/12/2017 07:44 PM, Segher Boessenkool wrote:

>> I don't really see why this is so complicated, and why the rs6000
>> target changes (a later patch) are so big.  Why isn't it just simple
>> patches to allocate_stack (and the prologue thing), that check the
>> flag and if it is set do some probes?
> Yea.  I wasn't happy with the size of the rs6000 patches either, which I
> mentioned at some point :-)  Some of the complexity is making sure we
> keep the backchain pointer correct and trying to do so as efficiently as
> possible.  But there's too much conceptual code duplication.
> 
> Essentially the code shows up 3 times in slightly different forms.
So in the V2 patch the PPC code is somewhat cleaner.  It's inherently
going to be more complex than the other ports because it has to handle
dynamic allocation and probing on its own rather than relying on the
generic code.

What I've done is broken out a few helper functions in that generic code
that the ppc backend can use.  There's helpers that compute the key
information we need (rounded size, last address, residual allocation,
etc), code to emit the start of the loop and code to emit the end of the
loop.

So the PPC dynamic code in rs6000.md looks something like this now

compute_data (...)
if (loop needed)
  {
    emit_loop_start (...);

    ppc magic to allocate & probe a stack page

    emit_loop_end (...);
  }

if (residuals)
  {
    fix operands[1] and let the rest of the expander run
  }



Ideally those three helpers could be used by other ports that have
backend specific expanders to handle dynamic stack allocations.

Jeff

      parent reply	other threads:[~2017-07-17 17:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11 21:20 Jeff Law
2017-07-13  1:44 ` Segher Boessenkool
2017-07-13 22:54   ` Jeff Law
2017-07-14 16:28     ` Jeff Law
2017-07-17 17:46     ` Jeff Law [this message]

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=12b5442a-da33-c5ff-b076-6ebcb8a12802@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=suzanne.jeff.law@gmail.com \
    /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).