public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Edelsohn <dje.gcc@gmail.com>
To: gcc-patches@gcc.gnu.org, Alan Modra <amodra@gmail.com>
Subject: Re: powerpc64 large-toc vs. reload
Date: Mon, 20 Jun 2011 08:06:00 -0000	[thread overview]
Message-ID: <BANLkTikKVH9hcc+9nv9ULPdzJXeDNuTdTg@mail.gmail.com> (raw)
In-Reply-To: <20110619140336.GM21332@bubble.grove.modra.org>

On Sun, Jun 19, 2011 at 10:03 AM, Alan Modra <amodra@gmail.com> wrote:
> I was alerted to a problem with large toc (-mcmodel=medium/large) code
> a few days ago by warnings emitted during a binutils build.
>
> dwarf.c: In function 'display_debug_lines_raw':
> dwarf.c:2409:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL (44) found in variable location
> dwarf.c:2409:1: note: non-delegitimized UNSPEC UNSPEC_TOCREL (44) found in variable location
>
> On investigating why this was happening, I found that these UNSPECs
> were from the high part calculation of a toc-relative address that
> didn't get a register.  reload allocated the pseudo to a stack slot..
> The stack slot didn't match the tight pattern in delegitimize_address
> which is why we have an UNSPEC left in the debug info.  The real
> problem of course is that reload should never allocate a stack slot
> for a simple address calculation that can be rematerialised anywhere
> in the function with just one instruction.  So after quite a bit of
> digging around in reload, I finally figured out that the problem has a
> really easy solution.  Simply tell reload that those high part address
> calculations are constants.  Which is true.
>
> That's what the create_TOC_reference change, and the rs6000.md changes
> below do.  (I also fix large-toc tls patterns.)  The rest of the patch
> just adjusts for the changed RTL.
>
> Bootstrap and regression tests powerpc64-linux in progress.  OK to
> apply mainline and 4.6 assuming no regressions?
>
>        * config/rs6000/rs6000.c (create_TOC_reference): Wrap high part
>        of toc-relative address in CONST.
>        (rs6000_delegitimize_address): Recognize changed address.
>        (rs6000_legitimize_reload_address): Likewise.
>        (rs6000_emit_move): Don't force these constants to memory.
>        * config/rs6000/rs6000.md (tls_gd, tls_gd_high): Wrap high part of
>        toc-relative address in CONST.
>        (tls_ld, tls_ld_high, tls_got_dtprel, tls_got_dtprel_high): Likewise.
>        (tls_got_tprel, tls_got_tprel_high, largetoc_high): Likewise.

Okay.

Thanks, David

  reply	other threads:[~2011-06-20  3:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-19 18:15 Alan Modra
2011-06-20  8:06 ` David Edelsohn [this message]
2011-06-20 15:18   ` Alan Modra

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=BANLkTikKVH9hcc+9nv9ULPdzJXeDNuTdTg@mail.gmail.com \
    --to=dje.gcc@gmail.com \
    --cc=amodra@gmail.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).