This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Q. How to get better global register allocation?
- From: Graham Stott <graham dot stott at btinternet dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 13 Jun 2003 00:06:34 +0100
- Subject: Re: Q. How to get better global register allocation?
- References: <Pine.LNX.4.44.0306120900300.4105-100000@wotan.suse.de>
Michael Matz wrote:
Hi,
On Wed, 11 Jun 2003, Graham Stott wrote:
(set (mem:SI (post_inc:SI (reg:SI 12))) (reg:SI 22))
(set (pc) (label_ref (code_label 1))
Now A2 is not a good register for pseudo 22 because the src and mem
cannot use registers from the same class.
Then you need to express that in the constraints. For instance if the
post_inc address can be placed into class A, the constraint for operand 1
(the source), should be "bcd" (in case these are the characters for your
register classes). Then the regclass pass should generate more usefull
preferred register classes, which then will lead to better allocation.
Been there tried that already it didn't exactly do what I wanted owning
too ALL_REGS still being the prefered class for pseudo 22.
Problems will of course arise, if for instance in the above example pseudo
12 will also be used in contexts requiring class B, as then the union of
both classes is the preferred class. Hence you also need to define
register classes which represent the union of all you base classes, which
shouldn't be too much as you only have four of them. Otherwise regclass
is more or less forced to take ALL_REGS as the preferred class.
In the example quoted the only constraint on pseduo 22 comes from the
mem so I was expecting the prefered class to be "BCD" for which we do have
a register class defined, ditto for the other combinations.
Guess I'll do some more digging.
Ciao,
Michael.
Cheers
Graham