https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115634
--- Comment #3 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
Yeah, I agree that sounds like the right fix. Specifically, I assume
s390_decompose_addrstyle_without_index, when doing:
if (op && GET_CODE (op) != REG)
return false;
should check whether the register is a pseudo register or is a member of
ADDR_REGS. The check should probably be limited to reload_completed, so that
the RAs have a chance to reload other registers.
The reason this works during register allocation is that the RAs check
REGNO_OK_FOR_BASE_P and REGNO_OK_FOR_INDEX_P as part of the constraints
process. But those macros are not checked automatically by address constraints
themselves (perhaps somewhat surprisingly). It has to be done explicitly in
target code.
I disagree that the predicates & constraints are icky though. Given the way
that the architecture treats shift amounts as addresses, it seems like a neat
approach.