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: About EXTRA_ADDRESS_CONSTRAINT


Alexandre Courbot wrote:

>It works flawlessly. I thought it wasn't necessary to put the 'r' as my 'Q'
>constraint obviously includes registers. I'm a bit confused by this. Reading
>the Machine Descriptions chapter again didn't help understanding why 'r' is
>needed here. Maybe it is marked in some way so the compiler knows how to
>reload to it, while my Q constraint obviously isn't marked?

Yes.  The point of reload is not *only* to make sure the operands match
the constraints as-is (maybe selecting an alternative), but also to make
changes to the operands to *make* them match the constraints if necessary.

For the second part, reload needs to understand exactly what the constraint
letter means; this understanding is hard-coded into reload.  Thus, for
example, it knows that if an operand does not fit the 'r' constraint, it
can be made fit by choosing a register from class GENERAL_REGS and reloading
the operand into that register.  Similar for the other standard constraint
letters.

However, for platform-specific EXTRA_CONSTRAINTs, reload does not know
how to make them fit if they don't match right away.   Thus is can make
sense to offer a standard constraint in addition to the extra one, so that
reload can use the standard constraint to make the operand fit if it
matches neither the standard nor the extra one.


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]