1 /* Declarations for interface to insn recognizer and insn-output.c.
2 Copyright (C) 1987, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
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)
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.
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. */
21 /* Random number that should be large enough for all purposes. */
22 #define MAX_RECOG_ALTERNATIVES 30
24 /* Types of operands. */
31 struct operand_alternative
33 /* Pointer to the beginning of the constraint string for this alternative,
34 for easier access by alternative number. */
35 const char *constraint
;
37 /* The register class valid for this alternative (possibly NO_REGS). */
40 /* "Badness" of this alternative, computed from number of '?' and '!'
41 characters in the constraint string. */
44 /* -1 if no matching constraint was found, or an operand number. */
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
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;
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
));
85 extern int next_insn_tests_no_inequality
PROTO ((rtx
));
87 extern int reg_fits_class_p
PROTO((rtx
, enum reg_class
, int,
89 extern rtx
*find_single_use
PROTO((rtx
, rtx
, rtx
*));
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
));
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
));
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
*));
121 /* Nonzero means volatile operands are recognized. */
122 extern int volatile_ok
;
124 /* Set by constrain_operands to the number of the alternative that
126 extern int which_alternative
;
128 /* The following vectors hold the results from insn_extract. */
132 /* It is very tempting to make the 5 operand related arrays into a
133 structure and index on that. However, to be source compatible
134 with all of the existing md file insn constraints and output
135 templates, we need `operand' as a flat array. Without that
136 member, making an array for the rest seems pointless. */
138 /* Gives value of operand N. */
139 rtx operand
[MAX_RECOG_OPERANDS
];
141 /* Gives location where operand N was found. */
142 rtx
*operand_loc
[MAX_RECOG_OPERANDS
];
144 /* Gives the constraint string for operand N. */
145 const char *constraints
[MAX_RECOG_OPERANDS
];
147 /* Gives the mode of operand N. */
148 enum machine_mode operand_mode
[MAX_RECOG_OPERANDS
];
150 /* Gives the type (in, out, inout) for operand N. */
151 enum op_type operand_type
[MAX_RECOG_OPERANDS
];
153 /* Gives location where the Nth duplicate-appearance of an operand
154 was found. This is something that matched MATCH_DUP. */
155 rtx
*dup_loc
[MAX_DUP_OPERANDS
];
157 /* Gives the operand number that was duplicated in the Nth
158 duplicate-appearance of an operand. */
159 char dup_num
[MAX_DUP_OPERANDS
];
161 /* ??? Note that these are `char' instead of `unsigned char' to (try to)
162 avoid certain lossage from K&R C, wherein `unsigned char' default
163 promotes to `unsigned int' instead of `int' as in ISO C. As of 1999,
164 the most common places to bootstrap from K&R C are SunOS and HPUX,
165 both of which have signed characters by default. The only other
166 supported natives that have both K&R C and unsigned characters are
167 ROMP and Irix 3, and neither have been seen for a while, but do
168 continue to consider unsignedness when performing arithmetic inside
171 /* The number of operands of the insn. */
174 /* The number of MATCH_DUPs in the insn. */
177 /* The number of alternatives in the constraints for the insn. */
181 extern struct recog_data recog_data
;
183 /* Contains a vector of operand_alternative structures for every operand.
184 Set up by preprocess_constraints. */
185 extern struct operand_alternative recog_op_alt
[MAX_RECOG_OPERANDS
][MAX_RECOG_ALTERNATIVES
];
187 /* Access the output function for CODE. */
189 #define OUT_FCN(CODE) (*insn_data[(int) (CODE)].outfun)
191 /* A table defined in insn-output.c that give information about
192 each insn-code value. */
194 typedef int (*insn_operand_predicate_fn
) PROTO ((rtx
, enum machine_mode
));
195 typedef const char * (*insn_output_fn
) PROTO ((rtx
*, rtx
));
196 #ifndef NO_MD_PROTOTYPES
197 typedef rtx (*insn_gen_fn
) PROTO ((rtx
, ...));
199 typedef rtx (*insn_gen_fn
) ();
202 struct insn_operand_data
204 insn_operand_predicate_fn predicate
;
206 const char *constraint
;
208 enum machine_mode mode
;
213 /* Legal values for insn_data.output_format. Indicate what type of data
214 is stored in insn_data.output. */
215 #define INSN_OUTPUT_FORMAT_NONE 0 /* abort */
216 #define INSN_OUTPUT_FORMAT_SINGLE 1 /* const char * */
217 #define INSN_OUTPUT_FORMAT_MULTI 2 /* const char * const * */
218 #define INSN_OUTPUT_FORMAT_FUNCTION 3 /* const char * (*)(...) */
225 const struct insn_operand_data
*operand
;
233 extern const struct insn_data insn_data
[];