http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496
--- Comment #19 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-04-09
08:04:40 UTC ---
> However, recog.c contains in various places checks that will *accept* -during
> reload- a pseudo in places where a memory constraint is required; exactly
> because such pseudos will actually get replaced by a MEM:
>
> case TARGET_MEM_CONSTRAINT:
> [snip]
> /* During reload, accept a pseudo */
> else if (reload_in_progress && REG_P (op)
> && REGNO (op) >= FIRST_PSEUDO_REGISTER)
> win = 1;
>
> Note that those checks were originally added in the same patch that added this
> asm validity check ...
OK, this makes sense.
> So really that validity check shouldn't have failed just because of the
> presence of a spilled pseudo. The question is, why doesn't this work for the
> ia64 test case as expected?
Because the reload insns are of the form:
(insn 119 66 120 4 (set (reg:DI 136 f8)
(reg:DI 406 [ MEM[(const mp_limb_t *)mip_6(D) + 8B] ])) pr52657.c:27 5
{movdi_internal}
and the matching alternative would be (f, Q) with
;; Note that while this accepts mem, it only accepts non-volatile mem,
;; and so cannot be "fixed" by adjusting the address. Thus it cannot
;; and does not use define_memory_constraint.
(define_constraint "Q"
"Non-volatile memory for FP_REG loads/stores"
(and (match_operand 0 "memory_operand")
(match_test "!MEM_VOLATILE_P (op)")))
bool
insn_extra_memory_constraint (enum constraint_num c)
{
switch (c)
{
case CONSTRAINT_S:
return true;
default: break;
}
return false;
}