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