Controlling what kind of value ends in a register

Jim Wilson wilson@specifixinc.com
Wed Sep 17 08:11:00 GMT 2003


Alexandre Courbot wrote:
> My machine definition requires that one kind of register class (named 
> POINTER_REGS) is exclusively used to hold addresses.

You didn't mention why addresses always have to be in POINTER_REGS.  The 
precise reason why may affect the answer.  You also haven't clearly 
shown what is going wrong.

There are a number of issues here.  You might want 
GO_IF_LEGITIMATE_ADDRESS to only accept registers in POINTER_REGS.  You 
might want to define a constraint letter for the POINTER_REGS register 
class and use it in all instructions that use addresses.  If that 
includes simple instructions like add, and you need to tell the 
difference between an address add and an integer add, then you might 
need to use PSImode or something similar for addresses so you can 
distinguish them from integers.  You might want BASE_REG_CLASS and 
INDEX_REG_CLASS to be POINTER_REGS.  You might want to define 
PREFERRED_RELOAD_CLASS to restrict classes for pointers to POINTER_REGS. 
  You might need secondary reloads.  You might need any number of other 
stuff.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list