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