From: roy rosen <roy.1rosen@gmail.com>
To: Vladimir Makarov <vmakarov@redhat.com>
Cc: gcc@gcc.gnu.org
Subject: Re: register allocation
Date: Mon, 27 Dec 2010 15:43:00 -0000 [thread overview]
Message-ID: <AANLkTinG9xhVjLkppMwwm-uwOGHwwtFcwcuWfzaion2Q@mail.gmail.com> (raw)
In-Reply-To: <4D137DDE.8010904@redhat.com>
2010/12/23 Vladimir Makarov <vmakarov@redhat.com>:
> On 12/23/2010 03:13 AM, roy rosen wrote:
>>
>> Hi All,
>>
>> I am looking at the code generated by my port and it seems that I have
>> a problem that too many copies between registers are generated.
>> I looked a bit at the register allocation and wanted to verify that I
>> understand its behavior.
>>
>> Is that true that it first chooses a register class for each pseodo
>> and only then starts coloring?
>>
> Yes, that is true.
>>
>> I think that my problem is that in my architecture there are two
>> register classes which can do all arithmetic operation but class X can
>> also do loads and stores and class Y can also do DSP operations.
>>
>> So when there are for example two DSP operations and between them some
>> arithmetic operations I expect to use only class Y but GCC prefers to
>> copy registers and do the arithmetic operations using X because for
>> some reason it determined that the prefered class for the registers in
>> the arithmetic operations is X.
>>
>> It seems that determining the class does not look at the whole flow
>> but rather looks only at insns in which the register appears.
>>
> Defining classes for pseudos is already one of the most expensive operation
> in IRA. Looking at the flow would make it even more complicated (I even
> don't know how to use this to improve the allocation because it means live
> range splitting before coloring and before defining classes which could help
> do live range splitting reasonably taking register pressure into account).
>>
>> Do I understand the situation correctly?
>
> Yes, I guess.
>>
>> Is there something I can do about it?
>
> I'd recommend to try ira-improv branch. I think that part of the problem is
> in usage of cover classes. The branch removes the cover classes and permits
> IRA to use intersected register classes and that helps to assign better hard
> registers.
>
>
I tried now this branch and got better results for some cases but
still in other cases I get lots of redundent register copies.
I might be missing something from the gcc history but I wonder why do
we need to limit the coloring stage to select a hard reg from a class
that was chosen by a prior stage.
Why not simply put in the interference graph edges for all registers
which are not possible for a pseudo and let the coloring algorithm
select the best hard reg.
It seems that choosing a class for a pseudo before the coloring only
makes it impossible for the coloring to get to the best solution.
Roy.
next prev parent reply other threads:[~2010-12-27 15:43 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-23 8:13 roy rosen
2010-12-23 16:48 ` Vladimir Makarov
2010-12-23 17:22 ` Jeff Law
2010-12-27 15:43 ` roy rosen [this message]
2011-01-03 15:41 ` Jeff Law
2011-01-05 14:44 ` roy rosen
2011-01-05 15:26 ` Jeff Law
2011-01-11 16:11 ` Vladimir Makarov
2011-01-11 15:53 ` Vladimir Makarov
-- strict thread matches above, loose matches on Subject: below --
2005-11-24 20:51 Register Allocation Joern RENNECKE
2005-11-17 16:53 Andrew MacLeod
2005-11-18 2:55 ` Mark Mitchell
2005-11-18 3:27 ` Daniel Jacobowitz
2005-11-18 9:53 ` Giovanni Bajo
2005-11-18 15:28 ` Andrew MacLeod
2005-11-19 19:31 ` Ian Lance Taylor
2005-11-19 20:20 ` Denis Chertykov
2005-11-20 0:20 ` Giovanni Bajo
2005-11-23 17:07 ` Andrew MacLeod
2005-11-23 20:43 ` Ian Lance Taylor
2005-11-20 0:37 ` Steven Bosscher
2005-11-23 17:08 ` Andrew MacLeod
2005-11-22 19:26 ` Peter Bergner
2005-11-22 21:55 ` Steven Bosscher
[not found] ` <200511222256.13823.>
2005-11-22 22:58 ` Peter Bergner
2005-11-23 14:06 ` Michael Matz
2005-11-23 20:50 ` Peter Bergner
2005-11-23 17:08 ` Andrew MacLeod
2004-09-22 1:21 Adrian Strätling
2004-09-22 5:22 ` tm_gccmail
2004-10-04 14:13 ` Nick Ing-Simmons
2004-05-02 13:27 register allocation Qiong Cai
2004-05-02 16:56 ` Daniel Berlin
2004-05-03 7:07 ` Michael Matz
2004-03-26 22:21 Register Allocation John Lu
2004-03-26 22:21 ` Vladimir N. Makarov
2004-03-26 22:26 ` Andrew MacLeod
2004-03-27 18:22 ` Andi Kleen
2002-03-12 6:21 register Allocation Danish Samad
1997-10-14 5:51 Register allocation Thomas Koenig
1998-12-21 22:38 ` 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=AANLkTinG9xhVjLkppMwwm-uwOGHwwtFcwcuWfzaion2Q@mail.gmail.com \
--to=roy.1rosen@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=vmakarov@redhat.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).