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


On Fri, 24 Dec 2004 01:24:42 +0100, Ulrich Weigand
<Ulrich.Weigand@de.ibm.com> wrote:

> 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 ...

Yes, that makes sense. I am a little fuzzy about what exactly strict
and nonstrict mean. I've read the description of
GO_IF_LEGITIMATE_ADDRESS several times, but I'm no closer to wisdom :)
 Anyway, I made that change, and I now have assembly output! Thank you
so much.

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

My fault for copying from the avr port :) I'm going to change it to
return 0 or 1.

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

Well, I hesitate to admit it, but it's a microcontroller, with no
external memory, and very little on-chip RAM. I was afraid that
someone would say, "What are you, nuts? GCC is for real processors,
not little microcontrollers!"

Thanks for all your help!

--Rob


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