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.
References constraint_data::c_name, const_dbl_constraints, const_int_constraints, constraint_max_namelen, error_with_line(), exp(), constraint_data::exp, generic_constraint_letters, have_address_constraints, have_const_dbl_constraints, have_const_int_constraints, have_extra_constraints, have_memory_constraints, have_register_constraints, constraint_data::is_address, constraint_data::is_const_dbl, constraint_data::is_const_int, constraint_data::is_extra, constraint_data::is_memory, constraint_data::is_register, constraint_data::lineno, mangle(), message_with_line(), constraint_data::name, constraint_data::namelen, constraint_data::next_textual, constraint_data::next_this_letter, constraint_data::regclass, regclass(), rtl_obstack, strlen(), and validate_exp().
Referenced by process_define_constraint(), and process_define_register_constraint().
|
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.
References pred_data::exp, generate_switch_p(), mark_mode_tests(), and pred_data::special.
Referenced by write_one_predicate_function().
|
static |
Determine whether the expression EXP is a MATCH_CODE that should be written as a switch statement.
Referenced by add_mode_tests(), and write_predicate_stmts().
int main | ( | ) |
Master control.
References fatal(), gen_constrs, gen_header, have_error, init_rtx_reader_args_cb(), next_insn_code, parse_option(), pattern_lineno, process_define_constraint(), process_define_predicate(), process_define_register_constraint(), progname, read_md_rtx(), write_insn_preds_c(), write_tm_constrs_h(), and write_tm_preds_h().
|
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.
References constraint_data::name, and rtl_obstack.
Referenced by add_constraint().
|
static |
References error(), lookup_predicate(), pred_data::special, and strstr().
Referenced by add_mode_tests().
|
static |
Given a predicate expression EXP, from form NAME, determine whether it refers to the variable given as VAR.
References strlen(), and strstr().
Referenced by write_tm_constrs_h().
|
static |
References gen_constrs, and gen_header.
Referenced by main().
|
static |
Process a DEFINE_CONSTRAINT, DEFINE_MEMORY_CONSTRAINT, or DEFINE_ADDRESS_CONSTRAINT expression, C.
References add_constraint().
Referenced by main().
|
static |
Predicates are defined with (define_predicate) or (define_special_predicate) expressions in the machine description.
References validate_exp().
Referenced by main().
|
static |
Process a DEFINE_REGISTER_CONSTRAINT expression, C.
References add_constraint().
Referenced by main().
|
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.
References error_with_line(), and message_with_line().
Referenced by add_constraint(), and process_define_predicate().
|
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_register.
Referenced by write_insn_preds_c().
|
static |
Write out an enumeration with one entry per machine-specific constraint.
References constraint_data::c_name.
Referenced by write_tm_preds_h().
|
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.
Referenced by write_match_code(), and write_match_code_switch().
|
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.
References constraint_data::c_name, constraint_data::exp, constraint_data::is_const_int, and write_predicate_expr().
Referenced by write_insn_preds_c().
|
static |
Write out a function which looks at a string and determines what the constraint name length is.
References error(), len, constraint_data::namelen, and constraint_data::next_this_letter.
Referenced by write_tm_preds_h().
|
static |
Write out the function which computes whether a given constraint is an address constraint.
References constraint_data::c_name, and constraint_data::is_address.
Referenced by write_insn_preds_c().
|
static |
Write out the function which computes whether a given constraint is a memory constraint.
References constraint_data::c_name, and constraint_data::is_memory.
Referenced by write_insn_preds_c().
|
static |
Write insn-preds.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.)
References constraint_max_namelen, have_address_constraints, have_const_int_constraints, have_memory_constraints, have_register_constraints, in_fname, progname, write_constraint_satisfied_p(), write_insn_const_int_ok_for_constraint(), write_insn_extra_address_constraint(), write_insn_extra_memory_constraint(), write_lookup_constraint(), write_one_predicate_function(), and write_regclass_for_constraint().
Referenced by main().
|
static |
Write out a function which looks at a string and determines what constraint name, if any, it begins with.
References constraint_data::c_name, constraint_data::name, constraint_data::namelen, and constraint_data::next_this_letter.
Referenced by write_insn_preds_c().
|
static |
CODES is a list of RTX codes. Write out an expression which determines whether the operand has one of those codes.
References scan_comma_elt(), and write_extract_subexp().
Referenced by write_predicate_expr().
|
static |
Write the MATCH_CODE expression EXP as a switch statement.
References pred_data::codes, path, scan_comma_elt(), and write_extract_subexp().
Referenced by write_predicate_stmts().
|
static |
Given a predicate, write out a complete C function to compute it.
References add_mode_tests(), pred_data::exp, pred_data::name, write_predicate_stmts(), and write_predicate_subfunction().
Referenced by write_insn_preds_c().
|
static |
EXP is an RTL (sub)expression for a predicate. Recursively descend the expression and write out an equivalent C expression.
References mode_name, print_c_condition(), and write_match_code().
Referenced by write_insn_const_int_ok_for_constraint(), and write_predicate_stmts().
|
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.
References generate_switch_p(), write_match_code_switch(), and write_predicate_expr().
Referenced by write_one_predicate_function(), and write_tm_constrs_h().
|
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.
References pred_data::c_block, pred_data::exp, pred_data::name, print_md_ptr_loc(), rtl_obstack, and strlen().
Referenced by write_one_predicate_function().
|
static |
Write out the function which computes the register class corresponding to a register constraint.
References constraint_data::c_name, constraint_data::is_register, and constraint_data::regclass.
Referenced by write_insn_preds_c().
|
static |
Write out the functions which compute whether a given value matches a given non-register constraint.
References constraint_data::c_name, constraint_data::exp, in_fname, constraint_data::is_register, needs_variable(), progname, and write_predicate_stmts().
Referenced by main().
|
static |
Write tm-preds.h. Unfortunately, it is impossible to forward-declare an enumeration in portable C, so we have to condition all these prototypes on HAVE_MACHINE_MODES.
References constraint_max_namelen, have_address_constraints, have_const_dbl_constraints, have_const_int_constraints, have_extra_constraints, have_memory_constraints, have_register_constraints, in_fname, pred_data::name, progname, write_enum_constraint_num(), and write_insn_constraint_len().
Referenced by main().
|
static |
Machine-independent code expects that constraints with these (initial) letters will allow only (a subset of all) CONST_DOUBLEs.
Referenced by add_constraint().
|
static |
Machine-independent code expects that constraints with these (initial) letters will allow only (a subset of all) CONST_INTs.
Referenced by add_constraint().
|
static |
Summary data used to decide whether to output various functions and macro definitions.
Referenced by add_constraint(), write_insn_preds_c(), and write_tm_preds_h().
|
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 |
Referenced by main(), and parse_option().
|
static |
Argument parsing.
Referenced by main(), and parse_option().
|
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.
Referenced by add_constraint().
|
static |
Referenced by add_constraint(), write_insn_preds_c(), and write_tm_preds_h().
|
static |
Referenced by add_constraint(), and write_tm_preds_h().
|
static |
Referenced by add_constraint(), write_insn_preds_c(), and write_tm_preds_h().
|
static |
Referenced by add_constraint(), and write_tm_preds_h().
|
static |
Referenced by add_constraint(), write_insn_preds_c(), and write_tm_preds_h().
|
static |
Referenced by add_constraint(), write_insn_preds_c(), and write_tm_preds_h().
|
static |