Next: Defining Predicates, Up: Predicates
These are the generic predicates available to all back ends. They are defined in recog.c. The first category of predicates allow only constant, or immediate, operands.
This predicate allows any sort of constant that fits in mode. It is an appropriate choice for instructions that take operands that must be constant.
This predicate allows any
CONST_INT
expression that fits in mode. It is an appropriate choice for an immediate operand that does not allow a symbol or label.
This predicate accepts any
CONST_DOUBLE
expression that has exactly mode. If mode isVOIDmode
, it will also acceptCONST_INT
. It is intended for immediate floating point constants.
The second category of predicates allow only some kind of machine register.
This predicate allows any
REG
orSUBREG
expression that is valid for mode. It is often suitable for arithmetic instruction operands on a RISC machine.
This is a slight variant on
register_operand
which works around a limitation in the machine-description reader.(match_operand n "pmode_register_operand" constraint)means exactly what
(match_operand:P n "register_operand" constraint)would mean, if the machine-description reader accepted ‘:P’ mode suffixes. Unfortunately, it cannot, because
Pmode
is an alias for some other mode, and might vary with machine-specific options. See Misc.
This predicate allows hard registers and
SCRATCH
expressions, but not pseudo-registers. It is used internally bymatch_scratch
; it should not be used directly.
The third category of predicates allow only some kind of memory reference.
This predicate allows any valid reference to a quantity of mode mode in memory, as determined by the weak form of
GO_IF_LEGITIMATE_ADDRESS
(see Addressing Modes).
This predicate is a little unusual; it allows any operand that is a valid expression for the address of a quantity of mode mode, again determined by the weak form of
GO_IF_LEGITIMATE_ADDRESS
. To first order, if ‘(mem:mode (exp))’ is acceptable tomemory_operand
, then exp is acceptable toaddress_operand
. Note that exp does not necessarily have the mode mode.
This is a stricter form of
memory_operand
which allows only memory references with ageneral_operand
as the address expression. New uses of this predicate are discouraged, becausegeneral_operand
is very permissive, so it's hard to tell what anindirect_operand
does or does not allow. If a target has different requirements for memory operands for different instructions, it is better to define target-specific predicates which enforce the hardware's requirements explicitly.
This predicate allows a memory reference suitable for pushing a value onto the stack. This will be a
MEM
which refers tostack_pointer_rtx
, with a side-effect in its address expression (see Incdec); which one is determined by theSTACK_PUSH_CODE
macro (see Frame Layout).
This predicate allows a memory reference suitable for popping a value off the stack. Again, this will be a
MEM
referring tostack_pointer_rtx
, with a side-effect in its address expression. However, this timeSTACK_POP_CODE
is expected.
The fourth category of predicates allow some combination of the above operands.
This predicate allows any immediate or register operand valid for mode.
This predicate allows any register or memory operand valid for mode.
This predicate allows any immediate, register, or memory operand valid for mode.
Finally, there are two generic operator predicates.