How to handle address which contain SUBREG

Andy H hutchinsonandy@aim.com
Wed Nov 25 15:37:00 GMT 2009


I'm am fixing some reload bugs for AVR.

In a couple of situations an address is formed which included  a SUBREG 
expression.
I am not sure how I should be handling these. Initial attempts produce 
sub-optimal code - and/or reload failures, so thought is a good idea to 
get some advise!

Either

(Subreg (Rx,0))

or

PLUS ((Subreg (Rx,0)) 5)

If I reject subreg expression, the code produced is sub-optimal.(since 
address is then calculated into register)

For the non-strict case I believe the address should be accepted as 
legitimate - on the basis that a SUBREG of psuedo  is just as valid as REG.

For the strict case (hard register) - I could either accept if the 
simplified form is valid - or reject and then make Legitimize simplify 
the SUBREG expression. (I guess I might also have to handle it in 
legitimize_reload_address.)

What is the right way?







More information about the Gcc mailing list