public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Fwd: Register classes
@ 2004-08-18 18:16 Caroline Tice
  2004-08-18 18:40 ` Daniel Berlin
  0 siblings, 1 reply; 8+ messages in thread
From: Caroline Tice @ 2004-08-18 18:16 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 3906 bytes --]

Oops, I forgot to copy the list on this message...

Begin forwarded message:

> From: Caroline Tice <ctice@apple.com>
> Date: August 18, 2004 10:55:43 AM PDT
> To: Daniel Berlin <dberlin@dberlin.org>
> Subject: Re: Register classes
>
> If you are planning on doing some work on the register allocator, 
> there was an EXCELLENT paper in
> PLDI this year (ACM Conference on Programming Language Design and 
> Implementation) on
> updating Chaitin's algorithm to work well on modern architectures.  I 
> would strongly recommend you read it, if you haven't already.  I can 
> send you a copy if you like.  Below is my summary of the paper:
>
> A Generalized Algorithm for Graph-Coloring Register Allocation
> by M.D. Smith, N. Ramsey and G. Holloway
>
> Expanding Chaitin's graph coloring algorithm to work on real hardware 
> architectures (taking into account
> register classes, overlapping between register classes, register 
> aliasing, etc).  Basically, Chaitin said a
> node in the coloring graph was trivially colorable if the number of 
> neighbors of N, "degree(N)" was less
> than the number of registers on the machine.  The new formula says   
> node is trivially colorable is
>  "squeeze (N)" is less than the number of registers actually available 
> for allocation, where squeeze (N) is
> the number of registers that N's neighbors will actually need.  The 
> rest of the paper is the concerned with
> accurately defining "squeeze (N)" and "number of registers actually 
> available for allocation" taking the
> various hardware architectures and constraints into account.
>
> -- Caroline Tice
> ctice@apple.com
>
> On Aug 18, 2004, at 10:39 AM, Daniel Berlin wrote:
>
>> A whole lot of ports seem to have register classes that contain 
>> registers that can't possibly be used together.
>> They also have to seem weird groupings of registers that don't make 
>> sense to be used by any single pseudo.
>>
>> What exactly is the goal of these register classes?
>> Is it to work around bad allocation decisions by the register 
>> allocator/regclass (IE get regclass to choose this new class as the 
>> preferred class so that the allocator makes a better decision later 
>> on)?
>>
>> I recently had another discussion with Gregory Chaitan about register 
>> allocation, and two things he was adamant about (that I was also 
>> somewhat strong feeling, but not as adamant about during design of 
>> new-ra):
>>
>> 1. The interference graph should represent all interference 
>> constraints necessary to do allocation in some way.  IE for variables 
>> that need multiple registers, this needs to be represented in the 
>> interference graph in some way (through either extra or weighted 
>> edges).
>> IE you should need nothing but a single bit test to determine whether 
>> two variables can share a register or not.
>> New-ra didn't follow this, and it became quite messy to try to 
>> determine whether two variables actually interfered, and what the 
>> possible registers we could use for these variables were.  This took 
>> away most of the benefits of using an interference graph in the first 
>> place.
>>
>> 2. That a lot of parameterization be done properly, so that costs are 
>> done right for each thing, and the allocator can make the right 
>> decisions.
>>
>>
>> In our case, that means that register classes (if we keep them) 
>> should represent only one thing, whereas right now it seems they can 
>> represent one of three things:
>>
>> 1. The set of registers possible for some given mode/usage.
>> 2. The set of registers good (but not all possibly usable registers 
>> for that mode/usage are included) for some given mode/usage.
>> 3. The set of registers good (but including  unusable registers for 
>> that mode/usage) are included.
>>
>> Have I missed anything (I haven't touched new-ra or old-ra in a year 
>> or so, so it's possibly i've lost it).
>> --Dan
>>
>

[-- Attachment #2: Type: text/enriched, Size: 3974 bytes --]

Oops, I forgot to copy the list on this message...


Begin forwarded message:


<excerpt><bold><color><param>0000,0000,0000</param>From:
</color></bold>Caroline Tice <<ctice@apple.com>

<bold><color><param>0000,0000,0000</param>Date: </color></bold>August
18, 2004 10:55:43 AM PDT

<bold><color><param>0000,0000,0000</param>To: </color></bold>Daniel
Berlin <<dberlin@dberlin.org>

<bold><color><param>0000,0000,0000</param>Subject: </color>Re:
Register classes

</bold>

If you are planning on doing some work on the register allocator,
there was an EXCELLENT paper in

PLDI this year (ACM Conference on Programming Language Design and
Implementation) on

updating Chaitin's algorithm to work well on modern architectures.  I
would strongly recommend you read it, if you haven't already.  I can
send you a copy if you like.  Below is my summary of the paper:


A Generalized Algorithm for Graph-Coloring Register Allocation

by M.D. Smith, N. Ramsey and G. Holloway


Expanding Chaitin's graph coloring algorithm to work on real hardware
architectures (taking into account

register classes, overlapping between register classes, register
aliasing, etc).  Basically, Chaitin said a

node in the coloring graph was trivially colorable if the number of
neighbors of N, "degree(N)" was less

than the number of registers on the machine.  The new formula says  
node is trivially colorable is

 "squeeze (N)" is less than the number of registers actually available
for allocation, where squeeze (N) is

the number of registers that N's neighbors will actually need.  The
rest of the paper is the concerned with

accurately defining "squeeze (N)" and "number of registers actually
available for allocation" taking the

various hardware architectures and constraints into account.


-- Caroline Tice

ctice@apple.com


On Aug 18, 2004, at 10:39 AM, Daniel Berlin wrote:


<excerpt>A whole lot of ports seem to have register classes that
contain registers that can't possibly be used together.

They also have to seem weird groupings of registers that don't make
sense to be used by any single pseudo.


What exactly is the goal of these register classes?

Is it to work around bad allocation decisions by the register
allocator/regclass (IE get regclass to choose this new class as the
preferred class so that the allocator makes a better decision later
on)?


I recently had another discussion with Gregory Chaitan about register
allocation, and two things he was adamant about (that I was also
somewhat strong feeling, but not as adamant about during design of
new-ra):


1. The interference graph should represent all interference
constraints necessary to do allocation in some way.  IE for variables
that need multiple registers, this needs to be represented in the
interference graph in some way (through either extra or weighted
edges).

IE you should need nothing but a single bit test to determine whether
two variables can share a register or not.

New-ra didn't follow this, and it became quite messy to try to
determine whether two variables actually interfered, and what the
possible registers we could use for these variables were.  This took
away most of the benefits of using an interference graph in the first
place.


2. That a lot of parameterization be done properly, so that costs are
done right for each thing, and the allocator can make the right
decisions.



In our case, that means that register classes (if we keep them) should
represent only one thing, whereas right now it seems they can
represent one of three things:


1. The set of registers possible for some given mode/usage.

2. The set of registers good (but not all possibly usable registers
for that mode/usage are included) for some given mode/usage.

3. The set of registers good (but including  unusable registers for
that mode/usage) are included.


Have I missed anything (I haven't touched new-ra or old-ra in a year
or so, so it's possibly i've lost it).

--Dan


</excerpt>

</excerpt>

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Register classes
@ 2004-08-18 17:59 Daniel Berlin
  2004-08-20  2:07 ` James E Wilson
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Berlin @ 2004-08-18 17:59 UTC (permalink / raw)
  To: gcc

