1 /* Declarations for interface to insn recognizer and insn-output.c.
2 Copyright (C) 1987, 1996, 1997, 1998, 1999, 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 /* Random number that should be large enough for all purposes. */
23 #define MAX_RECOG_ALTERNATIVES 30
24 #define recog_memoized(I) (INSN_CODE (I) >= 0 \
25 ? INSN_CODE (I) : recog_memoized_1 (I))
27 /* Types of operands. */
34 struct operand_alternative
36 /* Pointer to the beginning of the constraint string for this alternative,
37 for easier access by alternative number. */
38 const char *constraint
;
40 /* The register class valid for this alternative (possibly NO_REGS). */
43 /* "Badness" of this alternative, computed from number of '?' and '!'
44 characters in the constraint string. */
47 /* -1 if no matching constraint was found, or an operand number. */
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
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;
66 /* Nonzero if 'p' was found in the constraint string. */
67 unsigned int is_address
:1;
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;
74 extern void init_recog
PARAMS ((void));
75 extern void init_recog_no_volatile
PARAMS ((void));
76 extern int recog_memoized_1
PARAMS ((rtx
));
77 extern int check_asm_operands
PARAMS ((rtx
));
78 extern int asm_operand_ok
PARAMS ((rtx
, const char *));
79 extern int validate_change
PARAMS ((rtx
, rtx
*, rtx
, int));
80 extern int insn_invalid_p
PARAMS ((rtx
));
81 extern int apply_change_group
PARAMS ((void));
82 extern int num_validated_changes
PARAMS ((void));
83 extern void cancel_changes
PARAMS ((int));
84 extern int constrain_operands
PARAMS ((int));
85 extern int constrain_operands_cached
PARAMS ((int));
86 extern int memory_address_p
PARAMS ((enum machine_mode
, rtx
));
87 extern int strict_memory_address_p
PARAMS ((enum machine_mode
, rtx
));
88 extern int validate_replace_rtx_subexp
PARAMS ((rtx
, rtx
, rtx
, rtx
*));
89 extern int validate_replace_rtx
PARAMS ((rtx
, rtx
, rtx
));
90 extern void validate_replace_rtx_group
PARAMS ((rtx
, rtx
, rtx
));
91 extern int validate_replace_src
PARAMS ((rtx
, rtx
, rtx
));
92 extern void validate_replace_src_group
PARAMS ((rtx
, rtx
, rtx
));
93 extern int num_changes_pending
PARAMS ((void));
95 extern int next_insn_tests_no_inequality
PARAMS ((rtx
));
97 extern int reg_fits_class_p
PARAMS ((rtx
, enum reg_class
, int,
99 extern rtx
*find_single_use
PARAMS ((rtx
, rtx
, rtx
*));
101 extern int general_operand
PARAMS ((rtx
, enum machine_mode
));
102 extern int address_operand
PARAMS ((rtx
, enum machine_mode
));
103 extern int register_operand
PARAMS ((rtx
, enum machine_mode
));
104 extern int pmode_register_operand
PARAMS ((rtx
, enum machine_mode
));
105 extern int scratch_operand
PARAMS ((rtx
, enum machine_mode
));
106 extern int immediate_operand
PARAMS ((rtx
, enum machine_mode
));
107 extern int const_int_operand
PARAMS ((rtx
, enum machine_mode
));
108 extern int const_double_operand
PARAMS ((rtx
, enum machine_mode
));
109 extern int nonimmediate_operand
PARAMS ((rtx
, enum machine_mode
));
110 extern int nonmemory_operand
PARAMS ((rtx
, enum machine_mode
));
111 extern int push_operand
PARAMS ((rtx
, enum machine_mode
));
112 extern int pop_operand
PARAMS ((rtx
, enum machine_mode
));
113 extern int memory_operand
PARAMS ((rtx
, enum machine_mode
));
114 extern int indirect_operand
PARAMS ((rtx
, enum machine_mode
));
115 extern int comparison_operator
PARAMS ((rtx
, enum machine_mode
));
117 extern int offsettable_memref_p
PARAMS ((rtx
));
118 extern int offsettable_nonstrict_memref_p
PARAMS ((rtx
));
119 extern int offsettable_address_p
PARAMS ((int, enum machine_mode
, rtx
));
120 extern int mode_dependent_address_p
PARAMS ((rtx
));
122 extern int recog
PARAMS ((rtx
, rtx
, int *));
123 extern void add_clobbers
PARAMS ((rtx
, int));
124 extern int added_clobbers_hard_reg_p
PARAMS ((int));
125 extern void insn_extract
PARAMS ((rtx
));
126 extern void extract_insn
PARAMS ((rtx
));
127 extern void extract_constrain_insn_cached
PARAMS ((rtx
));
128 extern void extract_insn_cached
PARAMS ((rtx
));
129 extern void preprocess_constraints
PARAMS ((void));
130 extern rtx peep2_next_insn
PARAMS ((int));
131 extern int peep2_regno_dead_p
PARAMS ((int, int));
132 extern int peep2_reg_dead_p
PARAMS ((int, rtx
));
133 #ifdef CLEAR_HARD_REG_SET
134 extern rtx peep2_find_free_register
PARAMS ((int, int, const char *,
138 extern void peephole2_optimize
PARAMS ((FILE *));
139 extern rtx peephole2_insns
PARAMS ((rtx
, rtx
, int *));
141 extern int store_data_bypass_p
PARAMS ((rtx
, rtx
));
142 extern int if_test_bypass_p
PARAMS ((rtx
, rtx
));
144 /* Nonzero means volatile operands are recognized. */
145 extern int volatile_ok
;
147 /* Set by constrain_operands to the number of the alternative that
149 extern int which_alternative
;
151 /* The following vectors hold the results from insn_extract. */
155 /* It is very tempting to make the 5 operand related arrays into a
156 structure and index on that. However, to be source compatible
157 with all of the existing md file insn constraints and output
158 templates, we need `operand' as a flat array. Without that
159 member, making an array for the rest seems pointless. */
161 /* Gives value of operand N. */
162 rtx operand
[MAX_RECOG_OPERANDS
];
164 /* Gives location where operand N was found. */
165 rtx
*operand_loc
[MAX_RECOG_OPERANDS
];
167 /* Gives the constraint string for operand N. */
168 const char *constraints
[MAX_RECOG_OPERANDS
];
170 /* Gives the mode of operand N. */
171 enum machine_mode operand_mode
[MAX_RECOG_OPERANDS
];
173 /* Gives the type (in, out, inout) for operand N. */
174 enum op_type operand_type
[MAX_RECOG_OPERANDS
];
176 /* Gives location where the Nth duplicate-appearance of an operand
177 was found. This is something that matched MATCH_DUP. */
178 rtx
*dup_loc
[MAX_DUP_OPERANDS
];
180 /* Gives the operand number that was duplicated in the Nth
181 duplicate-appearance of an operand. */
182 char dup_num
[MAX_DUP_OPERANDS
];
184 /* ??? Note that these are `char' instead of `unsigned char' to (try to)
185 avoid certain lossage from K&R C, wherein `unsigned char' default
186 promotes to `unsigned int' instead of `int' as in ISO C. As of 1999,
187 the most common places to bootstrap from K&R C are SunOS and HPUX,
188 both of which have signed characters by default. The only other
189 supported natives that have both K&R C and unsigned characters are
190 ROMP and Irix 3, and neither have been seen for a while, but do
191 continue to consider unsignedness when performing arithmetic inside
194 /* The number of operands of the insn. */
197 /* The number of MATCH_DUPs in the insn. */
200 /* The number of alternatives in the constraints for the insn. */
203 /* In case we are caching, hold insn data was generated for. */
207 extern struct recog_data recog_data
;
209 /* Contains a vector of operand_alternative structures for every operand.
210 Set up by preprocess_constraints. */
211 extern struct operand_alternative recog_op_alt
[MAX_RECOG_OPERANDS
][MAX_RECOG_ALTERNATIVES
];
213 /* A table defined in insn-output.c that give information about
214 each insn-code value. */
216 typedef int (*insn_operand_predicate_fn
) PARAMS ((rtx
, enum machine_mode
));
217 typedef const char * (*insn_output_fn
) PARAMS ((rtx
*, rtx
));
218 typedef rtx (*insn_gen_fn
) PARAMS ((rtx
, ...));
220 struct insn_operand_data
222 const insn_operand_predicate_fn predicate
;
224 const char *const constraint
;
226 const ENUM_BITFIELD(machine_mode
) mode
: 16;
228 const char strict_low
;
230 const char eliminable
;
233 /* Legal values for insn_data.output_format. Indicate what type of data
234 is stored in insn_data.output. */
235 #define INSN_OUTPUT_FORMAT_NONE 0 /* abort */
236 #define INSN_OUTPUT_FORMAT_SINGLE 1 /* const char * */
237 #define INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */
238 #define INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */
242 const char *const name
;
244 const insn_gen_fn genfun
;
245 const struct insn_operand_data
*const operand
;
247 const char n_operands
;
249 const char n_alternatives
;
250 const char output_format
;
253 extern const struct insn_data insn_data
[];