GCC Middle and Back End API Reference

Data Structures  
struct  constraint_data 
Variables  
static struct constraint_data *  constraints_by_letter_table [1<< CHAR_BIT] 
static struct constraint_data *  first_constraint 
static struct constraint_data **  last_constraint_ptr = &first_constraint 
static const char  generic_constraint_letters [] = "EFVXginoprs" 
static const char  const_int_constraints [] = "IJKLMNOP" 
static const char  const_dbl_constraints [] = "GH" 
static unsigned int  constraint_max_namelen 
static bool  have_register_constraints 
static bool  have_memory_constraints 
static bool  have_address_constraints 
static bool  have_extra_constraints 
static bool  have_const_int_constraints 
static bool  have_const_dbl_constraints 
static bool  gen_header 
static bool  gen_constrs 

static 
Add one constraint, of any sort, to the tables. NAME is its name; REGCLASS is the register class, if any; EXP is the expression to test, if any; IS_MEMORY and IS_ADDRESS indicate memory and address constraints, respectively; LINENO is the line number from the MD reader. Not all combinations of arguments are valid; most importantly, REGCLASS is mutually exclusive with EXP, and IS_MEMORY/IS_ADDRESS are only meaningful for constraints with EXP. This function enforces all syntactic and semantic rules about what constraints can be defined.
This causes slot to end up pointing to the next_this_letter field of the last constraint with a name of equal or greater length than the new constraint; hence the new constraint will be inserted after all previous constraints with names of the same length.
Consider relaxing this requirement in the future.
Insert this constraint in the list of all constraints in textual order.

static 
Given a predicate, work out where in its RTL expression to add tests for proper modes. Special predicates do not get any such tests. We try to avoid adding tests when we don't have to; in particular, other normal predicates can be counted on to do it for us.
Don't touch special predicates.
If the whole expression already tests the mode, we're done.
It is always correct to rewrite p>exp as (and (...) (match_test "mode == VOIDmode  GET_MODE (op) == mode")) but there are a couple forms where we can do better. If the toplevel pattern is an IOR, and one of the two branches does test the mode, we can wrap just the branch that doesn't. Likewise, if we have an IF_THEN_ELSE, and one side of it tests the mode, we can wrap just the side that doesn't. And, of course, we can repeat this descent as many times as it works.
The switch code generation in write_predicate_stmts prefers rtx code tests to be at the top of the expression tree. So push this AND down into the second operand of an existing AND expression.
Must put it on the dependent clause, not the controlling expression, or we change the meaning of the test.
References generate_switch_p().

static 
Determine whether the expression EXP is a MATCH_CODE that should be written as a switch statement.
Referenced by add_mode_tests().
int main  (  ) 
Master control.

static 
Convert NAME, which contains angle brackets and/or underscores, to a string that can be used as part of a C identifier. The string comes from the rtl_obstack.

static 
A ? B : C does a mode test if (one of A and B) does a mode test, and C does too.

static 
Given a predicate expression EXP, from form NAME, determine whether it refers to the variable given as VAR.
Ternary, binary, unary expressions need a variable if any of their subexpressions do.
else fall through
else fall through
MATCH_CODE uses "op", but nothing else.
MATCH_OPERAND uses "op" and may use "mode".
MATCH_TEST uses var if XSTR (exp, 0) =~ /\b${var}\b/o;
Referenced by write_insn_constraint_len().

static 

static 
Process a DEFINE_CONSTRAINT, DEFINE_MEMORY_CONSTRAINT, or DEFINE_ADDRESS_CONSTRAINT expression, C.

static 
Predicates are defined with (define_predicate) or (define_special_predicate) expressions in the machine description.
References pred_data::c_block, pred_data::name, rtl_obstack, and strlen().

static 
Process a DEFINE_REGISTER_CONSTRAINT expression, C.

static 
@verbatim
Generate from machine description:
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
Given a predicate expression EXP, from form NAME at line LINENO, verify that it does not contain any RTL constructs which are not valid in predicate definitions. Returns true if EXP is INvalid; issues error messages, caller need not.
Ternary, binary, unary expressions: recurse into subexpressions.
else fall through
else fall through
MATCH_CODE might have a syntax error in its path expression.
fall through
These need no special checking.
References message_with_line().

