This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with define_insn and constraints





Robert Baruch wrote:

>However, by the time gcc gets to reload_cse_simplify_operands, at
>postreload.c:391, it is trying to match this insn, and fails, saying
>"insn does not satisfy its constraints":
>
>(insn 739 794 795 8 ../../Desktop/gcc-3.4.3/gcc/libgcc2.c:467 (set
>(mem/f:QI (plus:QI (mem:QI (plus:QI (reg/f:QI 49 R20/FP)
>                        (const_int 104 [0x68])) [6 S1 A8])
>                (const_int 1 [0x1])) [2 <result>+1 S1 A8])
>        (reg:QI 4 R53)) 0 {movqi} (nil)
>    (nil))

The address is of the form (stack slot) + constant, where the
stack slot is presumably the slot assigned to a pseudo register
that wasn't assigned a hard register.  Such stack slots are still
represented by REG RTXes during the reload phase, so from the
point of view of GO_IF_LEGITIMATE_ADDRESS the address would have
the form
   (plus (reg pseudo) (const_int 1))
which it should have rejected, but doesn't due to a bug in your
implementation.

Note how you carefully check registers here:

      if (GET_CODE (x) == REG && (strict ? REG_OK_FOR_BASE_STRICT_P (x)
                    : REG_OK_FOR_BASE_NONSTRICT_P (x)))
            r = ALL_REGS;

but not at all here:

  else if (GET_CODE (x) == PLUS
           && REG_P (XEXP (x, 0))
         && GET_CODE (XEXP (x, 1)) == CONST_INT
         && INTVAL (XEXP (x, 1)) >= 0)
      r = ALL_REGS;

The simple REG_P check accepts all registers, including pseudos,
but if the STRICT argument is true, the routine must not accept
pseudos or else your problem will occur ...

(As an aside I do not understand what you are doing with register
classes here; the function is supposed to simply return a boolean.)

B.t.w. is it correct that memory addresses are of mode QImode on
your platform?  That strikes me as somewhat weird ...


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]