This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: RFD: constraint letter suffixes
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 23 Dec 2002 16:39:32 +0000
- Subject: Re: RFD: constraint letter suffixes
- Organization: SuperH UK Ltd.
- References: <3D809DAB.86E4B05E@superh.com>
Joern Rennecke wrote:
>
> Constraint letters are often in short supply, be it for register
> classes, integer constants or extra constraints.
> We can overcome these limitations by allowing suffixes to distinguish
> different variants. IMHO the most obvious suffix would be to append
> a single digit. This will work if matching constraints are generally
> named first in any list of constraints with equal visibility within an
> alternative. Of course, every time we make a new arbitrary limit, we
> run the risk of exceeding that limit in the future. So if we are
> putting a mechanism in place to handle constraint letter suffixes,
> we might as well allow multi-letter/digit suffixes.
>
> So I propose the following new target macros:
>
> CONSTRAINT_LETTER_SUFFIX_LEN(C)
> For constraint letter C, give the length of the suffix. defaults.h
> provides a default definition as 0 for all letters.
> This macro is used when iterating over a constraint list to correctly
> advance to the next constraint. Note that the default definition will
> provide backwards compatibility with ports that put matching constraint
> digits immediately after constraint letters.
>
> CONST_OK_FOR_LETTER_AND_SUFFIX_P(VALUE, C, STR)
> For constraint letter C and the suffix at the start of STR (STR is the
> rest of the constraints string after C), return 1 if VALUE is in the
> appropriate range, 0 otherwise. If CONST_OK_DOR_LETTER_P is defined,
> defaults.h provides a default definition based on the latter macro.
>
> Likewise for:
> REG_CLASS_FROM_LETTER_AND_SUFFIX(C, STR)
> EXTRA_CONSTRAINT_WITH_SUFFIX(VALUE, C, STR)
Hmm, maybe it is simpler to just give the length of the whole constraint,
and pass the whole constraint, too. I.e:
CONSTRAINT_LEN(C, STR)
For the constraint STR starting with character C, give the length.
When actually processing a matching constraint, the this length is
ignored. (So you don't have to figure out how long a number is in
this macro, but you should return a number between 1 and the actual
length of the number so that searching for specific non-matching
constraints will work).
defaults.h provides a default definition as 1.
This macro is used when iterating over a constraint list to correctly
advance to the next constraint. Note that the default definition will
provide backwards compatibility with ports that put matching constraint
digits immediately after constraint letters. (As well as for all other
ports, of course.)
It is invalid for a machine description to include a comma or NUL in a
constraint - this can be checked in genoutput.c
CONST_OK_FOR_CONSTRAINT (C, STR)
For constraint STR starting with C, return 1 if VALUE is in the
appropriate range, 0 otherwise. If CONST_OK_FOR_LETTER_P is defined,
defaults.h provides a default definition based on the latter macro.
Likewise for:
REG_CLASS_FROM_CONSTRAINT
EXTRA_CONSTRAINT_STR (it would be consistent to call it EXTRA_CONSTRAINT,
but that would be a backwards compatibility nigtmare)
--
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658