Q. How to get better global register allocation?
Graham Stott
graham.stott@btinternet.com
Thu Jun 12 23:10:00 GMT 2003
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
More information about the Gcc
mailing list