GCC Middle and Back End API Reference
|
#include "bconfig.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "errors.h"
#include "read-md.h"
#include "gensupport.h"
Data Structures | |
struct | operand_data |
struct | data |
Macros | |
#define | MAX_MAX_OPERANDS 40 |
#define | INSN_OUTPUT_FORMAT_NONE 0 /* abort */ |
#define | INSN_OUTPUT_FORMAT_SINGLE 1 /* const char * */ |
#define | INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */ |
#define | INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */ |
#define | DEFAULT_CONSTRAINT_LEN(C, STR) 1 |
#define | DEFAULT_CONSTRAINT_LEN(C, STR) ((C) != *p || STR != p ? -1 : genoutput_default_constraint_len) |
#define | DEFAULT_CONSTRAINT_LEN(C, STR) 1 |
Functions | |
static int | n_occurrences (int, const char *) |
static const char * | strip_whitespace (const char *) |
static void | output_prologue (void) |
static void | output_operand_data (void) |
static void | output_insn_data (void) |
static void | output_get_insn_name (void) |
static void | scan_operands (struct data *, rtx, int, int) |
static int | compare_operands (struct operand_data *, struct operand_data *) |
static void | place_operands (struct data *) |
static void | process_template (struct data *, const char *) |
static void | validate_insn_alternatives (struct data *) |
static void | validate_insn_operands (struct data *) |
static void | gen_insn (rtx, int) |
static void | gen_peephole (rtx, int) |
static void | gen_expand (rtx, int) |
static void | gen_split (rtx, int) |
static void | check_constraint_len (void) |
static int | constraint_len (const char *, int) |
static int | compare_operands () |
static void | place_operands () |
static void | process_template () |
static void | validate_insn_alternatives () |
static void | validate_insn_operands () |
static void | validate_optab_operands () |
static void | gen_insn () |
static void | gen_peephole () |
static void | gen_expand () |
static void | gen_split () |
static void | init_insn_for_nothing () |
int | main (int, char **) |
int | main () |
static int | n_occurrences () |
static const char * | strip_whitespace () |
static int | constraint_len () |
Variables | |
static int | next_code_number |
static int | next_index_number |
static int | next_operand_number = 1 |
static struct operand_data | null_operand |
static struct operand_data * | odata = &null_operand |
static struct operand_data ** | odata_end = &null_operand.next |
static struct data | nothing |
static struct data * | idata = ¬hing |
static struct data ** | idata_end = ¬hing.next |
#define DEFAULT_CONSTRAINT_LEN | ( | C, | |
STR | |||
) | 1 |
#define DEFAULT_CONSTRAINT_LEN | ( | C, | |
STR | |||
) | ((C) != *p || STR != p ? -1 : genoutput_default_constraint_len) |
#define DEFAULT_CONSTRAINT_LEN | ( | C, | |
STR | |||
) | 1 |
#define INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */ |
Referenced by process_template().
#define INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */ |
Referenced by process_template().
#define INSN_OUTPUT_FORMAT_SINGLE 1 /* const char * */ |
#define MAX_MAX_OPERANDS 40 |
Generate code from to output assembler insns as recognized from rtl. Copyright (C) 1987-2013 Free Software Foundation, Inc.
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/. This program reads the machine description for the compiler target machine and produces a file containing these things:
An array of `struct insn_data_d', which is indexed by insn code number, which contains:
a. `name' is the name for that pattern. Nameless patterns are given a name.
b. `output' hold either the output template, an array of output templates, or an output function.
c. `genfun' is the function to generate a body for that pattern, given operands as arguments.
d. `n_operands' is the number of distinct operands in the pattern for that insn,
e. `n_dups' is the number of match_dup's that appear in the insn's pattern. This says how many elements of `recog_data.dup_loc' are significant after an insn has been recognized.
f. `n_alternatives' is the number of alternatives in the constraints of each pattern.
g. `output_format' tells what type of thing `output' is.
h. `operand' is the base of an array of operand data for the insn.
An array of `struct insn_operand data', used by `operand' above.
a. `predicate', an int-valued function, is the match_operand predicate for this operand.
b. `constraint' is the constraint for this operand.
c. `address_p' indicates that the operand appears within ADDRESS rtx's.
d. `mode' is the machine mode that that operand is supposed to have.
e. `strict_low', is nonzero for operands contained in a STRICT_LOW_PART.
f. `eliminable', is nonzero for operands that are matched normally by MATCH_OPERAND; it is zero for operands that should not be changed during register elimination such as MATCH_OPERATORs.
g. `allows_mem', is true for operands that accept MEM rtxes.
The code number of an insn is simply its position in the machine description; code numbers are assigned sequentially to entries in the description, starting with code number 0.
Thus, the following entry in the machine description
(define_insn "clrdf" [(set (match_operand:DF 0 "general_operand" "") (const_int 0))] "" "clrd %0")
assuming it is the 25th entry present, would cause insn_data[24].template to be "clrd %0", and insn_data[24].n_operands to be 1. No instruction can have more operands than this. Sorry for this arbitrary limit, but what machine will have an instruction with this many operands?
Referenced by output_get_insn_name().
|
static |
Verify that DEFAULT_CONSTRAINT_LEN is used properly and not tampered with. This isn't bullet-proof, but it should catch most genuine mistakes.
|
static |
Referenced by place_operands().
|
static |
Compare two operands for content equality.
|
static |
|
static |
Check that we still match defaults.h . First we do a generation-time check that fails if the value is not the expected one...
And now a compile-time check that should give a diagnostic if the definition doesn't exactly match.
Now re-define DEFAULT_CONSTRAINT_LEN so that we can verify it is being used.
And set it back.
|
static |
|
static |
Process a define_expand just read. Assign its code number, only for the purposes of `insn_gen_function'.
Build up the list in the same order as the insns are seen in the machine description.
Scan the operands to get the specified predicates and modes, since expand_binop needs to know them.
|
static |
|
static |
Look at a define_insn just read. Assign its code number. Record on idata the template and the number of arguments. If the insn has a hairy output action, output a function for now.
Build up the list in the same order as the insns are seen in the machine description.
|
static |
|
static |
Look at a define_peephole just read. Assign its code number. Record on idata the template and the number of arguments. If the insn has a hairy output action, output it now.
Build up the list in the same order as the insns are seen in the machine description.
Get the number of operands by scanning all the patterns of the peephole optimizer. But ignore all the rest of the information thus obtained.
|
static |
|
static |
Process a define_split just read. Assign its code number, only for reasons of consistency and to simplify genrecog.
Build up the list in the same order as the insns are seen in the machine description.
Get the number of operands by scanning all the patterns of the split patterns. But ignore all the rest of the information thus obtained.
References data::filename, data::name, and nothing.
|
static |
int main | ( | int | , |
char ** | |||
) |
int main | ( | ) |
Read the machine description.
|
static |
|
static |
Return the number of occurrences of character C in string S or -1 if S is the null string.
References error_with_line(), data::name, and XSTR.
|
static |
References GET_CODE, MAX_MAX_OPERANDS, and XINT.
|
static |
Preserve two consecutive
's or 's, but treat
as a single newline.
|
static |
|
static |
|
static |
|
static |
Scan the list of operands we've already committed to output and either find a subsequence that is the same, or allocate a new one at the end.
Brute force substring search.
Either partial match at the end of the list, or no match. In either case, we tack on what operands are remaining to the end of the list.
References compare_operands(), data::n_operands, operand_data::next, NULL, and data::operand.
|
static |
|
static |
Process an assembler template from a define_insn or a define_peephole. It is either the assembler code template, a list of assembler code templates, or C code to generate the assembler code template.
Templates starting with * contain straight code to be run.
If the assembler code template starts with a @ it is a newline-separated list of assembler code templates, one for each alternative.
The usual action will end with a return. If there is neither break or return at the end, this is assumed to be intentional; this allows to have multiple consecutive alternatives share some code.
References data::code_number, error_with_line(), INSN_OUTPUT_FORMAT_FUNCTION, INSN_OUTPUT_FORMAT_MULTI, data::lineno, message_with_line(), data::n_alternatives, data::output_format, and data::template_code.
|
static |
Stores the operand data into `d->operand[i]'.
THIS_ADDRESS_P is nonzero if the containing rtx was an ADDRESS. THIS_STRICT_LOW is nonzero if the containing rtx was a STRICT_LOW_PART.
|
static |
|
static |
Remove whitespace in `s' by moving up characters until the end. Return a new string.
|
static |
|
static |
Check insn D for consistency in number of constraint alternatives.
Make sure all the operands have the same number of alternatives in their constraints. Let N be that number.
Record the insn's overall number of alternatives.
|
static |
|
static |
Verify that there are no gaps in operand numbers for INSNs.
References data::code_number, data::index_number, next_code_number, and next_index_number.
|
static |
Miscellaneous tests.
|
static |
This variable points to the end of the insn chain. This is where everything relevant from the machien description is appended to.
|
static |
insns in the machine description are assigned sequential code numbers that are used by insn-recog.c (produced by genrecog) to communicate to insn-output.c (produced by this program).
Referenced by validate_insn_operands().
|
static |
This counts all definitions in the md file, for the sake of error messages.
Referenced by validate_insn_operands().
|
static |
This counts all operands used in the md file. The first is null.
|
static |
A dummy insn, for CODE_FOR_nothing.
Referenced by gen_split().
|
static |
Begin with a null operand at index 0.
|
static |
|
static |