Implementing a restrictive addressing mode for a gcc port

Jim Wilson wilson@tuliptree.org
Mon Mar 31 20:52:00 GMT 2008


Mohamed Shafi wrote:
> For the source or the destination register Rd/Ra, the restriction is
> that it should be one more than the base register . So the following
> instructions are valid:

GCC doesn't provide any easy way for the source address to depend on the 
destination address, or vice versa.

One thing you could try is generating a double-word pseudo-reg at RTL 
expand time, and then using subreg 0 for the source and subreg 1 for the 
dest (or vice versa depending on endianness/word order).  This will get 
you a register pair you can use from the register allocator.  This 
doesn't help at reload time though.

You probably have to define a constraint for every register, and then 
write an alternative for every register pair matching the correct even 
register with the correct odd register.  That gets you past reload.

Another alternative might be to have a pattern (e.g. reload_insi) that 
generates secondary reloads that request the register pair you need. 
This is unlikely to get good code, but would not be hard to do.

Jim



More information about the Gcc mailing list