]>
Commit | Line | Data |
---|---|---|
75a70cf9 | 1 | /* Gimple IR definitions. |
2 | ||
cfaf579d | 3 | Copyright 2007, 2008, 2009 Free Software Foundation, Inc. |
75a70cf9 | 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" | |
26 | #include "vec.h" | |
27 | #include "ggc.h" | |
28 | #include "tm.h" | |
29 | #include "hard-reg-set.h" | |
30 | #include "basic-block.h" | |
31 | #include "tree-ssa-operands.h" | |
32 | ||
33 | DEF_VEC_P(gimple); | |
34 | DEF_VEC_ALLOC_P(gimple,heap); | |
35 | DEF_VEC_ALLOC_P(gimple,gc); | |
36 | ||
dd277d48 | 37 | typedef gimple *gimple_p; |
38 | DEF_VEC_P(gimple_p); | |
39 | DEF_VEC_ALLOC_P(gimple_p,heap); | |
40 | ||
75a70cf9 | 41 | DEF_VEC_P(gimple_seq); |
42 | DEF_VEC_ALLOC_P(gimple_seq,gc); | |
43 | DEF_VEC_ALLOC_P(gimple_seq,heap); | |
44 | ||
255b6be7 | 45 | /* For each block, the PHI nodes that need to be rewritten are stored into |
46 | these vectors. */ | |
47 | typedef VEC(gimple, heap) *gimple_vec; | |
48 | DEF_VEC_P (gimple_vec); | |
49 | DEF_VEC_ALLOC_P (gimple_vec, heap); | |
50 | ||
75a70cf9 | 51 | enum gimple_code { |
52 | #define DEFGSCODE(SYM, STRING, STRUCT) SYM, | |
53 | #include "gimple.def" | |
54 | #undef DEFGSCODE | |
55 | LAST_AND_UNUSED_GIMPLE_CODE | |
56 | }; | |
57 | ||
58 | extern const char *const gimple_code_name[]; | |
59 | extern const unsigned char gimple_rhs_class_table[]; | |
60 | ||
61 | /* Error out if a gimple tuple is addressed incorrectly. */ | |
62 | #if defined ENABLE_GIMPLE_CHECKING | |
63 | extern void gimple_check_failed (const_gimple, const char *, int, \ | |
64 | const char *, enum gimple_code, \ | |
65 | enum tree_code) ATTRIBUTE_NORETURN; | |
75a70cf9 | 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__, \ | |
b9c74b4d | 72 | (CODE), ERROR_MARK); \ |
75a70cf9 | 73 | } while (0) |
74 | #else /* not ENABLE_GIMPLE_CHECKING */ | |
75 | #define GIMPLE_CHECK(GS, CODE) (void)0 | |
76 | #endif | |
77 | ||
78 | /* Class of GIMPLE expressions suitable for the RHS of assignments. See | |
79 | get_gimple_rhs_class. */ | |
80 | enum gimple_rhs_class | |
81 | { | |
82 | GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */ | |
83 | GIMPLE_BINARY_RHS, /* The expression is a binary operation. */ | |
84 | GIMPLE_UNARY_RHS, /* The expression is a unary operation. */ | |
85 | GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA | |
86 | name, a _DECL, a _REF, etc. */ | |
87 | }; | |
88 | ||
89 | /* Specific flags for individual GIMPLE statements. These flags are | |
90 | always stored in gimple_statement_base.subcode and they may only be | |
91 | defined for statement codes that do not use sub-codes. | |
92 | ||
93 | Values for the masks can overlap as long as the overlapping values | |
94 | are never used in the same statement class. | |
95 | ||
96 | The maximum mask value that can be defined is 1 << 15 (i.e., each | |
97 | statement code can hold up to 16 bitflags). | |
98 | ||
99 | Keep this list sorted. */ | |
100 | enum gf_mask { | |
101 | GF_ASM_INPUT = 1 << 0, | |
102 | GF_ASM_VOLATILE = 1 << 1, | |
103 | GF_CALL_CANNOT_INLINE = 1 << 0, | |
104 | GF_CALL_FROM_THUNK = 1 << 1, | |
105 | GF_CALL_RETURN_SLOT_OPT = 1 << 2, | |
106 | GF_CALL_TAILCALL = 1 << 3, | |
107 | GF_CALL_VA_ARG_PACK = 1 << 4, | |
108 | GF_OMP_PARALLEL_COMBINED = 1 << 0, | |
109 | ||
110 | /* True on an GIMPLE_OMP_RETURN statement if the return does not require | |
111 | a thread synchronization via some sort of barrier. The exact barrier | |
112 | that would otherwise be emitted is dependent on the OMP statement with | |
113 | which this return is associated. */ | |
114 | GF_OMP_RETURN_NOWAIT = 1 << 0, | |
115 | ||
116 | GF_OMP_SECTION_LAST = 1 << 0, | |
117 | GF_PREDICT_TAKEN = 1 << 15 | |
118 | }; | |
119 | ||
120 | /* Masks for selecting a pass local flag (PLF) to work on. These | |
121 | masks are used by gimple_set_plf and gimple_plf. */ | |
122 | enum plf_mask { | |
123 | GF_PLF_1 = 1 << 0, | |
124 | GF_PLF_2 = 1 << 1 | |
125 | }; | |
126 | ||
127 | /* A node in a gimple_seq_d. */ | |
fb1e4f4a | 128 | struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d { |
75a70cf9 | 129 | gimple stmt; |
130 | struct gimple_seq_node_d *prev; | |
131 | struct gimple_seq_node_d *next; | |
132 | }; | |
133 | ||
134 | /* A double-linked sequence of gimple statements. */ | |
fb1e4f4a | 135 | struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d { |
75a70cf9 | 136 | /* First and last statements in the sequence. */ |
137 | gimple_seq_node first; | |
138 | gimple_seq_node last; | |
139 | ||
140 | /* Sequences are created/destroyed frequently. To minimize | |
141 | allocation activity, deallocated sequences are kept in a pool of | |
142 | available sequences. This is the pointer to the next free | |
143 | sequence in the pool. */ | |
144 | gimple_seq next_free; | |
145 | }; | |
146 | ||
147 | ||
148 | /* Return the first node in GIMPLE sequence S. */ | |
149 | ||
150 | static inline gimple_seq_node | |
151 | gimple_seq_first (const_gimple_seq s) | |
152 | { | |
153 | return s ? s->first : NULL; | |
154 | } | |
155 | ||
156 | ||
157 | /* Return the first statement in GIMPLE sequence S. */ | |
158 | ||
159 | static inline gimple | |
160 | gimple_seq_first_stmt (const_gimple_seq s) | |
161 | { | |
162 | gimple_seq_node n = gimple_seq_first (s); | |
163 | return (n) ? n->stmt : NULL; | |
164 | } | |
165 | ||
166 | ||
167 | /* Return the last node in GIMPLE sequence S. */ | |
168 | ||
169 | static inline gimple_seq_node | |
170 | gimple_seq_last (const_gimple_seq s) | |
171 | { | |
172 | return s ? s->last : NULL; | |
173 | } | |
174 | ||
175 | ||
176 | /* Return the last statement in GIMPLE sequence S. */ | |
177 | ||
178 | static inline gimple | |
179 | gimple_seq_last_stmt (const_gimple_seq s) | |
180 | { | |
181 | gimple_seq_node n = gimple_seq_last (s); | |
182 | return (n) ? n->stmt : NULL; | |
183 | } | |
184 | ||
185 | ||
186 | /* Set the last node in GIMPLE sequence S to LAST. */ | |
187 | ||
188 | static inline void | |
189 | gimple_seq_set_last (gimple_seq s, gimple_seq_node last) | |
190 | { | |
191 | s->last = last; | |
192 | } | |
193 | ||
194 | ||
195 | /* Set the first node in GIMPLE sequence S to FIRST. */ | |
196 | ||
197 | static inline void | |
198 | gimple_seq_set_first (gimple_seq s, gimple_seq_node first) | |
199 | { | |
200 | s->first = first; | |
201 | } | |
202 | ||
203 | ||
204 | /* Return true if GIMPLE sequence S is empty. */ | |
205 | ||
206 | static inline bool | |
207 | gimple_seq_empty_p (const_gimple_seq s) | |
208 | { | |
209 | return s == NULL || s->first == NULL; | |
210 | } | |
211 | ||
212 | ||
213 | void gimple_seq_add_stmt (gimple_seq *, gimple); | |
214 | ||
215 | /* Allocate a new sequence and initialize its first element with STMT. */ | |
216 | ||
217 | static inline gimple_seq | |
218 | gimple_seq_alloc_with_stmt (gimple stmt) | |
219 | { | |
220 | gimple_seq seq = NULL; | |
221 | gimple_seq_add_stmt (&seq, stmt); | |
222 | return seq; | |
223 | } | |
224 | ||
225 | ||
226 | /* Returns the sequence of statements in BB. */ | |
227 | ||
228 | static inline gimple_seq | |
229 | bb_seq (const_basic_block bb) | |
230 | { | |
231 | return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL; | |
232 | } | |
233 | ||
234 | ||
235 | /* Sets the sequence of statements in BB to SEQ. */ | |
236 | ||
237 | static inline void | |
238 | set_bb_seq (basic_block bb, gimple_seq seq) | |
239 | { | |
240 | gcc_assert (!(bb->flags & BB_RTL)); | |
241 | bb->il.gimple->seq = seq; | |
242 | } | |
243 | ||
244 | /* Iterator object for GIMPLE statement sequences. */ | |
245 | ||
246 | typedef struct | |
247 | { | |
248 | /* Sequence node holding the current statement. */ | |
249 | gimple_seq_node ptr; | |
250 | ||
251 | /* Sequence and basic block holding the statement. These fields | |
252 | are necessary to handle edge cases such as when statement is | |
253 | added to an empty basic block or when the last statement of a | |
254 | block/sequence is removed. */ | |
255 | gimple_seq seq; | |
256 | basic_block bb; | |
257 | } gimple_stmt_iterator; | |
258 | ||
259 | ||
260 | /* Data structure definitions for GIMPLE tuples. NOTE: word markers | |
261 | are for 64 bit hosts. */ | |
262 | ||
fb1e4f4a | 263 | struct GTY(()) gimple_statement_base { |
75a70cf9 | 264 | /* [ WORD 1 ] |
265 | Main identifying code for a tuple. */ | |
266 | ENUM_BITFIELD(gimple_code) code : 8; | |
267 | ||
268 | /* Nonzero if a warning should not be emitted on this tuple. */ | |
269 | unsigned int no_warning : 1; | |
270 | ||
271 | /* Nonzero if this tuple has been visited. Passes are responsible | |
272 | for clearing this bit before using it. */ | |
273 | unsigned int visited : 1; | |
274 | ||
275 | /* Nonzero if this tuple represents a non-temporal move. */ | |
276 | unsigned int nontemporal_move : 1; | |
277 | ||
278 | /* Pass local flags. These flags are free for any pass to use as | |
279 | they see fit. Passes should not assume that these flags contain | |
280 | any useful value when the pass starts. Any initial state that | |
281 | the pass requires should be set on entry to the pass. See | |
282 | gimple_set_plf and gimple_plf for usage. */ | |
283 | unsigned int plf : 2; | |
284 | ||
285 | /* Nonzero if this statement has been modified and needs to have its | |
286 | operands rescanned. */ | |
287 | unsigned modified : 1; | |
288 | ||
289 | /* Nonzero if this statement contains volatile operands. */ | |
290 | unsigned has_volatile_ops : 1; | |
291 | ||
dd277d48 | 292 | /* Padding to get subcode to 16 bit alignment. */ |
293 | unsigned pad : 1; | |
75a70cf9 | 294 | |
295 | /* The SUBCODE field can be used for tuple-specific flags for tuples | |
296 | that do not require subcodes. Note that SUBCODE should be at | |
297 | least as wide as tree codes, as several tuples store tree codes | |
298 | in there. */ | |
299 | unsigned int subcode : 16; | |
300 | ||
51e52fe3 | 301 | /* UID of this statement. This is used by passes that want to |
302 | assign IDs to statements. It must be assigned and used by each | |
303 | pass. By default it should be assumed to contain garbage. */ | |
75a70cf9 | 304 | unsigned uid; |
305 | ||
306 | /* [ WORD 2 ] | |
307 | Locus information for debug info. */ | |
308 | location_t location; | |
309 | ||
310 | /* Number of operands in this tuple. */ | |
311 | unsigned num_ops; | |
312 | ||
313 | /* [ WORD 3 ] | |
314 | Basic block holding this statement. */ | |
315 | struct basic_block_def *bb; | |
316 | ||
317 | /* [ WORD 4 ] | |
318 | Lexical block holding this statement. */ | |
319 | tree block; | |
320 | }; | |
321 | ||
322 | ||
323 | /* Base structure for tuples with operands. */ | |
324 | ||
fb1e4f4a | 325 | struct GTY(()) gimple_statement_with_ops_base |
75a70cf9 | 326 | { |
6d5ec6f8 | 327 | /* [ WORD 1-4 ] */ |
75a70cf9 | 328 | struct gimple_statement_base gsbase; |
329 | ||
6d5ec6f8 | 330 | /* [ WORD 5-6 ] |
75a70cf9 | 331 | SSA operand vectors. NOTE: It should be possible to |
332 | amalgamate these vectors with the operand vector OP. However, | |
333 | the SSA operand vectors are organized differently and contain | |
334 | more information (like immediate use chaining). */ | |
335 | struct def_optype_d GTY((skip (""))) *def_ops; | |
336 | struct use_optype_d GTY((skip (""))) *use_ops; | |
337 | }; | |
338 | ||
339 | ||
340 | /* Statements that take register operands. */ | |
341 | ||
fb1e4f4a | 342 | struct GTY(()) gimple_statement_with_ops |
75a70cf9 | 343 | { |
6d5ec6f8 | 344 | /* [ WORD 1-6 ] */ |
75a70cf9 | 345 | struct gimple_statement_with_ops_base opbase; |
346 | ||
6d5ec6f8 | 347 | /* [ WORD 7 ] |
75a70cf9 | 348 | Operand vector. NOTE! This must always be the last field |
349 | of this structure. In particular, this means that this | |
350 | structure cannot be embedded inside another one. */ | |
351 | tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1]; | |
352 | }; | |
353 | ||
354 | ||
355 | /* Base for statements that take both memory and register operands. */ | |
356 | ||
fb1e4f4a | 357 | struct GTY(()) gimple_statement_with_memory_ops_base |
75a70cf9 | 358 | { |
6d5ec6f8 | 359 | /* [ WORD 1-6 ] */ |
75a70cf9 | 360 | struct gimple_statement_with_ops_base opbase; |
361 | ||
6d5ec6f8 | 362 | /* [ WORD 7-8 ] |
dd277d48 | 363 | Virtual operands for this statement. The GC will pick them |
364 | up via the ssa_names array. */ | |
365 | tree GTY((skip (""))) vdef; | |
366 | tree GTY((skip (""))) vuse; | |
75a70cf9 | 367 | }; |
368 | ||
369 | ||
370 | /* Statements that take both memory and register operands. */ | |
371 | ||
fb1e4f4a | 372 | struct GTY(()) gimple_statement_with_memory_ops |
75a70cf9 | 373 | { |
6d5ec6f8 | 374 | /* [ WORD 1-8 ] */ |
75a70cf9 | 375 | struct gimple_statement_with_memory_ops_base membase; |
376 | ||
6d5ec6f8 | 377 | /* [ WORD 9 ] |
75a70cf9 | 378 | Operand vector. NOTE! This must always be the last field |
379 | of this structure. In particular, this means that this | |
380 | structure cannot be embedded inside another one. */ | |
381 | tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1]; | |
382 | }; | |
383 | ||
384 | ||
385 | /* OpenMP statements (#pragma omp). */ | |
386 | ||
fb1e4f4a | 387 | struct GTY(()) gimple_statement_omp { |
75a70cf9 | 388 | /* [ WORD 1-4 ] */ |
389 | struct gimple_statement_base gsbase; | |
390 | ||
391 | /* [ WORD 5 ] */ | |
392 | gimple_seq body; | |
393 | }; | |
394 | ||
395 | ||
396 | /* GIMPLE_BIND */ | |
397 | ||
fb1e4f4a | 398 | struct GTY(()) gimple_statement_bind { |
75a70cf9 | 399 | /* [ WORD 1-4 ] */ |
400 | struct gimple_statement_base gsbase; | |
401 | ||
402 | /* [ WORD 5 ] | |
403 | Variables declared in this scope. */ | |
404 | tree vars; | |
405 | ||
406 | /* [ WORD 6 ] | |
407 | This is different than the BLOCK field in gimple_statement_base, | |
408 | which is analogous to TREE_BLOCK (i.e., the lexical block holding | |
409 | this statement). This field is the equivalent of BIND_EXPR_BLOCK | |
410 | in tree land (i.e., the lexical scope defined by this bind). See | |
411 | gimple-low.c. */ | |
412 | tree block; | |
413 | ||
414 | /* [ WORD 7 ] */ | |
415 | gimple_seq body; | |
416 | }; | |
417 | ||
418 | ||
419 | /* GIMPLE_CATCH */ | |
420 | ||
fb1e4f4a | 421 | struct GTY(()) gimple_statement_catch { |
75a70cf9 | 422 | /* [ WORD 1-4 ] */ |
423 | struct gimple_statement_base gsbase; | |
424 | ||
425 | /* [ WORD 5 ] */ | |
426 | tree types; | |
427 | ||
428 | /* [ WORD 6 ] */ | |
429 | gimple_seq handler; | |
430 | }; | |
431 | ||
432 | ||
433 | /* GIMPLE_EH_FILTER */ | |
434 | ||
fb1e4f4a | 435 | struct GTY(()) gimple_statement_eh_filter { |
75a70cf9 | 436 | /* [ WORD 1-4 ] */ |
437 | struct gimple_statement_base gsbase; | |
438 | ||
439 | /* Subcode: EH_FILTER_MUST_NOT_THROW. A boolean flag analogous to | |
440 | the tree counterpart. */ | |
441 | ||
442 | /* [ WORD 5 ] | |
443 | Filter types. */ | |
444 | tree types; | |
445 | ||
446 | /* [ WORD 6 ] | |
447 | Failure actions. */ | |
448 | gimple_seq failure; | |
449 | }; | |
450 | ||
451 | ||
452 | /* GIMPLE_PHI */ | |
453 | ||
fb1e4f4a | 454 | struct GTY(()) gimple_statement_phi { |
75a70cf9 | 455 | /* [ WORD 1-4 ] */ |
456 | struct gimple_statement_base gsbase; | |
457 | ||
458 | /* [ WORD 5 ] */ | |
459 | unsigned capacity; | |
460 | unsigned nargs; | |
461 | ||
462 | /* [ WORD 6 ] */ | |
463 | tree result; | |
464 | ||
465 | /* [ WORD 7 ] */ | |
466 | struct phi_arg_d GTY ((length ("%h.nargs"))) args[1]; | |
467 | }; | |
468 | ||
469 | ||
470 | /* GIMPLE_RESX */ | |
471 | ||
fb1e4f4a | 472 | struct GTY(()) gimple_statement_resx { |
75a70cf9 | 473 | /* [ WORD 1-4 ] */ |
474 | struct gimple_statement_base gsbase; | |
475 | ||
476 | /* [ WORD 5 ] | |
477 | Exception region number. */ | |
478 | int region; | |
479 | }; | |
480 | ||
481 | ||
482 | /* GIMPLE_TRY */ | |
483 | ||
fb1e4f4a | 484 | struct GTY(()) gimple_statement_try { |
75a70cf9 | 485 | /* [ WORD 1-4 ] */ |
486 | struct gimple_statement_base gsbase; | |
487 | ||
488 | /* [ WORD 5 ] | |
489 | Expression to evaluate. */ | |
490 | gimple_seq eval; | |
491 | ||
492 | /* [ WORD 6 ] | |
493 | Cleanup expression. */ | |
494 | gimple_seq cleanup; | |
495 | }; | |
496 | ||
497 | /* Kind of GIMPLE_TRY statements. */ | |
498 | enum gimple_try_flags | |
499 | { | |
500 | /* A try/catch. */ | |
501 | GIMPLE_TRY_CATCH = 1 << 0, | |
502 | ||
503 | /* A try/finally. */ | |
504 | GIMPLE_TRY_FINALLY = 1 << 1, | |
505 | GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY, | |
506 | ||
507 | /* Analogous to TRY_CATCH_IS_CLEANUP. */ | |
508 | GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2 | |
509 | }; | |
510 | ||
511 | /* GIMPLE_WITH_CLEANUP_EXPR */ | |
512 | ||
fb1e4f4a | 513 | struct GTY(()) gimple_statement_wce { |
75a70cf9 | 514 | /* [ WORD 1-4 ] */ |
515 | struct gimple_statement_base gsbase; | |
516 | ||
517 | /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be | |
518 | executed if an exception is thrown, not on normal exit of its | |
519 | scope. This flag is analogous to the CLEANUP_EH_ONLY flag | |
520 | in TARGET_EXPRs. */ | |
521 | ||
522 | /* [ WORD 5 ] | |
523 | Cleanup expression. */ | |
524 | gimple_seq cleanup; | |
525 | }; | |
526 | ||
527 | ||
528 | /* GIMPLE_ASM */ | |
529 | ||
fb1e4f4a | 530 | struct GTY(()) gimple_statement_asm |
75a70cf9 | 531 | { |
6d5ec6f8 | 532 | /* [ WORD 1-8 ] */ |
75a70cf9 | 533 | struct gimple_statement_with_memory_ops_base membase; |
534 | ||
6d5ec6f8 | 535 | /* [ WORD 9 ] |
75a70cf9 | 536 | __asm__ statement. */ |
537 | const char *string; | |
538 | ||
6d5ec6f8 | 539 | /* [ WORD 10 ] |
75a70cf9 | 540 | Number of inputs, outputs and clobbers. */ |
541 | unsigned char ni; | |
542 | unsigned char no; | |
543 | unsigned short nc; | |
544 | ||
6d5ec6f8 | 545 | /* [ WORD 11 ] |
75a70cf9 | 546 | Operand vector. NOTE! This must always be the last field |
547 | of this structure. In particular, this means that this | |
548 | structure cannot be embedded inside another one. */ | |
549 | tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1]; | |
550 | }; | |
551 | ||
552 | /* GIMPLE_OMP_CRITICAL */ | |
553 | ||
fb1e4f4a | 554 | struct GTY(()) gimple_statement_omp_critical { |
75a70cf9 | 555 | /* [ WORD 1-5 ] */ |
556 | struct gimple_statement_omp omp; | |
557 | ||
558 | /* [ WORD 6 ] | |
559 | Critical section name. */ | |
560 | tree name; | |
561 | }; | |
562 | ||
563 | ||
fb1e4f4a | 564 | struct GTY(()) gimple_omp_for_iter { |
75a70cf9 | 565 | /* Condition code. */ |
566 | enum tree_code cond; | |
567 | ||
568 | /* Index variable. */ | |
569 | tree index; | |
570 | ||
571 | /* Initial value. */ | |
572 | tree initial; | |
573 | ||
574 | /* Final value. */ | |
575 | tree final; | |
576 | ||
577 | /* Increment. */ | |
578 | tree incr; | |
579 | }; | |
580 | ||
581 | /* GIMPLE_OMP_FOR */ | |
582 | ||
fb1e4f4a | 583 | struct GTY(()) gimple_statement_omp_for { |
75a70cf9 | 584 | /* [ WORD 1-5 ] */ |
585 | struct gimple_statement_omp omp; | |
586 | ||
587 | /* [ WORD 6 ] */ | |
588 | tree clauses; | |
589 | ||
590 | /* [ WORD 7 ] | |
591 | Number of elements in iter array. */ | |
592 | size_t collapse; | |
593 | ||
594 | /* [ WORD 8 ] */ | |
595 | struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter; | |
596 | ||
597 | /* [ WORD 9 ] | |
598 | Pre-body evaluated before the loop body begins. */ | |
599 | gimple_seq pre_body; | |
600 | }; | |
601 | ||
602 | ||
603 | /* GIMPLE_OMP_PARALLEL */ | |
604 | ||
fb1e4f4a | 605 | struct GTY(()) gimple_statement_omp_parallel { |
75a70cf9 | 606 | /* [ WORD 1-5 ] */ |
607 | struct gimple_statement_omp omp; | |
608 | ||
609 | /* [ WORD 6 ] | |
610 | Clauses. */ | |
611 | tree clauses; | |
612 | ||
613 | /* [ WORD 7 ] | |
614 | Child function holding the body of the parallel region. */ | |
615 | tree child_fn; | |
616 | ||
617 | /* [ WORD 8 ] | |
618 | Shared data argument. */ | |
619 | tree data_arg; | |
620 | }; | |
621 | ||
622 | ||
623 | /* GIMPLE_OMP_TASK */ | |
624 | ||
fb1e4f4a | 625 | struct GTY(()) gimple_statement_omp_task { |
75a70cf9 | 626 | /* [ WORD 1-8 ] */ |
627 | struct gimple_statement_omp_parallel par; | |
628 | ||
629 | /* [ WORD 9 ] | |
630 | Child function holding firstprivate initialization if needed. */ | |
631 | tree copy_fn; | |
632 | ||
633 | /* [ WORD 10-11 ] | |
634 | Size and alignment in bytes of the argument data block. */ | |
635 | tree arg_size; | |
636 | tree arg_align; | |
637 | }; | |
638 | ||
639 | ||
640 | /* GIMPLE_OMP_SECTION */ | |
641 | /* Uses struct gimple_statement_omp. */ | |
642 | ||
643 | ||
644 | /* GIMPLE_OMP_SECTIONS */ | |
645 | ||
fb1e4f4a | 646 | struct GTY(()) gimple_statement_omp_sections { |
75a70cf9 | 647 | /* [ WORD 1-5 ] */ |
648 | struct gimple_statement_omp omp; | |
649 | ||
650 | /* [ WORD 6 ] */ | |
651 | tree clauses; | |
652 | ||
653 | /* [ WORD 7 ] | |
654 | The control variable used for deciding which of the sections to | |
655 | execute. */ | |
656 | tree control; | |
657 | }; | |
658 | ||
659 | /* GIMPLE_OMP_CONTINUE. | |
660 | ||
661 | Note: This does not inherit from gimple_statement_omp, because we | |
662 | do not need the body field. */ | |
663 | ||
fb1e4f4a | 664 | struct GTY(()) gimple_statement_omp_continue { |
75a70cf9 | 665 | /* [ WORD 1-4 ] */ |
666 | struct gimple_statement_base gsbase; | |
667 | ||
668 | /* [ WORD 5 ] */ | |
669 | tree control_def; | |
670 | ||
671 | /* [ WORD 6 ] */ | |
672 | tree control_use; | |
673 | }; | |
674 | ||
675 | /* GIMPLE_OMP_SINGLE */ | |
676 | ||
fb1e4f4a | 677 | struct GTY(()) gimple_statement_omp_single { |
75a70cf9 | 678 | /* [ WORD 1-5 ] */ |
679 | struct gimple_statement_omp omp; | |
680 | ||
681 | /* [ WORD 6 ] */ | |
682 | tree clauses; | |
683 | }; | |
684 | ||
685 | ||
686 | /* GIMPLE_OMP_ATOMIC_LOAD. | |
687 | Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp | |
688 | contains a sequence, which we don't need here. */ | |
689 | ||
fb1e4f4a | 690 | struct GTY(()) gimple_statement_omp_atomic_load { |
75a70cf9 | 691 | /* [ WORD 1-4 ] */ |
692 | struct gimple_statement_base gsbase; | |
693 | ||
694 | /* [ WORD 5-6 ] */ | |
695 | tree rhs, lhs; | |
696 | }; | |
697 | ||
698 | /* GIMPLE_OMP_ATOMIC_STORE. | |
699 | See note on GIMPLE_OMP_ATOMIC_LOAD. */ | |
700 | ||
fb1e4f4a | 701 | struct GTY(()) gimple_statement_omp_atomic_store { |
75a70cf9 | 702 | /* [ WORD 1-4 ] */ |
703 | struct gimple_statement_base gsbase; | |
704 | ||
705 | /* [ WORD 5 ] */ | |
706 | tree val; | |
707 | }; | |
708 | ||
709 | enum gimple_statement_structure_enum { | |
710 | #define DEFGSSTRUCT(SYM, STRING) SYM, | |
711 | #include "gsstruct.def" | |
712 | #undef DEFGSSTRUCT | |
713 | LAST_GSS_ENUM | |
714 | }; | |
715 | ||
716 | ||
717 | /* Define the overall contents of a gimple tuple. It may be any of the | |
718 | structures declared above for various types of tuples. */ | |
719 | ||
fb1e4f4a | 720 | union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d { |
75a70cf9 | 721 | struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase; |
722 | struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops; | |
723 | struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem; | |
724 | struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp; | |
725 | struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind; | |
726 | struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch; | |
727 | struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter; | |
728 | struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi; | |
729 | struct gimple_statement_resx GTY ((tag ("GSS_RESX"))) gimple_resx; | |
730 | struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try; | |
731 | struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce; | |
732 | struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm; | |
733 | struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical; | |
734 | struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for; | |
735 | struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel; | |
736 | struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task; | |
737 | struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections; | |
738 | struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single; | |
739 | struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue; | |
740 | struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load; | |
741 | struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store; | |
742 | }; | |
743 | ||
744 | /* In gimple.c. */ | |
745 | gimple gimple_build_return (tree); | |
746 | ||
747 | gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL); | |
748 | #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO) | |
749 | ||
750 | void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *); | |
751 | ||
752 | gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree, | |
753 | tree MEM_STAT_DECL); | |
754 | #define gimple_build_assign_with_ops(c,o1,o2,o3) \ | |
755 | gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO) | |
756 | ||
757 | gimple gimple_build_call_vec (tree, VEC(tree, heap) *); | |
758 | gimple gimple_build_call (tree, unsigned, ...); | |
759 | gimple gimple_build_call_from_tree (tree); | |
760 | gimple gimplify_assign (tree, tree, gimple_seq *); | |
761 | gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree); | |
762 | gimple gimple_build_label (tree label); | |
763 | gimple gimple_build_goto (tree dest); | |
764 | gimple gimple_build_nop (void); | |
765 | gimple gimple_build_bind (tree, gimple_seq, tree); | |
766 | gimple gimple_build_asm (const char *, unsigned, unsigned, unsigned, ...); | |
767 | gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *, | |
768 | VEC(tree,gc) *); | |
769 | gimple gimple_build_catch (tree, gimple_seq); | |
770 | gimple gimple_build_eh_filter (tree, gimple_seq); | |
ce6cd837 | 771 | gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags); |
75a70cf9 | 772 | gimple gimple_build_wce (gimple_seq); |
773 | gimple gimple_build_resx (int); | |
774 | gimple gimple_build_switch (unsigned, tree, tree, ...); | |
775 | gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *); | |
776 | gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree); | |
777 | gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree); | |
778 | gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq); | |
779 | gimple gimple_build_omp_critical (gimple_seq, tree); | |
780 | gimple gimple_build_omp_section (gimple_seq); | |
781 | gimple gimple_build_omp_continue (tree, tree); | |
782 | gimple gimple_build_omp_master (gimple_seq); | |
783 | gimple gimple_build_omp_return (bool); | |
784 | gimple gimple_build_omp_ordered (gimple_seq); | |
785 | gimple gimple_build_omp_sections (gimple_seq, tree); | |
786 | gimple gimple_build_omp_sections_switch (void); | |
787 | gimple gimple_build_omp_single (gimple_seq, tree); | |
788 | gimple gimple_build_cdt (tree, tree); | |
789 | gimple gimple_build_omp_atomic_load (tree, tree); | |
790 | gimple gimple_build_omp_atomic_store (tree); | |
791 | gimple gimple_build_predict (enum br_predictor, enum prediction); | |
792 | enum gimple_statement_structure_enum gimple_statement_structure (gimple); | |
793 | enum gimple_statement_structure_enum gss_for_assign (enum tree_code); | |
794 | void sort_case_labels (VEC(tree,heap) *); | |
795 | void gimple_set_body (tree, gimple_seq); | |
796 | gimple_seq gimple_body (tree); | |
1a1a827a | 797 | bool gimple_has_body_p (tree); |
75a70cf9 | 798 | gimple_seq gimple_seq_alloc (void); |
799 | void gimple_seq_free (gimple_seq); | |
800 | void gimple_seq_add_seq (gimple_seq *, gimple_seq); | |
801 | gimple_seq gimple_seq_copy (gimple_seq); | |
802 | int gimple_call_flags (const_gimple); | |
803 | bool gimple_assign_copy_p (gimple); | |
804 | bool gimple_assign_ssa_name_copy_p (gimple); | |
805 | bool gimple_assign_single_p (gimple); | |
806 | bool gimple_assign_unary_nop_p (gimple); | |
807 | void gimple_set_bb (gimple, struct basic_block_def *); | |
808 | tree gimple_fold (const_gimple); | |
809 | void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree); | |
810 | void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code, | |
811 | tree, tree); | |
812 | tree gimple_get_lhs (const_gimple); | |
813 | void gimple_set_lhs (gimple, tree); | |
814 | gimple gimple_copy (gimple); | |
815 | bool is_gimple_operand (const_tree); | |
816 | void gimple_set_modified (gimple, bool); | |
817 | void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *); | |
818 | gimple gimple_build_cond_from_tree (tree, tree, tree); | |
819 | void gimple_cond_set_condition_from_tree (gimple, tree); | |
820 | bool gimple_has_side_effects (const_gimple); | |
821 | bool gimple_rhs_has_side_effects (const_gimple); | |
822 | bool gimple_could_trap_p (gimple); | |
823 | bool gimple_assign_rhs_could_trap_p (gimple); | |
824 | void gimple_regimplify_operands (gimple, gimple_stmt_iterator *); | |
825 | bool empty_body_p (gimple_seq); | |
826 | unsigned get_gimple_rhs_num_ops (enum tree_code); | |
827 | ||
828 | /* Returns true iff T is a valid GIMPLE statement. */ | |
829 | extern bool is_gimple_stmt (tree); | |
830 | ||
831 | /* Returns true iff TYPE is a valid type for a scalar register variable. */ | |
832 | extern bool is_gimple_reg_type (tree); | |
833 | /* Returns true iff T is a scalar register variable. */ | |
834 | extern bool is_gimple_reg (tree); | |
75a70cf9 | 835 | /* Returns true iff T is any sort of variable. */ |
836 | extern bool is_gimple_variable (tree); | |
837 | /* Returns true iff T is any sort of symbol. */ | |
838 | extern bool is_gimple_id (tree); | |
839 | /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */ | |
840 | extern bool is_gimple_min_lval (tree); | |
841 | /* Returns true iff T is something whose address can be taken. */ | |
842 | extern bool is_gimple_addressable (tree); | |
843 | /* Returns true iff T is any valid GIMPLE lvalue. */ | |
844 | extern bool is_gimple_lvalue (tree); | |
845 | ||
846 | /* Returns true iff T is a GIMPLE address. */ | |
847 | bool is_gimple_address (const_tree); | |
848 | /* Returns true iff T is a GIMPLE invariant address. */ | |
849 | bool is_gimple_invariant_address (const_tree); | |
b9c94ed7 | 850 | /* Returns true iff T is a GIMPLE invariant address at interprocedural |
851 | level. */ | |
852 | bool is_gimple_ip_invariant_address (const_tree); | |
75a70cf9 | 853 | /* Returns true iff T is a valid GIMPLE constant. */ |
854 | bool is_gimple_constant (const_tree); | |
855 | /* Returns true iff T is a GIMPLE restricted function invariant. */ | |
856 | extern bool is_gimple_min_invariant (const_tree); | |
b9c94ed7 | 857 | /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */ |
858 | extern bool is_gimple_ip_invariant (const_tree); | |
75a70cf9 | 859 | /* Returns true iff T is a GIMPLE rvalue. */ |
860 | extern bool is_gimple_val (tree); | |
861 | /* Returns true iff T is a GIMPLE asm statement input. */ | |
862 | extern bool is_gimple_asm_val (tree); | |
863 | /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a | |
864 | GIMPLE temporary, a renamed user variable, or something else, | |
865 | respectively. */ | |
75a70cf9 | 866 | extern bool is_gimple_reg_rhs (tree); |
867 | extern bool is_gimple_mem_rhs (tree); | |
868 | ||
869 | /* Returns true iff T is a valid if-statement condition. */ | |
870 | extern bool is_gimple_condexpr (tree); | |
871 | ||
872 | /* Returns true iff T is a type conversion. */ | |
873 | extern bool is_gimple_cast (tree); | |
874 | /* Returns true iff T is a variable that does not need to live in memory. */ | |
875 | extern bool is_gimple_non_addressable (tree t); | |
876 | ||
877 | /* Returns true iff T is a valid call address expression. */ | |
878 | extern bool is_gimple_call_addr (tree); | |
879 | /* If T makes a function call, returns the CALL_EXPR operand. */ | |
880 | extern tree get_call_expr_in (tree t); | |
881 | ||
882 | extern void recalculate_side_effects (tree); | |
dd277d48 | 883 | extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *, |
884 | unsigned *); | |
5ed0b345 | 885 | extern bool walk_stmt_load_store_addr_ops (gimple, void *, |
886 | bool (*)(gimple, tree, void *), | |
887 | bool (*)(gimple, tree, void *), | |
888 | bool (*)(gimple, tree, void *)); | |
889 | extern bool walk_stmt_load_store_ops (gimple, void *, | |
890 | bool (*)(gimple, tree, void *), | |
891 | bool (*)(gimple, tree, void *)); | |
6d5ec6f8 | 892 | extern bool gimple_ior_addresses_taken (bitmap, gimple); |
75a70cf9 | 893 | |
894 | /* In gimplify.c */ | |
895 | extern tree create_tmp_var_raw (tree, const char *); | |
896 | extern tree create_tmp_var_name (const char *); | |
897 | extern tree create_tmp_var (tree, const char *); | |
898 | extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *); | |
899 | extern tree get_formal_tmp_var (tree, gimple_seq *); | |
900 | extern void declare_vars (tree, gimple, bool); | |
901 | extern void tree_annotate_all_with_location (tree *, location_t); | |
902 | extern void annotate_all_with_location (gimple_seq, location_t); | |
903 | ||
904 | /* Validation of GIMPLE expressions. Note that these predicates only check | |
905 | the basic form of the expression, they don't recurse to make sure that | |
906 | underlying nodes are also of the right form. */ | |
907 | typedef bool (*gimple_predicate)(tree); | |
908 | ||
909 | ||
910 | /* FIXME we should deduce this from the predicate. */ | |
b9c74b4d | 911 | enum fallback { |
75a70cf9 | 912 | fb_none = 0, /* Do not generate a temporary. */ |
913 | ||
914 | fb_rvalue = 1, /* Generate an rvalue to hold the result of a | |
915 | gimplified expression. */ | |
916 | ||
917 | fb_lvalue = 2, /* Generate an lvalue to hold the result of a | |
918 | gimplified expression. */ | |
919 | ||
920 | fb_mayfail = 4, /* Gimplification may fail. Error issued | |
921 | afterwards. */ | |
922 | fb_either= fb_rvalue | fb_lvalue | |
b9c74b4d | 923 | }; |
924 | ||
925 | typedef int fallback_t; | |
75a70cf9 | 926 | |
927 | enum gimplify_status { | |
928 | GS_ERROR = -2, /* Something Bad Seen. */ | |
929 | GS_UNHANDLED = -1, /* A langhook result for "I dunno". */ | |
930 | GS_OK = 0, /* We did something, maybe more to do. */ | |
931 | GS_ALL_DONE = 1 /* The expression is fully gimplified. */ | |
932 | }; | |
933 | ||
934 | struct gimplify_ctx | |
935 | { | |
936 | struct gimplify_ctx *prev_context; | |
937 | ||
938 | VEC(gimple,heap) *bind_expr_stack; | |
939 | tree temps; | |
940 | gimple_seq conditional_cleanups; | |
941 | tree exit_label; | |
942 | tree return_temp; | |
943 | ||
944 | VEC(tree,heap) *case_labels; | |
945 | /* The formal temporary table. Should this be persistent? */ | |
946 | htab_t temp_htab; | |
947 | ||
948 | int conditions; | |
949 | bool save_stack; | |
950 | bool into_ssa; | |
951 | bool allow_rhs_cond_expr; | |
952 | }; | |
953 | ||
954 | extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *, | |
955 | bool (*) (tree), fallback_t); | |
956 | extern void gimplify_type_sizes (tree, gimple_seq *); | |
957 | extern void gimplify_one_sizepos (tree *, gimple_seq *); | |
958 | extern bool gimplify_stmt (tree *, gimple_seq *); | |
959 | extern gimple gimplify_body (tree *, tree, bool); | |
960 | extern void push_gimplify_context (struct gimplify_ctx *); | |
961 | extern void pop_gimplify_context (gimple); | |
962 | extern void gimplify_and_add (tree, gimple_seq *); | |
963 | ||
964 | /* Miscellaneous helpers. */ | |
965 | extern void gimple_add_tmp_var (tree); | |
966 | extern gimple gimple_current_bind_expr (void); | |
967 | extern VEC(gimple, heap) *gimple_bind_expr_stack (void); | |
968 | extern tree voidify_wrapper_expr (tree, tree); | |
969 | extern tree build_and_jump (tree *); | |
970 | extern tree alloc_stmt_list (void); | |
971 | extern void free_stmt_list (tree); | |
972 | extern tree force_labels_r (tree *, int *, void *); | |
973 | extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *, | |
974 | gimple_seq *); | |
975 | struct gimplify_omp_ctx; | |
976 | extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree); | |
977 | extern tree gimple_boolify (tree); | |
978 | extern gimple_predicate rhs_predicate_for (tree); | |
979 | extern tree canonicalize_cond_expr_cond (tree); | |
980 | ||
981 | /* In omp-low.c. */ | |
982 | extern void diagnose_omp_structured_block_errors (tree); | |
983 | extern tree omp_reduction_init (tree, tree); | |
984 | ||
985 | /* In tree-nested.c. */ | |
986 | extern void lower_nested_functions (tree); | |
987 | extern void insert_field_into_struct (tree, tree); | |
988 | ||
989 | /* In gimplify.c. */ | |
990 | extern void gimplify_function_tree (tree); | |
991 | ||
992 | /* In cfgexpand.c. */ | |
993 | extern tree gimple_assign_rhs_to_tree (gimple); | |
994 | ||
995 | /* In builtins.c */ | |
996 | extern bool validate_gimple_arglist (const_gimple, ...); | |
997 | ||
644c6d4c | 998 | /* In tree-ssa.c */ |
999 | extern bool tree_ssa_useless_type_conversion (tree); | |
1000 | extern bool useless_type_conversion_p (tree, tree); | |
1001 | extern bool types_compatible_p (tree, tree); | |
1002 | ||
75a70cf9 | 1003 | /* Return the code for GIMPLE statement G. */ |
1004 | ||
1005 | static inline enum gimple_code | |
1006 | gimple_code (const_gimple g) | |
1007 | { | |
1008 | return g->gsbase.code; | |
1009 | } | |
1010 | ||
1011 | ||
1012 | /* Return true if statement G has sub-statements. This is only true for | |
1013 | High GIMPLE statements. */ | |
1014 | ||
1015 | static inline bool | |
1016 | gimple_has_substatements (gimple g) | |
1017 | { | |
1018 | switch (gimple_code (g)) | |
1019 | { | |
1020 | case GIMPLE_BIND: | |
1021 | case GIMPLE_CATCH: | |
1022 | case GIMPLE_EH_FILTER: | |
1023 | case GIMPLE_TRY: | |
1024 | case GIMPLE_OMP_FOR: | |
1025 | case GIMPLE_OMP_MASTER: | |
1026 | case GIMPLE_OMP_ORDERED: | |
1027 | case GIMPLE_OMP_SECTION: | |
1028 | case GIMPLE_OMP_PARALLEL: | |
1029 | case GIMPLE_OMP_TASK: | |
1030 | case GIMPLE_OMP_SECTIONS: | |
1031 | case GIMPLE_OMP_SINGLE: | |
12d3d5cb | 1032 | case GIMPLE_OMP_CRITICAL: |
75a70cf9 | 1033 | case GIMPLE_WITH_CLEANUP_EXPR: |
1034 | return true; | |
1035 | ||
1036 | default: | |
1037 | return false; | |
1038 | } | |
1039 | } | |
1040 | ||
1041 | ||
1042 | /* Return the basic block holding statement G. */ | |
1043 | ||
1044 | static inline struct basic_block_def * | |
1045 | gimple_bb (const_gimple g) | |
1046 | { | |
1047 | return g->gsbase.bb; | |
1048 | } | |
1049 | ||
1050 | ||
1051 | /* Return the lexical scope block holding statement G. */ | |
1052 | ||
1053 | static inline tree | |
1054 | gimple_block (const_gimple g) | |
1055 | { | |
1056 | return g->gsbase.block; | |
1057 | } | |
1058 | ||
1059 | ||
1060 | /* Set BLOCK to be the lexical scope block holding statement G. */ | |
1061 | ||
1062 | static inline void | |
1063 | gimple_set_block (gimple g, tree block) | |
1064 | { | |
1065 | g->gsbase.block = block; | |
1066 | } | |
1067 | ||
1068 | ||
1069 | /* Return location information for statement G. */ | |
1070 | ||
1071 | static inline location_t | |
1072 | gimple_location (const_gimple g) | |
1073 | { | |
1074 | return g->gsbase.location; | |
1075 | } | |
1076 | ||
1077 | /* Return pointer to location information for statement G. */ | |
1078 | ||
1079 | static inline const location_t * | |
1080 | gimple_location_ptr (const_gimple g) | |
1081 | { | |
1082 | return &g->gsbase.location; | |
1083 | } | |
1084 | ||
1085 | ||
1086 | /* Set location information for statement G. */ | |
1087 | ||
1088 | static inline void | |
1089 | gimple_set_location (gimple g, location_t location) | |
1090 | { | |
1091 | g->gsbase.location = location; | |
1092 | } | |
1093 | ||
1094 | ||
1095 | /* Return true if G contains location information. */ | |
1096 | ||
1097 | static inline bool | |
1098 | gimple_has_location (const_gimple g) | |
1099 | { | |
1100 | return gimple_location (g) != UNKNOWN_LOCATION; | |
1101 | } | |
1102 | ||
1103 | ||
1104 | /* Return the file name of the location of STMT. */ | |
1105 | ||
1106 | static inline const char * | |
1107 | gimple_filename (const_gimple stmt) | |
1108 | { | |
1109 | return LOCATION_FILE (gimple_location (stmt)); | |
1110 | } | |
1111 | ||
1112 | ||
1113 | /* Return the line number of the location of STMT. */ | |
1114 | ||
1115 | static inline int | |
1116 | gimple_lineno (const_gimple stmt) | |
1117 | { | |
1118 | return LOCATION_LINE (gimple_location (stmt)); | |
1119 | } | |
1120 | ||
1121 | ||
1122 | /* Determine whether SEQ is a singleton. */ | |
1123 | ||
1124 | static inline bool | |
1125 | gimple_seq_singleton_p (gimple_seq seq) | |
1126 | { | |
1127 | return ((gimple_seq_first (seq) != NULL) | |
1128 | && (gimple_seq_first (seq) == gimple_seq_last (seq))); | |
1129 | } | |
1130 | ||
1131 | /* Return true if no warnings should be emitted for statement STMT. */ | |
1132 | ||
1133 | static inline bool | |
1134 | gimple_no_warning_p (const_gimple stmt) | |
1135 | { | |
1136 | return stmt->gsbase.no_warning; | |
1137 | } | |
1138 | ||
1139 | /* Set the no_warning flag of STMT to NO_WARNING. */ | |
1140 | ||
1141 | static inline void | |
1142 | gimple_set_no_warning (gimple stmt, bool no_warning) | |
1143 | { | |
1144 | stmt->gsbase.no_warning = (unsigned) no_warning; | |
1145 | } | |
1146 | ||
1147 | /* Set the visited status on statement STMT to VISITED_P. */ | |
1148 | ||
1149 | static inline void | |
1150 | gimple_set_visited (gimple stmt, bool visited_p) | |
1151 | { | |
1152 | stmt->gsbase.visited = (unsigned) visited_p; | |
1153 | } | |
1154 | ||
1155 | ||
1156 | /* Return the visited status for statement STMT. */ | |
1157 | ||
1158 | static inline bool | |
1159 | gimple_visited_p (gimple stmt) | |
1160 | { | |
1161 | return stmt->gsbase.visited; | |
1162 | } | |
1163 | ||
1164 | ||
1165 | /* Set pass local flag PLF on statement STMT to VAL_P. */ | |
1166 | ||
1167 | static inline void | |
1168 | gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p) | |
1169 | { | |
1170 | if (val_p) | |
1171 | stmt->gsbase.plf |= (unsigned int) plf; | |
1172 | else | |
1173 | stmt->gsbase.plf &= ~((unsigned int) plf); | |
1174 | } | |
1175 | ||
1176 | ||
1177 | /* Return the value of pass local flag PLF on statement STMT. */ | |
1178 | ||
1179 | static inline unsigned int | |
1180 | gimple_plf (gimple stmt, enum plf_mask plf) | |
1181 | { | |
1182 | return stmt->gsbase.plf & ((unsigned int) plf); | |
1183 | } | |
1184 | ||
1185 | ||
51e52fe3 | 1186 | /* Set the UID of statement. */ |
75a70cf9 | 1187 | |
1188 | static inline void | |
1189 | gimple_set_uid (gimple g, unsigned uid) | |
1190 | { | |
1191 | g->gsbase.uid = uid; | |
1192 | } | |
1193 | ||
1194 | ||
51e52fe3 | 1195 | /* Return the UID of statement. */ |
75a70cf9 | 1196 | |
1197 | static inline unsigned | |
1198 | gimple_uid (const_gimple g) | |
1199 | { | |
1200 | return g->gsbase.uid; | |
1201 | } | |
1202 | ||
1203 | ||
1204 | /* Return true if GIMPLE statement G has register or memory operands. */ | |
1205 | ||
1206 | static inline bool | |
1207 | gimple_has_ops (const_gimple g) | |
1208 | { | |
1209 | return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN; | |
1210 | } | |
1211 | ||
1212 | ||
1213 | /* Return true if GIMPLE statement G has memory operands. */ | |
1214 | ||
1215 | static inline bool | |
1216 | gimple_has_mem_ops (const_gimple g) | |
1217 | { | |
1218 | return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN; | |
1219 | } | |
1220 | ||
75a70cf9 | 1221 | |
1222 | /* Return the set of DEF operands for statement G. */ | |
1223 | ||
1224 | static inline struct def_optype_d * | |
1225 | gimple_def_ops (const_gimple g) | |
1226 | { | |
1227 | if (!gimple_has_ops (g)) | |
1228 | return NULL; | |
1229 | return g->gsops.opbase.def_ops; | |
1230 | } | |
1231 | ||
1232 | ||
1233 | /* Set DEF to be the set of DEF operands for statement G. */ | |
1234 | ||
1235 | static inline void | |
1236 | gimple_set_def_ops (gimple g, struct def_optype_d *def) | |
1237 | { | |
1238 | gcc_assert (gimple_has_ops (g)); | |
1239 | g->gsops.opbase.def_ops = def; | |
1240 | } | |
1241 | ||
1242 | ||
1243 | /* Return the set of USE operands for statement G. */ | |
1244 | ||
1245 | static inline struct use_optype_d * | |
1246 | gimple_use_ops (const_gimple g) | |
1247 | { | |
1248 | if (!gimple_has_ops (g)) | |
1249 | return NULL; | |
1250 | return g->gsops.opbase.use_ops; | |
1251 | } | |
1252 | ||
1253 | ||
1254 | /* Set USE to be the set of USE operands for statement G. */ | |
1255 | ||
1256 | static inline void | |
1257 | gimple_set_use_ops (gimple g, struct use_optype_d *use) | |
1258 | { | |
1259 | gcc_assert (gimple_has_ops (g)); | |
1260 | g->gsops.opbase.use_ops = use; | |
1261 | } | |
1262 | ||
1263 | ||
dd277d48 | 1264 | /* Return the set of VUSE operand for statement G. */ |
75a70cf9 | 1265 | |
dd277d48 | 1266 | static inline use_operand_p |
1267 | gimple_vuse_op (const_gimple g) | |
75a70cf9 | 1268 | { |
dd277d48 | 1269 | struct use_optype_d *ops; |
75a70cf9 | 1270 | if (!gimple_has_mem_ops (g)) |
dd277d48 | 1271 | return NULL_USE_OPERAND_P; |
1272 | ops = g->gsops.opbase.use_ops; | |
1273 | if (ops | |
1274 | && USE_OP_PTR (ops)->use == &g->gsmem.membase.vuse) | |
1275 | return USE_OP_PTR (ops); | |
1276 | return NULL_USE_OPERAND_P; | |
75a70cf9 | 1277 | } |
1278 | ||
dd277d48 | 1279 | /* Return the set of VDEF operand for statement G. */ |
75a70cf9 | 1280 | |
dd277d48 | 1281 | static inline def_operand_p |
1282 | gimple_vdef_op (const_gimple g) | |
75a70cf9 | 1283 | { |
dd277d48 | 1284 | struct def_optype_d *ops; |
1285 | if (!gimple_has_mem_ops (g)) | |
1286 | return NULL_DEF_OPERAND_P; | |
1287 | ops = g->gsops.opbase.def_ops; | |
1288 | if (ops | |
1289 | && DEF_OP_PTR (ops) == &g->gsmem.membase.vdef) | |
1290 | return DEF_OP_PTR (ops); | |
1291 | return NULL_DEF_OPERAND_P; | |
75a70cf9 | 1292 | } |
1293 | ||
1294 | ||
dd277d48 | 1295 | /* Return the single VUSE operand of the statement G. */ |
75a70cf9 | 1296 | |
dd277d48 | 1297 | static inline tree |
1298 | gimple_vuse (const_gimple g) | |
75a70cf9 | 1299 | { |
1300 | if (!gimple_has_mem_ops (g)) | |
dd277d48 | 1301 | return NULL_TREE; |
1302 | return g->gsmem.membase.vuse; | |
75a70cf9 | 1303 | } |
1304 | ||
dd277d48 | 1305 | /* Return the single VDEF operand of the statement G. */ |
75a70cf9 | 1306 | |
dd277d48 | 1307 | static inline tree |
1308 | gimple_vdef (const_gimple g) | |
75a70cf9 | 1309 | { |
dd277d48 | 1310 | if (!gimple_has_mem_ops (g)) |
1311 | return NULL_TREE; | |
1312 | return g->gsmem.membase.vdef; | |
75a70cf9 | 1313 | } |
1314 | ||
dd277d48 | 1315 | /* Return the single VUSE operand of the statement G. */ |
75a70cf9 | 1316 | |
dd277d48 | 1317 | static inline tree * |
1318 | gimple_vuse_ptr (gimple g) | |
75a70cf9 | 1319 | { |
1320 | if (!gimple_has_mem_ops (g)) | |
1321 | return NULL; | |
dd277d48 | 1322 | return &g->gsmem.membase.vuse; |
75a70cf9 | 1323 | } |
1324 | ||
dd277d48 | 1325 | /* Return the single VDEF operand of the statement G. */ |
75a70cf9 | 1326 | |
dd277d48 | 1327 | static inline tree * |
1328 | gimple_vdef_ptr (gimple g) | |
75a70cf9 | 1329 | { |
1330 | if (!gimple_has_mem_ops (g)) | |
1331 | return NULL; | |
dd277d48 | 1332 | return &g->gsmem.membase.vdef; |
1333 | } | |
1334 | ||
1335 | /* Set the single VUSE operand of the statement G. */ | |
1336 | ||
1337 | static inline void | |
1338 | gimple_set_vuse (gimple g, tree vuse) | |
1339 | { | |
1340 | gcc_assert (gimple_has_mem_ops (g)); | |
1341 | g->gsmem.membase.vuse = vuse; | |
1342 | } | |
1343 | ||
1344 | /* Set the single VDEF operand of the statement G. */ | |
1345 | ||
1346 | static inline void | |
1347 | gimple_set_vdef (gimple g, tree vdef) | |
1348 | { | |
1349 | gcc_assert (gimple_has_mem_ops (g)); | |
1350 | g->gsmem.membase.vdef = vdef; | |
75a70cf9 | 1351 | } |
1352 | ||
1353 | ||
1354 | /* Return true if statement G has operands and the modified field has | |
1355 | been set. */ | |
1356 | ||
1357 | static inline bool | |
1358 | gimple_modified_p (const_gimple g) | |
1359 | { | |
1360 | return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false; | |
1361 | } | |
1362 | ||
1363 | /* Return the type of the main expression computed by STMT. Return | |
1364 | void_type_node if the statement computes nothing. */ | |
1365 | ||
1366 | static inline tree | |
1367 | gimple_expr_type (const_gimple stmt) | |
1368 | { | |
1369 | enum gimple_code code = gimple_code (stmt); | |
1370 | ||
1371 | if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) | |
1372 | { | |
1373 | tree type = TREE_TYPE (gimple_get_lhs (stmt)); | |
1374 | /* Integral sub-types are never the type of the expression, | |
1375 | but they still can be the type of the result as the base | |
1376 | type (in which expressions are computed) is trivially | |
1377 | convertible to one of its sub-types. So always return | |
1378 | the base type here. */ | |
1379 | if (INTEGRAL_TYPE_P (type) | |
644c6d4c | 1380 | && TREE_TYPE (type) |
1381 | /* But only if they are trivially convertible. */ | |
1382 | && useless_type_conversion_p (type, TREE_TYPE (type))) | |
75a70cf9 | 1383 | type = TREE_TYPE (type); |
1384 | return type; | |
1385 | } | |
1386 | else if (code == GIMPLE_COND) | |
1387 | return boolean_type_node; | |
1388 | else | |
1389 | return void_type_node; | |
1390 | } | |
1391 | ||
1392 | ||
1393 | /* Return the tree code for the expression computed by STMT. This is | |
1394 | only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For | |
1395 | GIMPLE_CALL, return CALL_EXPR as the expression code for | |
1396 | consistency. This is useful when the caller needs to deal with the | |
1397 | three kinds of computation that GIMPLE supports. */ | |
1398 | ||
1399 | static inline enum tree_code | |
1400 | gimple_expr_code (const_gimple stmt) | |
1401 | { | |
1402 | enum gimple_code code = gimple_code (stmt); | |
1403 | if (code == GIMPLE_ASSIGN || code == GIMPLE_COND) | |
1404 | return (enum tree_code) stmt->gsbase.subcode; | |
1405 | else if (code == GIMPLE_CALL) | |
1406 | return CALL_EXPR; | |
1407 | else | |
1408 | gcc_unreachable (); | |
1409 | } | |
1410 | ||
1411 | ||
1412 | /* Mark statement S as modified, and update it. */ | |
1413 | ||
1414 | static inline void | |
1415 | update_stmt (gimple s) | |
1416 | { | |
1417 | if (gimple_has_ops (s)) | |
1418 | { | |
1419 | gimple_set_modified (s, true); | |
1420 | update_stmt_operands (s); | |
1421 | } | |
1422 | } | |
1423 | ||
1424 | /* Update statement S if it has been optimized. */ | |
1425 | ||
1426 | static inline void | |
1427 | update_stmt_if_modified (gimple s) | |
1428 | { | |
1429 | if (gimple_modified_p (s)) | |
1430 | update_stmt_operands (s); | |
1431 | } | |
1432 | ||
1433 | /* Return true if statement STMT contains volatile operands. */ | |
1434 | ||
1435 | static inline bool | |
1436 | gimple_has_volatile_ops (const_gimple stmt) | |
1437 | { | |
1438 | if (gimple_has_mem_ops (stmt)) | |
1439 | return stmt->gsbase.has_volatile_ops; | |
1440 | else | |
1441 | return false; | |
1442 | } | |
1443 | ||
1444 | ||
1445 | /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */ | |
1446 | ||
1447 | static inline void | |
1448 | gimple_set_has_volatile_ops (gimple stmt, bool volatilep) | |
1449 | { | |
1450 | if (gimple_has_mem_ops (stmt)) | |
1451 | stmt->gsbase.has_volatile_ops = (unsigned) volatilep; | |
1452 | } | |
1453 | ||
1454 | ||
1455 | /* Return true if statement STMT may access memory. */ | |
1456 | ||
1457 | static inline bool | |
1458 | gimple_references_memory_p (gimple stmt) | |
1459 | { | |
dd277d48 | 1460 | return gimple_has_mem_ops (stmt) && gimple_vuse (stmt); |
75a70cf9 | 1461 | } |
1462 | ||
1463 | ||
75a70cf9 | 1464 | /* Return the subcode for OMP statement S. */ |
1465 | ||
1466 | static inline unsigned | |
1467 | gimple_omp_subcode (const_gimple s) | |
1468 | { | |
1469 | gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD | |
1470 | && gimple_code (s) <= GIMPLE_OMP_SINGLE); | |
1471 | return s->gsbase.subcode; | |
1472 | } | |
1473 | ||
1474 | /* Set the subcode for OMP statement S to SUBCODE. */ | |
1475 | ||
1476 | static inline void | |
1477 | gimple_omp_set_subcode (gimple s, unsigned int subcode) | |
1478 | { | |
1479 | /* We only have 16 bits for the subcode. Assert that we are not | |
1480 | overflowing it. */ | |
1481 | gcc_assert (subcode < (1 << 16)); | |
1482 | s->gsbase.subcode = subcode; | |
1483 | } | |
1484 | ||
1485 | /* Set the nowait flag on OMP_RETURN statement S. */ | |
1486 | ||
1487 | static inline void | |
1488 | gimple_omp_return_set_nowait (gimple s) | |
1489 | { | |
1490 | GIMPLE_CHECK (s, GIMPLE_OMP_RETURN); | |
1491 | s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT; | |
1492 | } | |
1493 | ||
1494 | ||
1495 | /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT | |
1496 | flag set. */ | |
1497 | ||
1498 | static inline bool | |
1499 | gimple_omp_return_nowait_p (const_gimple g) | |
1500 | { | |
1501 | GIMPLE_CHECK (g, GIMPLE_OMP_RETURN); | |
1502 | return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0; | |
1503 | } | |
1504 | ||
1505 | ||
1506 | /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST | |
1507 | flag set. */ | |
1508 | ||
1509 | static inline bool | |
1510 | gimple_omp_section_last_p (const_gimple g) | |
1511 | { | |
1512 | GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); | |
1513 | return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0; | |
1514 | } | |
1515 | ||
1516 | ||
1517 | /* Set the GF_OMP_SECTION_LAST flag on G. */ | |
1518 | ||
1519 | static inline void | |
1520 | gimple_omp_section_set_last (gimple g) | |
1521 | { | |
1522 | GIMPLE_CHECK (g, GIMPLE_OMP_SECTION); | |
1523 | g->gsbase.subcode |= GF_OMP_SECTION_LAST; | |
1524 | } | |
1525 | ||
1526 | ||
1527 | /* Return true if OMP parallel statement G has the | |
1528 | GF_OMP_PARALLEL_COMBINED flag set. */ | |
1529 | ||
1530 | static inline bool | |
1531 | gimple_omp_parallel_combined_p (const_gimple g) | |
1532 | { | |
1533 | GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); | |
1534 | return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0; | |
1535 | } | |
1536 | ||
1537 | ||
1538 | /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean | |
1539 | value of COMBINED_P. */ | |
1540 | ||
1541 | static inline void | |
1542 | gimple_omp_parallel_set_combined_p (gimple g, bool combined_p) | |
1543 | { | |
1544 | GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL); | |
1545 | if (combined_p) | |
1546 | g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED; | |
1547 | else | |
1548 | g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED; | |
1549 | } | |
1550 | ||
1551 | ||
1552 | /* Return the number of operands for statement GS. */ | |
1553 | ||
1554 | static inline unsigned | |
1555 | gimple_num_ops (const_gimple gs) | |
1556 | { | |
1557 | return gs->gsbase.num_ops; | |
1558 | } | |
1559 | ||
1560 | ||
1561 | /* Set the number of operands for statement GS. */ | |
1562 | ||
1563 | static inline void | |
1564 | gimple_set_num_ops (gimple gs, unsigned num_ops) | |
1565 | { | |
1566 | gs->gsbase.num_ops = num_ops; | |
1567 | } | |
1568 | ||
1569 | ||
1570 | /* Return the array of operands for statement GS. */ | |
1571 | ||
1572 | static inline tree * | |
1573 | gimple_ops (gimple gs) | |
1574 | { | |
1575 | /* Offset in bytes to the location of the operand vector in every | |
1576 | tuple structure. Defined in gimple.c */ | |
1577 | extern size_t const gimple_ops_offset_[]; | |
1578 | ||
1579 | if (!gimple_has_ops (gs)) | |
1580 | return NULL; | |
1581 | ||
1582 | /* All the tuples have their operand vector at the very bottom | |
1583 | of the structure. */ | |
1584 | return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)])); | |
1585 | } | |
1586 | ||
1587 | ||
1588 | /* Return operand I for statement GS. */ | |
1589 | ||
1590 | static inline tree | |
1591 | gimple_op (const_gimple gs, unsigned i) | |
1592 | { | |
1593 | if (gimple_has_ops (gs)) | |
1594 | { | |
1595 | gcc_assert (i < gimple_num_ops (gs)); | |
1596 | return gimple_ops (CONST_CAST_GIMPLE (gs))[i]; | |
1597 | } | |
1598 | else | |
1599 | return NULL_TREE; | |
1600 | } | |
1601 | ||
1602 | /* Return a pointer to operand I for statement GS. */ | |
1603 | ||
1604 | static inline tree * | |
1605 | gimple_op_ptr (const_gimple gs, unsigned i) | |
1606 | { | |
1607 | if (gimple_has_ops (gs)) | |
1608 | { | |
1609 | gcc_assert (i < gimple_num_ops (gs)); | |
1610 | return gimple_ops (CONST_CAST_GIMPLE (gs)) + i; | |
1611 | } | |
1612 | else | |
1613 | return NULL; | |
1614 | } | |
1615 | ||
1616 | /* Set operand I of statement GS to OP. */ | |
1617 | ||
1618 | static inline void | |
1619 | gimple_set_op (gimple gs, unsigned i, tree op) | |
1620 | { | |
1621 | gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs)); | |
1622 | ||
1623 | /* Note. It may be tempting to assert that OP matches | |
1624 | is_gimple_operand, but that would be wrong. Different tuples | |
1625 | accept slightly different sets of tree operands. Each caller | |
1626 | should perform its own validation. */ | |
1627 | gimple_ops (gs)[i] = op; | |
1628 | } | |
1629 | ||
1630 | /* Return true if GS is a GIMPLE_ASSIGN. */ | |
1631 | ||
1632 | static inline bool | |
1633 | is_gimple_assign (const_gimple gs) | |
1634 | { | |
1635 | return gimple_code (gs) == GIMPLE_ASSIGN; | |
1636 | } | |
1637 | ||
1638 | /* Determine if expression CODE is one of the valid expressions that can | |
1639 | be used on the RHS of GIMPLE assignments. */ | |
1640 | ||
1641 | static inline enum gimple_rhs_class | |
1642 | get_gimple_rhs_class (enum tree_code code) | |
1643 | { | |
1644 | return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code]; | |
1645 | } | |
1646 | ||
1647 | /* Return the LHS of assignment statement GS. */ | |
1648 | ||
1649 | static inline tree | |
1650 | gimple_assign_lhs (const_gimple gs) | |
1651 | { | |
1652 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1653 | return gimple_op (gs, 0); | |
1654 | } | |
1655 | ||
1656 | ||
1657 | /* Return a pointer to the LHS of assignment statement GS. */ | |
1658 | ||
1659 | static inline tree * | |
1660 | gimple_assign_lhs_ptr (const_gimple gs) | |
1661 | { | |
1662 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1663 | return gimple_op_ptr (gs, 0); | |
1664 | } | |
1665 | ||
1666 | ||
1667 | /* Set LHS to be the LHS operand of assignment statement GS. */ | |
1668 | ||
1669 | static inline void | |
1670 | gimple_assign_set_lhs (gimple gs, tree lhs) | |
1671 | { | |
1672 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1673 | gcc_assert (is_gimple_operand (lhs)); | |
1674 | gimple_set_op (gs, 0, lhs); | |
1675 | ||
1676 | if (lhs && TREE_CODE (lhs) == SSA_NAME) | |
1677 | SSA_NAME_DEF_STMT (lhs) = gs; | |
1678 | } | |
1679 | ||
1680 | ||
1681 | /* Return the first operand on the RHS of assignment statement GS. */ | |
1682 | ||
1683 | static inline tree | |
1684 | gimple_assign_rhs1 (const_gimple gs) | |
1685 | { | |
1686 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1687 | return gimple_op (gs, 1); | |
1688 | } | |
1689 | ||
1690 | ||
1691 | /* Return a pointer to the first operand on the RHS of assignment | |
1692 | statement GS. */ | |
1693 | ||
1694 | static inline tree * | |
1695 | gimple_assign_rhs1_ptr (const_gimple gs) | |
1696 | { | |
1697 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1698 | return gimple_op_ptr (gs, 1); | |
1699 | } | |
1700 | ||
1701 | /* Set RHS to be the first operand on the RHS of assignment statement GS. */ | |
1702 | ||
1703 | static inline void | |
1704 | gimple_assign_set_rhs1 (gimple gs, tree rhs) | |
1705 | { | |
1706 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1707 | ||
1708 | /* If there are 3 or more operands, the 2 operands on the RHS must be | |
1709 | GIMPLE values. */ | |
1710 | if (gimple_num_ops (gs) >= 3) | |
1711 | gcc_assert (is_gimple_val (rhs)); | |
1712 | else | |
1713 | gcc_assert (is_gimple_operand (rhs)); | |
1714 | ||
1715 | gimple_set_op (gs, 1, rhs); | |
1716 | } | |
1717 | ||
1718 | ||
1719 | /* Return the second operand on the RHS of assignment statement GS. | |
1720 | If GS does not have two operands, NULL is returned instead. */ | |
1721 | ||
1722 | static inline tree | |
1723 | gimple_assign_rhs2 (const_gimple gs) | |
1724 | { | |
1725 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1726 | ||
1727 | if (gimple_num_ops (gs) >= 3) | |
1728 | return gimple_op (gs, 2); | |
1729 | else | |
1730 | return NULL_TREE; | |
1731 | } | |
1732 | ||
1733 | ||
1734 | /* Return a pointer to the second operand on the RHS of assignment | |
1735 | statement GS. */ | |
1736 | ||
1737 | static inline tree * | |
1738 | gimple_assign_rhs2_ptr (const_gimple gs) | |
1739 | { | |
1740 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1741 | return gimple_op_ptr (gs, 2); | |
1742 | } | |
1743 | ||
1744 | ||
1745 | /* Set RHS to be the second operand on the RHS of assignment statement GS. */ | |
1746 | ||
1747 | static inline void | |
1748 | gimple_assign_set_rhs2 (gimple gs, tree rhs) | |
1749 | { | |
1750 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1751 | ||
1752 | /* The 2 operands on the RHS must be GIMPLE values. */ | |
1753 | gcc_assert (is_gimple_val (rhs)); | |
1754 | ||
1755 | gimple_set_op (gs, 2, rhs); | |
1756 | } | |
1757 | ||
1758 | /* Returns true if GS is a nontemporal move. */ | |
1759 | ||
1760 | static inline bool | |
1761 | gimple_assign_nontemporal_move_p (const_gimple gs) | |
1762 | { | |
1763 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1764 | return gs->gsbase.nontemporal_move; | |
1765 | } | |
1766 | ||
1767 | /* Sets nontemporal move flag of GS to NONTEMPORAL. */ | |
1768 | ||
1769 | static inline void | |
1770 | gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal) | |
1771 | { | |
1772 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1773 | gs->gsbase.nontemporal_move = nontemporal; | |
1774 | } | |
1775 | ||
1776 | ||
1777 | /* Return the code of the expression computed on the rhs of assignment | |
1778 | statement GS. In case that the RHS is a single object, returns the | |
1779 | tree code of the object. */ | |
1780 | ||
1781 | static inline enum tree_code | |
1782 | gimple_assign_rhs_code (const_gimple gs) | |
1783 | { | |
1784 | enum tree_code code; | |
1785 | GIMPLE_CHECK (gs, GIMPLE_ASSIGN); | |
1786 | ||
1787 | code = gimple_expr_code (gs); | |
1788 | if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS) | |
1789 | code = TREE_CODE (gimple_assign_rhs1 (gs)); | |
1790 | ||
1791 | return code; | |
1792 | } | |
1793 | ||
1794 | ||
1795 | /* Set CODE to be the code for the expression computed on the RHS of | |
1796 | assignment S. */ | |
1797 | ||
1798 | static inline void | |
1799 | gimple_assign_set_rhs_code (gimple s, enum tree_code code) | |
1800 | { | |
1801 | GIMPLE_CHECK (s, GIMPLE_ASSIGN); | |
1802 | s->gsbase.subcode = code; | |
1803 | } | |
1804 | ||
1805 | ||
b8747787 | 1806 | /* Return the gimple rhs class of the code of the expression computed on |
1807 | the rhs of assignment statement GS. | |
1808 | This will never return GIMPLE_INVALID_RHS. */ | |
1809 | ||
1810 | static inline enum gimple_rhs_class | |
1811 | gimple_assign_rhs_class (const_gimple gs) | |
1812 | { | |
1813 | return get_gimple_rhs_class (gimple_assign_rhs_code (gs)); | |
1814 | } | |
1815 | ||
1816 | ||
75a70cf9 | 1817 | /* Return true if S is a type-cast assignment. */ |
1818 | ||
1819 | static inline bool | |
1820 | gimple_assign_cast_p (gimple s) | |
1821 | { | |
1822 | if (is_gimple_assign (s)) | |
1823 | { | |
1824 | enum tree_code sc = gimple_assign_rhs_code (s); | |
d9659041 | 1825 | return CONVERT_EXPR_CODE_P (sc) |
75a70cf9 | 1826 | || sc == VIEW_CONVERT_EXPR |
1827 | || sc == FIX_TRUNC_EXPR; | |
1828 | } | |
1829 | ||
1830 | return false; | |
1831 | } | |
1832 | ||
1833 | ||
1834 | /* Return true if GS is a GIMPLE_CALL. */ | |
1835 | ||
1836 | static inline bool | |
1837 | is_gimple_call (const_gimple gs) | |
1838 | { | |
1839 | return gimple_code (gs) == GIMPLE_CALL; | |
1840 | } | |
1841 | ||
1842 | /* Return the LHS of call statement GS. */ | |
1843 | ||
1844 | static inline tree | |
1845 | gimple_call_lhs (const_gimple gs) | |
1846 | { | |
1847 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1848 | return gimple_op (gs, 0); | |
1849 | } | |
1850 | ||
1851 | ||
1852 | /* Return a pointer to the LHS of call statement GS. */ | |
1853 | ||
1854 | static inline tree * | |
1855 | gimple_call_lhs_ptr (const_gimple gs) | |
1856 | { | |
1857 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1858 | return gimple_op_ptr (gs, 0); | |
1859 | } | |
1860 | ||
1861 | ||
1862 | /* Set LHS to be the LHS operand of call statement GS. */ | |
1863 | ||
1864 | static inline void | |
1865 | gimple_call_set_lhs (gimple gs, tree lhs) | |
1866 | { | |
1867 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1868 | gcc_assert (!lhs || is_gimple_operand (lhs)); | |
1869 | gimple_set_op (gs, 0, lhs); | |
1870 | if (lhs && TREE_CODE (lhs) == SSA_NAME) | |
1871 | SSA_NAME_DEF_STMT (lhs) = gs; | |
1872 | } | |
1873 | ||
1874 | ||
1875 | /* Return the tree node representing the function called by call | |
0acacf9e | 1876 | statement GS. */ |
75a70cf9 | 1877 | |
1878 | static inline tree | |
1879 | gimple_call_fn (const_gimple gs) | |
1880 | { | |
1881 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1882 | return gimple_op (gs, 1); | |
1883 | } | |
1884 | ||
1885 | ||
1886 | /* Return a pointer to the tree node representing the function called by call | |
1887 | statement GS. */ | |
1888 | ||
1889 | static inline tree * | |
1890 | gimple_call_fn_ptr (const_gimple gs) | |
1891 | { | |
1892 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1893 | return gimple_op_ptr (gs, 1); | |
1894 | } | |
1895 | ||
1896 | ||
1897 | /* Set FN to be the function called by call statement GS. */ | |
1898 | ||
1899 | static inline void | |
1900 | gimple_call_set_fn (gimple gs, tree fn) | |
1901 | { | |
1902 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1903 | gcc_assert (is_gimple_operand (fn)); | |
1904 | gimple_set_op (gs, 1, fn); | |
1905 | } | |
1906 | ||
1907 | ||
0acacf9e | 1908 | /* Set FNDECL to be the function called by call statement GS. */ |
1909 | ||
1910 | static inline void | |
1911 | gimple_call_set_fndecl (gimple gs, tree decl) | |
1912 | { | |
1913 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1914 | gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); | |
1915 | gimple_set_op (gs, 1, build_fold_addr_expr (decl)); | |
1916 | } | |
1917 | ||
1918 | ||
75a70cf9 | 1919 | /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it. |
1920 | Otherwise return NULL. This function is analogous to | |
1921 | get_callee_fndecl in tree land. */ | |
1922 | ||
1923 | static inline tree | |
1924 | gimple_call_fndecl (const_gimple gs) | |
1925 | { | |
0acacf9e | 1926 | tree addr = gimple_call_fn (gs); |
1927 | if (TREE_CODE (addr) == ADDR_EXPR) | |
1928 | { | |
1929 | gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL); | |
1930 | return TREE_OPERAND (addr, 0); | |
1931 | } | |
1932 | return NULL_TREE; | |
75a70cf9 | 1933 | } |
1934 | ||
1935 | ||
1936 | /* Return the type returned by call statement GS. */ | |
1937 | ||
1938 | static inline tree | |
1939 | gimple_call_return_type (const_gimple gs) | |
1940 | { | |
1941 | tree fn = gimple_call_fn (gs); | |
1942 | tree type = TREE_TYPE (fn); | |
1943 | ||
0acacf9e | 1944 | /* See through the pointer. */ |
1945 | gcc_assert (POINTER_TYPE_P (type)); | |
1946 | type = TREE_TYPE (type); | |
75a70cf9 | 1947 | |
1948 | gcc_assert (TREE_CODE (type) == FUNCTION_TYPE | |
1949 | || TREE_CODE (type) == METHOD_TYPE); | |
1950 | ||
1951 | /* The type returned by a FUNCTION_DECL is the type of its | |
1952 | function type. */ | |
1953 | return TREE_TYPE (type); | |
1954 | } | |
1955 | ||
1956 | ||
1957 | /* Return the static chain for call statement GS. */ | |
1958 | ||
1959 | static inline tree | |
1960 | gimple_call_chain (const_gimple gs) | |
1961 | { | |
1962 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1963 | return gimple_op (gs, 2); | |
1964 | } | |
1965 | ||
1966 | ||
1967 | /* Return a pointer to the static chain for call statement GS. */ | |
1968 | ||
1969 | static inline tree * | |
1970 | gimple_call_chain_ptr (const_gimple gs) | |
1971 | { | |
1972 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1973 | return gimple_op_ptr (gs, 2); | |
1974 | } | |
1975 | ||
1976 | /* Set CHAIN to be the static chain for call statement GS. */ | |
1977 | ||
1978 | static inline void | |
1979 | gimple_call_set_chain (gimple gs, tree chain) | |
1980 | { | |
1981 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1982 | gcc_assert (chain == NULL | |
1983 | || TREE_CODE (chain) == ADDR_EXPR | |
0e3bb11d | 1984 | || SSA_VAR_P (chain)); |
75a70cf9 | 1985 | gimple_set_op (gs, 2, chain); |
1986 | } | |
1987 | ||
1988 | ||
1989 | /* Return the number of arguments used by call statement GS. */ | |
1990 | ||
1991 | static inline unsigned | |
1992 | gimple_call_num_args (const_gimple gs) | |
1993 | { | |
1994 | unsigned num_ops; | |
1995 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
1996 | num_ops = gimple_num_ops (gs); | |
1997 | gcc_assert (num_ops >= 3); | |
1998 | return num_ops - 3; | |
1999 | } | |
2000 | ||
2001 | ||
2002 | /* Return the argument at position INDEX for call statement GS. */ | |
2003 | ||
2004 | static inline tree | |
2005 | gimple_call_arg (const_gimple gs, unsigned index) | |
2006 | { | |
2007 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2008 | return gimple_op (gs, index + 3); | |
2009 | } | |
2010 | ||
2011 | ||
2012 | /* Return a pointer to the argument at position INDEX for call | |
2013 | statement GS. */ | |
2014 | ||
2015 | static inline tree * | |
2016 | gimple_call_arg_ptr (const_gimple gs, unsigned index) | |
2017 | { | |
2018 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2019 | return gimple_op_ptr (gs, index + 3); | |
2020 | } | |
2021 | ||
2022 | ||
2023 | /* Set ARG to be the argument at position INDEX for call statement GS. */ | |
2024 | ||
2025 | static inline void | |
2026 | gimple_call_set_arg (gimple gs, unsigned index, tree arg) | |
2027 | { | |
2028 | GIMPLE_CHECK (gs, GIMPLE_CALL); | |
2029 | gcc_assert (is_gimple_operand (arg)); | |
2030 | gimple_set_op (gs, index + 3, arg); | |
2031 | } | |
2032 | ||
2033 | ||
2034 | /* If TAIL_P is true, mark call statement S as being a tail call | |
2035 | (i.e., a call just before the exit of a function). These calls are | |
2036 | candidate for tail call optimization. */ | |
2037 | ||
2038 | static inline void | |
2039 | gimple_call_set_tail (gimple s, bool tail_p) | |
2040 | { | |
2041 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2042 | if (tail_p) | |
2043 | s->gsbase.subcode |= GF_CALL_TAILCALL; | |
2044 | else | |
2045 | s->gsbase.subcode &= ~GF_CALL_TAILCALL; | |
2046 | } | |
2047 | ||
2048 | ||
2049 | /* Return true if GIMPLE_CALL S is marked as a tail call. */ | |
2050 | ||
2051 | static inline bool | |
2052 | gimple_call_tail_p (gimple s) | |
2053 | { | |
2054 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2055 | return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0; | |
2056 | } | |
2057 | ||
2058 | ||
2059 | /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */ | |
2060 | ||
2061 | static inline void | |
2062 | gimple_call_set_cannot_inline (gimple s, bool inlinable_p) | |
2063 | { | |
2064 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2065 | if (inlinable_p) | |
2066 | s->gsbase.subcode |= GF_CALL_CANNOT_INLINE; | |
2067 | else | |
2068 | s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE; | |
2069 | } | |
2070 | ||
2071 | ||
2072 | /* Return true if GIMPLE_CALL S cannot be inlined. */ | |
2073 | ||
2074 | static inline bool | |
2075 | gimple_call_cannot_inline_p (gimple s) | |
2076 | { | |
2077 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2078 | return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0; | |
2079 | } | |
2080 | ||
2081 | ||
2082 | /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return | |
2083 | slot optimization. This transformation uses the target of the call | |
2084 | expansion as the return slot for calls that return in memory. */ | |
2085 | ||
2086 | static inline void | |
2087 | gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p) | |
2088 | { | |
2089 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2090 | if (return_slot_opt_p) | |
2091 | s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT; | |
2092 | else | |
2093 | s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT; | |
2094 | } | |
2095 | ||
2096 | ||
2097 | /* Return true if S is marked for return slot optimization. */ | |
2098 | ||
2099 | static inline bool | |
2100 | gimple_call_return_slot_opt_p (gimple s) | |
2101 | { | |
2102 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2103 | return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0; | |
2104 | } | |
2105 | ||
2106 | ||
2107 | /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a | |
2108 | thunk to the thunked-to function. */ | |
2109 | ||
2110 | static inline void | |
2111 | gimple_call_set_from_thunk (gimple s, bool from_thunk_p) | |
2112 | { | |
2113 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2114 | if (from_thunk_p) | |
2115 | s->gsbase.subcode |= GF_CALL_FROM_THUNK; | |
2116 | else | |
2117 | s->gsbase.subcode &= ~GF_CALL_FROM_THUNK; | |
2118 | } | |
2119 | ||
2120 | ||
2121 | /* Return true if GIMPLE_CALL S is a jump from a thunk. */ | |
2122 | ||
2123 | static inline bool | |
2124 | gimple_call_from_thunk_p (gimple s) | |
2125 | { | |
2126 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2127 | return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0; | |
2128 | } | |
2129 | ||
2130 | ||
2131 | /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the | |
2132 | argument pack in its argument list. */ | |
2133 | ||
2134 | static inline void | |
2135 | gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p) | |
2136 | { | |
2137 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2138 | if (pass_arg_pack_p) | |
2139 | s->gsbase.subcode |= GF_CALL_VA_ARG_PACK; | |
2140 | else | |
2141 | s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK; | |
2142 | } | |
2143 | ||
2144 | ||
2145 | /* Return true if GIMPLE_CALL S is a stdarg call that needs the | |
2146 | argument pack in its argument list. */ | |
2147 | ||
2148 | static inline bool | |
2149 | gimple_call_va_arg_pack_p (gimple s) | |
2150 | { | |
2151 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2152 | return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0; | |
2153 | } | |
2154 | ||
2155 | ||
2156 | /* Return true if S is a noreturn call. */ | |
2157 | ||
2158 | static inline bool | |
2159 | gimple_call_noreturn_p (gimple s) | |
2160 | { | |
2161 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2162 | return (gimple_call_flags (s) & ECF_NORETURN) != 0; | |
2163 | } | |
2164 | ||
2165 | ||
2166 | /* Return true if S is a nothrow call. */ | |
2167 | ||
2168 | static inline bool | |
2169 | gimple_call_nothrow_p (gimple s) | |
2170 | { | |
2171 | GIMPLE_CHECK (s, GIMPLE_CALL); | |
2172 | return (gimple_call_flags (s) & ECF_NOTHROW) != 0; | |
2173 | } | |
2174 | ||
2175 | ||
2176 | /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */ | |
2177 | ||
2178 | static inline void | |
2179 | gimple_call_copy_flags (gimple dest_call, gimple orig_call) | |
2180 | { | |
2181 | GIMPLE_CHECK (dest_call, GIMPLE_CALL); | |
2182 | GIMPLE_CHECK (orig_call, GIMPLE_CALL); | |
2183 | dest_call->gsbase.subcode = orig_call->gsbase.subcode; | |
2184 | } | |
2185 | ||
2186 | ||
2187 | /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a | |
2188 | non-NULL lhs. */ | |
2189 | ||
2190 | static inline bool | |
2191 | gimple_has_lhs (gimple stmt) | |
2192 | { | |
2193 | return (is_gimple_assign (stmt) | |
2194 | || (is_gimple_call (stmt) | |
2195 | && gimple_call_lhs (stmt) != NULL_TREE)); | |
2196 | } | |
2197 | ||
2198 | ||
2199 | /* Return the code of the predicate computed by conditional statement GS. */ | |
2200 | ||
2201 | static inline enum tree_code | |
2202 | gimple_cond_code (const_gimple gs) | |
2203 | { | |
2204 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
bc620c5c | 2205 | return (enum tree_code) gs->gsbase.subcode; |
75a70cf9 | 2206 | } |
2207 | ||
2208 | ||
2209 | /* Set CODE to be the predicate code for the conditional statement GS. */ | |
2210 | ||
2211 | static inline void | |
2212 | gimple_cond_set_code (gimple gs, enum tree_code code) | |
2213 | { | |
2214 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2215 | gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison); | |
2216 | gs->gsbase.subcode = code; | |
2217 | } | |
2218 | ||
2219 | ||
2220 | /* Return the LHS of the predicate computed by conditional statement GS. */ | |
2221 | ||
2222 | static inline tree | |
2223 | gimple_cond_lhs (const_gimple gs) | |
2224 | { | |
2225 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2226 | return gimple_op (gs, 0); | |
2227 | } | |
2228 | ||
2229 | /* Return the pointer to the LHS of the predicate computed by conditional | |
2230 | statement GS. */ | |
2231 | ||
2232 | static inline tree * | |
2233 | gimple_cond_lhs_ptr (const_gimple gs) | |
2234 | { | |
2235 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2236 | return gimple_op_ptr (gs, 0); | |
2237 | } | |
2238 | ||
2239 | /* Set LHS to be the LHS operand of the predicate computed by | |
2240 | conditional statement GS. */ | |
2241 | ||
2242 | static inline void | |
2243 | gimple_cond_set_lhs (gimple gs, tree lhs) | |
2244 | { | |
2245 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2246 | gcc_assert (is_gimple_operand (lhs)); | |
2247 | gimple_set_op (gs, 0, lhs); | |
2248 | } | |
2249 | ||
2250 | ||
2251 | /* Return the RHS operand of the predicate computed by conditional GS. */ | |
2252 | ||
2253 | static inline tree | |
2254 | gimple_cond_rhs (const_gimple gs) | |
2255 | { | |
2256 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2257 | return gimple_op (gs, 1); | |
2258 | } | |
2259 | ||
2260 | /* Return the pointer to the RHS operand of the predicate computed by | |
2261 | conditional GS. */ | |
2262 | ||
2263 | static inline tree * | |
2264 | gimple_cond_rhs_ptr (const_gimple gs) | |
2265 | { | |
2266 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2267 | return gimple_op_ptr (gs, 1); | |
2268 | } | |
2269 | ||
2270 | ||
2271 | /* Set RHS to be the RHS operand of the predicate computed by | |
2272 | conditional statement GS. */ | |
2273 | ||
2274 | static inline void | |
2275 | gimple_cond_set_rhs (gimple gs, tree rhs) | |
2276 | { | |
2277 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2278 | gcc_assert (is_gimple_operand (rhs)); | |
2279 | gimple_set_op (gs, 1, rhs); | |
2280 | } | |
2281 | ||
2282 | ||
2283 | /* Return the label used by conditional statement GS when its | |
2284 | predicate evaluates to true. */ | |
2285 | ||
2286 | static inline tree | |
2287 | gimple_cond_true_label (const_gimple gs) | |
2288 | { | |
2289 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2290 | return gimple_op (gs, 2); | |
2291 | } | |
2292 | ||
2293 | ||
2294 | /* Set LABEL to be the label used by conditional statement GS when its | |
2295 | predicate evaluates to true. */ | |
2296 | ||
2297 | static inline void | |
2298 | gimple_cond_set_true_label (gimple gs, tree label) | |
2299 | { | |
2300 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2301 | gcc_assert (!label || TREE_CODE (label) == LABEL_DECL); | |
2302 | gimple_set_op (gs, 2, label); | |
2303 | } | |
2304 | ||
2305 | ||
2306 | /* Set LABEL to be the label used by conditional statement GS when its | |
2307 | predicate evaluates to false. */ | |
2308 | ||
2309 | static inline void | |
2310 | gimple_cond_set_false_label (gimple gs, tree label) | |
2311 | { | |
2312 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2313 | gcc_assert (!label || TREE_CODE (label) == LABEL_DECL); | |
2314 | gimple_set_op (gs, 3, label); | |
2315 | } | |
2316 | ||
2317 | ||
2318 | /* Return the label used by conditional statement GS when its | |
2319 | predicate evaluates to false. */ | |
2320 | ||
2321 | static inline tree | |
2322 | gimple_cond_false_label (const_gimple gs) | |
2323 | { | |
2324 | GIMPLE_CHECK (gs, GIMPLE_COND); | |
2325 | return gimple_op (gs, 3); | |
2326 | } | |
2327 | ||
2328 | ||
2329 | /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */ | |
2330 | ||
2331 | static inline void | |
2332 | gimple_cond_make_false (gimple gs) | |
2333 | { | |
2334 | gimple_cond_set_lhs (gs, boolean_true_node); | |
2335 | gimple_cond_set_rhs (gs, boolean_false_node); | |
2336 | gs->gsbase.subcode = EQ_EXPR; | |
2337 | } | |
2338 | ||
2339 | ||
2340 | /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */ | |
2341 | ||
2342 | static inline void | |
2343 | gimple_cond_make_true (gimple gs) | |
2344 | { | |
2345 | gimple_cond_set_lhs (gs, boolean_true_node); | |
2346 | gimple_cond_set_rhs (gs, boolean_true_node); | |
2347 | gs->gsbase.subcode = EQ_EXPR; | |
2348 | } | |
2349 | ||
2350 | /* Check if conditional statemente GS is of the form 'if (1 == 1)', | |
2351 | 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */ | |
2352 | ||
2353 | static inline bool | |
2354 | gimple_cond_true_p (const_gimple gs) | |
2355 | { | |
2356 | tree lhs = gimple_cond_lhs (gs); | |
2357 | tree rhs = gimple_cond_rhs (gs); | |
2358 | enum tree_code code = gimple_cond_code (gs); | |
2359 | ||
2360 | if (lhs != boolean_true_node && lhs != boolean_false_node) | |
2361 | return false; | |
2362 | ||
2363 | if (rhs != boolean_true_node && rhs != boolean_false_node) | |
2364 | return false; | |
2365 | ||
2366 | if (code == NE_EXPR && lhs != rhs) | |
2367 | return true; | |
2368 | ||
2369 | if (code == EQ_EXPR && lhs == rhs) | |
2370 | return true; | |
2371 | ||
2372 | return false; | |
2373 | } | |
2374 | ||
2375 | /* Check if conditional statement GS is of the form 'if (1 != 1)', | |
2376 | 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */ | |
2377 | ||
2378 | static inline bool | |
2379 | gimple_cond_false_p (const_gimple gs) | |
2380 | { | |
2381 | tree lhs = gimple_cond_lhs (gs); | |
2382 | tree rhs = gimple_cond_rhs (gs); | |
2383 | enum tree_code code = gimple_cond_code (gs); | |
2384 | ||
2385 | if (lhs != boolean_true_node && lhs != boolean_false_node) | |
2386 | return false; | |
2387 | ||
2388 | if (rhs != boolean_true_node && rhs != boolean_false_node) | |
2389 | return false; | |
2390 | ||
2391 | if (code == NE_EXPR && lhs == rhs) | |
2392 | return true; | |
2393 | ||
2394 | if (code == EQ_EXPR && lhs != rhs) | |
2395 | return true; | |
2396 | ||
2397 | return false; | |
2398 | } | |
2399 | ||
2400 | /* Check if conditional statement GS is of the form 'if (var != 0)' or | |
2401 | 'if (var == 1)' */ | |
2402 | ||
2403 | static inline bool | |
2404 | gimple_cond_single_var_p (gimple gs) | |
2405 | { | |
2406 | if (gimple_cond_code (gs) == NE_EXPR | |
2407 | && gimple_cond_rhs (gs) == boolean_false_node) | |
2408 | return true; | |
2409 | ||
2410 | if (gimple_cond_code (gs) == EQ_EXPR | |
2411 | && gimple_cond_rhs (gs) == boolean_true_node) | |
2412 | return true; | |
2413 | ||
2414 | return false; | |
2415 | } | |
2416 | ||
2417 | /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */ | |
2418 | ||
2419 | static inline void | |
2420 | gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs) | |
2421 | { | |
2422 | gimple_cond_set_code (stmt, code); | |
2423 | gimple_cond_set_lhs (stmt, lhs); | |
2424 | gimple_cond_set_rhs (stmt, rhs); | |
2425 | } | |
2426 | ||
2427 | /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */ | |
2428 | ||
2429 | static inline tree | |
2430 | gimple_label_label (const_gimple gs) | |
2431 | { | |
2432 | GIMPLE_CHECK (gs, GIMPLE_LABEL); | |
2433 | return gimple_op (gs, 0); | |
2434 | } | |
2435 | ||
2436 | ||
2437 | /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement | |
2438 | GS. */ | |
2439 | ||
2440 | static inline void | |
2441 | gimple_label_set_label (gimple gs, tree label) | |
2442 | { | |
2443 | GIMPLE_CHECK (gs, GIMPLE_LABEL); | |
2444 | gcc_assert (TREE_CODE (label) == LABEL_DECL); | |
2445 | gimple_set_op (gs, 0, label); | |
2446 | } | |
2447 | ||
2448 | ||
2449 | /* Return the destination of the unconditional jump GS. */ | |
2450 | ||
2451 | static inline tree | |
2452 | gimple_goto_dest (const_gimple gs) | |
2453 | { | |
2454 | GIMPLE_CHECK (gs, GIMPLE_GOTO); | |
2455 | return gimple_op (gs, 0); | |
2456 | } | |
2457 | ||
2458 | ||
2459 | /* Set DEST to be the destination of the unconditonal jump GS. */ | |
2460 | ||
2461 | static inline void | |
2462 | gimple_goto_set_dest (gimple gs, tree dest) | |
2463 | { | |
2464 | GIMPLE_CHECK (gs, GIMPLE_GOTO); | |
2465 | gcc_assert (is_gimple_operand (dest)); | |
2466 | gimple_set_op (gs, 0, dest); | |
2467 | } | |
2468 | ||
2469 | ||
2470 | /* Return the variables declared in the GIMPLE_BIND statement GS. */ | |
2471 | ||
2472 | static inline tree | |
2473 | gimple_bind_vars (const_gimple gs) | |
2474 | { | |
2475 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2476 | return gs->gimple_bind.vars; | |
2477 | } | |
2478 | ||
2479 | ||
2480 | /* Set VARS to be the set of variables declared in the GIMPLE_BIND | |
2481 | statement GS. */ | |
2482 | ||
2483 | static inline void | |
2484 | gimple_bind_set_vars (gimple gs, tree vars) | |
2485 | { | |
2486 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2487 | gs->gimple_bind.vars = vars; | |
2488 | } | |
2489 | ||
2490 | ||
2491 | /* Append VARS to the set of variables declared in the GIMPLE_BIND | |
2492 | statement GS. */ | |
2493 | ||
2494 | static inline void | |
2495 | gimple_bind_append_vars (gimple gs, tree vars) | |
2496 | { | |
2497 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2498 | gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars); | |
2499 | } | |
2500 | ||
2501 | ||
2502 | /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */ | |
2503 | ||
2504 | static inline gimple_seq | |
2505 | gimple_bind_body (gimple gs) | |
2506 | { | |
2507 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2508 | return gs->gimple_bind.body; | |
2509 | } | |
2510 | ||
2511 | ||
2512 | /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND | |
2513 | statement GS. */ | |
2514 | ||
2515 | static inline void | |
2516 | gimple_bind_set_body (gimple gs, gimple_seq seq) | |
2517 | { | |
2518 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2519 | gs->gimple_bind.body = seq; | |
2520 | } | |
2521 | ||
2522 | ||
2523 | /* Append a statement to the end of a GIMPLE_BIND's body. */ | |
2524 | ||
2525 | static inline void | |
2526 | gimple_bind_add_stmt (gimple gs, gimple stmt) | |
2527 | { | |
2528 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2529 | gimple_seq_add_stmt (&gs->gimple_bind.body, stmt); | |
2530 | } | |
2531 | ||
2532 | ||
2533 | /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */ | |
2534 | ||
2535 | static inline void | |
2536 | gimple_bind_add_seq (gimple gs, gimple_seq seq) | |
2537 | { | |
2538 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2539 | gimple_seq_add_seq (&gs->gimple_bind.body, seq); | |
2540 | } | |
2541 | ||
2542 | ||
2543 | /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement | |
2544 | GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */ | |
2545 | ||
2546 | static inline tree | |
2547 | gimple_bind_block (const_gimple gs) | |
2548 | { | |
2549 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
2550 | return gs->gimple_bind.block; | |
2551 | } | |
2552 | ||
2553 | ||
2554 | /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND | |
2555 | statement GS. */ | |
2556 | ||
2557 | static inline void | |
2558 | gimple_bind_set_block (gimple gs, tree block) | |
2559 | { | |
2560 | GIMPLE_CHECK (gs, GIMPLE_BIND); | |
1597c73a | 2561 | gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK); |
75a70cf9 | 2562 | gs->gimple_bind.block = block; |
2563 | } | |
2564 | ||
2565 | ||
2566 | /* Return the number of input operands for GIMPLE_ASM GS. */ | |
2567 | ||
2568 | static inline unsigned | |
2569 | gimple_asm_ninputs (const_gimple gs) | |
2570 | { | |
2571 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2572 | return gs->gimple_asm.ni; | |
2573 | } | |
2574 | ||
2575 | ||
2576 | /* Return the number of output operands for GIMPLE_ASM GS. */ | |
2577 | ||
2578 | static inline unsigned | |
2579 | gimple_asm_noutputs (const_gimple gs) | |
2580 | { | |
2581 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2582 | return gs->gimple_asm.no; | |
2583 | } | |
2584 | ||
2585 | ||
2586 | /* Return the number of clobber operands for GIMPLE_ASM GS. */ | |
2587 | ||
2588 | static inline unsigned | |
2589 | gimple_asm_nclobbers (const_gimple gs) | |
2590 | { | |
2591 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2592 | return gs->gimple_asm.nc; | |
2593 | } | |
2594 | ||
2595 | ||
2596 | /* Return input operand INDEX of GIMPLE_ASM GS. */ | |
2597 | ||
2598 | static inline tree | |
2599 | gimple_asm_input_op (const_gimple gs, unsigned index) | |
2600 | { | |
2601 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2602 | gcc_assert (index <= gs->gimple_asm.ni); | |
2603 | return gimple_op (gs, index); | |
2604 | } | |
2605 | ||
2606 | /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */ | |
2607 | ||
2608 | static inline tree * | |
2609 | gimple_asm_input_op_ptr (const_gimple gs, unsigned index) | |
2610 | { | |
2611 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2612 | gcc_assert (index <= gs->gimple_asm.ni); | |
2613 | return gimple_op_ptr (gs, index); | |
2614 | } | |
2615 | ||
2616 | ||
2617 | /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */ | |
2618 | ||
2619 | static inline void | |
2620 | gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op) | |
2621 | { | |
2622 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2623 | gcc_assert (index <= gs->gimple_asm.ni); | |
2624 | gcc_assert (TREE_CODE (in_op) == TREE_LIST); | |
2625 | gimple_set_op (gs, index, in_op); | |
2626 | } | |
2627 | ||
2628 | ||
2629 | /* Return output operand INDEX of GIMPLE_ASM GS. */ | |
2630 | ||
2631 | static inline tree | |
2632 | gimple_asm_output_op (const_gimple gs, unsigned index) | |
2633 | { | |
2634 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2635 | gcc_assert (index <= gs->gimple_asm.no); | |
2636 | return gimple_op (gs, index + gs->gimple_asm.ni); | |
2637 | } | |
2638 | ||
2639 | /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */ | |
2640 | ||
2641 | static inline tree * | |
2642 | gimple_asm_output_op_ptr (const_gimple gs, unsigned index) | |
2643 | { | |
2644 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2645 | gcc_assert (index <= gs->gimple_asm.no); | |
2646 | return gimple_op_ptr (gs, index + gs->gimple_asm.ni); | |
2647 | } | |
2648 | ||
2649 | ||
2650 | /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */ | |
2651 | ||
2652 | static inline void | |
2653 | gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op) | |
2654 | { | |
2655 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2656 | gcc_assert (index <= gs->gimple_asm.no); | |
2657 | gcc_assert (TREE_CODE (out_op) == TREE_LIST); | |
2658 | gimple_set_op (gs, index + gs->gimple_asm.ni, out_op); | |
2659 | } | |
2660 | ||
2661 | ||
2662 | /* Return clobber operand INDEX of GIMPLE_ASM GS. */ | |
2663 | ||
2664 | static inline tree | |
2665 | gimple_asm_clobber_op (const_gimple gs, unsigned index) | |
2666 | { | |
2667 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2668 | gcc_assert (index <= gs->gimple_asm.nc); | |
2669 | return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no); | |
2670 | } | |
2671 | ||
2672 | ||
2673 | /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */ | |
2674 | ||
2675 | static inline void | |
2676 | gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op) | |
2677 | { | |
2678 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2679 | gcc_assert (index <= gs->gimple_asm.nc); | |
2680 | gcc_assert (TREE_CODE (clobber_op) == TREE_LIST); | |
2681 | gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op); | |
2682 | } | |
2683 | ||
2684 | ||
2685 | /* Return the string representing the assembly instruction in | |
2686 | GIMPLE_ASM GS. */ | |
2687 | ||
2688 | static inline const char * | |
2689 | gimple_asm_string (const_gimple gs) | |
2690 | { | |
2691 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2692 | return gs->gimple_asm.string; | |
2693 | } | |
2694 | ||
2695 | ||
2696 | /* Return true if GS is an asm statement marked volatile. */ | |
2697 | ||
2698 | static inline bool | |
2699 | gimple_asm_volatile_p (const_gimple gs) | |
2700 | { | |
2701 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2702 | return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0; | |
2703 | } | |
2704 | ||
2705 | ||
2706 | /* If VOLATLE_P is true, mark asm statement GS as volatile. */ | |
2707 | ||
2708 | static inline void | |
2709 | gimple_asm_set_volatile (gimple gs, bool volatile_p) | |
2710 | { | |
2711 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2712 | if (volatile_p) | |
2713 | gs->gsbase.subcode |= GF_ASM_VOLATILE; | |
2714 | else | |
2715 | gs->gsbase.subcode &= ~GF_ASM_VOLATILE; | |
2716 | } | |
2717 | ||
2718 | ||
2719 | /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */ | |
2720 | ||
2721 | static inline void | |
2722 | gimple_asm_set_input (gimple gs, bool input_p) | |
2723 | { | |
2724 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2725 | if (input_p) | |
2726 | gs->gsbase.subcode |= GF_ASM_INPUT; | |
2727 | else | |
2728 | gs->gsbase.subcode &= ~GF_ASM_INPUT; | |
2729 | } | |
2730 | ||
2731 | ||
2732 | /* Return true if asm GS is an ASM_INPUT. */ | |
2733 | ||
2734 | static inline bool | |
2735 | gimple_asm_input_p (const_gimple gs) | |
2736 | { | |
2737 | GIMPLE_CHECK (gs, GIMPLE_ASM); | |
2738 | return (gs->gsbase.subcode & GF_ASM_INPUT) != 0; | |
2739 | } | |
2740 | ||
2741 | ||
2742 | /* Return the types handled by GIMPLE_CATCH statement GS. */ | |
2743 | ||
2744 | static inline tree | |
2745 | gimple_catch_types (const_gimple gs) | |
2746 | { | |
2747 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
2748 | return gs->gimple_catch.types; | |
2749 | } | |
2750 | ||
2751 | ||
2752 | /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */ | |
2753 | ||
2754 | static inline tree * | |
2755 | gimple_catch_types_ptr (gimple gs) | |
2756 | { | |
2757 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
2758 | return &gs->gimple_catch.types; | |
2759 | } | |
2760 | ||
2761 | ||
2762 | /* Return the GIMPLE sequence representing the body of the handler of | |
2763 | GIMPLE_CATCH statement GS. */ | |
2764 | ||
2765 | static inline gimple_seq | |
2766 | gimple_catch_handler (gimple gs) | |
2767 | { | |
2768 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
2769 | return gs->gimple_catch.handler; | |
2770 | } | |
2771 | ||
2772 | ||
2773 | /* Return a pointer to the GIMPLE sequence representing the body of | |
2774 | the handler of GIMPLE_CATCH statement GS. */ | |
2775 | ||
2776 | static inline gimple_seq * | |
2777 | gimple_catch_handler_ptr (gimple gs) | |
2778 | { | |
2779 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
2780 | return &gs->gimple_catch.handler; | |
2781 | } | |
2782 | ||
2783 | ||
2784 | /* Set T to be the set of types handled by GIMPLE_CATCH GS. */ | |
2785 | ||
2786 | static inline void | |
2787 | gimple_catch_set_types (gimple gs, tree t) | |
2788 | { | |
2789 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
2790 | gs->gimple_catch.types = t; | |
2791 | } | |
2792 | ||
2793 | ||
2794 | /* Set HANDLER to be the body of GIMPLE_CATCH GS. */ | |
2795 | ||
2796 | static inline void | |
2797 | gimple_catch_set_handler (gimple gs, gimple_seq handler) | |
2798 | { | |
2799 | GIMPLE_CHECK (gs, GIMPLE_CATCH); | |
2800 | gs->gimple_catch.handler = handler; | |
2801 | } | |
2802 | ||
2803 | ||
2804 | /* Return the types handled by GIMPLE_EH_FILTER statement GS. */ | |
2805 | ||
2806 | static inline tree | |
2807 | gimple_eh_filter_types (const_gimple gs) | |
2808 | { | |
2809 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2810 | return gs->gimple_eh_filter.types; | |
2811 | } | |
2812 | ||
2813 | ||
2814 | /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement | |
2815 | GS. */ | |
2816 | ||
2817 | static inline tree * | |
2818 | gimple_eh_filter_types_ptr (gimple gs) | |
2819 | { | |
2820 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2821 | return &gs->gimple_eh_filter.types; | |
2822 | } | |
2823 | ||
2824 | ||
2825 | /* Return the sequence of statement to execute when GIMPLE_EH_FILTER | |
2826 | statement fails. */ | |
2827 | ||
2828 | static inline gimple_seq | |
2829 | gimple_eh_filter_failure (gimple gs) | |
2830 | { | |
2831 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2832 | return gs->gimple_eh_filter.failure; | |
2833 | } | |
2834 | ||
2835 | ||
2836 | /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */ | |
2837 | ||
2838 | static inline void | |
2839 | gimple_eh_filter_set_types (gimple gs, tree types) | |
2840 | { | |
2841 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2842 | gs->gimple_eh_filter.types = types; | |
2843 | } | |
2844 | ||
2845 | ||
2846 | /* Set FAILURE to be the sequence of statements to execute on failure | |
2847 | for GIMPLE_EH_FILTER GS. */ | |
2848 | ||
2849 | static inline void | |
2850 | gimple_eh_filter_set_failure (gimple gs, gimple_seq failure) | |
2851 | { | |
2852 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2853 | gs->gimple_eh_filter.failure = failure; | |
2854 | } | |
2855 | ||
2856 | /* Return the EH_FILTER_MUST_NOT_THROW flag. */ | |
2857 | ||
2858 | static inline bool | |
2859 | ||
2860 | gimple_eh_filter_must_not_throw (gimple gs) | |
2861 | { | |
2862 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2863 | return gs->gsbase.subcode != 0; | |
2864 | } | |
2865 | ||
2866 | /* Set the EH_FILTER_MUST_NOT_THROW flag to the value MNTP. */ | |
2867 | ||
2868 | static inline void | |
2869 | gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp) | |
2870 | { | |
2871 | GIMPLE_CHECK (gs, GIMPLE_EH_FILTER); | |
2872 | gs->gsbase.subcode = (unsigned int) mntp; | |
2873 | } | |
2874 | ||
2875 | ||
2876 | /* GIMPLE_TRY accessors. */ | |
2877 | ||
2878 | /* Return the kind of try block represented by GIMPLE_TRY GS. This is | |
2879 | either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */ | |
2880 | ||
2881 | static inline enum gimple_try_flags | |
2882 | gimple_try_kind (const_gimple gs) | |
2883 | { | |
2884 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2885 | return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND); | |
2886 | } | |
2887 | ||
2888 | ||
2889 | /* Set the kind of try block represented by GIMPLE_TRY GS. */ | |
2890 | ||
2891 | static inline void | |
2892 | gimple_try_set_kind (gimple gs, enum gimple_try_flags kind) | |
2893 | { | |
2894 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2895 | gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY); | |
2896 | if (gimple_try_kind (gs) != kind) | |
2897 | gs->gsbase.subcode = (unsigned int) kind; | |
2898 | } | |
2899 | ||
2900 | ||
2901 | /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ | |
2902 | ||
2903 | static inline bool | |
2904 | gimple_try_catch_is_cleanup (const_gimple gs) | |
2905 | { | |
2906 | gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH); | |
2907 | return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0; | |
2908 | } | |
2909 | ||
2910 | ||
2911 | /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */ | |
2912 | ||
2913 | static inline gimple_seq | |
2914 | gimple_try_eval (gimple gs) | |
2915 | { | |
2916 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2917 | return gs->gimple_try.eval; | |
2918 | } | |
2919 | ||
2920 | ||
2921 | /* Return the sequence of statements used as the cleanup body for | |
2922 | GIMPLE_TRY GS. */ | |
2923 | ||
2924 | static inline gimple_seq | |
2925 | gimple_try_cleanup (gimple gs) | |
2926 | { | |
2927 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2928 | return gs->gimple_try.cleanup; | |
2929 | } | |
2930 | ||
2931 | ||
2932 | /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */ | |
2933 | ||
2934 | static inline void | |
2935 | gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup) | |
2936 | { | |
2937 | gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH); | |
2938 | if (catch_is_cleanup) | |
2939 | g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP; | |
2940 | else | |
2941 | g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP; | |
2942 | } | |
2943 | ||
2944 | ||
2945 | /* Set EVAL to be the sequence of statements to use as the body for | |
2946 | GIMPLE_TRY GS. */ | |
2947 | ||
2948 | static inline void | |
2949 | gimple_try_set_eval (gimple gs, gimple_seq eval) | |
2950 | { | |
2951 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2952 | gs->gimple_try.eval = eval; | |
2953 | } | |
2954 | ||
2955 | ||
2956 | /* Set CLEANUP to be the sequence of statements to use as the cleanup | |
2957 | body for GIMPLE_TRY GS. */ | |
2958 | ||
2959 | static inline void | |
2960 | gimple_try_set_cleanup (gimple gs, gimple_seq cleanup) | |
2961 | { | |
2962 | GIMPLE_CHECK (gs, GIMPLE_TRY); | |
2963 | gs->gimple_try.cleanup = cleanup; | |
2964 | } | |
2965 | ||
2966 | ||
2967 | /* Return the cleanup sequence for cleanup statement GS. */ | |
2968 | ||
2969 | static inline gimple_seq | |
2970 | gimple_wce_cleanup (gimple gs) | |
2971 | { | |
2972 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
2973 | return gs->gimple_wce.cleanup; | |
2974 | } | |
2975 | ||
2976 | ||
2977 | /* Set CLEANUP to be the cleanup sequence for GS. */ | |
2978 | ||
2979 | static inline void | |
2980 | gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup) | |
2981 | { | |
2982 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
2983 | gs->gimple_wce.cleanup = cleanup; | |
2984 | } | |
2985 | ||
2986 | ||
2987 | /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */ | |
2988 | ||
2989 | static inline bool | |
2990 | gimple_wce_cleanup_eh_only (const_gimple gs) | |
2991 | { | |
2992 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
2993 | return gs->gsbase.subcode != 0; | |
2994 | } | |
2995 | ||
2996 | ||
2997 | /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */ | |
2998 | ||
2999 | static inline void | |
3000 | gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p) | |
3001 | { | |
3002 | GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR); | |
3003 | gs->gsbase.subcode = (unsigned int) eh_only_p; | |
3004 | } | |
3005 | ||
3006 | ||
3007 | /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */ | |
3008 | ||
3009 | static inline unsigned | |
3010 | gimple_phi_capacity (const_gimple gs) | |
3011 | { | |
3012 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3013 | return gs->gimple_phi.capacity; | |
3014 | } | |
3015 | ||
3016 | ||
3017 | /* Return the number of arguments in GIMPLE_PHI GS. This must always | |
3018 | be exactly the number of incoming edges for the basic block holding | |
3019 | GS. */ | |
3020 | ||
3021 | static inline unsigned | |
3022 | gimple_phi_num_args (const_gimple gs) | |
3023 | { | |
3024 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3025 | return gs->gimple_phi.nargs; | |
3026 | } | |
3027 | ||
3028 | ||
3029 | /* Return the SSA name created by GIMPLE_PHI GS. */ | |
3030 | ||
3031 | static inline tree | |
3032 | gimple_phi_result (const_gimple gs) | |
3033 | { | |
3034 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3035 | return gs->gimple_phi.result; | |
3036 | } | |
3037 | ||
3038 | /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */ | |
3039 | ||
3040 | static inline tree * | |
3041 | gimple_phi_result_ptr (gimple gs) | |
3042 | { | |
3043 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3044 | return &gs->gimple_phi.result; | |
3045 | } | |
3046 | ||
3047 | /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */ | |
3048 | ||
3049 | static inline void | |
3050 | gimple_phi_set_result (gimple gs, tree result) | |
3051 | { | |
3052 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3053 | gs->gimple_phi.result = result; | |
3054 | } | |
3055 | ||
3056 | ||
3057 | /* Return the PHI argument corresponding to incoming edge INDEX for | |
3058 | GIMPLE_PHI GS. */ | |
3059 | ||
3060 | static inline struct phi_arg_d * | |
3061 | gimple_phi_arg (gimple gs, unsigned index) | |
3062 | { | |
3063 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3064 | gcc_assert (index <= gs->gimple_phi.capacity); | |
3065 | return &(gs->gimple_phi.args[index]); | |
3066 | } | |
3067 | ||
3068 | /* Set PHIARG to be the argument corresponding to incoming edge INDEX | |
3069 | for GIMPLE_PHI GS. */ | |
3070 | ||
3071 | static inline void | |
3072 | gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg) | |
3073 | { | |
3074 | GIMPLE_CHECK (gs, GIMPLE_PHI); | |
3075 | gcc_assert (index <= gs->gimple_phi.nargs); | |
3076 | memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d)); | |
3077 | } | |
3078 | ||
3079 | /* Return the region number for GIMPLE_RESX GS. */ | |
3080 | ||
3081 | static inline int | |
3082 | gimple_resx_region (const_gimple gs) | |
3083 | { | |
3084 | GIMPLE_CHECK (gs, GIMPLE_RESX); | |
3085 | return gs->gimple_resx.region; | |
3086 | } | |
3087 | ||
3088 | /* Set REGION to be the region number for GIMPLE_RESX GS. */ | |
3089 | ||
3090 | static inline void | |
3091 | gimple_resx_set_region (gimple gs, int region) | |
3092 | { | |
3093 | GIMPLE_CHECK (gs, GIMPLE_RESX); | |
3094 | gs->gimple_resx.region = region; | |
3095 | } | |
3096 | ||
3097 | ||
3098 | /* Return the number of labels associated with the switch statement GS. */ | |
3099 | ||
3100 | static inline unsigned | |
3101 | gimple_switch_num_labels (const_gimple gs) | |
3102 | { | |
3103 | unsigned num_ops; | |
3104 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3105 | num_ops = gimple_num_ops (gs); | |
3106 | gcc_assert (num_ops > 1); | |
3107 | return num_ops - 1; | |
3108 | } | |
3109 | ||
3110 | ||
3111 | /* Set NLABELS to be the number of labels for the switch statement GS. */ | |
3112 | ||
3113 | static inline void | |
3114 | gimple_switch_set_num_labels (gimple g, unsigned nlabels) | |
3115 | { | |
3116 | GIMPLE_CHECK (g, GIMPLE_SWITCH); | |
3117 | gimple_set_num_ops (g, nlabels + 1); | |
3118 | } | |
3119 | ||
3120 | ||
3121 | /* Return the index variable used by the switch statement GS. */ | |
3122 | ||
3123 | static inline tree | |
3124 | gimple_switch_index (const_gimple gs) | |
3125 | { | |
3126 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3127 | return gimple_op (gs, 0); | |
3128 | } | |
3129 | ||
3130 | ||
3131 | /* Return a pointer to the index variable for the switch statement GS. */ | |
3132 | ||
3133 | static inline tree * | |
3134 | gimple_switch_index_ptr (const_gimple gs) | |
3135 | { | |
3136 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3137 | return gimple_op_ptr (gs, 0); | |
3138 | } | |
3139 | ||
3140 | ||
3141 | /* Set INDEX to be the index variable for switch statement GS. */ | |
3142 | ||
3143 | static inline void | |
3144 | gimple_switch_set_index (gimple gs, tree index) | |
3145 | { | |
3146 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3147 | gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index)); | |
3148 | gimple_set_op (gs, 0, index); | |
3149 | } | |
3150 | ||
3151 | ||
3152 | /* Return the label numbered INDEX. The default label is 0, followed by any | |
3153 | labels in a switch statement. */ | |
3154 | ||
3155 | static inline tree | |
3156 | gimple_switch_label (const_gimple gs, unsigned index) | |
3157 | { | |
3158 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3159 | gcc_assert (gimple_num_ops (gs) > index + 1); | |
3160 | return gimple_op (gs, index + 1); | |
3161 | } | |
3162 | ||
3163 | /* Set the label number INDEX to LABEL. 0 is always the default label. */ | |
3164 | ||
3165 | static inline void | |
3166 | gimple_switch_set_label (gimple gs, unsigned index, tree label) | |
3167 | { | |
3168 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
3169 | gcc_assert (gimple_num_ops (gs) > index + 1); | |
3170 | gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR); | |
3171 | gimple_set_op (gs, index + 1, label); | |
3172 | } | |
3173 | ||
3174 | /* Return the default label for a switch statement. */ | |
3175 | ||
3176 | static inline tree | |
3177 | gimple_switch_default_label (const_gimple gs) | |
3178 | { | |
3179 | return gimple_switch_label (gs, 0); | |
3180 | } | |
3181 | ||
3182 | /* Set the default label for a switch statement. */ | |
3183 | ||
3184 | static inline void | |
3185 | gimple_switch_set_default_label (gimple gs, tree label) | |
3186 | { | |
3187 | gimple_switch_set_label (gs, 0, label); | |
3188 | } | |
3189 | ||
3190 | ||
3191 | /* Return the body for the OMP statement GS. */ | |
3192 | ||
3193 | static inline gimple_seq | |
3194 | gimple_omp_body (gimple gs) | |
3195 | { | |
3196 | return gs->omp.body; | |
3197 | } | |
3198 | ||
3199 | /* Set BODY to be the body for the OMP statement GS. */ | |
3200 | ||
3201 | static inline void | |
3202 | gimple_omp_set_body (gimple gs, gimple_seq body) | |
3203 | { | |
3204 | gs->omp.body = body; | |
3205 | } | |
3206 | ||
3207 | ||
3208 | /* Return the name associated with OMP_CRITICAL statement GS. */ | |
3209 | ||
3210 | static inline tree | |
3211 | gimple_omp_critical_name (const_gimple gs) | |
3212 | { | |
3213 | GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL); | |
3214 | return gs->gimple_omp_critical.name; | |
3215 | } | |
3216 | ||
3217 | ||
3218 | /* Return a pointer to the name associated with OMP critical statement GS. */ | |
3219 | ||
3220 | static inline tree * | |
3221 | gimple_omp_critical_name_ptr (gimple gs) | |
3222 | { | |
3223 | GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL); | |
3224 | return &gs->gimple_omp_critical.name; | |
3225 | } | |
3226 | ||
3227 | ||
3228 | /* Set NAME to be the name associated with OMP critical statement GS. */ | |
3229 | ||
3230 | static inline void | |
3231 | gimple_omp_critical_set_name (gimple gs, tree name) | |
3232 | { | |
3233 | GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL); | |
3234 | gs->gimple_omp_critical.name = name; | |
3235 | } | |
3236 | ||
3237 | ||
3238 | /* Return the clauses associated with OMP_FOR GS. */ | |
3239 | ||
3240 | static inline tree | |
3241 | gimple_omp_for_clauses (const_gimple gs) | |
3242 | { | |
3243 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3244 | return gs->gimple_omp_for.clauses; | |
3245 | } | |
3246 | ||
3247 | ||
3248 | /* Return a pointer to the OMP_FOR GS. */ | |
3249 | ||
3250 | static inline tree * | |
3251 | gimple_omp_for_clauses_ptr (gimple gs) | |
3252 | { | |
3253 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3254 | return &gs->gimple_omp_for.clauses; | |
3255 | } | |
3256 | ||
3257 | ||
3258 | /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */ | |
3259 | ||
3260 | static inline void | |
3261 | gimple_omp_for_set_clauses (gimple gs, tree clauses) | |
3262 | { | |
3263 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3264 | gs->gimple_omp_for.clauses = clauses; | |
3265 | } | |
3266 | ||
3267 | ||
3268 | /* Get the collapse count of OMP_FOR GS. */ | |
3269 | ||
3270 | static inline size_t | |
3271 | gimple_omp_for_collapse (gimple gs) | |
3272 | { | |
3273 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3274 | return gs->gimple_omp_for.collapse; | |
3275 | } | |
3276 | ||
3277 | ||
3278 | /* Return the index variable for OMP_FOR GS. */ | |
3279 | ||
3280 | static inline tree | |
3281 | gimple_omp_for_index (const_gimple gs, size_t i) | |
3282 | { | |
3283 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3284 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3285 | return gs->gimple_omp_for.iter[i].index; | |
3286 | } | |
3287 | ||
3288 | ||
3289 | /* Return a pointer to the index variable for OMP_FOR GS. */ | |
3290 | ||
3291 | static inline tree * | |
3292 | gimple_omp_for_index_ptr (gimple gs, size_t i) | |
3293 | { | |
3294 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3295 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3296 | return &gs->gimple_omp_for.iter[i].index; | |
3297 | } | |
3298 | ||
3299 | ||
3300 | /* Set INDEX to be the index variable for OMP_FOR GS. */ | |
3301 | ||
3302 | static inline void | |
3303 | gimple_omp_for_set_index (gimple gs, size_t i, tree index) | |
3304 | { | |
3305 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3306 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3307 | gs->gimple_omp_for.iter[i].index = index; | |
3308 | } | |
3309 | ||
3310 | ||
3311 | /* Return the initial value for OMP_FOR GS. */ | |
3312 | ||
3313 | static inline tree | |
3314 | gimple_omp_for_initial (const_gimple gs, size_t i) | |
3315 | { | |
3316 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3317 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3318 | return gs->gimple_omp_for.iter[i].initial; | |
3319 | } | |
3320 | ||
3321 | ||
3322 | /* Return a pointer to the initial value for OMP_FOR GS. */ | |
3323 | ||
3324 | static inline tree * | |
3325 | gimple_omp_for_initial_ptr (gimple gs, size_t i) | |
3326 | { | |
3327 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3328 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3329 | return &gs->gimple_omp_for.iter[i].initial; | |
3330 | } | |
3331 | ||
3332 | ||
3333 | /* Set INITIAL to be the initial value for OMP_FOR GS. */ | |
3334 | ||
3335 | static inline void | |
3336 | gimple_omp_for_set_initial (gimple gs, size_t i, tree initial) | |
3337 | { | |
3338 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3339 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3340 | gs->gimple_omp_for.iter[i].initial = initial; | |
3341 | } | |
3342 | ||
3343 | ||
3344 | /* Return the final value for OMP_FOR GS. */ | |
3345 | ||
3346 | static inline tree | |
3347 | gimple_omp_for_final (const_gimple gs, size_t i) | |
3348 | { | |
3349 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3350 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3351 | return gs->gimple_omp_for.iter[i].final; | |
3352 | } | |
3353 | ||
3354 | ||
3355 | /* Return a pointer to the final value for OMP_FOR GS. */ | |
3356 | ||
3357 | static inline tree * | |
3358 | gimple_omp_for_final_ptr (gimple gs, size_t i) | |
3359 | { | |
3360 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3361 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3362 | return &gs->gimple_omp_for.iter[i].final; | |
3363 | } | |
3364 | ||
3365 | ||
3366 | /* Set FINAL to be the final value for OMP_FOR GS. */ | |
3367 | ||
3368 | static inline void | |
3369 | gimple_omp_for_set_final (gimple gs, size_t i, tree final) | |
3370 | { | |
3371 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3372 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3373 | gs->gimple_omp_for.iter[i].final = final; | |
3374 | } | |
3375 | ||
3376 | ||
3377 | /* Return the increment value for OMP_FOR GS. */ | |
3378 | ||
3379 | static inline tree | |
3380 | gimple_omp_for_incr (const_gimple gs, size_t i) | |
3381 | { | |
3382 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3383 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3384 | return gs->gimple_omp_for.iter[i].incr; | |
3385 | } | |
3386 | ||
3387 | ||
3388 | /* Return a pointer to the increment value for OMP_FOR GS. */ | |
3389 | ||
3390 | static inline tree * | |
3391 | gimple_omp_for_incr_ptr (gimple gs, size_t i) | |
3392 | { | |
3393 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3394 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3395 | return &gs->gimple_omp_for.iter[i].incr; | |
3396 | } | |
3397 | ||
3398 | ||
3399 | /* Set INCR to be the increment value for OMP_FOR GS. */ | |
3400 | ||
3401 | static inline void | |
3402 | gimple_omp_for_set_incr (gimple gs, size_t i, tree incr) | |
3403 | { | |
3404 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3405 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3406 | gs->gimple_omp_for.iter[i].incr = incr; | |
3407 | } | |
3408 | ||
3409 | ||
3410 | /* Return the sequence of statements to execute before the OMP_FOR | |
3411 | statement GS starts. */ | |
3412 | ||
3413 | static inline gimple_seq | |
3414 | gimple_omp_for_pre_body (gimple gs) | |
3415 | { | |
3416 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3417 | return gs->gimple_omp_for.pre_body; | |
3418 | } | |
3419 | ||
3420 | ||
3421 | /* Set PRE_BODY to be the sequence of statements to execute before the | |
3422 | OMP_FOR statement GS starts. */ | |
3423 | ||
3424 | static inline void | |
3425 | gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body) | |
3426 | { | |
3427 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3428 | gs->gimple_omp_for.pre_body = pre_body; | |
3429 | } | |
3430 | ||
3431 | ||
3432 | /* Return the clauses associated with OMP_PARALLEL GS. */ | |
3433 | ||
3434 | static inline tree | |
3435 | gimple_omp_parallel_clauses (const_gimple gs) | |
3436 | { | |
3437 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3438 | return gs->gimple_omp_parallel.clauses; | |
3439 | } | |
3440 | ||
3441 | ||
3442 | /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */ | |
3443 | ||
3444 | static inline tree * | |
3445 | gimple_omp_parallel_clauses_ptr (gimple gs) | |
3446 | { | |
3447 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3448 | return &gs->gimple_omp_parallel.clauses; | |
3449 | } | |
3450 | ||
3451 | ||
3452 | /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL | |
3453 | GS. */ | |
3454 | ||
3455 | static inline void | |
3456 | gimple_omp_parallel_set_clauses (gimple gs, tree clauses) | |
3457 | { | |
3458 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3459 | gs->gimple_omp_parallel.clauses = clauses; | |
3460 | } | |
3461 | ||
3462 | ||
3463 | /* Return the child function used to hold the body of OMP_PARALLEL GS. */ | |
3464 | ||
3465 | static inline tree | |
3466 | gimple_omp_parallel_child_fn (const_gimple gs) | |
3467 | { | |
3468 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3469 | return gs->gimple_omp_parallel.child_fn; | |
3470 | } | |
3471 | ||
3472 | /* Return a pointer to the child function used to hold the body of | |
3473 | OMP_PARALLEL GS. */ | |
3474 | ||
3475 | static inline tree * | |
3476 | gimple_omp_parallel_child_fn_ptr (gimple gs) | |
3477 | { | |
3478 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3479 | return &gs->gimple_omp_parallel.child_fn; | |
3480 | } | |
3481 | ||
3482 | ||
3483 | /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */ | |
3484 | ||
3485 | static inline void | |
3486 | gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn) | |
3487 | { | |
3488 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3489 | gs->gimple_omp_parallel.child_fn = child_fn; | |
3490 | } | |
3491 | ||
3492 | ||
3493 | /* Return the artificial argument used to send variables and values | |
3494 | from the parent to the children threads in OMP_PARALLEL GS. */ | |
3495 | ||
3496 | static inline tree | |
3497 | gimple_omp_parallel_data_arg (const_gimple gs) | |
3498 | { | |
3499 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3500 | return gs->gimple_omp_parallel.data_arg; | |
3501 | } | |
3502 | ||
3503 | ||
3504 | /* Return a pointer to the data argument for OMP_PARALLEL GS. */ | |
3505 | ||
3506 | static inline tree * | |
3507 | gimple_omp_parallel_data_arg_ptr (gimple gs) | |
3508 | { | |
3509 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3510 | return &gs->gimple_omp_parallel.data_arg; | |
3511 | } | |
3512 | ||
3513 | ||
3514 | /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */ | |
3515 | ||
3516 | static inline void | |
3517 | gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg) | |
3518 | { | |
3519 | GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL); | |
3520 | gs->gimple_omp_parallel.data_arg = data_arg; | |
3521 | } | |
3522 | ||
3523 | ||
3524 | /* Return the clauses associated with OMP_TASK GS. */ | |
3525 | ||
3526 | static inline tree | |
3527 | gimple_omp_task_clauses (const_gimple gs) | |
3528 | { | |
3529 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3530 | return gs->gimple_omp_parallel.clauses; | |
3531 | } | |
3532 | ||
3533 | ||
3534 | /* Return a pointer to the clauses associated with OMP_TASK GS. */ | |
3535 | ||
3536 | static inline tree * | |
3537 | gimple_omp_task_clauses_ptr (gimple gs) | |
3538 | { | |
3539 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3540 | return &gs->gimple_omp_parallel.clauses; | |
3541 | } | |
3542 | ||
3543 | ||
3544 | /* Set CLAUSES to be the list of clauses associated with OMP_TASK | |
3545 | GS. */ | |
3546 | ||
3547 | static inline void | |
3548 | gimple_omp_task_set_clauses (gimple gs, tree clauses) | |
3549 | { | |
3550 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3551 | gs->gimple_omp_parallel.clauses = clauses; | |
3552 | } | |
3553 | ||
3554 | ||
3555 | /* Return the child function used to hold the body of OMP_TASK GS. */ | |
3556 | ||
3557 | static inline tree | |
3558 | gimple_omp_task_child_fn (const_gimple gs) | |
3559 | { | |
3560 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3561 | return gs->gimple_omp_parallel.child_fn; | |
3562 | } | |
3563 | ||
3564 | /* Return a pointer to the child function used to hold the body of | |
3565 | OMP_TASK GS. */ | |
3566 | ||
3567 | static inline tree * | |
3568 | gimple_omp_task_child_fn_ptr (gimple gs) | |
3569 | { | |
3570 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3571 | return &gs->gimple_omp_parallel.child_fn; | |
3572 | } | |
3573 | ||
3574 | ||
3575 | /* Set CHILD_FN to be the child function for OMP_TASK GS. */ | |
3576 | ||
3577 | static inline void | |
3578 | gimple_omp_task_set_child_fn (gimple gs, tree child_fn) | |
3579 | { | |
3580 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3581 | gs->gimple_omp_parallel.child_fn = child_fn; | |
3582 | } | |
3583 | ||
3584 | ||
3585 | /* Return the artificial argument used to send variables and values | |
3586 | from the parent to the children threads in OMP_TASK GS. */ | |
3587 | ||
3588 | static inline tree | |
3589 | gimple_omp_task_data_arg (const_gimple gs) | |
3590 | { | |
3591 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3592 | return gs->gimple_omp_parallel.data_arg; | |
3593 | } | |
3594 | ||
3595 | ||
3596 | /* Return a pointer to the data argument for OMP_TASK GS. */ | |
3597 | ||
3598 | static inline tree * | |
3599 | gimple_omp_task_data_arg_ptr (gimple gs) | |
3600 | { | |
3601 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3602 | return &gs->gimple_omp_parallel.data_arg; | |
3603 | } | |
3604 | ||
3605 | ||
3606 | /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ | |
3607 | ||
3608 | static inline void | |
3609 | gimple_omp_task_set_data_arg (gimple gs, tree data_arg) | |
3610 | { | |
3611 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3612 | gs->gimple_omp_parallel.data_arg = data_arg; | |
3613 | } | |
3614 | ||
3615 | ||
3616 | /* Return the clauses associated with OMP_TASK GS. */ | |
3617 | ||
3618 | static inline tree | |
3619 | gimple_omp_taskreg_clauses (const_gimple gs) | |
3620 | { | |
3621 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3622 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3623 | return gs->gimple_omp_parallel.clauses; | |
3624 | } | |
3625 | ||
3626 | ||
3627 | /* Return a pointer to the clauses associated with OMP_TASK GS. */ | |
3628 | ||
3629 | static inline tree * | |
3630 | gimple_omp_taskreg_clauses_ptr (gimple gs) | |
3631 | { | |
3632 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3633 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3634 | return &gs->gimple_omp_parallel.clauses; | |
3635 | } | |
3636 | ||
3637 | ||
3638 | /* Set CLAUSES to be the list of clauses associated with OMP_TASK | |
3639 | GS. */ | |
3640 | ||
3641 | static inline void | |
3642 | gimple_omp_taskreg_set_clauses (gimple gs, tree clauses) | |
3643 | { | |
3644 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3645 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3646 | gs->gimple_omp_parallel.clauses = clauses; | |
3647 | } | |
3648 | ||
3649 | ||
3650 | /* Return the child function used to hold the body of OMP_TASK GS. */ | |
3651 | ||
3652 | static inline tree | |
3653 | gimple_omp_taskreg_child_fn (const_gimple gs) | |
3654 | { | |
3655 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3656 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3657 | return gs->gimple_omp_parallel.child_fn; | |
3658 | } | |
3659 | ||
3660 | /* Return a pointer to the child function used to hold the body of | |
3661 | OMP_TASK GS. */ | |
3662 | ||
3663 | static inline tree * | |
3664 | gimple_omp_taskreg_child_fn_ptr (gimple gs) | |
3665 | { | |
3666 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3667 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3668 | return &gs->gimple_omp_parallel.child_fn; | |
3669 | } | |
3670 | ||
3671 | ||
3672 | /* Set CHILD_FN to be the child function for OMP_TASK GS. */ | |
3673 | ||
3674 | static inline void | |
3675 | gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn) | |
3676 | { | |
3677 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3678 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3679 | gs->gimple_omp_parallel.child_fn = child_fn; | |
3680 | } | |
3681 | ||
3682 | ||
3683 | /* Return the artificial argument used to send variables and values | |
3684 | from the parent to the children threads in OMP_TASK GS. */ | |
3685 | ||
3686 | static inline tree | |
3687 | gimple_omp_taskreg_data_arg (const_gimple gs) | |
3688 | { | |
3689 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3690 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3691 | return gs->gimple_omp_parallel.data_arg; | |
3692 | } | |
3693 | ||
3694 | ||
3695 | /* Return a pointer to the data argument for OMP_TASK GS. */ | |
3696 | ||
3697 | static inline tree * | |
3698 | gimple_omp_taskreg_data_arg_ptr (gimple gs) | |
3699 | { | |
3700 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3701 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3702 | return &gs->gimple_omp_parallel.data_arg; | |
3703 | } | |
3704 | ||
3705 | ||
3706 | /* Set DATA_ARG to be the data argument for OMP_TASK GS. */ | |
3707 | ||
3708 | static inline void | |
3709 | gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg) | |
3710 | { | |
3711 | if (gimple_code (gs) != GIMPLE_OMP_PARALLEL) | |
3712 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3713 | gs->gimple_omp_parallel.data_arg = data_arg; | |
3714 | } | |
3715 | ||
3716 | ||
3717 | /* Return the copy function used to hold the body of OMP_TASK GS. */ | |
3718 | ||
3719 | static inline tree | |
3720 | gimple_omp_task_copy_fn (const_gimple gs) | |
3721 | { | |
3722 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3723 | return gs->gimple_omp_task.copy_fn; | |
3724 | } | |
3725 | ||
3726 | /* Return a pointer to the copy function used to hold the body of | |
3727 | OMP_TASK GS. */ | |
3728 | ||
3729 | static inline tree * | |
3730 | gimple_omp_task_copy_fn_ptr (gimple gs) | |
3731 | { | |
3732 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3733 | return &gs->gimple_omp_task.copy_fn; | |
3734 | } | |
3735 | ||
3736 | ||
3737 | /* Set CHILD_FN to be the copy function for OMP_TASK GS. */ | |
3738 | ||
3739 | static inline void | |
3740 | gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn) | |
3741 | { | |
3742 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3743 | gs->gimple_omp_task.copy_fn = copy_fn; | |
3744 | } | |
3745 | ||
3746 | ||
3747 | /* Return size of the data block in bytes in OMP_TASK GS. */ | |
3748 | ||
3749 | static inline tree | |
3750 | gimple_omp_task_arg_size (const_gimple gs) | |
3751 | { | |
3752 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3753 | return gs->gimple_omp_task.arg_size; | |
3754 | } | |
3755 | ||
3756 | ||
3757 | /* Return a pointer to the data block size for OMP_TASK GS. */ | |
3758 | ||
3759 | static inline tree * | |
3760 | gimple_omp_task_arg_size_ptr (gimple gs) | |
3761 | { | |
3762 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3763 | return &gs->gimple_omp_task.arg_size; | |
3764 | } | |
3765 | ||
3766 | ||
3767 | /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */ | |
3768 | ||
3769 | static inline void | |
3770 | gimple_omp_task_set_arg_size (gimple gs, tree arg_size) | |
3771 | { | |
3772 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3773 | gs->gimple_omp_task.arg_size = arg_size; | |
3774 | } | |
3775 | ||
3776 | ||
3777 | /* Return align of the data block in bytes in OMP_TASK GS. */ | |
3778 | ||
3779 | static inline tree | |
3780 | gimple_omp_task_arg_align (const_gimple gs) | |
3781 | { | |
3782 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3783 | return gs->gimple_omp_task.arg_align; | |
3784 | } | |
3785 | ||
3786 | ||
3787 | /* Return a pointer to the data block align for OMP_TASK GS. */ | |
3788 | ||
3789 | static inline tree * | |
3790 | gimple_omp_task_arg_align_ptr (gimple gs) | |
3791 | { | |
3792 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3793 | return &gs->gimple_omp_task.arg_align; | |
3794 | } | |
3795 | ||
3796 | ||
3797 | /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */ | |
3798 | ||
3799 | static inline void | |
3800 | gimple_omp_task_set_arg_align (gimple gs, tree arg_align) | |
3801 | { | |
3802 | GIMPLE_CHECK (gs, GIMPLE_OMP_TASK); | |
3803 | gs->gimple_omp_task.arg_align = arg_align; | |
3804 | } | |
3805 | ||
3806 | ||
3807 | /* Return the clauses associated with OMP_SINGLE GS. */ | |
3808 | ||
3809 | static inline tree | |
3810 | gimple_omp_single_clauses (const_gimple gs) | |
3811 | { | |
3812 | GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE); | |
3813 | return gs->gimple_omp_single.clauses; | |
3814 | } | |
3815 | ||
3816 | ||
3817 | /* Return a pointer to the clauses associated with OMP_SINGLE GS. */ | |
3818 | ||
3819 | static inline tree * | |
3820 | gimple_omp_single_clauses_ptr (gimple gs) | |
3821 | { | |
3822 | GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE); | |
3823 | return &gs->gimple_omp_single.clauses; | |
3824 | } | |
3825 | ||
3826 | ||
3827 | /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */ | |
3828 | ||
3829 | static inline void | |
3830 | gimple_omp_single_set_clauses (gimple gs, tree clauses) | |
3831 | { | |
3832 | GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE); | |
3833 | gs->gimple_omp_single.clauses = clauses; | |
3834 | } | |
3835 | ||
3836 | ||
3837 | /* Return the clauses associated with OMP_SECTIONS GS. */ | |
3838 | ||
3839 | static inline tree | |
3840 | gimple_omp_sections_clauses (const_gimple gs) | |
3841 | { | |
3842 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
3843 | return gs->gimple_omp_sections.clauses; | |
3844 | } | |
3845 | ||
3846 | ||
3847 | /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */ | |
3848 | ||
3849 | static inline tree * | |
3850 | gimple_omp_sections_clauses_ptr (gimple gs) | |
3851 | { | |
3852 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
3853 | return &gs->gimple_omp_sections.clauses; | |
3854 | } | |
3855 | ||
3856 | ||
3857 | /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS | |
3858 | GS. */ | |
3859 | ||
3860 | static inline void | |
3861 | gimple_omp_sections_set_clauses (gimple gs, tree clauses) | |
3862 | { | |
3863 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
3864 | gs->gimple_omp_sections.clauses = clauses; | |
3865 | } | |
3866 | ||
3867 | ||
3868 | /* Return the control variable associated with the GIMPLE_OMP_SECTIONS | |
3869 | in GS. */ | |
3870 | ||
3871 | static inline tree | |
3872 | gimple_omp_sections_control (const_gimple gs) | |
3873 | { | |
3874 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
3875 | return gs->gimple_omp_sections.control; | |
3876 | } | |
3877 | ||
3878 | ||
3879 | /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS | |
3880 | GS. */ | |
3881 | ||
3882 | static inline tree * | |
3883 | gimple_omp_sections_control_ptr (gimple gs) | |
3884 | { | |
3885 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
3886 | return &gs->gimple_omp_sections.control; | |
3887 | } | |
3888 | ||
3889 | ||
3890 | /* Set CONTROL to be the set of clauses associated with the | |
3891 | GIMPLE_OMP_SECTIONS in GS. */ | |
3892 | ||
3893 | static inline void | |
3894 | gimple_omp_sections_set_control (gimple gs, tree control) | |
3895 | { | |
3896 | GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS); | |
3897 | gs->gimple_omp_sections.control = control; | |
3898 | } | |
3899 | ||
3900 | ||
3901 | /* Set COND to be the condition code for OMP_FOR GS. */ | |
3902 | ||
3903 | static inline void | |
3904 | gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond) | |
3905 | { | |
3906 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3907 | gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison); | |
3908 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3909 | gs->gimple_omp_for.iter[i].cond = cond; | |
3910 | } | |
3911 | ||
3912 | ||
3913 | /* Return the condition code associated with OMP_FOR GS. */ | |
3914 | ||
3915 | static inline enum tree_code | |
3916 | gimple_omp_for_cond (const_gimple gs, size_t i) | |
3917 | { | |
3918 | GIMPLE_CHECK (gs, GIMPLE_OMP_FOR); | |
3919 | gcc_assert (i < gs->gimple_omp_for.collapse); | |
3920 | return gs->gimple_omp_for.iter[i].cond; | |
3921 | } | |
3922 | ||
3923 | ||
3924 | /* Set the value being stored in an atomic store. */ | |
3925 | ||
3926 | static inline void | |
3927 | gimple_omp_atomic_store_set_val (gimple g, tree val) | |
3928 | { | |
3929 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
3930 | g->gimple_omp_atomic_store.val = val; | |
3931 | } | |
3932 | ||
3933 | ||
3934 | /* Return the value being stored in an atomic store. */ | |
3935 | ||
3936 | static inline tree | |
3937 | gimple_omp_atomic_store_val (const_gimple g) | |
3938 | { | |
3939 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
3940 | return g->gimple_omp_atomic_store.val; | |
3941 | } | |
3942 | ||
3943 | ||
3944 | /* Return a pointer to the value being stored in an atomic store. */ | |
3945 | ||
3946 | static inline tree * | |
3947 | gimple_omp_atomic_store_val_ptr (gimple g) | |
3948 | { | |
3949 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE); | |
3950 | return &g->gimple_omp_atomic_store.val; | |
3951 | } | |
3952 | ||
3953 | ||
3954 | /* Set the LHS of an atomic load. */ | |
3955 | ||
3956 | static inline void | |
3957 | gimple_omp_atomic_load_set_lhs (gimple g, tree lhs) | |
3958 | { | |
3959 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
3960 | g->gimple_omp_atomic_load.lhs = lhs; | |
3961 | } | |
3962 | ||
3963 | ||
3964 | /* Get the LHS of an atomic load. */ | |
3965 | ||
3966 | static inline tree | |
3967 | gimple_omp_atomic_load_lhs (const_gimple g) | |
3968 | { | |
3969 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
3970 | return g->gimple_omp_atomic_load.lhs; | |
3971 | } | |
3972 | ||
3973 | ||
3974 | /* Return a pointer to the LHS of an atomic load. */ | |
3975 | ||
3976 | static inline tree * | |
3977 | gimple_omp_atomic_load_lhs_ptr (gimple g) | |
3978 | { | |
3979 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
3980 | return &g->gimple_omp_atomic_load.lhs; | |
3981 | } | |
3982 | ||
3983 | ||
3984 | /* Set the RHS of an atomic load. */ | |
3985 | ||
3986 | static inline void | |
3987 | gimple_omp_atomic_load_set_rhs (gimple g, tree rhs) | |
3988 | { | |
3989 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
3990 | g->gimple_omp_atomic_load.rhs = rhs; | |
3991 | } | |
3992 | ||
3993 | ||
3994 | /* Get the RHS of an atomic load. */ | |
3995 | ||
3996 | static inline tree | |
3997 | gimple_omp_atomic_load_rhs (const_gimple g) | |
3998 | { | |
3999 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4000 | return g->gimple_omp_atomic_load.rhs; | |
4001 | } | |
4002 | ||
4003 | ||
4004 | /* Return a pointer to the RHS of an atomic load. */ | |
4005 | ||
4006 | static inline tree * | |
4007 | gimple_omp_atomic_load_rhs_ptr (gimple g) | |
4008 | { | |
4009 | GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD); | |
4010 | return &g->gimple_omp_atomic_load.rhs; | |
4011 | } | |
4012 | ||
4013 | ||
4014 | /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4015 | ||
4016 | static inline tree | |
4017 | gimple_omp_continue_control_def (const_gimple g) | |
4018 | { | |
4019 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4020 | return g->gimple_omp_continue.control_def; | |
4021 | } | |
4022 | ||
4023 | /* The same as above, but return the address. */ | |
4024 | ||
4025 | static inline tree * | |
4026 | gimple_omp_continue_control_def_ptr (gimple g) | |
4027 | { | |
4028 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4029 | return &g->gimple_omp_continue.control_def; | |
4030 | } | |
4031 | ||
4032 | /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4033 | ||
4034 | static inline void | |
4035 | gimple_omp_continue_set_control_def (gimple g, tree def) | |
4036 | { | |
4037 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4038 | g->gimple_omp_continue.control_def = def; | |
4039 | } | |
4040 | ||
4041 | ||
4042 | /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4043 | ||
4044 | static inline tree | |
4045 | gimple_omp_continue_control_use (const_gimple g) | |
4046 | { | |
4047 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4048 | return g->gimple_omp_continue.control_use; | |
4049 | } | |
4050 | ||
4051 | ||
4052 | /* The same as above, but return the address. */ | |
4053 | ||
4054 | static inline tree * | |
4055 | gimple_omp_continue_control_use_ptr (gimple g) | |
4056 | { | |
4057 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4058 | return &g->gimple_omp_continue.control_use; | |
4059 | } | |
4060 | ||
4061 | ||
4062 | /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */ | |
4063 | ||
4064 | static inline void | |
4065 | gimple_omp_continue_set_control_use (gimple g, tree use) | |
4066 | { | |
4067 | GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE); | |
4068 | g->gimple_omp_continue.control_use = use; | |
4069 | } | |
4070 | ||
4071 | ||
4072 | /* Return a pointer to the return value for GIMPLE_RETURN GS. */ | |
4073 | ||
4074 | static inline tree * | |
4075 | gimple_return_retval_ptr (const_gimple gs) | |
4076 | { | |
4077 | GIMPLE_CHECK (gs, GIMPLE_RETURN); | |
4078 | gcc_assert (gimple_num_ops (gs) == 1); | |
4079 | return gimple_op_ptr (gs, 0); | |
4080 | } | |
4081 | ||
4082 | /* Return the return value for GIMPLE_RETURN GS. */ | |
4083 | ||
4084 | static inline tree | |
4085 | gimple_return_retval (const_gimple gs) | |
4086 | { | |
4087 | GIMPLE_CHECK (gs, GIMPLE_RETURN); | |
4088 | gcc_assert (gimple_num_ops (gs) == 1); | |
4089 | return gimple_op (gs, 0); | |
4090 | } | |
4091 | ||
4092 | ||
4093 | /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */ | |
4094 | ||
4095 | static inline void | |
4096 | gimple_return_set_retval (gimple gs, tree retval) | |
4097 | { | |
4098 | GIMPLE_CHECK (gs, GIMPLE_RETURN); | |
4099 | gcc_assert (gimple_num_ops (gs) == 1); | |
4100 | gcc_assert (retval == NULL_TREE | |
4101 | || TREE_CODE (retval) == RESULT_DECL | |
4102 | || is_gimple_val (retval)); | |
4103 | gimple_set_op (gs, 0, retval); | |
4104 | } | |
4105 | ||
4106 | ||
4107 | /* Returns true when the gimple statment STMT is any of the OpenMP types. */ | |
4108 | ||
4109 | static inline bool | |
4110 | is_gimple_omp (const_gimple stmt) | |
4111 | { | |
4112 | return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL | |
4113 | || gimple_code (stmt) == GIMPLE_OMP_TASK | |
4114 | || gimple_code (stmt) == GIMPLE_OMP_FOR | |
4115 | || gimple_code (stmt) == GIMPLE_OMP_SECTIONS | |
4116 | || gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH | |
4117 | || gimple_code (stmt) == GIMPLE_OMP_SINGLE | |
4118 | || gimple_code (stmt) == GIMPLE_OMP_SECTION | |
4119 | || gimple_code (stmt) == GIMPLE_OMP_MASTER | |
4120 | || gimple_code (stmt) == GIMPLE_OMP_ORDERED | |
4121 | || gimple_code (stmt) == GIMPLE_OMP_CRITICAL | |
4122 | || gimple_code (stmt) == GIMPLE_OMP_RETURN | |
4123 | || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD | |
4124 | || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE | |
4125 | || gimple_code (stmt) == GIMPLE_OMP_CONTINUE); | |
4126 | } | |
4127 | ||
4128 | ||
4129 | /* Returns TRUE if statement G is a GIMPLE_NOP. */ | |
4130 | ||
4131 | static inline bool | |
4132 | gimple_nop_p (const_gimple g) | |
4133 | { | |
4134 | return gimple_code (g) == GIMPLE_NOP; | |
4135 | } | |
4136 | ||
4137 | ||
4138 | /* Return the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */ | |
4139 | ||
4140 | static inline tree | |
4141 | gimple_cdt_new_type (gimple gs) | |
4142 | { | |
4143 | GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE); | |
4144 | return gimple_op (gs, 1); | |
4145 | } | |
4146 | ||
4147 | /* Return a pointer to the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE | |
4148 | statement GS. */ | |
4149 | ||
4150 | static inline tree * | |
4151 | gimple_cdt_new_type_ptr (gimple gs) | |
4152 | { | |
4153 | GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE); | |
4154 | return gimple_op_ptr (gs, 1); | |
4155 | } | |
4156 | ||
4157 | /* Set NEW_TYPE to be the type returned by GIMPLE_CHANGE_DYNAMIC_TYPE | |
4158 | statement GS. */ | |
4159 | ||
4160 | static inline void | |
4161 | gimple_cdt_set_new_type (gimple gs, tree new_type) | |
4162 | { | |
4163 | GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE); | |
4164 | gcc_assert (TREE_CODE_CLASS (TREE_CODE (new_type)) == tcc_type); | |
4165 | gimple_set_op (gs, 1, new_type); | |
4166 | } | |
4167 | ||
4168 | ||
4169 | /* Return the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */ | |
4170 | ||
4171 | static inline tree | |
4172 | gimple_cdt_location (gimple gs) | |
4173 | { | |
4174 | GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE); | |
4175 | return gimple_op (gs, 0); | |
4176 | } | |
4177 | ||
4178 | ||
4179 | /* Return a pointer to the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE | |
4180 | statement GS. */ | |
4181 | ||
4182 | static inline tree * | |
4183 | gimple_cdt_location_ptr (gimple gs) | |
4184 | { | |
4185 | GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE); | |
4186 | return gimple_op_ptr (gs, 0); | |
4187 | } | |
4188 | ||
4189 | ||
4190 | /* Set PTR to be the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE | |
4191 | statement GS. */ | |
4192 | ||
4193 | static inline void | |
4194 | gimple_cdt_set_location (gimple gs, tree ptr) | |
4195 | { | |
4196 | GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE); | |
4197 | gimple_set_op (gs, 0, ptr); | |
4198 | } | |
4199 | ||
4200 | ||
4201 | /* Return the predictor of GIMPLE_PREDICT statement GS. */ | |
4202 | ||
4203 | static inline enum br_predictor | |
4204 | gimple_predict_predictor (gimple gs) | |
4205 | { | |
4206 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4207 | return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN); | |
4208 | } | |
4209 | ||
4210 | ||
4211 | /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */ | |
4212 | ||
4213 | static inline void | |
4214 | gimple_predict_set_predictor (gimple gs, enum br_predictor predictor) | |
4215 | { | |
4216 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4217 | gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN) | |
4218 | | (unsigned) predictor; | |
4219 | } | |
4220 | ||
4221 | ||
4222 | /* Return the outcome of GIMPLE_PREDICT statement GS. */ | |
4223 | ||
4224 | static inline enum prediction | |
4225 | gimple_predict_outcome (gimple gs) | |
4226 | { | |
4227 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4228 | return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN; | |
4229 | } | |
4230 | ||
4231 | ||
4232 | /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */ | |
4233 | ||
4234 | static inline void | |
4235 | gimple_predict_set_outcome (gimple gs, enum prediction outcome) | |
4236 | { | |
4237 | GIMPLE_CHECK (gs, GIMPLE_PREDICT); | |
4238 | if (outcome == TAKEN) | |
4239 | gs->gsbase.subcode |= GF_PREDICT_TAKEN; | |
4240 | else | |
4241 | gs->gsbase.subcode &= ~GF_PREDICT_TAKEN; | |
4242 | } | |
4243 | ||
4244 | ||
4245 | /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */ | |
4246 | ||
4247 | static inline gimple_stmt_iterator | |
4248 | gsi_start (gimple_seq seq) | |
4249 | { | |
4250 | gimple_stmt_iterator i; | |
4251 | ||
4252 | i.ptr = gimple_seq_first (seq); | |
4253 | i.seq = seq; | |
4254 | i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL; | |
4255 | ||
4256 | return i; | |
4257 | } | |
4258 | ||
4259 | ||
4260 | /* Return a new iterator pointing to the first statement in basic block BB. */ | |
4261 | ||
4262 | static inline gimple_stmt_iterator | |
4263 | gsi_start_bb (basic_block bb) | |
4264 | { | |
4265 | gimple_stmt_iterator i; | |
4266 | gimple_seq seq; | |
4267 | ||
4268 | seq = bb_seq (bb); | |
4269 | i.ptr = gimple_seq_first (seq); | |
4270 | i.seq = seq; | |
4271 | i.bb = bb; | |
4272 | ||
4273 | return i; | |
4274 | } | |
4275 | ||
4276 | ||
4277 | /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */ | |
4278 | ||
4279 | static inline gimple_stmt_iterator | |
4280 | gsi_last (gimple_seq seq) | |
4281 | { | |
4282 | gimple_stmt_iterator i; | |
4283 | ||
4284 | i.ptr = gimple_seq_last (seq); | |
4285 | i.seq = seq; | |
4286 | i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL; | |
4287 | ||
4288 | return i; | |
4289 | } | |
4290 | ||
4291 | ||
4292 | /* Return a new iterator pointing to the last statement in basic block BB. */ | |
4293 | ||
4294 | static inline gimple_stmt_iterator | |
4295 | gsi_last_bb (basic_block bb) | |
4296 | { | |
4297 | gimple_stmt_iterator i; | |
4298 | gimple_seq seq; | |
4299 | ||
4300 | seq = bb_seq (bb); | |
4301 | i.ptr = gimple_seq_last (seq); | |
4302 | i.seq = seq; | |
4303 | i.bb = bb; | |
4304 | ||
4305 | return i; | |
4306 | } | |
4307 | ||
4308 | ||
4309 | /* Return true if I is at the end of its sequence. */ | |
4310 | ||
4311 | static inline bool | |
4312 | gsi_end_p (gimple_stmt_iterator i) | |
4313 | { | |
4314 | return i.ptr == NULL; | |
4315 | } | |
4316 | ||
4317 | ||
4318 | /* Return true if I is one statement before the end of its sequence. */ | |
4319 | ||
4320 | static inline bool | |
4321 | gsi_one_before_end_p (gimple_stmt_iterator i) | |
4322 | { | |
4323 | return i.ptr != NULL && i.ptr->next == NULL; | |
4324 | } | |
4325 | ||
4326 | ||
4327 | /* Advance the iterator to the next gimple statement. */ | |
4328 | ||
4329 | static inline void | |
4330 | gsi_next (gimple_stmt_iterator *i) | |
4331 | { | |
4332 | i->ptr = i->ptr->next; | |
4333 | } | |
4334 | ||
4335 | /* Advance the iterator to the previous gimple statement. */ | |
4336 | ||
4337 | static inline void | |
4338 | gsi_prev (gimple_stmt_iterator *i) | |
4339 | { | |
4340 | i->ptr = i->ptr->prev; | |
4341 | } | |
4342 | ||
4343 | /* Return the current stmt. */ | |
4344 | ||
4345 | static inline gimple | |
4346 | gsi_stmt (gimple_stmt_iterator i) | |
4347 | { | |
4348 | return i.ptr->stmt; | |
4349 | } | |
4350 | ||
4351 | /* Return a block statement iterator that points to the first non-label | |
4352 | statement in block BB. */ | |
4353 | ||
4354 | static inline gimple_stmt_iterator | |
4355 | gsi_after_labels (basic_block bb) | |
4356 | { | |
4357 | gimple_stmt_iterator gsi = gsi_start_bb (bb); | |
4358 | ||
4359 | while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL) | |
4360 | gsi_next (&gsi); | |
4361 | ||
4362 | return gsi; | |
4363 | } | |
4364 | ||
4365 | /* Return a pointer to the current stmt. | |
4366 | ||
4367 | NOTE: You may want to use gsi_replace on the iterator itself, | |
4368 | as this performs additional bookkeeping that will not be done | |
4369 | if you simply assign through a pointer returned by gsi_stmt_ptr. */ | |
4370 | ||
4371 | static inline gimple * | |
4372 | gsi_stmt_ptr (gimple_stmt_iterator *i) | |
4373 | { | |
4374 | return &i->ptr->stmt; | |
4375 | } | |
4376 | ||
4377 | ||
4378 | /* Return the basic block associated with this iterator. */ | |
4379 | ||
4380 | static inline basic_block | |
4381 | gsi_bb (gimple_stmt_iterator i) | |
4382 | { | |
4383 | return i.bb; | |
4384 | } | |
4385 | ||
4386 | ||
4387 | /* Return the sequence associated with this iterator. */ | |
4388 | ||
4389 | static inline gimple_seq | |
4390 | gsi_seq (gimple_stmt_iterator i) | |
4391 | { | |
4392 | return i.seq; | |
4393 | } | |
4394 | ||
4395 | ||
4396 | enum gsi_iterator_update | |
4397 | { | |
4398 | GSI_NEW_STMT, /* Only valid when single statement is added, move | |
4399 | iterator to it. */ | |
4400 | GSI_SAME_STMT, /* Leave the iterator at the same statement. */ | |
4401 | GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable | |
4402 | for linking other statements in the same | |
4403 | direction. */ | |
4404 | }; | |
4405 | ||
4406 | /* In gimple-iterator.c */ | |
4407 | gimple_stmt_iterator gsi_start_phis (basic_block); | |
4408 | gimple_seq gsi_split_seq_after (gimple_stmt_iterator); | |
4409 | gimple_seq gsi_split_seq_before (gimple_stmt_iterator *); | |
4410 | void gsi_replace (gimple_stmt_iterator *, gimple, bool); | |
4411 | void gsi_insert_before (gimple_stmt_iterator *, gimple, | |
4412 | enum gsi_iterator_update); | |
4413 | void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple, | |
4414 | enum gsi_iterator_update); | |
4415 | void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq, | |
4416 | enum gsi_iterator_update); | |
4417 | void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq, | |
4418 | enum gsi_iterator_update); | |
4419 | void gsi_insert_after (gimple_stmt_iterator *, gimple, | |
4420 | enum gsi_iterator_update); | |
4421 | void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple, | |
4422 | enum gsi_iterator_update); | |
4423 | void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq, | |
4424 | enum gsi_iterator_update); | |
4425 | void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq, | |
4426 | enum gsi_iterator_update); | |
4427 | void gsi_remove (gimple_stmt_iterator *, bool); | |
4428 | gimple_stmt_iterator gsi_for_stmt (gimple); | |
4429 | void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *); | |
4430 | void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *); | |
4431 | void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *); | |
4432 | void gsi_insert_on_edge (edge, gimple); | |
4433 | void gsi_insert_seq_on_edge (edge, gimple_seq); | |
4434 | basic_block gsi_insert_on_edge_immediate (edge, gimple); | |
4435 | basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq); | |
4436 | void gsi_commit_one_edge_insert (edge, basic_block *); | |
4437 | void gsi_commit_edge_inserts (void); | |
74140efd | 4438 | gimple gimple_call_copy_skip_args (gimple, bitmap); |
75a70cf9 | 4439 | |
4440 | ||
4441 | /* Convenience routines to walk all statements of a gimple function. | |
4442 | Note that this is useful exclusively before the code is converted | |
4443 | into SSA form. Once the program is in SSA form, the standard | |
4444 | operand interface should be used to analyze/modify statements. */ | |
4445 | struct walk_stmt_info | |
4446 | { | |
4447 | /* Points to the current statement being walked. */ | |
4448 | gimple_stmt_iterator gsi; | |
4449 | ||
4450 | /* Additional data that the callback functions may want to carry | |
4451 | through the recursion. */ | |
4452 | void *info; | |
4453 | ||
4454 | /* Pointer map used to mark visited tree nodes when calling | |
4455 | walk_tree on each operand. If set to NULL, duplicate tree nodes | |
4456 | will be visited more than once. */ | |
4457 | struct pointer_set_t *pset; | |
4458 | ||
4459 | /* Indicates whether the operand being examined may be replaced | |
4460 | with something that matches is_gimple_val (if true) or something | |
4461 | slightly more complicated (if false). "Something" technically | |
4462 | means the common subset of is_gimple_lvalue and is_gimple_rhs, | |
4463 | but we never try to form anything more complicated than that, so | |
4464 | we don't bother checking. | |
4465 | ||
4466 | Also note that CALLBACK should update this flag while walking the | |
4467 | sub-expressions of a statement. For instance, when walking the | |
4468 | statement 'foo (&var)', the flag VAL_ONLY will initially be set | |
4469 | to true, however, when walking &var, the operand of that | |
4470 | ADDR_EXPR does not need to be a GIMPLE value. */ | |
4471 | bool val_only; | |
4472 | ||
4473 | /* True if we are currently walking the LHS of an assignment. */ | |
4474 | bool is_lhs; | |
4475 | ||
4476 | /* Optional. Set to true by the callback functions if they made any | |
4477 | changes. */ | |
4478 | bool changed; | |
4479 | ||
4480 | /* True if we're interested in location information. */ | |
4481 | bool want_locations; | |
4482 | ||
4483 | /* Operand returned by the callbacks. This is set when calling | |
4484 | walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback | |
4485 | returns non-NULL, this field will contain the tree returned by | |
4486 | the last callback. */ | |
4487 | tree callback_result; | |
4488 | }; | |
4489 | ||
4490 | /* Callback for walk_gimple_stmt. Called for every statement found | |
4491 | during traversal. The first argument points to the statement to | |
4492 | walk. The second argument is a flag that the callback sets to | |
4493 | 'true' if it the callback handled all the operands and | |
4494 | sub-statements of the statement (the default value of this flag is | |
4495 | 'false'). The third argument is an anonymous pointer to data | |
4496 | to be used by the callback. */ | |
4497 | typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *, | |
4498 | struct walk_stmt_info *); | |
4499 | ||
4500 | gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn, | |
4501 | struct walk_stmt_info *); | |
4502 | tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn, | |
4503 | struct walk_stmt_info *); | |
4504 | tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *); | |
4505 | ||
4506 | #ifdef GATHER_STATISTICS | |
4507 | /* Enum and arrays used for allocation stats. Keep in sync with | |
4508 | gimple.c:gimple_alloc_kind_names. */ | |
4509 | enum gimple_alloc_kind | |
4510 | { | |
4511 | gimple_alloc_kind_assign, /* Assignments. */ | |
4512 | gimple_alloc_kind_phi, /* PHI nodes. */ | |
4513 | gimple_alloc_kind_cond, /* Conditionals. */ | |
4514 | gimple_alloc_kind_seq, /* Sequences. */ | |
4515 | gimple_alloc_kind_rest, /* Everything else. */ | |
4516 | gimple_alloc_kind_all | |
4517 | }; | |
4518 | ||
4519 | extern int gimple_alloc_counts[]; | |
4520 | extern int gimple_alloc_sizes[]; | |
4521 | ||
4522 | /* Return the allocation kind for a given stmt CODE. */ | |
4523 | static inline enum gimple_alloc_kind | |
4524 | gimple_alloc_kind (enum gimple_code code) | |
4525 | { | |
4526 | switch (code) | |
4527 | { | |
4528 | case GIMPLE_ASSIGN: | |
4529 | return gimple_alloc_kind_assign; | |
4530 | case GIMPLE_PHI: | |
4531 | return gimple_alloc_kind_phi; | |
4532 | case GIMPLE_COND: | |
4533 | return gimple_alloc_kind_cond; | |
4534 | default: | |
4535 | return gimple_alloc_kind_rest; | |
4536 | } | |
4537 | } | |
4538 | #endif /* GATHER_STATISTICS */ | |
4539 | ||
4540 | extern void dump_gimple_statistics (void); | |
4541 | ||
4542 | #endif /* GCC_GIMPLE_H */ |