xref: /dragonfly/contrib/gcc-8.0/gcc/recog.h (revision 38fd1498)
1*38fd1498Szrj /* Declarations for interface to insn recognizer and insn-output.c.
2*38fd1498Szrj    Copyright (C) 1987-2018 Free Software Foundation, Inc.
3*38fd1498Szrj 
4*38fd1498Szrj This file is part of GCC.
5*38fd1498Szrj 
6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify it under
7*38fd1498Szrj the terms of the GNU General Public License as published by the Free
8*38fd1498Szrj Software Foundation; either version 3, or (at your option) any later
9*38fd1498Szrj version.
10*38fd1498Szrj 
11*38fd1498Szrj GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12*38fd1498Szrj WARRANTY; without even the implied warranty of MERCHANTABILITY or
13*38fd1498Szrj FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*38fd1498Szrj for more details.
15*38fd1498Szrj 
16*38fd1498Szrj You should have received a copy of the GNU General Public License
17*38fd1498Szrj along with GCC; see the file COPYING3.  If not see
18*38fd1498Szrj <http://www.gnu.org/licenses/>.  */
19*38fd1498Szrj 
20*38fd1498Szrj #ifndef GCC_RECOG_H
21*38fd1498Szrj #define GCC_RECOG_H
22*38fd1498Szrj 
23*38fd1498Szrj /* Random number that should be large enough for all purposes.  Also define
24*38fd1498Szrj    a type that has at least MAX_RECOG_ALTERNATIVES + 1 bits, with the extra
25*38fd1498Szrj    bit giving an invalid value that can be used to mean "uninitialized".  */
26*38fd1498Szrj #define MAX_RECOG_ALTERNATIVES 35
27*38fd1498Szrj typedef uint64_t alternative_mask;
28*38fd1498Szrj 
29*38fd1498Szrj /* A mask of all alternatives.  */
30*38fd1498Szrj #define ALL_ALTERNATIVES ((alternative_mask) -1)
31*38fd1498Szrj 
32*38fd1498Szrj /* A mask containing just alternative X.  */
33*38fd1498Szrj #define ALTERNATIVE_BIT(X) ((alternative_mask) 1 << (X))
34*38fd1498Szrj 
35*38fd1498Szrj /* Types of operands.  */
36*38fd1498Szrj enum op_type {
37*38fd1498Szrj   OP_IN,
38*38fd1498Szrj   OP_OUT,
39*38fd1498Szrj   OP_INOUT
40*38fd1498Szrj };
41*38fd1498Szrj 
42*38fd1498Szrj struct operand_alternative
43*38fd1498Szrj {
44*38fd1498Szrj   /* Pointer to the beginning of the constraint string for this alternative,
45*38fd1498Szrj      for easier access by alternative number.  */
46*38fd1498Szrj   const char *constraint;
47*38fd1498Szrj 
48*38fd1498Szrj   /* The register class valid for this alternative (possibly NO_REGS).  */
49*38fd1498Szrj   ENUM_BITFIELD (reg_class) cl : 16;
50*38fd1498Szrj 
51*38fd1498Szrj   /* "Badness" of this alternative, computed from number of '?' and '!'
52*38fd1498Szrj      characters in the constraint string.  */
53*38fd1498Szrj   unsigned int reject : 16;
54*38fd1498Szrj 
55*38fd1498Szrj   /* -1 if no matching constraint was found, or an operand number.  */
56*38fd1498Szrj   int matches : 8;
57*38fd1498Szrj   /* The same information, but reversed: -1 if this operand is not
58*38fd1498Szrj      matched by any other, or the operand number of the operand that
59*38fd1498Szrj      matches this one.  */
60*38fd1498Szrj   int matched : 8;
61*38fd1498Szrj 
62*38fd1498Szrj   /* Nonzero if '&' was found in the constraint string.  */
63*38fd1498Szrj   unsigned int earlyclobber : 1;
64*38fd1498Szrj   /* Nonzero if TARGET_MEM_CONSTRAINT was found in the constraint
65*38fd1498Szrj      string.  */
66*38fd1498Szrj   unsigned int memory_ok : 1;
67*38fd1498Szrj   /* Nonzero if 'p' was found in the constraint string.  */
68*38fd1498Szrj   unsigned int is_address : 1;
69*38fd1498Szrj   /* Nonzero if 'X' was found in the constraint string, or if the constraint
70*38fd1498Szrj      string for this alternative was empty.  */
71*38fd1498Szrj   unsigned int anything_ok : 1;
72*38fd1498Szrj 
73*38fd1498Szrj   unsigned int unused : 12;
74*38fd1498Szrj };
75*38fd1498Szrj 
76*38fd1498Szrj /* Return the class for operand I of alternative ALT, taking matching
77*38fd1498Szrj    constraints into account.  */
78*38fd1498Szrj 
79*38fd1498Szrj static inline enum reg_class
alternative_class(const operand_alternative * alt,int i)80*38fd1498Szrj alternative_class (const operand_alternative *alt, int i)
81*38fd1498Szrj {
82*38fd1498Szrj   return alt[i].matches >= 0 ? alt[alt[i].matches].cl : alt[i].cl;
83*38fd1498Szrj }
84*38fd1498Szrj 
85*38fd1498Szrj extern void init_recog (void);
86*38fd1498Szrj extern void init_recog_no_volatile (void);
87*38fd1498Szrj extern int check_asm_operands (rtx);
88*38fd1498Szrj extern int asm_operand_ok (rtx, const char *, const char **);
89*38fd1498Szrj extern bool validate_change (rtx, rtx *, rtx, bool);
90*38fd1498Szrj extern bool validate_unshare_change (rtx, rtx *, rtx, bool);
91*38fd1498Szrj extern bool canonicalize_change_group (rtx_insn *insn, rtx x);
92*38fd1498Szrj extern int insn_invalid_p (rtx_insn *, bool);
93*38fd1498Szrj extern int verify_changes (int);
94*38fd1498Szrj extern void confirm_change_group (void);
95*38fd1498Szrj extern int apply_change_group (void);
96*38fd1498Szrj extern int num_validated_changes (void);
97*38fd1498Szrj extern void cancel_changes (int);
98*38fd1498Szrj extern int constrain_operands (int, alternative_mask);
99*38fd1498Szrj extern int constrain_operands_cached (rtx_insn *, int);
100*38fd1498Szrj extern int memory_address_addr_space_p (machine_mode, rtx, addr_space_t);
101*38fd1498Szrj #define memory_address_p(mode,addr) \
102*38fd1498Szrj 	memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
103*38fd1498Szrj extern int strict_memory_address_addr_space_p (machine_mode, rtx,
104*38fd1498Szrj 					       addr_space_t);
105*38fd1498Szrj #define strict_memory_address_p(mode,addr) \
106*38fd1498Szrj 	strict_memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
107*38fd1498Szrj extern int validate_replace_rtx_subexp (rtx, rtx, rtx_insn *, rtx *);
108*38fd1498Szrj extern int validate_replace_rtx (rtx, rtx, rtx_insn *);
109*38fd1498Szrj extern int validate_replace_rtx_part (rtx, rtx, rtx *, rtx_insn *);
110*38fd1498Szrj extern int validate_replace_rtx_part_nosimplify (rtx, rtx, rtx *, rtx_insn *);
111*38fd1498Szrj extern void validate_replace_rtx_group (rtx, rtx, rtx_insn *);
112*38fd1498Szrj extern void validate_replace_src_group (rtx, rtx, rtx_insn *);
113*38fd1498Szrj extern bool validate_simplify_insn (rtx_insn *insn);
114*38fd1498Szrj extern int num_changes_pending (void);
115*38fd1498Szrj extern int next_insn_tests_no_inequality (rtx_insn *);
116*38fd1498Szrj extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
117*38fd1498Szrj 
118*38fd1498Szrj extern int offsettable_memref_p (rtx);
119*38fd1498Szrj extern int offsettable_nonstrict_memref_p (rtx);
120*38fd1498Szrj extern int offsettable_address_addr_space_p (int, machine_mode, rtx,
121*38fd1498Szrj 					     addr_space_t);
122*38fd1498Szrj #define offsettable_address_p(strict,mode,addr) \
123*38fd1498Szrj 	offsettable_address_addr_space_p ((strict), (mode), (addr), \
124*38fd1498Szrj 					  ADDR_SPACE_GENERIC)
125*38fd1498Szrj extern bool mode_dependent_address_p (rtx, addr_space_t);
126*38fd1498Szrj 
127*38fd1498Szrj extern int recog (rtx, rtx_insn *, int *);
128*38fd1498Szrj #ifndef GENERATOR_FILE
129*38fd1498Szrj static inline int recog_memoized (rtx_insn *insn);
130*38fd1498Szrj #endif
131*38fd1498Szrj extern void add_clobbers (rtx, int);
132*38fd1498Szrj extern int added_clobbers_hard_reg_p (int);
133*38fd1498Szrj extern void insn_extract (rtx_insn *);
134*38fd1498Szrj extern void extract_insn (rtx_insn *);
135*38fd1498Szrj extern void extract_constrain_insn (rtx_insn *insn);
136*38fd1498Szrj extern void extract_constrain_insn_cached (rtx_insn *);
137*38fd1498Szrj extern void extract_insn_cached (rtx_insn *);
138*38fd1498Szrj extern void preprocess_constraints (int, int, const char **,
139*38fd1498Szrj 				    operand_alternative *, rtx **);
140*38fd1498Szrj extern const operand_alternative *preprocess_insn_constraints (unsigned int);
141*38fd1498Szrj extern void preprocess_constraints (rtx_insn *);
142*38fd1498Szrj extern rtx_insn *peep2_next_insn (int);
143*38fd1498Szrj extern int peep2_regno_dead_p (int, int);
144*38fd1498Szrj extern int peep2_reg_dead_p (int, rtx);
145*38fd1498Szrj #ifdef CLEAR_HARD_REG_SET
146*38fd1498Szrj extern rtx peep2_find_free_register (int, int, const char *,
147*38fd1498Szrj 				     machine_mode, HARD_REG_SET *);
148*38fd1498Szrj #endif
149*38fd1498Szrj extern rtx_insn *peephole2_insns (rtx, rtx_insn *, int *);
150*38fd1498Szrj 
151*38fd1498Szrj extern int store_data_bypass_p (rtx_insn *, rtx_insn *);
152*38fd1498Szrj extern int if_test_bypass_p (rtx_insn *, rtx_insn *);
153*38fd1498Szrj 
154*38fd1498Szrj #ifndef GENERATOR_FILE
155*38fd1498Szrj /* Try recognizing the instruction INSN,
156*38fd1498Szrj    and return the code number that results.
157*38fd1498Szrj    Remember the code so that repeated calls do not
158*38fd1498Szrj    need to spend the time for actual rerecognition.
159*38fd1498Szrj 
160*38fd1498Szrj    This function is the normal interface to instruction recognition.
161*38fd1498Szrj    The automatically-generated function `recog' is normally called
162*38fd1498Szrj    through this one.  */
163*38fd1498Szrj 
164*38fd1498Szrj static inline int
recog_memoized(rtx_insn * insn)165*38fd1498Szrj recog_memoized (rtx_insn *insn)
166*38fd1498Szrj {
167*38fd1498Szrj   if (INSN_CODE (insn) < 0)
168*38fd1498Szrj     INSN_CODE (insn) = recog (PATTERN (insn), insn, 0);
169*38fd1498Szrj   return INSN_CODE (insn);
170*38fd1498Szrj }
171*38fd1498Szrj #endif
172*38fd1498Szrj 
173*38fd1498Szrj /* Skip chars until the next ',' or the end of the string.  This is
174*38fd1498Szrj    useful to skip alternatives in a constraint string.  */
175*38fd1498Szrj static inline const char *
skip_alternative(const char * p)176*38fd1498Szrj skip_alternative (const char *p)
177*38fd1498Szrj {
178*38fd1498Szrj   const char *r = p;
179*38fd1498Szrj   while (*r != '\0' && *r != ',')
180*38fd1498Szrj     r++;
181*38fd1498Szrj   if (*r == ',')
182*38fd1498Szrj     r++;
183*38fd1498Szrj   return r;
184*38fd1498Szrj }
185*38fd1498Szrj 
186*38fd1498Szrj /* Nonzero means volatile operands are recognized.  */
187*38fd1498Szrj extern int volatile_ok;
188*38fd1498Szrj 
189*38fd1498Szrj /* Set by constrain_operands to the number of the alternative that
190*38fd1498Szrj    matched.  */
191*38fd1498Szrj extern int which_alternative;
192*38fd1498Szrj 
193*38fd1498Szrj /* The following vectors hold the results from insn_extract.  */
194*38fd1498Szrj 
195*38fd1498Szrj struct recog_data_d
196*38fd1498Szrj {
197*38fd1498Szrj   /* It is very tempting to make the 5 operand related arrays into a
198*38fd1498Szrj      structure and index on that.  However, to be source compatible
199*38fd1498Szrj      with all of the existing md file insn constraints and output
200*38fd1498Szrj      templates, we need `operand' as a flat array.  Without that
201*38fd1498Szrj      member, making an array for the rest seems pointless.  */
202*38fd1498Szrj 
203*38fd1498Szrj   /* Gives value of operand N.  */
204*38fd1498Szrj   rtx operand[MAX_RECOG_OPERANDS];
205*38fd1498Szrj 
206*38fd1498Szrj   /* Gives location where operand N was found.  */
207*38fd1498Szrj   rtx *operand_loc[MAX_RECOG_OPERANDS];
208*38fd1498Szrj 
209*38fd1498Szrj   /* Gives the constraint string for operand N.  */
210*38fd1498Szrj   const char *constraints[MAX_RECOG_OPERANDS];
211*38fd1498Szrj 
212*38fd1498Szrj   /* Nonzero if operand N is a match_operator or a match_parallel.  */
213*38fd1498Szrj   char is_operator[MAX_RECOG_OPERANDS];
214*38fd1498Szrj 
215*38fd1498Szrj   /* Gives the mode of operand N.  */
216*38fd1498Szrj   machine_mode operand_mode[MAX_RECOG_OPERANDS];
217*38fd1498Szrj 
218*38fd1498Szrj   /* Gives the type (in, out, inout) for operand N.  */
219*38fd1498Szrj   enum op_type operand_type[MAX_RECOG_OPERANDS];
220*38fd1498Szrj 
221*38fd1498Szrj   /* Gives location where the Nth duplicate-appearance of an operand
222*38fd1498Szrj      was found.  This is something that matched MATCH_DUP.  */
223*38fd1498Szrj   rtx *dup_loc[MAX_DUP_OPERANDS];
224*38fd1498Szrj 
225*38fd1498Szrj   /* Gives the operand number that was duplicated in the Nth
226*38fd1498Szrj      duplicate-appearance of an operand.  */
227*38fd1498Szrj   char dup_num[MAX_DUP_OPERANDS];
228*38fd1498Szrj 
229*38fd1498Szrj   /* ??? Note that these are `char' instead of `unsigned char' to (try to)
230*38fd1498Szrj      avoid certain lossage from K&R C, wherein `unsigned char' default
231*38fd1498Szrj      promotes to `unsigned int' instead of `int' as in ISO C.  As of 1999,
232*38fd1498Szrj      the most common places to bootstrap from K&R C are SunOS and HPUX,
233*38fd1498Szrj      both of which have signed characters by default.  The only other
234*38fd1498Szrj      supported natives that have both K&R C and unsigned characters are
235*38fd1498Szrj      ROMP and Irix 3, and neither have been seen for a while, but do
236*38fd1498Szrj      continue to consider unsignedness when performing arithmetic inside
237*38fd1498Szrj      a comparison.  */
238*38fd1498Szrj 
239*38fd1498Szrj   /* The number of operands of the insn.  */
240*38fd1498Szrj   char n_operands;
241*38fd1498Szrj 
242*38fd1498Szrj   /* The number of MATCH_DUPs in the insn.  */
243*38fd1498Szrj   char n_dups;
244*38fd1498Szrj 
245*38fd1498Szrj   /* The number of alternatives in the constraints for the insn.  */
246*38fd1498Szrj   char n_alternatives;
247*38fd1498Szrj 
248*38fd1498Szrj   /* True if insn is ASM_OPERANDS.  */
249*38fd1498Szrj   bool is_asm;
250*38fd1498Szrj 
251*38fd1498Szrj   /* In case we are caching, hold insn data was generated for.  */
252*38fd1498Szrj   rtx_insn *insn;
253*38fd1498Szrj };
254*38fd1498Szrj 
255*38fd1498Szrj extern struct recog_data_d recog_data;
256*38fd1498Szrj 
257*38fd1498Szrj extern const operand_alternative *recog_op_alt;
258*38fd1498Szrj 
259*38fd1498Szrj /* Return a pointer to an array in which index OP describes the constraints
260*38fd1498Szrj    on operand OP of the current instruction alternative (which_alternative).
261*38fd1498Szrj    Only valid after calling preprocess_constraints and constrain_operands.  */
262*38fd1498Szrj 
263*38fd1498Szrj inline static const operand_alternative *
which_op_alt()264*38fd1498Szrj which_op_alt ()
265*38fd1498Szrj {
266*38fd1498Szrj   gcc_checking_assert (IN_RANGE (which_alternative, 0,
267*38fd1498Szrj 				 recog_data.n_alternatives - 1));
268*38fd1498Szrj   return &recog_op_alt[which_alternative * recog_data.n_operands];
269*38fd1498Szrj }
270*38fd1498Szrj 
271*38fd1498Szrj /* A table defined in insn-output.c that give information about
272*38fd1498Szrj    each insn-code value.  */
273*38fd1498Szrj 
274*38fd1498Szrj typedef int (*insn_operand_predicate_fn) (rtx, machine_mode);
275*38fd1498Szrj typedef const char * (*insn_output_fn) (rtx *, rtx_insn *);
276*38fd1498Szrj 
277*38fd1498Szrj struct insn_gen_fn
278*38fd1498Szrj {
279*38fd1498Szrj   typedef rtx_insn * (*f0) (void);
280*38fd1498Szrj   typedef rtx_insn * (*f1) (rtx);
281*38fd1498Szrj   typedef rtx_insn * (*f2) (rtx, rtx);
282*38fd1498Szrj   typedef rtx_insn * (*f3) (rtx, rtx, rtx);
283*38fd1498Szrj   typedef rtx_insn * (*f4) (rtx, rtx, rtx, rtx);
284*38fd1498Szrj   typedef rtx_insn * (*f5) (rtx, rtx, rtx, rtx, rtx);
285*38fd1498Szrj   typedef rtx_insn * (*f6) (rtx, rtx, rtx, rtx, rtx, rtx);
286*38fd1498Szrj   typedef rtx_insn * (*f7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
287*38fd1498Szrj   typedef rtx_insn * (*f8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
288*38fd1498Szrj   typedef rtx_insn * (*f9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
289*38fd1498Szrj   typedef rtx_insn * (*f10) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
290*38fd1498Szrj   typedef rtx_insn * (*f11) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
291*38fd1498Szrj   typedef rtx_insn * (*f12) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
292*38fd1498Szrj   typedef rtx_insn * (*f13) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
293*38fd1498Szrj   typedef rtx_insn * (*f14) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
294*38fd1498Szrj   typedef rtx_insn * (*f15) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
295*38fd1498Szrj   typedef rtx_insn * (*f16) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
296*38fd1498Szrj 
297*38fd1498Szrj   typedef void (*stored_funcptr) (void);
298*38fd1498Szrj 
operatorinsn_gen_fn299*38fd1498Szrj   rtx_insn * operator () (void) const { return ((f0)func) (); }
operatorinsn_gen_fn300*38fd1498Szrj   rtx_insn * operator () (rtx a0) const { return ((f1)func) (a0); }
operatorinsn_gen_fn301*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1) const { return ((f2)func) (a0, a1); }
operatorinsn_gen_fn302*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2) const { return ((f3)func) (a0, a1, a2); }
operatorinsn_gen_fn303*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3) const { return ((f4)func) (a0, a1, a2, a3); }
operatorinsn_gen_fn304*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4) const { return ((f5)func) (a0, a1, a2, a3, a4); }
operatorinsn_gen_fn305*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5) const { return ((f6)func) (a0, a1, a2, a3, a4, a5); }
operatorinsn_gen_fn306*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6) const { return ((f7)func) (a0, a1, a2, a3, a4, a5, a6); }
operatorinsn_gen_fn307*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7) const { return ((f8)func) (a0, a1, a2, a3, a4, a5, a6, a7); }
operatorinsn_gen_fn308*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8) const { return ((f9)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8); }
operatorinsn_gen_fn309*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9) const { return ((f10)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
operatorinsn_gen_fn310*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10) const { return ((f11)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
operatorinsn_gen_fn311*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11) const { return ((f12)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
operatorinsn_gen_fn312*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12) const { return ((f13)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
operatorinsn_gen_fn313*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13) const { return ((f14)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
operatorinsn_gen_fn314*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14) const { return ((f15)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
operatorinsn_gen_fn315*38fd1498Szrj   rtx_insn * operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14, rtx a15) const { return ((f16)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
316*38fd1498Szrj 
317*38fd1498Szrj   // This is for compatibility of code that invokes functions like
318*38fd1498Szrj   //   (*funcptr) (arg)
319*38fd1498Szrj   insn_gen_fn operator * (void) const { return *this; }
320*38fd1498Szrj 
321*38fd1498Szrj   // The wrapped function pointer must be public and there must not be any
322*38fd1498Szrj   // constructors.  Otherwise the insn_data_d struct initializers generated
323*38fd1498Szrj   // by genoutput.c will result in static initializer functions, which defeats
324*38fd1498Szrj   // the purpose of the generated insn_data_d array.
325*38fd1498Szrj   stored_funcptr func;
326*38fd1498Szrj };
327*38fd1498Szrj 
328*38fd1498Szrj struct insn_operand_data
329*38fd1498Szrj {
330*38fd1498Szrj   const insn_operand_predicate_fn predicate;
331*38fd1498Szrj 
332*38fd1498Szrj   const char *const constraint;
333*38fd1498Szrj 
334*38fd1498Szrj   ENUM_BITFIELD(machine_mode) const mode : 16;
335*38fd1498Szrj 
336*38fd1498Szrj   const char strict_low;
337*38fd1498Szrj 
338*38fd1498Szrj   const char is_operator;
339*38fd1498Szrj 
340*38fd1498Szrj   const char eliminable;
341*38fd1498Szrj 
342*38fd1498Szrj   const char allows_mem;
343*38fd1498Szrj };
344*38fd1498Szrj 
345*38fd1498Szrj /* Legal values for insn_data.output_format.  Indicate what type of data
346*38fd1498Szrj    is stored in insn_data.output.  */
347*38fd1498Szrj #define INSN_OUTPUT_FORMAT_NONE		0	/* abort */
348*38fd1498Szrj #define INSN_OUTPUT_FORMAT_SINGLE	1	/* const char * */
349*38fd1498Szrj #define INSN_OUTPUT_FORMAT_MULTI	2	/* const char * const * */
350*38fd1498Szrj #define INSN_OUTPUT_FORMAT_FUNCTION	3	/* const char * (*)(...) */
351*38fd1498Szrj 
352*38fd1498Szrj struct insn_data_d
353*38fd1498Szrj {
354*38fd1498Szrj   const char *const name;
355*38fd1498Szrj #if HAVE_DESIGNATED_UNION_INITIALIZERS
356*38fd1498Szrj   union {
357*38fd1498Szrj     const char *single;
358*38fd1498Szrj     const char *const *multi;
359*38fd1498Szrj     insn_output_fn function;
360*38fd1498Szrj   } output;
361*38fd1498Szrj #else
362*38fd1498Szrj   struct {
363*38fd1498Szrj     const char *single;
364*38fd1498Szrj     const char *const *multi;
365*38fd1498Szrj     insn_output_fn function;
366*38fd1498Szrj   } output;
367*38fd1498Szrj #endif
368*38fd1498Szrj   const insn_gen_fn genfun;
369*38fd1498Szrj   const struct insn_operand_data *const operand;
370*38fd1498Szrj 
371*38fd1498Szrj   const char n_generator_args;
372*38fd1498Szrj   const char n_operands;
373*38fd1498Szrj   const char n_dups;
374*38fd1498Szrj   const char n_alternatives;
375*38fd1498Szrj   const char output_format;
376*38fd1498Szrj };
377*38fd1498Szrj 
378*38fd1498Szrj extern const struct insn_data_d insn_data[];
379*38fd1498Szrj extern int peep2_current_count;
380*38fd1498Szrj 
381*38fd1498Szrj #ifndef GENERATOR_FILE
382*38fd1498Szrj #include "insn-codes.h"
383*38fd1498Szrj 
384*38fd1498Szrj /* An enum of boolean attributes that may only depend on the current
385*38fd1498Szrj    subtarget, not on things like operands or compiler phase.  */
386*38fd1498Szrj enum bool_attr {
387*38fd1498Szrj   BA_ENABLED,
388*38fd1498Szrj   BA_PREFERRED_FOR_SPEED,
389*38fd1498Szrj   BA_PREFERRED_FOR_SIZE,
390*38fd1498Szrj   BA_LAST = BA_PREFERRED_FOR_SIZE
391*38fd1498Szrj };
392*38fd1498Szrj 
393*38fd1498Szrj /* Target-dependent globals.  */
394*38fd1498Szrj struct target_recog {
395*38fd1498Szrj   bool x_initialized;
396*38fd1498Szrj   alternative_mask x_bool_attr_masks[NUM_INSN_CODES][BA_LAST + 1];
397*38fd1498Szrj   operand_alternative *x_op_alt[NUM_INSN_CODES];
398*38fd1498Szrj };
399*38fd1498Szrj 
400*38fd1498Szrj extern struct target_recog default_target_recog;
401*38fd1498Szrj #if SWITCHABLE_TARGET
402*38fd1498Szrj extern struct target_recog *this_target_recog;
403*38fd1498Szrj #else
404*38fd1498Szrj #define this_target_recog (&default_target_recog)
405*38fd1498Szrj #endif
406*38fd1498Szrj 
407*38fd1498Szrj alternative_mask get_enabled_alternatives (rtx_insn *);
408*38fd1498Szrj alternative_mask get_preferred_alternatives (rtx_insn *);
409*38fd1498Szrj alternative_mask get_preferred_alternatives (rtx_insn *, basic_block);
410*38fd1498Szrj bool check_bool_attrs (rtx_insn *);
411*38fd1498Szrj 
412*38fd1498Szrj void recog_init ();
413*38fd1498Szrj #endif
414*38fd1498Szrj 
415*38fd1498Szrj #endif /* GCC_RECOG_H */
416