Mercurial > hg > CbC > CbC_gcc
annotate gcc/optabs.h @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
rev | line source |
---|---|
0 | 1 /* Definitions for code generation pass of GNU compiler. |
131 | 2 Copyright (C) 2001-2018 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GCC. | |
5 | |
6 GCC 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 3, or (at your option) | |
9 any later version. | |
10 | |
11 GCC 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 GCC; see the file COPYING3. If not see | |
18 <http://www.gnu.org/licenses/>. */ | |
19 | |
20 #ifndef GCC_OPTABS_H | |
21 #define GCC_OPTABS_H | |
22 | |
111 | 23 #include "optabs-query.h" |
24 #include "optabs-libfuncs.h" | |
131 | 25 #include "vec-perm-indices.h" |
0 | 26 |
111 | 27 /* Generate code for a widening multiply. */ |
28 extern rtx expand_widening_mult (machine_mode, rtx, rtx, rtx, int, optab); | |
0 | 29 |
111 | 30 /* Describes the type of an expand_operand. Each value is associated |
31 with a create_*_operand function; see the comments above those | |
32 functions for details. */ | |
33 enum expand_operand_type { | |
34 EXPAND_FIXED, | |
35 EXPAND_OUTPUT, | |
36 EXPAND_INPUT, | |
37 EXPAND_CONVERT_TO, | |
38 EXPAND_CONVERT_FROM, | |
39 EXPAND_ADDRESS, | |
40 EXPAND_INTEGER | |
0 | 41 }; |
42 | |
111 | 43 /* Information about an operand for instruction expansion. */ |
44 struct expand_operand { | |
45 /* The type of operand. */ | |
46 ENUM_BITFIELD (expand_operand_type) type : 8; | |
0 | 47 |
111 | 48 /* True if any conversion should treat VALUE as being unsigned |
49 rather than signed. Only meaningful for certain types. */ | |
50 unsigned int unsigned_p : 1; | |
0 | 51 |
111 | 52 /* Is the target operand. */ |
53 unsigned int target : 1; | |
0 | 54 |
111 | 55 /* Unused; available for future use. */ |
56 unsigned int unused : 6; | |
0 | 57 |
111 | 58 /* The mode passed to the convert_*_operand function. It has a |
59 type-dependent meaning. */ | |
60 ENUM_BITFIELD (machine_mode) mode : 16; | |
0 | 61 |
111 | 62 /* The value of the operand. */ |
63 rtx value; | |
131 | 64 |
65 /* The value of an EXPAND_INTEGER operand. */ | |
66 poly_int64 int_value; | |
0 | 67 }; |
68 | |
111 | 69 /* Initialize OP with the given fields. Initialise the other fields |
70 to their default values. */ | |
71 | |
72 static inline void | |
73 create_expand_operand (struct expand_operand *op, | |
74 enum expand_operand_type type, | |
75 rtx value, machine_mode mode, | |
131 | 76 bool unsigned_p, poly_int64 int_value = 0) |
111 | 77 { |
78 op->type = type; | |
79 op->unsigned_p = unsigned_p; | |
80 op->unused = 0; | |
81 op->mode = mode; | |
82 op->value = value; | |
131 | 83 op->int_value = int_value; |
111 | 84 } |
85 | |
86 /* Make OP describe an operand that must use rtx X, even if X is volatile. */ | |
87 | |
88 static inline void | |
89 create_fixed_operand (struct expand_operand *op, rtx x) | |
90 { | |
91 create_expand_operand (op, EXPAND_FIXED, x, VOIDmode, false); | |
92 } | |
0 | 93 |
111 | 94 /* Make OP describe an output operand that must have mode MODE. |
95 X, if nonnull, is a suggestion for where the output should be stored. | |
96 It is OK for VALUE to be inconsistent with MODE, although it will just | |
97 be ignored in that case. */ | |
98 | |
99 static inline void | |
100 create_output_operand (struct expand_operand *op, rtx x, | |
101 machine_mode mode) | |
102 { | |
103 create_expand_operand (op, EXPAND_OUTPUT, x, mode, false); | |
104 } | |
0 | 105 |
111 | 106 /* Make OP describe an input operand that must have mode MODE and |
107 value VALUE; MODE cannot be VOIDmode. The backend may request that | |
108 VALUE be copied into a different kind of rtx before being passed | |
109 as an operand. */ | |
110 | |
111 static inline void | |
112 create_input_operand (struct expand_operand *op, rtx value, | |
113 machine_mode mode) | |
114 { | |
115 create_expand_operand (op, EXPAND_INPUT, value, mode, false); | |
116 } | |
117 | |
118 /* Like create_input_operand, except that VALUE must first be converted | |
119 to mode MODE. UNSIGNED_P says whether VALUE is unsigned. */ | |
0 | 120 |
111 | 121 static inline void |
122 create_convert_operand_to (struct expand_operand *op, rtx value, | |
123 machine_mode mode, bool unsigned_p) | |
124 { | |
125 create_expand_operand (op, EXPAND_CONVERT_TO, value, mode, unsigned_p); | |
126 } | |
0 | 127 |
111 | 128 /* Make OP describe an input operand that should have the same value |
129 as VALUE, after any mode conversion that the backend might request. | |
130 If VALUE is a CONST_INT, it should be treated as having mode MODE. | |
131 UNSIGNED_P says whether VALUE is unsigned. */ | |
0 | 132 |
111 | 133 static inline void |
134 create_convert_operand_from (struct expand_operand *op, rtx value, | |
135 machine_mode mode, bool unsigned_p) | |
136 { | |
137 create_expand_operand (op, EXPAND_CONVERT_FROM, value, mode, unsigned_p); | |
138 } | |
0 | 139 |
140 | |
111 | 141 /* Make OP describe an input Pmode address operand. VALUE is the value |
142 of the address, but it may need to be converted to Pmode first. */ | |
0 | 143 |
111 | 144 static inline void |
145 create_address_operand (struct expand_operand *op, rtx value) | |
146 { | |
147 create_expand_operand (op, EXPAND_ADDRESS, value, Pmode, false); | |
148 } | |
0 | 149 |
131 | 150 extern void create_integer_operand (struct expand_operand *, poly_int64); |
0 | 151 |
111 | 152 /* Passed to expand_simple_binop and expand_binop to say which options |
153 to try to use if the requested operation can't be open-coded on the | |
154 requisite mode. Either OPTAB_LIB or OPTAB_LIB_WIDEN says try using | |
155 a library call. Either OPTAB_WIDEN or OPTAB_LIB_WIDEN says try | |
156 using a wider mode. OPTAB_MUST_WIDEN says try widening and don't | |
157 try anything else. */ | |
0 | 158 |
111 | 159 enum optab_methods |
160 { | |
161 OPTAB_DIRECT, | |
162 OPTAB_LIB, | |
163 OPTAB_WIDEN, | |
164 OPTAB_LIB_WIDEN, | |
165 OPTAB_MUST_WIDEN | |
0 | 166 }; |
167 | |
111 | 168 extern rtx expand_widen_pattern_expr (struct separate_ops *, rtx , rtx , rtx, |
169 rtx, int); | |
170 extern rtx expand_ternary_op (machine_mode mode, optab ternary_optab, | |
0 | 171 rtx op0, rtx op1, rtx op2, rtx target, |
172 int unsignedp); | |
111 | 173 extern rtx simplify_expand_binop (machine_mode mode, optab binoptab, |
174 rtx op0, rtx op1, rtx target, int unsignedp, | |
175 enum optab_methods methods); | |
176 extern bool force_expand_binop (machine_mode, optab, rtx, rtx, rtx, int, | |
177 enum optab_methods); | |
131 | 178 extern rtx expand_vector_broadcast (machine_mode, rtx); |
111 | 179 |
180 /* Generate code for a simple binary or unary operation. "Simple" in | |
181 this case means "can be unambiguously described by a (mode, code) | |
182 pair and mapped to a single optab." */ | |
183 extern rtx expand_simple_binop (machine_mode, enum rtx_code, rtx, | |
184 rtx, rtx, int, enum optab_methods); | |
0 | 185 |
186 /* Expand a binary operation given optab and rtx operands. */ | |
111 | 187 extern rtx expand_binop (machine_mode, optab, rtx, rtx, rtx, int, |
0 | 188 enum optab_methods); |
189 | |
190 /* Expand a binary operation with both signed and unsigned forms. */ | |
111 | 191 extern rtx sign_expand_binop (machine_mode, optab, optab, rtx, rtx, |
0 | 192 rtx, int, enum optab_methods); |
193 | |
194 /* Generate code to perform an operation on one operand with two results. */ | |
195 extern int expand_twoval_unop (optab, rtx, rtx, rtx, int); | |
196 | |
197 /* Generate code to perform an operation on two operands with two results. */ | |
198 extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int); | |
199 | |
200 /* Generate code to perform an operation on two operands with two | |
201 results, using a library function. */ | |
202 extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx, | |
203 enum rtx_code); | |
111 | 204 extern rtx expand_simple_unop (machine_mode, enum rtx_code, rtx, rtx, |
205 int); | |
0 | 206 |
207 /* Expand a unary arithmetic operation given optab rtx operand. */ | |
111 | 208 extern rtx expand_unop (machine_mode, optab, rtx, rtx, int); |
0 | 209 |
210 /* Expand the absolute value operation. */ | |
111 | 211 extern rtx expand_abs_nojump (machine_mode, rtx, rtx, int); |
212 extern rtx expand_abs (machine_mode, rtx, rtx, int, int); | |
0 | 213 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
214 /* Expand the one's complement absolute value operation. */ |
111 | 215 extern rtx expand_one_cmpl_abs_nojump (machine_mode, rtx, rtx); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
216 |
0 | 217 /* Expand the copysign operation. */ |
218 extern rtx expand_copysign (rtx, rtx, rtx); | |
219 /* Generate an instruction with a given INSN_CODE with an output and | |
220 an input. */ | |
111 | 221 extern bool maybe_emit_unop_insn (enum insn_code, rtx, rtx, enum rtx_code); |
222 extern void emit_unop_insn (enum insn_code, rtx, rtx, enum rtx_code); | |
0 | 223 |
111 | 224 /* Emit code to make a call to a constant function or a library call. */ |
225 extern void emit_libcall_block (rtx_insn *, rtx, rtx, rtx); | |
0 | 226 |
227 /* The various uses that a comparison can have; used by can_compare_p: | |
228 jumps, conditional moves, store flag operations. */ | |
229 enum can_compare_purpose | |
230 { | |
231 ccp_jump, | |
232 ccp_cmov, | |
233 ccp_store_flag | |
234 }; | |
235 | |
236 /* Nonzero if a compare of mode MODE can be done straightforwardly | |
237 (without splitting it into pieces). */ | |
111 | 238 extern int can_compare_p (enum rtx_code, machine_mode, |
0 | 239 enum can_compare_purpose); |
111 | 240 extern rtx prepare_operand (enum insn_code, rtx, int, machine_mode, |
241 machine_mode, int); | |
242 /* Emit a pair of rtl insns to compare two rtx's and to jump | |
243 to a label if the comparison is true. */ | |
244 extern void emit_cmp_and_jump_insns (rtx, rtx, enum rtx_code, rtx, | |
245 machine_mode, int, rtx, | |
246 profile_probability prob | |
247 = profile_probability::uninitialized ()); | |
248 | |
249 /* Generate code to indirectly jump to a location given in the rtx LOC. */ | |
250 extern void emit_indirect_jump (rtx); | |
251 | |
252 #include "insn-config.h" | |
253 | |
254 #ifndef GCC_INSN_CONFIG_H | |
255 #error "insn-config.h must be included before optabs.h" | |
256 #endif | |
0 | 257 |
111 | 258 /* Emit a conditional move operation. */ |
259 rtx emit_conditional_move (rtx, enum rtx_code, rtx, rtx, machine_mode, | |
260 rtx, rtx, machine_mode, int); | |
261 | |
262 /* Emit a conditional negate or bitwise complement operation. */ | |
263 rtx emit_conditional_neg_or_complement (rtx, rtx_code, machine_mode, rtx, | |
264 rtx, rtx); | |
265 | |
266 rtx emit_conditional_add (rtx, enum rtx_code, rtx, rtx, machine_mode, | |
267 rtx, rtx, machine_mode, int); | |
268 | |
269 /* Create but don't emit one rtl instruction to perform certain operations. | |
270 Modes must match; operands must meet the operation's predicates. | |
271 Likewise for subtraction and for just copying. */ | |
272 extern rtx_insn *gen_add2_insn (rtx, rtx); | |
273 extern rtx_insn *gen_add3_insn (rtx, rtx, rtx); | |
274 extern int have_add2_insn (rtx, rtx); | |
275 extern rtx_insn *gen_addptr3_insn (rtx, rtx, rtx); | |
276 extern int have_addptr3_insn (rtx, rtx, rtx); | |
277 extern rtx_insn *gen_sub2_insn (rtx, rtx); | |
278 extern rtx_insn *gen_sub3_insn (rtx, rtx, rtx); | |
279 extern int have_sub2_insn (rtx, rtx); | |
0 | 280 |
281 /* Generate the body of an insn to extend Y (with mode MFROM) | |
282 into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */ | |
111 | 283 extern rtx_insn *gen_extend_insn (rtx, rtx, machine_mode, machine_mode, int); |
0 | 284 |
285 /* Generate code for a FLOAT_EXPR. */ | |
286 extern void expand_float (rtx, rtx, int); | |
287 | |
288 /* Generate code for a FIX_EXPR. */ | |
289 extern void expand_fix (rtx, rtx, int); | |
290 | |
111 | 291 /* Generate code for a FIXED_CONVERT_EXPR. */ |
292 extern void expand_fixed_convert (rtx, rtx, int, int); | |
293 | |
0 | 294 /* Generate code for float to integral conversion. */ |
295 extern bool expand_sfix_optab (rtx, rtx, convert_optab); | |
296 | |
111 | 297 /* Report whether the machine description contains an insn which can |
298 perform the operation described by CODE and MODE. */ | |
299 extern int have_insn_for (enum rtx_code, machine_mode); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
300 |
111 | 301 /* Generate a conditional trap instruction. */ |
302 extern rtx_insn *gen_cond_trap (enum rtx_code, rtx, rtx, rtx); | |
303 | |
304 /* Generate code for VEC_PERM_EXPR. */ | |
131 | 305 extern rtx expand_vec_perm_var (machine_mode, rtx, rtx, rtx, rtx); |
306 extern rtx expand_vec_perm_const (machine_mode, rtx, rtx, | |
307 const vec_perm_builder &, machine_mode, rtx); | |
111 | 308 |
309 /* Generate code for vector comparison. */ | |
310 extern rtx expand_vec_cmp_expr (tree, tree, rtx); | |
0 | 311 |
312 /* Generate code for VEC_COND_EXPR. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
313 extern rtx expand_vec_cond_expr (tree, tree, tree, tree, rtx); |
0 | 314 |
131 | 315 /* Generate code for VEC_SERIES_EXPR. */ |
316 extern rtx expand_vec_series_expr (machine_mode, rtx, rtx, rtx); | |
317 | |
111 | 318 /* Generate code for MULT_HIGHPART_EXPR. */ |
319 extern rtx expand_mult_highpart (machine_mode, rtx, rtx, rtx, bool); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
320 |
111 | 321 extern rtx expand_sync_lock_test_and_set (rtx, rtx, rtx); |
322 extern rtx expand_atomic_test_and_set (rtx, rtx, enum memmodel); | |
323 extern rtx expand_atomic_exchange (rtx, rtx, rtx, enum memmodel); | |
324 extern bool expand_atomic_compare_and_swap (rtx *, rtx *, rtx, rtx, rtx, bool, | |
325 enum memmodel, enum memmodel); | |
326 /* Generate memory barriers. */ | |
327 extern void expand_mem_thread_fence (enum memmodel); | |
328 extern void expand_mem_signal_fence (enum memmodel); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
329 |
111 | 330 rtx expand_atomic_load (rtx, rtx, enum memmodel); |
331 rtx expand_atomic_store (rtx, rtx, enum memmodel, bool); | |
332 rtx expand_atomic_fetch_op (rtx, rtx, rtx, enum rtx_code, enum memmodel, | |
333 bool); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
334 |
111 | 335 extern bool insn_operand_matches (enum insn_code icode, unsigned int opno, |
336 rtx operand); | |
337 extern bool valid_multiword_target_p (rtx); | |
338 extern void create_convert_operand_from_type (struct expand_operand *op, | |
339 rtx value, tree type); | |
340 extern bool maybe_legitimize_operands (enum insn_code icode, | |
341 unsigned int opno, unsigned int nops, | |
342 struct expand_operand *ops); | |
343 extern rtx_insn *maybe_gen_insn (enum insn_code icode, unsigned int nops, | |
344 struct expand_operand *ops); | |
345 extern bool maybe_expand_insn (enum insn_code icode, unsigned int nops, | |
346 struct expand_operand *ops); | |
347 extern bool maybe_expand_jump_insn (enum insn_code icode, unsigned int nops, | |
348 struct expand_operand *ops); | |
349 extern void expand_insn (enum insn_code icode, unsigned int nops, | |
350 struct expand_operand *ops); | |
351 extern void expand_jump_insn (enum insn_code icode, unsigned int nops, | |
352 struct expand_operand *ops); | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
353 |
111 | 354 extern enum rtx_code get_rtx_code (enum tree_code tcode, bool unsignedp); |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
355 |
0 | 356 #endif /* GCC_OPTABS_H */ |