OSDN Git Service

* c-decl.c (struct language_function): Renamed from struct c_function.
[pf3gnuchains/gcc-fork.git] / gcc / recog.h
1 /* Declarations for interface to insn recognizer and insn-output.c.
2    Copyright (C) 1987, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Random number that should be large enough for all purposes.  */
22 #define MAX_RECOG_ALTERNATIVES 30
23
24 /* Types of operands.  */
25 enum op_type {
26   OP_IN,
27   OP_OUT,
28   OP_INOUT
29 };
30
31 struct operand_alternative
32 {
33   /* Pointer to the beginning of the constraint string for this alternative,
34      for easier access by alternative number.  */
35   const char *constraint;
36
37   /* The register class valid for this alternative (possibly NO_REGS).  */
38   enum reg_class class;
39
40   /* "Badness" of this alternative, computed from number of '?' and '!'
41      characters in the constraint string.  */
42   unsigned int reject;
43
44   /* -1 if no matching constraint was found, or an operand number.  */
45   int matches;
46   /* The same information, but reversed: -1 if this operand is not
47      matched by any other, or the operand number of the operand that
48      matches this one.  */
49   int matched;
50
51   /* Nonzero if '&' was found in the constraint string.  */
52   unsigned int earlyclobber:1;
53   /* Nonzero if 'm' was found in the constraint string.  */
54   unsigned int memory_ok:1;  
55   /* Nonzero if 'o' was found in the constraint string.  */
56   unsigned int offmem_ok:1;  
57   /* Nonzero if 'V' was found in the constraint string.  */
58   unsigned int nonoffmem_ok:1;
59   /* Nonzero if '<' was found in the constraint string.  */
60   unsigned int decmem_ok:1;
61   /* Nonzero if '>' was found in the constraint string.  */
62   unsigned int incmem_ok:1;
63   /* Nonzero if 'X' was found in the constraint string, or if the constraint
64      string for this alternative was empty.  */
65   unsigned int anything_ok:1;
66 };
67
68
69 extern void init_recog                  PROTO((void));
70 extern void init_recog_no_volatile      PROTO((void));
71 extern int recog_memoized               PROTO((rtx));
72 extern int check_asm_operands           PROTO((rtx));
73 extern int asm_operand_ok               PROTO((rtx, const char *));
74 extern int validate_change              PROTO((rtx, rtx *, rtx, int));
75 extern int apply_change_group           PROTO((void));
76 extern int num_validated_changes        PROTO((void));
77 extern void cancel_changes              PROTO((int));
78 extern int constrain_operands           PROTO((int));
79 extern int memory_address_p             PROTO((enum machine_mode, rtx));
80 extern int strict_memory_address_p      PROTO((enum machine_mode, rtx));
81 extern int validate_replace_rtx         PROTO((rtx, rtx, rtx));
82 extern void validate_replace_rtx_group  PROTO((rtx, rtx, rtx));
83 extern int validate_replace_src         PROTO((rtx, rtx, rtx));
84 #ifdef HAVE_cc0
85 extern int next_insn_tests_no_inequality PROTO ((rtx));
86 #endif
87 extern int reg_fits_class_p             PROTO((rtx, enum reg_class, int,
88                                                enum machine_mode));
89 extern rtx *find_single_use             PROTO((rtx, rtx, rtx *));
90
91 extern int general_operand              PROTO((rtx, enum machine_mode));
92 extern int address_operand              PROTO((rtx, enum machine_mode));
93 extern int register_operand             PROTO((rtx, enum machine_mode));
94 extern int scratch_operand              PROTO((rtx, enum machine_mode));
95 extern int immediate_operand            PROTO((rtx, enum machine_mode));
96 extern int const_int_operand            PROTO((rtx, enum machine_mode));
97 extern int const_double_operand         PROTO((rtx, enum machine_mode));
98 extern int nonimmediate_operand         PROTO((rtx, enum machine_mode));
99 extern int nonmemory_operand            PROTO((rtx, enum machine_mode));
100 extern int push_operand                 PROTO((rtx, enum machine_mode));
101 extern int pop_operand                  PROTO((rtx, enum machine_mode));
102 extern int memory_operand               PROTO((rtx, enum machine_mode));
103 extern int indirect_operand             PROTO((rtx, enum machine_mode));
104 extern int mode_independent_operand     PROTO((rtx, enum machine_mode));
105 extern int comparison_operator          PROTO((rtx, enum machine_mode));
106
107 extern int offsettable_memref_p         PROTO((rtx));
108 extern int offsettable_nonstrict_memref_p       PROTO((rtx));
109 extern int offsettable_address_p        PROTO((int, enum machine_mode, rtx));
110 extern int mode_dependent_address_p     PROTO((rtx));
111
112 extern int recog                        PROTO((rtx, rtx, int *));
113 extern void add_clobbers                PROTO((rtx, int));
114 extern void insn_extract                PROTO((rtx));
115 extern void extract_insn                PROTO((rtx));
116 extern void preprocess_constraints      PROTO((void));
117 extern rtx recog_next_insn              PROTO((rtx, int));
118 extern void peephole2_optimize          PROTO((FILE *));
119 extern rtx peephole2_insns              PROTO((rtx, rtx, rtx *));
120
121 /* Nonzero means volatile operands are recognized.  */
122 extern int volatile_ok;
123
124 /* Set by constrain_operands to the number of the alternative that
125    matched.  */
126 extern int which_alternative;
127
128 /* The following vectors hold the results from insn_extract.  */
129
130 /* Indexed by N, gives value of operand N.  */
131 extern rtx recog_operand[];
132
133 /* Indexed by N, gives location where operand N was found.  */
134 extern rtx *recog_operand_loc[];
135
136 /* Indexed by N, gives location where the Nth duplicate-appearance of
137    an operand was found.  This is something that matched MATCH_DUP.  */
138 extern rtx *recog_dup_loc[];
139
140 /* Indexed by N, gives the operand number that was duplicated in the
141    Nth duplicate-appearance of an operand.  */
142 extern char recog_dup_num[];
143
144 /* The next variables are set up by extract_insn.  */
145
146 /* The number of operands of the insn.  */
147 extern int recog_n_operands;
148
149 /* The number of MATCH_DUPs in the insn.  */
150 extern int recog_n_dups;
151
152 /* The number of alternatives in the constraints for the insn.  */
153 extern int recog_n_alternatives;
154
155 /* Indexed by N, gives the mode of operand N.  */
156 extern enum machine_mode recog_operand_mode[];
157
158 /* Indexed by N, gives the constraint string for operand N.  */
159 extern const char *recog_constraints[];
160
161 /* Indexed by N, gives the type (in, out, inout) for operand N.  */
162 extern enum op_type recog_op_type[];
163
164 #ifndef REGISTER_CONSTRAINTS
165 /* Indexed by N, nonzero if operand N should be an address.  */
166 extern char recog_operand_address_p[];
167 #endif
168
169 /* Contains a vector of operand_alternative structures for every operand.
170    Set up by preprocess_constraints.  */
171 extern struct operand_alternative recog_op_alt[MAX_RECOG_OPERANDS][MAX_RECOG_ALTERNATIVES];
172
173 /* Access the output function for CODE.  */
174
175 #define OUT_FCN(CODE) (*insn_outfun[(int) (CODE)])
176
177 /* Tables defined in insn-output.c that give information about
178    each insn-code value.  */
179
180 /* These are vectors indexed by insn-code.  Details in genoutput.c.  */
181
182 extern const char *const insn_template[];
183
184 extern const char *(*const insn_outfun[]) PROTO ((rtx *, rtx));
185
186 extern const int insn_n_operands[];
187
188 extern const int insn_n_dups[];
189
190 /* Indexed by insn code number, gives # of constraint alternatives.  */
191
192 extern const int insn_n_alternatives[];
193
194 /* These are two-dimensional arrays indexed first by the insn-code
195    and second by the operand number.  Details in genoutput.c.  */
196
197 #ifdef REGISTER_CONSTRAINTS  /* Avoid undef sym in certain broken linkers.  */
198 extern const char *const insn_operand_constraint[][MAX_RECOG_OPERANDS];
199 #endif
200
201 #ifndef REGISTER_CONSTRAINTS  /* Avoid undef sym in certain broken linkers.  */
202 extern const char insn_operand_address_p[][MAX_RECOG_OPERANDS];
203 #endif
204
205 extern const enum machine_mode insn_operand_mode[][MAX_RECOG_OPERANDS];
206
207 extern const char insn_operand_strict_low[][MAX_RECOG_OPERANDS];
208
209 extern int (*const insn_operand_predicate[][MAX_RECOG_OPERANDS]) PROTO ((rtx, enum machine_mode));
210
211 extern const char * insn_name[];