> My mistake. It's because arm_legitimize_address cannot re-factor "[r105 + > r165*4 + (-2064)]" into "rx = r105 + (-2064); [rx + r165*4]". Do you > suggest that this kind of transformation should be done in backend? I can > think of some disadvantages by doing it in backend: > Different kinds of address expression might be wanted in different phase of > compilation, for example, sometimes GCC wants to force computation of > address expression out of memory access because it cannot CSE array > indexing. It's difficult to differentiate in backend.
It's equally difficult in memory_address_addr_space and it affects all the architectures at once... You said in the original message that Thumb2 and ARM modes are already not equally sensitive to it, so it's not unthinkable that some architectures might not want it at all. Therefore, yes, this should preferably be handled in arm_legitimize_address. -- Eric Botcazou