On 2012-06-16 00:45, Richard Sandiford wrote:
> [(mem:GPR (match_operand:P 1 "register_operand" "d"))]
>
> Instead, we should define a new memory predicate/constraint pair
> for memories that only accept register addresses. I.e. there
> should be a new predicate to go alongside things like
> memory_operand and stack_operand, except that the new one would
> be even more restrictive in the set of addresses that it allows.
> mem_reg_operand seems as good a name as any, but I'm not wedded
> to a particular name.
C.f. mem_noofs_operand inthe ARM port, and its uses in sync.md.
> The atomic_exchange and atomic_fetch_add expanders should use
> the code I quoted in the earlier message to force the original
> memory_operand into this more restrictive form:
>
> if (!mem_reg_operand (operands[1], <MODE>mode))
> {
> addr = force_reg (Pmode, XEXP (operands[1], 0));
> operands[1] = replace_equiv_address (operands[1], addr);
> }
Not required if you use the proper predicate in the expander.
The middle-end will take care of this for you.
r~