On 6/8/24 3:32 AM, Mikael Pettersson via Gcc wrote:
On Thu, Jun 6, 2024 at 8:59 PM Dimitar Dimitrov <dimi...@dinux.eu> wrote:
Have you tried defining TARGET_LEGITIMIZE_ADDRESS for your target? From
a quick search I see that the iq2000 and rx backends are rewriting some
PLUS expression addresses with insn sequence to calculate the address.

I have partial success.

The key was to define both TARGET_LEGITIMATE_ADDRESS_P and an
addptr<Pmode>3 insn.
If it doesn't work without TARGET_LEGITIMATE_ADDRESS, then it's wrong.

At the highest level that hook is meant to provide a way for the target to adjust addresses to optimize them better. If you're using it for correctness purposes, it's ultimately going to fail in one way or another.

GCC has certainly supported targets with limited addressing modes in the past (ia64 being a good example). It's painful to deal with such targets, but it can be made to work.

Jeff

Reply via email to