PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / gimple.h
bloba5dda9369bc0b11446ba7cffe0403e93f0222fa6
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2018 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
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.
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.
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/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN \
50 ATTRIBUTE_COLD;
52 #define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59 template <typename T>
60 static inline T
61 GIMPLE_CHECK2(const gimple *gs,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66 #else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70 #endif
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
75 remove_pointer<T>::type::code_, ERROR_MARK);
76 return ret;
78 template <typename T>
79 static inline T
80 GIMPLE_CHECK2(gimple *gs,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85 #else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89 #endif
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
94 remove_pointer<T>::type::code_, ERROR_MARK);
95 return ret;
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T>
101 static inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 static inline T
108 GIMPLE_CHECK2(const gimple *gs)
110 return as_a <T> (gs);
112 #endif
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1,
140 GF_CALL_FROM_THUNK = 1 << 0,
141 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
142 GF_CALL_TAILCALL = 1 << 2,
143 GF_CALL_VA_ARG_PACK = 1 << 3,
144 GF_CALL_NOTHROW = 1 << 4,
145 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
146 GF_CALL_INTERNAL = 1 << 6,
147 GF_CALL_CTRL_ALTERING = 1 << 7,
148 GF_CALL_MUST_TAIL_CALL = 1 << 9,
149 GF_CALL_BY_DESCRIPTOR = 1 << 10,
150 GF_CALL_NOCF_CHECK = 1 << 11,
151 GF_OMP_PARALLEL_COMBINED = 1 << 0,
152 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
153 GF_OMP_TASK_TASKLOOP = 1 << 0,
154 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
155 GF_OMP_FOR_KIND_FOR = 0,
156 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
157 GF_OMP_FOR_KIND_TASKLOOP = 2,
158 GF_OMP_FOR_KIND_OACC_LOOP = 4,
159 GF_OMP_FOR_KIND_GRID_LOOP = 5,
160 /* Flag for SIMD variants of OMP_FOR kinds. */
161 GF_OMP_FOR_SIMD = 1 << 3,
162 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
163 GF_OMP_FOR_COMBINED = 1 << 4,
164 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
165 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
166 statements. */
167 GF_OMP_FOR_GRID_PHONY = 1 << 6,
168 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
169 loop statements. */
170 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6,
171 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7,
172 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
173 GF_OMP_TARGET_KIND_REGION = 0,
174 GF_OMP_TARGET_KIND_DATA = 1,
175 GF_OMP_TARGET_KIND_UPDATE = 2,
176 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
177 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
178 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
179 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
180 GF_OMP_TARGET_KIND_OACC_DATA = 7,
181 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
182 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
183 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
184 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
185 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
187 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
188 a thread synchronization via some sort of barrier. The exact barrier
189 that would otherwise be emitted is dependent on the OMP statement with
190 which this return is associated. */
191 GF_OMP_RETURN_NOWAIT = 1 << 0,
193 GF_OMP_SECTION_LAST = 1 << 0,
194 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
195 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
196 GF_PREDICT_TAKEN = 1 << 15
199 /* This subcode tells apart different kinds of stmts that are not used
200 for codegen, but rather to retain debug information. */
201 enum gimple_debug_subcode {
202 GIMPLE_DEBUG_BIND = 0,
203 GIMPLE_DEBUG_SOURCE_BIND = 1,
204 GIMPLE_DEBUG_BEGIN_STMT = 2,
205 GIMPLE_DEBUG_INLINE_ENTRY = 3
208 /* Masks for selecting a pass local flag (PLF) to work on. These
209 masks are used by gimple_set_plf and gimple_plf. */
210 enum plf_mask {
211 GF_PLF_1 = 1 << 0,
212 GF_PLF_2 = 1 << 1
215 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
216 are for 64 bit hosts. */
218 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
219 chain_next ("%h.next"), variable_size))
220 gimple
222 /* [ WORD 1 ]
223 Main identifying code for a tuple. */
224 ENUM_BITFIELD(gimple_code) code : 8;
226 /* Nonzero if a warning should not be emitted on this tuple. */
227 unsigned int no_warning : 1;
229 /* Nonzero if this tuple has been visited. Passes are responsible
230 for clearing this bit before using it. */
231 unsigned int visited : 1;
233 /* Nonzero if this tuple represents a non-temporal move. */
234 unsigned int nontemporal_move : 1;
236 /* Pass local flags. These flags are free for any pass to use as
237 they see fit. Passes should not assume that these flags contain
238 any useful value when the pass starts. Any initial state that
239 the pass requires should be set on entry to the pass. See
240 gimple_set_plf and gimple_plf for usage. */
241 unsigned int plf : 2;
243 /* Nonzero if this statement has been modified and needs to have its
244 operands rescanned. */
245 unsigned modified : 1;
247 /* Nonzero if this statement contains volatile operands. */
248 unsigned has_volatile_ops : 1;
250 /* Padding to get subcode to 16 bit alignment. */
251 unsigned pad : 1;
253 /* The SUBCODE field can be used for tuple-specific flags for tuples
254 that do not require subcodes. Note that SUBCODE should be at
255 least as wide as tree codes, as several tuples store tree codes
256 in there. */
257 unsigned int subcode : 16;
259 /* UID of this statement. This is used by passes that want to
260 assign IDs to statements. It must be assigned and used by each
261 pass. By default it should be assumed to contain garbage. */
262 unsigned uid;
264 /* [ WORD 2 ]
265 Locus information for debug info. */
266 location_t location;
268 /* Number of operands in this tuple. */
269 unsigned num_ops;
271 /* [ WORD 3 ]
272 Basic block holding this statement. */
273 basic_block bb;
275 /* [ WORD 4-5 ]
276 Linked lists of gimple statements. The next pointers form
277 a NULL terminated list, the prev pointers are a cyclic list.
278 A gimple statement is hence also a double-ended list of
279 statements, with the pointer itself being the first element,
280 and the prev pointer being the last. */
281 gimple *next;
282 gimple *GTY((skip)) prev;
286 /* Base structure for tuples with operands. */
288 /* This gimple subclass has no tag value. */
289 struct GTY(())
290 gimple_statement_with_ops_base : public gimple
292 /* [ WORD 1-6 ] : base class */
294 /* [ WORD 7 ]
295 SSA operand vectors. NOTE: It should be possible to
296 amalgamate these vectors with the operand vector OP. However,
297 the SSA operand vectors are organized differently and contain
298 more information (like immediate use chaining). */
299 struct use_optype_d GTY((skip (""))) *use_ops;
303 /* Statements that take register operands. */
305 struct GTY((tag("GSS_WITH_OPS")))
306 gimple_statement_with_ops : public gimple_statement_with_ops_base
308 /* [ WORD 1-7 ] : base class */
310 /* [ WORD 8 ]
311 Operand vector. NOTE! This must always be the last field
312 of this structure. In particular, this means that this
313 structure cannot be embedded inside another one. */
314 tree GTY((length ("%h.num_ops"))) op[1];
318 /* Base for statements that take both memory and register operands. */
320 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
321 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
323 /* [ WORD 1-7 ] : base class */
325 /* [ WORD 8-9 ]
326 Virtual operands for this statement. The GC will pick them
327 up via the ssa_names array. */
328 tree GTY((skip (""))) vdef;
329 tree GTY((skip (""))) vuse;
333 /* Statements that take both memory and register operands. */
335 struct GTY((tag("GSS_WITH_MEM_OPS")))
336 gimple_statement_with_memory_ops :
337 public gimple_statement_with_memory_ops_base
339 /* [ WORD 1-9 ] : base class */
341 /* [ WORD 10 ]
342 Operand vector. NOTE! This must always be the last field
343 of this structure. In particular, this means that this
344 structure cannot be embedded inside another one. */
345 tree GTY((length ("%h.num_ops"))) op[1];
349 /* Call statements that take both memory and register operands. */
351 struct GTY((tag("GSS_CALL")))
352 gcall : public gimple_statement_with_memory_ops_base
354 /* [ WORD 1-9 ] : base class */
356 /* [ WORD 10-13 ] */
357 struct pt_solution call_used;
358 struct pt_solution call_clobbered;
360 /* [ WORD 14 ] */
361 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
362 tree GTY ((tag ("0"))) fntype;
363 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
364 } u;
366 /* [ WORD 15 ]
367 Operand vector. NOTE! This must always be the last field
368 of this structure. In particular, this means that this
369 structure cannot be embedded inside another one. */
370 tree GTY((length ("%h.num_ops"))) op[1];
372 static const enum gimple_code code_ = GIMPLE_CALL;
376 /* OMP statements. */
378 struct GTY((tag("GSS_OMP")))
379 gimple_statement_omp : public gimple
381 /* [ WORD 1-6 ] : base class */
383 /* [ WORD 7 ] */
384 gimple_seq body;
388 /* GIMPLE_BIND */
390 struct GTY((tag("GSS_BIND")))
391 gbind : public gimple
393 /* [ WORD 1-6 ] : base class */
395 /* [ WORD 7 ]
396 Variables declared in this scope. */
397 tree vars;
399 /* [ WORD 8 ]
400 This is different than the BLOCK field in gimple,
401 which is analogous to TREE_BLOCK (i.e., the lexical block holding
402 this statement). This field is the equivalent of BIND_EXPR_BLOCK
403 in tree land (i.e., the lexical scope defined by this bind). See
404 gimple-low.c. */
405 tree block;
407 /* [ WORD 9 ] */
408 gimple_seq body;
412 /* GIMPLE_CATCH */
414 struct GTY((tag("GSS_CATCH")))
415 gcatch : public gimple
417 /* [ WORD 1-6 ] : base class */
419 /* [ WORD 7 ] */
420 tree types;
422 /* [ WORD 8 ] */
423 gimple_seq handler;
427 /* GIMPLE_EH_FILTER */
429 struct GTY((tag("GSS_EH_FILTER")))
430 geh_filter : public gimple
432 /* [ WORD 1-6 ] : base class */
434 /* [ WORD 7 ]
435 Filter types. */
436 tree types;
438 /* [ WORD 8 ]
439 Failure actions. */
440 gimple_seq failure;
443 /* GIMPLE_EH_ELSE */
445 struct GTY((tag("GSS_EH_ELSE")))
446 geh_else : public gimple
448 /* [ WORD 1-6 ] : base class */
450 /* [ WORD 7,8 ] */
451 gimple_seq n_body, e_body;
454 /* GIMPLE_EH_MUST_NOT_THROW */
456 struct GTY((tag("GSS_EH_MNT")))
457 geh_mnt : public gimple
459 /* [ WORD 1-6 ] : base class */
461 /* [ WORD 7 ] Abort function decl. */
462 tree fndecl;
465 /* GIMPLE_PHI */
467 struct GTY((tag("GSS_PHI")))
468 gphi : public gimple
470 /* [ WORD 1-6 ] : base class */
472 /* [ WORD 7 ] */
473 unsigned capacity;
474 unsigned nargs;
476 /* [ WORD 8 ] */
477 tree result;
479 /* [ WORD 9 ] */
480 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
484 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
486 struct GTY((tag("GSS_EH_CTRL")))
487 gimple_statement_eh_ctrl : public gimple
489 /* [ WORD 1-6 ] : base class */
491 /* [ WORD 7 ]
492 Exception region number. */
493 int region;
496 struct GTY((tag("GSS_EH_CTRL")))
497 gresx : public gimple_statement_eh_ctrl
499 /* No extra fields; adds invariant:
500 stmt->code == GIMPLE_RESX. */
503 struct GTY((tag("GSS_EH_CTRL")))
504 geh_dispatch : public gimple_statement_eh_ctrl
506 /* No extra fields; adds invariant:
507 stmt->code == GIMPLE_EH_DISPATH. */
511 /* GIMPLE_TRY */
513 struct GTY((tag("GSS_TRY")))
514 gtry : public gimple
516 /* [ WORD 1-6 ] : base class */
518 /* [ WORD 7 ]
519 Expression to evaluate. */
520 gimple_seq eval;
522 /* [ WORD 8 ]
523 Cleanup expression. */
524 gimple_seq cleanup;
527 /* Kind of GIMPLE_TRY statements. */
528 enum gimple_try_flags
530 /* A try/catch. */
531 GIMPLE_TRY_CATCH = 1 << 0,
533 /* A try/finally. */
534 GIMPLE_TRY_FINALLY = 1 << 1,
535 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
537 /* Analogous to TRY_CATCH_IS_CLEANUP. */
538 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
541 /* GIMPLE_WITH_CLEANUP_EXPR */
543 struct GTY((tag("GSS_WCE")))
544 gimple_statement_wce : public gimple
546 /* [ WORD 1-6 ] : base class */
548 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
549 executed if an exception is thrown, not on normal exit of its
550 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
551 in TARGET_EXPRs. */
553 /* [ WORD 7 ]
554 Cleanup expression. */
555 gimple_seq cleanup;
559 /* GIMPLE_ASM */
561 struct GTY((tag("GSS_ASM")))
562 gasm : public gimple_statement_with_memory_ops_base
564 /* [ WORD 1-9 ] : base class */
566 /* [ WORD 10 ]
567 __asm__ statement. */
568 const char *string;
570 /* [ WORD 11 ]
571 Number of inputs, outputs, clobbers, labels. */
572 unsigned char ni;
573 unsigned char no;
574 unsigned char nc;
575 unsigned char nl;
577 /* [ WORD 12 ]
578 Operand vector. NOTE! This must always be the last field
579 of this structure. In particular, this means that this
580 structure cannot be embedded inside another one. */
581 tree GTY((length ("%h.num_ops"))) op[1];
584 /* GIMPLE_OMP_CRITICAL */
586 struct GTY((tag("GSS_OMP_CRITICAL")))
587 gomp_critical : public gimple_statement_omp
589 /* [ WORD 1-7 ] : base class */
591 /* [ WORD 8 ] */
592 tree clauses;
594 /* [ WORD 9 ]
595 Critical section name. */
596 tree name;
600 struct GTY(()) gimple_omp_for_iter {
601 /* Condition code. */
602 enum tree_code cond;
604 /* Index variable. */
605 tree index;
607 /* Initial value. */
608 tree initial;
610 /* Final value. */
611 tree final;
613 /* Increment. */
614 tree incr;
617 /* GIMPLE_OMP_FOR */
619 struct GTY((tag("GSS_OMP_FOR")))
620 gomp_for : public gimple_statement_omp
622 /* [ WORD 1-7 ] : base class */
624 /* [ WORD 8 ] */
625 tree clauses;
627 /* [ WORD 9 ]
628 Number of elements in iter array. */
629 size_t collapse;
631 /* [ WORD 10 ] */
632 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
634 /* [ WORD 11 ]
635 Pre-body evaluated before the loop body begins. */
636 gimple_seq pre_body;
640 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
642 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
643 gimple_statement_omp_parallel_layout : public gimple_statement_omp
645 /* [ WORD 1-7 ] : base class */
647 /* [ WORD 8 ]
648 Clauses. */
649 tree clauses;
651 /* [ WORD 9 ]
652 Child function holding the body of the parallel region. */
653 tree child_fn;
655 /* [ WORD 10 ]
656 Shared data argument. */
657 tree data_arg;
660 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
661 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
662 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
664 /* No extra fields; adds invariant:
665 stmt->code == GIMPLE_OMP_PARALLEL
666 || stmt->code == GIMPLE_OMP_TASK. */
669 /* GIMPLE_OMP_PARALLEL */
670 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
671 gomp_parallel : public gimple_statement_omp_taskreg
673 /* No extra fields; adds invariant:
674 stmt->code == GIMPLE_OMP_PARALLEL. */
677 /* GIMPLE_OMP_TARGET */
678 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
679 gomp_target : public gimple_statement_omp_parallel_layout
681 /* No extra fields; adds invariant:
682 stmt->code == GIMPLE_OMP_TARGET. */
685 /* GIMPLE_OMP_TASK */
687 struct GTY((tag("GSS_OMP_TASK")))
688 gomp_task : public gimple_statement_omp_taskreg
690 /* [ WORD 1-10 ] : base class */
692 /* [ WORD 11 ]
693 Child function holding firstprivate initialization if needed. */
694 tree copy_fn;
696 /* [ WORD 12-13 ]
697 Size and alignment in bytes of the argument data block. */
698 tree arg_size;
699 tree arg_align;
703 /* GIMPLE_OMP_SECTION */
704 /* Uses struct gimple_statement_omp. */
707 /* GIMPLE_OMP_SECTIONS */
709 struct GTY((tag("GSS_OMP_SECTIONS")))
710 gomp_sections : public gimple_statement_omp
712 /* [ WORD 1-7 ] : base class */
714 /* [ WORD 8 ] */
715 tree clauses;
717 /* [ WORD 9 ]
718 The control variable used for deciding which of the sections to
719 execute. */
720 tree control;
723 /* GIMPLE_OMP_CONTINUE.
725 Note: This does not inherit from gimple_statement_omp, because we
726 do not need the body field. */
728 struct GTY((tag("GSS_OMP_CONTINUE")))
729 gomp_continue : public gimple
731 /* [ WORD 1-6 ] : base class */
733 /* [ WORD 7 ] */
734 tree control_def;
736 /* [ WORD 8 ] */
737 tree control_use;
740 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
742 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
743 gimple_statement_omp_single_layout : public gimple_statement_omp
745 /* [ WORD 1-7 ] : base class */
747 /* [ WORD 8 ] */
748 tree clauses;
751 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
752 gomp_single : public gimple_statement_omp_single_layout
754 /* No extra fields; adds invariant:
755 stmt->code == GIMPLE_OMP_SINGLE. */
758 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
759 gomp_teams : public gimple_statement_omp_single_layout
761 /* No extra fields; adds invariant:
762 stmt->code == GIMPLE_OMP_TEAMS. */
765 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
766 gomp_ordered : public gimple_statement_omp_single_layout
768 /* No extra fields; adds invariant:
769 stmt->code == GIMPLE_OMP_ORDERED. */
773 /* GIMPLE_OMP_ATOMIC_LOAD.
774 Note: This is based on gimple, not g_s_omp, because g_s_omp
775 contains a sequence, which we don't need here. */
777 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
778 gomp_atomic_load : public gimple
780 /* [ WORD 1-6 ] : base class */
782 /* [ WORD 7-8 ] */
783 tree rhs, lhs;
786 /* GIMPLE_OMP_ATOMIC_STORE.
787 See note on GIMPLE_OMP_ATOMIC_LOAD. */
789 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
790 gimple_statement_omp_atomic_store_layout : public gimple
792 /* [ WORD 1-6 ] : base class */
794 /* [ WORD 7 ] */
795 tree val;
798 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
799 gomp_atomic_store :
800 public gimple_statement_omp_atomic_store_layout
802 /* No extra fields; adds invariant:
803 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
806 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
807 gimple_statement_omp_return :
808 public gimple_statement_omp_atomic_store_layout
810 /* No extra fields; adds invariant:
811 stmt->code == GIMPLE_OMP_RETURN. */
814 /* GIMPLE_TRANSACTION. */
816 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
818 /* The __transaction_atomic was declared [[outer]] or it is
819 __transaction_relaxed. */
820 #define GTMA_IS_OUTER (1u << 0)
821 #define GTMA_IS_RELAXED (1u << 1)
822 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
824 /* The transaction is seen to not have an abort. */
825 #define GTMA_HAVE_ABORT (1u << 2)
826 /* The transaction is seen to have loads or stores. */
827 #define GTMA_HAVE_LOAD (1u << 3)
828 #define GTMA_HAVE_STORE (1u << 4)
829 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
830 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
831 /* The transaction WILL enter serial irrevocable mode.
832 An irrevocable block post-dominates the entire transaction, such
833 that all invocations of the transaction will go serial-irrevocable.
834 In such case, we don't bother instrumenting the transaction, and
835 tell the runtime that it should begin the transaction in
836 serial-irrevocable mode. */
837 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
838 /* The transaction contains no instrumentation code whatsover, most
839 likely because it is guaranteed to go irrevocable upon entry. */
840 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
842 struct GTY((tag("GSS_TRANSACTION")))
843 gtransaction : public gimple_statement_with_memory_ops_base
845 /* [ WORD 1-9 ] : base class */
847 /* [ WORD 10 ] */
848 gimple_seq body;
850 /* [ WORD 11-13 ] */
851 tree label_norm;
852 tree label_uninst;
853 tree label_over;
856 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
857 enum gimple_statement_structure_enum {
858 #include "gsstruct.def"
859 LAST_GSS_ENUM
861 #undef DEFGSSTRUCT
863 /* A statement with the invariant that
864 stmt->code == GIMPLE_COND
865 i.e. a conditional jump statement. */
867 struct GTY((tag("GSS_WITH_OPS")))
868 gcond : public gimple_statement_with_ops
870 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
871 static const enum gimple_code code_ = GIMPLE_COND;
874 /* A statement with the invariant that
875 stmt->code == GIMPLE_DEBUG
876 i.e. a debug statement. */
878 struct GTY((tag("GSS_WITH_OPS")))
879 gdebug : public gimple_statement_with_ops
881 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
884 /* A statement with the invariant that
885 stmt->code == GIMPLE_GOTO
886 i.e. a goto statement. */
888 struct GTY((tag("GSS_WITH_OPS")))
889 ggoto : public gimple_statement_with_ops
891 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
894 /* A statement with the invariant that
895 stmt->code == GIMPLE_LABEL
896 i.e. a label statement. */
898 struct GTY((tag("GSS_WITH_OPS")))
899 glabel : public gimple_statement_with_ops
901 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
904 /* A statement with the invariant that
905 stmt->code == GIMPLE_SWITCH
906 i.e. a switch statement. */
908 struct GTY((tag("GSS_WITH_OPS")))
909 gswitch : public gimple_statement_with_ops
911 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
914 /* A statement with the invariant that
915 stmt->code == GIMPLE_ASSIGN
916 i.e. an assignment statement. */
918 struct GTY((tag("GSS_WITH_MEM_OPS")))
919 gassign : public gimple_statement_with_memory_ops
921 static const enum gimple_code code_ = GIMPLE_ASSIGN;
922 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
925 /* A statement with the invariant that
926 stmt->code == GIMPLE_RETURN
927 i.e. a return statement. */
929 struct GTY((tag("GSS_WITH_MEM_OPS")))
930 greturn : public gimple_statement_with_memory_ops
932 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
935 template <>
936 template <>
937 inline bool
938 is_a_helper <gasm *>::test (gimple *gs)
940 return gs->code == GIMPLE_ASM;
943 template <>
944 template <>
945 inline bool
946 is_a_helper <gassign *>::test (gimple *gs)
948 return gs->code == GIMPLE_ASSIGN;
951 template <>
952 template <>
953 inline bool
954 is_a_helper <const gassign *>::test (const gimple *gs)
956 return gs->code == GIMPLE_ASSIGN;
959 template <>
960 template <>
961 inline bool
962 is_a_helper <gbind *>::test (gimple *gs)
964 return gs->code == GIMPLE_BIND;
967 template <>
968 template <>
969 inline bool
970 is_a_helper <gcall *>::test (gimple *gs)
972 return gs->code == GIMPLE_CALL;
975 template <>
976 template <>
977 inline bool
978 is_a_helper <gcatch *>::test (gimple *gs)
980 return gs->code == GIMPLE_CATCH;
983 template <>
984 template <>
985 inline bool
986 is_a_helper <gcond *>::test (gimple *gs)
988 return gs->code == GIMPLE_COND;
991 template <>
992 template <>
993 inline bool
994 is_a_helper <const gcond *>::test (const gimple *gs)
996 return gs->code == GIMPLE_COND;
999 template <>
1000 template <>
1001 inline bool
1002 is_a_helper <gdebug *>::test (gimple *gs)
1004 return gs->code == GIMPLE_DEBUG;
1007 template <>
1008 template <>
1009 inline bool
1010 is_a_helper <ggoto *>::test (gimple *gs)
1012 return gs->code == GIMPLE_GOTO;
1015 template <>
1016 template <>
1017 inline bool
1018 is_a_helper <glabel *>::test (gimple *gs)
1020 return gs->code == GIMPLE_LABEL;
1023 template <>
1024 template <>
1025 inline bool
1026 is_a_helper <gresx *>::test (gimple *gs)
1028 return gs->code == GIMPLE_RESX;
1031 template <>
1032 template <>
1033 inline bool
1034 is_a_helper <geh_dispatch *>::test (gimple *gs)
1036 return gs->code == GIMPLE_EH_DISPATCH;
1039 template <>
1040 template <>
1041 inline bool
1042 is_a_helper <geh_else *>::test (gimple *gs)
1044 return gs->code == GIMPLE_EH_ELSE;
1047 template <>
1048 template <>
1049 inline bool
1050 is_a_helper <geh_filter *>::test (gimple *gs)
1052 return gs->code == GIMPLE_EH_FILTER;
1055 template <>
1056 template <>
1057 inline bool
1058 is_a_helper <geh_mnt *>::test (gimple *gs)
1060 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1063 template <>
1064 template <>
1065 inline bool
1066 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1068 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1071 template <>
1072 template <>
1073 inline bool
1074 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1076 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1079 template <>
1080 template <>
1081 inline bool
1082 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1084 return gs->code == GIMPLE_OMP_RETURN;
1087 template <>
1088 template <>
1089 inline bool
1090 is_a_helper <gomp_continue *>::test (gimple *gs)
1092 return gs->code == GIMPLE_OMP_CONTINUE;
1095 template <>
1096 template <>
1097 inline bool
1098 is_a_helper <gomp_critical *>::test (gimple *gs)
1100 return gs->code == GIMPLE_OMP_CRITICAL;
1103 template <>
1104 template <>
1105 inline bool
1106 is_a_helper <gomp_ordered *>::test (gimple *gs)
1108 return gs->code == GIMPLE_OMP_ORDERED;
1111 template <>
1112 template <>
1113 inline bool
1114 is_a_helper <gomp_for *>::test (gimple *gs)
1116 return gs->code == GIMPLE_OMP_FOR;
1119 template <>
1120 template <>
1121 inline bool
1122 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1124 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1127 template <>
1128 template <>
1129 inline bool
1130 is_a_helper <gomp_parallel *>::test (gimple *gs)
1132 return gs->code == GIMPLE_OMP_PARALLEL;
1135 template <>
1136 template <>
1137 inline bool
1138 is_a_helper <gomp_target *>::test (gimple *gs)
1140 return gs->code == GIMPLE_OMP_TARGET;
1143 template <>
1144 template <>
1145 inline bool
1146 is_a_helper <gomp_sections *>::test (gimple *gs)
1148 return gs->code == GIMPLE_OMP_SECTIONS;
1151 template <>
1152 template <>
1153 inline bool
1154 is_a_helper <gomp_single *>::test (gimple *gs)
1156 return gs->code == GIMPLE_OMP_SINGLE;
1159 template <>
1160 template <>
1161 inline bool
1162 is_a_helper <gomp_teams *>::test (gimple *gs)
1164 return gs->code == GIMPLE_OMP_TEAMS;
1167 template <>
1168 template <>
1169 inline bool
1170 is_a_helper <gomp_task *>::test (gimple *gs)
1172 return gs->code == GIMPLE_OMP_TASK;
1175 template <>
1176 template <>
1177 inline bool
1178 is_a_helper <gphi *>::test (gimple *gs)
1180 return gs->code == GIMPLE_PHI;
1183 template <>
1184 template <>
1185 inline bool
1186 is_a_helper <greturn *>::test (gimple *gs)
1188 return gs->code == GIMPLE_RETURN;
1191 template <>
1192 template <>
1193 inline bool
1194 is_a_helper <gswitch *>::test (gimple *gs)
1196 return gs->code == GIMPLE_SWITCH;
1199 template <>
1200 template <>
1201 inline bool
1202 is_a_helper <gtransaction *>::test (gimple *gs)
1204 return gs->code == GIMPLE_TRANSACTION;
1207 template <>
1208 template <>
1209 inline bool
1210 is_a_helper <gtry *>::test (gimple *gs)
1212 return gs->code == GIMPLE_TRY;
1215 template <>
1216 template <>
1217 inline bool
1218 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1220 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1223 template <>
1224 template <>
1225 inline bool
1226 is_a_helper <const gasm *>::test (const gimple *gs)
1228 return gs->code == GIMPLE_ASM;
1231 template <>
1232 template <>
1233 inline bool
1234 is_a_helper <const gbind *>::test (const gimple *gs)
1236 return gs->code == GIMPLE_BIND;
1239 template <>
1240 template <>
1241 inline bool
1242 is_a_helper <const gcall *>::test (const gimple *gs)
1244 return gs->code == GIMPLE_CALL;
1247 template <>
1248 template <>
1249 inline bool
1250 is_a_helper <const gcatch *>::test (const gimple *gs)
1252 return gs->code == GIMPLE_CATCH;
1255 template <>
1256 template <>
1257 inline bool
1258 is_a_helper <const gresx *>::test (const gimple *gs)
1260 return gs->code == GIMPLE_RESX;
1263 template <>
1264 template <>
1265 inline bool
1266 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1268 return gs->code == GIMPLE_EH_DISPATCH;
1271 template <>
1272 template <>
1273 inline bool
1274 is_a_helper <const geh_filter *>::test (const gimple *gs)
1276 return gs->code == GIMPLE_EH_FILTER;
1279 template <>
1280 template <>
1281 inline bool
1282 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1284 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1287 template <>
1288 template <>
1289 inline bool
1290 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1292 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1295 template <>
1296 template <>
1297 inline bool
1298 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1300 return gs->code == GIMPLE_OMP_RETURN;
1303 template <>
1304 template <>
1305 inline bool
1306 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1308 return gs->code == GIMPLE_OMP_CONTINUE;
1311 template <>
1312 template <>
1313 inline bool
1314 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1316 return gs->code == GIMPLE_OMP_CRITICAL;
1319 template <>
1320 template <>
1321 inline bool
1322 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1324 return gs->code == GIMPLE_OMP_ORDERED;
1327 template <>
1328 template <>
1329 inline bool
1330 is_a_helper <const gomp_for *>::test (const gimple *gs)
1332 return gs->code == GIMPLE_OMP_FOR;
1335 template <>
1336 template <>
1337 inline bool
1338 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1340 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1343 template <>
1344 template <>
1345 inline bool
1346 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1348 return gs->code == GIMPLE_OMP_PARALLEL;
1351 template <>
1352 template <>
1353 inline bool
1354 is_a_helper <const gomp_target *>::test (const gimple *gs)
1356 return gs->code == GIMPLE_OMP_TARGET;
1359 template <>
1360 template <>
1361 inline bool
1362 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1364 return gs->code == GIMPLE_OMP_SECTIONS;
1367 template <>
1368 template <>
1369 inline bool
1370 is_a_helper <const gomp_single *>::test (const gimple *gs)
1372 return gs->code == GIMPLE_OMP_SINGLE;
1375 template <>
1376 template <>
1377 inline bool
1378 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1380 return gs->code == GIMPLE_OMP_TEAMS;
1383 template <>
1384 template <>
1385 inline bool
1386 is_a_helper <const gomp_task *>::test (const gimple *gs)
1388 return gs->code == GIMPLE_OMP_TASK;
1391 template <>
1392 template <>
1393 inline bool
1394 is_a_helper <const gphi *>::test (const gimple *gs)
1396 return gs->code == GIMPLE_PHI;
1399 template <>
1400 template <>
1401 inline bool
1402 is_a_helper <const gtransaction *>::test (const gimple *gs)
1404 return gs->code == GIMPLE_TRANSACTION;
1407 /* Offset in bytes to the location of the operand vector.
1408 Zero if there is no operand vector for this tuple structure. */
1409 extern size_t const gimple_ops_offset_[];
1411 /* Map GIMPLE codes to GSS codes. */
1412 extern enum gimple_statement_structure_enum const gss_for_code_[];
1414 /* This variable holds the currently expanded gimple statement for purposes
1415 of comminucating the profile info to the builtin expanders. */
1416 extern gimple *currently_expanding_gimple_stmt;
1418 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1419 greturn *gimple_build_return (tree);
1420 void gimple_call_reset_alias_info (gcall *);
1421 gcall *gimple_build_call_vec (tree, vec<tree> );
1422 gcall *gimple_build_call (tree, unsigned, ...);
1423 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1424 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1425 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1426 gcall *gimple_build_call_from_tree (tree, tree);
1427 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1428 gassign *gimple_build_assign (tree, enum tree_code,
1429 tree, tree, tree CXX_MEM_STAT_INFO);
1430 gassign *gimple_build_assign (tree, enum tree_code,
1431 tree, tree CXX_MEM_STAT_INFO);
1432 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1433 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1434 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1435 void gimple_cond_set_condition_from_tree (gcond *, tree);
1436 glabel *gimple_build_label (tree label);
1437 ggoto *gimple_build_goto (tree dest);
1438 gimple *gimple_build_nop (void);
1439 gbind *gimple_build_bind (tree, gimple_seq, tree);
1440 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1441 vec<tree, va_gc> *, vec<tree, va_gc> *,
1442 vec<tree, va_gc> *);
1443 gcatch *gimple_build_catch (tree, gimple_seq);
1444 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1445 geh_mnt *gimple_build_eh_must_not_throw (tree);
1446 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1447 gtry *gimple_build_try (gimple_seq, gimple_seq,
1448 enum gimple_try_flags);
1449 gimple *gimple_build_wce (gimple_seq);
1450 gresx *gimple_build_resx (int);
1451 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1452 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1453 geh_dispatch *gimple_build_eh_dispatch (int);
1454 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1455 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1456 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1457 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1458 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1459 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1460 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1461 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1462 tree, tree);
1463 gimple *gimple_build_omp_section (gimple_seq);
1464 gimple *gimple_build_omp_master (gimple_seq);
1465 gimple *gimple_build_omp_grid_body (gimple_seq);
1466 gimple *gimple_build_omp_taskgroup (gimple_seq);
1467 gomp_continue *gimple_build_omp_continue (tree, tree);
1468 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1469 gimple *gimple_build_omp_return (bool);
1470 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1471 gimple *gimple_build_omp_sections_switch (void);
1472 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1473 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1474 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1475 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1476 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1477 gtransaction *gimple_build_transaction (gimple_seq);
1478 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1479 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1480 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1481 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1482 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1483 location_t);
1484 extern void annotate_all_with_location (gimple_seq, location_t);
1485 bool empty_body_p (gimple_seq);
1486 gimple_seq gimple_seq_copy (gimple_seq);
1487 bool gimple_call_same_target_p (const gimple *, const gimple *);
1488 int gimple_call_flags (const gimple *);
1489 int gimple_call_arg_flags (const gcall *, unsigned);
1490 int gimple_call_return_flags (const gcall *);
1491 bool gimple_call_nonnull_result_p (gcall *);
1492 tree gimple_call_nonnull_arg (gcall *);
1493 bool gimple_assign_copy_p (gimple *);
1494 bool gimple_assign_ssa_name_copy_p (gimple *);
1495 bool gimple_assign_unary_nop_p (gimple *);
1496 void gimple_set_bb (gimple *, basic_block);
1497 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1498 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1499 tree, tree, tree);
1500 tree gimple_get_lhs (const gimple *);
1501 void gimple_set_lhs (gimple *, tree);
1502 gimple *gimple_copy (gimple *);
1503 bool gimple_has_side_effects (const gimple *);
1504 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1505 bool gimple_could_trap_p (gimple *);
1506 bool gimple_assign_rhs_could_trap_p (gimple *);
1507 extern void dump_gimple_statistics (void);
1508 unsigned get_gimple_rhs_num_ops (enum tree_code);
1509 extern tree canonicalize_cond_expr_cond (tree);
1510 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1511 extern bool gimple_compare_field_offset (tree, tree);
1512 extern tree gimple_unsigned_type (tree);
1513 extern tree gimple_signed_type (tree);
1514 extern alias_set_type gimple_get_alias_set (tree);
1515 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1516 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1517 extern combined_fn gimple_call_combined_fn (const gimple *);
1518 extern bool gimple_call_builtin_p (const gimple *);
1519 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1520 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1521 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1522 extern void dump_decl_set (FILE *, bitmap);
1523 extern bool nonfreeing_call_p (gimple *);
1524 extern bool nonbarrier_call_p (gimple *);
1525 extern bool infer_nonnull_range (gimple *, tree);
1526 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1527 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1528 extern void sort_case_labels (vec<tree>);
1529 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1530 extern void gimple_seq_set_location (gimple_seq, location_t);
1531 extern void gimple_seq_discard (gimple_seq);
1532 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1533 extern bool gimple_inexpensive_call_p (gcall *);
1534 extern bool stmt_can_terminate_bb_p (gimple *);
1536 /* Formal (expression) temporary table handling: multiple occurrences of
1537 the same scalar expression are evaluated into the same temporary. */
1539 typedef struct gimple_temp_hash_elt
1541 tree val; /* Key */
1542 tree temp; /* Value */
1543 } elt_t;
1545 /* Get the number of the next statement uid to be allocated. */
1546 static inline unsigned int
1547 gimple_stmt_max_uid (struct function *fn)
1549 return fn->last_stmt_uid;
1552 /* Set the number of the next statement uid to be allocated. */
1553 static inline void
1554 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1556 fn->last_stmt_uid = maxid;
1559 /* Set the number of the next statement uid to be allocated. */
1560 static inline unsigned int
1561 inc_gimple_stmt_max_uid (struct function *fn)
1563 return fn->last_stmt_uid++;
1566 /* Return the first node in GIMPLE sequence S. */
1568 static inline gimple_seq_node
1569 gimple_seq_first (gimple_seq s)
1571 return s;
1575 /* Return the first statement in GIMPLE sequence S. */
1577 static inline gimple *
1578 gimple_seq_first_stmt (gimple_seq s)
1580 gimple_seq_node n = gimple_seq_first (s);
1581 return n;
1584 /* Return the first statement in GIMPLE sequence S as a gbind *,
1585 verifying that it has code GIMPLE_BIND in a checked build. */
1587 static inline gbind *
1588 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1590 gimple_seq_node n = gimple_seq_first (s);
1591 return as_a <gbind *> (n);
1595 /* Return the last node in GIMPLE sequence S. */
1597 static inline gimple_seq_node
1598 gimple_seq_last (gimple_seq s)
1600 return s ? s->prev : NULL;
1604 /* Return the last statement in GIMPLE sequence S. */
1606 static inline gimple *
1607 gimple_seq_last_stmt (gimple_seq s)
1609 gimple_seq_node n = gimple_seq_last (s);
1610 return n;
1614 /* Set the last node in GIMPLE sequence *PS to LAST. */
1616 static inline void
1617 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1619 (*ps)->prev = last;
1623 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1625 static inline void
1626 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1628 *ps = first;
1632 /* Return true if GIMPLE sequence S is empty. */
1634 static inline bool
1635 gimple_seq_empty_p (gimple_seq s)
1637 return s == NULL;
1640 /* Allocate a new sequence and initialize its first element with STMT. */
1642 static inline gimple_seq
1643 gimple_seq_alloc_with_stmt (gimple *stmt)
1645 gimple_seq seq = NULL;
1646 gimple_seq_add_stmt (&seq, stmt);
1647 return seq;
1651 /* Returns the sequence of statements in BB. */
1653 static inline gimple_seq
1654 bb_seq (const_basic_block bb)
1656 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1659 static inline gimple_seq *
1660 bb_seq_addr (basic_block bb)
1662 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1665 /* Sets the sequence of statements in BB to SEQ. */
1667 static inline void
1668 set_bb_seq (basic_block bb, gimple_seq seq)
1670 gcc_checking_assert (!(bb->flags & BB_RTL));
1671 bb->il.gimple.seq = seq;
1675 /* Return the code for GIMPLE statement G. */
1677 static inline enum gimple_code
1678 gimple_code (const gimple *g)
1680 return g->code;
1684 /* Return the GSS code used by a GIMPLE code. */
1686 static inline enum gimple_statement_structure_enum
1687 gss_for_code (enum gimple_code code)
1689 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1690 return gss_for_code_[code];
1694 /* Return which GSS code is used by GS. */
1696 static inline enum gimple_statement_structure_enum
1697 gimple_statement_structure (gimple *gs)
1699 return gss_for_code (gimple_code (gs));
1703 /* Return true if statement G has sub-statements. This is only true for
1704 High GIMPLE statements. */
1706 static inline bool
1707 gimple_has_substatements (gimple *g)
1709 switch (gimple_code (g))
1711 case GIMPLE_BIND:
1712 case GIMPLE_CATCH:
1713 case GIMPLE_EH_FILTER:
1714 case GIMPLE_EH_ELSE:
1715 case GIMPLE_TRY:
1716 case GIMPLE_OMP_FOR:
1717 case GIMPLE_OMP_MASTER:
1718 case GIMPLE_OMP_TASKGROUP:
1719 case GIMPLE_OMP_ORDERED:
1720 case GIMPLE_OMP_SECTION:
1721 case GIMPLE_OMP_PARALLEL:
1722 case GIMPLE_OMP_TASK:
1723 case GIMPLE_OMP_SECTIONS:
1724 case GIMPLE_OMP_SINGLE:
1725 case GIMPLE_OMP_TARGET:
1726 case GIMPLE_OMP_TEAMS:
1727 case GIMPLE_OMP_CRITICAL:
1728 case GIMPLE_WITH_CLEANUP_EXPR:
1729 case GIMPLE_TRANSACTION:
1730 case GIMPLE_OMP_GRID_BODY:
1731 return true;
1733 default:
1734 return false;
1739 /* Return the basic block holding statement G. */
1741 static inline basic_block
1742 gimple_bb (const gimple *g)
1744 return g->bb;
1748 /* Return the lexical scope block holding statement G. */
1750 static inline tree
1751 gimple_block (const gimple *g)
1753 return LOCATION_BLOCK (g->location);
1757 /* Set BLOCK to be the lexical scope block holding statement G. */
1759 static inline void
1760 gimple_set_block (gimple *g, tree block)
1762 g->location = set_block (g->location, block);
1766 /* Return location information for statement G. */
1768 static inline location_t
1769 gimple_location (const gimple *g)
1771 return g->location;
1774 /* Return location information for statement G if g is not NULL.
1775 Otherwise, UNKNOWN_LOCATION is returned. */
1777 static inline location_t
1778 gimple_location_safe (const gimple *g)
1780 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1783 /* Set location information for statement G. */
1785 static inline void
1786 gimple_set_location (gimple *g, location_t location)
1788 g->location = location;
1792 /* Return true if G contains location information. */
1794 static inline bool
1795 gimple_has_location (const gimple *g)
1797 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1801 /* Return non-artificial location information for statement G. */
1803 static inline location_t
1804 gimple_nonartificial_location (const gimple *g)
1806 location_t *ploc = NULL;
1808 if (tree block = gimple_block (g))
1809 ploc = block_nonartificial_location (block);
1811 return ploc ? *ploc : gimple_location (g);
1815 /* Return the file name of the location of STMT. */
1817 static inline const char *
1818 gimple_filename (const gimple *stmt)
1820 return LOCATION_FILE (gimple_location (stmt));
1824 /* Return the line number of the location of STMT. */
1826 static inline int
1827 gimple_lineno (const gimple *stmt)
1829 return LOCATION_LINE (gimple_location (stmt));
1833 /* Determine whether SEQ is a singleton. */
1835 static inline bool
1836 gimple_seq_singleton_p (gimple_seq seq)
1838 return ((gimple_seq_first (seq) != NULL)
1839 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1842 /* Return true if no warnings should be emitted for statement STMT. */
1844 static inline bool
1845 gimple_no_warning_p (const gimple *stmt)
1847 return stmt->no_warning;
1850 /* Set the no_warning flag of STMT to NO_WARNING. */
1852 static inline void
1853 gimple_set_no_warning (gimple *stmt, bool no_warning)
1855 stmt->no_warning = (unsigned) no_warning;
1858 /* Set the visited status on statement STMT to VISITED_P.
1860 Please note that this 'visited' property of the gimple statement is
1861 supposed to be undefined at pass boundaries. This means that a
1862 given pass should not assume it contains any useful value when the
1863 pass starts and thus can set it to any value it sees fit.
1865 You can learn more about the visited property of the gimple
1866 statement by reading the comments of the 'visited' data member of
1867 struct gimple.
1870 static inline void
1871 gimple_set_visited (gimple *stmt, bool visited_p)
1873 stmt->visited = (unsigned) visited_p;
1877 /* Return the visited status for statement STMT.
1879 Please note that this 'visited' property of the gimple statement is
1880 supposed to be undefined at pass boundaries. This means that a
1881 given pass should not assume it contains any useful value when the
1882 pass starts and thus can set it to any value it sees fit.
1884 You can learn more about the visited property of the gimple
1885 statement by reading the comments of the 'visited' data member of
1886 struct gimple. */
1888 static inline bool
1889 gimple_visited_p (gimple *stmt)
1891 return stmt->visited;
1895 /* Set pass local flag PLF on statement STMT to VAL_P.
1897 Please note that this PLF property of the gimple statement is
1898 supposed to be undefined at pass boundaries. This means that a
1899 given pass should not assume it contains any useful value when the
1900 pass starts and thus can set it to any value it sees fit.
1902 You can learn more about the PLF property by reading the comment of
1903 the 'plf' data member of struct gimple_statement_structure. */
1905 static inline void
1906 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1908 if (val_p)
1909 stmt->plf |= (unsigned int) plf;
1910 else
1911 stmt->plf &= ~((unsigned int) plf);
1915 /* Return the value of pass local flag PLF on statement STMT.
1917 Please note that this 'plf' property of the gimple statement is
1918 supposed to be undefined at pass boundaries. This means that a
1919 given pass should not assume it contains any useful value when the
1920 pass starts and thus can set it to any value it sees fit.
1922 You can learn more about the plf property by reading the comment of
1923 the 'plf' data member of struct gimple_statement_structure. */
1925 static inline unsigned int
1926 gimple_plf (gimple *stmt, enum plf_mask plf)
1928 return stmt->plf & ((unsigned int) plf);
1932 /* Set the UID of statement.
1934 Please note that this UID property is supposed to be undefined at
1935 pass boundaries. This means that a given pass should not assume it
1936 contains any useful value when the pass starts and thus can set it
1937 to any value it sees fit. */
1939 static inline void
1940 gimple_set_uid (gimple *g, unsigned uid)
1942 g->uid = uid;
1946 /* Return the UID of statement.
1948 Please note that this UID property is supposed to be undefined at
1949 pass boundaries. This means that a given pass should not assume it
1950 contains any useful value when the pass starts and thus can set it
1951 to any value it sees fit. */
1953 static inline unsigned
1954 gimple_uid (const gimple *g)
1956 return g->uid;
1960 /* Make statement G a singleton sequence. */
1962 static inline void
1963 gimple_init_singleton (gimple *g)
1965 g->next = NULL;
1966 g->prev = g;
1970 /* Return true if GIMPLE statement G has register or memory operands. */
1972 static inline bool
1973 gimple_has_ops (const gimple *g)
1975 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1978 template <>
1979 template <>
1980 inline bool
1981 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1983 return gimple_has_ops (gs);
1986 template <>
1987 template <>
1988 inline bool
1989 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1991 return gimple_has_ops (gs);
1994 /* Return true if GIMPLE statement G has memory operands. */
1996 static inline bool
1997 gimple_has_mem_ops (const gimple *g)
1999 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2002 template <>
2003 template <>
2004 inline bool
2005 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2007 return gimple_has_mem_ops (gs);
2010 template <>
2011 template <>
2012 inline bool
2013 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2015 return gimple_has_mem_ops (gs);
2018 /* Return the set of USE operands for statement G. */
2020 static inline struct use_optype_d *
2021 gimple_use_ops (const gimple *g)
2023 const gimple_statement_with_ops *ops_stmt =
2024 dyn_cast <const gimple_statement_with_ops *> (g);
2025 if (!ops_stmt)
2026 return NULL;
2027 return ops_stmt->use_ops;
2031 /* Set USE to be the set of USE operands for statement G. */
2033 static inline void
2034 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2036 gimple_statement_with_ops *ops_stmt =
2037 as_a <gimple_statement_with_ops *> (g);
2038 ops_stmt->use_ops = use;
2042 /* Return the single VUSE operand of the statement G. */
2044 static inline tree
2045 gimple_vuse (const gimple *g)
2047 const gimple_statement_with_memory_ops *mem_ops_stmt =
2048 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2049 if (!mem_ops_stmt)
2050 return NULL_TREE;
2051 return mem_ops_stmt->vuse;
2054 /* Return the single VDEF operand of the statement G. */
2056 static inline tree
2057 gimple_vdef (const gimple *g)
2059 const gimple_statement_with_memory_ops *mem_ops_stmt =
2060 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2061 if (!mem_ops_stmt)
2062 return NULL_TREE;
2063 return mem_ops_stmt->vdef;
2066 /* Return the single VUSE operand of the statement G. */
2068 static inline tree *
2069 gimple_vuse_ptr (gimple *g)
2071 gimple_statement_with_memory_ops *mem_ops_stmt =
2072 dyn_cast <gimple_statement_with_memory_ops *> (g);
2073 if (!mem_ops_stmt)
2074 return NULL;
2075 return &mem_ops_stmt->vuse;
2078 /* Return the single VDEF operand of the statement G. */
2080 static inline tree *
2081 gimple_vdef_ptr (gimple *g)
2083 gimple_statement_with_memory_ops *mem_ops_stmt =
2084 dyn_cast <gimple_statement_with_memory_ops *> (g);
2085 if (!mem_ops_stmt)
2086 return NULL;
2087 return &mem_ops_stmt->vdef;
2090 /* Set the single VUSE operand of the statement G. */
2092 static inline void
2093 gimple_set_vuse (gimple *g, tree vuse)
2095 gimple_statement_with_memory_ops *mem_ops_stmt =
2096 as_a <gimple_statement_with_memory_ops *> (g);
2097 mem_ops_stmt->vuse = vuse;
2100 /* Set the single VDEF operand of the statement G. */
2102 static inline void
2103 gimple_set_vdef (gimple *g, tree vdef)
2105 gimple_statement_with_memory_ops *mem_ops_stmt =
2106 as_a <gimple_statement_with_memory_ops *> (g);
2107 mem_ops_stmt->vdef = vdef;
2111 /* Return true if statement G has operands and the modified field has
2112 been set. */
2114 static inline bool
2115 gimple_modified_p (const gimple *g)
2117 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2121 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2122 a MODIFIED field. */
2124 static inline void
2125 gimple_set_modified (gimple *s, bool modifiedp)
2127 if (gimple_has_ops (s))
2128 s->modified = (unsigned) modifiedp;
2132 /* Return the tree code for the expression computed by STMT. This is
2133 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2134 GIMPLE_CALL, return CALL_EXPR as the expression code for
2135 consistency. This is useful when the caller needs to deal with the
2136 three kinds of computation that GIMPLE supports. */
2138 static inline enum tree_code
2139 gimple_expr_code (const gimple *stmt)
2141 enum gimple_code code = gimple_code (stmt);
2142 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2143 return (enum tree_code) stmt->subcode;
2144 else
2146 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2147 return CALL_EXPR;
2152 /* Return true if statement STMT contains volatile operands. */
2154 static inline bool
2155 gimple_has_volatile_ops (const gimple *stmt)
2157 if (gimple_has_mem_ops (stmt))
2158 return stmt->has_volatile_ops;
2159 else
2160 return false;
2164 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2166 static inline void
2167 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2169 if (gimple_has_mem_ops (stmt))
2170 stmt->has_volatile_ops = (unsigned) volatilep;
2173 /* Return true if STMT is in a transaction. */
2175 static inline bool
2176 gimple_in_transaction (const gimple *stmt)
2178 return bb_in_transaction (gimple_bb (stmt));
2181 /* Return true if statement STMT may access memory. */
2183 static inline bool
2184 gimple_references_memory_p (gimple *stmt)
2186 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2190 /* Return the subcode for OMP statement S. */
2192 static inline unsigned
2193 gimple_omp_subcode (const gimple *s)
2195 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2196 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2197 return s->subcode;
2200 /* Set the subcode for OMP statement S to SUBCODE. */
2202 static inline void
2203 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2205 /* We only have 16 bits for the subcode. Assert that we are not
2206 overflowing it. */
2207 gcc_gimple_checking_assert (subcode < (1 << 16));
2208 s->subcode = subcode;
2211 /* Set the nowait flag on OMP_RETURN statement S. */
2213 static inline void
2214 gimple_omp_return_set_nowait (gimple *s)
2216 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2217 s->subcode |= GF_OMP_RETURN_NOWAIT;
2221 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2222 flag set. */
2224 static inline bool
2225 gimple_omp_return_nowait_p (const gimple *g)
2227 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2228 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2232 /* Set the LHS of OMP return. */
2234 static inline void
2235 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2237 gimple_statement_omp_return *omp_return_stmt =
2238 as_a <gimple_statement_omp_return *> (g);
2239 omp_return_stmt->val = lhs;
2243 /* Get the LHS of OMP return. */
2245 static inline tree
2246 gimple_omp_return_lhs (const gimple *g)
2248 const gimple_statement_omp_return *omp_return_stmt =
2249 as_a <const gimple_statement_omp_return *> (g);
2250 return omp_return_stmt->val;
2254 /* Return a pointer to the LHS of OMP return. */
2256 static inline tree *
2257 gimple_omp_return_lhs_ptr (gimple *g)
2259 gimple_statement_omp_return *omp_return_stmt =
2260 as_a <gimple_statement_omp_return *> (g);
2261 return &omp_return_stmt->val;
2265 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2266 flag set. */
2268 static inline bool
2269 gimple_omp_section_last_p (const gimple *g)
2271 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2272 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2276 /* Set the GF_OMP_SECTION_LAST flag on G. */
2278 static inline void
2279 gimple_omp_section_set_last (gimple *g)
2281 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2282 g->subcode |= GF_OMP_SECTION_LAST;
2286 /* Return true if OMP parallel statement G has the
2287 GF_OMP_PARALLEL_COMBINED flag set. */
2289 static inline bool
2290 gimple_omp_parallel_combined_p (const gimple *g)
2292 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2293 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2297 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2298 value of COMBINED_P. */
2300 static inline void
2301 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2303 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2304 if (combined_p)
2305 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2306 else
2307 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2311 /* Return true if OMP atomic load/store statement G has the
2312 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2314 static inline bool
2315 gimple_omp_atomic_need_value_p (const gimple *g)
2317 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2318 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2319 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2323 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2325 static inline void
2326 gimple_omp_atomic_set_need_value (gimple *g)
2328 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2329 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2330 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2334 /* Return true if OMP atomic load/store statement G has the
2335 GF_OMP_ATOMIC_SEQ_CST flag set. */
2337 static inline bool
2338 gimple_omp_atomic_seq_cst_p (const gimple *g)
2340 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2341 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2342 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2346 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2348 static inline void
2349 gimple_omp_atomic_set_seq_cst (gimple *g)
2351 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2352 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2353 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2357 /* Return the number of operands for statement GS. */
2359 static inline unsigned
2360 gimple_num_ops (const gimple *gs)
2362 return gs->num_ops;
2366 /* Set the number of operands for statement GS. */
2368 static inline void
2369 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2371 gs->num_ops = num_ops;
2375 /* Return the array of operands for statement GS. */
2377 static inline tree *
2378 gimple_ops (gimple *gs)
2380 size_t off;
2382 /* All the tuples have their operand vector at the very bottom
2383 of the structure. Note that those structures that do not
2384 have an operand vector have a zero offset. */
2385 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2386 gcc_gimple_checking_assert (off != 0);
2388 return (tree *) ((char *) gs + off);
2392 /* Return operand I for statement GS. */
2394 static inline tree
2395 gimple_op (const gimple *gs, unsigned i)
2397 if (gimple_has_ops (gs))
2399 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2400 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2402 else
2403 return NULL_TREE;
2406 /* Return a pointer to operand I for statement GS. */
2408 static inline tree *
2409 gimple_op_ptr (gimple *gs, unsigned i)
2411 if (gimple_has_ops (gs))
2413 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2414 return gimple_ops (gs) + i;
2416 else
2417 return NULL;
2420 /* Set operand I of statement GS to OP. */
2422 static inline void
2423 gimple_set_op (gimple *gs, unsigned i, tree op)
2425 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2427 /* Note. It may be tempting to assert that OP matches
2428 is_gimple_operand, but that would be wrong. Different tuples
2429 accept slightly different sets of tree operands. Each caller
2430 should perform its own validation. */
2431 gimple_ops (gs)[i] = op;
2434 /* Return true if GS is a GIMPLE_ASSIGN. */
2436 static inline bool
2437 is_gimple_assign (const gimple *gs)
2439 return gimple_code (gs) == GIMPLE_ASSIGN;
2442 /* Determine if expression CODE is one of the valid expressions that can
2443 be used on the RHS of GIMPLE assignments. */
2445 static inline enum gimple_rhs_class
2446 get_gimple_rhs_class (enum tree_code code)
2448 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2451 /* Return the LHS of assignment statement GS. */
2453 static inline tree
2454 gimple_assign_lhs (const gassign *gs)
2456 return gs->op[0];
2459 static inline tree
2460 gimple_assign_lhs (const gimple *gs)
2462 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2463 return gimple_assign_lhs (ass);
2467 /* Return a pointer to the LHS of assignment statement GS. */
2469 static inline tree *
2470 gimple_assign_lhs_ptr (gassign *gs)
2472 return &gs->op[0];
2475 static inline tree *
2476 gimple_assign_lhs_ptr (gimple *gs)
2478 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2479 return gimple_assign_lhs_ptr (ass);
2483 /* Set LHS to be the LHS operand of assignment statement GS. */
2485 static inline void
2486 gimple_assign_set_lhs (gassign *gs, tree lhs)
2488 gs->op[0] = lhs;
2490 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2491 SSA_NAME_DEF_STMT (lhs) = gs;
2494 static inline void
2495 gimple_assign_set_lhs (gimple *gs, tree lhs)
2497 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2498 gimple_assign_set_lhs (ass, lhs);
2502 /* Return the first operand on the RHS of assignment statement GS. */
2504 static inline tree
2505 gimple_assign_rhs1 (const gassign *gs)
2507 return gs->op[1];
2510 static inline tree
2511 gimple_assign_rhs1 (const gimple *gs)
2513 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2514 return gimple_assign_rhs1 (ass);
2518 /* Return a pointer to the first operand on the RHS of assignment
2519 statement GS. */
2521 static inline tree *
2522 gimple_assign_rhs1_ptr (gassign *gs)
2524 return &gs->op[1];
2527 static inline tree *
2528 gimple_assign_rhs1_ptr (gimple *gs)
2530 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2531 return gimple_assign_rhs1_ptr (ass);
2534 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2536 static inline void
2537 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2539 gs->op[1] = rhs;
2542 static inline void
2543 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2545 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2546 gimple_assign_set_rhs1 (ass, rhs);
2550 /* Return the second operand on the RHS of assignment statement GS.
2551 If GS does not have two operands, NULL is returned instead. */
2553 static inline tree
2554 gimple_assign_rhs2 (const gassign *gs)
2556 if (gimple_num_ops (gs) >= 3)
2557 return gs->op[2];
2558 else
2559 return NULL_TREE;
2562 static inline tree
2563 gimple_assign_rhs2 (const gimple *gs)
2565 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2566 return gimple_assign_rhs2 (ass);
2570 /* Return a pointer to the second operand on the RHS of assignment
2571 statement GS. */
2573 static inline tree *
2574 gimple_assign_rhs2_ptr (gassign *gs)
2576 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2577 return &gs->op[2];
2580 static inline tree *
2581 gimple_assign_rhs2_ptr (gimple *gs)
2583 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2584 return gimple_assign_rhs2_ptr (ass);
2588 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2590 static inline void
2591 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2593 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2594 gs->op[2] = rhs;
2597 static inline void
2598 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2600 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2601 return gimple_assign_set_rhs2 (ass, rhs);
2604 /* Return the third operand on the RHS of assignment statement GS.
2605 If GS does not have two operands, NULL is returned instead. */
2607 static inline tree
2608 gimple_assign_rhs3 (const gassign *gs)
2610 if (gimple_num_ops (gs) >= 4)
2611 return gs->op[3];
2612 else
2613 return NULL_TREE;
2616 static inline tree
2617 gimple_assign_rhs3 (const gimple *gs)
2619 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2620 return gimple_assign_rhs3 (ass);
2623 /* Return a pointer to the third operand on the RHS of assignment
2624 statement GS. */
2626 static inline tree *
2627 gimple_assign_rhs3_ptr (gimple *gs)
2629 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2630 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2631 return &ass->op[3];
2635 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2637 static inline void
2638 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2640 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2641 gs->op[3] = rhs;
2644 static inline void
2645 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2647 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2648 gimple_assign_set_rhs3 (ass, rhs);
2652 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2653 which expect to see only two operands. */
2655 static inline void
2656 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2657 tree op1, tree op2)
2659 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2662 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2663 which expect to see only one operands. */
2665 static inline void
2666 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2667 tree op1)
2669 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2672 /* Returns true if GS is a nontemporal move. */
2674 static inline bool
2675 gimple_assign_nontemporal_move_p (const gassign *gs)
2677 return gs->nontemporal_move;
2680 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2682 static inline void
2683 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2685 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2686 gs->nontemporal_move = nontemporal;
2690 /* Return the code of the expression computed on the rhs of assignment
2691 statement GS. In case that the RHS is a single object, returns the
2692 tree code of the object. */
2694 static inline enum tree_code
2695 gimple_assign_rhs_code (const gassign *gs)
2697 enum tree_code code = (enum tree_code) gs->subcode;
2698 /* While we initially set subcode to the TREE_CODE of the rhs for
2699 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2700 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2701 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2702 code = TREE_CODE (gs->op[1]);
2704 return code;
2707 static inline enum tree_code
2708 gimple_assign_rhs_code (const gimple *gs)
2710 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2711 return gimple_assign_rhs_code (ass);
2715 /* Set CODE to be the code for the expression computed on the RHS of
2716 assignment S. */
2718 static inline void
2719 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2721 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2722 s->subcode = code;
2726 /* Return the gimple rhs class of the code of the expression computed on
2727 the rhs of assignment statement GS.
2728 This will never return GIMPLE_INVALID_RHS. */
2730 static inline enum gimple_rhs_class
2731 gimple_assign_rhs_class (const gimple *gs)
2733 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2736 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2737 there is no operator associated with the assignment itself.
2738 Unlike gimple_assign_copy_p, this predicate returns true for
2739 any RHS operand, including those that perform an operation
2740 and do not have the semantics of a copy, such as COND_EXPR. */
2742 static inline bool
2743 gimple_assign_single_p (const gimple *gs)
2745 return (is_gimple_assign (gs)
2746 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2749 /* Return true if GS performs a store to its lhs. */
2751 static inline bool
2752 gimple_store_p (const gimple *gs)
2754 tree lhs = gimple_get_lhs (gs);
2755 return lhs && !is_gimple_reg (lhs);
2758 /* Return true if GS is an assignment that loads from its rhs1. */
2760 static inline bool
2761 gimple_assign_load_p (const gimple *gs)
2763 tree rhs;
2764 if (!gimple_assign_single_p (gs))
2765 return false;
2766 rhs = gimple_assign_rhs1 (gs);
2767 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2768 return true;
2769 rhs = get_base_address (rhs);
2770 return (DECL_P (rhs)
2771 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2775 /* Return true if S is a type-cast assignment. */
2777 static inline bool
2778 gimple_assign_cast_p (const gimple *s)
2780 if (is_gimple_assign (s))
2782 enum tree_code sc = gimple_assign_rhs_code (s);
2783 return CONVERT_EXPR_CODE_P (sc)
2784 || sc == VIEW_CONVERT_EXPR
2785 || sc == FIX_TRUNC_EXPR;
2788 return false;
2791 /* Return true if S is a clobber statement. */
2793 static inline bool
2794 gimple_clobber_p (const gimple *s)
2796 return gimple_assign_single_p (s)
2797 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2800 /* Return true if GS is a GIMPLE_CALL. */
2802 static inline bool
2803 is_gimple_call (const gimple *gs)
2805 return gimple_code (gs) == GIMPLE_CALL;
2808 /* Return the LHS of call statement GS. */
2810 static inline tree
2811 gimple_call_lhs (const gcall *gs)
2813 return gs->op[0];
2816 static inline tree
2817 gimple_call_lhs (const gimple *gs)
2819 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2820 return gimple_call_lhs (gc);
2824 /* Return a pointer to the LHS of call statement GS. */
2826 static inline tree *
2827 gimple_call_lhs_ptr (gcall *gs)
2829 return &gs->op[0];
2832 static inline tree *
2833 gimple_call_lhs_ptr (gimple *gs)
2835 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2836 return gimple_call_lhs_ptr (gc);
2840 /* Set LHS to be the LHS operand of call statement GS. */
2842 static inline void
2843 gimple_call_set_lhs (gcall *gs, tree lhs)
2845 gs->op[0] = lhs;
2846 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2847 SSA_NAME_DEF_STMT (lhs) = gs;
2850 static inline void
2851 gimple_call_set_lhs (gimple *gs, tree lhs)
2853 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2854 gimple_call_set_lhs (gc, lhs);
2858 /* Return true if call GS calls an internal-only function, as enumerated
2859 by internal_fn. */
2861 static inline bool
2862 gimple_call_internal_p (const gcall *gs)
2864 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2867 static inline bool
2868 gimple_call_internal_p (const gimple *gs)
2870 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2871 return gimple_call_internal_p (gc);
2874 /* Return true if call GS is marked as nocf_check. */
2876 static inline bool
2877 gimple_call_nocf_check_p (const gcall *gs)
2879 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2882 /* Mark statement GS as nocf_check call. */
2884 static inline void
2885 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2887 if (nocf_check)
2888 gs->subcode |= GF_CALL_NOCF_CHECK;
2889 else
2890 gs->subcode &= ~GF_CALL_NOCF_CHECK;
2893 /* Return the target of internal call GS. */
2895 static inline enum internal_fn
2896 gimple_call_internal_fn (const gcall *gs)
2898 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2899 return gs->u.internal_fn;
2902 static inline enum internal_fn
2903 gimple_call_internal_fn (const gimple *gs)
2905 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2906 return gimple_call_internal_fn (gc);
2909 /* Return true, if this internal gimple call is unique. */
2911 static inline bool
2912 gimple_call_internal_unique_p (const gcall *gs)
2914 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2917 static inline bool
2918 gimple_call_internal_unique_p (const gimple *gs)
2920 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2921 return gimple_call_internal_unique_p (gc);
2924 /* Return true if GS is an internal function FN. */
2926 static inline bool
2927 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2929 return (is_gimple_call (gs)
2930 && gimple_call_internal_p (gs)
2931 && gimple_call_internal_fn (gs) == fn);
2934 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2935 that could alter control flow. */
2937 static inline void
2938 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2940 if (ctrl_altering_p)
2941 s->subcode |= GF_CALL_CTRL_ALTERING;
2942 else
2943 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2946 static inline void
2947 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2949 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2950 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2953 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2954 flag is set. Such call could not be a stmt in the middle of a bb. */
2956 static inline bool
2957 gimple_call_ctrl_altering_p (const gcall *gs)
2959 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2962 static inline bool
2963 gimple_call_ctrl_altering_p (const gimple *gs)
2965 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2966 return gimple_call_ctrl_altering_p (gc);
2970 /* Return the function type of the function called by GS. */
2972 static inline tree
2973 gimple_call_fntype (const gcall *gs)
2975 if (gimple_call_internal_p (gs))
2976 return NULL_TREE;
2977 return gs->u.fntype;
2980 static inline tree
2981 gimple_call_fntype (const gimple *gs)
2983 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2984 return gimple_call_fntype (call_stmt);
2987 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2989 static inline void
2990 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2992 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2993 call_stmt->u.fntype = fntype;
2997 /* Return the tree node representing the function called by call
2998 statement GS. */
3000 static inline tree
3001 gimple_call_fn (const gcall *gs)
3003 return gs->op[1];
3006 static inline tree
3007 gimple_call_fn (const gimple *gs)
3009 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3010 return gimple_call_fn (gc);
3013 /* Return a pointer to the tree node representing the function called by call
3014 statement GS. */
3016 static inline tree *
3017 gimple_call_fn_ptr (gcall *gs)
3019 return &gs->op[1];
3022 static inline tree *
3023 gimple_call_fn_ptr (gimple *gs)
3025 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3026 return gimple_call_fn_ptr (gc);
3030 /* Set FN to be the function called by call statement GS. */
3032 static inline void
3033 gimple_call_set_fn (gcall *gs, tree fn)
3035 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3036 gs->op[1] = fn;
3040 /* Set FNDECL to be the function called by call statement GS. */
3042 static inline void
3043 gimple_call_set_fndecl (gcall *gs, tree decl)
3045 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3046 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3047 build_pointer_type (TREE_TYPE (decl)), decl);
3050 static inline void
3051 gimple_call_set_fndecl (gimple *gs, tree decl)
3053 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3054 gimple_call_set_fndecl (gc, decl);
3058 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3060 static inline void
3061 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3063 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3064 call_stmt->u.internal_fn = fn;
3068 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3069 Otherwise return NULL. This function is analogous to
3070 get_callee_fndecl in tree land. */
3072 static inline tree
3073 gimple_call_fndecl (const gcall *gs)
3075 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3078 static inline tree
3079 gimple_call_fndecl (const gimple *gs)
3081 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3082 return gimple_call_fndecl (gc);
3086 /* Return the type returned by call statement GS. */
3088 static inline tree
3089 gimple_call_return_type (const gcall *gs)
3091 tree type = gimple_call_fntype (gs);
3093 if (type == NULL_TREE)
3094 return TREE_TYPE (gimple_call_lhs (gs));
3096 /* The type returned by a function is the type of its
3097 function type. */
3098 return TREE_TYPE (type);
3102 /* Return the static chain for call statement GS. */
3104 static inline tree
3105 gimple_call_chain (const gcall *gs)
3107 return gs->op[2];
3110 static inline tree
3111 gimple_call_chain (const gimple *gs)
3113 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3114 return gimple_call_chain (gc);
3118 /* Return a pointer to the static chain for call statement CALL_STMT. */
3120 static inline tree *
3121 gimple_call_chain_ptr (gcall *call_stmt)
3123 return &call_stmt->op[2];
3126 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3128 static inline void
3129 gimple_call_set_chain (gcall *call_stmt, tree chain)
3131 call_stmt->op[2] = chain;
3135 /* Return the number of arguments used by call statement GS. */
3137 static inline unsigned
3138 gimple_call_num_args (const gcall *gs)
3140 return gimple_num_ops (gs) - 3;
3143 static inline unsigned
3144 gimple_call_num_args (const gimple *gs)
3146 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3147 return gimple_call_num_args (gc);
3151 /* Return the argument at position INDEX for call statement GS. */
3153 static inline tree
3154 gimple_call_arg (const gcall *gs, unsigned index)
3156 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3157 return gs->op[index + 3];
3160 static inline tree
3161 gimple_call_arg (const gimple *gs, unsigned index)
3163 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3164 return gimple_call_arg (gc, index);
3168 /* Return a pointer to the argument at position INDEX for call
3169 statement GS. */
3171 static inline tree *
3172 gimple_call_arg_ptr (gcall *gs, unsigned index)
3174 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3175 return &gs->op[index + 3];
3178 static inline tree *
3179 gimple_call_arg_ptr (gimple *gs, unsigned index)
3181 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3182 return gimple_call_arg_ptr (gc, index);
3186 /* Set ARG to be the argument at position INDEX for call statement GS. */
3188 static inline void
3189 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3191 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3192 gs->op[index + 3] = arg;
3195 static inline void
3196 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3198 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3199 gimple_call_set_arg (gc, index, arg);
3203 /* If TAIL_P is true, mark call statement S as being a tail call
3204 (i.e., a call just before the exit of a function). These calls are
3205 candidate for tail call optimization. */
3207 static inline void
3208 gimple_call_set_tail (gcall *s, bool tail_p)
3210 if (tail_p)
3211 s->subcode |= GF_CALL_TAILCALL;
3212 else
3213 s->subcode &= ~GF_CALL_TAILCALL;
3217 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3219 static inline bool
3220 gimple_call_tail_p (gcall *s)
3222 return (s->subcode & GF_CALL_TAILCALL) != 0;
3225 /* Mark (or clear) call statement S as requiring tail call optimization. */
3227 static inline void
3228 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3230 if (must_tail_p)
3231 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3232 else
3233 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3236 /* Return true if call statement has been marked as requiring
3237 tail call optimization. */
3239 static inline bool
3240 gimple_call_must_tail_p (const gcall *s)
3242 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3245 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3246 slot optimization. This transformation uses the target of the call
3247 expansion as the return slot for calls that return in memory. */
3249 static inline void
3250 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3252 if (return_slot_opt_p)
3253 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3254 else
3255 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3259 /* Return true if S is marked for return slot optimization. */
3261 static inline bool
3262 gimple_call_return_slot_opt_p (gcall *s)
3264 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3268 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3269 thunk to the thunked-to function. */
3271 static inline void
3272 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3274 if (from_thunk_p)
3275 s->subcode |= GF_CALL_FROM_THUNK;
3276 else
3277 s->subcode &= ~GF_CALL_FROM_THUNK;
3281 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3283 static inline bool
3284 gimple_call_from_thunk_p (gcall *s)
3286 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3290 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3291 argument pack in its argument list. */
3293 static inline void
3294 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3296 if (pass_arg_pack_p)
3297 s->subcode |= GF_CALL_VA_ARG_PACK;
3298 else
3299 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3303 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3304 argument pack in its argument list. */
3306 static inline bool
3307 gimple_call_va_arg_pack_p (gcall *s)
3309 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3313 /* Return true if S is a noreturn call. */
3315 static inline bool
3316 gimple_call_noreturn_p (const gcall *s)
3318 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3321 static inline bool
3322 gimple_call_noreturn_p (const gimple *s)
3324 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3325 return gimple_call_noreturn_p (gc);
3329 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3330 even if the called function can throw in other cases. */
3332 static inline void
3333 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3335 if (nothrow_p)
3336 s->subcode |= GF_CALL_NOTHROW;
3337 else
3338 s->subcode &= ~GF_CALL_NOTHROW;
3341 /* Return true if S is a nothrow call. */
3343 static inline bool
3344 gimple_call_nothrow_p (gcall *s)
3346 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3349 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3350 is known to be emitted for VLA objects. Those are wrapped by
3351 stack_save/stack_restore calls and hence can't lead to unbounded
3352 stack growth even when they occur in loops. */
3354 static inline void
3355 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3357 if (for_var)
3358 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3359 else
3360 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3363 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3365 static inline bool
3366 gimple_call_alloca_for_var_p (gcall *s)
3368 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3371 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3372 pointers to nested function are descriptors instead of trampolines. */
3374 static inline void
3375 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3377 if (by_descriptor_p)
3378 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3379 else
3380 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3383 /* Return true if S is a by-descriptor call. */
3385 static inline bool
3386 gimple_call_by_descriptor_p (gcall *s)
3388 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3391 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3393 static inline void
3394 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3396 dest_call->subcode = orig_call->subcode;
3400 /* Return a pointer to the points-to solution for the set of call-used
3401 variables of the call CALL_STMT. */
3403 static inline struct pt_solution *
3404 gimple_call_use_set (gcall *call_stmt)
3406 return &call_stmt->call_used;
3410 /* Return a pointer to the points-to solution for the set of call-used
3411 variables of the call CALL_STMT. */
3413 static inline struct pt_solution *
3414 gimple_call_clobber_set (gcall *call_stmt)
3416 return &call_stmt->call_clobbered;
3420 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3421 non-NULL lhs. */
3423 static inline bool
3424 gimple_has_lhs (gimple *stmt)
3426 if (is_gimple_assign (stmt))
3427 return true;
3428 if (gcall *call = dyn_cast <gcall *> (stmt))
3429 return gimple_call_lhs (call) != NULL_TREE;
3430 return false;
3434 /* Return the code of the predicate computed by conditional statement GS. */
3436 static inline enum tree_code
3437 gimple_cond_code (const gcond *gs)
3439 return (enum tree_code) gs->subcode;
3442 static inline enum tree_code
3443 gimple_cond_code (const gimple *gs)
3445 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3446 return gimple_cond_code (gc);
3450 /* Set CODE to be the predicate code for the conditional statement GS. */
3452 static inline void
3453 gimple_cond_set_code (gcond *gs, enum tree_code code)
3455 gs->subcode = code;
3459 /* Return the LHS of the predicate computed by conditional statement GS. */
3461 static inline tree
3462 gimple_cond_lhs (const gcond *gs)
3464 return gs->op[0];
3467 static inline tree
3468 gimple_cond_lhs (const gimple *gs)
3470 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3471 return gimple_cond_lhs (gc);
3474 /* Return the pointer to the LHS of the predicate computed by conditional
3475 statement GS. */
3477 static inline tree *
3478 gimple_cond_lhs_ptr (gcond *gs)
3480 return &gs->op[0];
3483 /* Set LHS to be the LHS operand of the predicate computed by
3484 conditional statement GS. */
3486 static inline void
3487 gimple_cond_set_lhs (gcond *gs, tree lhs)
3489 gs->op[0] = lhs;
3493 /* Return the RHS operand of the predicate computed by conditional GS. */
3495 static inline tree
3496 gimple_cond_rhs (const gcond *gs)
3498 return gs->op[1];
3501 static inline tree
3502 gimple_cond_rhs (const gimple *gs)
3504 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3505 return gimple_cond_rhs (gc);
3508 /* Return the pointer to the RHS operand of the predicate computed by
3509 conditional GS. */
3511 static inline tree *
3512 gimple_cond_rhs_ptr (gcond *gs)
3514 return &gs->op[1];
3518 /* Set RHS to be the RHS operand of the predicate computed by
3519 conditional statement GS. */
3521 static inline void
3522 gimple_cond_set_rhs (gcond *gs, tree rhs)
3524 gs->op[1] = rhs;
3528 /* Return the label used by conditional statement GS when its
3529 predicate evaluates to true. */
3531 static inline tree
3532 gimple_cond_true_label (const gcond *gs)
3534 return gs->op[2];
3538 /* Set LABEL to be the label used by conditional statement GS when its
3539 predicate evaluates to true. */
3541 static inline void
3542 gimple_cond_set_true_label (gcond *gs, tree label)
3544 gs->op[2] = label;
3548 /* Set LABEL to be the label used by conditional statement GS when its
3549 predicate evaluates to false. */
3551 static inline void
3552 gimple_cond_set_false_label (gcond *gs, tree label)
3554 gs->op[3] = label;
3558 /* Return the label used by conditional statement GS when its
3559 predicate evaluates to false. */
3561 static inline tree
3562 gimple_cond_false_label (const gcond *gs)
3564 return gs->op[3];
3568 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3570 static inline void
3571 gimple_cond_make_false (gcond *gs)
3573 gimple_cond_set_lhs (gs, boolean_false_node);
3574 gimple_cond_set_rhs (gs, boolean_false_node);
3575 gs->subcode = NE_EXPR;
3579 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3581 static inline void
3582 gimple_cond_make_true (gcond *gs)
3584 gimple_cond_set_lhs (gs, boolean_true_node);
3585 gimple_cond_set_rhs (gs, boolean_false_node);
3586 gs->subcode = NE_EXPR;
3589 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3590 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3592 static inline bool
3593 gimple_cond_true_p (const gcond *gs)
3595 tree lhs = gimple_cond_lhs (gs);
3596 tree rhs = gimple_cond_rhs (gs);
3597 enum tree_code code = gimple_cond_code (gs);
3599 if (lhs != boolean_true_node && lhs != boolean_false_node)
3600 return false;
3602 if (rhs != boolean_true_node && rhs != boolean_false_node)
3603 return false;
3605 if (code == NE_EXPR && lhs != rhs)
3606 return true;
3608 if (code == EQ_EXPR && lhs == rhs)
3609 return true;
3611 return false;
3614 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3615 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3617 static inline bool
3618 gimple_cond_false_p (const gcond *gs)
3620 tree lhs = gimple_cond_lhs (gs);
3621 tree rhs = gimple_cond_rhs (gs);
3622 enum tree_code code = gimple_cond_code (gs);
3624 if (lhs != boolean_true_node && lhs != boolean_false_node)
3625 return false;
3627 if (rhs != boolean_true_node && rhs != boolean_false_node)
3628 return false;
3630 if (code == NE_EXPR && lhs == rhs)
3631 return true;
3633 if (code == EQ_EXPR && lhs != rhs)
3634 return true;
3636 return false;
3639 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3641 static inline void
3642 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3643 tree rhs)
3645 gimple_cond_set_code (stmt, code);
3646 gimple_cond_set_lhs (stmt, lhs);
3647 gimple_cond_set_rhs (stmt, rhs);
3650 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3652 static inline tree
3653 gimple_label_label (const glabel *gs)
3655 return gs->op[0];
3659 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3660 GS. */
3662 static inline void
3663 gimple_label_set_label (glabel *gs, tree label)
3665 gs->op[0] = label;
3669 /* Return the destination of the unconditional jump GS. */
3671 static inline tree
3672 gimple_goto_dest (const gimple *gs)
3674 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3675 return gimple_op (gs, 0);
3679 /* Set DEST to be the destination of the unconditonal jump GS. */
3681 static inline void
3682 gimple_goto_set_dest (ggoto *gs, tree dest)
3684 gs->op[0] = dest;
3688 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3690 static inline tree
3691 gimple_bind_vars (const gbind *bind_stmt)
3693 return bind_stmt->vars;
3697 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3698 statement GS. */
3700 static inline void
3701 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3703 bind_stmt->vars = vars;
3707 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3708 statement GS. */
3710 static inline void
3711 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3713 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3717 static inline gimple_seq *
3718 gimple_bind_body_ptr (gbind *bind_stmt)
3720 return &bind_stmt->body;
3723 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3725 static inline gimple_seq
3726 gimple_bind_body (gbind *gs)
3728 return *gimple_bind_body_ptr (gs);
3732 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3733 statement GS. */
3735 static inline void
3736 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3738 bind_stmt->body = seq;
3742 /* Append a statement to the end of a GIMPLE_BIND's body. */
3744 static inline void
3745 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3747 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3751 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3753 static inline void
3754 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3756 gimple_seq_add_seq (&bind_stmt->body, seq);
3760 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3761 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3763 static inline tree
3764 gimple_bind_block (const gbind *bind_stmt)
3766 return bind_stmt->block;
3770 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3771 statement GS. */
3773 static inline void
3774 gimple_bind_set_block (gbind *bind_stmt, tree block)
3776 gcc_gimple_checking_assert (block == NULL_TREE
3777 || TREE_CODE (block) == BLOCK);
3778 bind_stmt->block = block;
3782 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3784 static inline unsigned
3785 gimple_asm_ninputs (const gasm *asm_stmt)
3787 return asm_stmt->ni;
3791 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3793 static inline unsigned
3794 gimple_asm_noutputs (const gasm *asm_stmt)
3796 return asm_stmt->no;
3800 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3802 static inline unsigned
3803 gimple_asm_nclobbers (const gasm *asm_stmt)
3805 return asm_stmt->nc;
3808 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3810 static inline unsigned
3811 gimple_asm_nlabels (const gasm *asm_stmt)
3813 return asm_stmt->nl;
3816 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3818 static inline tree
3819 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3821 gcc_gimple_checking_assert (index < asm_stmt->ni);
3822 return asm_stmt->op[index + asm_stmt->no];
3825 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3827 static inline void
3828 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3830 gcc_gimple_checking_assert (index < asm_stmt->ni
3831 && TREE_CODE (in_op) == TREE_LIST);
3832 asm_stmt->op[index + asm_stmt->no] = in_op;
3836 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3838 static inline tree
3839 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3841 gcc_gimple_checking_assert (index < asm_stmt->no);
3842 return asm_stmt->op[index];
3845 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3847 static inline void
3848 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3850 gcc_gimple_checking_assert (index < asm_stmt->no
3851 && TREE_CODE (out_op) == TREE_LIST);
3852 asm_stmt->op[index] = out_op;
3856 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3858 static inline tree
3859 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3861 gcc_gimple_checking_assert (index < asm_stmt->nc);
3862 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3866 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3868 static inline void
3869 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3871 gcc_gimple_checking_assert (index < asm_stmt->nc
3872 && TREE_CODE (clobber_op) == TREE_LIST);
3873 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3876 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3878 static inline tree
3879 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3881 gcc_gimple_checking_assert (index < asm_stmt->nl);
3882 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3885 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3887 static inline void
3888 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3890 gcc_gimple_checking_assert (index < asm_stmt->nl
3891 && TREE_CODE (label_op) == TREE_LIST);
3892 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3895 /* Return the string representing the assembly instruction in
3896 GIMPLE_ASM ASM_STMT. */
3898 static inline const char *
3899 gimple_asm_string (const gasm *asm_stmt)
3901 return asm_stmt->string;
3905 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3907 static inline bool
3908 gimple_asm_volatile_p (const gasm *asm_stmt)
3910 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3914 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3916 static inline void
3917 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3919 if (volatile_p)
3920 asm_stmt->subcode |= GF_ASM_VOLATILE;
3921 else
3922 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3926 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3928 static inline void
3929 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3931 if (input_p)
3932 asm_stmt->subcode |= GF_ASM_INPUT;
3933 else
3934 asm_stmt->subcode &= ~GF_ASM_INPUT;
3938 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3940 static inline bool
3941 gimple_asm_input_p (const gasm *asm_stmt)
3943 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3947 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3949 static inline tree
3950 gimple_catch_types (const gcatch *catch_stmt)
3952 return catch_stmt->types;
3956 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3958 static inline tree *
3959 gimple_catch_types_ptr (gcatch *catch_stmt)
3961 return &catch_stmt->types;
3965 /* Return a pointer to the GIMPLE sequence representing the body of
3966 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3968 static inline gimple_seq *
3969 gimple_catch_handler_ptr (gcatch *catch_stmt)
3971 return &catch_stmt->handler;
3975 /* Return the GIMPLE sequence representing the body of the handler of
3976 GIMPLE_CATCH statement CATCH_STMT. */
3978 static inline gimple_seq
3979 gimple_catch_handler (gcatch *catch_stmt)
3981 return *gimple_catch_handler_ptr (catch_stmt);
3985 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3987 static inline void
3988 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3990 catch_stmt->types = t;
3994 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3996 static inline void
3997 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3999 catch_stmt->handler = handler;
4003 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4005 static inline tree
4006 gimple_eh_filter_types (const gimple *gs)
4008 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4009 return eh_filter_stmt->types;
4013 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4014 GS. */
4016 static inline tree *
4017 gimple_eh_filter_types_ptr (gimple *gs)
4019 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4020 return &eh_filter_stmt->types;
4024 /* Return a pointer to the sequence of statement to execute when
4025 GIMPLE_EH_FILTER statement fails. */
4027 static inline gimple_seq *
4028 gimple_eh_filter_failure_ptr (gimple *gs)
4030 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4031 return &eh_filter_stmt->failure;
4035 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4036 statement fails. */
4038 static inline gimple_seq
4039 gimple_eh_filter_failure (gimple *gs)
4041 return *gimple_eh_filter_failure_ptr (gs);
4045 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4046 EH_FILTER_STMT. */
4048 static inline void
4049 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4051 eh_filter_stmt->types = types;
4055 /* Set FAILURE to be the sequence of statements to execute on failure
4056 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4058 static inline void
4059 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4060 gimple_seq failure)
4062 eh_filter_stmt->failure = failure;
4065 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4067 static inline tree
4068 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4070 return eh_mnt_stmt->fndecl;
4073 /* Set the function decl to be called by GS to DECL. */
4075 static inline void
4076 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4077 tree decl)
4079 eh_mnt_stmt->fndecl = decl;
4082 /* GIMPLE_EH_ELSE accessors. */
4084 static inline gimple_seq *
4085 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4087 return &eh_else_stmt->n_body;
4090 static inline gimple_seq
4091 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4093 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4096 static inline gimple_seq *
4097 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4099 return &eh_else_stmt->e_body;
4102 static inline gimple_seq
4103 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4105 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4108 static inline void
4109 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4111 eh_else_stmt->n_body = seq;
4114 static inline void
4115 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4117 eh_else_stmt->e_body = seq;
4120 /* GIMPLE_TRY accessors. */
4122 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4123 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4125 static inline enum gimple_try_flags
4126 gimple_try_kind (const gimple *gs)
4128 GIMPLE_CHECK (gs, GIMPLE_TRY);
4129 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4133 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4135 static inline void
4136 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4138 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4139 || kind == GIMPLE_TRY_FINALLY);
4140 if (gimple_try_kind (gs) != kind)
4141 gs->subcode = (unsigned int) kind;
4145 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4147 static inline bool
4148 gimple_try_catch_is_cleanup (const gimple *gs)
4150 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4151 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4155 /* Return a pointer to the sequence of statements used as the
4156 body for GIMPLE_TRY GS. */
4158 static inline gimple_seq *
4159 gimple_try_eval_ptr (gimple *gs)
4161 gtry *try_stmt = as_a <gtry *> (gs);
4162 return &try_stmt->eval;
4166 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4168 static inline gimple_seq
4169 gimple_try_eval (gimple *gs)
4171 return *gimple_try_eval_ptr (gs);
4175 /* Return a pointer to the sequence of statements used as the cleanup body for
4176 GIMPLE_TRY GS. */
4178 static inline gimple_seq *
4179 gimple_try_cleanup_ptr (gimple *gs)
4181 gtry *try_stmt = as_a <gtry *> (gs);
4182 return &try_stmt->cleanup;
4186 /* Return the sequence of statements used as the cleanup body for
4187 GIMPLE_TRY GS. */
4189 static inline gimple_seq
4190 gimple_try_cleanup (gimple *gs)
4192 return *gimple_try_cleanup_ptr (gs);
4196 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4198 static inline void
4199 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4201 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4202 if (catch_is_cleanup)
4203 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4204 else
4205 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4209 /* Set EVAL to be the sequence of statements to use as the body for
4210 GIMPLE_TRY TRY_STMT. */
4212 static inline void
4213 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4215 try_stmt->eval = eval;
4219 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4220 body for GIMPLE_TRY TRY_STMT. */
4222 static inline void
4223 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4225 try_stmt->cleanup = cleanup;
4229 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4231 static inline gimple_seq *
4232 gimple_wce_cleanup_ptr (gimple *gs)
4234 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4235 return &wce_stmt->cleanup;
4239 /* Return the cleanup sequence for cleanup statement GS. */
4241 static inline gimple_seq
4242 gimple_wce_cleanup (gimple *gs)
4244 return *gimple_wce_cleanup_ptr (gs);
4248 /* Set CLEANUP to be the cleanup sequence for GS. */
4250 static inline void
4251 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4253 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4254 wce_stmt->cleanup = cleanup;
4258 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4260 static inline bool
4261 gimple_wce_cleanup_eh_only (const gimple *gs)
4263 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4264 return gs->subcode != 0;
4268 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4270 static inline void
4271 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4273 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4274 gs->subcode = (unsigned int) eh_only_p;
4278 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4280 static inline unsigned
4281 gimple_phi_capacity (const gimple *gs)
4283 const gphi *phi_stmt = as_a <const gphi *> (gs);
4284 return phi_stmt->capacity;
4288 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4289 be exactly the number of incoming edges for the basic block holding
4290 GS. */
4292 static inline unsigned
4293 gimple_phi_num_args (const gimple *gs)
4295 const gphi *phi_stmt = as_a <const gphi *> (gs);
4296 return phi_stmt->nargs;
4300 /* Return the SSA name created by GIMPLE_PHI GS. */
4302 static inline tree
4303 gimple_phi_result (const gphi *gs)
4305 return gs->result;
4308 static inline tree
4309 gimple_phi_result (const gimple *gs)
4311 const gphi *phi_stmt = as_a <const gphi *> (gs);
4312 return gimple_phi_result (phi_stmt);
4315 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4317 static inline tree *
4318 gimple_phi_result_ptr (gphi *gs)
4320 return &gs->result;
4323 static inline tree *
4324 gimple_phi_result_ptr (gimple *gs)
4326 gphi *phi_stmt = as_a <gphi *> (gs);
4327 return gimple_phi_result_ptr (phi_stmt);
4330 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4332 static inline void
4333 gimple_phi_set_result (gphi *phi, tree result)
4335 phi->result = result;
4336 if (result && TREE_CODE (result) == SSA_NAME)
4337 SSA_NAME_DEF_STMT (result) = phi;
4341 /* Return the PHI argument corresponding to incoming edge INDEX for
4342 GIMPLE_PHI GS. */
4344 static inline struct phi_arg_d *
4345 gimple_phi_arg (gphi *gs, unsigned index)
4347 gcc_gimple_checking_assert (index < gs->nargs);
4348 return &(gs->args[index]);
4351 static inline struct phi_arg_d *
4352 gimple_phi_arg (gimple *gs, unsigned index)
4354 gphi *phi_stmt = as_a <gphi *> (gs);
4355 return gimple_phi_arg (phi_stmt, index);
4358 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4359 for GIMPLE_PHI PHI. */
4361 static inline void
4362 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4364 gcc_gimple_checking_assert (index < phi->nargs);
4365 phi->args[index] = *phiarg;
4368 /* Return the PHI nodes for basic block BB, or NULL if there are no
4369 PHI nodes. */
4371 static inline gimple_seq
4372 phi_nodes (const_basic_block bb)
4374 gcc_checking_assert (!(bb->flags & BB_RTL));
4375 return bb->il.gimple.phi_nodes;
4378 /* Return a pointer to the PHI nodes for basic block BB. */
4380 static inline gimple_seq *
4381 phi_nodes_ptr (basic_block bb)
4383 gcc_checking_assert (!(bb->flags & BB_RTL));
4384 return &bb->il.gimple.phi_nodes;
4387 /* Return the tree operand for argument I of PHI node GS. */
4389 static inline tree
4390 gimple_phi_arg_def (gphi *gs, size_t index)
4392 return gimple_phi_arg (gs, index)->def;
4395 static inline tree
4396 gimple_phi_arg_def (gimple *gs, size_t index)
4398 return gimple_phi_arg (gs, index)->def;
4402 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4404 static inline tree *
4405 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4407 return &gimple_phi_arg (phi, index)->def;
4410 /* Return the edge associated with argument I of phi node PHI. */
4412 static inline edge
4413 gimple_phi_arg_edge (gphi *phi, size_t i)
4415 return EDGE_PRED (gimple_bb (phi), i);
4418 /* Return the source location of gimple argument I of phi node PHI. */
4420 static inline source_location
4421 gimple_phi_arg_location (gphi *phi, size_t i)
4423 return gimple_phi_arg (phi, i)->locus;
4426 /* Return the source location of the argument on edge E of phi node PHI. */
4428 static inline source_location
4429 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4431 return gimple_phi_arg (phi, e->dest_idx)->locus;
4434 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4436 static inline void
4437 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4439 gimple_phi_arg (phi, i)->locus = loc;
4442 /* Return TRUE if argument I of phi node PHI has a location record. */
4444 static inline bool
4445 gimple_phi_arg_has_location (gphi *phi, size_t i)
4447 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4451 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4453 static inline int
4454 gimple_resx_region (const gresx *resx_stmt)
4456 return resx_stmt->region;
4459 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4461 static inline void
4462 gimple_resx_set_region (gresx *resx_stmt, int region)
4464 resx_stmt->region = region;
4467 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4469 static inline int
4470 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4472 return eh_dispatch_stmt->region;
4475 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4476 EH_DISPATCH_STMT. */
4478 static inline void
4479 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4481 eh_dispatch_stmt->region = region;
4484 /* Return the number of labels associated with the switch statement GS. */
4486 static inline unsigned
4487 gimple_switch_num_labels (const gswitch *gs)
4489 unsigned num_ops;
4490 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4491 num_ops = gimple_num_ops (gs);
4492 gcc_gimple_checking_assert (num_ops > 1);
4493 return num_ops - 1;
4497 /* Set NLABELS to be the number of labels for the switch statement GS. */
4499 static inline void
4500 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4502 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4503 gimple_set_num_ops (g, nlabels + 1);
4507 /* Return the index variable used by the switch statement GS. */
4509 static inline tree
4510 gimple_switch_index (const gswitch *gs)
4512 return gs->op[0];
4516 /* Return a pointer to the index variable for the switch statement GS. */
4518 static inline tree *
4519 gimple_switch_index_ptr (gswitch *gs)
4521 return &gs->op[0];
4525 /* Set INDEX to be the index variable for switch statement GS. */
4527 static inline void
4528 gimple_switch_set_index (gswitch *gs, tree index)
4530 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4531 gs->op[0] = index;
4535 /* Return the label numbered INDEX. The default label is 0, followed by any
4536 labels in a switch statement. */
4538 static inline tree
4539 gimple_switch_label (const gswitch *gs, unsigned index)
4541 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4542 return gs->op[index + 1];
4545 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4547 static inline void
4548 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4550 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4551 && (label == NULL_TREE
4552 || TREE_CODE (label) == CASE_LABEL_EXPR));
4553 gs->op[index + 1] = label;
4556 /* Return the default label for a switch statement. */
4558 static inline tree
4559 gimple_switch_default_label (const gswitch *gs)
4561 tree label = gimple_switch_label (gs, 0);
4562 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4563 return label;
4566 /* Set the default label for a switch statement. */
4568 static inline void
4569 gimple_switch_set_default_label (gswitch *gs, tree label)
4571 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4572 gimple_switch_set_label (gs, 0, label);
4575 /* Return true if GS is a GIMPLE_DEBUG statement. */
4577 static inline bool
4578 is_gimple_debug (const gimple *gs)
4580 return gimple_code (gs) == GIMPLE_DEBUG;
4584 /* Return the last nondebug statement in GIMPLE sequence S. */
4586 static inline gimple *
4587 gimple_seq_last_nondebug_stmt (gimple_seq s)
4589 gimple_seq_node n;
4590 for (n = gimple_seq_last (s);
4591 n && is_gimple_debug (n);
4592 n = n->prev)
4593 if (n->prev == s)
4594 return NULL;
4595 return n;
4599 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4601 static inline bool
4602 gimple_debug_bind_p (const gimple *s)
4604 if (is_gimple_debug (s))
4605 return s->subcode == GIMPLE_DEBUG_BIND;
4607 return false;
4610 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4612 static inline tree
4613 gimple_debug_bind_get_var (gimple *dbg)
4615 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4616 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4617 return gimple_op (dbg, 0);
4620 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4621 statement. */
4623 static inline tree
4624 gimple_debug_bind_get_value (gimple *dbg)
4626 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4627 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4628 return gimple_op (dbg, 1);
4631 /* Return a pointer to the value bound to the variable in a
4632 GIMPLE_DEBUG bind statement. */
4634 static inline tree *
4635 gimple_debug_bind_get_value_ptr (gimple *dbg)
4637 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4638 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4639 return gimple_op_ptr (dbg, 1);
4642 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4644 static inline void
4645 gimple_debug_bind_set_var (gimple *dbg, tree var)
4647 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4648 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4649 gimple_set_op (dbg, 0, var);
4652 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4653 statement. */
4655 static inline void
4656 gimple_debug_bind_set_value (gimple *dbg, tree value)
4658 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4659 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4660 gimple_set_op (dbg, 1, value);
4663 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4664 optimized away. */
4665 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4667 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4668 statement. */
4670 static inline void
4671 gimple_debug_bind_reset_value (gimple *dbg)
4673 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4674 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4675 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4678 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4679 value. */
4681 static inline bool
4682 gimple_debug_bind_has_value_p (gimple *dbg)
4684 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4685 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4686 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4689 #undef GIMPLE_DEBUG_BIND_NOVALUE
4691 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4693 static inline bool
4694 gimple_debug_source_bind_p (const gimple *s)
4696 if (is_gimple_debug (s))
4697 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4699 return false;
4702 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4704 static inline tree
4705 gimple_debug_source_bind_get_var (gimple *dbg)
4707 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4708 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4709 return gimple_op (dbg, 0);
4712 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4713 statement. */
4715 static inline tree
4716 gimple_debug_source_bind_get_value (gimple *dbg)
4718 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4719 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4720 return gimple_op (dbg, 1);
4723 /* Return a pointer to the value bound to the variable in a
4724 GIMPLE_DEBUG source bind statement. */
4726 static inline tree *
4727 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4729 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4730 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4731 return gimple_op_ptr (dbg, 1);
4734 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4736 static inline void
4737 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4739 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4740 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4741 gimple_set_op (dbg, 0, var);
4744 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4745 statement. */
4747 static inline void
4748 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4750 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4751 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4752 gimple_set_op (dbg, 1, value);
4755 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4757 static inline bool
4758 gimple_debug_begin_stmt_p (const gimple *s)
4760 if (is_gimple_debug (s))
4761 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4763 return false;
4766 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4768 static inline bool
4769 gimple_debug_inline_entry_p (const gimple *s)
4771 if (is_gimple_debug (s))
4772 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4774 return false;
4777 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4779 static inline bool
4780 gimple_debug_nonbind_marker_p (const gimple *s)
4782 if (is_gimple_debug (s))
4783 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
4784 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4786 return false;
4789 /* Return the line number for EXPR, or return -1 if we have no line
4790 number information for it. */
4791 static inline int
4792 get_lineno (const gimple *stmt)
4794 location_t loc;
4796 if (!stmt)
4797 return -1;
4799 loc = gimple_location (stmt);
4800 if (loc == UNKNOWN_LOCATION)
4801 return -1;
4803 return LOCATION_LINE (loc);
4806 /* Return a pointer to the body for the OMP statement GS. */
4808 static inline gimple_seq *
4809 gimple_omp_body_ptr (gimple *gs)
4811 return &static_cast <gimple_statement_omp *> (gs)->body;
4814 /* Return the body for the OMP statement GS. */
4816 static inline gimple_seq
4817 gimple_omp_body (gimple *gs)
4819 return *gimple_omp_body_ptr (gs);
4822 /* Set BODY to be the body for the OMP statement GS. */
4824 static inline void
4825 gimple_omp_set_body (gimple *gs, gimple_seq body)
4827 static_cast <gimple_statement_omp *> (gs)->body = body;
4831 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4833 static inline tree
4834 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4836 return crit_stmt->name;
4840 /* Return a pointer to the name associated with OMP critical statement
4841 CRIT_STMT. */
4843 static inline tree *
4844 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4846 return &crit_stmt->name;
4850 /* Set NAME to be the name associated with OMP critical statement
4851 CRIT_STMT. */
4853 static inline void
4854 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4856 crit_stmt->name = name;
4860 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4862 static inline tree
4863 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4865 return crit_stmt->clauses;
4869 /* Return a pointer to the clauses associated with OMP critical statement
4870 CRIT_STMT. */
4872 static inline tree *
4873 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4875 return &crit_stmt->clauses;
4879 /* Set CLAUSES to be the clauses associated with OMP critical statement
4880 CRIT_STMT. */
4882 static inline void
4883 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4885 crit_stmt->clauses = clauses;
4889 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4891 static inline tree
4892 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4894 return ord_stmt->clauses;
4898 /* Return a pointer to the clauses associated with OMP ordered statement
4899 ORD_STMT. */
4901 static inline tree *
4902 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4904 return &ord_stmt->clauses;
4908 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4909 ORD_STMT. */
4911 static inline void
4912 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4914 ord_stmt->clauses = clauses;
4918 /* Return the kind of the OMP_FOR statemement G. */
4920 static inline int
4921 gimple_omp_for_kind (const gimple *g)
4923 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4924 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4928 /* Set the kind of the OMP_FOR statement G. */
4930 static inline void
4931 gimple_omp_for_set_kind (gomp_for *g, int kind)
4933 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4934 | (kind & GF_OMP_FOR_KIND_MASK);
4938 /* Return true if OMP_FOR statement G has the
4939 GF_OMP_FOR_COMBINED flag set. */
4941 static inline bool
4942 gimple_omp_for_combined_p (const gimple *g)
4944 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4945 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4949 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4950 the boolean value of COMBINED_P. */
4952 static inline void
4953 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4955 if (combined_p)
4956 g->subcode |= GF_OMP_FOR_COMBINED;
4957 else
4958 g->subcode &= ~GF_OMP_FOR_COMBINED;
4962 /* Return true if the OMP_FOR statement G has the
4963 GF_OMP_FOR_COMBINED_INTO flag set. */
4965 static inline bool
4966 gimple_omp_for_combined_into_p (const gimple *g)
4968 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4969 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4973 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4974 on the boolean value of COMBINED_P. */
4976 static inline void
4977 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4979 if (combined_p)
4980 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4981 else
4982 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4986 /* Return the clauses associated with the OMP_FOR statement GS. */
4988 static inline tree
4989 gimple_omp_for_clauses (const gimple *gs)
4991 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4992 return omp_for_stmt->clauses;
4996 /* Return a pointer to the clauses associated with the OMP_FOR statement
4997 GS. */
4999 static inline tree *
5000 gimple_omp_for_clauses_ptr (gimple *gs)
5002 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5003 return &omp_for_stmt->clauses;
5007 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5008 GS. */
5010 static inline void
5011 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5013 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5014 omp_for_stmt->clauses = clauses;
5018 /* Get the collapse count of the OMP_FOR statement GS. */
5020 static inline size_t
5021 gimple_omp_for_collapse (gimple *gs)
5023 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5024 return omp_for_stmt->collapse;
5028 /* Return the condition code associated with the OMP_FOR statement GS. */
5030 static inline enum tree_code
5031 gimple_omp_for_cond (const gimple *gs, size_t i)
5033 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5034 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5035 return omp_for_stmt->iter[i].cond;
5039 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5041 static inline void
5042 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5044 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5045 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5046 && i < omp_for_stmt->collapse);
5047 omp_for_stmt->iter[i].cond = cond;
5051 /* Return the index variable for the OMP_FOR statement GS. */
5053 static inline tree
5054 gimple_omp_for_index (const gimple *gs, size_t i)
5056 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5057 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5058 return omp_for_stmt->iter[i].index;
5062 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5064 static inline tree *
5065 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5067 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5068 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5069 return &omp_for_stmt->iter[i].index;
5073 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5075 static inline void
5076 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5078 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5079 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5080 omp_for_stmt->iter[i].index = index;
5084 /* Return the initial value for the OMP_FOR statement GS. */
5086 static inline tree
5087 gimple_omp_for_initial (const gimple *gs, size_t i)
5089 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5090 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5091 return omp_for_stmt->iter[i].initial;
5095 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5097 static inline tree *
5098 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5100 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5101 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5102 return &omp_for_stmt->iter[i].initial;
5106 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5108 static inline void
5109 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5111 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5112 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5113 omp_for_stmt->iter[i].initial = initial;
5117 /* Return the final value for the OMP_FOR statement GS. */
5119 static inline tree
5120 gimple_omp_for_final (const gimple *gs, size_t i)
5122 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5123 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5124 return omp_for_stmt->iter[i].final;
5128 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5130 static inline tree *
5131 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5133 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5134 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5135 return &omp_for_stmt->iter[i].final;
5139 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5141 static inline void
5142 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5144 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5145 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5146 omp_for_stmt->iter[i].final = final;
5150 /* Return the increment value for the OMP_FOR statement GS. */
5152 static inline tree
5153 gimple_omp_for_incr (const gimple *gs, size_t i)
5155 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5156 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5157 return omp_for_stmt->iter[i].incr;
5161 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5163 static inline tree *
5164 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5166 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5167 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5168 return &omp_for_stmt->iter[i].incr;
5172 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5174 static inline void
5175 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5177 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5178 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5179 omp_for_stmt->iter[i].incr = incr;
5183 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5184 statement GS starts. */
5186 static inline gimple_seq *
5187 gimple_omp_for_pre_body_ptr (gimple *gs)
5189 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5190 return &omp_for_stmt->pre_body;
5194 /* Return the sequence of statements to execute before the OMP_FOR
5195 statement GS starts. */
5197 static inline gimple_seq
5198 gimple_omp_for_pre_body (gimple *gs)
5200 return *gimple_omp_for_pre_body_ptr (gs);
5204 /* Set PRE_BODY to be the sequence of statements to execute before the
5205 OMP_FOR statement GS starts. */
5207 static inline void
5208 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5210 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5211 omp_for_stmt->pre_body = pre_body;
5214 /* Return the kernel_phony of OMP_FOR statement. */
5216 static inline bool
5217 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5219 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5220 != GF_OMP_FOR_KIND_GRID_LOOP);
5221 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5224 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5226 static inline void
5227 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5229 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5230 != GF_OMP_FOR_KIND_GRID_LOOP);
5231 if (value)
5232 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5233 else
5234 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5237 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5239 static inline bool
5240 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5242 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5243 == GF_OMP_FOR_KIND_GRID_LOOP);
5244 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5247 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5249 static inline void
5250 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5252 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5253 == GF_OMP_FOR_KIND_GRID_LOOP);
5254 if (value)
5255 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5256 else
5257 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5260 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5261 groups. */
5263 static inline bool
5264 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5266 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5267 == GF_OMP_FOR_KIND_GRID_LOOP);
5268 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5271 /* Set group_iter flag of OMP_FOR to VALUE. */
5273 static inline void
5274 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5276 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5277 == GF_OMP_FOR_KIND_GRID_LOOP);
5278 if (value)
5279 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5280 else
5281 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5284 /* Return the clauses associated with OMP_PARALLEL GS. */
5286 static inline tree
5287 gimple_omp_parallel_clauses (const gimple *gs)
5289 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5290 return omp_parallel_stmt->clauses;
5294 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5296 static inline tree *
5297 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5299 return &omp_parallel_stmt->clauses;
5303 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5305 static inline void
5306 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5307 tree clauses)
5309 omp_parallel_stmt->clauses = clauses;
5313 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5315 static inline tree
5316 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5318 return omp_parallel_stmt->child_fn;
5321 /* Return a pointer to the child function used to hold the body of
5322 OMP_PARALLEL_STMT. */
5324 static inline tree *
5325 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5327 return &omp_parallel_stmt->child_fn;
5331 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5333 static inline void
5334 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5335 tree child_fn)
5337 omp_parallel_stmt->child_fn = child_fn;
5341 /* Return the artificial argument used to send variables and values
5342 from the parent to the children threads in OMP_PARALLEL_STMT. */
5344 static inline tree
5345 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5347 return omp_parallel_stmt->data_arg;
5351 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5353 static inline tree *
5354 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5356 return &omp_parallel_stmt->data_arg;
5360 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5362 static inline void
5363 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5364 tree data_arg)
5366 omp_parallel_stmt->data_arg = data_arg;
5369 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5371 static inline bool
5372 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5374 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5377 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5379 static inline void
5380 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5382 if (value)
5383 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5384 else
5385 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5388 /* Return the clauses associated with OMP_TASK GS. */
5390 static inline tree
5391 gimple_omp_task_clauses (const gimple *gs)
5393 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5394 return omp_task_stmt->clauses;
5398 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5400 static inline tree *
5401 gimple_omp_task_clauses_ptr (gimple *gs)
5403 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5404 return &omp_task_stmt->clauses;
5408 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5409 GS. */
5411 static inline void
5412 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5414 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5415 omp_task_stmt->clauses = clauses;
5419 /* Return true if OMP task statement G has the
5420 GF_OMP_TASK_TASKLOOP flag set. */
5422 static inline bool
5423 gimple_omp_task_taskloop_p (const gimple *g)
5425 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5426 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5430 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5431 value of TASKLOOP_P. */
5433 static inline void
5434 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5436 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5437 if (taskloop_p)
5438 g->subcode |= GF_OMP_TASK_TASKLOOP;
5439 else
5440 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5444 /* Return the child function used to hold the body of OMP_TASK GS. */
5446 static inline tree
5447 gimple_omp_task_child_fn (const gimple *gs)
5449 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5450 return omp_task_stmt->child_fn;
5453 /* Return a pointer to the child function used to hold the body of
5454 OMP_TASK GS. */
5456 static inline tree *
5457 gimple_omp_task_child_fn_ptr (gimple *gs)
5459 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5460 return &omp_task_stmt->child_fn;
5464 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5466 static inline void
5467 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5469 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5470 omp_task_stmt->child_fn = child_fn;
5474 /* Return the artificial argument used to send variables and values
5475 from the parent to the children threads in OMP_TASK GS. */
5477 static inline tree
5478 gimple_omp_task_data_arg (const gimple *gs)
5480 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5481 return omp_task_stmt->data_arg;
5485 /* Return a pointer to the data argument for OMP_TASK GS. */
5487 static inline tree *
5488 gimple_omp_task_data_arg_ptr (gimple *gs)
5490 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5491 return &omp_task_stmt->data_arg;
5495 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5497 static inline void
5498 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5500 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5501 omp_task_stmt->data_arg = data_arg;
5505 /* Return the clauses associated with OMP_TASK GS. */
5507 static inline tree
5508 gimple_omp_taskreg_clauses (const gimple *gs)
5510 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5511 = as_a <const gimple_statement_omp_taskreg *> (gs);
5512 return omp_taskreg_stmt->clauses;
5516 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5518 static inline tree *
5519 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5521 gimple_statement_omp_taskreg *omp_taskreg_stmt
5522 = as_a <gimple_statement_omp_taskreg *> (gs);
5523 return &omp_taskreg_stmt->clauses;
5527 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5528 GS. */
5530 static inline void
5531 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5533 gimple_statement_omp_taskreg *omp_taskreg_stmt
5534 = as_a <gimple_statement_omp_taskreg *> (gs);
5535 omp_taskreg_stmt->clauses = clauses;
5539 /* Return the child function used to hold the body of OMP_TASK GS. */
5541 static inline tree
5542 gimple_omp_taskreg_child_fn (const gimple *gs)
5544 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5545 = as_a <const gimple_statement_omp_taskreg *> (gs);
5546 return omp_taskreg_stmt->child_fn;
5549 /* Return a pointer to the child function used to hold the body of
5550 OMP_TASK GS. */
5552 static inline tree *
5553 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5555 gimple_statement_omp_taskreg *omp_taskreg_stmt
5556 = as_a <gimple_statement_omp_taskreg *> (gs);
5557 return &omp_taskreg_stmt->child_fn;
5561 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5563 static inline void
5564 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5566 gimple_statement_omp_taskreg *omp_taskreg_stmt
5567 = as_a <gimple_statement_omp_taskreg *> (gs);
5568 omp_taskreg_stmt->child_fn = child_fn;
5572 /* Return the artificial argument used to send variables and values
5573 from the parent to the children threads in OMP_TASK GS. */
5575 static inline tree
5576 gimple_omp_taskreg_data_arg (const gimple *gs)
5578 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5579 = as_a <const gimple_statement_omp_taskreg *> (gs);
5580 return omp_taskreg_stmt->data_arg;
5584 /* Return a pointer to the data argument for OMP_TASK GS. */
5586 static inline tree *
5587 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5589 gimple_statement_omp_taskreg *omp_taskreg_stmt
5590 = as_a <gimple_statement_omp_taskreg *> (gs);
5591 return &omp_taskreg_stmt->data_arg;
5595 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5597 static inline void
5598 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5600 gimple_statement_omp_taskreg *omp_taskreg_stmt
5601 = as_a <gimple_statement_omp_taskreg *> (gs);
5602 omp_taskreg_stmt->data_arg = data_arg;
5606 /* Return the copy function used to hold the body of OMP_TASK GS. */
5608 static inline tree
5609 gimple_omp_task_copy_fn (const gimple *gs)
5611 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5612 return omp_task_stmt->copy_fn;
5615 /* Return a pointer to the copy function used to hold the body of
5616 OMP_TASK GS. */
5618 static inline tree *
5619 gimple_omp_task_copy_fn_ptr (gimple *gs)
5621 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5622 return &omp_task_stmt->copy_fn;
5626 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5628 static inline void
5629 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5631 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5632 omp_task_stmt->copy_fn = copy_fn;
5636 /* Return size of the data block in bytes in OMP_TASK GS. */
5638 static inline tree
5639 gimple_omp_task_arg_size (const gimple *gs)
5641 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5642 return omp_task_stmt->arg_size;
5646 /* Return a pointer to the data block size for OMP_TASK GS. */
5648 static inline tree *
5649 gimple_omp_task_arg_size_ptr (gimple *gs)
5651 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5652 return &omp_task_stmt->arg_size;
5656 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5658 static inline void
5659 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5661 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5662 omp_task_stmt->arg_size = arg_size;
5666 /* Return align of the data block in bytes in OMP_TASK GS. */
5668 static inline tree
5669 gimple_omp_task_arg_align (const gimple *gs)
5671 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5672 return omp_task_stmt->arg_align;
5676 /* Return a pointer to the data block align for OMP_TASK GS. */
5678 static inline tree *
5679 gimple_omp_task_arg_align_ptr (gimple *gs)
5681 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5682 return &omp_task_stmt->arg_align;
5686 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5688 static inline void
5689 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5691 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5692 omp_task_stmt->arg_align = arg_align;
5696 /* Return the clauses associated with OMP_SINGLE GS. */
5698 static inline tree
5699 gimple_omp_single_clauses (const gimple *gs)
5701 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5702 return omp_single_stmt->clauses;
5706 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5708 static inline tree *
5709 gimple_omp_single_clauses_ptr (gimple *gs)
5711 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5712 return &omp_single_stmt->clauses;
5716 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5718 static inline void
5719 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5721 omp_single_stmt->clauses = clauses;
5725 /* Return the clauses associated with OMP_TARGET GS. */
5727 static inline tree
5728 gimple_omp_target_clauses (const gimple *gs)
5730 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5731 return omp_target_stmt->clauses;
5735 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5737 static inline tree *
5738 gimple_omp_target_clauses_ptr (gimple *gs)
5740 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5741 return &omp_target_stmt->clauses;
5745 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5747 static inline void
5748 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5749 tree clauses)
5751 omp_target_stmt->clauses = clauses;
5755 /* Return the kind of the OMP_TARGET G. */
5757 static inline int
5758 gimple_omp_target_kind (const gimple *g)
5760 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5761 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5765 /* Set the kind of the OMP_TARGET G. */
5767 static inline void
5768 gimple_omp_target_set_kind (gomp_target *g, int kind)
5770 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5771 | (kind & GF_OMP_TARGET_KIND_MASK);
5775 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5777 static inline tree
5778 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5780 return omp_target_stmt->child_fn;
5783 /* Return a pointer to the child function used to hold the body of
5784 OMP_TARGET_STMT. */
5786 static inline tree *
5787 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5789 return &omp_target_stmt->child_fn;
5793 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5795 static inline void
5796 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5797 tree child_fn)
5799 omp_target_stmt->child_fn = child_fn;
5803 /* Return the artificial argument used to send variables and values
5804 from the parent to the children threads in OMP_TARGET_STMT. */
5806 static inline tree
5807 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5809 return omp_target_stmt->data_arg;
5813 /* Return a pointer to the data argument for OMP_TARGET GS. */
5815 static inline tree *
5816 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5818 return &omp_target_stmt->data_arg;
5822 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5824 static inline void
5825 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5826 tree data_arg)
5828 omp_target_stmt->data_arg = data_arg;
5832 /* Return the clauses associated with OMP_TEAMS GS. */
5834 static inline tree
5835 gimple_omp_teams_clauses (const gimple *gs)
5837 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5838 return omp_teams_stmt->clauses;
5842 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5844 static inline tree *
5845 gimple_omp_teams_clauses_ptr (gimple *gs)
5847 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5848 return &omp_teams_stmt->clauses;
5852 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5854 static inline void
5855 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5857 omp_teams_stmt->clauses = clauses;
5860 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5862 static inline bool
5863 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5865 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5868 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5870 static inline void
5871 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5873 if (value)
5874 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5875 else
5876 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5879 /* Return the clauses associated with OMP_SECTIONS GS. */
5881 static inline tree
5882 gimple_omp_sections_clauses (const gimple *gs)
5884 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5885 return omp_sections_stmt->clauses;
5889 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5891 static inline tree *
5892 gimple_omp_sections_clauses_ptr (gimple *gs)
5894 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5895 return &omp_sections_stmt->clauses;
5899 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5900 GS. */
5902 static inline void
5903 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5905 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5906 omp_sections_stmt->clauses = clauses;
5910 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5911 in GS. */
5913 static inline tree
5914 gimple_omp_sections_control (const gimple *gs)
5916 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5917 return omp_sections_stmt->control;
5921 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5922 GS. */
5924 static inline tree *
5925 gimple_omp_sections_control_ptr (gimple *gs)
5927 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5928 return &omp_sections_stmt->control;
5932 /* Set CONTROL to be the set of clauses associated with the
5933 GIMPLE_OMP_SECTIONS in GS. */
5935 static inline void
5936 gimple_omp_sections_set_control (gimple *gs, tree control)
5938 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5939 omp_sections_stmt->control = control;
5943 /* Set the value being stored in an atomic store. */
5945 static inline void
5946 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5948 store_stmt->val = val;
5952 /* Return the value being stored in an atomic store. */
5954 static inline tree
5955 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5957 return store_stmt->val;
5961 /* Return a pointer to the value being stored in an atomic store. */
5963 static inline tree *
5964 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5966 return &store_stmt->val;
5970 /* Set the LHS of an atomic load. */
5972 static inline void
5973 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5975 load_stmt->lhs = lhs;
5979 /* Get the LHS of an atomic load. */
5981 static inline tree
5982 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5984 return load_stmt->lhs;
5988 /* Return a pointer to the LHS of an atomic load. */
5990 static inline tree *
5991 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5993 return &load_stmt->lhs;
5997 /* Set the RHS of an atomic load. */
5999 static inline void
6000 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6002 load_stmt->rhs = rhs;
6006 /* Get the RHS of an atomic load. */
6008 static inline tree
6009 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6011 return load_stmt->rhs;
6015 /* Return a pointer to the RHS of an atomic load. */
6017 static inline tree *
6018 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6020 return &load_stmt->rhs;
6024 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6026 static inline tree
6027 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6029 return cont_stmt->control_def;
6032 /* The same as above, but return the address. */
6034 static inline tree *
6035 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6037 return &cont_stmt->control_def;
6040 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6042 static inline void
6043 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6045 cont_stmt->control_def = def;
6049 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6051 static inline tree
6052 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6054 return cont_stmt->control_use;
6058 /* The same as above, but return the address. */
6060 static inline tree *
6061 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6063 return &cont_stmt->control_use;
6067 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6069 static inline void
6070 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6072 cont_stmt->control_use = use;
6075 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6076 TRANSACTION_STMT. */
6078 static inline gimple_seq *
6079 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6081 return &transaction_stmt->body;
6084 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6086 static inline gimple_seq
6087 gimple_transaction_body (gtransaction *transaction_stmt)
6089 return transaction_stmt->body;
6092 /* Return the label associated with a GIMPLE_TRANSACTION. */
6094 static inline tree
6095 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6097 return transaction_stmt->label_norm;
6100 static inline tree *
6101 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6103 return &transaction_stmt->label_norm;
6106 static inline tree
6107 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6109 return transaction_stmt->label_uninst;
6112 static inline tree *
6113 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6115 return &transaction_stmt->label_uninst;
6118 static inline tree
6119 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6121 return transaction_stmt->label_over;
6124 static inline tree *
6125 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6127 return &transaction_stmt->label_over;
6130 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6132 static inline unsigned int
6133 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6135 return transaction_stmt->subcode;
6138 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6139 TRANSACTION_STMT. */
6141 static inline void
6142 gimple_transaction_set_body (gtransaction *transaction_stmt,
6143 gimple_seq body)
6145 transaction_stmt->body = body;
6148 /* Set the label associated with a GIMPLE_TRANSACTION. */
6150 static inline void
6151 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6153 transaction_stmt->label_norm = label;
6156 static inline void
6157 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6159 transaction_stmt->label_uninst = label;
6162 static inline void
6163 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6165 transaction_stmt->label_over = label;
6168 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6170 static inline void
6171 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6172 unsigned int subcode)
6174 transaction_stmt->subcode = subcode;
6177 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6179 static inline tree *
6180 gimple_return_retval_ptr (greturn *gs)
6182 return &gs->op[0];
6185 /* Return the return value for GIMPLE_RETURN GS. */
6187 static inline tree
6188 gimple_return_retval (const greturn *gs)
6190 return gs->op[0];
6194 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6196 static inline void
6197 gimple_return_set_retval (greturn *gs, tree retval)
6199 gs->op[0] = retval;
6203 /* Returns true when the gimple statement STMT is any of the OMP types. */
6205 #define CASE_GIMPLE_OMP \
6206 case GIMPLE_OMP_PARALLEL: \
6207 case GIMPLE_OMP_TASK: \
6208 case GIMPLE_OMP_FOR: \
6209 case GIMPLE_OMP_SECTIONS: \
6210 case GIMPLE_OMP_SECTIONS_SWITCH: \
6211 case GIMPLE_OMP_SINGLE: \
6212 case GIMPLE_OMP_TARGET: \
6213 case GIMPLE_OMP_TEAMS: \
6214 case GIMPLE_OMP_SECTION: \
6215 case GIMPLE_OMP_MASTER: \
6216 case GIMPLE_OMP_TASKGROUP: \
6217 case GIMPLE_OMP_ORDERED: \
6218 case GIMPLE_OMP_CRITICAL: \
6219 case GIMPLE_OMP_RETURN: \
6220 case GIMPLE_OMP_ATOMIC_LOAD: \
6221 case GIMPLE_OMP_ATOMIC_STORE: \
6222 case GIMPLE_OMP_CONTINUE: \
6223 case GIMPLE_OMP_GRID_BODY
6225 static inline bool
6226 is_gimple_omp (const gimple *stmt)
6228 switch (gimple_code (stmt))
6230 CASE_GIMPLE_OMP:
6231 return true;
6232 default:
6233 return false;
6237 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6238 specifically. */
6240 static inline bool
6241 is_gimple_omp_oacc (const gimple *stmt)
6243 gcc_assert (is_gimple_omp (stmt));
6244 switch (gimple_code (stmt))
6246 case GIMPLE_OMP_FOR:
6247 switch (gimple_omp_for_kind (stmt))
6249 case GF_OMP_FOR_KIND_OACC_LOOP:
6250 return true;
6251 default:
6252 return false;
6254 case GIMPLE_OMP_TARGET:
6255 switch (gimple_omp_target_kind (stmt))
6257 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6258 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6259 case GF_OMP_TARGET_KIND_OACC_DATA:
6260 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6261 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6262 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6263 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6264 return true;
6265 default:
6266 return false;
6268 default:
6269 return false;
6274 /* Return true if the OMP gimple statement STMT is offloaded. */
6276 static inline bool
6277 is_gimple_omp_offloaded (const gimple *stmt)
6279 gcc_assert (is_gimple_omp (stmt));
6280 switch (gimple_code (stmt))
6282 case GIMPLE_OMP_TARGET:
6283 switch (gimple_omp_target_kind (stmt))
6285 case GF_OMP_TARGET_KIND_REGION:
6286 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6287 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6288 return true;
6289 default:
6290 return false;
6292 default:
6293 return false;
6298 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6300 static inline bool
6301 gimple_nop_p (const gimple *g)
6303 return gimple_code (g) == GIMPLE_NOP;
6307 /* Return true if GS is a GIMPLE_RESX. */
6309 static inline bool
6310 is_gimple_resx (const gimple *gs)
6312 return gimple_code (gs) == GIMPLE_RESX;
6315 /* Return the type of the main expression computed by STMT. Return
6316 void_type_node if the statement computes nothing. */
6318 static inline tree
6319 gimple_expr_type (const gimple *stmt)
6321 enum gimple_code code = gimple_code (stmt);
6322 /* In general we want to pass out a type that can be substituted
6323 for both the RHS and the LHS types if there is a possibly
6324 useless conversion involved. That means returning the
6325 original RHS type as far as we can reconstruct it. */
6326 if (code == GIMPLE_CALL)
6328 const gcall *call_stmt = as_a <const gcall *> (stmt);
6329 if (gimple_call_internal_p (call_stmt))
6330 switch (gimple_call_internal_fn (call_stmt))
6332 case IFN_MASK_STORE:
6333 case IFN_SCATTER_STORE:
6334 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6335 case IFN_MASK_SCATTER_STORE:
6336 return TREE_TYPE (gimple_call_arg (call_stmt, 4));
6337 default:
6338 break;
6340 return gimple_call_return_type (call_stmt);
6342 else if (code == GIMPLE_ASSIGN)
6344 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6345 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6346 else
6347 /* As fallback use the type of the LHS. */
6348 return TREE_TYPE (gimple_get_lhs (stmt));
6350 else if (code == GIMPLE_COND)
6351 return boolean_type_node;
6352 else
6353 return void_type_node;
6356 /* Enum and arrays used for allocation stats. Keep in sync with
6357 gimple.c:gimple_alloc_kind_names. */
6358 enum gimple_alloc_kind
6360 gimple_alloc_kind_assign, /* Assignments. */
6361 gimple_alloc_kind_phi, /* PHI nodes. */
6362 gimple_alloc_kind_cond, /* Conditionals. */
6363 gimple_alloc_kind_rest, /* Everything else. */
6364 gimple_alloc_kind_all
6367 extern uint64_t gimple_alloc_counts[];
6368 extern uint64_t gimple_alloc_sizes[];
6370 /* Return the allocation kind for a given stmt CODE. */
6371 static inline enum gimple_alloc_kind
6372 gimple_alloc_kind (enum gimple_code code)
6374 switch (code)
6376 case GIMPLE_ASSIGN:
6377 return gimple_alloc_kind_assign;
6378 case GIMPLE_PHI:
6379 return gimple_alloc_kind_phi;
6380 case GIMPLE_COND:
6381 return gimple_alloc_kind_cond;
6382 default:
6383 return gimple_alloc_kind_rest;
6387 /* Return true if a location should not be emitted for this statement
6388 by annotate_all_with_location. */
6390 static inline bool
6391 gimple_do_not_emit_location_p (gimple *g)
6393 return gimple_plf (g, GF_PLF_1);
6396 /* Mark statement G so a location will not be emitted by
6397 annotate_one_with_location. */
6399 static inline void
6400 gimple_set_do_not_emit_location (gimple *g)
6402 /* The PLF flags are initialized to 0 when a new tuple is created,
6403 so no need to initialize it anywhere. */
6404 gimple_set_plf (g, GF_PLF_1, true);
6408 /* Macros for showing usage statistics. */
6409 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6410 ? (x) \
6411 : ((x) < 1024*1024*10 \
6412 ? (x) / 1024 \
6413 : (x) / (1024*1024))))
6415 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6417 #endif /* GCC_GIMPLE_H */