A whole lot of ports seem to have register classes that contain 
registers that can't possibly be used together.
They also have to seem weird groupings of registers that don't make 
sense to be used by any single pseudo.

What exactly is the goal of these register classes?
Is it to work around bad allocation decisions by the register 
allocator/regclass (IE get regclass to choose this new class as the 
preferred class so that the allocator makes a better decision later 
on)?

I recently had another discussion with Gregory Chaitan about register 
allocation, and two things he was adamant about (that I was also 
somewhat strong feeling, but not as adamant about during design of 
new-ra):

1. The interference graph should represent all interference constraints 
necessary to do allocation in some way.  IE for variables that need 
multiple registers, this needs to be represented in the interference 
graph in some way (through either extra or weighted edges).
IE you should need nothing but a single bit test to determine whether 
two variables can share a register or not.
New-ra didn't follow this, and it became quite messy to try to 
determine whether two variables actually interfered, and what the 
possible registers we could use for these variables were.  This took 
away most of the benefits of using an interference graph in the first 
place.

2. That a lot of parameterization be done properly, so that costs are 
done right for each thing, and the allocator can make the right 
decisions.


In our case, that means that register classes (if we keep them) should 
represent only one thing, whereas right now it seems they can represent 
one of three things:

1. The set of registers possible for some given mode/usage.
2. The set of registers good (but not all possibly usable registers for 
that mode/usage are included) for some given mode/usage.
3. The set of registers good (but including  unusable registers for 
that mode/usage) are included.

Have I missed anything (I haven't touched new-ra or old-ra in a year or 
so, so it's possibly i've lost it).
--Dan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-08-20  2:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18 18:16 Fwd: Register classes Caroline Tice
2004-08-18 18:40 ` Daniel Berlin
2004-08-19 13:42   ` Michael Matz
2004-08-19 17:09     ` Daniel Berlin
2004-08-19 20:14       ` Denis Chertykov
  -- strict thread matches above, loose matches on Subject: below --
2004-08-18 17:59 Daniel Berlin
2004-08-20  2:07 ` James E Wilson
2004-08-20  5:28   ` Daniel Berlin

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).