static 
Write out the wrapper function, constraint_satisfied_p, that maps a CONSTRAINT_xxx constant to one of the predicate functions generated above.
References constraint_data::c_name, and constraint_data::is_memory.

static 
Write out an enumeration with one entry per machinespecific constraint.
Referenced by write_insn_extra_memory_constraint().

static 
PATH is a string describing a path from the root of an RTL expression to an inner subexpression to be tested. Output code which computes the subexpression from the variable holding the root of the expression.
We first write out the operations (XEXP or XVECEXP) in reverse order, then write "op", then the indices in forward order.
References scan_comma_elt().

static 
Write out the function which computes whether a given value matches a given CONST_INT constraint. This doesn't just forward to constraint_satisfied_p because caller passes the INTVAL, not the RTX.
c>exp is guaranteed to be (and (match_code "const_int") (...)); we know at this point that we have a const_int, so we need not bother with that part of the test.

static 
Write out a function which looks at a string and determines what the constraint name length is.
Constraints with multiple characters should have the same length.
References constraint_data::c_name, constraint_data::exp, in_fname, constraint_data::is_register, needs_variable(), and progname.
Referenced by write_insn_extra_memory_constraint().

static 
Write out the function which computes whether a given constraint is an address constraint.

static 
Write out the function which computes whether a given constraint is a memory constraint.
References write_enum_constraint_num(), and write_insn_constraint_len().

static 
Write insnpreds.c. N.B. the list of headers to include was copied from genrecog; it may not be ideal. FUTURE: Write #line markers referring back to the machine description. (Can't practically do this now since we don't know the line number of the C block  just the line number of the enclosing expression.)

static 
Write out a function which looks at a string and determines what constraint name, if any, it begins with.
References error(), constraint_data::namelen, and constraint_data::next_this_letter.

static 
CODES is a list of RTX codes. Write out an expression which determines whether the operand has one of those codes.

static 
Write the MATCH_CODE expression EXP as a switch statement.

static 
Given a predicate, write out a complete C function to compute it.
A normal predicate can legitimately not look at enum machine_mode if it accepts only CONST_INTs and/or CONST_DOUBLEs.

static 
EXP is an RTL (sub)expression for a predicate. Recursively descend the expression and write out an equivalent C expression.

static 
Given a predicate expression EXP, write out a sequence of stmts to evaluate it. This is similar to write_predicate_expr but can generate efficient switch statements.

static 
Given a predicate, if it has an embedded C block, write the block out as a static inline subroutine, and augment the RTL test with a match_test that calls that subroutine. For instance, (define_predicate "basereg_operand" (match_operand 0 "register_operand") { if (GET_CODE (op) == SUBREG) op = SUBREG_REG (op); return REG_POINTER (op); }) becomes static inline int basereg_operand_1(rtx op, enum machine_mode mode) { if (GET_CODE (op) == SUBREG) op = SUBREG_REG (op); return REG_POINTER (op); } (define_predicate "basereg_operand" (and (match_operand 0 "register_operand") (match_test "basereg_operand_1 (op, mode)"))) The only wart is that there's no way to insist on a { } string in an RTL template, so we have to handle "" strings.
Construct the functioncall expression.
Add the functioncall expression to the complete expression to be evaluated.

static 
Write out the function which computes the register class corresponding to a register constraint.

static 
Write out the functions which compute whether a given value matches a given nonregister constraint.
References constraint_data::c_name, and constraint_data::is_register.

static 
Write tmpreds.h. Unfortunately, it is impossible to forwarddeclare an enumeration in portable C, so we have to condition all these prototypes on HAVE_MACHINE_MODES.

static 
Machineindependent code expects that constraints with these (initial) letters will allow only (a subset of all) CONST_DOUBLEs.

static 
Machineindependent code expects that constraints with these (initial) letters will allow only (a subset of all) CONST_INTs.

static 
Summary data used to decide whether to output various functions and macro definitions.

static 
Overview of all constraints beginning with a given letter.

static 
For looking up all the constraints in the order that they appeared in the machine description.

static 

static 
Argument parsing.

static 
These letters, and all names beginning with them, are reserved for generic constraints. The 'm' constraint is not mentioned here since that constraint letter can be overridden by the back end by defining the TARGET_MEM_CONSTRAINT macro.

static 

static 

static 

static 

static 

static 

static 