public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <ian@airs.com>
To: Miles Bader <miles@gnu.org>
Cc: Bernd Schmidt <bernds_cb1@t-online.de>, gcc@gcc.gnu.org
Subject: Re: reload question
Date: Tue, 22 Mar 2005 18:56:00 -0000	[thread overview]
Message-ID: <m3br9bhbbt.fsf@gossamer.airs.com> (raw)
In-Reply-To: <buosm2txyzw.fsf@mctpc71.ucom.lsi.nec.co.jp>

Miles Bader <miles@lsi.nec.co.jp> writes:

> I've defined SECONDARY_*_RELOAD_CLASS (and PREFERRED_* to try to help
> things along), and am now running into more understandable reload
> problems:  "unable to find a register to spill in class"  :-/
> 
> The problem, as I understand, is that reload doesn't deal with conflicts
> between secondary and primary reloads -- which are common with my arch
> because it's an accumulator architecture.
> 
> For instance, slightly modifying my previous example:
> 
>    Say I've got a mov instruction that only works via an accumulator A,
>    and a two-operand add instruction.  "r" regclass includes regs A,X,Y,
>    and "a" regclass only includes reg A.
> 
>    mov has constraints like:     0 = "g,a"   1 = "a,gi"
>    and add3 has constraints:     0 = "a"     1 = "0"    2 = "ri" (say)
> 
> So if before reload you've got an instruction like:
> 
>    add temp, [sp + 4], [sp + 6]
> 
> and v2 and v3 are in memory, it will have to have generate something like:
> 
>    mov A, [sp + 4]    ; primary reload 1 in X, with secondary reload 0 A
>    mov X, A           ;   ""
>    mov A, [sp + 6]    ; primary reload 2 in A, with no secondary reload
>    add A, X
>    mov temp, A
> 
> There's really only _one_ register that can be used for many reloads, A.

I don't think there is any way that reload can cope with this
directly.  reload would have to get a lot smarter about ordering the
reloads.

Since you need the accumulator for so much, one approach you should
consider is not exposing the accumulator register until after reload.
You could do this by writing pretty much every insn as a
define_insn_and_split, with reload_completed as the split condition.
Then you split into code that uses the accumulator.  Your add
instruction permits you to add any two general registers, and you
split into moving one into the accumulator, doing the add, and moving
the result whereever it should go.  If you then split all the insns
before the postreload pass, perhaps the generated code won't even be
too horrible.

Ian

  parent reply	other threads:[~2005-03-22 16:53 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-16 10:08 Miles Bader
2005-03-16 14:58 ` Bernd Schmidt
2005-03-18 10:35   ` Miles Bader
2005-03-18 14:04     ` Miles Bader
2005-03-22 18:56     ` Ian Lance Taylor [this message]
2005-03-25 14:27       ` tm_gccmail
2005-03-25 15:43         ` Ian Lance Taylor
2005-06-02  5:56           ` Miles Bader
2005-03-25 16:30         ` Alan Lehotsky
  -- strict thread matches above, loose matches on Subject: below --
2011-08-11 16:49 Hari Sandanagobalane
2010-06-23 17:41 Alex Turjan
2010-06-23 18:30 ` Jeff Law
2010-06-23 21:29   ` Alex Turjan
2010-06-23 21:43     ` Jeff Law
2010-06-24  3:44 ` Joern Rennecke
2007-08-10 20:02 Pat Haugen
2007-08-11  0:18 ` Ian Lance Taylor
2007-08-13 14:55   ` Pat Haugen
2007-08-13 17:42     ` Ian Lance Taylor
2007-08-11 11:45 ` Paolo Bonzini
2003-03-19 12:51 Reload question Joern Rennecke
2003-03-19 19:39 ` Eric Botcazou
2003-03-18  0:25 Eric Botcazou
2002-07-25 13:57 Richard Kenner
2002-07-26 13:35 ` Mark Mitchell
2002-07-26 15:01   ` Bernd Schmidt
2002-07-26 16:35     ` Mark Mitchell
2002-07-25 13:47 Mark Mitchell
2002-07-25 16:19 ` Bernd Schmidt
2002-01-27  4:34 reload question Chris Lattner
1997-09-29  5:34 Reload question Christian Iseli
1997-09-29  8:41 ` Jeffrey A Law

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=m3br9bhbbt.fsf@gossamer.airs.com \
    --to=ian@airs.com \
    --cc=bernds_cb1@t-online.de \
    --cc=gcc@gcc.gnu.org \
    --cc=miles@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).