This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Q. How to get better global register allocation?


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.

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.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]