Thank you very much for reply. reload is such a lonely place!
TBH, it sounds like the opposite: LEGITIMIZE_RELOAD_ADDRESS should
not be handling this address at all.
Yes but reload will not do anything before call to L_R_A. So in practice
that would mean L_R_A has
to check reg_equiv_constant[regno] to see if register were a constant
and do nothing if it is.
If L_R_A does nothing with it,
the normal reload handling will first try:
(const:HI (plus:HI (symbol_ref:HI ("chk_fail_buf") (const_int 2))))
Are you sure? I think it will try
(plus:HI (symbol_ref:HI ("chk_fail_buf") (const_int 2)))
I could be wrong so I will rerun to check this. If const is missing it
will be rejected as valid address.
Though I note parts of reload do not impose this check.
If that's legitimate, that's the address you'll get. If it isn't,
the normal reload handling will reload the symbol_ref into a
base register of class:
MODE_CODE_BASE_REG_CLASS (mem_mode, PLUS, CONST_INT)
And it sounds from your message like that's exactly what you want.
Not really. - though that might be what happens if cons wrapper is missing.
We can take any relocatable expressions. So first choice is a good one.
Richard