]>
Commit | Line | Data |
---|---|---|
726a989a RB |
1 | /* Gimple IR definitions. |
2 | ||
d1e082c2 | 3 | Copyright (C) 2007-2013 Free Software Foundation, Inc. |
726a989a RB |
4 | Contributed by Aldy Hernandez <aldyh@redhat.com> |
5 | ||
6 | This file is part of GCC. | |
7 | ||
8 | GCC is free software; you can redistribute it and/or modify it under | |
9 | the terms of the GNU General Public License as published by the Free | |
10 | Software Foundation; either version 3, or (at your option) any later | |
11 | version. | |
12 | ||
13 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 | for more details. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #ifndef GCC_GIMPLE_H | |
23 | #define GCC_GIMPLE_H | |
24 | ||
25 | #include "pointer-set.h" | |
4a8fb1a1 | 26 | #include "hash-table.h" |
726a989a RB |
27 | #include "vec.h" |
28 | #include "ggc.h" | |
726a989a | 29 | #include "basic-block.h" |
532aafad | 30 | #include "tree.h" |
726a989a | 31 | #include "tree-ssa-operands.h" |
d086d311 | 32 | #include "tree-ssa-alias.h" |
25583c4f | 33 | #include "internal-fn.h" |
726a989a | 34 | |
355a7673 | 35 | typedef gimple gimple_seq_node; |
cde8534c | 36 | |
475b8f37 DN |
37 | /* Types of supported temporaries. GIMPLE temporaries may be symbols |
38 | in normal form (i.e., regular decls) or SSA names. This enum is | |
39 | used by create_gimple_tmp to tell it what kind of temporary the | |
40 | caller wants. */ | |
41 | enum ssa_mode { | |
42 | M_SSA = 0, | |
43 | M_NORMAL | |
44 | }; | |
45 | ||
f8bf9252 SP |
46 | /* For each block, the PHI nodes that need to be rewritten are stored into |
47 | these vectors. */ | |
9771b263 | 48 | typedef vec<gimple> gimple_vec; |
f8bf9252 | 49 | |
726a989a RB |
50 | enum gimple_code { |
51 | #define DEFGSCODE(SYM, STRING, STRUCT) SYM, | |
52 | #include "gimple.def" | |
53 | #undef DEFGSCODE | |
54 | LAST_AND_UNUSED_GIMPLE_CODE | |
55 | }; | |
56 | ||
57 | extern const char *const gimple_code_name[]; | |
58 | extern const unsigned char gimple_rhs_class_table[]; | |
59 | ||
60 | /* Error out if a gimple tuple is addressed incorrectly. */ | |
61 | #if defined ENABLE_GIMPLE_CHECKING | |
2bc0a660 | 62 | #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR) |
726a989a RB |
63 | extern void gimple_check_failed (const_gimple, const char *, int, \ |
64 | const char *, enum gimple_code, \ | |
65 | enum tree_code) ATTRIBUTE_NORETURN; | |
726a989a RB |
66 | |
67 | #define GIMPLE_CHECK(GS, CODE) \ | |
68 | do { \ | |
69 | const_gimple __gs = (GS); \ | |
70 | if (gimple_code (__gs) != (CODE)) \ | |
71 | gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \ | |
bbbbb16a | 72 | (CODE), ERROR_MARK); \ |
726a989a RB |
73 | } while (0) |
74 | #else /* not ENABLE_GIMPLE_CHECKING */ | |
2bc0a660 | 75 | #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR))) |
726a989a RB |
76 | #define GIMPLE_CHECK(GS, CODE) (void)0 |
77 | #endif | |
78 | ||
79 | /* Class of GIMPLE expressions suitable for the RHS of assignments. See | |
80 | get_gimple_rhs_class. */ | |
81 | enum gimple_rhs_class | |
82 | { | |
83 | GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */ | |
0354c0c7 | 84 | GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */ |
726a989a RB |
85 | GIMPLE_BINARY_RHS, /* The expression is a binary operation. */ |
86 | GIMPLE_UNARY_RHS, /* The expression is a unary operation. */ | |
87 | GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA | |
88 | name, a _DECL, a _REF, etc. */ | |
89 | }; | |
90 | ||
91 | /* Specific flags for individual GIMPLE statements. These flags are | |
92 | always stored in gimple_statement_base.subcode and they may only be | |
93 | defined for statement codes that do not use sub-codes. | |
94 | ||
95 | Values for the masks can overlap as long as the overlapping values | |
96 | are never used in the same statement class. | |
97 | ||
98 | The maximum mask value that can be defined is 1 << 15 (i.e., each | |
99 | statement code can hold up to 16 bitflags). | |
100 | ||
101 | Keep this list sorted. */ | |
102 | enum gf_mask { | |
103 | GF_ASM_INPUT = 1 << 0, | |
104 | GF_ASM_VOLATILE = 1 << 1, | |
89faf322 RG |
105 | GF_CALL_FROM_THUNK = 1 << 0, |
106 | GF_CALL_RETURN_SLOT_OPT = 1 << 1, | |
107 | GF_CALL_TAILCALL = 1 << 2, | |
108 | GF_CALL_VA_ARG_PACK = 1 << 3, | |
109 | GF_CALL_NOTHROW = 1 << 4, | |
110 | GF_CALL_ALLOCA_FOR_VAR = 1 << 5, | |
111 | GF_CALL_INTERNAL = 1 << 6, | |
726a989a | 112 | GF_OMP_PARALLEL_COMBINED = 1 << 0, |
74bf76ed JJ |
113 | GF_OMP_FOR_KIND_MASK = 3 << 0, |
114 | GF_OMP_FOR_KIND_FOR = 0 << 0, | |
115 | GF_OMP_FOR_KIND_SIMD = 1 << 0, | |
726a989a RB |
116 | |
117 | /* True on an GIMPLE_OMP_RETURN statement if the return does not require | |
118 | a thread synchronization via some sort of barrier. The exact barrier | |
119 | that would otherwise be emitted is dependent on the OMP statement with | |
120 | which this return is associated. */ | |
121 | GF_OMP_RETURN_NOWAIT = 1 << 0, | |
122 | ||
123 | GF_OMP_SECTION_LAST = 1 << 0, | |
20906c66 | 124 | GF_OMP_ATOMIC_NEED_VALUE = 1 << 0, |
726a989a RB |
125 | GF_PREDICT_TAKEN = 1 << 15 |
126 | }; | |
127 | ||
ddb555ed | 128 | /* Currently, there are only two types of gimple debug stmt. Others are |
b5b8b0ac AO |
129 | envisioned, for example, to enable the generation of is_stmt notes |
130 | in line number information, to mark sequence points, etc. This | |
131 | subcode is to be used to tell them apart. */ | |
132 | enum gimple_debug_subcode { | |
ddb555ed JJ |
133 | GIMPLE_DEBUG_BIND = 0, |
134 | GIMPLE_DEBUG_SOURCE_BIND = 1 | |
b5b8b0ac AO |
135 | }; |
136 | ||
726a989a RB |
137 | /* Masks for selecting a pass local flag (PLF) to work on. These |
138 | masks are used by gimple_set_plf and gimple_plf. */ | |
139 | enum plf_mask { | |
140 | GF_PLF_1 = 1 << 0, | |
141 | GF_PLF_2 = 1 << 1 | |
142 | }; | |
143 | ||
726a989a RB |
144 | /* Iterator object for GIMPLE statement sequences. */ |
145 | ||
ea679d55 | 146 | struct gimple_stmt_iterator_d |
726a989a RB |
147 | { |
148 | /* Sequence node holding the current statement. */ | |
149 | gimple_seq_node ptr; | |
150 | ||
151 | /* Sequence and basic block holding the statement. These fields | |
152 | are necessary to handle edge cases such as when statement is | |
153 | added to an empty basic block or when the last statement of a | |
154 | block/sequence is removed. */ | |
355a7673 | 155 | gimple_seq *seq; |
726a989a | 156 | basic_block bb; |
ea679d55 | 157 | }; |
726a989a RB |
158 | |
159 | /* Data structure definitions for GIMPLE tuples. NOTE: word markers | |
160 | are for 64 bit hosts. */ | |
161 | ||
d17fd79c | 162 | struct GTY((chain_next ("%h.next"))) gimple_statement_base { |
726a989a RB |
163 | /* [ WORD 1 ] |
164 | Main identifying code for a tuple. */ | |
165 | ENUM_BITFIELD(gimple_code) code : 8; | |
166 | ||
167 | /* Nonzero if a warning should not be emitted on this tuple. */ | |
168 | unsigned int no_warning : 1; | |
169 | ||
170 | /* Nonzero if this tuple has been visited. Passes are responsible | |
171 | for clearing this bit before using it. */ | |
172 | unsigned int visited : 1; | |
173 | ||
174 | /* Nonzero if this tuple represents a non-temporal move. */ | |
175 | unsigned int nontemporal_move : 1; | |
176 | ||
177 | /* Pass local flags. These flags are free for any pass to use as | |
178 | they see fit. Passes should not assume that these flags contain | |
179 | any useful value when the pass starts. Any initial state that | |
180 | the pass requires should be set on entry to the pass. See | |
181 | gimple_set_plf and gimple_plf for usage. */ | |
182 | unsigned int plf : 2; | |
183 | ||
184 | /* Nonzero if this statement has been modified and needs to have its | |
185 | operands rescanned. */ | |
186 | unsigned modified : 1; | |
187 | ||
188 | /* Nonzero if this statement contains volatile operands. */ | |
189 | unsigned has_volatile_ops : 1; | |
190 | ||
726a989a RB |
191 | /* The SUBCODE field can be used for tuple-specific flags for tuples |
192 | that do not require subcodes. Note that SUBCODE should be at | |
193 | least as wide as tree codes, as several tuples store tree codes | |
194 | in there. */ | |
195 | unsigned int subcode : 16; | |
196 | ||
e0e10d3a DN |
197 | /* UID of this statement. This is used by passes that want to |
198 | assign IDs to statements. It must be assigned and used by each | |
199 | pass. By default it should be assumed to contain garbage. */ | |
726a989a RB |
200 | unsigned uid; |
201 | ||
202 | /* [ WORD 2 ] | |
203 | Locus information for debug info. */ | |
204 | location_t location; | |
205 | ||
206 | /* Number of operands in this tuple. */ | |
207 | unsigned num_ops; | |
208 | ||
209 | /* [ WORD 3 ] | |
210 | Basic block holding this statement. */ | |
b8244d74 | 211 | basic_block bb; |
726a989a | 212 | |
355a7673 MM |
213 | /* [ WORD 4-5 ] |
214 | Linked lists of gimple statements. The next pointers form | |
215 | a NULL terminated list, the prev pointers are a cyclic list. | |
216 | A gimple statement is hence also a double-ended list of | |
217 | statements, with the pointer itself being the first element, | |
218 | and the prev pointer being the last. */ | |
219 | gimple next; | |
220 | gimple GTY((skip)) prev; | |
726a989a RB |
221 | }; |
222 | ||
223 | ||
224 | /* Base structure for tuples with operands. */ | |
225 | ||
d1b38208 | 226 | struct GTY(()) gimple_statement_with_ops_base |
726a989a | 227 | { |
355a7673 | 228 | /* [ WORD 1-6 ] */ |
726a989a RB |
229 | struct gimple_statement_base gsbase; |
230 | ||
4b671e64 | 231 | /* [ WORD 7 ] |
726a989a RB |
232 | SSA operand vectors. NOTE: It should be possible to |
233 | amalgamate these vectors with the operand vector OP. However, | |
234 | the SSA operand vectors are organized differently and contain | |
235 | more information (like immediate use chaining). */ | |
726a989a RB |
236 | struct use_optype_d GTY((skip (""))) *use_ops; |
237 | }; | |
238 | ||
239 | ||
240 | /* Statements that take register operands. */ | |
241 | ||
d1b38208 | 242 | struct GTY(()) gimple_statement_with_ops |
726a989a | 243 | { |
4b671e64 | 244 | /* [ WORD 1-7 ] */ |
726a989a RB |
245 | struct gimple_statement_with_ops_base opbase; |
246 | ||
4b671e64 | 247 | /* [ WORD 8 ] |
726a989a RB |
248 | Operand vector. NOTE! This must always be the last field |
249 | of this structure. In particular, this means that this | |
250 | structure cannot be embedded inside another one. */ | |
251 | tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1]; | |
252 | }; | |
253 | ||
254 | ||
255 | /* Base for statements that take both memory and register operands. */ | |
256 | ||
d1b38208 | 257 | struct GTY(()) gimple_statement_with_memory_ops_base |
726a989a | 258 | { |
4b671e64 | 259 | /* [ WORD 1-7 ] */ |
726a989a RB |
260 | struct gimple_statement_with_ops_base opbase; |
261 | ||
4b671e64 | 262 | /* [ WORD 8-9 ] |
5006671f RG |
263 | Virtual operands for this statement. The GC will pick them |
264 | up via the ssa_names array. */ | |
265 | tree GTY((skip (""))) vdef; | |
266 | tree GTY((skip (""))) vuse; | |
726a989a RB |
267 | }; |
268 | ||
269 | ||
270 | /* Statements that take both memory and register operands. */ | |
271 | ||
d1b38208 | 272 | struct GTY(()) gimple_statement_with_memory_ops |
726a989a | 273 | { |
4b671e64 | 274 | /* [ WORD 1-9 ] */ |
726a989a RB |
275 | struct gimple_statement_with_memory_ops_base membase; |
276 | ||
4b671e64 | 277 | /* [ WORD 10 ] |
726a989a RB |
278 | Operand vector. NOTE! This must always be the last field |
279 | of this structure. In particular, this means that this | |
280 | structure cannot be embedded inside another one. */ | |
281 | tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1]; | |
282 | }; | |
283 | ||
284 | ||
d086d311 RG |
285 | /* Call statements that take both memory and register operands. */ |
286 | ||
287 | struct GTY(()) gimple_statement_call | |
288 | { | |
4b671e64 | 289 | /* [ WORD 1-9 ] */ |
d086d311 RG |
290 | struct gimple_statement_with_memory_ops_base membase; |
291 | ||
4b671e64 | 292 | /* [ WORD 10-13 ] */ |
d086d311 RG |
293 | struct pt_solution call_used; |
294 | struct pt_solution call_clobbered; | |
295 | ||
4b671e64 | 296 | /* [ WORD 14 ] */ |
25583c4f RS |
297 | union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) { |
298 | tree GTY ((tag ("0"))) fntype; | |
299 | enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn; | |
300 | } u; | |
f20ca725 | 301 | |
4b671e64 | 302 | /* [ WORD 15 ] |
d086d311 RG |
303 | Operand vector. NOTE! This must always be the last field |
304 | of this structure. In particular, this means that this | |
305 | structure cannot be embedded inside another one. */ | |
306 | tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1]; | |
307 | }; | |
308 | ||
309 | ||
726a989a RB |
310 | /* OpenMP statements (#pragma omp). */ |
311 | ||
d1b38208 | 312 | struct GTY(()) gimple_statement_omp { |
355a7673 | 313 | /* [ WORD 1-6 ] */ |
726a989a RB |
314 | struct gimple_statement_base gsbase; |
315 | ||
355a7673 | 316 | /* [ WORD 7 ] */ |
726a989a RB |
317 | gimple_seq body; |
318 | }; | |
319 | ||
320 | ||
321 | /* GIMPLE_BIND */ | |
322 | ||
d1b38208 | 323 | struct GTY(()) gimple_statement_bind { |
355a7673 | 324 | /* [ WORD 1-6 ] */ |
726a989a RB |
325 | struct gimple_statement_base gsbase; |
326 | ||
355a7673 | 327 | /* [ WORD 7 ] |
726a989a RB |
328 | Variables declared in this scope. */ |
329 | tree vars; | |
330 | ||
355a7673 | 331 | /* [ WORD 8 ] |
726a989a RB |
332 | This is different than the BLOCK field in gimple_statement_base, |
333 | which is analogous to TREE_BLOCK (i.e., the lexical block holding | |
334 | this statement). This field is the equivalent of BIND_EXPR_BLOCK | |
335 | in tree land (i.e., the lexical scope defined by this bind). See | |
336 | gimple-low.c. */ | |
337 | tree block; | |
338 | ||
355a7673 | 339 | /* [ WORD 9 ] */ |
726a989a RB |
340 | gimple_seq body; |
341 | }; | |
342 | ||
343 | ||
344 | /* GIMPLE_CATCH */ | |
345 | ||
d1b38208 | 346 | struct GTY(()) gimple_statement_catch { |
355a7673 | 347 | /* [ WORD 1-6 ] */ |
726a989a RB |
348 | struct gimple_statement_base gsbase; |
349 | ||
355a7673 | 350 | /* [ WORD 7 ] */ |
726a989a RB |
351 | tree types; |
352 | ||
355a7673 | 353 | /* [ WORD 8 ] */ |
726a989a RB |
354 | gimple_seq handler; |
355 | }; | |
356 | ||
357 | ||
358 | /* GIMPLE_EH_FILTER */ | |
359 | ||
d1b38208 | 360 | struct GTY(()) gimple_statement_eh_filter { |
355a7673 | 361 | /* [ WORD 1-6 ] */ |
726a989a RB |
362 | struct gimple_statement_base gsbase; |
363 | ||
355a7673 | 364 | /* [ WORD 7 ] |
726a989a RB |
365 | Filter types. */ |
366 | tree types; | |
367 | ||
355a7673 | 368 | /* [ WORD 8 ] |
726a989a RB |
369 | Failure actions. */ |
370 | gimple_seq failure; | |
371 | }; | |
372 | ||
0a35513e AH |
373 | /* GIMPLE_EH_ELSE */ |
374 | ||
375 | struct GTY(()) gimple_statement_eh_else { | |
355a7673 | 376 | /* [ WORD 1-6 ] */ |
0a35513e AH |
377 | struct gimple_statement_base gsbase; |
378 | ||
355a7673 | 379 | /* [ WORD 7,8 ] */ |
0a35513e AH |
380 | gimple_seq n_body, e_body; |
381 | }; | |
726a989a | 382 | |
1d65f45c RH |
383 | /* GIMPLE_EH_MUST_NOT_THROW */ |
384 | ||
385 | struct GTY(()) gimple_statement_eh_mnt { | |
355a7673 | 386 | /* [ WORD 1-6 ] */ |
1d65f45c RH |
387 | struct gimple_statement_base gsbase; |
388 | ||
355a7673 | 389 | /* [ WORD 7 ] Abort function decl. */ |
1d65f45c RH |
390 | tree fndecl; |
391 | }; | |
392 | ||
726a989a RB |
393 | /* GIMPLE_PHI */ |
394 | ||
d1b38208 | 395 | struct GTY(()) gimple_statement_phi { |
355a7673 | 396 | /* [ WORD 1-6 ] */ |
726a989a RB |
397 | struct gimple_statement_base gsbase; |
398 | ||
355a7673 | 399 | /* [ WORD 7 ] */ |
726a989a RB |
400 | unsigned capacity; |
401 | unsigned nargs; | |
402 | ||
355a7673 | 403 | /* [ WORD 8 ] */ |
726a989a RB |
404 | tree result; |
405 | ||
355a7673 | 406 | /* [ WORD 9 ] */ |
726a989a RB |
407 | struct phi_arg_d GTY ((length ("%h.nargs"))) args[1]; |
408 | }; | |
409 | ||
410 | ||
1d65f45c | 411 | /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */ |
726a989a | 412 | |
1d65f45c RH |
413 | struct GTY(()) gimple_statement_eh_ctrl |
414 | { | |
355a7673 | 415 | /* [ WORD 1-6 ] */ |
726a989a RB |
416 | struct gimple_statement_base gsbase; |
417 | ||
355a7673 | 418 | /* [ WORD 7 ] |
726a989a RB |
419 | Exception region number. */ |
420 | int region; | |
421 | }; | |
422 | ||
423 | ||
424 | /* GIMPLE_TRY */ | |
425 | ||
d1b38208 | 426 | struct GTY(()) gimple_statement_try { |
355a7673 | 427 | /* [ WORD 1-6 ] */ |
726a989a RB |
428 | struct gimple_statement_base gsbase; |
429 | ||
355a7673 | 430 | /* [ WORD 7 ] |
726a989a RB |
431 | Expression to evaluate. */ |
432 | gimple_seq eval; | |
433 | ||
355a7673 | 434 | /* [ WORD 8 ] |
726a989a RB |
435 | Cleanup expression. */ |
436 | gimple_seq cleanup; | |
437 | }; | |
438 | ||
439 | /* Kind of GIMPLE_TRY statements. */ | |
440 | enum gimple_try_flags | |
441 | { | |
442 | /* A try/catch. */ | |
443 | GIMPLE_TRY_CATCH = 1 << 0, | |
444 | ||
445 | /* A try/finally. */ | |
446 | GIMPLE_TRY_FINALLY = 1 << 1, | |
447 | GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY, | |
448 | ||
449 | /* Analogous to TRY_CATCH_IS_CLEANUP. */ | |
450 | GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2 | |
451 | }; | |
452 | ||
453 | /* GIMPLE_WITH_CLEANUP_EXPR */ | |
454 | ||
d1b38208 | 455 | struct GTY(()) gimple_statement_wce { |
355a7673 | 456 | /* [ WORD 1-6 ] */ |
726a989a RB |
457 | struct gimple_statement_base gsbase; |
458 | ||
459 | /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be | |
460 | executed if an exception is thrown, not on normal exit of its | |
461 | scope. This flag is analogous to the CLEANUP_EH_ONLY flag | |
462 | in TARGET_EXPRs. */ | |
463 | ||
355a7673 | 464 | /* [ WORD 7 ] |
726a989a RB |
465 | Cleanup expression. */ |
466 | gimple_seq cleanup; | |
467 | }; | |
468 | ||
469 | ||
470 | /* GIMPLE_ASM */ | |
471 | ||
d1b38208 | 472 | struct GTY(()) gimple_statement_asm |
726a989a | 473 | { |
4b671e64 | 474 | /* [ WORD 1-9 ] */ |
726a989a RB |
475 | struct gimple_statement_with_memory_ops_base membase; |
476 | ||
4b671e64 | 477 | /* [ WORD 10 ] |
726a989a RB |
478 | __asm__ statement. */ |
479 | const char *string; | |
480 | ||
4b671e64 | 481 | /* [ WORD 11 ] |
1c384bf1 | 482 | Number of inputs, outputs, clobbers, labels. */ |
726a989a RB |
483 | unsigned char ni; |
484 | unsigned char no; | |
1c384bf1 RH |
485 | unsigned char nc; |
486 | unsigned char nl; | |
726a989a | 487 | |
4b671e64 | 488 | /* [ WORD 12 ] |
726a989a RB |
489 | Operand vector. NOTE! This must always be the last field |
490 | of this structure. In particular, this means that this | |
491 | structure cannot be embedded inside another one. */ | |
492 | tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1]; | |
493 | }; | |
494 | ||
495 | /* GIMPLE_OMP_CRITICAL */ | |
496 | ||
d1b38208 | 497 | struct GTY(()) gimple_statement_omp_critical { |
355a7673 | 498 | /* [ WORD 1-7 ] */ |
726a989a RB |
499 | struct gimple_statement_omp omp; |
500 | ||
355a7673 | 501 | /* [ WORD 8 ] |
726a989a RB |
502 | Critical section name. */ |
503 | tree name; | |
504 | }; | |
505 | ||
506 | ||
d1b38208 | 507 | struct GTY(()) gimple_omp_for_iter { |
726a989a RB |
508 | /* Condition code. */ |
509 | enum tree_code cond; | |
510 | ||
511 | /* Index variable. */ | |
512 | tree index; | |
b8698a0f | 513 | |
726a989a RB |
514 | /* Initial value. */ |
515 | tree initial; | |
516 | ||
517 | /* Final value. */ | |
518 | tree final; | |
b8698a0f | 519 | |
726a989a RB |
520 | /* Increment. */ |
521 | tree incr; | |
522 | }; | |
523 | ||
524 | /* GIMPLE_OMP_FOR */ | |
525 | ||
d1b38208 | 526 | struct GTY(()) gimple_statement_omp_for { |
355a7673 | 527 | /* [ WORD 1-7 ] */ |
726a989a RB |
528 | struct gimple_statement_omp omp; |
529 | ||
355a7673 | 530 | /* [ WORD 8 ] */ |
726a989a RB |
531 | tree clauses; |
532 | ||
355a7673 | 533 | /* [ WORD 9 ] |
726a989a RB |
534 | Number of elements in iter array. */ |
535 | size_t collapse; | |
536 | ||
355a7673 | 537 | /* [ WORD 10 ] */ |
726a989a RB |
538 | struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter; |
539 | ||
355a7673 | 540 | /* [ WORD 11 ] |
726a989a RB |
541 | Pre-body evaluated before the loop body begins. */ |
542 | gimple_seq pre_body; | |
543 | }; | |
544 | ||
545 | ||
546 | /* GIMPLE_OMP_PARALLEL */ | |
547 | ||
d1b38208 | 548 | struct GTY(()) gimple_statement_omp_parallel { |
355a7673 | 549 | /* [ WORD 1-7 ] */ |
726a989a RB |
550 | struct gimple_statement_omp omp; |
551 | ||
355a7673 | 552 | /* [ WORD 8 ] |
726a989a RB |
553 | Clauses. */ |
554 | tree clauses; | |
555 | ||
355a7673 | 556 | /* [ WORD 9 ] |
726a989a RB |
557 | Child function holding the body of the parallel region. */ |
558 | tree child_fn; | |
559 | ||
355a7673 | 560 | /* [ WORD 10 ] |
726a989a RB |
561 | Shared data argument. */ |
562 | tree data_arg; | |
563 | }; | |
564 | ||
565 | ||
566 | /* GIMPLE_OMP_TASK */ | |
567 | ||
d1b38208 | 568 | struct GTY(()) gimple_statement_omp_task { |
355a7673 | 569 | /* [ WORD 1-10 ] */ |
726a989a RB |
570 | struct gimple_statement_omp_parallel par; |
571 | ||
355a7673 | 572 | /* [ WORD 11 ] |
726a989a RB |
573 | Child function holding firstprivate initialization if needed. */ |
574 | tree copy_fn; | |
575 | ||
355a7673 | 576 | /* [ WORD 12-13 ] |
726a989a RB |
577 | Size and alignment in bytes of the argument data block. */ |
578 | tree arg_size; | |
579 | tree arg_align; | |
580 | }; | |
581 | ||
582 | ||
583 | /* GIMPLE_OMP_SECTION */ | |
584 | /* Uses struct gimple_statement_omp. */ | |
585 | ||
586 | ||
587 | /* GIMPLE_OMP_SECTIONS */ | |
588 | ||
d1b38208 | 589 | struct GTY(()) gimple_statement_omp_sections { |
355a7673 | 590 | /* [ WORD 1-7 ] */ |
726a989a RB |
591 | struct gimple_statement_omp omp; |
592 | ||
355a7673 | 593 | /* [ WORD 8 ] */ |
726a989a RB |
594 | tree clauses; |
595 | ||
355a7673 | 596 | /* [ WORD 9 ] |
726a989a RB |
597 | The control variable used for deciding which of the sections to |
598 | execute. */ | |
599 | tree control; | |
600 | }; | |
601 | ||
602 | /* GIMPLE_OMP_CONTINUE. | |
603 | ||
604 | Note: This does not inherit from gimple_statement_omp, because we | |
605 | do not need the body field. */ | |
606 | ||
d1b38208 | 607 | struct GTY(()) gimple_statement_omp_continue { |
355a7673 | 608 | /* [ WORD 1-6 ] */ |
726a989a RB |
609 | struct gimple_statement_base gsbase; |
610 | ||
355a7673 | 611 | /* [ WORD 7 ] */ |
726a989a RB |
612 | tree control_def; |
613 | ||
355a7673 | 614 | /* [ WORD 8 ] */ |
726a989a RB |
615 | tree control_use; |
616 | }; | |
617 | ||
618 | /* GIMPLE_OMP_SINGLE */ | |
619 | ||
d1b38208 | 620 | struct GTY(()) gimple_statement_omp_single { |
355a7673 | 621 | /* [ WORD 1-7 ] */ |
726a989a RB |
622 | struct gimple_statement_omp omp; |
623 | ||
355a7673 | 624 | /* [ WORD 7 ] */ |
726a989a RB |
625 | tree clauses; |
626 | }; | |
627 | ||
628 | ||
b8698a0f | 629 | /* GIMPLE_OMP_ATOMIC_LOAD. |
726a989a RB |
630 | Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp |
631 | contains a sequence, which we don't need here. */ | |
632 | ||
d1b38208 | 633 | struct GTY(()) gimple_statement_omp_atomic_load { |
355a7673 | 634 | /* [ WORD 1-6 ] */ |
726a989a RB |
635 | struct gimple_statement_base gsbase; |
636 | ||
355a7673 | 637 | /* [ WORD 7-8 ] */ |
726a989a RB |
638 | tree rhs, lhs; |
639 | }; | |
640 | ||
641 | /* GIMPLE_OMP_ATOMIC_STORE. | |
642 | See note on GIMPLE_OMP_ATOMIC_LOAD. */ | |
643 | ||
d1b38208 | 644 | struct GTY(()) gimple_statement_omp_atomic_store { |
355a7673 | 645 | /* [ WORD 1-6 ] */ |
726a989a RB |
646 | struct gimple_statement_base gsbase; |
647 | ||
355a7673 | 648 | /* [ WORD 7 ] */ |
726a989a RB |
649 | tree val; |
650 | }; | |
651 | ||
0a35513e AH |
652 | /* GIMPLE_TRANSACTION. */ |
653 | ||
654 | /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */ | |
655 | ||
656 | /* The __transaction_atomic was declared [[outer]] or it is | |
657 | __transaction_relaxed. */ | |
658 | #define GTMA_IS_OUTER (1u << 0) | |
659 | #define GTMA_IS_RELAXED (1u << 1) | |
660 | #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED) | |
661 | ||
662 | /* The transaction is seen to not have an abort. */ | |
663 | #define GTMA_HAVE_ABORT (1u << 2) | |
664 | /* The transaction is seen to have loads or stores. */ | |
665 | #define GTMA_HAVE_LOAD (1u << 3) | |
666 | #define GTMA_HAVE_STORE (1u << 4) | |
667 | /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */ | |
668 | #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5) | |
669 | /* The transaction WILL enter serial irrevocable mode. | |
670 | An irrevocable block post-dominates the entire transaction, such | |
671 | that all invocations of the transaction will go serial-irrevocable. | |
672 | In such case, we don't bother instrumenting the transaction, and | |
673 | tell the runtime that it should begin the transaction in | |
674 | serial-irrevocable mode. */ | |
675 | #define GTMA_DOES_GO_IRREVOCABLE (1u << 6) | |
b7a78683 AH |
676 | /* The transaction contains no instrumentation code whatsover, most |
677 | likely because it is guaranteed to go irrevocable upon entry. */ | |
678 | #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7) | |
0a35513e AH |
679 | |
680 | struct GTY(()) gimple_statement_transaction | |
681 | { | |
4b671e64 | 682 | /* [ WORD 1-9 ] */ |
0a35513e AH |
683 | struct gimple_statement_with_memory_ops_base gsbase; |
684 | ||
4b671e64 | 685 | /* [ WORD 10 ] */ |
0a35513e AH |
686 | gimple_seq body; |
687 | ||
4b671e64 | 688 | /* [ WORD 11 ] */ |
0a35513e AH |
689 | tree label; |
690 | }; | |
691 | ||
f2c4a81c | 692 | #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM, |
726a989a | 693 | enum gimple_statement_structure_enum { |
726a989a | 694 | #include "gsstruct.def" |
726a989a RB |
695 | LAST_GSS_ENUM |
696 | }; | |
f2c4a81c | 697 | #undef DEFGSSTRUCT |
726a989a RB |
698 | |
699 | ||
700 | /* Define the overall contents of a gimple tuple. It may be any of the | |
701 | structures declared above for various types of tuples. */ | |
702 | ||
355a7673 MM |
703 | union GTY ((desc ("gimple_statement_structure (&%h)"), |
704 | chain_next ("%h.gsbase.next"), variable_size)) gimple_statement_d { | |
726a989a RB |
705 | struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase; |
706 | struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops; | |
bb4efb4d | 707 | struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase; |
726a989a | 708 | struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem; |
d086d311 | 709 | struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call; |
726a989a RB |
710 | struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp; |
711 | struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind; | |
712 | struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch; | |
713 | struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter; | |
1d65f45c | 714 | struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt; |
0a35513e | 715 | struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else; |
726a989a | 716 | struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi; |
1d65f45c | 717 | struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl; |
726a989a RB |
718 | struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try; |
719 | struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce; | |
720 | struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm; | |
721 | struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical; | |
722 | struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for; | |
723 | struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel; | |
724 | struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task; | |
725 | struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections; | |
726 | struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single; | |
727 | struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue; | |
728 | struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load; | |
729 | struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store; | |
0a35513e | 730 | struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction; |
726a989a RB |
731 | }; |
732 | ||
f2c4a81c RH |
733 | /* Offset in bytes to the location of the operand vector. |
734 | Zero if there is no operand vector for this tuple structure. */ | |
735 | extern size_t const gimple_ops_offset_[]; | |
736 | ||
737 | /* Map GIMPLE codes to GSS codes. */ | |
738 | extern enum gimple_statement_structure_enum const gss_for_code_[]; | |
739 | ||
a5883ba0 MM |
740 | /* This variable holds the currently expanded gimple statement for purposes |
741 | of comminucating the profile info to the builtin expanders. */ | |
742 | extern gimple currently_expanding_gimple_stmt; | |
743 | ||
726a989a RB |
744 | gimple gimple_build_return (tree); |
745 | ||
746 | gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL); | |
747 | #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO) | |
748 | ||
0354c0c7 | 749 | void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *); |
726a989a | 750 | |
73804b12 RG |
751 | gimple |
752 | gimple_build_assign_with_ops (enum tree_code, tree, | |
753 | tree, tree CXX_MEM_STAT_INFO); | |
754 | gimple | |
755 | gimple_build_assign_with_ops (enum tree_code, tree, | |
756 | tree, tree, tree CXX_MEM_STAT_INFO); | |
726a989a | 757 | |
b5b8b0ac AO |
758 | gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL); |
759 | #define gimple_build_debug_bind(var,val,stmt) \ | |
760 | gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO) | |
ddb555ed JJ |
761 | gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL); |
762 | #define gimple_build_debug_source_bind(var,val,stmt) \ | |
763 | gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO) | |
b5b8b0ac | 764 | |
9771b263 | 765 | gimple gimple_build_call_vec (tree, vec<tree> ); |
726a989a | 766 | gimple gimple_build_call (tree, unsigned, ...); |
21860814 | 767 | gimple gimple_build_call_valist (tree, unsigned, va_list); |
25583c4f | 768 | gimple gimple_build_call_internal (enum internal_fn, unsigned, ...); |
9771b263 | 769 | gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> ); |
726a989a RB |
770 | gimple gimple_build_call_from_tree (tree); |
771 | gimple gimplify_assign (tree, tree, gimple_seq *); | |
772 | gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree); | |
773 | gimple gimple_build_label (tree label); | |
774 | gimple gimple_build_goto (tree dest); | |
775 | gimple gimple_build_nop (void); | |
776 | gimple gimple_build_bind (tree, gimple_seq, tree); | |
9771b263 DN |
777 | gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *, |
778 | vec<tree, va_gc> *, vec<tree, va_gc> *, | |
779 | vec<tree, va_gc> *); | |
726a989a RB |
780 | gimple gimple_build_catch (tree, gimple_seq); |
781 | gimple gimple_build_eh_filter (tree, gimple_seq); | |
1d65f45c | 782 | gimple gimple_build_eh_must_not_throw (tree); |
0a35513e | 783 | gimple gimple_build_eh_else (gimple_seq, gimple_seq); |
cb4ad180 | 784 | gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags); |
726a989a RB |
785 | gimple gimple_build_wce (gimple_seq); |
786 | gimple gimple_build_resx (int); | |
1d65f45c RH |
787 | gimple gimple_build_eh_dispatch (int); |
788 | gimple gimple_build_switch_nlabels (unsigned, tree, tree); | |
9771b263 | 789 | gimple gimple_build_switch (tree, tree, vec<tree> ); |
726a989a RB |
790 | gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree); |
791 | gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree); | |
74bf76ed | 792 | gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq); |
726a989a RB |
793 | gimple gimple_build_omp_critical (gimple_seq, tree); |
794 | gimple gimple_build_omp_section (gimple_seq); | |
795 | gimple gimple_build_omp_continue (tree, tree); | |
796 | gimple gimple_build_omp_master (gimple_seq); | |
797 | gimple gimple_build_omp_return (bool); | |
798 | gimple gimple_build_omp_ordered (gimple_seq); | |
799 | gimple gimple_build_omp_sections (gimple_seq, tree); | |
800 | gimple gimple_build_omp_sections_switch (void); | |
801 | gimple gimple_build_omp_single (gimple_seq, tree); | |
802 | gimple gimple_build_cdt (tree, tree); | |
803 | gimple gimple_build_omp_atomic_load (tree, tree); | |
804 | gimple gimple_build_omp_atomic_store (tree); | |
0a35513e | 805 | gimple gimple_build_transaction (gimple_seq, tree); |
726a989a | 806 | gimple gimple_build_predict (enum br_predictor, enum prediction); |
726a989a | 807 | enum gimple_statement_structure_enum gss_for_assign (enum tree_code); |
9771b263 DN |
808 | void sort_case_labels (vec<tree> ); |
809 | void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *); | |
726a989a RB |
810 | void gimple_set_body (tree, gimple_seq); |
811 | gimple_seq gimple_body (tree); | |
39ecc018 | 812 | bool gimple_has_body_p (tree); |
726a989a RB |
813 | gimple_seq gimple_seq_alloc (void); |
814 | void gimple_seq_free (gimple_seq); | |
815 | void gimple_seq_add_seq (gimple_seq *, gimple_seq); | |
816 | gimple_seq gimple_seq_copy (gimple_seq); | |
25583c4f | 817 | bool gimple_call_same_target_p (const_gimple, const_gimple); |
726a989a | 818 | int gimple_call_flags (const_gimple); |
0b7b376d RG |
819 | int gimple_call_return_flags (const_gimple); |
820 | int gimple_call_arg_flags (const_gimple, unsigned); | |
d086d311 | 821 | void gimple_call_reset_alias_info (gimple); |
726a989a RB |
822 | bool gimple_assign_copy_p (gimple); |
823 | bool gimple_assign_ssa_name_copy_p (gimple); | |
726a989a | 824 | bool gimple_assign_unary_nop_p (gimple); |
b8244d74 | 825 | void gimple_set_bb (gimple, basic_block); |
726a989a | 826 | void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); |
0354c0c7 BS |
827 | void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code, |
828 | tree, tree, tree); | |
726a989a RB |
829 | tree gimple_get_lhs (const_gimple); |
830 | void gimple_set_lhs (gimple, tree); | |
21cf7180 | 831 | void gimple_replace_lhs (gimple, tree); |
726a989a | 832 | gimple gimple_copy (gimple); |
726a989a RB |
833 | void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *); |
834 | gimple gimple_build_cond_from_tree (tree, tree, tree); | |
835 | void gimple_cond_set_condition_from_tree (gimple, tree); | |
836 | bool gimple_has_side_effects (const_gimple); | |
726a989a | 837 | bool gimple_could_trap_p (gimple); |
e1fd038a | 838 | bool gimple_could_trap_p_1 (gimple, bool, bool); |
726a989a RB |
839 | bool gimple_assign_rhs_could_trap_p (gimple); |
840 | void gimple_regimplify_operands (gimple, gimple_stmt_iterator *); | |
841 | bool empty_body_p (gimple_seq); | |
842 | unsigned get_gimple_rhs_num_ops (enum tree_code); | |
d7f09764 DN |
843 | #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO) |
844 | gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL); | |
4537ec0c | 845 | const char *gimple_decl_printable_name (tree, int); |
81fa35bd | 846 | tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree); |
c49bdb2e | 847 | tree gimple_extract_devirt_binfo_from_cst (tree, tree); |
726a989a | 848 | |
726a989a RB |
849 | /* Returns true iff T is a scalar register variable. */ |
850 | extern bool is_gimple_reg (tree); | |
726a989a RB |
851 | /* Returns true iff T is any sort of variable. */ |
852 | extern bool is_gimple_variable (tree); | |
853 | /* Returns true iff T is any sort of symbol. */ | |
854 | extern bool is_gimple_id (tree); | |
855 | /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */ | |
856 | extern bool is_gimple_min_lval (tree); | |
857 | /* Returns true iff T is something whose address can be taken. */ | |
858 | extern bool is_gimple_addressable (tree); | |
859 | /* Returns true iff T is any valid GIMPLE lvalue. */ | |
860 | extern bool is_gimple_lvalue (tree); | |
861 | ||
862 | /* Returns true iff T is a GIMPLE address. */ | |
863 | bool is_gimple_address (const_tree); | |
864 | /* Returns true iff T is a GIMPLE invariant address. */ | |
865 | bool is_gimple_invariant_address (const_tree); | |
00fc2333 JH |
866 | /* Returns true iff T is a GIMPLE invariant address at interprocedural |
867 | level. */ | |
868 | bool is_gimple_ip_invariant_address (const_tree); | |
726a989a RB |
869 | /* Returns true iff T is a valid GIMPLE constant. */ |
870 | bool is_gimple_constant (const_tree); | |
871 | /* Returns true iff T is a GIMPLE restricted function invariant. */ | |
872 | extern bool is_gimple_min_invariant (const_tree); | |
00fc2333 JH |
873 | /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */ |
874 | extern bool is_gimple_ip_invariant (const_tree); | |
726a989a RB |
875 | /* Returns true iff T is a GIMPLE rvalue. */ |
876 | extern bool is_gimple_val (tree); | |
877 | /* Returns true iff T is a GIMPLE asm statement input. */ | |
878 | extern bool is_gimple_asm_val (tree); | |
70f34814 RG |
879 | /* Returns true iff T is a valid address operand of a MEM_REF. */ |
880 | bool is_gimple_mem_ref_addr (tree); | |
726a989a RB |
881 | |
882 | /* Returns true iff T is a valid if-statement condition. */ | |
883 | extern bool is_gimple_condexpr (tree); | |
884 | ||
726a989a RB |
885 | /* Returns true iff T is a valid call address expression. */ |
886 | extern bool is_gimple_call_addr (tree); | |
726a989a | 887 | |
25ae5027 DS |
888 | /* Return TRUE iff stmt is a call to a built-in function. */ |
889 | extern bool is_gimple_builtin_call (gimple stmt); | |
890 | ||
726a989a | 891 | extern void recalculate_side_effects (tree); |
d025732d | 892 | extern bool gimple_compare_field_offset (tree, tree); |
4490cae6 | 893 | extern tree gimple_register_canonical_type (tree); |
b8f4e58f | 894 | extern void print_gimple_types_stats (const char *); |
0d0bfe17 | 895 | extern void free_gimple_type_tables (void); |
d7f09764 DN |
896 | extern tree gimple_unsigned_type (tree); |
897 | extern tree gimple_signed_type (tree); | |
898 | extern alias_set_type gimple_get_alias_set (tree); | |
346ef3fa RG |
899 | extern bool walk_stmt_load_store_addr_ops (gimple, void *, |
900 | bool (*)(gimple, tree, void *), | |
901 | bool (*)(gimple, tree, void *), | |
902 | bool (*)(gimple, tree, void *)); | |
903 | extern bool walk_stmt_load_store_ops (gimple, void *, | |
904 | bool (*)(gimple, tree, void *), | |
905 | bool (*)(gimple, tree, void *)); | |
ccacdf06 | 906 | extern bool gimple_ior_addresses_taken (bitmap, gimple); |
3626621a | 907 | extern bool gimple_call_builtin_p (gimple, enum built_in_class); |
c54c785d | 908 | extern bool gimple_call_builtin_p (gimple, enum built_in_function); |
edcdea5b | 909 | extern bool gimple_asm_clobbers_memory_p (const_gimple); |
7a300452 AM |
910 | extern bool useless_type_conversion_p (tree, tree); |
911 | extern bool types_compatible_p (tree, tree); | |
726a989a RB |
912 | |
913 | /* In gimplify.c */ | |
914 | extern tree create_tmp_var_raw (tree, const char *); | |
915 | extern tree create_tmp_var_name (const char *); | |
916 | extern tree create_tmp_var (tree, const char *); | |
acd63801 | 917 | extern tree create_tmp_reg (tree, const char *); |
726a989a RB |
918 | extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *); |
919 | extern tree get_formal_tmp_var (tree, gimple_seq *); | |
920 | extern void declare_vars (tree, gimple, bool); | |
726a989a RB |
921 | extern void annotate_all_with_location (gimple_seq, location_t); |
922 | ||
923 | /* Validation of GIMPLE expressions. Note that these predicates only check | |
924 | the basic form of the expression, they don't recurse to make sure that | |
925 | underlying nodes are also of the right form. */ | |
926 | typedef bool (*gimple_predicate)(tree); | |
927 | ||
928 | ||
929 | /* FIXME we should deduce this from the predicate. */ | |
bbbbb16a | 930 | enum fallback { |
726a989a RB |
931 | fb_none = 0, /* Do not generate a temporary. */ |
932 | ||
933 | fb_rvalue = 1, /* Generate an rvalue to hold the result of a | |
934 | gimplified expression. */ | |
935 | ||
936 | fb_lvalue = 2, /* Generate an lvalue to hold the result of a | |
937 | gimplified expression. */ | |
938 | ||
939 | fb_mayfail = 4, /* Gimplification may fail. Error issued | |
940 | afterwards. */ | |
941 | fb_either= fb_rvalue | fb_lvalue | |
bbbbb16a ILT |
942 | }; |
943 | ||
944 | typedef int fallback_t; | |
726a989a RB |
945 | |
946 | enum gimplify_status { | |
947 | GS_ERROR = -2, /* Something Bad Seen. */ | |
948 | GS_UNHANDLED = -1, /* A langhook result for "I dunno". */ | |
949 | GS_OK = 0, /* We did something, maybe more to do. */ | |
950 | GS_ALL_DONE = 1 /* The expression is fully gimplified. */ | |
951 | }; | |
952 | ||
4a8fb1a1 LC |
953 | /* Formal (expression) temporary table handling: multiple occurrences of |
954 | the same scalar expression are evaluated into the same temporary. */ | |
955 | ||
956 | typedef struct gimple_temp_hash_elt | |
957 | { | |
958 | tree val; /* Key */ | |
959 | tree temp; /* Value */ | |
960 | } elt_t; | |
961 | ||
962 | /* Gimplify hashtable helper. */ | |
963 | ||
964 | struct gimplify_hasher : typed_free_remove <elt_t> | |
965 | { | |
966 | typedef elt_t value_type; | |
967 | typedef elt_t compare_type; | |
968 | static inline hashval_t hash (const value_type *); | |
969 | static inline bool equal (const value_type *, const compare_type *); | |
970 | }; | |
971 | ||
972 | inline hashval_t | |
973 | gimplify_hasher::hash (const value_type *p) | |
974 | { | |
975 | tree t = p->val; | |
976 | return iterative_hash_expr (t, 0); | |
977 | } | |
978 | ||
979 | inline bool | |
980 | gimplify_hasher::equal (const value_type *p1, const compare_type *p2) | |
981 | { | |
982 | tree t1 = p1->val; | |
983 | tree t2 = p2->val; | |
984 | enum tree_code code = TREE_CODE (t1); | |
985 | ||
986 | if (TREE_CODE (t2) != code | |
987 | || TREE_TYPE (t1) != TREE_TYPE (t2)) | |
988 | return false; | |
989 | ||
990 | if (!operand_equal_p (t1, t2, 0)) | |
991 | return false; | |
992 | ||
993 | #ifdef ENABLE_CHECKING | |
994 | /* Only allow them to compare equal if they also hash equal; otherwise | |
995 | results are nondeterminate, and we fail bootstrap comparison. */ | |
996 | gcc_assert (hash (p1) == hash (p2)); | |
997 | #endif | |
998 | ||
999 | return true; | |
1000 | } | |
1001 | ||
726a989a RB |
1002 | struct gimplify_ctx |
1003 | { | |
1004 | struct gimplify_ctx *prev_context; | |
1005 | ||
9771b263 | 1006 | vec<gimple> bind_expr_stack; |
726a989a RB |
1007 | tree temps; |
1008 | gimple_seq conditional_cleanups; | |
1009 | tree exit_label; | |
1010 | tree return_temp; | |
b8698a0f | 1011 | |
9771b263 | 1012 | vec<tree> case_labels; |
726a989a | 1013 | /* The formal temporary table. Should this be persistent? */ |
4a8fb1a1 | 1014 | hash_table <gimplify_hasher> temp_htab; |
726a989a RB |
1015 | |
1016 | int conditions; | |
1017 | bool save_stack; | |
1018 | bool into_ssa; | |
1019 | bool allow_rhs_cond_expr; | |
32be32af | 1020 | bool in_cleanup_point_expr; |
726a989a RB |
1021 | }; |
1022 | ||
848be094 JJ |
1023 | /* Return true if gimplify_one_sizepos doesn't need to gimplify |
1024 | expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize | |
1025 | fields). */ | |
1026 | static inline bool | |
1027 | is_gimple_sizepos (tree expr) | |
1028 | { | |
1029 | /* gimplify_one_sizepos doesn't need to do anything if the value isn't there, | |
1030 | is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do | |
1031 | anything if it's already a VAR_DECL. If it's a VAR_DECL from another | |
1032 | function, the gimplifier will want to replace it with a new variable, | |
1033 | but that will cause problems if this type is from outside the function. | |
1034 | It's OK to have that here. */ | |
1035 | return (expr == NULL_TREE | |
1036 | || TREE_CONSTANT (expr) | |
1037 | || TREE_CODE (expr) == VAR_DECL | |
1038 | || CONTAINS_PLACEHOLDER_P (expr)); | |
1039 | } | |
1040 | ||
726a989a RB |
1041 | extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *, |
1042 | bool (*) (tree), fallback_t); | |
1043 | extern void gimplify_type_sizes (tree, gimple_seq *); | |
1044 | extern void gimplify_one_sizepos (tree *, gimple_seq *); | |
cc3c4f62 RB |
1045 | enum gimplify_status gimplify_self_mod_expr (tree *, gimple_seq *, gimple_seq *, |
1046 | bool, tree); | |
726a989a | 1047 | extern bool gimplify_stmt (tree *, gimple_seq *); |
3ad065ef | 1048 | extern gimple gimplify_body (tree, bool); |
726a989a RB |
1049 | extern void push_gimplify_context (struct gimplify_ctx *); |
1050 | extern void pop_gimplify_context (gimple); | |
1051 | extern void gimplify_and_add (tree, gimple_seq *); | |
1052 | ||
1053 | /* Miscellaneous helpers. */ | |
1054 | extern void gimple_add_tmp_var (tree); | |
1055 | extern gimple gimple_current_bind_expr (void); | |
9771b263 | 1056 | extern vec<gimple> gimple_bind_expr_stack (void); |
726a989a RB |
1057 | extern tree voidify_wrapper_expr (tree, tree); |
1058 | extern tree build_and_jump (tree *); | |
726a989a RB |
1059 | extern tree force_labels_r (tree *, int *, void *); |
1060 | extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *, | |
1061 | gimple_seq *); | |
1062 | struct gimplify_omp_ctx; | |
1063 | extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree); | |
1064 | extern tree gimple_boolify (tree); | |
1065 | extern gimple_predicate rhs_predicate_for (tree); | |
1066 | extern tree canonicalize_cond_expr_cond (tree); | |
1067 | ||
1068 | /* In omp-low.c. */ | |
726a989a RB |
1069 | extern tree omp_reduction_init (tree, tree); |
1070 | ||
0a35513e AH |
1071 | /* In trans-mem.c. */ |
1072 | extern void diagnose_tm_safe_errors (tree); | |
19c0d7df | 1073 | extern void compute_transaction_bits (void); |
0a35513e | 1074 | |
726a989a RB |
1075 | /* In tree-nested.c. */ |
1076 | extern void lower_nested_functions (tree); | |
1077 | extern void insert_field_into_struct (tree, tree); | |
1078 | ||
1079 | /* In gimplify.c. */ | |
1080 | extern void gimplify_function_tree (tree); | |
1081 | ||
1082 | /* In cfgexpand.c. */ | |
1083 | extern tree gimple_assign_rhs_to_tree (gimple); | |
1084 | ||
1085 | /* In builtins.c */ | |
1086 | extern bool validate_gimple_arglist (const_gimple, ...); | |
1087 | ||
e91d0adb JL |
1088 | /* In tree-ssa-coalesce.c */ |
1089 | extern bool gimple_can_coalesce_p (tree, tree); | |
1090 | ||
355a7673 MM |
1091 | /* Return the first node in GIMPLE sequence S. */ |
1092 | ||
1093 | static inline gimple_seq_node | |
3e8b732e | 1094 | gimple_seq_first (gimple_seq s) |
355a7673 MM |
1095 | { |
1096 | return s; | |
1097 | } | |
1098 | ||
1099 | ||
1100 | /* Return the first statement in GIMPLE sequence S. */ | |
1101 | ||
1102 | static inline gimple | |
3e8b732e | 1103 | gimple_seq_first_stmt (gimple_seq s) |
355a7673 MM |
1104 | { |
1105 | gimple_seq_node n = gimple_seq_first (s); | |
1106 | return n; | |
1107 | } | |
1108 | ||
1109 | ||
1110 | /* Return the last node in GIMPLE sequence S. */ | |
1111 | ||
1112 | static inline gimple_seq_node | |
3e8b732e | 1113 | gimple_seq_last (gimple_seq s) |
355a7673 MM |
1114 | { |
1115 | return s ? s->gsbase.prev : NULL; | |
1116 | } | |
1117 | ||
1118 | ||
1119 | /* Return the last statement in GIMPLE sequence S. */ | |
1120 | ||
1121 | static inline gimple | |
3e8b732e | 1122 | gimple_seq_last_stmt (gimple_seq s) |
355a7673 MM |
1123 | { |
1124 | gimple_seq_node n = gimple_seq_last (s); | |
1125 | return n; | |
1126 | } | |
1127 | ||
1128 | ||
1129 | /* Set the last node in GIMPLE sequence *PS to LAST. */ | |
1130 | ||
1131 | static inline void | |
1132 | gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last) | |
1133 | { | |
1134 | (*ps)->gsbase.prev = last; | |
1135 | } | |
1136 | ||
1137 | ||
1138 | /* Set the first node in GIMPLE sequence *PS to FIRST. */ | |
1139 | ||
1140 | static inline void | |
1141 | gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first) | |
1142 | { | |
1143 | *ps = first; | |
1144 | } | |
1145 | ||
1146 | ||
1147 | /* Return true if GIMPLE sequence S is empty. */ | |
1148 | ||
1149 | static inline bool | |
3e8b732e | 1150 | gimple_seq_empty_p (gimple_seq s) |
355a7673 MM |
1151 | { |
1152 | return s == NULL; | |
1153 | } | |
1154 | ||
355a7673 MM |
1155 | void gimple_seq_add_stmt (gimple_seq *, gimple); |
1156 | ||
1157 | /* Link gimple statement GS to the end of the sequence *SEQ_P. If | |
1158 | *SEQ_P is NULL, a new sequence is allocated. This function is | |
1159 | similar to gimple_seq_add_stmt, but does not scan the operands. | |
1160 | During gimplification, we need to manipulate statement sequences | |
1161 | before the def/use vectors have been constructed. */ | |
1162 | void gimple_seq_add_stmt_without_update (gimple_seq *, gimple); | |
1163 | ||
1164 | /* Allocate a new sequence and initialize its first element with STMT. */ | |
1165 | ||
1166 | static inline gimple_seq | |
1167 | gimple_seq_alloc_with_stmt (gimple stmt) | |
1168 | { | |
1169 | gimple_seq seq = NULL; | |
1170 | gimple_seq_add_stmt (&seq, stmt); | |
1171 | return seq; | |
1172 | } | |
1173 | ||
1174 | ||
1175 | /* Returns the sequence of statements in BB. */ | |
1176 | ||
1177 | static inline gimple_seq | |
1178 | bb_seq (const_basic_block bb) | |
1179 | { | |
3e8b732e | 1180 | return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL; |
355a7673 MM |
1181 | } |
1182 | ||
1183 | static inline gimple_seq * | |
3e8b732e | 1184 | bb_seq_addr (basic_block bb) |
355a7673 | 1185 | { |
3e8b732e | 1186 | return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL; |
355a7673 MM |
1187 | } |
1188 | ||
1189 | /* Sets the sequence of statements in BB to SEQ. */ | |
1190 | ||
1191 | static inline void | |
1192 | set_bb_seq (basic_block bb, gimple_seq seq) | |
1193 | { | |
1194 | gcc_checking_assert (!(bb->flags & BB_RTL)); | |
3e8b732e | 1195 | bb->il.gimple.seq = seq; |
355a7673 MM |
1196 | } |
1197 | ||
1198 | ||
726a989a RB |
1199 | /* Return the code for GIMPLE statement G. */ |
1200 | ||
1201 | static inline enum gimple_code | |
1202 | gimple_code (const_gimple g) | |
1203 | { | |
1204 | return g->gsbase.code; | |
1205 | } | |
1206 | ||
1207 | ||
f2c4a81c RH |
1208 | /* Return the GSS code used by a GIMPLE code. */ |
1209 | ||
1210 | static inline enum gimple_statement_structure_enum | |
1211 | gss_for_code (enum gimple_code code) | |
1212 | { | |
2bc0a660 | 1213 | gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE); |
f2c4a81c RH |
1214 | return gss_for_code_[code]; |
1215 | } | |
1216 | ||
1217 | ||
1218 | /* Return which GSS code is used by GS. */ | |
1219 | ||
1220 | static inline enum gimple_statement_structure_enum | |
1221 | gimple_statement_structure (gimple gs) | |
1222 | { | |
1223 | return gss_for_code (gimple_code (gs)); | |
1224 | } | |
1225 | ||
1226 | ||
726a989a RB |
1227 | /* Return true if statement G has sub-statements. This is only true for |
1228 | High GIMPLE statements. */ | |
1229 | ||
1230 | static inline bool | |
1231 | gimple_has_substatements (gimple g) | |
1232 | { | |
1233 | switch (gimple_code (g)) | |
1234 | { | |
1235 | case GIMPLE_BIND: | |
1236 | case GIMPLE_CATCH: | |
1237 | case GIMPLE_EH_FILTER: | |
0a35513e | 1238 | case GIMPLE_EH_ELSE: |
726a989a RB |
1239 | case GIMPLE_TRY: |
1240 | case GIMPLE_OMP_FOR: | |
1241 | case GIMPLE_OMP_MASTER: | |
1242 | case GIMPLE_OMP_ORDERED: | |
1243 | case GIMPLE_OMP_SECTION: | |
1244 | case GIMPLE_OMP_PARALLEL: | |
1245 | case GIMPLE_OMP_TASK: | |
1246 | case GIMPLE_OMP_SECTIONS: | |
1247 | case GIMPLE_OMP_SINGLE: | |
05a26161 | 1248 | case GIMPLE_OMP_CRITICAL: |
726a989a | 1249 | case GIMPLE_WITH_CLEANUP_EXPR: |
0a35513e | 1250 | case GIMPLE_TRANSACTION: |
726a989a RB |
1251 | return true; |
1252 | ||
1253 | default: | |
1254 | return false; | |
1255 | } | |
1256 | } | |
b8698a0f | 1257 | |
726a989a RB |
1258 | |
1259 | /* Return the basic block holding statement G. */ | |
1260 | ||
b8244d74 | 1261 | static inline basic_block |
726a989a RB |
1262 | gimple_bb (const_gimple g) |
1263 | { | |
1264 | return g->gsbase.bb; | |
1265 | } | |
1266 | ||
1267 | ||
1268 | /* Return the lexical scope block holding statement G. */ | |
1269 | ||
1270 | static inline tree | |
1271 | gimple_block (const_gimple g) | |
1272 | { | |
5368224f | 1273 | return LOCATION_BLOCK (g->gsbase.location); |
726a989a RB |
1274 | } |
1275 | ||
1276 | ||
1277 | /* Set BLOCK to be the lexical scope block holding statement G. */ | |
1278 | ||
1279 | static inline void | |
1280 | gimple_set_block (gimple g, tree block) | |
1281 | { | |
5368224f DC |
1282 | if (block) |
1283 | g->gsbase.location = | |
1284 | COMBINE_LOCATION_DATA (line_table, g->gsbase.location, block); | |
1285 | else | |
1286 | g->gsbase.location = LOCATION_LOCUS (g->gsbase.location); | |
726a989a RB |
1287 | } |
1288 | ||
1289 | ||
1290 | /* Return location information for statement G. */ | |
1291 | ||
1292 | static inline location_t | |
1293 | gimple_location (const_gimple g) | |
1294 | { | |
1295 | return g->gsbase.location; | |
1296 | } | |
1297 | ||
1298 | /* Return pointer to location information for statement G. */ | |
1299 | ||
1300 | static inline const location_t * | |
1301 | gimple_location_ptr (const_gimple g) | |
1302 | { | |
1303 | return &g->gsbase.location; | |
1304 | } | |
1305 | ||
1306 | ||
1307 | /* Set location information for statement G. */ | |
1308 | ||
1309 | static inline void | |
1310 | gimple_set_location (gimple g, location_t location) | |
1311 | { | |
1312 | g->gsbase.location = location; | |
1313 | } | |
1314 | ||
1315 | ||
1316 | /* Return true if G contains location information. */ | |
1317 | ||
1318 | static inline bool | |
1319 | gimple_has_location (const_gimple g) | |
1320 | { | |
2f13f2de | 1321 | return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION; |
726a989a RB |
1322 | } |
1323 | ||
1324 | ||
1325 | /* Return the file name of the location of STMT. */ | |
1326 | ||
1327 | static inline const char * | |
1328 | gimple_filename (const_gimple stmt) | |
1329 | { | |
1330 | return LOCATION_FILE (gimple_location (stmt)); | |
1331 | } | |
1332 | ||
1333 | ||
1334 | /* Return the line number of the location of STMT. */ | |
1335 | ||
1336 | static inline int | |
1337 | gimple_lineno (const_gimple stmt) | |
1338 | { | |
1339 | return LOCATION_LINE (gimple_location (stmt)); | |
1340 | } | |
1341 | ||
1342 | ||
1343 | /* Determine whether SEQ is a singleton. */ | |
1344 | ||
1345 | static inline bool | |
1346 | gimple_seq_singleton_p (gimple_seq seq) | |
1347 | { | |
1348 | return ((gimple_seq_first (seq) != NULL) | |
1349 | && (gimple_seq_first (seq) == gimple_seq_last (seq))); | |
1350 | } | |
1351 | ||
1352 | /* Return true if no warnings should be emitted for statement STMT. */ | |
1353 | ||
1354 | static inline bool | |
1355 | gimple_no_warning_p (const_gimple stmt) | |
1356 | { | |
1357 | return stmt->gsbase.no_warning; | |
1358 | } | |
1359 | ||
1360 | /* Set the no_warning flag of STMT to NO_WARNING. */ | |
1361 | ||
1362 | static inline void | |
1363 | gimple_set_no_warning (gimple stmt, bool no_warning) | |
1364 | { | |
1365 | stmt->gsbase.no_warning = (unsigned) no_warning; | |
1366 | } | |
1367 | ||
1368 | /* Set the visited status on statement STMT to VISITED_P. */ | |
1369 | ||
1370 | static inline void | |
1371 | gimple_set_visited (gimple stmt, bool visited_p) | |
1372 | { | |
1373 | stmt->gsbase.visited = (unsigned) visited_p; | |
1374 | } | |
1375 | ||
1376 | ||
1377 | /* Return the visited status for statement STMT. */ | |
1378 | ||
1379 | static inline bool | |
1380 | gimple_visited_p (gimple stmt) | |
1381 | { | |
1382 | return stmt->gsbase.visited; | |
1383 | } | |
1384 | ||
1385 | ||
1386 | /* Set pass local flag PLF on statement STMT to VAL_P. */ | |
1387 | ||
1388 | static inline void | |
1389 | gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p) | |
1390 | { | |
1391 | if (val_p) | |
1392 | stmt->gsbase.plf |= (unsigned int) plf; | |
1393 | else | |
1394 | stmt->gsbase.plf &= ~((unsigned int) plf); | |
1395 | } | |
1396 | ||
1397 | ||
1398 | /* Return the value of pass local flag PLF on statement STMT. */ | |
1399 | ||
1400 | static inline unsigned int | |
1401 | gimple_plf (gimple stmt, enum plf_mask plf) | |
1402 | { | |
1403 | return stmt->gsbase.plf & ((unsigned int) plf); | |
1404 | } | |
1405 | ||
1406 | ||
e0e10d3a | 1407 | /* Set the UID of statement. */ |
726a989a RB |
1408 | |
1409 | static inline void | |
1410 | gimple_set_uid (gimple g, unsigned uid) | |
1411 | { | |
1412 | g->gsbase.uid = uid; | |
1413 | } | |
1414 | ||
1415 | ||
e0e10d3a | 1416 | /* Return the UID of statement. */ |
726a989a RB |
1417 | |
1418 | static inline unsigned | |
1419 | gimple_uid (const_gimple g) | |
1420 | { | |
1421 | return g->gsbase.uid; | |
1422 | } | |
1423 | ||
1424 | ||
355a7673 MM |
1425 | /* Make statement G a singleton sequence. */ |
1426 | ||
1427 | static inline void | |
1428 | gimple_init_singleton (gimple g) | |
1429 | { | |
1430 | g->gsbase.next = NULL; | |
1431 | g->gsbase.prev = g; | |
1432 | } | |
1433 | ||
1434 | ||
726a989a RB |
1435 | /* Return true if GIMPLE statement G has register or memory operands. */ |
1436 | ||
1437 | static inline bool | |
1438 | gimple_has_ops (const_gimple g) | |
1439 | { | |
1440 | return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN; | |
1441 | } | |
1442 | ||
1443 | ||
1444 | /* Return true if GIMPLE statement G has memory operands. */ | |
1445 | ||
1446 | static inline bool | |
1447 | gimple_has_mem_ops (const_gimple g) | |
1448 | { | |
1449 | return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN; | |
1450 | } | |
1451 | ||
726a989a | 1452 | |
726a989a RB |
1453 | /* Return the set of USE operands for statement G. */ |
1454 | ||
1455 | static inline struct use_optype_d * | |
1456 | gimple_use_ops (const_gimple g) | |
1457 | { | |
1458 | if (!gimple_has_ops (g)) | |
1459 | return NULL; | |
1460 | return g->gsops.opbase.use_ops; | |
1461 | } | |
1462 | ||
1463 | ||
1464 | /* Set USE to be the set of USE operands for statement G. */ | |
1465 | ||
1466 | static inline void | |
1467 | gimple_set_use_ops (gimple g, struct use_optype_d *use) | |
1468 | { | |
2bc0a660 | 1469 | gcc_gimple_checking_assert (gimple_has_ops (g)); |
726a989a RB |
1470 | g->gsops.opbase.use_ops = use; |
1471 | } | |
1472 | ||
1473 | ||
5006671f | 1474 | /* Return the set of VUSE operand for statement G. */ |
726a989a | 1475 | |
5006671f RG |
1476 | static inline use_operand_p |
1477 | gimple_vuse_op (const_gimple g) | |
726a989a | 1478 | { |
5006671f | 1479 | struct use_optype_d *ops; |
726a989a | 1480 | if (!gimple_has_mem_ops (g)) |
5006671f RG |
1481 | return NULL_USE_OPERAND_P; |
1482 | ops = g->gsops.opbase.use_ops; | |
1483 | if (ops | |
bb4efb4d | 1484 | && USE_OP_PTR (ops)->use == &g->gsmembase.vuse) |
5006671f RG |
1485 | return USE_OP_PTR (ops); |
1486 | return NULL_USE_OPERAND_P; | |
726a989a RB |
1487 | } |
1488 | ||
5006671f | 1489 | /* Return the set of VDEF operand for statement G. */ |
726a989a | 1490 | |
5006671f | 1491 | static inline def_operand_p |
4b671e64 | 1492 | gimple_vdef_op (gimple g) |
726a989a | 1493 | { |
5006671f RG |
1494 | if (!gimple_has_mem_ops (g)) |
1495 | return NULL_DEF_OPERAND_P; | |
4b671e64 MM |
1496 | if (g->gsmembase.vdef) |
1497 | return &g->gsmembase.vdef; | |
5006671f | 1498 | return NULL_DEF_OPERAND_P; |
726a989a RB |
1499 | } |
1500 | ||
1501 | ||
5006671f | 1502 | /* Return the single VUSE operand of the statement G. */ |
726a989a | 1503 | |
5006671f RG |
1504 | static inline tree |
1505 | gimple_vuse (const_gimple g) | |
726a989a RB |
1506 | { |
1507 | if (!gimple_has_mem_ops (g)) | |
5006671f | 1508 | return NULL_TREE; |
bb4efb4d | 1509 | return g->gsmembase.vuse; |
726a989a RB |
1510 | } |
1511 | ||
5006671f | 1512 | /* Return the single VDEF operand of the statement G. */ |
726a989a | 1513 | |
5006671f RG |
1514 | static inline tree |
1515 | gimple_vdef (const_gimple g) | |
726a989a | 1516 | { |
5006671f RG |
1517 | if (!gimple_has_mem_ops (g)) |
1518 | return NULL_TREE; | |
bb4efb4d | 1519 | return g->gsmembase.vdef; |
726a989a RB |
1520 | } |
1521 | ||
5006671f | 1522 | /* Return the single VUSE operand of the statement G. */ |
726a989a | 1523 | |
5006671f RG |
1524 | static inline tree * |
1525 | gimple_vuse_ptr (gimple g) | |
726a989a RB |
1526 | { |
1527 | if (!gimple_has_mem_ops (g)) | |
1528 | return NULL; | |
bb4efb4d | 1529 | return &g->gsmembase.vuse; |
726a989a RB |
1530 | } |
1531 | ||
5006671f | 1532 | /* Return the single VDEF operand of the statement G. */ |
726a989a | 1533 | |
5006671f RG |
1534 | static inline tree * |
1535 | gimple_vdef_ptr (gimple g) | |
726a989a RB |
1536 | { |
1537 | if (!gimple_has_mem_ops (g)) | |
1538 | return NULL; | |
bb4efb4d | 1539 | return &g->gsmembase.vdef; |
5006671f RG |
1540 | } |
1541 | ||
1542 | /* Set the single VUSE operand of the statement G. */ | |
1543 | ||
1544 | static inline void | |
1545 | gimple_set_vuse (gimple g, tree vuse) | |
1546 | { | |
2bc0a660 | 1547 | gcc_gimple_checking_assert (gimple_has_mem_ops (g)); |
bb4efb4d | 1548 | g->gsmembase.vuse = vuse; |
5006671f RG |
1549 | } |
1550 | ||
1551 | /* Set the single VDEF operand of the statement G. */ | |
1552 | ||
1553 | static inline void | |
1554 | gimple_set_vdef (gimple g, tree vdef) | |
1555 | { | |
2bc0a660 | 1556 | gcc_gimple_checking_assert (gimple_has_mem_ops (g)); |
bb4efb4d | 1557 | g->gsmembase.vdef = vdef; |
726a989a RB |
1558 | } |
1559 | ||
1560 | ||
1561 | /* Return true if statement G has operands and the modified field has | |
1562 | been set. */ | |
1563 | ||
1564 | static inline bool | |
1565 | gimple_modified_p (const_gimple g) | |
1566 | { | |
1567 | return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false; | |
1568 | } | |
1569 | ||
726a989a | 1570 | |
a02f0c5d RG |
1571 | /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has |
1572 | a MODIFIED field. */ | |
1573 | ||
1574 | static inline void | |
1575 | gimple_set_modified (gimple s, bool modifiedp) | |
1576 | { | |
1577 | if (gimple_has_ops (s)) | |
1578 | s->gsbase.modified = (unsigned) modifiedp; | |
1579 | } | |
1580 | ||
1581 | ||
726a989a RB |
1582 | /* Return the tree code for the expression computed by STMT. This is |
1583 | only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For | |
1584 | GIMPLE_CALL, return CALL_EXPR as the expression code for | |
1585 | consistency. This is useful when the caller needs to deal with the | |
1586 | three kinds of computation that GIMPLE supports. */ | |
1587 | ||
1588 | static inline enum tree_code | |
1589 | gimple_expr_code (const_gimple stmt) | |
1590 | { | |
1591 | enum gimple_code code = gimple_code (stmt); | |
1592 | if (code == GIMPLE_ASSIGN || code == GIMPLE_COND) | |
1593 | return (enum tree_code) stmt->gsbase.subcode; | |
726a989a | 1594 | else |
b074e783 JH |
1595 | { |
1596 | gcc_gimple_checking_assert (code == GIMPLE_CALL); | |
1597 | return CALL_EXPR; | |
1598 | } | |
726a989a RB |
1599 | } |
1600 | ||
1601 | ||
1602 | /* Mark statement S as modified, and update it. */ | |
1603 | ||
1604 | static inline void | |
1605 | update_stmt (gimple s) | |
1606 | { | |
1607 | if (gimple_has_ops (s)) | |
1608 | { | |
1609 | gimple_set_modified (s, true); | |
1610 | update_stmt_operands (s); | |
1611 | } | |
1612 | } | |
1613 | ||
1614 | /* Update statement S if it has been optimized. */ | |
1615 | ||
1616 | static inline void | |
1617 | update_stmt_if_modified (gimple s) | |
1618 | { | |
1619 | if (gimple_modified_p (s)) | |
1620 | update_stmt_operands (s); | |
1621 | } | |
1622 | ||
1623 | /* Return true if statement STMT contains volatile operands. */ | |
1624 | ||
1625 | static inline bool | |
1626 | gimple_has_volatile_ops (const_gimple stmt) | |
1627 | { | |
1628 | if (gimple_has_mem_ops (stmt)) | |
1629 | return stmt->gsbase.has_volatile_ops; | |
1630 | else | |
1631 | return false; | |
1632 | } | |
1633 | ||
1634 | ||
1635 | /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */ | |
1636 | ||
1637 | static inline void | |
1638 | gimple_set_has_volatile_ops (gimple stmt, bool volatilep) | |
1639 | { | |
1640 | if (gimple_has_mem_ops (stmt)) | |
1641 | stmt->gsbase.has_volatile_ops = (unsigned) volatilep; | |
1642 | } | |
1643 | ||
039496da AH |
1644 | /* Return true if BB is in a transaction. */ |
1645 | ||
1646 | static inline bool | |
1647 | block_in_transaction (basic_block bb) | |
1648 | { | |
874a3589 | 1649 | return flag_tm && bb->flags & BB_IN_TRANSACTION; |
039496da AH |
1650 | } |
1651 | ||
19c0d7df AH |
1652 | /* Return true if STMT is in a transaction. */ |
1653 | ||
1654 | static inline bool | |
1655 | gimple_in_transaction (gimple stmt) | |
1656 | { | |
039496da | 1657 | return block_in_transaction (gimple_bb (stmt)); |
19c0d7df | 1658 | } |
726a989a RB |
1659 | |
1660 | /* Return true if statement STMT may access memory. */ | |
1661 | ||
1662 | static inline bool | |
1663 | gimple_references_memory_p (gimple stmt) | |
1664 | { | |
5006671f | 1665 | return gimple_has_mem_ops (stmt) && gimple_vuse (stmt); |
726a989a RB |
1666 | } |
1667 | ||
1668 | ||
726a989a RB |
1669 | /* Return the subcode for OMP statement S. */ |
1670 | ||
1671 | static inline unsigned | |
1672 | gimple_omp_subcode (const_gimple s) | |
1673 | { | |
2bc0a660 | 1674 | gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD |
726a989a RB |
1675 | && gimple_code (s) <= GIMPLE_OMP_SINGLE); |
1676 | return s->gsbase.subcode; | |
1677 | } | |
1678 | ||
1679 | /* Set the subcode for OMP statement S to SUBCODE. */ | |
1680 | ||
1681 | static inline void | |
1682 | gimple_omp_set_subcode (gimple s, unsigned int subcode) | |
1683 | { | |
1684 | /* We only have 16 bits for the subcode. Assert that we are not | |
1685 | overflowing it. */ | |
2bc0a660 | 1686 | gcc_gimple_checking_assert (subcode < (1 << 16)); |
726a989a RB |
1687 | s->gsbase.subcode = subcode; |
1688 | } | |
1689 | ||
1690 | /* Set the nowait flag on OMP_RETURN statement S. */ | |
1691 | ||
1692 | static inline void | |
1693 | gimple_omp_return_set_nowait (gimple s) | |
1694 | { | |
1695 | GIMPLE_CHECK (s, GIMPLE_OMP_RETURN); | |
1696 | s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT; | |
1697 | } | |
1698 | ||
1699 | ||
1700 | /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT | |
1701 | flag set. */ | |
1702 | ||
1703 | static inline bool | |
1704 | gimple_omp_return_nowait_p (const_gimple g) | |
1705 | { | |
1706 | GIMPLE_CHECK (g, GIMPLE_OMP_RETURN); | |
1707 | return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0; | |
1708 | } | |
1709 | ||
1710 | ||
1711 | /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST | |
1712 | flag set. */ | |
1713 | ||
1714 | static inline bool | |
1715 | gimple_omp_section_last_p (const_gimple g) | |
1716 | { | |
1717 | GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); | |
1718 | return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0; | |
1719 | } | |
1720 | ||
1721 | ||
1722 | /* Set the GF_OMP_SECTION_LAST flag on G. */ | |
1723 | ||
1724 | static inline void | |
1725 | gimple_omp_section_set_last (gimple g) | |
1726 | { | |
1727 | GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); | |
1728 | g->gsbase.subcode |= GF_OMP_SECTION_LAST; | |
1729 | } | |
1730 | ||
1731 | ||
1732 | /* Return true if OMP parallel statement G has the | |
1733 | GF_OMP_PARALLEL_COMBINED flag set. */ | |
1734 | ||
1735 | static inline bool | |
1736 | gimple_omp_parallel_combined_p (const_gimple g) | |
1737 | { | |
1738 | GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); | |
1739 | return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0; | |
1740 | } | |
1741 | ||
1742 | ||
1743 | /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean | |
1744 | value of COMBINED_P. */ | |
1745 | ||
1746 | static inline void | |
1747 | gimple_omp_parallel_set_combined_p (gimple g, bool combined_p) | |
1748 | { | |
1749 | GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); | |
1750 | if (combined_p) | |
1751 | g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED; | |
1752 | else | |
1753 | g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED; | |
1754 | } | |
1755 | ||
1756 | ||
20906c66 JJ |
1757 | /* Return true if OMP atomic load/store statement G has the |
1758 | GF_OMP_ATOMIC_NEED_VALUE flag set. */ | |
1759 | ||
1760 | static inline bool | |
1761 | gimple_omp_atomic_need_value_p (const_gimple g) | |
1762 | { | |
1763 | if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) | |
1764 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
1765 | return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0; | |
1766 | } | |
1767 | ||
1768 | ||
1769 | /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */ | |
1770 | ||
1771 | static inline void | |
1772 | gimple_omp_atomic_set_need_value (gimple g) | |
1773 | { | |
1774 | if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD) | |
1775 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
1776 | g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE; | |
1777 | } | |
1778 | ||
1779 | ||
726a989a RB |
1780 | /* Return the number of operands for statement GS. */ |
1781 | ||
1782 | static inline unsigned | |
1783 | gimple_num_ops (const_gimple gs) | |
1784 | { | |
1785 | return gs->gsbase.num_ops; | |
1786 | } | |
1787 | ||
1788 | ||
1789 | /* Set the number of operands for statement GS. */ | |
1790 | ||
1791 | static inline void | |
1792 | gimple_set_num_ops (gimple gs, unsigned num_ops) | |
1793 | { | |
1794 | gs->gsbase.num_ops = num_ops; | |
1795 | } | |
1796 | ||
1797 | ||
1798 | /* Return the array of operands for statement GS. */ | |
1799 | ||
1800 | static inline tree * | |
1801 | gimple_ops (gimple gs) | |
1802 | { | |
f2c4a81c | 1803 | size_t off; |
726a989a RB |
1804 | |
1805 | /* All the tuples have their operand vector at the very bottom | |
f2c4a81c RH |
1806 | of the structure. Note that those structures that do not |
1807 | have an operand vector have a zero offset. */ | |
1808 | off = gimple_ops_offset_[gimple_statement_structure (gs)]; | |
2bc0a660 | 1809 | gcc_gimple_checking_assert (off != 0); |
f2c4a81c RH |
1810 | |
1811 | return (tree *) ((char *) gs + off); | |
726a989a RB |
1812 | } |
1813 | ||
1814 | ||
1815 | /* Return operand I for statement GS. */ | |
1816 | ||
1817 | static inline tree | |
1818 | gimple_op (const_gimple gs, unsigned i) | |
1819 | { | |
1820 | if (gimple_has_ops (gs)) | |
1821 | { | |
2bc0a660 | 1822 | gcc_gimple_checking_assert (i < gimple_num_ops (gs)); |
726a989a RB |
1823 | return gimple_ops (CONST_CAST_GIMPLE (gs))[i]; |
1824 | } | |
1825 | else | |
1826 | return NULL_TREE; | |
1827 | } | |
1828 | ||
1829 | /* Return a pointer to operand I for statement GS. */ | |
1830 | ||
1831 | static inline tree * | |
1832 | gimple_op_ptr (const_gimple gs, unsigned i) | |
1833 | { | |
1834 | if (gimple_has_ops (gs)) | |
1835 | { | |
2bc0a660 | 1836 | gcc_gimple_checking_assert (i < gimple_num_ops (gs)); |
726a989a RB |
1837 | return gimple_ops (CONST_CAST_GIMPLE (gs)) + i; |
1838 | } | |
1839 | else | |
1840 | return NULL; | |
1841 | } | |
1842 | ||
1843 | /* Set operand I of statement GS to OP. */ | |
1844 | ||
1845 | static inline void | |
1846 | gimple_set_op (gimple gs, unsigned i, tree op) | |
1847 | { | |
2bc0a660 | 1848 | gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); |
726a989a RB |
1849 | |
1850 | /* Note. It may be tempting to assert that OP matches | |
1851 | is_gimple_operand, but that would be wrong. Different tuples | |
1852 | accept slightly different sets of tree operands. Each caller | |
1853 | should perform its own validation. */ | |
1854 | gimple_ops (gs)[i] = op; | |
1855 | } | |
1856 | ||
1857 | /* Return true if GS is a GIMPLE_ASSIGN. */ | |
1858 | ||
1859 | static inline bool | |
1860 | is_gimple_assign (const_gimple gs) | |
1861 | { | |
1862 | return gimple_code (gs) == GIMPLE_ASSIGN; | |
1863 | } | |
1864 | ||
1865 | /* Determine if expression CODE is one of the valid expressions that can | |
1866 | be used on the RHS of GIMPLE assignments. */ | |
1867 | ||
1868 | static inline enum gimple_rhs_class | |
1869 | get_gimple_rhs_class (enum tree_code code) | |
1870 | { | |
1871 | return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code]; | |
1872 | } | |
1873 | ||
1874 | /* Return the LHS of assignment statement GS. */ | |
1875 | ||
1876 | static inline tree | |
1877 | gimple_assign_lhs (const_gimple gs) | |
1878 | { | |
1879 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1880 | return gimple_op (gs, 0); | |
1881 | } | |
1882 | ||
1883 | ||
1884 | /* Return a pointer to the LHS of assignment statement GS. */ | |
1885 | ||
1886 | static inline tree * | |
1887 | gimple_assign_lhs_ptr (const_gimple gs) | |
1888 | { | |
1889 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1890 | return gimple_op_ptr (gs, 0); | |
1891 | } | |
1892 | ||
1893 | ||
1894 | /* Set LHS to be the LHS operand of assignment statement GS. */ | |
1895 | ||
1896 | static inline void | |
1897 | gimple_assign_set_lhs (gimple gs, tree lhs) | |
1898 | { | |
1899 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
726a989a RB |
1900 | gimple_set_op (gs, 0, lhs); |
1901 | ||
1902 | if (lhs && TREE_CODE (lhs) == SSA_NAME) | |
1903 | SSA_NAME_DEF_STMT (lhs) = gs; | |
1904 | } | |
1905 | ||
1906 | ||
1907 | /* Return the first operand on the RHS of assignment statement GS. */ | |
1908 | ||
1909 | static inline tree | |
1910 | gimple_assign_rhs1 (const_gimple gs) | |
1911 | { | |
1912 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1913 | return gimple_op (gs, 1); | |
1914 | } | |
1915 | ||
1916 | ||
1917 | /* Return a pointer to the first operand on the RHS of assignment | |
1918 | statement GS. */ | |
1919 | ||
1920 | static inline tree * | |
1921 | gimple_assign_rhs1_ptr (const_gimple gs) | |
1922 | { | |
1923 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1924 | return gimple_op_ptr (gs, 1); | |
1925 | } | |
1926 | ||
1927 | /* Set RHS to be the first operand on the RHS of assignment statement GS. */ | |
1928 | ||
1929 | static inline void | |
1930 | gimple_assign_set_rhs1 (gimple gs, tree rhs) | |
1931 | { | |
1932 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1933 | ||
726a989a RB |
1934 | gimple_set_op (gs, 1, rhs); |
1935 | } | |
1936 | ||
1937 | ||
1938 | /* Return the second operand on the RHS of assignment statement GS. | |
1939 | If GS does not have two operands, NULL is returned instead. */ | |
1940 | ||
1941 | static inline tree | |
1942 | gimple_assign_rhs2 (const_gimple gs) | |
1943 | { | |
1944 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1945 | ||
1946 | if (gimple_num_ops (gs) >= 3) | |
1947 | return gimple_op (gs, 2); | |
1948 | else | |
1949 | return NULL_TREE; | |
1950 | } | |
1951 | ||
1952 | ||
1953 | /* Return a pointer to the second operand on the RHS of assignment | |
1954 | statement GS. */ | |
1955 | ||
1956 | static inline tree * | |
1957 | gimple_assign_rhs2_ptr (const_gimple gs) | |
1958 | { | |
1959 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1960 | return gimple_op_ptr (gs, 2); | |
1961 | } | |
1962 | ||
1963 | ||
1964 | /* Set RHS to be the second operand on the RHS of assignment statement GS. */ | |
1965 | ||
1966 | static inline void | |
1967 | gimple_assign_set_rhs2 (gimple gs, tree rhs) | |
1968 | { | |
1969 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1970 | ||
726a989a RB |
1971 | gimple_set_op (gs, 2, rhs); |
1972 | } | |
1973 | ||
0354c0c7 BS |
1974 | /* Return the third operand on the RHS of assignment statement GS. |
1975 | If GS does not have two operands, NULL is returned instead. */ | |
1976 | ||
1977 | static inline tree | |
1978 | gimple_assign_rhs3 (const_gimple gs) | |
1979 | { | |
1980 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1981 | ||
1982 | if (gimple_num_ops (gs) >= 4) | |
1983 | return gimple_op (gs, 3); | |
1984 | else | |
1985 | return NULL_TREE; | |
1986 | } | |
1987 | ||
1988 | /* Return a pointer to the third operand on the RHS of assignment | |
1989 | statement GS. */ | |
1990 | ||
1991 | static inline tree * | |
1992 | gimple_assign_rhs3_ptr (const_gimple gs) | |
1993 | { | |
1994 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1995 | return gimple_op_ptr (gs, 3); | |
1996 | } | |
1997 | ||
1998 | ||
1999 | /* Set RHS to be the third operand on the RHS of assignment statement GS. */ | |
2000 | ||
2001 | static inline void | |
2002 | gimple_assign_set_rhs3 (gimple gs, tree rhs) | |
2003 | { | |
2004 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
2005 | ||
2006 | gimple_set_op (gs, 3, rhs); | |
2007 | } | |
2008 | ||
2009 | /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect | |
2010 | to see only a maximum of two operands. */ | |
2011 | ||
2012 | static inline void | |
2013 | gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, | |
2014 | tree op1, tree op2) | |
2015 | { | |
2016 | gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL); | |
2017 | } | |
2018 | ||
2019 | /* A wrapper around extract_ops_from_tree_1, for callers which expect | |
2020 | to see only a maximum of two operands. */ | |
2021 | ||
2022 | static inline void | |
2023 | extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0, | |
2024 | tree *op1) | |
2025 | { | |
2026 | tree op2; | |
2027 | extract_ops_from_tree_1 (expr, code, op0, op1, &op2); | |
2028 | gcc_assert (op2 == NULL_TREE); | |
2029 | } | |
2030 | ||
726a989a RB |
2031 | /* Returns true if GS is a nontemporal move. */ |
2032 | ||
2033 | static inline bool | |
2034 | gimple_assign_nontemporal_move_p (const_gimple gs) | |
2035 | { | |
2036 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
2037 | return gs->gsbase.nontemporal_move; | |
2038 | } | |
2039 | ||
2040 | /* Sets nontemporal move flag of GS to NONTEMPORAL. */ | |
2041 | ||
2042 | static inline void | |
2043 | gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal) | |
2044 | { | |
2045 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
2046 | gs->gsbase.nontemporal_move = nontemporal; | |
2047 | } | |
2048 | ||
2049 | ||
2050 | /* Return the code of the expression computed on the rhs of assignment | |
2051 | statement GS. In case that the RHS is a single object, returns the | |
2052 | tree code of the object. */ | |
2053 | ||
2054 | static inline enum tree_code | |
2055 | gimple_assign_rhs_code (const_gimple gs) | |
2056 | { | |
2057 | enum tree_code code; | |
2058 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
2059 | ||
3dbe9454 RG |
2060 | code = (enum tree_code) gs->gsbase.subcode; |
2061 | /* While we initially set subcode to the TREE_CODE of the rhs for | |
2062 | GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay | |
2063 | in sync when we rewrite stmts into SSA form or do SSA propagations. */ | |
726a989a RB |
2064 | if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) |
2065 | code = TREE_CODE (gimple_assign_rhs1 (gs)); | |
2066 | ||
2067 | return code; | |
2068 | } | |
2069 | ||
2070 | ||
2071 | /* Set CODE to be the code for the expression computed on the RHS of | |
2072 | assignment S. */ | |
2073 | ||
2074 | static inline void | |
2075 | gimple_assign_set_rhs_code (gimple s, enum tree_code code) | |
2076 | { | |
2077 | GIMPLE_CHECK (s, GIMPLE_ASSIGN); | |
2078 | s->gsbase.subcode = code; | |
2079 | } | |
2080 | ||
2081 | ||
0f336c35 RG |
2082 | /* Return the gimple rhs class of the code of the expression computed on |
2083 | the rhs of assignment statement GS. | |
2084 | This will never return GIMPLE_INVALID_RHS. */ | |
2085 | ||
2086 | static inline enum gimple_rhs_class | |
2087 | gimple_assign_rhs_class (const_gimple gs) | |
2088 | { | |
2089 | return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); | |
2090 | } | |
2091 | ||
3dbe9454 RG |
2092 | /* Return true if GS is an assignment with a singleton RHS, i.e., |
2093 | there is no operator associated with the assignment itself. | |
2094 | Unlike gimple_assign_copy_p, this predicate returns true for | |
2095 | any RHS operand, including those that perform an operation | |
2096 | and do not have the semantics of a copy, such as COND_EXPR. */ | |
2097 | ||
2098 | static inline bool | |
2099 | gimple_assign_single_p (gimple gs) | |
2100 | { | |
2101 | return (is_gimple_assign (gs) | |
2102 | && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS); | |
2103 | } | |
2104 | ||
c12d9242 RB |
2105 | /* Return true if GS performs a store to its lhs. */ |
2106 | ||
2107 | static inline bool | |
2108 | gimple_store_p (gimple gs) | |
2109 | { | |
2110 | tree lhs = gimple_get_lhs (gs); | |
2111 | return lhs && !is_gimple_reg (lhs); | |
2112 | } | |
2113 | ||
2114 | /* Return true if GS is an assignment that loads from its rhs1. */ | |
2115 | ||
2116 | static inline bool | |
2117 | gimple_assign_load_p (gimple gs) | |
2118 | { | |
2119 | tree rhs; | |
2120 | if (!gimple_assign_single_p (gs)) | |
2121 | return false; | |
2122 | rhs = gimple_assign_rhs1 (gs); | |
2123 | if (TREE_CODE (rhs) == WITH_SIZE_EXPR) | |
2124 | return true; | |
2125 | rhs = get_base_address (rhs); | |
2126 | return (DECL_P (rhs) | |
2127 | || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF); | |
2128 | } | |
2129 | ||
0f336c35 | 2130 | |
726a989a RB |
2131 | /* Return true if S is a type-cast assignment. */ |
2132 | ||
2133 | static inline bool | |
2134 | gimple_assign_cast_p (gimple s) | |
2135 | { | |
2136 | if (is_gimple_assign (s)) | |
2137 | { | |
2138 | enum tree_code sc = gimple_assign_rhs_code (s); | |
1a87cf0c | 2139 | return CONVERT_EXPR_CODE_P (sc) |
726a989a RB |
2140 | || sc == VIEW_CONVERT_EXPR |
2141 | || sc == FIX_TRUNC_EXPR; | |
2142 | } | |
2143 | ||
2144 | return false; | |
2145 | } | |
2146 | ||
47598145 MM |
2147 | /* Return true if S is a clobber statement. */ |
2148 | ||
2149 | static inline bool | |
2150 | gimple_clobber_p (gimple s) | |
2151 | { | |
2152 | return gimple_assign_single_p (s) | |
2153 | && TREE_CLOBBER_P (gimple_assign_rhs1 (s)); | |
2154 | } | |
726a989a RB |
2155 | |
2156 | /* Return true if GS is a GIMPLE_CALL. */ | |
2157 | ||
2158 | static inline bool | |
2159 | is_gimple_call (const_gimple gs) | |
2160 | { | |
2161 | return gimple_code (gs) == GIMPLE_CALL; | |
2162 | } | |
2163 | ||
2164 | /* Return the LHS of call statement GS. */ | |
2165 | ||
2166 | static inline tree | |
2167 | gimple_call_lhs (const_gimple gs) | |
2168 | { | |
2169 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2170 | return gimple_op (gs, 0); | |
2171 | } | |
2172 | ||
2173 | ||
2174 | /* Return a pointer to the LHS of call statement GS. */ | |
2175 | ||
2176 | static inline tree * | |
2177 | gimple_call_lhs_ptr (const_gimple gs) | |
2178 | { | |
2179 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2180 | return gimple_op_ptr (gs, 0); | |
2181 | } | |
2182 | ||
2183 | ||
2184 | /* Set LHS to be the LHS operand of call statement GS. */ | |
2185 | ||
2186 | static inline void | |
2187 | gimple_call_set_lhs (gimple gs, tree lhs) | |
2188 | { | |
2189 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
726a989a RB |
2190 | gimple_set_op (gs, 0, lhs); |
2191 | if (lhs && TREE_CODE (lhs) == SSA_NAME) | |
2192 | SSA_NAME_DEF_STMT (lhs) = gs; | |
2193 | } | |
2194 | ||
2195 | ||
25583c4f RS |
2196 | /* Return true if call GS calls an internal-only function, as enumerated |
2197 | by internal_fn. */ | |
2198 | ||
2199 | static inline bool | |
2200 | gimple_call_internal_p (const_gimple gs) | |
2201 | { | |
2202 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2203 | return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0; | |
2204 | } | |
2205 | ||
2206 | ||
2207 | /* Return the target of internal call GS. */ | |
2208 | ||
2209 | static inline enum internal_fn | |
2210 | gimple_call_internal_fn (const_gimple gs) | |
2211 | { | |
2212 | gcc_gimple_checking_assert (gimple_call_internal_p (gs)); | |
2213 | return gs->gimple_call.u.internal_fn; | |
2214 | } | |
2215 | ||
2216 | ||
f20ca725 | 2217 | /* Return the function type of the function called by GS. */ |
726a989a RB |
2218 | |
2219 | static inline tree | |
f20ca725 | 2220 | gimple_call_fntype (const_gimple gs) |
726a989a RB |
2221 | { |
2222 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
25583c4f RS |
2223 | if (gimple_call_internal_p (gs)) |
2224 | return NULL_TREE; | |
2225 | return gs->gimple_call.u.fntype; | |
726a989a RB |
2226 | } |
2227 | ||
f20ca725 RG |
2228 | /* Set the type of the function called by GS to FNTYPE. */ |
2229 | ||
2230 | static inline void | |
2231 | gimple_call_set_fntype (gimple gs, tree fntype) | |
2232 | { | |
2233 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
25583c4f RS |
2234 | gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); |
2235 | gs->gimple_call.u.fntype = fntype; | |
f20ca725 RG |
2236 | } |
2237 | ||
2238 | ||
2239 | /* Return the tree node representing the function called by call | |
2240 | statement GS. */ | |
9bfc434b RG |
2241 | |
2242 | static inline tree | |
f20ca725 | 2243 | gimple_call_fn (const_gimple gs) |
9bfc434b | 2244 | { |
f20ca725 RG |
2245 | GIMPLE_CHECK (gs, GIMPLE_CALL); |
2246 | return gimple_op (gs, 1); | |
9bfc434b | 2247 | } |
726a989a RB |
2248 | |
2249 | /* Return a pointer to the tree node representing the function called by call | |
2250 | statement GS. */ | |
2251 | ||
2252 | static inline tree * | |
2253 | gimple_call_fn_ptr (const_gimple gs) | |
2254 | { | |
2255 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2256 | return gimple_op_ptr (gs, 1); | |
2257 | } | |
2258 | ||
2259 | ||
2260 | /* Set FN to be the function called by call statement GS. */ | |
2261 | ||
2262 | static inline void | |
2263 | gimple_call_set_fn (gimple gs, tree fn) | |
2264 | { | |
2265 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
25583c4f | 2266 | gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); |
726a989a RB |
2267 | gimple_set_op (gs, 1, fn); |
2268 | } | |
2269 | ||
2270 | ||
7c9577be RG |
2271 | /* Set FNDECL to be the function called by call statement GS. */ |
2272 | ||
2273 | static inline void | |
2274 | gimple_call_set_fndecl (gimple gs, tree decl) | |
2275 | { | |
2276 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
25583c4f | 2277 | gcc_gimple_checking_assert (!gimple_call_internal_p (gs)); |
db3927fb | 2278 | gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl)); |
7c9577be RG |
2279 | } |
2280 | ||
25583c4f RS |
2281 | |
2282 | /* Set internal function FN to be the function called by call statement GS. */ | |
2283 | ||
2284 | static inline void | |
2285 | gimple_call_set_internal_fn (gimple gs, enum internal_fn fn) | |
2286 | { | |
2287 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2288 | gcc_gimple_checking_assert (gimple_call_internal_p (gs)); | |
2289 | gs->gimple_call.u.internal_fn = fn; | |
2290 | } | |
2291 | ||
2292 | ||
3b45a007 RG |
2293 | /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL |
2294 | associated with the callee if known. Otherwise return NULL_TREE. */ | |
2295 | ||
2296 | static inline tree | |
2297 | gimple_call_addr_fndecl (const_tree fn) | |
2298 | { | |
25583c4f | 2299 | if (fn && TREE_CODE (fn) == ADDR_EXPR) |
3b45a007 RG |
2300 | { |
2301 | tree fndecl = TREE_OPERAND (fn, 0); | |
2302 | if (TREE_CODE (fndecl) == MEM_REF | |
2303 | && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR | |
2304 | && integer_zerop (TREE_OPERAND (fndecl, 1))) | |
2305 | fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0); | |
2306 | if (TREE_CODE (fndecl) == FUNCTION_DECL) | |
2307 | return fndecl; | |
2308 | } | |
2309 | return NULL_TREE; | |
2310 | } | |
7c9577be | 2311 | |
726a989a RB |
2312 | /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it. |
2313 | Otherwise return NULL. This function is analogous to | |
2314 | get_callee_fndecl in tree land. */ | |
2315 | ||
2316 | static inline tree | |
2317 | gimple_call_fndecl (const_gimple gs) | |
2318 | { | |
3b45a007 | 2319 | return gimple_call_addr_fndecl (gimple_call_fn (gs)); |
726a989a RB |
2320 | } |
2321 | ||
2322 | ||
2323 | /* Return the type returned by call statement GS. */ | |
2324 | ||
2325 | static inline tree | |
2326 | gimple_call_return_type (const_gimple gs) | |
2327 | { | |
9bfc434b | 2328 | tree type = gimple_call_fntype (gs); |
726a989a | 2329 | |
25583c4f RS |
2330 | if (type == NULL_TREE) |
2331 | return TREE_TYPE (gimple_call_lhs (gs)); | |
2332 | ||
9bfc434b | 2333 | /* The type returned by a function is the type of its |
726a989a RB |
2334 | function type. */ |
2335 | return TREE_TYPE (type); | |
2336 | } | |
2337 | ||
2338 | ||
2339 | /* Return the static chain for call statement GS. */ | |
2340 | ||
2341 | static inline tree | |
2342 | gimple_call_chain (const_gimple gs) | |
2343 | { | |
2344 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2345 | return gimple_op (gs, 2); | |
2346 | } | |
2347 | ||
2348 | ||
2349 | /* Return a pointer to the static chain for call statement GS. */ | |
2350 | ||
2351 | static inline tree * | |
2352 | gimple_call_chain_ptr (const_gimple gs) | |
2353 | { | |
2354 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2355 | return gimple_op_ptr (gs, 2); | |
2356 | } | |
2357 | ||
2358 | /* Set CHAIN to be the static chain for call statement GS. */ | |
2359 | ||
2360 | static inline void | |
2361 | gimple_call_set_chain (gimple gs, tree chain) | |
2362 | { | |
2363 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
f68a75df | 2364 | |
726a989a RB |
2365 | gimple_set_op (gs, 2, chain); |
2366 | } | |
2367 | ||
2368 | ||
2369 | /* Return the number of arguments used by call statement GS. */ | |
2370 | ||
2371 | static inline unsigned | |
2372 | gimple_call_num_args (const_gimple gs) | |
2373 | { | |
2374 | unsigned num_ops; | |
2375 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2376 | num_ops = gimple_num_ops (gs); | |
726a989a RB |
2377 | return num_ops - 3; |
2378 | } | |
2379 | ||
2380 | ||
2381 | /* Return the argument at position INDEX for call statement GS. */ | |
2382 | ||
2383 | static inline tree | |
2384 | gimple_call_arg (const_gimple gs, unsigned index) | |
2385 | { | |
2386 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2387 | return gimple_op (gs, index + 3); | |
2388 | } | |
2389 | ||
2390 | ||
2391 | /* Return a pointer to the argument at position INDEX for call | |
2392 | statement GS. */ | |
2393 | ||
2394 | static inline tree * | |
2395 | gimple_call_arg_ptr (const_gimple gs, unsigned index) | |
2396 | { | |
2397 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2398 | return gimple_op_ptr (gs, index + 3); | |
2399 | } | |
2400 | ||
2401 | ||
2402 | /* Set ARG to be the argument at position INDEX for call statement GS. */ | |
2403 | ||
2404 | static inline void | |
2405 | gimple_call_set_arg (gimple gs, unsigned index, tree arg) | |
2406 | { | |
2407 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
726a989a RB |
2408 | gimple_set_op (gs, index + 3, arg); |
2409 | } | |
2410 | ||
2411 | ||
2412 | /* If TAIL_P is true, mark call statement S as being a tail call | |
2413 | (i.e., a call just before the exit of a function). These calls are | |
2414 | candidate for tail call optimization. */ | |
2415 | ||
2416 | static inline void | |
2417 | gimple_call_set_tail (gimple s, bool tail_p) | |
2418 | { | |
2419 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2420 | if (tail_p) | |
2421 | s->gsbase.subcode |= GF_CALL_TAILCALL; | |
2422 | else | |
2423 | s->gsbase.subcode &= ~GF_CALL_TAILCALL; | |
2424 | } | |
2425 | ||
2426 | ||
2427 | /* Return true if GIMPLE_CALL S is marked as a tail call. */ | |
2428 | ||
2429 | static inline bool | |
2430 | gimple_call_tail_p (gimple s) | |
2431 | { | |
2432 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2433 | return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0; | |
2434 | } | |
2435 | ||
2436 | ||
726a989a RB |
2437 | /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return |
2438 | slot optimization. This transformation uses the target of the call | |
2439 | expansion as the return slot for calls that return in memory. */ | |
2440 | ||
2441 | static inline void | |
2442 | gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p) | |
2443 | { | |
2444 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2445 | if (return_slot_opt_p) | |
2446 | s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT; | |
2447 | else | |
2448 | s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT; | |
2449 | } | |
2450 | ||
2451 | ||
2452 | /* Return true if S is marked for return slot optimization. */ | |
2453 | ||
2454 | static inline bool | |
2455 | gimple_call_return_slot_opt_p (gimple s) | |
2456 | { | |
2457 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2458 | return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0; | |
2459 | } | |
2460 | ||
2461 | ||
2462 | /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a | |
2463 | thunk to the thunked-to function. */ | |
2464 | ||
2465 | static inline void | |
2466 | gimple_call_set_from_thunk (gimple s, bool from_thunk_p) | |
2467 | { | |
2468 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2469 | if (from_thunk_p) | |
2470 | s->gsbase.subcode |= GF_CALL_FROM_THUNK; | |
2471 | else | |
2472 | s->gsbase.subcode &= ~GF_CALL_FROM_THUNK; | |
2473 | } | |
2474 | ||
2475 | ||
2476 | /* Return true if GIMPLE_CALL S is a jump from a thunk. */ | |
2477 | ||
2478 | static inline bool | |
2479 | gimple_call_from_thunk_p (gimple s) | |
2480 | { | |
2481 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2482 | return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0; | |
2483 | } | |
2484 | ||
2485 | ||
2486 | /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the | |
2487 | argument pack in its argument list. */ | |
2488 | ||
2489 | static inline void | |
2490 | gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p) | |
2491 | { | |
2492 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2493 | if (pass_arg_pack_p) | |
2494 | s->gsbase.subcode |= GF_CALL_VA_ARG_PACK; | |
2495 | else | |
2496 | s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK; | |
2497 | } | |
2498 | ||
2499 | ||
2500 | /* Return true if GIMPLE_CALL S is a stdarg call that needs the | |
2501 | argument pack in its argument list. */ | |
2502 | ||
2503 | static inline bool | |
2504 | gimple_call_va_arg_pack_p (gimple s) | |
2505 | { | |
2506 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2507 | return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0; | |
2508 | } | |
2509 | ||
2510 | ||
2511 | /* Return true if S is a noreturn call. */ | |
2512 | ||
2513 | static inline bool | |
2514 | gimple_call_noreturn_p (gimple s) | |
2515 | { | |
2516 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2517 | return (gimple_call_flags (s) & ECF_NORETURN) != 0; | |
2518 | } | |
2519 | ||
2520 | ||
9bb1a81b JM |
2521 | /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw |
2522 | even if the called function can throw in other cases. */ | |
2523 | ||
2524 | static inline void | |
2525 | gimple_call_set_nothrow (gimple s, bool nothrow_p) | |
2526 | { | |
2527 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2528 | if (nothrow_p) | |
2529 | s->gsbase.subcode |= GF_CALL_NOTHROW; | |
2530 | else | |
2531 | s->gsbase.subcode &= ~GF_CALL_NOTHROW; | |
2532 | } | |
2533 | ||
726a989a RB |
2534 | /* Return true if S is a nothrow call. */ |
2535 | ||
2536 | static inline bool | |
2537 | gimple_call_nothrow_p (gimple s) | |
2538 | { | |
2539 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2540 | return (gimple_call_flags (s) & ECF_NOTHROW) != 0; | |
2541 | } | |
2542 | ||
63d2a353 MM |
2543 | /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that |
2544 | is known to be emitted for VLA objects. Those are wrapped by | |
2545 | stack_save/stack_restore calls and hence can't lead to unbounded | |
2546 | stack growth even when they occur in loops. */ | |
2547 | ||
2548 | static inline void | |
2549 | gimple_call_set_alloca_for_var (gimple s, bool for_var) | |
2550 | { | |
2551 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2552 | if (for_var) | |
2553 | s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR; | |
2554 | else | |
2555 | s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR; | |
2556 | } | |
2557 | ||
2558 | /* Return true of S is a call to builtin_alloca emitted for VLA objects. */ | |
2559 | ||
2560 | static inline bool | |
2561 | gimple_call_alloca_for_var_p (gimple s) | |
2562 | { | |
2563 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2564 | return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0; | |
2565 | } | |
726a989a RB |
2566 | |
2567 | /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */ | |
2568 | ||
2569 | static inline void | |
2570 | gimple_call_copy_flags (gimple dest_call, gimple orig_call) | |
2571 | { | |
2572 | GIMPLE_CHECK (dest_call, GIMPLE_CALL); | |
2573 | GIMPLE_CHECK (orig_call, GIMPLE_CALL); | |
2574 | dest_call->gsbase.subcode = orig_call->gsbase.subcode; | |
2575 | } | |
2576 | ||
2577 | ||
d086d311 RG |
2578 | /* Return a pointer to the points-to solution for the set of call-used |
2579 | variables of the call CALL. */ | |
2580 | ||
2581 | static inline struct pt_solution * | |
2582 | gimple_call_use_set (gimple call) | |
2583 | { | |
2584 | GIMPLE_CHECK (call, GIMPLE_CALL); | |
2585 | return &call->gimple_call.call_used; | |
2586 | } | |
2587 | ||
2588 | ||
2589 | /* Return a pointer to the points-to solution for the set of call-used | |
2590 | variables of the call CALL. */ | |
2591 | ||
2592 | static inline struct pt_solution * | |
2593 | gimple_call_clobber_set (gimple call) | |
2594 | { | |
2595 | GIMPLE_CHECK (call, GIMPLE_CALL); | |
2596 | return &call->gimple_call.call_clobbered; | |
2597 | } | |
2598 | ||
2599 | ||
726a989a RB |
2600 | /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a |
2601 | non-NULL lhs. */ | |
2602 | ||
2603 | static inline bool | |
2604 | gimple_has_lhs (gimple stmt) | |
2605 | { | |
2606 | return (is_gimple_assign (stmt) | |
2607 | || (is_gimple_call (stmt) | |
2608 | && gimple_call_lhs (stmt) != NULL_TREE)); | |
2609 | } | |
2610 | ||
2611 | ||
2612 | /* Return the code of the predicate computed by conditional statement GS. */ | |
2613 | ||
2614 | static inline enum tree_code | |
2615 | gimple_cond_code (const_gimple gs) | |
2616 | { | |
2617 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
81f40b79 | 2618 | return (enum tree_code) gs->gsbase.subcode; |
726a989a RB |
2619 | } |
2620 | ||
2621 | ||
2622 | /* Set CODE to be the predicate code for the conditional statement GS. */ | |
2623 | ||
2624 | static inline void | |
2625 | gimple_cond_set_code (gimple gs, enum tree_code code) | |
2626 | { | |
2627 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
726a989a RB |
2628 | gs->gsbase.subcode = code; |
2629 | } | |
2630 | ||
2631 | ||
2632 | /* Return the LHS of the predicate computed by conditional statement GS. */ | |
2633 | ||
2634 | static inline tree | |
2635 | gimple_cond_lhs (const_gimple gs) | |
2636 | { | |
2637 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2638 | return gimple_op (gs, 0); | |
2639 | } | |
2640 | ||
2641 | /* Return the pointer to the LHS of the predicate computed by conditional | |
2642 | statement GS. */ | |
2643 | ||
2644 | static inline tree * | |
2645 | gimple_cond_lhs_ptr (const_gimple gs) | |
2646 | { | |
2647 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2648 | return gimple_op_ptr (gs, 0); | |
2649 | } | |
2650 | ||
2651 | /* Set LHS to be the LHS operand of the predicate computed by | |
2652 | conditional statement GS. */ | |
2653 | ||
2654 | static inline void | |
2655 | gimple_cond_set_lhs (gimple gs, tree lhs) | |
2656 | { | |
2657 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
726a989a RB |
2658 | gimple_set_op (gs, 0, lhs); |
2659 | } | |
2660 | ||
2661 | ||
2662 | /* Return the RHS operand of the predicate computed by conditional GS. */ | |
2663 | ||
2664 | static inline tree | |
2665 | gimple_cond_rhs (const_gimple gs) | |
2666 | { | |
2667 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2668 | return gimple_op (gs, 1); | |
2669 | } | |
2670 | ||
2671 | /* Return the pointer to the RHS operand of the predicate computed by | |
2672 | conditional GS. */ | |
2673 | ||
2674 | static inline tree * | |
2675 | gimple_cond_rhs_ptr (const_gimple gs) | |
2676 | { | |
2677 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2678 | return gimple_op_ptr (gs, 1); | |
2679 | } | |
2680 | ||
2681 | ||
2682 | /* Set RHS to be the RHS operand of the predicate computed by | |
2683 | conditional statement GS. */ | |
2684 | ||
2685 | static inline void | |
2686 | gimple_cond_set_rhs (gimple gs, tree rhs) | |
2687 | { | |
2688 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
726a989a RB |
2689 | gimple_set_op (gs, 1, rhs); |
2690 | } | |
2691 | ||
2692 | ||
2693 | /* Return the label used by conditional statement GS when its | |
2694 | predicate evaluates to true. */ | |
2695 | ||
2696 | static inline tree | |
2697 | gimple_cond_true_label (const_gimple gs) | |
2698 | { | |
2699 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2700 | return gimple_op (gs, 2); | |
2701 | } | |
2702 | ||
2703 | ||
2704 | /* Set LABEL to be the label used by conditional statement GS when its | |
2705 | predicate evaluates to true. */ | |
2706 | ||
2707 | static inline void | |
2708 | gimple_cond_set_true_label (gimple gs, tree label) | |
2709 | { | |
2710 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
726a989a RB |
2711 | gimple_set_op (gs, 2, label); |
2712 | } | |
2713 | ||
2714 | ||
2715 | /* Set LABEL to be the label used by conditional statement GS when its | |
2716 | predicate evaluates to false. */ | |
2717 | ||
2718 | static inline void | |
2719 | gimple_cond_set_false_label (gimple gs, tree label) | |
2720 | { | |
2721 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
726a989a RB |
2722 | gimple_set_op (gs, 3, label); |
2723 | } | |
2724 | ||
2725 | ||
2726 | /* Return the label used by conditional statement GS when its | |
2727 | predicate evaluates to false. */ | |
2728 | ||
2729 | static inline tree | |
2730 | gimple_cond_false_label (const_gimple gs) | |
2731 | { | |
2732 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2733 | return gimple_op (gs, 3); | |
2734 | } | |
2735 | ||
2736 | ||
2737 | /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */ | |
2738 | ||
2739 | static inline void | |
2740 | gimple_cond_make_false (gimple gs) | |
2741 | { | |
2742 | gimple_cond_set_lhs (gs, boolean_true_node); | |
2743 | gimple_cond_set_rhs (gs, boolean_false_node); | |
2744 | gs->gsbase.subcode = EQ_EXPR; | |
2745 | } | |
2746 | ||
2747 | ||
2748 | /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */ | |
2749 | ||
2750 | static inline void | |
2751 | gimple_cond_make_true (gimple gs) | |
2752 | { | |
2753 | gimple_cond_set_lhs (gs, boolean_true_node); | |
2754 | gimple_cond_set_rhs (gs, boolean_true_node); | |
2755 | gs->gsbase.subcode = EQ_EXPR; | |
2756 | } | |
2757 | ||
2758 | /* Check if conditional statemente GS is of the form 'if (1 == 1)', | |
2759 | 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */ | |
2760 | ||
2761 | static inline bool | |
2762 | gimple_cond_true_p (const_gimple gs) | |
2763 | { | |
2764 | tree lhs = gimple_cond_lhs (gs); | |
2765 | tree rhs = gimple_cond_rhs (gs); | |
2766 | enum tree_code code = gimple_cond_code (gs); | |
2767 | ||
2768 | if (lhs != boolean_true_node && lhs != boolean_false_node) | |
2769 | return false; | |
2770 | ||
2771 | if (rhs != boolean_true_node && rhs != boolean_false_node) | |
2772 | return false; | |
2773 | ||
2774 | if (code == NE_EXPR && lhs != rhs) | |
2775 | return true; | |
2776 | ||
2777 | if (code == EQ_EXPR && lhs == rhs) | |
2778 | return true; | |
2779 | ||
2780 | return false; | |
2781 | } | |
2782 | ||
2783 | /* Check if conditional statement GS is of the form 'if (1 != 1)', | |
2784 | 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */ | |
2785 | ||
2786 | static inline bool | |
2787 | gimple_cond_false_p (const_gimple gs) | |
2788 | { | |
2789 | tree lhs = gimple_cond_lhs (gs); | |
2790 | tree rhs = gimple_cond_rhs (gs); | |
2791 | enum tree_code code = gimple_cond_code (gs); | |
2792 | ||
2793 | if (lhs != boolean_true_node && lhs != boolean_false_node) | |
2794 | return false; | |
2795 | ||
2796 | if (rhs != boolean_true_node && rhs != boolean_false_node) | |
2797 | return false; | |
2798 | ||
2799 | if (code == NE_EXPR && lhs == rhs) | |
2800 | return true; | |
2801 | ||
2802 | if (code == EQ_EXPR && lhs != rhs) | |
2803 | return true; | |
2804 | ||
2805 | return false; | |
2806 | } | |
2807 | ||
726a989a RB |
2808 | /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */ |
2809 | ||
2810 | static inline void | |
2811 | gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs) | |
2812 | { | |
2813 | gimple_cond_set_code (stmt, code); | |
2814 | gimple_cond_set_lhs (stmt, lhs); | |
2815 | gimple_cond_set_rhs (stmt, rhs); | |
2816 | } | |
2817 | ||
2818 | /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */ | |
2819 | ||
2820 | static inline tree | |
2821 | gimple_label_label (const_gimple gs) | |
2822 | { | |
2823 | GIMPLE_CHECK (gs, GIMPLE_LABEL); | |
2824 | return gimple_op (gs, 0); | |
2825 | } | |
2826 | ||
2827 | ||
2828 | /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement | |
2829 | GS. */ | |
2830 | ||
2831 | static inline void | |
2832 | gimple_label_set_label (gimple gs, tree label) | |
2833 | { | |
2834 | GIMPLE_CHECK (gs, GIMPLE_LABEL); | |
726a989a RB |
2835 | gimple_set_op (gs, 0, label); |
2836 | } | |
2837 | ||
2838 | ||
2839 | /* Return the destination of the unconditional jump GS. */ | |
2840 | ||
2841 | static inline tree | |
2842 | gimple_goto_dest (const_gimple gs) | |
2843 | { | |
2844 | GIMPLE_CHECK (gs, GIMPLE_GOTO); | |
2845 | return gimple_op (gs, 0); | |
2846 | } | |
2847 | ||
2848 | ||
2849 | /* Set DEST to be the destination of the unconditonal jump GS. */ | |
2850 | ||
b8698a0f | 2851 | static inline void |
726a989a RB |
2852 | gimple_goto_set_dest (gimple gs, tree dest) |
2853 | { | |
2854 | GIMPLE_CHECK (gs, GIMPLE_GOTO); | |
726a989a RB |
2855 | gimple_set_op (gs, 0, dest); |
2856 | } | |
2857 | ||
2858 | ||
2859 | /* Return the variables declared in the GIMPLE_BIND statement GS. */ | |
2860 | ||
2861 | static inline tree | |
2862 | gimple_bind_vars (const_gimple gs) | |
2863 | { | |
2864 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2865 | return gs->gimple_bind.vars; | |
2866 | } | |
2867 | ||
2868 | ||
2869 | /* Set VARS to be the set of variables declared in the GIMPLE_BIND | |
2870 | statement GS. */ | |
2871 | ||
2872 | static inline void | |
2873 | gimple_bind_set_vars (gimple gs, tree vars) | |
2874 | { | |
2875 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2876 | gs->gimple_bind.vars = vars; | |
2877 | } | |
2878 | ||
2879 | ||
2880 | /* Append VARS to the set of variables declared in the GIMPLE_BIND | |
2881 | statement GS. */ | |
2882 | ||
2883 | static inline void | |
2884 | gimple_bind_append_vars (gimple gs, tree vars) | |
2885 | { | |
2886 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2887 | gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars); | |
2888 | } | |
2889 | ||
2890 | ||
355a7673 MM |
2891 | static inline gimple_seq * |
2892 | gimple_bind_body_ptr (gimple gs) | |
2893 | { | |
2894 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2895 | return &gs->gimple_bind.body; | |
2896 | } | |
2897 | ||
726a989a RB |
2898 | /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ |
2899 | ||
2900 | static inline gimple_seq | |
2901 | gimple_bind_body (gimple gs) | |
2902 | { | |
355a7673 | 2903 | return *gimple_bind_body_ptr (gs); |
726a989a RB |
2904 | } |
2905 | ||
2906 | ||
2907 | /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND | |
2908 | statement GS. */ | |
2909 | ||
2910 | static inline void | |
2911 | gimple_bind_set_body (gimple gs, gimple_seq seq) | |
2912 | { | |
2913 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2914 | gs->gimple_bind.body = seq; | |
2915 | } | |
2916 | ||
2917 | ||
2918 | /* Append a statement to the end of a GIMPLE_BIND's body. */ | |
2919 | ||
2920 | static inline void | |
2921 | gimple_bind_add_stmt (gimple gs, gimple stmt) | |
2922 | { | |
2923 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2924 | gimple_seq_add_stmt (&gs->gimple_bind.body, stmt); | |
2925 | } | |
2926 | ||
2927 | ||
2928 | /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */ | |
2929 | ||
2930 | static inline void | |
2931 | gimple_bind_add_seq (gimple gs, gimple_seq seq) | |
2932 | { | |
2933 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2934 | gimple_seq_add_seq (&gs->gimple_bind.body, seq); | |
2935 | } | |
2936 | ||
2937 | ||
2938 | /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement | |
2939 | GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */ | |
2940 | ||
2941 | static inline tree | |
2942 | gimple_bind_block (const_gimple gs) | |
2943 | { | |
2944 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2945 | return gs->gimple_bind.block; | |
2946 | } | |
2947 | ||
2948 | ||
2949 | /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND | |
2950 | statement GS. */ | |
2951 | ||
2952 | static inline void | |
2953 | gimple_bind_set_block (gimple gs, tree block) | |
2954 | { | |
2955 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2bc0a660 JH |
2956 | gcc_gimple_checking_assert (block == NULL_TREE |
2957 | || TREE_CODE (block) == BLOCK); | |
726a989a RB |
2958 | gs->gimple_bind.block = block; |
2959 | } | |
2960 | ||
2961 | ||
2962 | /* Return the number of input operands for GIMPLE_ASM GS. */ | |
2963 | ||
2964 | static inline unsigned | |
2965 | gimple_asm_ninputs (const_gimple gs) | |
2966 | { | |
2967 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2968 | return gs->gimple_asm.ni; | |
2969 | } | |
2970 | ||
2971 | ||
2972 | /* Return the number of output operands for GIMPLE_ASM GS. */ | |
2973 | ||
2974 | static inline unsigned | |
2975 | gimple_asm_noutputs (const_gimple gs) | |
2976 | { | |
2977 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2978 | return gs->gimple_asm.no; | |
2979 | } | |
2980 | ||
2981 | ||
2982 | /* Return the number of clobber operands for GIMPLE_ASM GS. */ | |
2983 | ||
2984 | static inline unsigned | |
2985 | gimple_asm_nclobbers (const_gimple gs) | |
2986 | { | |
2987 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2988 | return gs->gimple_asm.nc; | |
2989 | } | |
2990 | ||
1c384bf1 RH |
2991 | /* Return the number of label operands for GIMPLE_ASM GS. */ |
2992 | ||
2993 | static inline unsigned | |
2994 | gimple_asm_nlabels (const_gimple gs) | |
2995 | { | |
2996 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2997 | return gs->gimple_asm.nl; | |
2998 | } | |
726a989a RB |
2999 | |
3000 | /* Return input operand INDEX of GIMPLE_ASM GS. */ | |
3001 | ||
3002 | static inline tree | |
3003 | gimple_asm_input_op (const_gimple gs, unsigned index) | |
3004 | { | |
3005 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 MM |
3006 | gcc_gimple_checking_assert (index < gs->gimple_asm.ni); |
3007 | return gimple_op (gs, index + gs->gimple_asm.no); | |
726a989a RB |
3008 | } |
3009 | ||
3010 | /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */ | |
3011 | ||
3012 | static inline tree * | |
3013 | gimple_asm_input_op_ptr (const_gimple gs, unsigned index) | |
3014 | { | |
3015 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 MM |
3016 | gcc_gimple_checking_assert (index < gs->gimple_asm.ni); |
3017 | return gimple_op_ptr (gs, index + gs->gimple_asm.no); | |
726a989a RB |
3018 | } |
3019 | ||
3020 | ||
3021 | /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */ | |
3022 | ||
3023 | static inline void | |
3024 | gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op) | |
3025 | { | |
3026 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 | 3027 | gcc_gimple_checking_assert (index < gs->gimple_asm.ni |
2bc0a660 | 3028 | && TREE_CODE (in_op) == TREE_LIST); |
4b671e64 | 3029 | gimple_set_op (gs, index + gs->gimple_asm.no, in_op); |
726a989a RB |
3030 | } |
3031 | ||
3032 | ||
3033 | /* Return output operand INDEX of GIMPLE_ASM GS. */ | |
3034 | ||
3035 | static inline tree | |
3036 | gimple_asm_output_op (const_gimple gs, unsigned index) | |
3037 | { | |
3038 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 MM |
3039 | gcc_gimple_checking_assert (index < gs->gimple_asm.no); |
3040 | return gimple_op (gs, index); | |
726a989a RB |
3041 | } |
3042 | ||
3043 | /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */ | |
3044 | ||
3045 | static inline tree * | |
3046 | gimple_asm_output_op_ptr (const_gimple gs, unsigned index) | |
3047 | { | |
3048 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 MM |
3049 | gcc_gimple_checking_assert (index < gs->gimple_asm.no); |
3050 | return gimple_op_ptr (gs, index); | |
726a989a RB |
3051 | } |
3052 | ||
3053 | ||
3054 | /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */ | |
3055 | ||
3056 | static inline void | |
3057 | gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op) | |
3058 | { | |
3059 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 | 3060 | gcc_gimple_checking_assert (index < gs->gimple_asm.no |
2bc0a660 | 3061 | && TREE_CODE (out_op) == TREE_LIST); |
4b671e64 | 3062 | gimple_set_op (gs, index, out_op); |
726a989a RB |
3063 | } |
3064 | ||
3065 | ||
3066 | /* Return clobber operand INDEX of GIMPLE_ASM GS. */ | |
3067 | ||
3068 | static inline tree | |
3069 | gimple_asm_clobber_op (const_gimple gs, unsigned index) | |
3070 | { | |
3071 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 | 3072 | gcc_gimple_checking_assert (index < gs->gimple_asm.nc); |
726a989a RB |
3073 | return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no); |
3074 | } | |
3075 | ||
3076 | ||
3077 | /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */ | |
3078 | ||
3079 | static inline void | |
3080 | gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op) | |
3081 | { | |
3082 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 | 3083 | gcc_gimple_checking_assert (index < gs->gimple_asm.nc |
2bc0a660 | 3084 | && TREE_CODE (clobber_op) == TREE_LIST); |
726a989a RB |
3085 | gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op); |
3086 | } | |
3087 | ||
1c384bf1 RH |
3088 | /* Return label operand INDEX of GIMPLE_ASM GS. */ |
3089 | ||
3090 | static inline tree | |
3091 | gimple_asm_label_op (const_gimple gs, unsigned index) | |
3092 | { | |
3093 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 | 3094 | gcc_gimple_checking_assert (index < gs->gimple_asm.nl); |
1c384bf1 RH |
3095 | return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc); |
3096 | } | |
3097 | ||
3098 | /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */ | |
3099 | ||
3100 | static inline void | |
3101 | gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op) | |
3102 | { | |
3103 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
4b671e64 | 3104 | gcc_gimple_checking_assert (index < gs->gimple_asm.nl |
2bc0a660 | 3105 | && TREE_CODE (label_op) == TREE_LIST); |
1c384bf1 RH |
3106 | gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op); |
3107 | } | |
726a989a RB |
3108 | |
3109 | /* Return the string representing the assembly instruction in | |
3110 | GIMPLE_ASM GS. */ | |
3111 | ||
3112 | static inline const char * | |
3113 | gimple_asm_string (const_gimple gs) | |
3114 | { | |
3115 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
3116 | return gs->gimple_asm.string; | |
3117 | } | |
3118 | ||
3119 | ||
3120 | /* Return true if GS is an asm statement marked volatile. */ | |
3121 | ||
3122 | static inline bool | |
3123 | gimple_asm_volatile_p (const_gimple gs) | |
3124 | { | |
3125 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
3126 | return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0; | |
3127 | } | |
3128 | ||
3129 | ||
3130 | /* If VOLATLE_P is true, mark asm statement GS as volatile. */ | |
3131 | ||
3132 | static inline void | |
3133 | gimple_asm_set_volatile (gimple gs, bool volatile_p) | |
3134 | { | |
3135 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
3136 | if (volatile_p) | |
3137 | gs->gsbase.subcode |= GF_ASM_VOLATILE; | |
3138 | else | |
3139 | gs->gsbase.subcode &= ~GF_ASM_VOLATILE; | |
3140 | } | |
3141 | ||
3142 | ||
3143 | /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */ | |
3144 | ||
3145 | static inline void | |
3146 | gimple_asm_set_input (gimple gs, bool input_p) | |
3147 | { | |
3148 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
3149 | if (input_p) | |
3150 | gs->gsbase.subcode |= GF_ASM_INPUT; | |
3151 | else | |
3152 | gs->gsbase.subcode &= ~GF_ASM_INPUT; | |
3153 | } | |
3154 | ||
3155 | ||
3156 | /* Return true if asm GS is an ASM_INPUT. */ | |
3157 | ||
3158 | static inline bool | |
3159 | gimple_asm_input_p (const_gimple gs) | |
3160 | { | |
3161 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
3162 | return (gs->gsbase.subcode & GF_ASM_INPUT) != 0; | |
3163 | } | |
3164 | ||
3165 | ||
3166 | /* Return the types handled by GIMPLE_CATCH statement GS. */ | |
3167 | ||
3168 | static inline tree | |
3169 | gimple_catch_types (const_gimple gs) | |
3170 | { | |
3171 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
3172 | return gs->gimple_catch.types; | |
3173 | } | |
3174 | ||
3175 | ||
3176 | /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */ | |
3177 | ||
3178 | static inline tree * | |
3179 | gimple_catch_types_ptr (gimple gs) | |
3180 | { | |
3181 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
3182 | return &gs->gimple_catch.types; | |
3183 | } | |
3184 | ||
3185 | ||
726a989a RB |
3186 | /* Return a pointer to the GIMPLE sequence representing the body of |
3187 | the handler of GIMPLE_CATCH statement GS. */ | |
3188 | ||
3189 | static inline gimple_seq * | |
3190 | gimple_catch_handler_ptr (gimple gs) | |
3191 | { | |
3192 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
3193 | return &gs->gimple_catch.handler; | |
3194 | } | |
3195 | ||
3196 | ||
355a7673 MM |
3197 | /* Return the GIMPLE sequence representing the body of the handler of |
3198 | GIMPLE_CATCH statement GS. */ | |
3199 | ||
3200 | static inline gimple_seq | |
3201 | gimple_catch_handler (gimple gs) | |
3202 | { | |
3203 | return *gimple_catch_handler_ptr (gs); | |
3204 | } | |
3205 | ||
3206 | ||
726a989a RB |
3207 | /* Set T to be the set of types handled by GIMPLE_CATCH GS. */ |
3208 | ||
3209 | static inline void | |
3210 | gimple_catch_set_types (gimple gs, tree t) | |
3211 | { | |
3212 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
3213 | gs->gimple_catch.types = t; | |
3214 | } | |
3215 | ||
3216 | ||
3217 | /* Set HANDLER to be the body of GIMPLE_CATCH GS. */ | |
3218 | ||
3219 | static inline void | |
3220 | gimple_catch_set_handler (gimple gs, gimple_seq handler) | |
3221 | { | |
3222 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
3223 | gs->gimple_catch.handler = handler; | |
3224 | } | |
3225 | ||
3226 | ||
3227 | /* Return the types handled by GIMPLE_EH_FILTER statement GS. */ | |
3228 | ||
3229 | static inline tree | |
3230 | gimple_eh_filter_types (const_gimple gs) | |
3231 | { | |
3232 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
3233 | return gs->gimple_eh_filter.types; | |
3234 | } | |
3235 | ||
3236 | ||
3237 | /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement | |
3238 | GS. */ | |
3239 | ||
3240 | static inline tree * | |
3241 | gimple_eh_filter_types_ptr (gimple gs) | |
3242 | { | |
3243 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
3244 | return &gs->gimple_eh_filter.types; | |
3245 | } | |
3246 | ||
3247 | ||
355a7673 MM |
3248 | /* Return a pointer to the sequence of statement to execute when |
3249 | GIMPLE_EH_FILTER statement fails. */ | |
3250 | ||
3251 | static inline gimple_seq * | |
3252 | gimple_eh_filter_failure_ptr (gimple gs) | |
3253 | { | |
3254 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
3255 | return &gs->gimple_eh_filter.failure; | |
3256 | } | |
3257 | ||
3258 | ||
726a989a RB |
3259 | /* Return the sequence of statement to execute when GIMPLE_EH_FILTER |
3260 | statement fails. */ | |
3261 | ||
3262 | static inline gimple_seq | |
3263 | gimple_eh_filter_failure (gimple gs) | |
3264 | { | |
355a7673 | 3265 | return *gimple_eh_filter_failure_ptr (gs); |
726a989a RB |
3266 | } |
3267 | ||
3268 | ||
3269 | /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */ | |
3270 | ||
3271 | static inline void | |
3272 | gimple_eh_filter_set_types (gimple gs, tree types) | |
3273 | { | |
3274 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
3275 | gs->gimple_eh_filter.types = types; | |
3276 | } | |
3277 | ||
3278 | ||
3279 | /* Set FAILURE to be the sequence of statements to execute on failure | |
3280 | for GIMPLE_EH_FILTER GS. */ | |
3281 | ||
3282 | static inline void | |
3283 | gimple_eh_filter_set_failure (gimple gs, gimple_seq failure) | |
3284 | { | |
3285 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
3286 | gs->gimple_eh_filter.failure = failure; | |
3287 | } | |
3288 | ||
1d65f45c | 3289 | /* Get the function decl to be called by the MUST_NOT_THROW region. */ |
726a989a | 3290 | |
1d65f45c RH |
3291 | static inline tree |
3292 | gimple_eh_must_not_throw_fndecl (gimple gs) | |
726a989a | 3293 | { |
1d65f45c RH |
3294 | GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW); |
3295 | return gs->gimple_eh_mnt.fndecl; | |
726a989a RB |
3296 | } |
3297 | ||
d7f09764 DN |
3298 | /* Set the function decl to be called by GS to DECL. */ |
3299 | ||
3300 | static inline void | |
3301 | gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl) | |
3302 | { | |
3303 | GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW); | |
3304 | gs->gimple_eh_mnt.fndecl = decl; | |
3305 | } | |
3306 | ||
0a35513e AH |
3307 | /* GIMPLE_EH_ELSE accessors. */ |
3308 | ||
355a7673 MM |
3309 | static inline gimple_seq * |
3310 | gimple_eh_else_n_body_ptr (gimple gs) | |
3311 | { | |
3312 | GIMPLE_CHECK (gs, GIMPLE_EH_ELSE); | |
3313 | return &gs->gimple_eh_else.n_body; | |
3314 | } | |
3315 | ||
0a35513e AH |
3316 | static inline gimple_seq |
3317 | gimple_eh_else_n_body (gimple gs) | |
355a7673 MM |
3318 | { |
3319 | return *gimple_eh_else_n_body_ptr (gs); | |
3320 | } | |
3321 | ||
3322 | static inline gimple_seq * | |
3323 | gimple_eh_else_e_body_ptr (gimple gs) | |
0a35513e AH |
3324 | { |
3325 | GIMPLE_CHECK (gs, GIMPLE_EH_ELSE); | |
355a7673 | 3326 | return &gs->gimple_eh_else.e_body; |
0a35513e AH |
3327 | } |
3328 | ||
3329 | static inline gimple_seq | |
3330 | gimple_eh_else_e_body (gimple gs) | |
3331 | { | |
355a7673 | 3332 | return *gimple_eh_else_e_body_ptr (gs); |
0a35513e AH |
3333 | } |
3334 | ||
3335 | static inline void | |
3336 | gimple_eh_else_set_n_body (gimple gs, gimple_seq seq) | |
3337 | { | |
3338 | GIMPLE_CHECK (gs, GIMPLE_EH_ELSE); | |
3339 | gs->gimple_eh_else.n_body = seq; | |
3340 | } | |
3341 | ||
3342 | static inline void | |
3343 | gimple_eh_else_set_e_body (gimple gs, gimple_seq seq) | |
3344 | { | |
3345 | GIMPLE_CHECK (gs, GIMPLE_EH_ELSE); | |
3346 | gs->gimple_eh_else.e_body = seq; | |
3347 | } | |
d7f09764 | 3348 | |
726a989a RB |
3349 | /* GIMPLE_TRY accessors. */ |
3350 | ||
3351 | /* Return the kind of try block represented by GIMPLE_TRY GS. This is | |
3352 | either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */ | |
3353 | ||
3354 | static inline enum gimple_try_flags | |
3355 | gimple_try_kind (const_gimple gs) | |
3356 | { | |
3357 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
3358 | return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND); | |
3359 | } | |
3360 | ||
3361 | ||
3362 | /* Set the kind of try block represented by GIMPLE_TRY GS. */ | |
3363 | ||
3364 | static inline void | |
3365 | gimple_try_set_kind (gimple gs, enum gimple_try_flags kind) | |
3366 | { | |
3367 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2bc0a660 JH |
3368 | gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH |
3369 | || kind == GIMPLE_TRY_FINALLY); | |
726a989a RB |
3370 | if (gimple_try_kind (gs) != kind) |
3371 | gs->gsbase.subcode = (unsigned int) kind; | |
3372 | } | |
3373 | ||
3374 | ||
3375 | /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ | |
3376 | ||
3377 | static inline bool | |
3378 | gimple_try_catch_is_cleanup (const_gimple gs) | |
3379 | { | |
2bc0a660 | 3380 | gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); |
726a989a RB |
3381 | return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0; |
3382 | } | |
3383 | ||
3384 | ||
355a7673 MM |
3385 | /* Return a pointer to the sequence of statements used as the |
3386 | body for GIMPLE_TRY GS. */ | |
3387 | ||
3388 | static inline gimple_seq * | |
3389 | gimple_try_eval_ptr (gimple gs) | |
3390 | { | |
3391 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
3392 | return &gs->gimple_try.eval; | |
3393 | } | |
3394 | ||
3395 | ||
726a989a RB |
3396 | /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ |
3397 | ||
3398 | static inline gimple_seq | |
3399 | gimple_try_eval (gimple gs) | |
355a7673 MM |
3400 | { |
3401 | return *gimple_try_eval_ptr (gs); | |
3402 | } | |
3403 | ||
3404 | ||
3405 | /* Return a pointer to the sequence of statements used as the cleanup body for | |
3406 | GIMPLE_TRY GS. */ | |
3407 | ||
3408 | static inline gimple_seq * | |
3409 | gimple_try_cleanup_ptr (gimple gs) | |
726a989a RB |
3410 | { |
3411 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
355a7673 | 3412 | return &gs->gimple_try.cleanup; |
726a989a RB |
3413 | } |
3414 | ||
3415 | ||
3416 | /* Return the sequence of statements used as the cleanup body for | |
3417 | GIMPLE_TRY GS. */ | |
3418 | ||
3419 | static inline gimple_seq | |
3420 | gimple_try_cleanup (gimple gs) | |
3421 | { | |
355a7673 | 3422 | return *gimple_try_cleanup_ptr (gs); |
726a989a RB |
3423 | } |
3424 | ||
3425 | ||
3426 | /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ | |
3427 | ||
3428 | static inline void | |
3429 | gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup) | |
3430 | { | |
2bc0a660 | 3431 | gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); |
726a989a RB |
3432 | if (catch_is_cleanup) |
3433 | g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP; | |
3434 | else | |
3435 | g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP; | |
3436 | } | |
3437 | ||
3438 | ||
3439 | /* Set EVAL to be the sequence of statements to use as the body for | |
3440 | GIMPLE_TRY GS. */ | |
3441 | ||
3442 | static inline void | |
3443 | gimple_try_set_eval (gimple gs, gimple_seq eval) | |
3444 | { | |
3445 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
3446 | gs->gimple_try.eval = eval; | |
3447 | } | |
3448 | ||
3449 | ||
3450 | /* Set CLEANUP to be the sequence of statements to use as the cleanup | |
3451 | body for GIMPLE_TRY GS. */ | |
3452 | ||
3453 | static inline void | |
3454 | gimple_try_set_cleanup (gimple gs, gimple_seq cleanup) | |
3455 | { | |
3456 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
3457 | gs->gimple_try.cleanup = cleanup; | |
3458 | } | |
3459 | ||
3460 | ||
355a7673 MM |
3461 | /* Return a pointer to the cleanup sequence for cleanup statement GS. */ |
3462 | ||
3463 | static inline gimple_seq * | |
3464 | gimple_wce_cleanup_ptr (gimple gs) | |
3465 | { | |
3466 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
3467 | return &gs->gimple_wce.cleanup; | |
3468 | } | |
3469 | ||
3470 | ||
726a989a RB |
3471 | /* Return the cleanup sequence for cleanup statement GS. */ |
3472 | ||
3473 | static inline gimple_seq | |
3474 | gimple_wce_cleanup (gimple gs) | |
3475 | { | |
355a7673 | 3476 | return *gimple_wce_cleanup_ptr (gs); |
726a989a RB |
3477 | } |
3478 | ||
3479 | ||
3480 | /* Set CLEANUP to be the cleanup sequence for GS. */ | |
3481 | ||
3482 | static inline void | |
3483 | gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup) | |
3484 | { | |
3485 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
3486 | gs->gimple_wce.cleanup = cleanup; | |
3487 | } | |
3488 | ||
3489 | ||
3490 | /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */ | |
3491 | ||
3492 | static inline bool | |
3493 | gimple_wce_cleanup_eh_only (const_gimple gs) | |
3494 | { | |
3495 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
3496 | return gs->gsbase.subcode != 0; | |
3497 | } | |
3498 | ||
3499 | ||
3500 | /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */ | |
3501 | ||
3502 | static inline void | |
3503 | gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p) | |
3504 | { | |
3505 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
3506 | gs->gsbase.subcode = (unsigned int) eh_only_p; | |
3507 | } | |
3508 | ||
3509 | ||
3510 | /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */ | |
3511 | ||
3512 | static inline unsigned | |
3513 | gimple_phi_capacity (const_gimple gs) | |
3514 | { | |
3515 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3516 | return gs->gimple_phi.capacity; | |
3517 | } | |
3518 | ||
3519 | ||
3520 | /* Return the number of arguments in GIMPLE_PHI GS. This must always | |
3521 | be exactly the number of incoming edges for the basic block holding | |
3522 | GS. */ | |
3523 | ||
3524 | static inline unsigned | |
3525 | gimple_phi_num_args (const_gimple gs) | |
3526 | { | |
3527 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3528 | return gs->gimple_phi.nargs; | |
3529 | } | |
3530 | ||
3531 | ||
3532 | /* Return the SSA name created by GIMPLE_PHI GS. */ | |
3533 | ||
3534 | static inline tree | |
3535 | gimple_phi_result (const_gimple gs) | |
3536 | { | |
3537 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3538 | return gs->gimple_phi.result; | |
3539 | } | |
3540 | ||
3541 | /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */ | |
3542 | ||
3543 | static inline tree * | |
3544 | gimple_phi_result_ptr (gimple gs) | |
3545 | { | |
3546 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3547 | return &gs->gimple_phi.result; | |
3548 | } | |
3549 | ||
3550 | /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */ | |
3551 | ||
3552 | static inline void | |
3553 | gimple_phi_set_result (gimple gs, tree result) | |
3554 | { | |
3555 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3556 | gs->gimple_phi.result = result; | |
dcc748dd RG |
3557 | if (result && TREE_CODE (result) == SSA_NAME) |
3558 | SSA_NAME_DEF_STMT (result) = gs; | |
726a989a RB |
3559 | } |
3560 | ||
3561 | ||
3562 | /* Return the PHI argument corresponding to incoming edge INDEX for | |
3563 | GIMPLE_PHI GS. */ | |
3564 | ||
3565 | static inline struct phi_arg_d * | |
3566 | gimple_phi_arg (gimple gs, unsigned index) | |
3567 | { | |
3568 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
2bc0a660 | 3569 | gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity); |
726a989a RB |
3570 | return &(gs->gimple_phi.args[index]); |
3571 | } | |
3572 | ||
3573 | /* Set PHIARG to be the argument corresponding to incoming edge INDEX | |
3574 | for GIMPLE_PHI GS. */ | |
3575 | ||
3576 | static inline void | |
3577 | gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg) | |
3578 | { | |
3579 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
2bc0a660 JH |
3580 | gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs); |
3581 | gs->gimple_phi.args[index] = *phiarg; | |
726a989a RB |
3582 | } |
3583 | ||
3584 | /* Return the region number for GIMPLE_RESX GS. */ | |
3585 | ||
3586 | static inline int | |
3587 | gimple_resx_region (const_gimple gs) | |
3588 | { | |
3589 | GIMPLE_CHECK (gs, GIMPLE_RESX); | |
1d65f45c | 3590 | return gs->gimple_eh_ctrl.region; |
726a989a RB |
3591 | } |
3592 | ||
3593 | /* Set REGION to be the region number for GIMPLE_RESX GS. */ | |
3594 | ||
3595 | static inline void | |
3596 | gimple_resx_set_region (gimple gs, int region) | |
3597 | { | |
3598 | GIMPLE_CHECK (gs, GIMPLE_RESX); | |
1d65f45c | 3599 | gs->gimple_eh_ctrl.region = region; |
726a989a RB |
3600 | } |
3601 | ||
1d65f45c RH |
3602 | /* Return the region number for GIMPLE_EH_DISPATCH GS. */ |
3603 | ||
3604 | static inline int | |
3605 | gimple_eh_dispatch_region (const_gimple gs) | |
3606 | { | |
3607 | GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH); | |
3608 | return gs->gimple_eh_ctrl.region; | |
3609 | } | |
3610 | ||
3611 | /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */ | |
3612 | ||
3613 | static inline void | |
3614 | gimple_eh_dispatch_set_region (gimple gs, int region) | |
3615 | { | |
3616 | GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH); | |
3617 | gs->gimple_eh_ctrl.region = region; | |
3618 | } | |
726a989a RB |
3619 | |
3620 | /* Return the number of labels associated with the switch statement GS. */ | |
3621 | ||
3622 | static inline unsigned | |
3623 | gimple_switch_num_labels (const_gimple gs) | |
3624 | { | |
3625 | unsigned num_ops; | |
3626 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3627 | num_ops = gimple_num_ops (gs); | |
2bc0a660 | 3628 | gcc_gimple_checking_assert (num_ops > 1); |
726a989a RB |
3629 | return num_ops - 1; |
3630 | } | |
3631 | ||
3632 | ||
3633 | /* Set NLABELS to be the number of labels for the switch statement GS. */ | |
3634 | ||
3635 | static inline void | |
3636 | gimple_switch_set_num_labels (gimple g, unsigned nlabels) | |
3637 | { | |
3638 | GIMPLE_CHECK (g, GIMPLE_SWITCH); | |
3639 | gimple_set_num_ops (g, nlabels + 1); | |
3640 | } | |
3641 | ||
3642 | ||
3643 | /* Return the index variable used by the switch statement GS. */ | |
3644 | ||
3645 | static inline tree | |
3646 | gimple_switch_index (const_gimple gs) | |
3647 | { | |
3648 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3649 | return gimple_op (gs, 0); | |
3650 | } | |
3651 | ||
3652 | ||
3653 | /* Return a pointer to the index variable for the switch statement GS. */ | |
3654 | ||
3655 | static inline tree * | |
3656 | gimple_switch_index_ptr (const_gimple gs) | |
3657 | { | |
3658 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3659 | return gimple_op_ptr (gs, 0); | |
3660 | } | |
3661 | ||
3662 | ||
3663 | /* Set INDEX to be the index variable for switch statement GS. */ | |
3664 | ||
3665 | static inline void | |
3666 | gimple_switch_set_index (gimple gs, tree index) | |
3667 | { | |
3668 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
2bc0a660 | 3669 | gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); |
726a989a RB |
3670 | gimple_set_op (gs, 0, index); |
3671 | } | |
3672 | ||
3673 | ||
3674 | /* Return the label numbered INDEX. The default label is 0, followed by any | |
3675 | labels in a switch statement. */ | |
3676 | ||
3677 | static inline tree | |
3678 | gimple_switch_label (const_gimple gs, unsigned index) | |
3679 | { | |
3680 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
2bc0a660 | 3681 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1); |
726a989a RB |
3682 | return gimple_op (gs, index + 1); |
3683 | } | |
3684 | ||
3685 | /* Set the label number INDEX to LABEL. 0 is always the default label. */ | |
3686 | ||
3687 | static inline void | |
3688 | gimple_switch_set_label (gimple gs, unsigned index, tree label) | |
3689 | { | |
3690 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
2bc0a660 JH |
3691 | gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1 |
3692 | && (label == NULL_TREE | |
3693 | || TREE_CODE (label) == CASE_LABEL_EXPR)); | |
726a989a RB |
3694 | gimple_set_op (gs, index + 1, label); |
3695 | } | |
3696 | ||
3697 | /* Return the default label for a switch statement. */ | |
3698 | ||
3699 | static inline tree | |
3700 | gimple_switch_default_label (const_gimple gs) | |
3701 | { | |
fd8d363e SB |
3702 | tree label = gimple_switch_label (gs, 0); |
3703 | gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); | |
3704 | return label; | |
726a989a RB |
3705 | } |
3706 | ||
3707 | /* Set the default label for a switch statement. */ | |
3708 | ||
3709 | static inline void | |
3710 | gimple_switch_set_default_label (gimple gs, tree label) | |
3711 | { | |
fd8d363e | 3712 | gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label)); |
726a989a RB |
3713 | gimple_switch_set_label (gs, 0, label); |
3714 | } | |
3715 | ||
b5b8b0ac AO |
3716 | /* Return true if GS is a GIMPLE_DEBUG statement. */ |
3717 | ||
3718 | static inline bool | |
3719 | is_gimple_debug (const_gimple gs) | |
3720 | { | |
3721 | return gimple_code (gs) == GIMPLE_DEBUG; | |
3722 | } | |
3723 | ||
3724 | /* Return true if S is a GIMPLE_DEBUG BIND statement. */ | |
3725 | ||
3726 | static inline bool | |
3727 | gimple_debug_bind_p (const_gimple s) | |
3728 | { | |
3729 | if (is_gimple_debug (s)) | |
3730 | return s->gsbase.subcode == GIMPLE_DEBUG_BIND; | |
3731 | ||
3732 | return false; | |
3733 | } | |
3734 | ||
3735 | /* Return the variable bound in a GIMPLE_DEBUG bind statement. */ | |
3736 | ||
3737 | static inline tree | |
3738 | gimple_debug_bind_get_var (gimple dbg) | |
3739 | { | |
3740 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3741 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3742 | return gimple_op (dbg, 0); |
3743 | } | |
3744 | ||
3745 | /* Return the value bound to the variable in a GIMPLE_DEBUG bind | |
3746 | statement. */ | |
3747 | ||
3748 | static inline tree | |
3749 | gimple_debug_bind_get_value (gimple dbg) | |
3750 | { | |
3751 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3752 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3753 | return gimple_op (dbg, 1); |
3754 | } | |
3755 | ||
3756 | /* Return a pointer to the value bound to the variable in a | |
3757 | GIMPLE_DEBUG bind statement. */ | |
3758 | ||
3759 | static inline tree * | |
3760 | gimple_debug_bind_get_value_ptr (gimple dbg) | |
3761 | { | |
3762 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3763 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3764 | return gimple_op_ptr (dbg, 1); |
3765 | } | |
3766 | ||
3767 | /* Set the variable bound in a GIMPLE_DEBUG bind statement. */ | |
3768 | ||
3769 | static inline void | |
3770 | gimple_debug_bind_set_var (gimple dbg, tree var) | |
3771 | { | |
3772 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3773 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3774 | gimple_set_op (dbg, 0, var); |
3775 | } | |
3776 | ||
3777 | /* Set the value bound to the variable in a GIMPLE_DEBUG bind | |
3778 | statement. */ | |
3779 | ||
3780 | static inline void | |
3781 | gimple_debug_bind_set_value (gimple dbg, tree value) | |
3782 | { | |
3783 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3784 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3785 | gimple_set_op (dbg, 1, value); |
3786 | } | |
3787 | ||
3788 | /* The second operand of a GIMPLE_DEBUG_BIND, when the value was | |
3789 | optimized away. */ | |
3790 | #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */ | |
3791 | ||
3792 | /* Remove the value bound to the variable in a GIMPLE_DEBUG bind | |
3793 | statement. */ | |
3794 | ||
3795 | static inline void | |
3796 | gimple_debug_bind_reset_value (gimple dbg) | |
3797 | { | |
3798 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3799 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3800 | gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE); |
3801 | } | |
3802 | ||
3803 | /* Return true if the GIMPLE_DEBUG bind statement is bound to a | |
3804 | value. */ | |
3805 | ||
3806 | static inline bool | |
3807 | gimple_debug_bind_has_value_p (gimple dbg) | |
3808 | { | |
3809 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
2bc0a660 | 3810 | gcc_gimple_checking_assert (gimple_debug_bind_p (dbg)); |
b5b8b0ac AO |
3811 | return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE; |
3812 | } | |
3813 | ||
3814 | #undef GIMPLE_DEBUG_BIND_NOVALUE | |
726a989a | 3815 | |
ddb555ed JJ |
3816 | /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */ |
3817 | ||
3818 | static inline bool | |
3819 | gimple_debug_source_bind_p (const_gimple s) | |
3820 | { | |
3821 | if (is_gimple_debug (s)) | |
3822 | return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND; | |
3823 | ||
3824 | return false; | |
3825 | } | |
3826 | ||
3827 | /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */ | |
3828 | ||
3829 | static inline tree | |
3830 | gimple_debug_source_bind_get_var (gimple dbg) | |
3831 | { | |
3832 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
3833 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
3834 | return gimple_op (dbg, 0); | |
3835 | } | |
3836 | ||
3837 | /* Return the value bound to the variable in a GIMPLE_DEBUG source bind | |
3838 | statement. */ | |
3839 | ||
3840 | static inline tree | |
3841 | gimple_debug_source_bind_get_value (gimple dbg) | |
3842 | { | |
3843 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
3844 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
3845 | return gimple_op (dbg, 1); | |
3846 | } | |
3847 | ||
3848 | /* Return a pointer to the value bound to the variable in a | |
3849 | GIMPLE_DEBUG source bind statement. */ | |
3850 | ||
3851 | static inline tree * | |
3852 | gimple_debug_source_bind_get_value_ptr (gimple dbg) | |
3853 | { | |
3854 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
3855 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
3856 | return gimple_op_ptr (dbg, 1); | |
3857 | } | |
3858 | ||
3859 | /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */ | |
3860 | ||
3861 | static inline void | |
3862 | gimple_debug_source_bind_set_var (gimple dbg, tree var) | |
3863 | { | |
3864 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
3865 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
3866 | gimple_set_op (dbg, 0, var); | |
3867 | } | |
3868 | ||
3869 | /* Set the value bound to the variable in a GIMPLE_DEBUG source bind | |
3870 | statement. */ | |
3871 | ||
3872 | static inline void | |
3873 | gimple_debug_source_bind_set_value (gimple dbg, tree value) | |
3874 | { | |
3875 | GIMPLE_CHECK (dbg, GIMPLE_DEBUG); | |
3876 | gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg)); | |
3877 | gimple_set_op (dbg, 1, value); | |
3878 | } | |
3879 | ||
355a7673 MM |
3880 | /* Return a pointer to the body for the OMP statement GS. */ |
3881 | ||
3882 | static inline gimple_seq * | |
3883 | gimple_omp_body_ptr (gimple gs) | |
3884 | { | |
3885 | return &gs->omp.body; | |
3886 | } | |
3887 | ||
726a989a RB |
3888 | /* Return the body for the OMP statement GS. */ |
3889 | ||
b8698a0f | 3890 | static inline gimple_seq |
726a989a RB |
3891 | gimple_omp_body (gimple gs) |
3892 | { | |
355a7673 | 3893 | return *gimple_omp_body_ptr (gs); |
726a989a RB |
3894 | } |
3895 | ||
3896 | /* Set BODY to be the body for the OMP statement GS. */ | |
3897 | ||
3898 | static inline void | |
3899 | gimple_omp_set_body (gimple gs, gimple_seq body) | |
3900 | { | |
3901 | gs->omp.body = body; | |
3902 | } | |
3903 | ||
3904 | ||
3905 | /* Return the name associated with OMP_CRITICAL statement GS. */ | |
3906 | ||
3907 | static inline tree | |
3908 | gimple_omp_critical_name (const_gimple gs) | |
3909 | { | |
3910 | GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL); | |
3911 | return gs->gimple_omp_critical.name; | |
3912 | } | |
3913 | ||
3914 | ||
3915 | /* Return a pointer to the name associated with OMP critical statement GS. */ | |
3916 | ||
3917 | static inline tree * | |
3918 | gimple_omp_critical_name_ptr (gimple gs) | |
3919 | { | |
3920 | GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL); | |
3921 | return &gs->gimple_omp_critical.name; | |
3922 | } | |
3923 | ||
3924 | ||
3925 | /* Set NAME to be the name associated with OMP critical statement GS. */ | |
3926 | ||
3927 | static inline void | |
3928 | gimple_omp_critical_set_name (gimple gs, tree name) | |
3929 | { | |
3930 | GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL); | |
3931 | gs->gimple_omp_critical.name = name; | |
3932 | } | |
3933 | ||
3934 | ||
74bf76ed JJ |
3935 | /* Return the kind of OMP for statemement. */ |
3936 | ||
3937 | static inline int | |
3938 | gimple_omp_for_kind (const_gimple g) | |
3939 | { | |
3940 | GIMPLE_CHECK (g, GIMPLE_OMP_FOR); | |
3941 | return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK); | |
3942 | } | |
3943 | ||
3944 | ||
3945 | /* Set the OMP for kind. */ | |
3946 | ||
3947 | static inline void | |
3948 | gimple_omp_for_set_kind (gimple g, int kind) | |
3949 | { | |
3950 | GIMPLE_CHECK (g, GIMPLE_OMP_FOR); | |
3951 | g->gsbase.subcode = (g->gsbase.subcode & ~GF_OMP_FOR_KIND_MASK) | |
3952 | | (kind & GF_OMP_FOR_KIND_MASK); | |
3953 | } | |
3954 | ||
3955 | ||
726a989a RB |
3956 | /* Return the clauses associated with OMP_FOR GS. */ |
3957 | ||
3958 | static inline tree | |
3959 | gimple_omp_for_clauses (const_gimple gs) | |
3960 | { | |
3961 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3962 | return gs->gimple_omp_for.clauses; | |
3963 | } | |
3964 | ||
3965 | ||
3966 | /* Return a pointer to the OMP_FOR GS. */ | |
3967 | ||
3968 | static inline tree * | |
3969 | gimple_omp_for_clauses_ptr (gimple gs) | |
3970 | { | |
3971 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3972 | return &gs->gimple_omp_for.clauses; | |
3973 | } | |
3974 | ||
3975 | ||
3976 | /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */ | |
3977 | ||
3978 | static inline void | |
3979 | gimple_omp_for_set_clauses (gimple gs, tree clauses) | |
3980 | { | |
3981 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3982 | gs->gimple_omp_for.clauses = clauses; | |
3983 | } | |
3984 | ||
3985 | ||
3986 | /* Get the collapse count of OMP_FOR GS. */ | |
3987 | ||
3988 | static inline size_t | |
3989 | gimple_omp_for_collapse (gimple gs) | |
3990 | { | |
3991 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3992 | return gs->gimple_omp_for.collapse; | |
3993 | } | |
3994 | ||
3995 | ||
3996 | /* Return the index variable for OMP_FOR GS. */ | |
3997 | ||
3998 | static inline tree | |
3999 | gimple_omp_for_index (const_gimple gs, size_t i) | |
4000 | { | |
4001 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4002 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4003 | return gs->gimple_omp_for.iter[i].index; |
4004 | } | |
4005 | ||
4006 | ||
4007 | /* Return a pointer to the index variable for OMP_FOR GS. */ | |
4008 | ||
4009 | static inline tree * | |
4010 | gimple_omp_for_index_ptr (gimple gs, size_t i) | |
4011 | { | |
4012 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4013 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4014 | return &gs->gimple_omp_for.iter[i].index; |
4015 | } | |
4016 | ||
4017 | ||
4018 | /* Set INDEX to be the index variable for OMP_FOR GS. */ | |
4019 | ||
4020 | static inline void | |
4021 | gimple_omp_for_set_index (gimple gs, size_t i, tree index) | |
4022 | { | |
4023 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4024 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4025 | gs->gimple_omp_for.iter[i].index = index; |
4026 | } | |
4027 | ||
4028 | ||
4029 | /* Return the initial value for OMP_FOR GS. */ | |
4030 | ||
4031 | static inline tree | |
4032 | gimple_omp_for_initial (const_gimple gs, size_t i) | |
4033 | { | |
4034 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4035 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4036 | return gs->gimple_omp_for.iter[i].initial; |
4037 | } | |
4038 | ||
4039 | ||
4040 | /* Return a pointer to the initial value for OMP_FOR GS. */ | |
4041 | ||
4042 | static inline tree * | |
4043 | gimple_omp_for_initial_ptr (gimple gs, size_t i) | |
4044 | { | |
4045 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4046 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4047 | return &gs->gimple_omp_for.iter[i].initial; |
4048 | } | |
4049 | ||
4050 | ||
4051 | /* Set INITIAL to be the initial value for OMP_FOR GS. */ | |
4052 | ||
4053 | static inline void | |
4054 | gimple_omp_for_set_initial (gimple gs, size_t i, tree initial) | |
4055 | { | |
4056 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4057 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4058 | gs->gimple_omp_for.iter[i].initial = initial; |
4059 | } | |
4060 | ||
4061 | ||
4062 | /* Return the final value for OMP_FOR GS. */ | |
4063 | ||
4064 | static inline tree | |
4065 | gimple_omp_for_final (const_gimple gs, size_t i) | |
4066 | { | |
4067 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4068 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4069 | return gs->gimple_omp_for.iter[i].final; |
4070 | } | |
4071 | ||
4072 | ||
4073 | /* Return a pointer to the final value for OMP_FOR GS. */ | |
4074 | ||
4075 | static inline tree * | |
4076 | gimple_omp_for_final_ptr (gimple gs, size_t i) | |
4077 | { | |
4078 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4079 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4080 | return &gs->gimple_omp_for.iter[i].final; |
4081 | } | |
4082 | ||
4083 | ||
4084 | /* Set FINAL to be the final value for OMP_FOR GS. */ | |
4085 | ||
4086 | static inline void | |
4087 | gimple_omp_for_set_final (gimple gs, size_t i, tree final) | |
4088 | { | |
4089 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4090 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4091 | gs->gimple_omp_for.iter[i].final = final; |
4092 | } | |
4093 | ||
4094 | ||
4095 | /* Return the increment value for OMP_FOR GS. */ | |
4096 | ||
4097 | static inline tree | |
4098 | gimple_omp_for_incr (const_gimple gs, size_t i) | |
4099 | { | |
4100 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4101 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4102 | return gs->gimple_omp_for.iter[i].incr; |
4103 | } | |
4104 | ||
4105 | ||
4106 | /* Return a pointer to the increment value for OMP_FOR GS. */ | |
4107 | ||
4108 | static inline tree * | |
4109 | gimple_omp_for_incr_ptr (gimple gs, size_t i) | |
4110 | { | |
4111 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4112 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4113 | return &gs->gimple_omp_for.iter[i].incr; |
4114 | } | |
4115 | ||
4116 | ||
4117 | /* Set INCR to be the increment value for OMP_FOR GS. */ | |
4118 | ||
4119 | static inline void | |
4120 | gimple_omp_for_set_incr (gimple gs, size_t i, tree incr) | |
4121 | { | |
4122 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4123 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4124 | gs->gimple_omp_for.iter[i].incr = incr; |
4125 | } | |
4126 | ||
4127 | ||
355a7673 MM |
4128 | /* Return a pointer to the sequence of statements to execute before the OMP_FOR |
4129 | statement GS starts. */ | |
4130 | ||
4131 | static inline gimple_seq * | |
4132 | gimple_omp_for_pre_body_ptr (gimple gs) | |
4133 | { | |
4134 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
4135 | return &gs->gimple_omp_for.pre_body; | |
4136 | } | |
4137 | ||
4138 | ||
726a989a RB |
4139 | /* Return the sequence of statements to execute before the OMP_FOR |
4140 | statement GS starts. */ | |
4141 | ||
4142 | static inline gimple_seq | |
4143 | gimple_omp_for_pre_body (gimple gs) | |
4144 | { | |
355a7673 | 4145 | return *gimple_omp_for_pre_body_ptr (gs); |
726a989a RB |
4146 | } |
4147 | ||
4148 | ||
4149 | /* Set PRE_BODY to be the sequence of statements to execute before the | |
4150 | OMP_FOR statement GS starts. */ | |
4151 | ||
4152 | static inline void | |
4153 | gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body) | |
4154 | { | |
4155 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
4156 | gs->gimple_omp_for.pre_body = pre_body; | |
4157 | } | |
4158 | ||
4159 | ||
4160 | /* Return the clauses associated with OMP_PARALLEL GS. */ | |
4161 | ||
4162 | static inline tree | |
4163 | gimple_omp_parallel_clauses (const_gimple gs) | |
4164 | { | |
4165 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4166 | return gs->gimple_omp_parallel.clauses; | |
4167 | } | |
4168 | ||
4169 | ||
4170 | /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */ | |
4171 | ||
4172 | static inline tree * | |
4173 | gimple_omp_parallel_clauses_ptr (gimple gs) | |
4174 | { | |
4175 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4176 | return &gs->gimple_omp_parallel.clauses; | |
4177 | } | |
4178 | ||
4179 | ||
4180 | /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL | |
4181 | GS. */ | |
4182 | ||
4183 | static inline void | |
4184 | gimple_omp_parallel_set_clauses (gimple gs, tree clauses) | |
4185 | { | |
4186 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4187 | gs->gimple_omp_parallel.clauses = clauses; | |
4188 | } | |
4189 | ||
4190 | ||
4191 | /* Return the child function used to hold the body of OMP_PARALLEL GS. */ | |
4192 | ||
4193 | static inline tree | |
4194 | gimple_omp_parallel_child_fn (const_gimple gs) | |
4195 | { | |
4196 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4197 | return gs->gimple_omp_parallel.child_fn; | |
4198 | } | |
4199 | ||
4200 | /* Return a pointer to the child function used to hold the body of | |
4201 | OMP_PARALLEL GS. */ | |
4202 | ||
4203 | static inline tree * | |
4204 | gimple_omp_parallel_child_fn_ptr (gimple gs) | |
4205 | { | |
4206 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4207 | return &gs->gimple_omp_parallel.child_fn; | |
4208 | } | |
4209 | ||
4210 | ||
4211 | /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */ | |
4212 | ||
4213 | static inline void | |
4214 | gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn) | |
4215 | { | |
4216 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4217 | gs->gimple_omp_parallel.child_fn = child_fn; | |
4218 | } | |
4219 | ||
4220 | ||
4221 | /* Return the artificial argument used to send variables and values | |
4222 | from the parent to the children threads in OMP_PARALLEL GS. */ | |
4223 | ||
4224 | static inline tree | |
4225 | gimple_omp_parallel_data_arg (const_gimple gs) | |
4226 | { | |
4227 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4228 | return gs->gimple_omp_parallel.data_arg; | |
4229 | } | |
4230 | ||
4231 | ||
4232 | /* Return a pointer to the data argument for OMP_PARALLEL GS. */ | |
4233 | ||
4234 | static inline tree * | |
4235 | gimple_omp_parallel_data_arg_ptr (gimple gs) | |
4236 | { | |
4237 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4238 | return &gs->gimple_omp_parallel.data_arg; | |
4239 | } | |
4240 | ||
4241 | ||
4242 | /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */ | |
4243 | ||
4244 | static inline void | |
4245 | gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg) | |
4246 | { | |
4247 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
4248 | gs->gimple_omp_parallel.data_arg = data_arg; | |
4249 | } | |
4250 | ||
4251 | ||
4252 | /* Return the clauses associated with OMP_TASK GS. */ | |
4253 | ||
4254 | static inline tree | |
4255 | gimple_omp_task_clauses (const_gimple gs) | |
4256 | { | |
4257 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4258 | return gs->gimple_omp_parallel.clauses; | |
4259 | } | |
4260 | ||
4261 | ||
4262 | /* Return a pointer to the clauses associated with OMP_TASK GS. */ | |
4263 | ||
4264 | static inline tree * | |
4265 | gimple_omp_task_clauses_ptr (gimple gs) | |
4266 | { | |
4267 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4268 | return &gs->gimple_omp_parallel.clauses; | |
4269 | } | |
4270 | ||
4271 | ||
4272 | /* Set CLAUSES to be the list of clauses associated with OMP_TASK | |
4273 | GS. */ | |
4274 | ||
4275 | static inline void | |
4276 | gimple_omp_task_set_clauses (gimple gs, tree clauses) | |
4277 | { | |
4278 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4279 | gs->gimple_omp_parallel.clauses = clauses; | |
4280 | } | |
4281 | ||
4282 | ||
4283 | /* Return the child function used to hold the body of OMP_TASK GS. */ | |
4284 | ||
4285 | static inline tree | |
4286 | gimple_omp_task_child_fn (const_gimple gs) | |
4287 | { | |
4288 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4289 | return gs->gimple_omp_parallel.child_fn; | |
4290 | } | |
4291 | ||
4292 | /* Return a pointer to the child function used to hold the body of | |
4293 | OMP_TASK GS. */ | |
4294 | ||
4295 | static inline tree * | |
4296 | gimple_omp_task_child_fn_ptr (gimple gs) | |
4297 | { | |
4298 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4299 | return &gs->gimple_omp_parallel.child_fn; | |
4300 | } | |
4301 | ||
4302 | ||
4303 | /* Set CHILD_FN to be the child function for OMP_TASK GS. */ | |
4304 | ||
4305 | static inline void | |
4306 | gimple_omp_task_set_child_fn (gimple gs, tree child_fn) | |
4307 | { | |
4308 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4309 | gs->gimple_omp_parallel.child_fn = child_fn; | |
4310 | } | |
4311 | ||
4312 | ||
4313 | /* Return the artificial argument used to send variables and values | |
4314 | from the parent to the children threads in OMP_TASK GS. */ | |
4315 | ||
4316 | static inline tree | |
4317 | gimple_omp_task_data_arg (const_gimple gs) | |
4318 | { | |
4319 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4320 | return gs->gimple_omp_parallel.data_arg; | |
4321 | } | |
4322 | ||
4323 | ||
4324 | /* Return a pointer to the data argument for OMP_TASK GS. */ | |
4325 | ||
4326 | static inline tree * | |
4327 | gimple_omp_task_data_arg_ptr (gimple gs) | |
4328 | { | |
4329 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4330 | return &gs->gimple_omp_parallel.data_arg; | |
4331 | } | |
4332 | ||
4333 | ||
4334 | /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ | |
4335 | ||
4336 | static inline void | |
4337 | gimple_omp_task_set_data_arg (gimple gs, tree data_arg) | |
4338 | { | |
4339 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4340 | gs->gimple_omp_parallel.data_arg = data_arg; | |
4341 | } | |
4342 | ||
4343 | ||
4344 | /* Return the clauses associated with OMP_TASK GS. */ | |
4345 | ||
4346 | static inline tree | |
4347 | gimple_omp_taskreg_clauses (const_gimple gs) | |
4348 | { | |
4349 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4350 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4351 | return gs->gimple_omp_parallel.clauses; | |
4352 | } | |
4353 | ||
4354 | ||
4355 | /* Return a pointer to the clauses associated with OMP_TASK GS. */ | |
4356 | ||
4357 | static inline tree * | |
4358 | gimple_omp_taskreg_clauses_ptr (gimple gs) | |
4359 | { | |
4360 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4361 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4362 | return &gs->gimple_omp_parallel.clauses; | |
4363 | } | |
4364 | ||
4365 | ||
4366 | /* Set CLAUSES to be the list of clauses associated with OMP_TASK | |
4367 | GS. */ | |
4368 | ||
4369 | static inline void | |
4370 | gimple_omp_taskreg_set_clauses (gimple gs, tree clauses) | |
4371 | { | |
4372 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4373 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4374 | gs->gimple_omp_parallel.clauses = clauses; | |
4375 | } | |
4376 | ||
4377 | ||
4378 | /* Return the child function used to hold the body of OMP_TASK GS. */ | |
4379 | ||
4380 | static inline tree | |
4381 | gimple_omp_taskreg_child_fn (const_gimple gs) | |
4382 | { | |
4383 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4384 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4385 | return gs->gimple_omp_parallel.child_fn; | |
4386 | } | |
4387 | ||
4388 | /* Return a pointer to the child function used to hold the body of | |
4389 | OMP_TASK GS. */ | |
4390 | ||
4391 | static inline tree * | |
4392 | gimple_omp_taskreg_child_fn_ptr (gimple gs) | |
4393 | { | |
4394 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4395 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4396 | return &gs->gimple_omp_parallel.child_fn; | |
4397 | } | |
4398 | ||
4399 | ||
4400 | /* Set CHILD_FN to be the child function for OMP_TASK GS. */ | |
4401 | ||
4402 | static inline void | |
4403 | gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn) | |
4404 | { | |
4405 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4406 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4407 | gs->gimple_omp_parallel.child_fn = child_fn; | |
4408 | } | |
4409 | ||
4410 | ||
4411 | /* Return the artificial argument used to send variables and values | |
4412 | from the parent to the children threads in OMP_TASK GS. */ | |
4413 | ||
4414 | static inline tree | |
4415 | gimple_omp_taskreg_data_arg (const_gimple gs) | |
4416 | { | |
4417 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4418 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4419 | return gs->gimple_omp_parallel.data_arg; | |
4420 | } | |
4421 | ||
4422 | ||
4423 | /* Return a pointer to the data argument for OMP_TASK GS. */ | |
4424 | ||
4425 | static inline tree * | |
4426 | gimple_omp_taskreg_data_arg_ptr (gimple gs) | |
4427 | { | |
4428 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4429 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4430 | return &gs->gimple_omp_parallel.data_arg; | |
4431 | } | |
4432 | ||
4433 | ||
4434 | /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ | |
4435 | ||
4436 | static inline void | |
4437 | gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg) | |
4438 | { | |
4439 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
4440 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4441 | gs->gimple_omp_parallel.data_arg = data_arg; | |
4442 | } | |
4443 | ||
4444 | ||
4445 | /* Return the copy function used to hold the body of OMP_TASK GS. */ | |
4446 | ||
4447 | static inline tree | |
4448 | gimple_omp_task_copy_fn (const_gimple gs) | |
4449 | { | |
4450 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4451 | return gs->gimple_omp_task.copy_fn; | |
4452 | } | |
4453 | ||
4454 | /* Return a pointer to the copy function used to hold the body of | |
4455 | OMP_TASK GS. */ | |
4456 | ||
4457 | static inline tree * | |
4458 | gimple_omp_task_copy_fn_ptr (gimple gs) | |
4459 | { | |
4460 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4461 | return &gs->gimple_omp_task.copy_fn; | |
4462 | } | |
4463 | ||
4464 | ||
4465 | /* Set CHILD_FN to be the copy function for OMP_TASK GS. */ | |
4466 | ||
4467 | static inline void | |
4468 | gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn) | |
4469 | { | |
4470 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4471 | gs->gimple_omp_task.copy_fn = copy_fn; | |
4472 | } | |
4473 | ||
4474 | ||
4475 | /* Return size of the data block in bytes in OMP_TASK GS. */ | |
4476 | ||
4477 | static inline tree | |
4478 | gimple_omp_task_arg_size (const_gimple gs) | |
4479 | { | |
4480 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4481 | return gs->gimple_omp_task.arg_size; | |
4482 | } | |
4483 | ||
4484 | ||
4485 | /* Return a pointer to the data block size for OMP_TASK GS. */ | |
4486 | ||
4487 | static inline tree * | |
4488 | gimple_omp_task_arg_size_ptr (gimple gs) | |
4489 | { | |
4490 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4491 | return &gs->gimple_omp_task.arg_size; | |
4492 | } | |
4493 | ||
4494 | ||
4495 | /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */ | |
4496 | ||
4497 | static inline void | |
4498 | gimple_omp_task_set_arg_size (gimple gs, tree arg_size) | |
4499 | { | |
4500 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4501 | gs->gimple_omp_task.arg_size = arg_size; | |
4502 | } | |
4503 | ||
4504 | ||
4505 | /* Return align of the data block in bytes in OMP_TASK GS. */ | |
4506 | ||
4507 | static inline tree | |
4508 | gimple_omp_task_arg_align (const_gimple gs) | |
4509 | { | |
4510 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4511 | return gs->gimple_omp_task.arg_align; | |
4512 | } | |
4513 | ||
4514 | ||
4515 | /* Return a pointer to the data block align for OMP_TASK GS. */ | |
4516 | ||
4517 | static inline tree * | |
4518 | gimple_omp_task_arg_align_ptr (gimple gs) | |
4519 | { | |
4520 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4521 | return &gs->gimple_omp_task.arg_align; | |
4522 | } | |
4523 | ||
4524 | ||
4525 | /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */ | |
4526 | ||
4527 | static inline void | |
4528 | gimple_omp_task_set_arg_align (gimple gs, tree arg_align) | |
4529 | { | |
4530 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
4531 | gs->gimple_omp_task.arg_align = arg_align; | |
4532 | } | |
4533 | ||
4534 | ||
4535 | /* Return the clauses associated with OMP_SINGLE GS. */ | |
4536 | ||
4537 | static inline tree | |
4538 | gimple_omp_single_clauses (const_gimple gs) | |
4539 | { | |
4540 | GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE); | |
4541 | return gs->gimple_omp_single.clauses; | |
4542 | } | |
4543 | ||
4544 | ||
4545 | /* Return a pointer to the clauses associated with OMP_SINGLE GS. */ | |
4546 | ||
4547 | static inline tree * | |
4548 | gimple_omp_single_clauses_ptr (gimple gs) | |
4549 | { | |
4550 | GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE); | |
4551 | return &gs->gimple_omp_single.clauses; | |
4552 | } | |
4553 | ||
4554 | ||
4555 | /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */ | |
4556 | ||
4557 | static inline void | |
4558 | gimple_omp_single_set_clauses (gimple gs, tree clauses) | |
4559 | { | |
4560 | GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE); | |
4561 | gs->gimple_omp_single.clauses = clauses; | |
4562 | } | |
4563 | ||
4564 | ||
4565 | /* Return the clauses associated with OMP_SECTIONS GS. */ | |
4566 | ||
4567 | static inline tree | |
4568 | gimple_omp_sections_clauses (const_gimple gs) | |
4569 | { | |
4570 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
4571 | return gs->gimple_omp_sections.clauses; | |
4572 | } | |
4573 | ||
4574 | ||
4575 | /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */ | |
4576 | ||
4577 | static inline tree * | |
4578 | gimple_omp_sections_clauses_ptr (gimple gs) | |
4579 | { | |
4580 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
4581 | return &gs->gimple_omp_sections.clauses; | |
4582 | } | |
4583 | ||
4584 | ||
4585 | /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS | |
4586 | GS. */ | |
4587 | ||
4588 | static inline void | |
4589 | gimple_omp_sections_set_clauses (gimple gs, tree clauses) | |
4590 | { | |
4591 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
4592 | gs->gimple_omp_sections.clauses = clauses; | |
4593 | } | |
4594 | ||
4595 | ||
4596 | /* Return the control variable associated with the GIMPLE_OMP_SECTIONS | |
4597 | in GS. */ | |
4598 | ||
4599 | static inline tree | |
4600 | gimple_omp_sections_control (const_gimple gs) | |
4601 | { | |
4602 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
4603 | return gs->gimple_omp_sections.control; | |
4604 | } | |
4605 | ||
4606 | ||
4607 | /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS | |
4608 | GS. */ | |
4609 | ||
4610 | static inline tree * | |
4611 | gimple_omp_sections_control_ptr (gimple gs) | |
4612 | { | |
4613 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
4614 | return &gs->gimple_omp_sections.control; | |
4615 | } | |
4616 | ||
4617 | ||
4618 | /* Set CONTROL to be the set of clauses associated with the | |
4619 | GIMPLE_OMP_SECTIONS in GS. */ | |
4620 | ||
4621 | static inline void | |
4622 | gimple_omp_sections_set_control (gimple gs, tree control) | |
4623 | { | |
4624 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
4625 | gs->gimple_omp_sections.control = control; | |
4626 | } | |
4627 | ||
4628 | ||
4629 | /* Set COND to be the condition code for OMP_FOR GS. */ | |
4630 | ||
4631 | static inline void | |
4632 | gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond) | |
4633 | { | |
4634 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 JH |
4635 | gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison |
4636 | && i < gs->gimple_omp_for.collapse); | |
726a989a RB |
4637 | gs->gimple_omp_for.iter[i].cond = cond; |
4638 | } | |
4639 | ||
4640 | ||
4641 | /* Return the condition code associated with OMP_FOR GS. */ | |
4642 | ||
4643 | static inline enum tree_code | |
4644 | gimple_omp_for_cond (const_gimple gs, size_t i) | |
4645 | { | |
4646 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
2bc0a660 | 4647 | gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse); |
726a989a RB |
4648 | return gs->gimple_omp_for.iter[i].cond; |
4649 | } | |
4650 | ||
4651 | ||
4652 | /* Set the value being stored in an atomic store. */ | |
4653 | ||
4654 | static inline void | |
4655 | gimple_omp_atomic_store_set_val (gimple g, tree val) | |
4656 | { | |
4657 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
4658 | g->gimple_omp_atomic_store.val = val; | |
4659 | } | |
4660 | ||
4661 | ||
4662 | /* Return the value being stored in an atomic store. */ | |
4663 | ||
4664 | static inline tree | |
4665 | gimple_omp_atomic_store_val (const_gimple g) | |
4666 | { | |
4667 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
4668 | return g->gimple_omp_atomic_store.val; | |
4669 | } | |
4670 | ||
4671 | ||
4672 | /* Return a pointer to the value being stored in an atomic store. */ | |
4673 | ||
4674 | static inline tree * | |
4675 | gimple_omp_atomic_store_val_ptr (gimple g) | |
4676 | { | |
4677 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
4678 | return &g->gimple_omp_atomic_store.val; | |
4679 | } | |
4680 | ||
4681 | ||
4682 | /* Set the LHS of an atomic load. */ | |
4683 | ||
4684 | static inline void | |
4685 | gimple_omp_atomic_load_set_lhs (gimple g, tree lhs) | |
4686 | { | |
4687 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4688 | g->gimple_omp_atomic_load.lhs = lhs; | |
4689 | } | |
4690 | ||
4691 | ||
4692 | /* Get the LHS of an atomic load. */ | |
4693 | ||
4694 | static inline tree | |
4695 | gimple_omp_atomic_load_lhs (const_gimple g) | |
4696 | { | |
4697 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4698 | return g->gimple_omp_atomic_load.lhs; | |
4699 | } | |
4700 | ||
4701 | ||
4702 | /* Return a pointer to the LHS of an atomic load. */ | |
4703 | ||
4704 | static inline tree * | |
4705 | gimple_omp_atomic_load_lhs_ptr (gimple g) | |
4706 | { | |
4707 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4708 | return &g->gimple_omp_atomic_load.lhs; | |
4709 | } | |
4710 | ||
4711 | ||
4712 | /* Set the RHS of an atomic load. */ | |
4713 | ||
4714 | static inline void | |
4715 | gimple_omp_atomic_load_set_rhs (gimple g, tree rhs) | |
4716 | { | |
4717 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4718 | g->gimple_omp_atomic_load.rhs = rhs; | |
4719 | } | |
4720 | ||
4721 | ||
4722 | /* Get the RHS of an atomic load. */ | |
4723 | ||
4724 | static inline tree | |
4725 | gimple_omp_atomic_load_rhs (const_gimple g) | |
4726 | { | |
4727 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4728 | return g->gimple_omp_atomic_load.rhs; | |
4729 | } | |
4730 | ||
4731 | ||
4732 | /* Return a pointer to the RHS of an atomic load. */ | |
4733 | ||
4734 | static inline tree * | |
4735 | gimple_omp_atomic_load_rhs_ptr (gimple g) | |
4736 | { | |
4737 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4738 | return &g->gimple_omp_atomic_load.rhs; | |
4739 | } | |
4740 | ||
4741 | ||
4742 | /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4743 | ||
4744 | static inline tree | |
4745 | gimple_omp_continue_control_def (const_gimple g) | |
4746 | { | |
4747 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4748 | return g->gimple_omp_continue.control_def; | |
4749 | } | |
4750 | ||
4751 | /* The same as above, but return the address. */ | |
4752 | ||
4753 | static inline tree * | |
4754 | gimple_omp_continue_control_def_ptr (gimple g) | |
4755 | { | |
4756 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4757 | return &g->gimple_omp_continue.control_def; | |
4758 | } | |
4759 | ||
4760 | /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4761 | ||
4762 | static inline void | |
4763 | gimple_omp_continue_set_control_def (gimple g, tree def) | |
4764 | { | |
4765 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4766 | g->gimple_omp_continue.control_def = def; | |
4767 | } | |
4768 | ||
4769 | ||
4770 | /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4771 | ||
4772 | static inline tree | |
4773 | gimple_omp_continue_control_use (const_gimple g) | |
4774 | { | |
4775 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4776 | return g->gimple_omp_continue.control_use; | |
4777 | } | |
4778 | ||
4779 | ||
4780 | /* The same as above, but return the address. */ | |
4781 | ||
4782 | static inline tree * | |
4783 | gimple_omp_continue_control_use_ptr (gimple g) | |
4784 | { | |
4785 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4786 | return &g->gimple_omp_continue.control_use; | |
4787 | } | |
4788 | ||
4789 | ||
4790 | /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4791 | ||
4792 | static inline void | |
4793 | gimple_omp_continue_set_control_use (gimple g, tree use) | |
4794 | { | |
4795 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4796 | g->gimple_omp_continue.control_use = use; | |
4797 | } | |
4798 | ||
355a7673 MM |
4799 | /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */ |
4800 | ||
4801 | static inline gimple_seq * | |
4802 | gimple_transaction_body_ptr (gimple gs) | |
4803 | { | |
4804 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4805 | return &gs->gimple_transaction.body; | |
4806 | } | |
4807 | ||
0a35513e AH |
4808 | /* Return the body for the GIMPLE_TRANSACTION statement GS. */ |
4809 | ||
4810 | static inline gimple_seq | |
4811 | gimple_transaction_body (gimple gs) | |
4812 | { | |
355a7673 | 4813 | return *gimple_transaction_body_ptr (gs); |
0a35513e AH |
4814 | } |
4815 | ||
4816 | /* Return the label associated with a GIMPLE_TRANSACTION. */ | |
4817 | ||
4818 | static inline tree | |
4819 | gimple_transaction_label (const_gimple gs) | |
4820 | { | |
4821 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4822 | return gs->gimple_transaction.label; | |
4823 | } | |
4824 | ||
4825 | static inline tree * | |
4826 | gimple_transaction_label_ptr (gimple gs) | |
4827 | { | |
4828 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4829 | return &gs->gimple_transaction.label; | |
4830 | } | |
4831 | ||
4832 | /* Return the subcode associated with a GIMPLE_TRANSACTION. */ | |
4833 | ||
4834 | static inline unsigned int | |
4835 | gimple_transaction_subcode (const_gimple gs) | |
4836 | { | |
4837 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4838 | return gs->gsbase.subcode; | |
4839 | } | |
4840 | ||
4841 | /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */ | |
4842 | ||
4843 | static inline void | |
4844 | gimple_transaction_set_body (gimple gs, gimple_seq body) | |
4845 | { | |
4846 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4847 | gs->gimple_transaction.body = body; | |
4848 | } | |
4849 | ||
4850 | /* Set the label associated with a GIMPLE_TRANSACTION. */ | |
4851 | ||
4852 | static inline void | |
4853 | gimple_transaction_set_label (gimple gs, tree label) | |
4854 | { | |
4855 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4856 | gs->gimple_transaction.label = label; | |
4857 | } | |
4858 | ||
4859 | /* Set the subcode associated with a GIMPLE_TRANSACTION. */ | |
4860 | ||
4861 | static inline void | |
4862 | gimple_transaction_set_subcode (gimple gs, unsigned int subcode) | |
4863 | { | |
4864 | GIMPLE_CHECK (gs, GIMPLE_TRANSACTION); | |
4865 | gs->gsbase.subcode = subcode; | |
4866 | } | |
4867 | ||
726a989a RB |
4868 | |
4869 | /* Return a pointer to the return value for GIMPLE_RETURN GS. */ | |
4870 | ||
4871 | static inline tree * | |
4872 | gimple_return_retval_ptr (const_gimple gs) | |
4873 | { | |
4874 | GIMPLE_CHECK (gs, GIMPLE_RETURN); | |
726a989a RB |
4875 | return gimple_op_ptr (gs, 0); |
4876 | } | |
4877 | ||
4878 | /* Return the return value for GIMPLE_RETURN GS. */ | |
4879 | ||
4880 | static inline tree | |
4881 | gimple_return_retval (const_gimple gs) | |
4882 | { | |
4883 | GIMPLE_CHECK (gs, GIMPLE_RETURN); | |
726a989a RB |
4884 | return gimple_op (gs, 0); |
4885 | } | |
4886 | ||
4887 | ||
4888 | /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ | |
4889 | ||
4890 | static inline void | |
4891 | gimple_return_set_retval (gimple gs, tree retval) | |
4892 | { | |
4893 | GIMPLE_CHECK (gs, GIMPLE_RETURN); | |
726a989a RB |
4894 | gimple_set_op (gs, 0, retval); |
4895 | } | |
4896 | ||
4897 | ||
073a8998 | 4898 | /* Returns true when the gimple statement STMT is any of the OpenMP types. */ |
726a989a | 4899 | |
8b9db065 RH |
4900 | #define CASE_GIMPLE_OMP \ |
4901 | case GIMPLE_OMP_PARALLEL: \ | |
4902 | case GIMPLE_OMP_TASK: \ | |
4903 | case GIMPLE_OMP_FOR: \ | |
4904 | case GIMPLE_OMP_SECTIONS: \ | |
4905 | case GIMPLE_OMP_SECTIONS_SWITCH: \ | |
4906 | case GIMPLE_OMP_SINGLE: \ | |
4907 | case GIMPLE_OMP_SECTION: \ | |
4908 | case GIMPLE_OMP_MASTER: \ | |
4909 | case GIMPLE_OMP_ORDERED: \ | |
4910 | case GIMPLE_OMP_CRITICAL: \ | |
4911 | case GIMPLE_OMP_RETURN: \ | |
4912 | case GIMPLE_OMP_ATOMIC_LOAD: \ | |
4913 | case GIMPLE_OMP_ATOMIC_STORE: \ | |
4914 | case GIMPLE_OMP_CONTINUE | |
4915 | ||
726a989a RB |
4916 | static inline bool |
4917 | is_gimple_omp (const_gimple stmt) | |
4918 | { | |
8b9db065 RH |
4919 | switch (gimple_code (stmt)) |
4920 | { | |
4921 | CASE_GIMPLE_OMP: | |
4922 | return true; | |
4923 | default: | |
4924 | return false; | |
4925 | } | |
726a989a RB |
4926 | } |
4927 | ||
4928 | ||
4929 | /* Returns TRUE if statement G is a GIMPLE_NOP. */ | |
4930 | ||
4931 | static inline bool | |
4932 | gimple_nop_p (const_gimple g) | |
4933 | { | |
4934 | return gimple_code (g) == GIMPLE_NOP; | |
4935 | } | |
4936 | ||
4937 | ||
1d65f45c RH |
4938 | /* Return true if GS is a GIMPLE_RESX. */ |
4939 | ||
4940 | static inline bool | |
4941 | is_gimple_resx (const_gimple gs) | |
4942 | { | |
4943 | return gimple_code (gs) == GIMPLE_RESX; | |
4944 | } | |
4945 | ||
726a989a RB |
4946 | /* Return the predictor of GIMPLE_PREDICT statement GS. */ |
4947 | ||
4948 | static inline enum br_predictor | |
4949 | gimple_predict_predictor (gimple gs) | |
4950 | { | |
4951 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4952 | return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN); | |
4953 | } | |
4954 | ||
4955 | ||
4956 | /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */ | |
4957 | ||
4958 | static inline void | |
4959 | gimple_predict_set_predictor (gimple gs, enum br_predictor predictor) | |
4960 | { | |
4961 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4962 | gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN) | |
4963 | | (unsigned) predictor; | |
4964 | } | |
4965 | ||
4966 | ||
4967 | /* Return the outcome of GIMPLE_PREDICT statement GS. */ | |
4968 | ||
4969 | static inline enum prediction | |
4970 | gimple_predict_outcome (gimple gs) | |
4971 | { | |
4972 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4973 | return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN; | |
4974 | } | |
4975 | ||
4976 | ||
4977 | /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */ | |
4978 | ||
4979 | static inline void | |
4980 | gimple_predict_set_outcome (gimple gs, enum prediction outcome) | |
4981 | { | |
4982 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4983 | if (outcome == TAKEN) | |
4984 | gs->gsbase.subcode |= GF_PREDICT_TAKEN; | |
4985 | else | |
4986 | gs->gsbase.subcode &= ~GF_PREDICT_TAKEN; | |
4987 | } | |
4988 | ||
4989 | ||
828552ed RG |
4990 | /* Return the type of the main expression computed by STMT. Return |
4991 | void_type_node if the statement computes nothing. */ | |
4992 | ||
4993 | static inline tree | |
4994 | gimple_expr_type (const_gimple stmt) | |
4995 | { | |
4996 | enum gimple_code code = gimple_code (stmt); | |
4997 | ||
4998 | if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) | |
4999 | { | |
5000 | tree type; | |
5001 | /* In general we want to pass out a type that can be substituted | |
5002 | for both the RHS and the LHS types if there is a possibly | |
5003 | useless conversion involved. That means returning the | |
5004 | original RHS type as far as we can reconstruct it. */ | |
5005 | if (code == GIMPLE_CALL) | |
5006 | type = gimple_call_return_type (stmt); | |
5007 | else | |
5008 | switch (gimple_assign_rhs_code (stmt)) | |
5009 | { | |
5010 | case POINTER_PLUS_EXPR: | |
5011 | type = TREE_TYPE (gimple_assign_rhs1 (stmt)); | |
5012 | break; | |
5013 | ||
5014 | default: | |
5015 | /* As fallback use the type of the LHS. */ | |
5016 | type = TREE_TYPE (gimple_get_lhs (stmt)); | |
5017 | break; | |
5018 | } | |
5019 | return type; | |
5020 | } | |
5021 | else if (code == GIMPLE_COND) | |
5022 | return boolean_type_node; | |
5023 | else | |
5024 | return void_type_node; | |
5025 | } | |
5026 | ||
b9af73fc RG |
5027 | /* Return true if TYPE is a suitable type for a scalar register variable. */ |
5028 | ||
5029 | static inline bool | |
5030 | is_gimple_reg_type (tree type) | |
5031 | { | |
5032 | return !AGGREGATE_TYPE_P (type); | |
5033 | } | |
828552ed | 5034 | |
726a989a RB |
5035 | /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */ |
5036 | ||
5037 | static inline gimple_stmt_iterator | |
355a7673 | 5038 | gsi_start_1 (gimple_seq *seq) |
726a989a RB |
5039 | { |
5040 | gimple_stmt_iterator i; | |
5041 | ||
355a7673 | 5042 | i.ptr = gimple_seq_first (*seq); |
726a989a | 5043 | i.seq = seq; |
355a7673 | 5044 | i.bb = i.ptr ? gimple_bb (i.ptr) : NULL; |
726a989a RB |
5045 | |
5046 | return i; | |
5047 | } | |
5048 | ||
355a7673 MM |
5049 | #define gsi_start(x) gsi_start_1(&(x)) |
5050 | ||
5051 | static inline gimple_stmt_iterator | |
5052 | gsi_none (void) | |
5053 | { | |
5054 | gimple_stmt_iterator i; | |
5055 | i.ptr = NULL; | |
5056 | i.seq = NULL; | |
5057 | i.bb = NULL; | |
5058 | return i; | |
5059 | } | |
726a989a RB |
5060 | |
5061 | /* Return a new iterator pointing to the first statement in basic block BB. */ | |
5062 | ||
5063 | static inline gimple_stmt_iterator | |
5064 | gsi_start_bb (basic_block bb) | |
5065 | { | |
5066 | gimple_stmt_iterator i; | |
355a7673 | 5067 | gimple_seq *seq; |
b8698a0f | 5068 | |
355a7673 | 5069 | seq = bb_seq_addr (bb); |
3e8b732e MM |
5070 | i.ptr = gimple_seq_first (*seq); |
5071 | i.seq = seq; | |
5072 | i.bb = bb; | |
726a989a RB |
5073 | |
5074 | return i; | |
5075 | } | |
5076 | ||
5077 | ||
5078 | /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */ | |
5079 | ||
5080 | static inline gimple_stmt_iterator | |
355a7673 | 5081 | gsi_last_1 (gimple_seq *seq) |
726a989a RB |
5082 | { |
5083 | gimple_stmt_iterator i; | |
5084 | ||
355a7673 | 5085 | i.ptr = gimple_seq_last (*seq); |
726a989a | 5086 | i.seq = seq; |
355a7673 | 5087 | i.bb = i.ptr ? gimple_bb (i.ptr) : NULL; |
726a989a RB |
5088 | |
5089 | return i; | |
5090 | } | |
5091 | ||
355a7673 | 5092 | #define gsi_last(x) gsi_last_1(&(x)) |
726a989a RB |
5093 | |
5094 | /* Return a new iterator pointing to the last statement in basic block BB. */ | |
5095 | ||
5096 | static inline gimple_stmt_iterator | |
5097 | gsi_last_bb (basic_block bb) | |
5098 | { | |
5099 | gimple_stmt_iterator i; | |
355a7673 | 5100 | gimple_seq *seq; |
726a989a | 5101 | |
355a7673 | 5102 | seq = bb_seq_addr (bb); |
3e8b732e MM |
5103 | i.ptr = gimple_seq_last (*seq); |
5104 | i.seq = seq; | |
5105 | i.bb = bb; | |
726a989a RB |
5106 | |
5107 | return i; | |
5108 | } | |
5109 | ||
5110 | ||
5111 | /* Return true if I is at the end of its sequence. */ | |
5112 | ||
5113 | static inline bool | |
5114 | gsi_end_p (gimple_stmt_iterator i) | |
5115 | { | |
5116 | return i.ptr == NULL; | |
5117 | } | |
5118 | ||
5119 | ||
5120 | /* Return true if I is one statement before the end of its sequence. */ | |
5121 | ||
5122 | static inline bool | |
5123 | gsi_one_before_end_p (gimple_stmt_iterator i) | |
5124 | { | |
355a7673 | 5125 | return i.ptr != NULL && i.ptr->gsbase.next == NULL; |
726a989a RB |
5126 | } |
5127 | ||
5128 | ||
5129 | /* Advance the iterator to the next gimple statement. */ | |
5130 | ||
5131 | static inline void | |
5132 | gsi_next (gimple_stmt_iterator *i) | |
5133 | { | |
355a7673 | 5134 | i->ptr = i->ptr->gsbase.next; |
726a989a RB |
5135 | } |
5136 | ||
5137 | /* Advance the iterator to the previous gimple statement. */ | |
5138 | ||
5139 | static inline void | |
5140 | gsi_prev (gimple_stmt_iterator *i) | |
5141 | { | |
355a7673 MM |
5142 | gimple prev = i->ptr->gsbase.prev; |
5143 | if (prev->gsbase.next) | |
5144 | i->ptr = prev; | |
5145 | else | |
5146 | i->ptr = NULL; | |
726a989a RB |
5147 | } |
5148 | ||
5149 | /* Return the current stmt. */ | |
5150 | ||
5151 | static inline gimple | |
5152 | gsi_stmt (gimple_stmt_iterator i) | |
5153 | { | |
355a7673 | 5154 | return i.ptr; |
726a989a RB |
5155 | } |
5156 | ||
5157 | /* Return a block statement iterator that points to the first non-label | |
5158 | statement in block BB. */ | |
5159 | ||
5160 | static inline gimple_stmt_iterator | |
5161 | gsi_after_labels (basic_block bb) | |
5162 | { | |
5163 | gimple_stmt_iterator gsi = gsi_start_bb (bb); | |
5164 | ||
5165 | while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL) | |
5166 | gsi_next (&gsi); | |
5167 | ||
5168 | return gsi; | |
5169 | } | |
5170 | ||
b5b8b0ac AO |
5171 | /* Advance the iterator to the next non-debug gimple statement. */ |
5172 | ||
5173 | static inline void | |
5174 | gsi_next_nondebug (gimple_stmt_iterator *i) | |
5175 | { | |
5176 | do | |
5177 | { | |
5178 | gsi_next (i); | |
5179 | } | |
5180 | while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i))); | |
5181 | } | |
5182 | ||
5183 | /* Advance the iterator to the next non-debug gimple statement. */ | |
5184 | ||
5185 | static inline void | |
5186 | gsi_prev_nondebug (gimple_stmt_iterator *i) | |
5187 | { | |
5188 | do | |
5189 | { | |
5190 | gsi_prev (i); | |
5191 | } | |
5192 | while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i))); | |
5193 | } | |
5194 | ||
5195 | /* Return a new iterator pointing to the first non-debug statement in | |
5196 | basic block BB. */ | |
5197 | ||
5198 | static inline gimple_stmt_iterator | |
5199 | gsi_start_nondebug_bb (basic_block bb) | |
5200 | { | |
5201 | gimple_stmt_iterator i = gsi_start_bb (bb); | |
5202 | ||
5203 | if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i))) | |
5204 | gsi_next_nondebug (&i); | |
5205 | ||
5206 | return i; | |
5207 | } | |
5208 | ||
5209 | /* Return a new iterator pointing to the last non-debug statement in | |
5210 | basic block BB. */ | |
5211 | ||
5212 | static inline gimple_stmt_iterator | |
5213 | gsi_last_nondebug_bb (basic_block bb) | |
5214 | { | |
5215 | gimple_stmt_iterator i = gsi_last_bb (bb); | |
5216 | ||
5217 | if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i))) | |
5218 | gsi_prev_nondebug (&i); | |
5219 | ||
5220 | return i; | |
5221 | } | |
5222 | ||
726a989a RB |
5223 | |
5224 | /* Return the basic block associated with this iterator. */ | |
5225 | ||
5226 | static inline basic_block | |
5227 | gsi_bb (gimple_stmt_iterator i) | |
5228 | { | |
5229 | return i.bb; | |
5230 | } | |
5231 | ||
5232 | ||
5233 | /* Return the sequence associated with this iterator. */ | |
5234 | ||
5235 | static inline gimple_seq | |
5236 | gsi_seq (gimple_stmt_iterator i) | |
5237 | { | |
355a7673 | 5238 | return *i.seq; |
726a989a RB |
5239 | } |
5240 | ||
5241 | ||
5242 | enum gsi_iterator_update | |
5243 | { | |
5244 | GSI_NEW_STMT, /* Only valid when single statement is added, move | |
5245 | iterator to it. */ | |
5246 | GSI_SAME_STMT, /* Leave the iterator at the same statement. */ | |
5247 | GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable | |
5248 | for linking other statements in the same | |
5249 | direction. */ | |
5250 | }; | |
5251 | ||
5252 | /* In gimple-iterator.c */ | |
5253 | gimple_stmt_iterator gsi_start_phis (basic_block); | |
5254 | gimple_seq gsi_split_seq_after (gimple_stmt_iterator); | |
355a7673 MM |
5255 | void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *); |
5256 | void gsi_set_stmt (gimple_stmt_iterator *, gimple); | |
726a989a | 5257 | void gsi_replace (gimple_stmt_iterator *, gimple, bool); |
355a7673 | 5258 | void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool); |
726a989a RB |
5259 | void gsi_insert_before (gimple_stmt_iterator *, gimple, |
5260 | enum gsi_iterator_update); | |
5261 | void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple, | |
5262 | enum gsi_iterator_update); | |
5263 | void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq, | |
5264 | enum gsi_iterator_update); | |
5265 | void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq, | |
5266 | enum gsi_iterator_update); | |
5267 | void gsi_insert_after (gimple_stmt_iterator *, gimple, | |
5268 | enum gsi_iterator_update); | |
5269 | void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple, | |
5270 | enum gsi_iterator_update); | |
5271 | void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq, | |
5272 | enum gsi_iterator_update); | |
5273 | void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq, | |
5274 | enum gsi_iterator_update); | |
b5b3ec3e | 5275 | bool gsi_remove (gimple_stmt_iterator *, bool); |
726a989a RB |
5276 | gimple_stmt_iterator gsi_for_stmt (gimple); |
5277 | void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *); | |
5278 | void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *); | |
b8244d74 | 5279 | void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block); |
726a989a RB |
5280 | void gsi_insert_on_edge (edge, gimple); |
5281 | void gsi_insert_seq_on_edge (edge, gimple_seq); | |
5282 | basic_block gsi_insert_on_edge_immediate (edge, gimple); | |
5283 | basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq); | |
5284 | void gsi_commit_one_edge_insert (edge, basic_block *); | |
5285 | void gsi_commit_edge_inserts (void); | |
5c0466b5 | 5286 | gimple gimple_call_copy_skip_args (gimple, bitmap); |
726a989a RB |
5287 | |
5288 | ||
5289 | /* Convenience routines to walk all statements of a gimple function. | |
5290 | Note that this is useful exclusively before the code is converted | |
5291 | into SSA form. Once the program is in SSA form, the standard | |
5292 | operand interface should be used to analyze/modify statements. */ | |
5293 | struct walk_stmt_info | |
5294 | { | |
5295 | /* Points to the current statement being walked. */ | |
5296 | gimple_stmt_iterator gsi; | |
5297 | ||
5298 | /* Additional data that the callback functions may want to carry | |
5299 | through the recursion. */ | |
5300 | void *info; | |
5301 | ||
5302 | /* Pointer map used to mark visited tree nodes when calling | |
5303 | walk_tree on each operand. If set to NULL, duplicate tree nodes | |
5304 | will be visited more than once. */ | |
5305 | struct pointer_set_t *pset; | |
5306 | ||
0a35513e AH |
5307 | /* Operand returned by the callbacks. This is set when calling |
5308 | walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback | |
5309 | returns non-NULL, this field will contain the tree returned by | |
5310 | the last callback. */ | |
5311 | tree callback_result; | |
5312 | ||
726a989a RB |
5313 | /* Indicates whether the operand being examined may be replaced |
5314 | with something that matches is_gimple_val (if true) or something | |
5315 | slightly more complicated (if false). "Something" technically | |
5316 | means the common subset of is_gimple_lvalue and is_gimple_rhs, | |
5317 | but we never try to form anything more complicated than that, so | |
5318 | we don't bother checking. | |
5319 | ||
5320 | Also note that CALLBACK should update this flag while walking the | |
5321 | sub-expressions of a statement. For instance, when walking the | |
5322 | statement 'foo (&var)', the flag VAL_ONLY will initially be set | |
5323 | to true, however, when walking &var, the operand of that | |
5324 | ADDR_EXPR does not need to be a GIMPLE value. */ | |
0a35513e | 5325 | BOOL_BITFIELD val_only : 1; |
726a989a RB |
5326 | |
5327 | /* True if we are currently walking the LHS of an assignment. */ | |
0a35513e | 5328 | BOOL_BITFIELD is_lhs : 1; |
726a989a RB |
5329 | |
5330 | /* Optional. Set to true by the callback functions if they made any | |
5331 | changes. */ | |
0a35513e | 5332 | BOOL_BITFIELD changed : 1; |
726a989a RB |
5333 | |
5334 | /* True if we're interested in location information. */ | |
0a35513e | 5335 | BOOL_BITFIELD want_locations : 1; |
726a989a | 5336 | |
0a35513e AH |
5337 | /* True if we've removed the statement that was processed. */ |
5338 | BOOL_BITFIELD removed_stmt : 1; | |
726a989a RB |
5339 | }; |
5340 | ||
5341 | /* Callback for walk_gimple_stmt. Called for every statement found | |
5342 | during traversal. The first argument points to the statement to | |
5343 | walk. The second argument is a flag that the callback sets to | |
5344 | 'true' if it the callback handled all the operands and | |
5345 | sub-statements of the statement (the default value of this flag is | |
5346 | 'false'). The third argument is an anonymous pointer to data | |
5347 | to be used by the callback. */ | |
5348 | typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *, | |
5349 | struct walk_stmt_info *); | |
5350 | ||
5351 | gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn, | |
5352 | struct walk_stmt_info *); | |
355a7673 MM |
5353 | gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn, |
5354 | struct walk_stmt_info *); | |
726a989a RB |
5355 | tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn, |
5356 | struct walk_stmt_info *); | |
5357 | tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *); | |
5358 | ||
726a989a RB |
5359 | /* Enum and arrays used for allocation stats. Keep in sync with |
5360 | gimple.c:gimple_alloc_kind_names. */ | |
5361 | enum gimple_alloc_kind | |
5362 | { | |
5363 | gimple_alloc_kind_assign, /* Assignments. */ | |
5364 | gimple_alloc_kind_phi, /* PHI nodes. */ | |
5365 | gimple_alloc_kind_cond, /* Conditionals. */ | |
726a989a RB |
5366 | gimple_alloc_kind_rest, /* Everything else. */ |
5367 | gimple_alloc_kind_all | |
5368 | }; | |
5369 | ||
5370 | extern int gimple_alloc_counts[]; | |
5371 | extern int gimple_alloc_sizes[]; | |
5372 | ||
5373 | /* Return the allocation kind for a given stmt CODE. */ | |
5374 | static inline enum gimple_alloc_kind | |
5375 | gimple_alloc_kind (enum gimple_code code) | |
5376 | { | |
5377 | switch (code) | |
5378 | { | |
5379 | case GIMPLE_ASSIGN: | |
5380 | return gimple_alloc_kind_assign; | |
5381 | case GIMPLE_PHI: | |
5382 | return gimple_alloc_kind_phi; | |
5383 | case GIMPLE_COND: | |
5384 | return gimple_alloc_kind_cond; | |
5385 | default: | |
5386 | return gimple_alloc_kind_rest; | |
5387 | } | |
5388 | } | |
726a989a RB |
5389 | |
5390 | extern void dump_gimple_statistics (void); | |
5391 | ||
cbdd87d4 RG |
5392 | /* In gimple-fold.c. */ |
5393 | void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); | |
5394 | tree gimple_fold_builtin (gimple); | |
5395 | bool fold_stmt (gimple_stmt_iterator *); | |
59401b92 | 5396 | bool fold_stmt_inplace (gimple_stmt_iterator *); |
cbdd87d4 | 5397 | tree get_symbol_constant_value (tree); |
c44c2088 | 5398 | tree canonicalize_constructor_val (tree, tree); |
e89065a1 SL |
5399 | extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree, |
5400 | enum tree_code, tree, tree); | |
5401 | extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree, | |
5402 | enum tree_code, tree, tree); | |
cbdd87d4 | 5403 | |
06bc3ec7 | 5404 | bool gimple_val_nonnegative_real_p (tree); |
475b8f37 DN |
5405 | |
5406 | ||
5407 | /* Set the location of all statements in SEQ to LOC. */ | |
5408 | ||
5409 | static inline void | |
5410 | gimple_seq_set_location (gimple_seq seq, location_t loc) | |
5411 | { | |
5412 | for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) | |
5413 | gimple_set_location (gsi_stmt (i), loc); | |
5414 | } | |
5415 | ||
726a989a | 5416 | #endif /* GCC_GIMPLE_H */ |