public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: reload in incompatible constraints
Date: Tue, 28 Jun 2011 18:55:00 -0000	[thread overview]
Message-ID: <mcrmxh2yqck.fsf@coign.corp.google.com> (raw)
In-Reply-To: <BANLkTinTysU94gTnXiNTw455xogP4SnsRw@mail.gmail.com> (Aurelien	Buhrig's message of "Tue, 28 Jun 2011 11:02:36 +0200")

Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com> writes:

> 2011/6/28 Ian Lance Taylor <iant@google.com>:
>> Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com> writes:
>>
>>> I'm trying to implement TARGET_SECONDARY_RELOAD but I cannot make it
>>> work properly.
>>> The hook seems to work for preventing from moving from BASE_REG to
>>> BASE_REG in HImode by inserting a GENERAL_REG.
>>> But I also want to insert a GENERAL_REGS intermediate register when
>>> moving between BASE_REGS registers and memory in HImode.
>>>
>>> So I wrote something like that in my TARGET_SECONDARY_RELOAD:
>>> if (MEM_P(x) && (reload_mode == HImode) && reload_class == BASE_REGS)
>>>      return GENERAL_REGS;
>>>
>>>
>>> But it seems this do not work. For instance with DI function parameter
>>> access (movdi reg:DI <-- m) which are (automatically) split into movhi
>>> subreg:HI <-- m; then in movhi reg:HI <- m. But the hook do not seem
>>> to work since the reg:HI is reloaded into a BASE_REG...
>>>
>>> So when is this hook called? Is there something specific with spliting
>>> insn? Or just a general thing about TARGET_SECONDARY_RELOAD I missed ?
>>
>> The hook is called during reload, which is run as part of register
>> allocation.  When are you splitting the DImode load?
>>
>> Ian
>>
> I have no instruction for it. GCC automatically splits it, and it does
> it at the very beginning (131r.expand) by affecting a subreg:HI, and
> affects a reg:HI at 139r.subregs, and a hard base_reg at 176r.greg. It
> is never changed after.
>
> Would it be a reg class pb ?
> For now, I defined BASE_REGS class for address registers which does
> not intersect with GENERAL_REGS class (the data registers). Should I
> define Address register and data register as general register, with a
> class for address register and a new class for data registers (such as
> m68k) ?
>
> Does GCC treat GENERALS_REGS differently than other classes ?

Yes, but I don't see why this would be your problem.

From your description I don't know why this is not working.  You are
going to have to debug it.  Probably the first thing to try would be a
few debug statements in your TARGET_SECONDARY_RELOAD to see if it is
being invoked as you expect.

Ian

      reply	other threads:[~2011-06-28 14:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-23  8:35 Aurelien Buhrig
2011-06-23 17:58 ` Ian Lance Taylor
2011-06-27 21:46   ` Aurelien Buhrig
2011-06-28  6:01     ` Ian Lance Taylor
2011-06-28 17:57       ` Aurelien Buhrig
2011-06-28 18:55         ` Ian Lance Taylor [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=mcrmxh2yqck.fsf@coign.corp.google.com \
    --to=iant@google.com \
    --cc=aurelien.buhrig.gcc@gmail.com \
    --cc=gcc-help@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).