]> gcc.gnu.org Git - gcc.git/blame - gcc/recog.h
Makefile.in, [...]: replace "GNU CC" with "GCC".
[gcc.git] / gcc / recog.h
CommitLineData
64a93ac5 1/* Declarations for interface to insn recognizer and insn-output.c.
751aa7cc
RK
2 Copyright (C) 1987, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
64a93ac5 4
1322177d 5This file is part of GCC.
64a93ac5 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
64a93ac5 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
64a93ac5
CH
16
17You should have received a copy of the GNU General Public License
1322177d
LB
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
64a93ac5 21
f62a15e3
BS
22/* Random number that should be large enough for all purposes. */
23#define MAX_RECOG_ALTERNATIVES 30
6c698a6d
JH
24#define recog_memoized(I) (INSN_CODE (I) >= 0 \
25 ? INSN_CODE (I) : recog_memoized_1 (I))
f62a15e3 26
0eadeb15
BS
27/* Types of operands. */
28enum op_type {
29 OP_IN,
30 OP_OUT,
31 OP_INOUT
32};
33
f62a15e3
BS
34struct operand_alternative
35{
36 /* Pointer to the beginning of the constraint string for this alternative,
37 for easier access by alternative number. */
9b3142b3 38 const char *constraint;
f62a15e3
BS
39
40 /* The register class valid for this alternative (possibly NO_REGS). */
41 enum reg_class class;
42
43 /* "Badness" of this alternative, computed from number of '?' and '!'
44 characters in the constraint string. */
45 unsigned int reject;
46
47 /* -1 if no matching constraint was found, or an operand number. */
48 int matches;
49 /* The same information, but reversed: -1 if this operand is not
50 matched by any other, or the operand number of the operand that
51 matches this one. */
52 int matched;
53
54 /* Nonzero if '&' was found in the constraint string. */
55 unsigned int earlyclobber:1;
56 /* Nonzero if 'm' was found in the constraint string. */
57 unsigned int memory_ok:1;
58 /* Nonzero if 'o' was found in the constraint string. */
59 unsigned int offmem_ok:1;
60 /* Nonzero if 'V' was found in the constraint string. */
61 unsigned int nonoffmem_ok:1;
62 /* Nonzero if '<' was found in the constraint string. */
63 unsigned int decmem_ok:1;
64 /* Nonzero if '>' was found in the constraint string. */
65 unsigned int incmem_ok:1;
541f7d56
BS
66 /* Nonzero if 'p' was found in the constraint string. */
67 unsigned int is_address:1;
f62a15e3
BS
68 /* Nonzero if 'X' was found in the constraint string, or if the constraint
69 string for this alternative was empty. */
70 unsigned int anything_ok:1;
71};
72
73
13536812
KG
74extern void init_recog PARAMS ((void));
75extern void init_recog_no_volatile PARAMS ((void));
6c698a6d 76extern int recog_memoized_1 PARAMS ((rtx));
13536812
KG
77extern int check_asm_operands PARAMS ((rtx));
78extern int asm_operand_ok PARAMS ((rtx, const char *));
79extern int validate_change PARAMS ((rtx, rtx *, rtx, int));
fb0c0a12 80extern int insn_invalid_p PARAMS ((rtx));
13536812
KG
81extern int apply_change_group PARAMS ((void));
82extern int num_validated_changes PARAMS ((void));
83extern void cancel_changes PARAMS ((int));
84extern int constrain_operands PARAMS ((int));
6c698a6d 85extern int constrain_operands_cached PARAMS ((int));
13536812
KG
86extern int memory_address_p PARAMS ((enum machine_mode, rtx));
87extern int strict_memory_address_p PARAMS ((enum machine_mode, rtx));
e251e2a2 88extern int validate_replace_rtx_subexp PARAMS ((rtx, rtx, rtx, rtx *));
13536812
KG
89extern int validate_replace_rtx PARAMS ((rtx, rtx, rtx));
90extern void validate_replace_rtx_group PARAMS ((rtx, rtx, rtx));
91extern int validate_replace_src PARAMS ((rtx, rtx, rtx));
523bb0ba 92#ifdef HAVE_cc0
13536812 93extern int next_insn_tests_no_inequality PARAMS ((rtx));
523bb0ba 94#endif
13536812 95extern int reg_fits_class_p PARAMS ((rtx, enum reg_class, int,
31031edd 96 enum machine_mode));
13536812
KG
97extern rtx *find_single_use PARAMS ((rtx, rtx, rtx *));
98
99extern int general_operand PARAMS ((rtx, enum machine_mode));
100extern int address_operand PARAMS ((rtx, enum machine_mode));
101extern int register_operand PARAMS ((rtx, enum machine_mode));
102extern int pmode_register_operand PARAMS ((rtx, enum machine_mode));
103extern int scratch_operand PARAMS ((rtx, enum machine_mode));
104extern int immediate_operand PARAMS ((rtx, enum machine_mode));
105extern int const_int_operand PARAMS ((rtx, enum machine_mode));
106extern int const_double_operand PARAMS ((rtx, enum machine_mode));
107extern int nonimmediate_operand PARAMS ((rtx, enum machine_mode));
108extern int nonmemory_operand PARAMS ((rtx, enum machine_mode));
109extern int push_operand PARAMS ((rtx, enum machine_mode));
110extern int pop_operand PARAMS ((rtx, enum machine_mode));
111extern int memory_operand PARAMS ((rtx, enum machine_mode));
112extern int indirect_operand PARAMS ((rtx, enum machine_mode));
113extern int mode_independent_operand PARAMS ((rtx, enum machine_mode));
114extern int comparison_operator PARAMS ((rtx, enum machine_mode));
115
116extern int offsettable_memref_p PARAMS ((rtx));
117extern int offsettable_nonstrict_memref_p PARAMS ((rtx));
118extern int offsettable_address_p PARAMS ((int, enum machine_mode, rtx));
119extern int mode_dependent_address_p PARAMS ((rtx));
120
121extern int recog PARAMS ((rtx, rtx, int *));
122extern void add_clobbers PARAMS ((rtx, int));
751aa7cc 123extern int added_clobbers_hard_reg_p PARAMS ((int));
13536812
KG
124extern void insn_extract PARAMS ((rtx));
125extern void extract_insn PARAMS ((rtx));
d90ffc8d
JH
126extern void extract_constrain_insn_cached PARAMS ((rtx));
127extern void extract_insn_cached PARAMS ((rtx));
13536812 128extern void preprocess_constraints PARAMS ((void));
23280139
RH
129extern rtx peep2_next_insn PARAMS ((int));
130extern int peep2_regno_dead_p PARAMS ((int, int));
131extern int peep2_reg_dead_p PARAMS ((int, rtx));
132#ifdef CLEAR_HARD_REG_SET
133extern rtx peep2_find_free_register PARAMS ((int, int, const char *,
134 enum machine_mode,
135 HARD_REG_SET *));
136#endif
13536812 137extern void peephole2_optimize PARAMS ((FILE *));
23280139 138extern rtx peephole2_insns PARAMS ((rtx, rtx, int *));
64a93ac5
CH
139
140/* Nonzero means volatile operands are recognized. */
64a93ac5
CH
141extern int volatile_ok;
142
0a578fee
BS
143/* Set by constrain_operands to the number of the alternative that
144 matched. */
145extern int which_alternative;
146
64a93ac5
CH
147/* The following vectors hold the results from insn_extract. */
148
1ccbefce
RH
149struct recog_data
150{
151 /* It is very tempting to make the 5 operand related arrays into a
152 structure and index on that. However, to be source compatible
153 with all of the existing md file insn constraints and output
154 templates, we need `operand' as a flat array. Without that
155 member, making an array for the rest seems pointless. */
64a93ac5 156
1ccbefce
RH
157 /* Gives value of operand N. */
158 rtx operand[MAX_RECOG_OPERANDS];
64a93ac5 159
1ccbefce
RH
160 /* Gives location where operand N was found. */
161 rtx *operand_loc[MAX_RECOG_OPERANDS];
64a93ac5 162
1ccbefce
RH
163 /* Gives the constraint string for operand N. */
164 const char *constraints[MAX_RECOG_OPERANDS];
64a93ac5 165
1ccbefce
RH
166 /* Gives the mode of operand N. */
167 enum machine_mode operand_mode[MAX_RECOG_OPERANDS];
0a578fee 168
1ccbefce
RH
169 /* Gives the type (in, out, inout) for operand N. */
170 enum op_type operand_type[MAX_RECOG_OPERANDS];
0a578fee 171
1ccbefce
RH
172 /* Gives location where the Nth duplicate-appearance of an operand
173 was found. This is something that matched MATCH_DUP. */
174 rtx *dup_loc[MAX_DUP_OPERANDS];
0a578fee 175
1ccbefce
RH
176 /* Gives the operand number that was duplicated in the Nth
177 duplicate-appearance of an operand. */
88e6fdcb 178 char dup_num[MAX_DUP_OPERANDS];
0a578fee 179
88e6fdcb
RH
180 /* ??? Note that these are `char' instead of `unsigned char' to (try to)
181 avoid certain lossage from K&R C, wherein `unsigned char' default
182 promotes to `unsigned int' instead of `int' as in ISO C. As of 1999,
183 the most common places to bootstrap from K&R C are SunOS and HPUX,
184 both of which have signed characters by default. The only other
185 supported natives that have both K&R C and unsigned characters are
186 ROMP and Irix 3, and neither have been seen for a while, but do
187 continue to consider unsignedness when performing arithmetic inside
188 a comparison. */
189
1ccbefce 190 /* The number of operands of the insn. */
88e6fdcb 191 char n_operands;
0a578fee 192
1ccbefce 193 /* The number of MATCH_DUPs in the insn. */
88e6fdcb 194 char n_dups;
0eadeb15 195
1ccbefce 196 /* The number of alternatives in the constraints for the insn. */
88e6fdcb 197 char n_alternatives;
d90ffc8d
JH
198
199 /* In case we are caching, hold insn data was generated for. */
200 rtx insn;
1ccbefce
RH
201};
202
203extern struct recog_data recog_data;
0a578fee 204
f62a15e3
BS
205/* Contains a vector of operand_alternative structures for every operand.
206 Set up by preprocess_constraints. */
b0983bb9 207extern struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES];
f62a15e3 208
a995e389 209/* A table defined in insn-output.c that give information about
64a93ac5
CH
210 each insn-code value. */
211
13536812
KG
212typedef int (*insn_operand_predicate_fn) PARAMS ((rtx, enum machine_mode));
213typedef const char * (*insn_output_fn) PARAMS ((rtx *, rtx));
13536812 214typedef rtx (*insn_gen_fn) PARAMS ((rtx, ...));
64a93ac5 215
a995e389
RH
216struct insn_operand_data
217{
218 insn_operand_predicate_fn predicate;
64a93ac5 219
a995e389 220 const char *constraint;
64a93ac5 221
a2b498cb 222 ENUM_BITFIELD(machine_mode) mode : 16;
a995e389 223
a995e389 224 char strict_low;
dfac187e
BS
225
226 char eliminable;
a995e389 227};
64a93ac5 228
4bbf910e
RH
229/* Legal values for insn_data.output_format. Indicate what type of data
230 is stored in insn_data.output. */
231#define INSN_OUTPUT_FORMAT_NONE 0 /* abort */
232#define INSN_OUTPUT_FORMAT_SINGLE 1 /* const char * */
233#define INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */
234#define INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */
235
a995e389
RH
236struct insn_data
237{
238 const char *name;
4bbf910e 239 const PTR output;
a995e389
RH
240 insn_gen_fn genfun;
241 const struct insn_operand_data *operand;
64a93ac5 242
88e6fdcb
RH
243 char n_operands;
244 char n_dups;
245 char n_alternatives;
246 char output_format;
a995e389 247};
64a93ac5 248
a995e389 249extern const struct insn_data insn_data[];
This page took 1.299395 seconds and 5 git commands to generate.