On 13 March 2007 19:56, Ian Lance Taylor wrote:
> "Dave Korn" <[EMAIL PROTECTED]> writes:
>
>> The intermediate cause is that lreg considers all the special-purpose reg
>> classes when allocating, and for some reason decides that several of the
>> special-purpose classes have equal cost (zero) to GENERAL_REGS. The bit I
>> find strange about this is that it then decides to take the
>> highest-numbered class as the preferred register class, despite the fact
>> that it has a lot less members in it than GENERAL_REGS. (There is no
>> overlap between the classes, so I haven't put them in the "wrong order",
>> as one is not a subset of the other).
>
> Did you set REGISTER_MOVE_COST for your new registers?
>
>
>> Q. Is it possible to do what I really want: to make the compiler aware of
>> some registers, but limit their usage to a single insn; to allow reload to
>> use these registers when directed to by a constraint letter, but for the
>> rest of the compiler to basically pretend they don't even exist.
>
> This is more or less what the MIPS backend does with the HI and LO
> registers. You might want to look at that.
Thanks Ian, that was just the ticket. The solution was indeed to define
REGISTER_MOVE_COST to a high value for moves between general regs and the
special purpose regs; that prevents RA from considering them to be preferred
classes for operands that aren't constrained to occupy a SPR. Adding
secondary reloads via gprs when reloading from/to memory wrapped it up nicely.
cheers,
DaveK
--
Can't think of a witty .sigline today....