RFA: Avoid automodification in ARM call addresses

Richard Sandiford richard@codesourcery.com
Tue Dec 13 04:33:00 GMT 2005


Ian Lance Taylor <ian@airs.com> writes:
> Looking at it again, it seems simpler to change the 'm' constraint to
> 'o', rather than changing the insn condition at all.

I'm probably misunderstanding you, sorry, but I think changing the
constraint from 'm' to 'o' misses the point of the patch.  The problem
isn't that 'm' is too pemissive; it isn't.  The patterns can handle
unspilled automodified addresses just fine.  The problem is that, if the
automodified address register is spilled, we have an address that is not
a valid memory operand as-is, namely:

    (mem (pre_inc (mem (plus (reg fp) (const_int ...)))))

We need to reload this address.  We need an input reload to copy the
pseudo's stack slot into a base register and an output reload to copy
the base register back to the spill slot.

The same would be true if we changed the constraints to 'o'.  You'd get
the following input reloads:

        reg <- spill slot
        reg <- reg - 4

And the following output reload:

        spill slot <- reg

The point is that calls cannot have output reloads.  And IMO, arm.md is
wrong in providing a call pattern that it cannot handle without such a
reload.  I.e., arm.md is wrong because (a) the insn accepts any type of
memory operand, but (b) it doesn't provide an alternative that can handle
spilled automodified address registers.  It's no different from providing
(say) a decrement-and-branch pattern that requires an output reload when
the counter is spilled.

Richard



More information about the Gcc-patches mailing list