> -----Original Message----- > From: Eric Botcazou [mailto:ebotca...@adacore.com] > Sent: Monday, June 17, 2013 4:42 PM > To: Bin Cheng > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH GCC]Fix PR57540, try to choose scaled_offset address mode > when expanding array reference > > > 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.
I was thinking it would be more accurate to capture the scaled_offset without over-kill by doing it in offset_address. Only problem I can image is the change forces addr into register, which might nullifies backend dependent transformation. I will try to do it in arm_legitimize_address and see what's the result. Thanks. bin