d: Merge upstream dmd d579c467c1, phobos 88aa69b14.
[official-gcc.git] / gcc / gimple.h
blob77ac1495c46def4af050a86237ca03e1c655744f
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2022 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_ASM_INLINE = 1 << 2,
141 GF_CALL_FROM_THUNK = 1 << 0,
142 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
143 GF_CALL_TAILCALL = 1 << 2,
144 GF_CALL_VA_ARG_PACK = 1 << 3,
145 GF_CALL_NOTHROW = 1 << 4,
146 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
147 GF_CALL_INTERNAL = 1 << 6,
148 GF_CALL_CTRL_ALTERING = 1 << 7,
149 GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 GF_CALL_NOCF_CHECK = 1 << 11,
152 GF_CALL_FROM_NEW_OR_DELETE = 1 << 12,
153 GF_OMP_PARALLEL_COMBINED = 1 << 0,
154 GF_OMP_TASK_TASKLOOP = 1 << 0,
155 GF_OMP_TASK_TASKWAIT = 1 << 1,
156 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
157 GF_OMP_FOR_KIND_FOR = 0,
158 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
159 GF_OMP_FOR_KIND_TASKLOOP = 2,
160 GF_OMP_FOR_KIND_OACC_LOOP = 4,
161 GF_OMP_FOR_KIND_SIMD = 5,
162 GF_OMP_FOR_COMBINED = 1 << 3,
163 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
164 GF_OMP_TARGET_KIND_MASK = (1 << 5) - 1,
165 GF_OMP_TARGET_KIND_REGION = 0,
166 GF_OMP_TARGET_KIND_DATA = 1,
167 GF_OMP_TARGET_KIND_UPDATE = 2,
168 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
169 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
170 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
171 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
172 GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
173 GF_OMP_TARGET_KIND_OACC_DATA = 8,
174 GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
175 GF_OMP_TARGET_KIND_OACC_ENTER_DATA = 10,
176 GF_OMP_TARGET_KIND_OACC_EXIT_DATA = 11,
177 GF_OMP_TARGET_KIND_OACC_DECLARE = 12,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 13,
179 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
180 decomposed part, parallelized. */
181 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED = 14,
182 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
183 decomposed part, "gang-single". */
184 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE = 15,
185 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
186 decomposed parts' 'data' construct. */
187 GF_OMP_TARGET_KIND_OACC_DATA_KERNELS = 16,
188 GF_OMP_TEAMS_HOST = 1 << 0,
190 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
191 a thread synchronization via some sort of barrier. The exact barrier
192 that would otherwise be emitted is dependent on the OMP statement with
193 which this return is associated. */
194 GF_OMP_RETURN_NOWAIT = 1 << 0,
196 GF_OMP_SECTION_LAST = 1 << 0,
197 GF_OMP_ORDERED_STANDALONE = 1 << 0,
198 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 6) - 1,
199 GF_OMP_ATOMIC_NEED_VALUE = 1 << 6,
200 GF_OMP_ATOMIC_WEAK = 1 << 7,
201 GF_PREDICT_TAKEN = 1 << 15
204 /* This subcode tells apart different kinds of stmts that are not used
205 for codegen, but rather to retain debug information. */
206 enum gimple_debug_subcode {
207 GIMPLE_DEBUG_BIND = 0,
208 GIMPLE_DEBUG_SOURCE_BIND = 1,
209 GIMPLE_DEBUG_BEGIN_STMT = 2,
210 GIMPLE_DEBUG_INLINE_ENTRY = 3
213 /* Masks for selecting a pass local flag (PLF) to work on. These
214 masks are used by gimple_set_plf and gimple_plf. */
215 enum plf_mask {
216 GF_PLF_1 = 1 << 0,
217 GF_PLF_2 = 1 << 1
220 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
221 are for 64 bit hosts. */
223 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
224 chain_next ("%h.next"), variable_size))
225 gimple
227 /* [ WORD 1 ]
228 Main identifying code for a tuple. */
229 ENUM_BITFIELD(gimple_code) code : 8;
231 /* Nonzero if a warning should not be emitted on this tuple. */
232 unsigned int no_warning : 1;
234 /* Nonzero if this tuple has been visited. Passes are responsible
235 for clearing this bit before using it. */
236 unsigned int visited : 1;
238 /* Nonzero if this tuple represents a non-temporal move. */
239 unsigned int nontemporal_move : 1;
241 /* Pass local flags. These flags are free for any pass to use as
242 they see fit. Passes should not assume that these flags contain
243 any useful value when the pass starts. Any initial state that
244 the pass requires should be set on entry to the pass. See
245 gimple_set_plf and gimple_plf for usage. */
246 unsigned int plf : 2;
248 /* Nonzero if this statement has been modified and needs to have its
249 operands rescanned. */
250 unsigned modified : 1;
252 /* Nonzero if this statement contains volatile operands. */
253 unsigned has_volatile_ops : 1;
255 /* Padding to get subcode to 16 bit alignment. */
256 unsigned pad : 1;
258 /* The SUBCODE field can be used for tuple-specific flags for tuples
259 that do not require subcodes. Note that SUBCODE should be at
260 least as wide as tree codes, as several tuples store tree codes
261 in there. */
262 unsigned int subcode : 16;
264 /* UID of this statement. This is used by passes that want to
265 assign IDs to statements. It must be assigned and used by each
266 pass. By default it should be assumed to contain garbage. */
267 unsigned uid;
269 /* [ WORD 2 ]
270 Locus information for debug info. */
271 location_t location;
273 /* Number of operands in this tuple. */
274 unsigned num_ops;
276 /* [ WORD 3 ]
277 Basic block holding this statement. */
278 basic_block bb;
280 /* [ WORD 4-5 ]
281 Linked lists of gimple statements. The next pointers form
282 a NULL terminated list, the prev pointers are a cyclic list.
283 A gimple statement is hence also a double-ended list of
284 statements, with the pointer itself being the first element,
285 and the prev pointer being the last. */
286 gimple *next;
287 gimple *GTY((skip)) prev;
291 /* Base structure for tuples with operands. */
293 /* This gimple subclass has no tag value. */
294 struct GTY(())
295 gimple_statement_with_ops_base : public gimple
297 /* [ WORD 1-6 ] : base class */
299 /* [ WORD 7 ]
300 SSA operand vectors. NOTE: It should be possible to
301 amalgamate these vectors with the operand vector OP. However,
302 the SSA operand vectors are organized differently and contain
303 more information (like immediate use chaining). */
304 struct use_optype_d GTY((skip (""))) *use_ops;
308 /* Statements that take register operands. */
310 struct GTY((tag("GSS_WITH_OPS")))
311 gimple_statement_with_ops : public gimple_statement_with_ops_base
313 /* [ WORD 1-7 ] : base class */
315 /* [ WORD 8 ]
316 Operand vector. NOTE! This must always be the last field
317 of this structure. In particular, this means that this
318 structure cannot be embedded inside another one. */
319 tree GTY((length ("%h.num_ops"))) op[1];
323 /* Base for statements that take both memory and register operands. */
325 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
326 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
328 /* [ WORD 1-7 ] : base class */
330 /* [ WORD 8-9 ]
331 Virtual operands for this statement. The GC will pick them
332 up via the ssa_names array. */
333 tree GTY((skip (""))) vdef;
334 tree GTY((skip (""))) vuse;
338 /* Statements that take both memory and register operands. */
340 struct GTY((tag("GSS_WITH_MEM_OPS")))
341 gimple_statement_with_memory_ops :
342 public gimple_statement_with_memory_ops_base
344 /* [ WORD 1-9 ] : base class */
346 /* [ WORD 10 ]
347 Operand vector. NOTE! This must always be the last field
348 of this structure. In particular, this means that this
349 structure cannot be embedded inside another one. */
350 tree GTY((length ("%h.num_ops"))) op[1];
354 /* Call statements that take both memory and register operands. */
356 struct GTY((tag("GSS_CALL")))
357 gcall : public gimple_statement_with_memory_ops_base
359 /* [ WORD 1-9 ] : base class */
361 /* [ WORD 10-13 ] */
362 struct pt_solution call_used;
363 struct pt_solution call_clobbered;
365 /* [ WORD 14 ] */
366 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
367 tree GTY ((tag ("0"))) fntype;
368 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
369 } u;
371 /* [ WORD 15 ]
372 Operand vector. NOTE! This must always be the last field
373 of this structure. In particular, this means that this
374 structure cannot be embedded inside another one. */
375 tree GTY((length ("%h.num_ops"))) op[1];
377 static const enum gimple_code code_ = GIMPLE_CALL;
381 /* OMP statements. */
383 struct GTY((tag("GSS_OMP")))
384 gimple_statement_omp : public gimple
386 /* [ WORD 1-6 ] : base class */
388 /* [ WORD 7 ] */
389 gimple_seq body;
393 /* GIMPLE_BIND */
395 struct GTY((tag("GSS_BIND")))
396 gbind : public gimple
398 /* [ WORD 1-6 ] : base class */
400 /* [ WORD 7 ]
401 Variables declared in this scope. */
402 tree vars;
404 /* [ WORD 8 ]
405 This is different than the BLOCK field in gimple,
406 which is analogous to TREE_BLOCK (i.e., the lexical block holding
407 this statement). This field is the equivalent of BIND_EXPR_BLOCK
408 in tree land (i.e., the lexical scope defined by this bind). See
409 gimple-low.cc. */
410 tree block;
412 /* [ WORD 9 ] */
413 gimple_seq body;
417 /* GIMPLE_CATCH */
419 struct GTY((tag("GSS_CATCH")))
420 gcatch : public gimple
422 /* [ WORD 1-6 ] : base class */
424 /* [ WORD 7 ] */
425 tree types;
427 /* [ WORD 8 ] */
428 gimple_seq handler;
432 /* GIMPLE_EH_FILTER */
434 struct GTY((tag("GSS_EH_FILTER")))
435 geh_filter : public gimple
437 /* [ WORD 1-6 ] : base class */
439 /* [ WORD 7 ]
440 Filter types. */
441 tree types;
443 /* [ WORD 8 ]
444 Failure actions. */
445 gimple_seq failure;
448 /* GIMPLE_EH_ELSE */
450 struct GTY((tag("GSS_EH_ELSE")))
451 geh_else : public gimple
453 /* [ WORD 1-6 ] : base class */
455 /* [ WORD 7,8 ] */
456 gimple_seq n_body, e_body;
459 /* GIMPLE_EH_MUST_NOT_THROW */
461 struct GTY((tag("GSS_EH_MNT")))
462 geh_mnt : public gimple
464 /* [ WORD 1-6 ] : base class */
466 /* [ WORD 7 ] Abort function decl. */
467 tree fndecl;
470 /* GIMPLE_PHI */
472 struct GTY((tag("GSS_PHI")))
473 gphi : public gimple
475 /* [ WORD 1-6 ] : base class */
477 /* [ WORD 7 ] */
478 unsigned capacity;
479 unsigned nargs;
481 /* [ WORD 8 ] */
482 tree result;
484 /* [ WORD 9 ] */
485 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
489 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
491 struct GTY((tag("GSS_EH_CTRL")))
492 gimple_statement_eh_ctrl : public gimple
494 /* [ WORD 1-6 ] : base class */
496 /* [ WORD 7 ]
497 Exception region number. */
498 int region;
501 struct GTY((tag("GSS_EH_CTRL")))
502 gresx : public gimple_statement_eh_ctrl
504 /* No extra fields; adds invariant:
505 stmt->code == GIMPLE_RESX. */
508 struct GTY((tag("GSS_EH_CTRL")))
509 geh_dispatch : public gimple_statement_eh_ctrl
511 /* No extra fields; adds invariant:
512 stmt->code == GIMPLE_EH_DISPATH. */
516 /* GIMPLE_TRY */
518 struct GTY((tag("GSS_TRY")))
519 gtry : public gimple
521 /* [ WORD 1-6 ] : base class */
523 /* [ WORD 7 ]
524 Expression to evaluate. */
525 gimple_seq eval;
527 /* [ WORD 8 ]
528 Cleanup expression. */
529 gimple_seq cleanup;
532 /* Kind of GIMPLE_TRY statements. */
533 enum gimple_try_flags
535 /* A try/catch. */
536 GIMPLE_TRY_CATCH = 1 << 0,
538 /* A try/finally. */
539 GIMPLE_TRY_FINALLY = 1 << 1,
540 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
542 /* Analogous to TRY_CATCH_IS_CLEANUP. */
543 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
546 /* GIMPLE_WITH_CLEANUP_EXPR */
548 struct GTY((tag("GSS_WCE")))
549 gimple_statement_wce : public gimple
551 /* [ WORD 1-6 ] : base class */
553 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
554 executed if an exception is thrown, not on normal exit of its
555 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
556 in TARGET_EXPRs. */
558 /* [ WORD 7 ]
559 Cleanup expression. */
560 gimple_seq cleanup;
564 /* GIMPLE_ASM */
566 struct GTY((tag("GSS_ASM")))
567 gasm : public gimple_statement_with_memory_ops_base
569 /* [ WORD 1-9 ] : base class */
571 /* [ WORD 10 ]
572 __asm__ statement. */
573 const char *string;
575 /* [ WORD 11 ]
576 Number of inputs, outputs, clobbers, labels. */
577 unsigned char ni;
578 unsigned char no;
579 unsigned char nc;
580 unsigned char nl;
582 /* [ WORD 12 ]
583 Operand vector. NOTE! This must always be the last field
584 of this structure. In particular, this means that this
585 structure cannot be embedded inside another one. */
586 tree GTY((length ("%h.num_ops"))) op[1];
589 /* GIMPLE_OMP_CRITICAL */
591 struct GTY((tag("GSS_OMP_CRITICAL")))
592 gomp_critical : public gimple_statement_omp
594 /* [ WORD 1-7 ] : base class */
596 /* [ WORD 8 ] */
597 tree clauses;
599 /* [ WORD 9 ]
600 Critical section name. */
601 tree name;
605 struct GTY(()) gimple_omp_for_iter {
606 /* Condition code. */
607 enum tree_code cond;
609 /* Index variable. */
610 tree index;
612 /* Initial value. */
613 tree initial;
615 /* Final value. */
616 tree final;
618 /* Increment. */
619 tree incr;
622 /* GIMPLE_OMP_FOR */
624 struct GTY((tag("GSS_OMP_FOR")))
625 gomp_for : public gimple_statement_omp
627 /* [ WORD 1-7 ] : base class */
629 /* [ WORD 8 ] */
630 tree clauses;
632 /* [ WORD 9 ]
633 Number of elements in iter array. */
634 size_t collapse;
636 /* [ WORD 10 ] */
637 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
639 /* [ WORD 11 ]
640 Pre-body evaluated before the loop body begins. */
641 gimple_seq pre_body;
645 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
647 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
648 gimple_statement_omp_parallel_layout : public gimple_statement_omp
650 /* [ WORD 1-7 ] : base class */
652 /* [ WORD 8 ]
653 Clauses. */
654 tree clauses;
656 /* [ WORD 9 ]
657 Child function holding the body of the parallel region. */
658 tree child_fn;
660 /* [ WORD 10 ]
661 Shared data argument. */
662 tree data_arg;
665 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
666 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
667 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_PARALLEL
671 || stmt->code == GIMPLE_OMP_TASK
672 || stmt->code == GIMPLE_OMP_TEAMS. */
675 /* GIMPLE_OMP_PARALLEL */
676 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
677 gomp_parallel : public gimple_statement_omp_taskreg
679 /* No extra fields; adds invariant:
680 stmt->code == GIMPLE_OMP_PARALLEL. */
683 /* GIMPLE_OMP_TARGET */
684 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
685 gomp_target : public gimple_statement_omp_parallel_layout
687 /* No extra fields; adds invariant:
688 stmt->code == GIMPLE_OMP_TARGET. */
691 /* GIMPLE_OMP_TASK */
693 struct GTY((tag("GSS_OMP_TASK")))
694 gomp_task : public gimple_statement_omp_taskreg
696 /* [ WORD 1-10 ] : base class */
698 /* [ WORD 11 ]
699 Child function holding firstprivate initialization if needed. */
700 tree copy_fn;
702 /* [ WORD 12-13 ]
703 Size and alignment in bytes of the argument data block. */
704 tree arg_size;
705 tree arg_align;
709 /* GIMPLE_OMP_SECTION */
710 /* Uses struct gimple_statement_omp. */
713 /* GIMPLE_OMP_SECTIONS */
715 struct GTY((tag("GSS_OMP_SECTIONS")))
716 gomp_sections : public gimple_statement_omp
718 /* [ WORD 1-7 ] : base class */
720 /* [ WORD 8 ] */
721 tree clauses;
723 /* [ WORD 9 ]
724 The control variable used for deciding which of the sections to
725 execute. */
726 tree control;
729 /* GIMPLE_OMP_CONTINUE.
731 Note: This does not inherit from gimple_statement_omp, because we
732 do not need the body field. */
734 struct GTY((tag("GSS_OMP_CONTINUE")))
735 gomp_continue : public gimple
737 /* [ WORD 1-6 ] : base class */
739 /* [ WORD 7 ] */
740 tree control_def;
742 /* [ WORD 8 ] */
743 tree control_use;
746 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
747 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
749 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
750 gimple_statement_omp_single_layout : public gimple_statement_omp
752 /* [ WORD 1-7 ] : base class */
754 /* [ WORD 8 ] */
755 tree clauses;
758 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
759 gomp_single : public gimple_statement_omp_single_layout
761 /* No extra fields; adds invariant:
762 stmt->code == GIMPLE_OMP_SINGLE. */
765 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
766 gomp_teams : public gimple_statement_omp_taskreg
768 /* No extra fields; adds invariant:
769 stmt->code == GIMPLE_OMP_TEAMS. */
772 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
773 gomp_ordered : public gimple_statement_omp_single_layout
775 /* No extra fields; adds invariant:
776 stmt->code == GIMPLE_OMP_ORDERED. */
779 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
780 gomp_scan : public gimple_statement_omp_single_layout
782 /* No extra fields; adds invariant:
783 stmt->code == GIMPLE_OMP_SCAN. */
787 /* GIMPLE_OMP_ATOMIC_LOAD.
788 Note: This is based on gimple, not g_s_omp, because g_s_omp
789 contains a sequence, which we don't need here. */
791 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
792 gomp_atomic_load : public gimple
794 /* [ WORD 1-6 ] : base class */
796 /* [ WORD 7-8 ] */
797 tree rhs, lhs;
800 /* GIMPLE_OMP_ATOMIC_STORE.
801 See note on GIMPLE_OMP_ATOMIC_LOAD. */
803 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
804 gimple_statement_omp_atomic_store_layout : public gimple
806 /* [ WORD 1-6 ] : base class */
808 /* [ WORD 7 ] */
809 tree val;
812 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
813 gomp_atomic_store :
814 public gimple_statement_omp_atomic_store_layout
816 /* No extra fields; adds invariant:
817 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
820 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
821 gimple_statement_omp_return :
822 public gimple_statement_omp_atomic_store_layout
824 /* No extra fields; adds invariant:
825 stmt->code == GIMPLE_OMP_RETURN. */
828 /* GIMPLE_TRANSACTION. */
830 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
832 /* The __transaction_atomic was declared [[outer]] or it is
833 __transaction_relaxed. */
834 #define GTMA_IS_OUTER (1u << 0)
835 #define GTMA_IS_RELAXED (1u << 1)
836 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
838 /* The transaction is seen to not have an abort. */
839 #define GTMA_HAVE_ABORT (1u << 2)
840 /* The transaction is seen to have loads or stores. */
841 #define GTMA_HAVE_LOAD (1u << 3)
842 #define GTMA_HAVE_STORE (1u << 4)
843 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
844 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
845 /* The transaction WILL enter serial irrevocable mode.
846 An irrevocable block post-dominates the entire transaction, such
847 that all invocations of the transaction will go serial-irrevocable.
848 In such case, we don't bother instrumenting the transaction, and
849 tell the runtime that it should begin the transaction in
850 serial-irrevocable mode. */
851 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
852 /* The transaction contains no instrumentation code whatsover, most
853 likely because it is guaranteed to go irrevocable upon entry. */
854 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
856 struct GTY((tag("GSS_TRANSACTION")))
857 gtransaction : public gimple_statement_with_memory_ops_base
859 /* [ WORD 1-9 ] : base class */
861 /* [ WORD 10 ] */
862 gimple_seq body;
864 /* [ WORD 11-13 ] */
865 tree label_norm;
866 tree label_uninst;
867 tree label_over;
870 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
871 enum gimple_statement_structure_enum {
872 #include "gsstruct.def"
873 LAST_GSS_ENUM
875 #undef DEFGSSTRUCT
877 /* A statement with the invariant that
878 stmt->code == GIMPLE_COND
879 i.e. a conditional jump statement. */
881 struct GTY((tag("GSS_WITH_OPS")))
882 gcond : public gimple_statement_with_ops
884 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
885 static const enum gimple_code code_ = GIMPLE_COND;
888 /* A statement with the invariant that
889 stmt->code == GIMPLE_DEBUG
890 i.e. a debug statement. */
892 struct GTY((tag("GSS_WITH_OPS")))
893 gdebug : public gimple_statement_with_ops
895 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
898 /* A statement with the invariant that
899 stmt->code == GIMPLE_GOTO
900 i.e. a goto statement. */
902 struct GTY((tag("GSS_WITH_OPS")))
903 ggoto : public gimple_statement_with_ops
905 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
908 /* A statement with the invariant that
909 stmt->code == GIMPLE_LABEL
910 i.e. a label statement. */
912 struct GTY((tag("GSS_WITH_OPS")))
913 glabel : public gimple_statement_with_ops
915 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
918 /* A statement with the invariant that
919 stmt->code == GIMPLE_SWITCH
920 i.e. a switch statement. */
922 struct GTY((tag("GSS_WITH_OPS")))
923 gswitch : public gimple_statement_with_ops
925 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
928 /* A statement with the invariant that
929 stmt->code == GIMPLE_ASSIGN
930 i.e. an assignment statement. */
932 struct GTY((tag("GSS_WITH_MEM_OPS")))
933 gassign : public gimple_statement_with_memory_ops
935 static const enum gimple_code code_ = GIMPLE_ASSIGN;
936 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
939 /* A statement with the invariant that
940 stmt->code == GIMPLE_RETURN
941 i.e. a return statement. */
943 struct GTY((tag("GSS_WITH_MEM_OPS")))
944 greturn : public gimple_statement_with_memory_ops
946 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
949 template <>
950 template <>
951 inline bool
952 is_a_helper <gasm *>::test (gimple *gs)
954 return gs->code == GIMPLE_ASM;
957 template <>
958 template <>
959 inline bool
960 is_a_helper <gassign *>::test (gimple *gs)
962 return gs->code == GIMPLE_ASSIGN;
965 template <>
966 template <>
967 inline bool
968 is_a_helper <const gassign *>::test (const gimple *gs)
970 return gs->code == GIMPLE_ASSIGN;
973 template <>
974 template <>
975 inline bool
976 is_a_helper <gbind *>::test (gimple *gs)
978 return gs->code == GIMPLE_BIND;
981 template <>
982 template <>
983 inline bool
984 is_a_helper <gcall *>::test (gimple *gs)
986 return gs->code == GIMPLE_CALL;
989 template <>
990 template <>
991 inline bool
992 is_a_helper <gcatch *>::test (gimple *gs)
994 return gs->code == GIMPLE_CATCH;
997 template <>
998 template <>
999 inline bool
1000 is_a_helper <gcond *>::test (gimple *gs)
1002 return gs->code == GIMPLE_COND;
1005 template <>
1006 template <>
1007 inline bool
1008 is_a_helper <const gcond *>::test (const gimple *gs)
1010 return gs->code == GIMPLE_COND;
1013 template <>
1014 template <>
1015 inline bool
1016 is_a_helper <gdebug *>::test (gimple *gs)
1018 return gs->code == GIMPLE_DEBUG;
1021 template <>
1022 template <>
1023 inline bool
1024 is_a_helper <const gdebug *>::test (const gimple *gs)
1026 return gs->code == GIMPLE_DEBUG;
1029 template <>
1030 template <>
1031 inline bool
1032 is_a_helper <ggoto *>::test (gimple *gs)
1034 return gs->code == GIMPLE_GOTO;
1037 template <>
1038 template <>
1039 inline bool
1040 is_a_helper <const ggoto *>::test (const gimple *gs)
1042 return gs->code == GIMPLE_GOTO;
1045 template <>
1046 template <>
1047 inline bool
1048 is_a_helper <glabel *>::test (gimple *gs)
1050 return gs->code == GIMPLE_LABEL;
1053 template <>
1054 template <>
1055 inline bool
1056 is_a_helper <const glabel *>::test (const gimple *gs)
1058 return gs->code == GIMPLE_LABEL;
1061 template <>
1062 template <>
1063 inline bool
1064 is_a_helper <gresx *>::test (gimple *gs)
1066 return gs->code == GIMPLE_RESX;
1069 template <>
1070 template <>
1071 inline bool
1072 is_a_helper <geh_dispatch *>::test (gimple *gs)
1074 return gs->code == GIMPLE_EH_DISPATCH;
1077 template <>
1078 template <>
1079 inline bool
1080 is_a_helper <geh_else *>::test (gimple *gs)
1082 return gs->code == GIMPLE_EH_ELSE;
1085 template <>
1086 template <>
1087 inline bool
1088 is_a_helper <const geh_else *>::test (const gimple *gs)
1090 return gs->code == GIMPLE_EH_ELSE;
1093 template <>
1094 template <>
1095 inline bool
1096 is_a_helper <geh_filter *>::test (gimple *gs)
1098 return gs->code == GIMPLE_EH_FILTER;
1101 template <>
1102 template <>
1103 inline bool
1104 is_a_helper <geh_mnt *>::test (gimple *gs)
1106 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1109 template <>
1110 template <>
1111 inline bool
1112 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1114 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1117 template <>
1118 template <>
1119 inline bool
1120 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1122 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1125 template <>
1126 template <>
1127 inline bool
1128 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1130 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1133 template <>
1134 template <>
1135 inline bool
1136 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1138 return gs->code == GIMPLE_OMP_RETURN;
1141 template <>
1142 template <>
1143 inline bool
1144 is_a_helper <gomp_continue *>::test (gimple *gs)
1146 return gs->code == GIMPLE_OMP_CONTINUE;
1149 template <>
1150 template <>
1151 inline bool
1152 is_a_helper <gomp_critical *>::test (gimple *gs)
1154 return gs->code == GIMPLE_OMP_CRITICAL;
1157 template <>
1158 template <>
1159 inline bool
1160 is_a_helper <gomp_ordered *>::test (gimple *gs)
1162 return gs->code == GIMPLE_OMP_ORDERED;
1165 template <>
1166 template <>
1167 inline bool
1168 is_a_helper <gomp_scan *>::test (gimple *gs)
1170 return gs->code == GIMPLE_OMP_SCAN;
1173 template <>
1174 template <>
1175 inline bool
1176 is_a_helper <gomp_for *>::test (gimple *gs)
1178 return gs->code == GIMPLE_OMP_FOR;
1181 template <>
1182 template <>
1183 inline bool
1184 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1186 return (gs->code == GIMPLE_OMP_PARALLEL
1187 || gs->code == GIMPLE_OMP_TASK
1188 || gs->code == GIMPLE_OMP_TEAMS);
1191 template <>
1192 template <>
1193 inline bool
1194 is_a_helper <gomp_parallel *>::test (gimple *gs)
1196 return gs->code == GIMPLE_OMP_PARALLEL;
1199 template <>
1200 template <>
1201 inline bool
1202 is_a_helper <gomp_target *>::test (gimple *gs)
1204 return gs->code == GIMPLE_OMP_TARGET;
1207 template <>
1208 template <>
1209 inline bool
1210 is_a_helper <gomp_sections *>::test (gimple *gs)
1212 return gs->code == GIMPLE_OMP_SECTIONS;
1215 template <>
1216 template <>
1217 inline bool
1218 is_a_helper <gomp_single *>::test (gimple *gs)
1220 return gs->code == GIMPLE_OMP_SINGLE;
1223 template <>
1224 template <>
1225 inline bool
1226 is_a_helper <gomp_teams *>::test (gimple *gs)
1228 return gs->code == GIMPLE_OMP_TEAMS;
1231 template <>
1232 template <>
1233 inline bool
1234 is_a_helper <gomp_task *>::test (gimple *gs)
1236 return gs->code == GIMPLE_OMP_TASK;
1239 template <>
1240 template <>
1241 inline bool
1242 is_a_helper <gphi *>::test (gimple *gs)
1244 return gs->code == GIMPLE_PHI;
1247 template <>
1248 template <>
1249 inline bool
1250 is_a_helper <greturn *>::test (gimple *gs)
1252 return gs->code == GIMPLE_RETURN;
1255 template <>
1256 template <>
1257 inline bool
1258 is_a_helper <gswitch *>::test (gimple *gs)
1260 return gs->code == GIMPLE_SWITCH;
1263 template <>
1264 template <>
1265 inline bool
1266 is_a_helper <const gswitch *>::test (const gimple *gs)
1268 return gs->code == GIMPLE_SWITCH;
1271 template <>
1272 template <>
1273 inline bool
1274 is_a_helper <gtransaction *>::test (gimple *gs)
1276 return gs->code == GIMPLE_TRANSACTION;
1279 template <>
1280 template <>
1281 inline bool
1282 is_a_helper <gtry *>::test (gimple *gs)
1284 return gs->code == GIMPLE_TRY;
1287 template <>
1288 template <>
1289 inline bool
1290 is_a_helper <const gtry *>::test (const gimple *gs)
1292 return gs->code == GIMPLE_TRY;
1295 template <>
1296 template <>
1297 inline bool
1298 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1300 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1303 template <>
1304 template <>
1305 inline bool
1306 is_a_helper <const gasm *>::test (const gimple *gs)
1308 return gs->code == GIMPLE_ASM;
1311 template <>
1312 template <>
1313 inline bool
1314 is_a_helper <const gbind *>::test (const gimple *gs)
1316 return gs->code == GIMPLE_BIND;
1319 template <>
1320 template <>
1321 inline bool
1322 is_a_helper <const gcall *>::test (const gimple *gs)
1324 return gs->code == GIMPLE_CALL;
1327 template <>
1328 template <>
1329 inline bool
1330 is_a_helper <const gcatch *>::test (const gimple *gs)
1332 return gs->code == GIMPLE_CATCH;
1335 template <>
1336 template <>
1337 inline bool
1338 is_a_helper <const gresx *>::test (const gimple *gs)
1340 return gs->code == GIMPLE_RESX;
1343 template <>
1344 template <>
1345 inline bool
1346 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1348 return gs->code == GIMPLE_EH_DISPATCH;
1351 template <>
1352 template <>
1353 inline bool
1354 is_a_helper <const geh_filter *>::test (const gimple *gs)
1356 return gs->code == GIMPLE_EH_FILTER;
1359 template <>
1360 template <>
1361 inline bool
1362 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1364 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1367 template <>
1368 template <>
1369 inline bool
1370 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1372 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1375 template <>
1376 template <>
1377 inline bool
1378 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1380 return gs->code == GIMPLE_OMP_RETURN;
1383 template <>
1384 template <>
1385 inline bool
1386 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1388 return gs->code == GIMPLE_OMP_CONTINUE;
1391 template <>
1392 template <>
1393 inline bool
1394 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1396 return gs->code == GIMPLE_OMP_CRITICAL;
1399 template <>
1400 template <>
1401 inline bool
1402 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1404 return gs->code == GIMPLE_OMP_ORDERED;
1407 template <>
1408 template <>
1409 inline bool
1410 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1412 return gs->code == GIMPLE_OMP_SCAN;
1415 template <>
1416 template <>
1417 inline bool
1418 is_a_helper <const gomp_for *>::test (const gimple *gs)
1420 return gs->code == GIMPLE_OMP_FOR;
1423 template <>
1424 template <>
1425 inline bool
1426 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1428 return (gs->code == GIMPLE_OMP_PARALLEL
1429 || gs->code == GIMPLE_OMP_TASK
1430 || gs->code == GIMPLE_OMP_TEAMS);
1433 template <>
1434 template <>
1435 inline bool
1436 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1438 return gs->code == GIMPLE_OMP_PARALLEL;
1441 template <>
1442 template <>
1443 inline bool
1444 is_a_helper <const gomp_target *>::test (const gimple *gs)
1446 return gs->code == GIMPLE_OMP_TARGET;
1449 template <>
1450 template <>
1451 inline bool
1452 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1454 return gs->code == GIMPLE_OMP_SECTIONS;
1457 template <>
1458 template <>
1459 inline bool
1460 is_a_helper <const gomp_single *>::test (const gimple *gs)
1462 return gs->code == GIMPLE_OMP_SINGLE;
1465 template <>
1466 template <>
1467 inline bool
1468 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1470 return gs->code == GIMPLE_OMP_TEAMS;
1473 template <>
1474 template <>
1475 inline bool
1476 is_a_helper <const gomp_task *>::test (const gimple *gs)
1478 return gs->code == GIMPLE_OMP_TASK;
1481 template <>
1482 template <>
1483 inline bool
1484 is_a_helper <const gphi *>::test (const gimple *gs)
1486 return gs->code == GIMPLE_PHI;
1489 template <>
1490 template <>
1491 inline bool
1492 is_a_helper <const greturn *>::test (const gimple *gs)
1494 return gs->code == GIMPLE_RETURN;
1497 template <>
1498 template <>
1499 inline bool
1500 is_a_helper <const gtransaction *>::test (const gimple *gs)
1502 return gs->code == GIMPLE_TRANSACTION;
1505 /* Offset in bytes to the location of the operand vector.
1506 Zero if there is no operand vector for this tuple structure. */
1507 extern size_t const gimple_ops_offset_[];
1509 /* Map GIMPLE codes to GSS codes. */
1510 extern enum gimple_statement_structure_enum const gss_for_code_[];
1512 /* This variable holds the currently expanded gimple statement for purposes
1513 of comminucating the profile info to the builtin expanders. */
1514 extern gimple *currently_expanding_gimple_stmt;
1516 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1517 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1518 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1519 greturn *gimple_build_return (tree);
1520 void gimple_call_reset_alias_info (gcall *);
1521 gcall *gimple_build_call_vec (tree, const vec<tree> &);
1522 gcall *gimple_build_call (tree, unsigned, ...);
1523 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1524 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1525 gcall *gimple_build_call_internal_vec (enum internal_fn, const vec<tree> &);
1526 gcall *gimple_build_call_from_tree (tree, tree);
1527 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1528 gassign *gimple_build_assign (tree, enum tree_code,
1529 tree, tree, tree CXX_MEM_STAT_INFO);
1530 gassign *gimple_build_assign (tree, enum tree_code,
1531 tree, tree CXX_MEM_STAT_INFO);
1532 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1533 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1534 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1535 void gimple_cond_set_condition_from_tree (gcond *, tree);
1536 glabel *gimple_build_label (tree label);
1537 ggoto *gimple_build_goto (tree dest);
1538 gimple *gimple_build_nop (void);
1539 gbind *gimple_build_bind (tree, gimple_seq, tree);
1540 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1541 vec<tree, va_gc> *, vec<tree, va_gc> *,
1542 vec<tree, va_gc> *);
1543 gcatch *gimple_build_catch (tree, gimple_seq);
1544 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1545 geh_mnt *gimple_build_eh_must_not_throw (tree);
1546 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1547 gtry *gimple_build_try (gimple_seq, gimple_seq,
1548 enum gimple_try_flags);
1549 gimple *gimple_build_wce (gimple_seq);
1550 gresx *gimple_build_resx (int);
1551 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1552 gswitch *gimple_build_switch (tree, tree, const vec<tree> &);
1553 geh_dispatch *gimple_build_eh_dispatch (int);
1554 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1555 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1556 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1557 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1558 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1559 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1560 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1561 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1562 tree, tree);
1563 gimple *gimple_build_omp_section (gimple_seq);
1564 gimple *gimple_build_omp_scope (gimple_seq, tree);
1565 gimple *gimple_build_omp_master (gimple_seq);
1566 gimple *gimple_build_omp_masked (gimple_seq, tree);
1567 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1568 gomp_continue *gimple_build_omp_continue (tree, tree);
1569 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1570 gimple *gimple_build_omp_return (bool);
1571 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1572 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1573 gimple *gimple_build_omp_sections_switch (void);
1574 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1575 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1576 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1577 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1578 enum omp_memory_order);
1579 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1580 gtransaction *gimple_build_transaction (gimple_seq);
1581 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1582 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1583 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1584 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1585 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1586 location_t);
1587 extern void annotate_all_with_location (gimple_seq, location_t);
1588 bool empty_body_p (gimple_seq);
1589 gimple_seq gimple_seq_copy (gimple_seq);
1590 bool gimple_call_same_target_p (const gimple *, const gimple *);
1591 int gimple_call_flags (const gimple *);
1592 int gimple_call_arg_flags (const gcall *, unsigned);
1593 int gimple_call_retslot_flags (const gcall *);
1594 int gimple_call_static_chain_flags (const gcall *);
1595 int gimple_call_return_flags (const gcall *);
1596 bool gimple_call_nonnull_result_p (gcall *);
1597 tree gimple_call_nonnull_arg (gcall *);
1598 bool gimple_assign_copy_p (gimple *);
1599 bool gimple_assign_ssa_name_copy_p (gimple *);
1600 bool gimple_assign_unary_nop_p (gimple *);
1601 void gimple_set_bb (gimple *, basic_block);
1602 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1603 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1604 tree, tree, tree);
1605 tree gimple_get_lhs (const gimple *);
1606 void gimple_set_lhs (gimple *, tree);
1607 gimple *gimple_copy (gimple *);
1608 void gimple_move_vops (gimple *, gimple *);
1609 bool gimple_has_side_effects (const gimple *);
1610 bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1611 bool gimple_could_trap_p (const gimple *);
1612 bool gimple_assign_rhs_could_trap_p (gimple *);
1613 extern void dump_gimple_statistics (void);
1614 unsigned get_gimple_rhs_num_ops (enum tree_code);
1615 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1616 extern bool gimple_compare_field_offset (tree, tree);
1617 extern tree gimple_unsigned_type (tree);
1618 extern tree gimple_signed_type (tree);
1619 extern alias_set_type gimple_get_alias_set (tree);
1620 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1621 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1622 extern combined_fn gimple_call_combined_fn (const gimple *);
1623 extern bool gimple_call_operator_delete_p (const gcall *);
1624 extern bool gimple_call_builtin_p (const gimple *);
1625 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1626 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1627 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1628 extern void dump_decl_set (FILE *, bitmap);
1629 extern bool nonfreeing_call_p (gimple *);
1630 extern bool nonbarrier_call_p (gimple *);
1631 extern bool infer_nonnull_range (gimple *, tree);
1632 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1633 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1634 extern void sort_case_labels (vec<tree> &);
1635 extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
1636 extern void gimple_seq_set_location (gimple_seq, location_t);
1637 extern void gimple_seq_discard (gimple_seq);
1638 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1639 extern bool gimple_inexpensive_call_p (gcall *);
1640 extern bool stmt_can_terminate_bb_p (gimple *);
1641 extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1642 gcall *gimple_build_builtin_unreachable (location_t);
1644 /* Return the disposition for a warning (or all warnings by default)
1645 for a statement. */
1646 extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1647 ATTRIBUTE_NONNULL (1);
1648 /* Set the disposition for a warning (or all warnings by default)
1649 at a location to enabled by default. */
1650 extern void suppress_warning (gimple *, opt_code = all_warnings,
1651 bool = true) ATTRIBUTE_NONNULL (1);
1653 /* Copy the warning disposition mapping from one statement to another. */
1654 extern void copy_warning (gimple *, const gimple *)
1655 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1656 /* Copy the warning disposition mapping from an expression to a statement. */
1657 extern void copy_warning (gimple *, const_tree)
1658 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1659 /* Copy the warning disposition mapping from a statement to an expression. */
1660 extern void copy_warning (tree, const gimple *)
1661 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1663 /* Formal (expression) temporary table handling: multiple occurrences of
1664 the same scalar expression are evaluated into the same temporary. */
1666 typedef struct gimple_temp_hash_elt
1668 tree val; /* Key */
1669 tree temp; /* Value */
1670 } elt_t;
1672 /* Get the number of the next statement uid to be allocated. */
1673 static inline unsigned int
1674 gimple_stmt_max_uid (struct function *fn)
1676 return fn->last_stmt_uid;
1679 /* Set the number of the next statement uid to be allocated. */
1680 static inline void
1681 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1683 fn->last_stmt_uid = maxid;
1686 /* Set the number of the next statement uid to be allocated. */
1687 static inline unsigned int
1688 inc_gimple_stmt_max_uid (struct function *fn)
1690 return fn->last_stmt_uid++;
1693 /* Return the first node in GIMPLE sequence S. */
1695 static inline gimple_seq_node
1696 gimple_seq_first (gimple_seq s)
1698 return s;
1702 /* Return the first statement in GIMPLE sequence S. */
1704 static inline gimple *
1705 gimple_seq_first_stmt (gimple_seq s)
1707 gimple_seq_node n = gimple_seq_first (s);
1708 return n;
1711 /* Return the first statement in GIMPLE sequence S as a gbind *,
1712 verifying that it has code GIMPLE_BIND in a checked build. */
1714 static inline gbind *
1715 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1717 gimple_seq_node n = gimple_seq_first (s);
1718 return as_a <gbind *> (n);
1722 /* Return the last node in GIMPLE sequence S. */
1724 static inline gimple_seq_node
1725 gimple_seq_last (gimple_seq s)
1727 return s ? s->prev : NULL;
1731 /* Return the last statement in GIMPLE sequence S. */
1733 static inline gimple *
1734 gimple_seq_last_stmt (gimple_seq s)
1736 gimple_seq_node n = gimple_seq_last (s);
1737 return n;
1741 /* Set the last node in GIMPLE sequence *PS to LAST. */
1743 static inline void
1744 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1746 (*ps)->prev = last;
1750 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1752 static inline void
1753 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1755 *ps = first;
1759 /* Return true if GIMPLE sequence S is empty. */
1761 static inline bool
1762 gimple_seq_empty_p (gimple_seq s)
1764 return s == NULL;
1767 /* Allocate a new sequence and initialize its first element with STMT. */
1769 static inline gimple_seq
1770 gimple_seq_alloc_with_stmt (gimple *stmt)
1772 gimple_seq seq = NULL;
1773 gimple_seq_add_stmt (&seq, stmt);
1774 return seq;
1778 /* Returns the sequence of statements in BB. */
1780 static inline gimple_seq
1781 bb_seq (const_basic_block bb)
1783 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1786 static inline gimple_seq *
1787 bb_seq_addr (basic_block bb)
1789 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1792 /* Sets the sequence of statements in BB to SEQ. */
1794 static inline void
1795 set_bb_seq (basic_block bb, gimple_seq seq)
1797 gcc_checking_assert (!(bb->flags & BB_RTL));
1798 bb->il.gimple.seq = seq;
1802 /* Return the code for GIMPLE statement G. */
1804 static inline enum gimple_code
1805 gimple_code (const gimple *g)
1807 return g->code;
1811 /* Return the GSS code used by a GIMPLE code. */
1813 static inline enum gimple_statement_structure_enum
1814 gss_for_code (enum gimple_code code)
1816 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1817 return gss_for_code_[code];
1821 /* Return which GSS code is used by GS. */
1823 static inline enum gimple_statement_structure_enum
1824 gimple_statement_structure (gimple *gs)
1826 return gss_for_code (gimple_code (gs));
1830 /* Return true if statement G has sub-statements. This is only true for
1831 High GIMPLE statements. */
1833 static inline bool
1834 gimple_has_substatements (gimple *g)
1836 switch (gimple_code (g))
1838 case GIMPLE_BIND:
1839 case GIMPLE_CATCH:
1840 case GIMPLE_EH_FILTER:
1841 case GIMPLE_EH_ELSE:
1842 case GIMPLE_TRY:
1843 case GIMPLE_OMP_FOR:
1844 case GIMPLE_OMP_MASTER:
1845 case GIMPLE_OMP_MASKED:
1846 case GIMPLE_OMP_TASKGROUP:
1847 case GIMPLE_OMP_ORDERED:
1848 case GIMPLE_OMP_SECTION:
1849 case GIMPLE_OMP_PARALLEL:
1850 case GIMPLE_OMP_TASK:
1851 case GIMPLE_OMP_SCOPE:
1852 case GIMPLE_OMP_SECTIONS:
1853 case GIMPLE_OMP_SINGLE:
1854 case GIMPLE_OMP_TARGET:
1855 case GIMPLE_OMP_TEAMS:
1856 case GIMPLE_OMP_CRITICAL:
1857 case GIMPLE_WITH_CLEANUP_EXPR:
1858 case GIMPLE_TRANSACTION:
1859 return true;
1861 default:
1862 return false;
1867 /* Return the basic block holding statement G. */
1869 static inline basic_block
1870 gimple_bb (const gimple *g)
1872 return g->bb;
1876 /* Return the lexical scope block holding statement G. */
1878 static inline tree
1879 gimple_block (const gimple *g)
1881 return LOCATION_BLOCK (g->location);
1884 /* Forward declare. */
1885 static inline void gimple_set_location (gimple *, location_t);
1887 /* Set BLOCK to be the lexical scope block holding statement G. */
1889 static inline void
1890 gimple_set_block (gimple *g, tree block)
1892 gimple_set_location (g, set_block (g->location, block));
1895 /* Return location information for statement G. */
1897 static inline location_t
1898 gimple_location (const gimple *g)
1900 return g->location;
1903 /* Return location information for statement G if g is not NULL.
1904 Otherwise, UNKNOWN_LOCATION is returned. */
1906 static inline location_t
1907 gimple_location_safe (const gimple *g)
1909 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1912 /* Set location information for statement G. */
1914 static inline void
1915 gimple_set_location (gimple *g, location_t location)
1917 /* Copy the no-warning data to the statement location. */
1918 if (g->location != UNKNOWN_LOCATION)
1919 copy_warning (location, g->location);
1920 g->location = location;
1923 /* Return address of the location information for statement G. */
1925 static inline location_t *
1926 gimple_location_ptr (gimple *g)
1928 return &g->location;
1932 /* Return true if G contains location information. */
1934 static inline bool
1935 gimple_has_location (const gimple *g)
1937 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1941 /* Return non-artificial location information for statement G. */
1943 static inline location_t
1944 gimple_nonartificial_location (const gimple *g)
1946 location_t *ploc = NULL;
1948 if (tree block = gimple_block (g))
1949 ploc = block_nonartificial_location (block);
1951 return ploc ? *ploc : gimple_location (g);
1955 /* Return the file name of the location of STMT. */
1957 static inline const char *
1958 gimple_filename (const gimple *stmt)
1960 return LOCATION_FILE (gimple_location (stmt));
1964 /* Return the line number of the location of STMT. */
1966 static inline int
1967 gimple_lineno (const gimple *stmt)
1969 return LOCATION_LINE (gimple_location (stmt));
1973 /* Determine whether SEQ is a singleton. */
1975 static inline bool
1976 gimple_seq_singleton_p (gimple_seq seq)
1978 return ((gimple_seq_first (seq) != NULL)
1979 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1982 /* Return true if no warnings should be emitted for statement STMT. */
1984 static inline bool
1985 gimple_no_warning_p (const gimple *stmt)
1987 return stmt->no_warning;
1990 /* Set the no_warning flag of STMT to NO_WARNING. */
1992 static inline void
1993 gimple_set_no_warning (gimple *stmt, bool no_warning)
1995 stmt->no_warning = (unsigned) no_warning;
1998 /* Set the visited status on statement STMT to VISITED_P.
2000 Please note that this 'visited' property of the gimple statement is
2001 supposed to be undefined at pass boundaries. This means that a
2002 given pass should not assume it contains any useful value when the
2003 pass starts and thus can set it to any value it sees fit.
2005 You can learn more about the visited property of the gimple
2006 statement by reading the comments of the 'visited' data member of
2007 struct gimple.
2010 static inline void
2011 gimple_set_visited (gimple *stmt, bool visited_p)
2013 stmt->visited = (unsigned) visited_p;
2017 /* Return the visited status for statement STMT.
2019 Please note that this 'visited' property of the gimple statement is
2020 supposed to be undefined at pass boundaries. This means that a
2021 given pass should not assume it contains any useful value when the
2022 pass starts and thus can set it to any value it sees fit.
2024 You can learn more about the visited property of the gimple
2025 statement by reading the comments of the 'visited' data member of
2026 struct gimple. */
2028 static inline bool
2029 gimple_visited_p (gimple *stmt)
2031 return stmt->visited;
2035 /* Set pass local flag PLF on statement STMT to VAL_P.
2037 Please note that this PLF property of the gimple statement is
2038 supposed to be undefined at pass boundaries. This means that a
2039 given pass should not assume it contains any useful value when the
2040 pass starts and thus can set it to any value it sees fit.
2042 You can learn more about the PLF property by reading the comment of
2043 the 'plf' data member of struct gimple_statement_structure. */
2045 static inline void
2046 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2048 if (val_p)
2049 stmt->plf |= (unsigned int) plf;
2050 else
2051 stmt->plf &= ~((unsigned int) plf);
2055 /* Return the value of pass local flag PLF on statement STMT.
2057 Please note that this 'plf' property of the gimple statement is
2058 supposed to be undefined at pass boundaries. This means that a
2059 given pass should not assume it contains any useful value when the
2060 pass starts and thus can set it to any value it sees fit.
2062 You can learn more about the plf property by reading the comment of
2063 the 'plf' data member of struct gimple_statement_structure. */
2065 static inline unsigned int
2066 gimple_plf (gimple *stmt, enum plf_mask plf)
2068 return stmt->plf & ((unsigned int) plf);
2072 /* Set the UID of statement.
2074 Please note that this UID property is supposed to be undefined at
2075 pass boundaries. This means that a given pass should not assume it
2076 contains any useful value when the pass starts and thus can set it
2077 to any value it sees fit. */
2079 static inline void
2080 gimple_set_uid (gimple *g, unsigned uid)
2082 g->uid = uid;
2086 /* Return the UID of statement.
2088 Please note that this UID property is supposed to be undefined at
2089 pass boundaries. This means that a given pass should not assume it
2090 contains any useful value when the pass starts and thus can set it
2091 to any value it sees fit. */
2093 static inline unsigned
2094 gimple_uid (const gimple *g)
2096 return g->uid;
2100 /* Make statement G a singleton sequence. */
2102 static inline void
2103 gimple_init_singleton (gimple *g)
2105 g->next = NULL;
2106 g->prev = g;
2110 /* Return true if GIMPLE statement G has register or memory operands. */
2112 static inline bool
2113 gimple_has_ops (const gimple *g)
2115 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2118 template <>
2119 template <>
2120 inline bool
2121 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2123 return gimple_has_ops (gs);
2126 template <>
2127 template <>
2128 inline bool
2129 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2131 return gimple_has_ops (gs);
2134 /* Return true if GIMPLE statement G has memory operands. */
2136 static inline bool
2137 gimple_has_mem_ops (const gimple *g)
2139 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2142 template <>
2143 template <>
2144 inline bool
2145 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2147 return gimple_has_mem_ops (gs);
2150 template <>
2151 template <>
2152 inline bool
2153 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2155 return gimple_has_mem_ops (gs);
2158 /* Return the set of USE operands for statement G. */
2160 static inline struct use_optype_d *
2161 gimple_use_ops (const gimple *g)
2163 const gimple_statement_with_ops *ops_stmt =
2164 dyn_cast <const gimple_statement_with_ops *> (g);
2165 if (!ops_stmt)
2166 return NULL;
2167 return ops_stmt->use_ops;
2171 /* Set USE to be the set of USE operands for statement G. */
2173 static inline void
2174 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2176 gimple_statement_with_ops *ops_stmt =
2177 as_a <gimple_statement_with_ops *> (g);
2178 ops_stmt->use_ops = use;
2182 /* Return the single VUSE operand of the statement G. */
2184 static inline tree
2185 gimple_vuse (const gimple *g)
2187 const gimple_statement_with_memory_ops *mem_ops_stmt =
2188 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2189 if (!mem_ops_stmt)
2190 return NULL_TREE;
2191 return mem_ops_stmt->vuse;
2194 /* Return the single VDEF operand of the statement G. */
2196 static inline tree
2197 gimple_vdef (const gimple *g)
2199 const gimple_statement_with_memory_ops *mem_ops_stmt =
2200 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2201 if (!mem_ops_stmt)
2202 return NULL_TREE;
2203 return mem_ops_stmt->vdef;
2206 /* Return the single VUSE operand of the statement G. */
2208 static inline tree *
2209 gimple_vuse_ptr (gimple *g)
2211 gimple_statement_with_memory_ops *mem_ops_stmt =
2212 dyn_cast <gimple_statement_with_memory_ops *> (g);
2213 if (!mem_ops_stmt)
2214 return NULL;
2215 return &mem_ops_stmt->vuse;
2218 /* Return the single VDEF operand of the statement G. */
2220 static inline tree *
2221 gimple_vdef_ptr (gimple *g)
2223 gimple_statement_with_memory_ops *mem_ops_stmt =
2224 dyn_cast <gimple_statement_with_memory_ops *> (g);
2225 if (!mem_ops_stmt)
2226 return NULL;
2227 return &mem_ops_stmt->vdef;
2230 /* Set the single VUSE operand of the statement G. */
2232 static inline void
2233 gimple_set_vuse (gimple *g, tree vuse)
2235 gimple_statement_with_memory_ops *mem_ops_stmt =
2236 as_a <gimple_statement_with_memory_ops *> (g);
2237 mem_ops_stmt->vuse = vuse;
2240 /* Set the single VDEF operand of the statement G. */
2242 static inline void
2243 gimple_set_vdef (gimple *g, tree vdef)
2245 gimple_statement_with_memory_ops *mem_ops_stmt =
2246 as_a <gimple_statement_with_memory_ops *> (g);
2247 mem_ops_stmt->vdef = vdef;
2251 /* Return true if statement G has operands and the modified field has
2252 been set. */
2254 static inline bool
2255 gimple_modified_p (const gimple *g)
2257 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2261 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2262 a MODIFIED field. */
2264 static inline void
2265 gimple_set_modified (gimple *s, bool modifiedp)
2267 if (gimple_has_ops (s))
2268 s->modified = (unsigned) modifiedp;
2272 /* Return true if statement STMT contains volatile operands. */
2274 static inline bool
2275 gimple_has_volatile_ops (const gimple *stmt)
2277 if (gimple_has_mem_ops (stmt))
2278 return stmt->has_volatile_ops;
2279 else
2280 return false;
2284 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2286 static inline void
2287 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2289 if (gimple_has_mem_ops (stmt))
2290 stmt->has_volatile_ops = (unsigned) volatilep;
2293 /* Return true if STMT is in a transaction. */
2295 static inline bool
2296 gimple_in_transaction (const gimple *stmt)
2298 return bb_in_transaction (gimple_bb (stmt));
2301 /* Return true if statement STMT may access memory. */
2303 static inline bool
2304 gimple_references_memory_p (gimple *stmt)
2306 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2310 /* Return the subcode for OMP statement S. */
2312 static inline unsigned
2313 gimple_omp_subcode (const gimple *s)
2315 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2316 && gimple_code (s) <= GIMPLE_OMP_ORDERED);
2317 return s->subcode;
2320 /* Set the subcode for OMP statement S to SUBCODE. */
2322 static inline void
2323 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2325 /* We only have 16 bits for the subcode. Assert that we are not
2326 overflowing it. */
2327 gcc_gimple_checking_assert (subcode < (1 << 16));
2328 s->subcode = subcode;
2331 /* Set the nowait flag on OMP_RETURN statement S. */
2333 static inline void
2334 gimple_omp_return_set_nowait (gimple *s)
2336 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2337 s->subcode |= GF_OMP_RETURN_NOWAIT;
2341 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2342 flag set. */
2344 static inline bool
2345 gimple_omp_return_nowait_p (const gimple *g)
2347 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2348 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2352 /* Set the LHS of OMP return. */
2354 static inline void
2355 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2357 gimple_statement_omp_return *omp_return_stmt =
2358 as_a <gimple_statement_omp_return *> (g);
2359 omp_return_stmt->val = lhs;
2363 /* Get the LHS of OMP return. */
2365 static inline tree
2366 gimple_omp_return_lhs (const gimple *g)
2368 const gimple_statement_omp_return *omp_return_stmt =
2369 as_a <const gimple_statement_omp_return *> (g);
2370 return omp_return_stmt->val;
2374 /* Return a pointer to the LHS of OMP return. */
2376 static inline tree *
2377 gimple_omp_return_lhs_ptr (gimple *g)
2379 gimple_statement_omp_return *omp_return_stmt =
2380 as_a <gimple_statement_omp_return *> (g);
2381 return &omp_return_stmt->val;
2385 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2386 flag set. */
2388 static inline bool
2389 gimple_omp_section_last_p (const gimple *g)
2391 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2392 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2396 /* Set the GF_OMP_SECTION_LAST flag on G. */
2398 static inline void
2399 gimple_omp_section_set_last (gimple *g)
2401 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2402 g->subcode |= GF_OMP_SECTION_LAST;
2406 /* Return true if OMP ordered construct is stand-alone
2407 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2409 static inline bool
2410 gimple_omp_ordered_standalone_p (const gimple *g)
2412 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2413 return (gimple_omp_subcode (g) & GF_OMP_ORDERED_STANDALONE) != 0;
2417 /* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2419 static inline void
2420 gimple_omp_ordered_standalone (gimple *g)
2422 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2423 g->subcode |= GF_OMP_ORDERED_STANDALONE;
2427 /* Return true if OMP parallel statement G has the
2428 GF_OMP_PARALLEL_COMBINED flag set. */
2430 static inline bool
2431 gimple_omp_parallel_combined_p (const gimple *g)
2433 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2434 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2438 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2439 value of COMBINED_P. */
2441 static inline void
2442 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2444 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2445 if (combined_p)
2446 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2447 else
2448 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2452 /* Return true if OMP atomic load/store statement G has the
2453 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2455 static inline bool
2456 gimple_omp_atomic_need_value_p (const gimple *g)
2458 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2459 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2460 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2464 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2466 static inline void
2467 gimple_omp_atomic_set_need_value (gimple *g)
2469 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2470 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2471 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2475 /* Return true if OMP atomic load/store statement G has the
2476 GF_OMP_ATOMIC_WEAK flag set. */
2478 static inline bool
2479 gimple_omp_atomic_weak_p (const gimple *g)
2481 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2482 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2483 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_WEAK) != 0;
2487 /* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2489 static inline void
2490 gimple_omp_atomic_set_weak (gimple *g)
2492 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2493 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2494 g->subcode |= GF_OMP_ATOMIC_WEAK;
2498 /* Return the memory order of the OMP atomic load/store statement G. */
2500 static inline enum omp_memory_order
2501 gimple_omp_atomic_memory_order (const gimple *g)
2503 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2504 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2505 return (enum omp_memory_order)
2506 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2510 /* Set the memory order on G. */
2512 static inline void
2513 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2515 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2516 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2517 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2518 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2522 /* Return the number of operands for statement GS. */
2524 static inline unsigned
2525 gimple_num_ops (const gimple *gs)
2527 return gs->num_ops;
2531 /* Set the number of operands for statement GS. */
2533 static inline void
2534 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2536 gs->num_ops = num_ops;
2540 /* Return the array of operands for statement GS. */
2542 static inline tree *
2543 gimple_ops (gimple *gs)
2545 size_t off;
2547 /* All the tuples have their operand vector at the very bottom
2548 of the structure. Note that those structures that do not
2549 have an operand vector have a zero offset. */
2550 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2551 gcc_gimple_checking_assert (off != 0);
2553 return (tree *) ((char *) gs + off);
2557 /* Return operand I for statement GS. */
2559 static inline tree
2560 gimple_op (const gimple *gs, unsigned i)
2562 if (gimple_has_ops (gs))
2564 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2565 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2567 else
2568 return NULL_TREE;
2571 /* Return a pointer to operand I for statement GS. */
2573 static inline tree *
2574 gimple_op_ptr (gimple *gs, unsigned i)
2576 if (gimple_has_ops (gs))
2578 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2579 return gimple_ops (gs) + i;
2581 else
2582 return NULL;
2585 /* Set operand I of statement GS to OP. */
2587 static inline void
2588 gimple_set_op (gimple *gs, unsigned i, tree op)
2590 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2592 /* Note. It may be tempting to assert that OP matches
2593 is_gimple_operand, but that would be wrong. Different tuples
2594 accept slightly different sets of tree operands. Each caller
2595 should perform its own validation. */
2596 gimple_ops (gs)[i] = op;
2599 /* Return true if GS is a GIMPLE_ASSIGN. */
2601 static inline bool
2602 is_gimple_assign (const gimple *gs)
2604 return gimple_code (gs) == GIMPLE_ASSIGN;
2607 /* Determine if expression CODE is one of the valid expressions that can
2608 be used on the RHS of GIMPLE assignments. */
2610 static inline enum gimple_rhs_class
2611 get_gimple_rhs_class (enum tree_code code)
2613 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2616 /* Return the LHS of assignment statement GS. */
2618 static inline tree
2619 gimple_assign_lhs (const gassign *gs)
2621 return gs->op[0];
2624 static inline tree
2625 gimple_assign_lhs (const gimple *gs)
2627 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2628 return gimple_assign_lhs (ass);
2632 /* Return a pointer to the LHS of assignment statement GS. */
2634 static inline tree *
2635 gimple_assign_lhs_ptr (gassign *gs)
2637 return &gs->op[0];
2640 static inline tree *
2641 gimple_assign_lhs_ptr (gimple *gs)
2643 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2644 return gimple_assign_lhs_ptr (ass);
2648 /* Set LHS to be the LHS operand of assignment statement GS. */
2650 static inline void
2651 gimple_assign_set_lhs (gassign *gs, tree lhs)
2653 gs->op[0] = lhs;
2655 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2656 SSA_NAME_DEF_STMT (lhs) = gs;
2659 static inline void
2660 gimple_assign_set_lhs (gimple *gs, tree lhs)
2662 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2663 gimple_assign_set_lhs (ass, lhs);
2667 /* Return the first operand on the RHS of assignment statement GS. */
2669 static inline tree
2670 gimple_assign_rhs1 (const gassign *gs)
2672 return gs->op[1];
2675 static inline tree
2676 gimple_assign_rhs1 (const gimple *gs)
2678 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2679 return gimple_assign_rhs1 (ass);
2683 /* Return a pointer to the first operand on the RHS of assignment
2684 statement GS. */
2686 static inline tree *
2687 gimple_assign_rhs1_ptr (gassign *gs)
2689 return &gs->op[1];
2692 static inline tree *
2693 gimple_assign_rhs1_ptr (gimple *gs)
2695 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2696 return gimple_assign_rhs1_ptr (ass);
2699 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2701 static inline void
2702 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2704 gs->op[1] = rhs;
2707 static inline void
2708 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2710 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2711 gimple_assign_set_rhs1 (ass, rhs);
2715 /* Return the second operand on the RHS of assignment statement GS.
2716 If GS does not have two operands, NULL is returned instead. */
2718 static inline tree
2719 gimple_assign_rhs2 (const gassign *gs)
2721 if (gimple_num_ops (gs) >= 3)
2722 return gs->op[2];
2723 else
2724 return NULL_TREE;
2727 static inline tree
2728 gimple_assign_rhs2 (const gimple *gs)
2730 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2731 return gimple_assign_rhs2 (ass);
2735 /* Return a pointer to the second operand on the RHS of assignment
2736 statement GS. */
2738 static inline tree *
2739 gimple_assign_rhs2_ptr (gassign *gs)
2741 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2742 return &gs->op[2];
2745 static inline tree *
2746 gimple_assign_rhs2_ptr (gimple *gs)
2748 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2749 return gimple_assign_rhs2_ptr (ass);
2753 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2755 static inline void
2756 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2758 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2759 gs->op[2] = rhs;
2762 static inline void
2763 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2765 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2766 return gimple_assign_set_rhs2 (ass, rhs);
2769 /* Return the third operand on the RHS of assignment statement GS.
2770 If GS does not have two operands, NULL is returned instead. */
2772 static inline tree
2773 gimple_assign_rhs3 (const gassign *gs)
2775 if (gimple_num_ops (gs) >= 4)
2776 return gs->op[3];
2777 else
2778 return NULL_TREE;
2781 static inline tree
2782 gimple_assign_rhs3 (const gimple *gs)
2784 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2785 return gimple_assign_rhs3 (ass);
2788 /* Return a pointer to the third operand on the RHS of assignment
2789 statement GS. */
2791 static inline tree *
2792 gimple_assign_rhs3_ptr (gimple *gs)
2794 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2795 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2796 return &ass->op[3];
2800 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2802 static inline void
2803 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2805 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2806 gs->op[3] = rhs;
2809 static inline void
2810 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2812 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2813 gimple_assign_set_rhs3 (ass, rhs);
2817 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2818 which expect to see only two operands. */
2820 static inline void
2821 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2822 tree op1, tree op2)
2824 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2827 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2828 which expect to see only one operands. */
2830 static inline void
2831 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2832 tree op1)
2834 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2837 /* Returns true if GS is a nontemporal move. */
2839 static inline bool
2840 gimple_assign_nontemporal_move_p (const gassign *gs)
2842 return gs->nontemporal_move;
2845 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2847 static inline void
2848 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2850 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2851 gs->nontemporal_move = nontemporal;
2855 /* Return the code of the expression computed on the rhs of assignment
2856 statement GS. In case that the RHS is a single object, returns the
2857 tree code of the object. */
2859 static inline enum tree_code
2860 gimple_assign_rhs_code (const gassign *gs)
2862 enum tree_code code = (enum tree_code) gs->subcode;
2863 /* While we initially set subcode to the TREE_CODE of the rhs for
2864 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2865 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2866 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2867 code = TREE_CODE (gs->op[1]);
2869 return code;
2872 static inline enum tree_code
2873 gimple_assign_rhs_code (const gimple *gs)
2875 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2876 return gimple_assign_rhs_code (ass);
2880 /* Set CODE to be the code for the expression computed on the RHS of
2881 assignment S. */
2883 static inline void
2884 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2886 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2887 s->subcode = code;
2891 /* Return the gimple rhs class of the code of the expression computed on
2892 the rhs of assignment statement GS.
2893 This will never return GIMPLE_INVALID_RHS. */
2895 static inline enum gimple_rhs_class
2896 gimple_assign_rhs_class (const gimple *gs)
2898 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2901 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2902 there is no operator associated with the assignment itself.
2903 Unlike gimple_assign_copy_p, this predicate returns true for
2904 any RHS operand, including those that perform an operation
2905 and do not have the semantics of a copy, such as COND_EXPR. */
2907 static inline bool
2908 gimple_assign_single_p (const gimple *gs)
2910 return (is_gimple_assign (gs)
2911 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2914 /* Return true if GS performs a store to its lhs. */
2916 static inline bool
2917 gimple_store_p (const gimple *gs)
2919 tree lhs = gimple_get_lhs (gs);
2920 return lhs && !is_gimple_reg (lhs);
2923 /* Return true if GS is an assignment that loads from its rhs1. */
2925 static inline bool
2926 gimple_assign_load_p (const gimple *gs)
2928 tree rhs;
2929 if (!gimple_assign_single_p (gs))
2930 return false;
2931 rhs = gimple_assign_rhs1 (gs);
2932 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2933 return true;
2934 rhs = get_base_address (rhs);
2935 return (DECL_P (rhs)
2936 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2940 /* Return true if S is a type-cast assignment. */
2942 static inline bool
2943 gimple_assign_cast_p (const gimple *s)
2945 if (is_gimple_assign (s))
2947 enum tree_code sc = gimple_assign_rhs_code (s);
2948 return CONVERT_EXPR_CODE_P (sc)
2949 || sc == VIEW_CONVERT_EXPR
2950 || sc == FIX_TRUNC_EXPR;
2953 return false;
2956 /* Return true if S is a clobber statement. */
2958 static inline bool
2959 gimple_clobber_p (const gimple *s)
2961 return gimple_assign_single_p (s)
2962 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2965 /* Return true if S is a clobber statement. */
2967 static inline bool
2968 gimple_clobber_p (const gimple *s, enum clobber_kind kind)
2970 return gimple_clobber_p (s)
2971 && CLOBBER_KIND (gimple_assign_rhs1 (s)) == kind;
2974 /* Return true if GS is a GIMPLE_CALL. */
2976 static inline bool
2977 is_gimple_call (const gimple *gs)
2979 return gimple_code (gs) == GIMPLE_CALL;
2982 /* Return the LHS of call statement GS. */
2984 static inline tree
2985 gimple_call_lhs (const gcall *gs)
2987 return gs->op[0];
2990 static inline tree
2991 gimple_call_lhs (const gimple *gs)
2993 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2994 return gimple_call_lhs (gc);
2998 /* Return a pointer to the LHS of call statement GS. */
3000 static inline tree *
3001 gimple_call_lhs_ptr (gcall *gs)
3003 return &gs->op[0];
3006 static inline tree *
3007 gimple_call_lhs_ptr (gimple *gs)
3009 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3010 return gimple_call_lhs_ptr (gc);
3014 /* Set LHS to be the LHS operand of call statement GS. */
3016 static inline void
3017 gimple_call_set_lhs (gcall *gs, tree lhs)
3019 gs->op[0] = lhs;
3020 if (lhs && TREE_CODE (lhs) == SSA_NAME)
3021 SSA_NAME_DEF_STMT (lhs) = gs;
3024 static inline void
3025 gimple_call_set_lhs (gimple *gs, tree lhs)
3027 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3028 gimple_call_set_lhs (gc, lhs);
3032 /* Return true if call GS calls an internal-only function, as enumerated
3033 by internal_fn. */
3035 static inline bool
3036 gimple_call_internal_p (const gcall *gs)
3038 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3041 static inline bool
3042 gimple_call_internal_p (const gimple *gs)
3044 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3045 return gimple_call_internal_p (gc);
3048 /* Return true if call GS is marked as nocf_check. */
3050 static inline bool
3051 gimple_call_nocf_check_p (const gcall *gs)
3053 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3056 /* Mark statement GS as nocf_check call. */
3058 static inline void
3059 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
3061 if (nocf_check)
3062 gs->subcode |= GF_CALL_NOCF_CHECK;
3063 else
3064 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3067 /* Return the target of internal call GS. */
3069 static inline enum internal_fn
3070 gimple_call_internal_fn (const gcall *gs)
3072 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3073 return gs->u.internal_fn;
3076 static inline enum internal_fn
3077 gimple_call_internal_fn (const gimple *gs)
3079 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3080 return gimple_call_internal_fn (gc);
3083 /* Return true, if this internal gimple call is unique. */
3085 static inline bool
3086 gimple_call_internal_unique_p (const gcall *gs)
3088 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3091 static inline bool
3092 gimple_call_internal_unique_p (const gimple *gs)
3094 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3095 return gimple_call_internal_unique_p (gc);
3098 /* Return true if GS is an internal function FN. */
3100 static inline bool
3101 gimple_call_internal_p (const gimple *gs, internal_fn fn)
3103 return (is_gimple_call (gs)
3104 && gimple_call_internal_p (gs)
3105 && gimple_call_internal_fn (gs) == fn);
3108 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3109 that could alter control flow. */
3111 static inline void
3112 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3114 if (ctrl_altering_p)
3115 s->subcode |= GF_CALL_CTRL_ALTERING;
3116 else
3117 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3120 static inline void
3121 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3123 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3124 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3127 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3128 flag is set. Such call could not be a stmt in the middle of a bb. */
3130 static inline bool
3131 gimple_call_ctrl_altering_p (const gcall *gs)
3133 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3136 static inline bool
3137 gimple_call_ctrl_altering_p (const gimple *gs)
3139 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3140 return gimple_call_ctrl_altering_p (gc);
3144 /* Return the function type of the function called by GS. */
3146 static inline tree
3147 gimple_call_fntype (const gcall *gs)
3149 if (gimple_call_internal_p (gs))
3150 return NULL_TREE;
3151 return gs->u.fntype;
3154 static inline tree
3155 gimple_call_fntype (const gimple *gs)
3157 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3158 return gimple_call_fntype (call_stmt);
3161 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3163 static inline void
3164 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3166 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3167 call_stmt->u.fntype = fntype;
3171 /* Return the tree node representing the function called by call
3172 statement GS. */
3174 static inline tree
3175 gimple_call_fn (const gcall *gs)
3177 return gs->op[1];
3180 static inline tree
3181 gimple_call_fn (const gimple *gs)
3183 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3184 return gimple_call_fn (gc);
3187 /* Return a pointer to the tree node representing the function called by call
3188 statement GS. */
3190 static inline tree *
3191 gimple_call_fn_ptr (gcall *gs)
3193 return &gs->op[1];
3196 static inline tree *
3197 gimple_call_fn_ptr (gimple *gs)
3199 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3200 return gimple_call_fn_ptr (gc);
3204 /* Set FN to be the function called by call statement GS. */
3206 static inline void
3207 gimple_call_set_fn (gcall *gs, tree fn)
3209 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3210 gs->op[1] = fn;
3214 /* Set FNDECL to be the function called by call statement GS. */
3216 static inline void
3217 gimple_call_set_fndecl (gcall *gs, tree decl)
3219 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3220 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3221 build_pointer_type (TREE_TYPE (decl)), decl);
3224 static inline void
3225 gimple_call_set_fndecl (gimple *gs, tree decl)
3227 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3228 gimple_call_set_fndecl (gc, decl);
3232 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3234 static inline void
3235 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3237 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3238 call_stmt->u.internal_fn = fn;
3242 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3243 Otherwise return NULL. This function is analogous to
3244 get_callee_fndecl in tree land. */
3246 static inline tree
3247 gimple_call_fndecl (const gcall *gs)
3249 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3252 static inline tree
3253 gimple_call_fndecl (const gimple *gs)
3255 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3256 return gimple_call_fndecl (gc);
3260 /* Return the type returned by call statement GS. */
3262 static inline tree
3263 gimple_call_return_type (const gcall *gs)
3265 tree type = gimple_call_fntype (gs);
3267 if (type == NULL_TREE)
3268 return TREE_TYPE (gimple_call_lhs (gs));
3270 /* The type returned by a function is the type of its
3271 function type. */
3272 return TREE_TYPE (type);
3276 /* Return the static chain for call statement GS. */
3278 static inline tree
3279 gimple_call_chain (const gcall *gs)
3281 return gs->op[2];
3284 static inline tree
3285 gimple_call_chain (const gimple *gs)
3287 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3288 return gimple_call_chain (gc);
3292 /* Return a pointer to the static chain for call statement CALL_STMT. */
3294 static inline tree *
3295 gimple_call_chain_ptr (gcall *call_stmt)
3297 return &call_stmt->op[2];
3300 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3302 static inline void
3303 gimple_call_set_chain (gcall *call_stmt, tree chain)
3305 call_stmt->op[2] = chain;
3309 /* Return the number of arguments used by call statement GS. */
3311 static inline unsigned
3312 gimple_call_num_args (const gcall *gs)
3314 return gimple_num_ops (gs) - 3;
3317 static inline unsigned
3318 gimple_call_num_args (const gimple *gs)
3320 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3321 return gimple_call_num_args (gc);
3325 /* Return the argument at position INDEX for call statement GS. */
3327 static inline tree
3328 gimple_call_arg (const gcall *gs, unsigned index)
3330 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3331 return gs->op[index + 3];
3334 static inline tree
3335 gimple_call_arg (const gimple *gs, unsigned index)
3337 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3338 return gimple_call_arg (gc, index);
3342 /* Return a pointer to the argument at position INDEX for call
3343 statement GS. */
3345 static inline tree *
3346 gimple_call_arg_ptr (gcall *gs, unsigned index)
3348 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3349 return &gs->op[index + 3];
3352 static inline tree *
3353 gimple_call_arg_ptr (gimple *gs, unsigned index)
3355 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3356 return gimple_call_arg_ptr (gc, index);
3360 /* Set ARG to be the argument at position INDEX for call statement GS. */
3362 static inline void
3363 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3365 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3366 gs->op[index + 3] = arg;
3369 static inline void
3370 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3372 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3373 gimple_call_set_arg (gc, index, arg);
3377 /* If TAIL_P is true, mark call statement S as being a tail call
3378 (i.e., a call just before the exit of a function). These calls are
3379 candidate for tail call optimization. */
3381 static inline void
3382 gimple_call_set_tail (gcall *s, bool tail_p)
3384 if (tail_p)
3385 s->subcode |= GF_CALL_TAILCALL;
3386 else
3387 s->subcode &= ~GF_CALL_TAILCALL;
3391 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3393 static inline bool
3394 gimple_call_tail_p (const gcall *s)
3396 return (s->subcode & GF_CALL_TAILCALL) != 0;
3399 /* Mark (or clear) call statement S as requiring tail call optimization. */
3401 static inline void
3402 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3404 if (must_tail_p)
3405 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3406 else
3407 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3410 /* Return true if call statement has been marked as requiring
3411 tail call optimization. */
3413 static inline bool
3414 gimple_call_must_tail_p (const gcall *s)
3416 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3419 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3420 slot optimization. This transformation uses the target of the call
3421 expansion as the return slot for calls that return in memory. */
3423 static inline void
3424 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3426 if (return_slot_opt_p)
3427 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3428 else
3429 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3433 /* Return true if S is marked for return slot optimization. */
3435 static inline bool
3436 gimple_call_return_slot_opt_p (const gcall *s)
3438 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3442 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3443 thunk to the thunked-to function. */
3445 static inline void
3446 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3448 if (from_thunk_p)
3449 s->subcode |= GF_CALL_FROM_THUNK;
3450 else
3451 s->subcode &= ~GF_CALL_FROM_THUNK;
3455 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3457 static inline bool
3458 gimple_call_from_thunk_p (gcall *s)
3460 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3464 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3465 to operator new or delete created from a new or delete expression. */
3467 static inline void
3468 gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3470 if (from_new_or_delete_p)
3471 s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
3472 else
3473 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3477 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3478 from a new or delete expression. */
3480 static inline bool
3481 gimple_call_from_new_or_delete (const gcall *s)
3483 return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
3487 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3488 argument pack in its argument list. */
3490 static inline void
3491 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3493 if (pass_arg_pack_p)
3494 s->subcode |= GF_CALL_VA_ARG_PACK;
3495 else
3496 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3500 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3501 argument pack in its argument list. */
3503 static inline bool
3504 gimple_call_va_arg_pack_p (const gcall *s)
3506 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3510 /* Return true if S is a noreturn call. */
3512 static inline bool
3513 gimple_call_noreturn_p (const gcall *s)
3515 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3518 static inline bool
3519 gimple_call_noreturn_p (const gimple *s)
3521 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3522 return gimple_call_noreturn_p (gc);
3526 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3527 even if the called function can throw in other cases. */
3529 static inline void
3530 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3532 if (nothrow_p)
3533 s->subcode |= GF_CALL_NOTHROW;
3534 else
3535 s->subcode &= ~GF_CALL_NOTHROW;
3538 /* Return true if S is a nothrow call. */
3540 static inline bool
3541 gimple_call_nothrow_p (gcall *s)
3543 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3546 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3547 is known to be emitted for VLA objects. Those are wrapped by
3548 stack_save/stack_restore calls and hence can't lead to unbounded
3549 stack growth even when they occur in loops. */
3551 static inline void
3552 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3554 if (for_var)
3555 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3556 else
3557 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3560 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3562 static inline bool
3563 gimple_call_alloca_for_var_p (gcall *s)
3565 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3568 static inline bool
3569 gimple_call_alloca_for_var_p (gimple *s)
3571 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3572 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3575 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3576 pointers to nested function are descriptors instead of trampolines. */
3578 static inline void
3579 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3581 if (by_descriptor_p)
3582 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3583 else
3584 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3587 /* Return true if S is a by-descriptor call. */
3589 static inline bool
3590 gimple_call_by_descriptor_p (gcall *s)
3592 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3595 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3597 static inline void
3598 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3600 dest_call->subcode = orig_call->subcode;
3604 /* Return a pointer to the points-to solution for the set of call-used
3605 variables of the call CALL_STMT. */
3607 static inline struct pt_solution *
3608 gimple_call_use_set (gcall *call_stmt)
3610 return &call_stmt->call_used;
3613 /* As above, but const. */
3615 static inline const pt_solution *
3616 gimple_call_use_set (const gcall *call_stmt)
3618 return &call_stmt->call_used;
3621 /* Return a pointer to the points-to solution for the set of call-used
3622 variables of the call CALL_STMT. */
3624 static inline struct pt_solution *
3625 gimple_call_clobber_set (gcall *call_stmt)
3627 return &call_stmt->call_clobbered;
3630 /* As above, but const. */
3632 static inline const pt_solution *
3633 gimple_call_clobber_set (const gcall *call_stmt)
3635 return &call_stmt->call_clobbered;
3639 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3640 non-NULL lhs. */
3642 static inline bool
3643 gimple_has_lhs (const gimple *stmt)
3645 if (is_gimple_assign (stmt))
3646 return true;
3647 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3648 return gimple_call_lhs (call) != NULL_TREE;
3649 return false;
3653 /* Return the code of the predicate computed by conditional statement GS. */
3655 static inline enum tree_code
3656 gimple_cond_code (const gcond *gs)
3658 return (enum tree_code) gs->subcode;
3661 static inline enum tree_code
3662 gimple_cond_code (const gimple *gs)
3664 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3665 return gimple_cond_code (gc);
3669 /* Set CODE to be the predicate code for the conditional statement GS. */
3671 static inline void
3672 gimple_cond_set_code (gcond *gs, enum tree_code code)
3674 gs->subcode = code;
3678 /* Return the LHS of the predicate computed by conditional statement GS. */
3680 static inline tree
3681 gimple_cond_lhs (const gcond *gs)
3683 return gs->op[0];
3686 static inline tree
3687 gimple_cond_lhs (const gimple *gs)
3689 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3690 return gimple_cond_lhs (gc);
3693 /* Return the pointer to the LHS of the predicate computed by conditional
3694 statement GS. */
3696 static inline tree *
3697 gimple_cond_lhs_ptr (gcond *gs)
3699 return &gs->op[0];
3702 /* Set LHS to be the LHS operand of the predicate computed by
3703 conditional statement GS. */
3705 static inline void
3706 gimple_cond_set_lhs (gcond *gs, tree lhs)
3708 gs->op[0] = lhs;
3712 /* Return the RHS operand of the predicate computed by conditional GS. */
3714 static inline tree
3715 gimple_cond_rhs (const gcond *gs)
3717 return gs->op[1];
3720 static inline tree
3721 gimple_cond_rhs (const gimple *gs)
3723 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3724 return gimple_cond_rhs (gc);
3727 /* Return the pointer to the RHS operand of the predicate computed by
3728 conditional GS. */
3730 static inline tree *
3731 gimple_cond_rhs_ptr (gcond *gs)
3733 return &gs->op[1];
3737 /* Set RHS to be the RHS operand of the predicate computed by
3738 conditional statement GS. */
3740 static inline void
3741 gimple_cond_set_rhs (gcond *gs, tree rhs)
3743 gs->op[1] = rhs;
3747 /* Return the label used by conditional statement GS when its
3748 predicate evaluates to true. */
3750 static inline tree
3751 gimple_cond_true_label (const gcond *gs)
3753 return gs->op[2];
3757 /* Set LABEL to be the label used by conditional statement GS when its
3758 predicate evaluates to true. */
3760 static inline void
3761 gimple_cond_set_true_label (gcond *gs, tree label)
3763 gs->op[2] = label;
3767 /* Set LABEL to be the label used by conditional statement GS when its
3768 predicate evaluates to false. */
3770 static inline void
3771 gimple_cond_set_false_label (gcond *gs, tree label)
3773 gs->op[3] = label;
3777 /* Return the label used by conditional statement GS when its
3778 predicate evaluates to false. */
3780 static inline tree
3781 gimple_cond_false_label (const gcond *gs)
3783 return gs->op[3];
3787 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3789 static inline void
3790 gimple_cond_make_false (gcond *gs)
3792 gimple_cond_set_lhs (gs, boolean_false_node);
3793 gimple_cond_set_rhs (gs, boolean_false_node);
3794 gs->subcode = NE_EXPR;
3798 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3800 static inline void
3801 gimple_cond_make_true (gcond *gs)
3803 gimple_cond_set_lhs (gs, boolean_true_node);
3804 gimple_cond_set_rhs (gs, boolean_false_node);
3805 gs->subcode = NE_EXPR;
3808 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3809 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3811 static inline bool
3812 gimple_cond_true_p (const gcond *gs)
3814 tree lhs = gimple_cond_lhs (gs);
3815 tree rhs = gimple_cond_rhs (gs);
3816 enum tree_code code = gimple_cond_code (gs);
3818 if (lhs != boolean_true_node && lhs != boolean_false_node)
3819 return false;
3821 if (rhs != boolean_true_node && rhs != boolean_false_node)
3822 return false;
3824 if (code == NE_EXPR && lhs != rhs)
3825 return true;
3827 if (code == EQ_EXPR && lhs == rhs)
3828 return true;
3830 return false;
3833 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3834 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3836 static inline bool
3837 gimple_cond_false_p (const gcond *gs)
3839 tree lhs = gimple_cond_lhs (gs);
3840 tree rhs = gimple_cond_rhs (gs);
3841 enum tree_code code = gimple_cond_code (gs);
3843 if (lhs != boolean_true_node && lhs != boolean_false_node)
3844 return false;
3846 if (rhs != boolean_true_node && rhs != boolean_false_node)
3847 return false;
3849 if (code == NE_EXPR && lhs == rhs)
3850 return true;
3852 if (code == EQ_EXPR && lhs != rhs)
3853 return true;
3855 return false;
3858 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3860 static inline void
3861 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3862 tree rhs)
3864 gimple_cond_set_code (stmt, code);
3865 gimple_cond_set_lhs (stmt, lhs);
3866 gimple_cond_set_rhs (stmt, rhs);
3870 /* Return the tree code for the expression computed by STMT. This is
3871 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3872 GIMPLE_CALL, return CALL_EXPR as the expression code for
3873 consistency. This is useful when the caller needs to deal with the
3874 three kinds of computation that GIMPLE supports. */
3876 static inline enum tree_code
3877 gimple_expr_code (const gimple *stmt)
3879 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3880 return gimple_assign_rhs_code (ass);
3881 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3882 return gimple_cond_code (cond);
3883 else
3885 gcc_gimple_checking_assert (gimple_code (stmt) == GIMPLE_CALL);
3886 return CALL_EXPR;
3891 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3893 static inline tree
3894 gimple_label_label (const glabel *gs)
3896 return gs->op[0];
3900 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3901 GS. */
3903 static inline void
3904 gimple_label_set_label (glabel *gs, tree label)
3906 gs->op[0] = label;
3910 /* Return the destination of the unconditional jump GS. */
3912 static inline tree
3913 gimple_goto_dest (const gimple *gs)
3915 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3916 return gimple_op (gs, 0);
3920 /* Set DEST to be the destination of the unconditonal jump GS. */
3922 static inline void
3923 gimple_goto_set_dest (ggoto *gs, tree dest)
3925 gs->op[0] = dest;
3929 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3931 static inline tree
3932 gimple_bind_vars (const gbind *bind_stmt)
3934 return bind_stmt->vars;
3938 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3939 statement GS. */
3941 static inline void
3942 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3944 bind_stmt->vars = vars;
3948 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3949 statement GS. */
3951 static inline void
3952 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3954 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3958 static inline gimple_seq *
3959 gimple_bind_body_ptr (gbind *bind_stmt)
3961 return &bind_stmt->body;
3964 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3966 static inline gimple_seq
3967 gimple_bind_body (const gbind *gs)
3969 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3973 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3974 statement GS. */
3976 static inline void
3977 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3979 bind_stmt->body = seq;
3983 /* Append a statement to the end of a GIMPLE_BIND's body. */
3985 static inline void
3986 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3988 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3992 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3994 static inline void
3995 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3997 gimple_seq_add_seq (&bind_stmt->body, seq);
4001 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4002 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4004 static inline tree
4005 gimple_bind_block (const gbind *bind_stmt)
4007 return bind_stmt->block;
4011 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4012 statement GS. */
4014 static inline void
4015 gimple_bind_set_block (gbind *bind_stmt, tree block)
4017 gcc_gimple_checking_assert (block == NULL_TREE
4018 || TREE_CODE (block) == BLOCK);
4019 bind_stmt->block = block;
4023 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4025 static inline unsigned
4026 gimple_asm_ninputs (const gasm *asm_stmt)
4028 return asm_stmt->ni;
4032 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4034 static inline unsigned
4035 gimple_asm_noutputs (const gasm *asm_stmt)
4037 return asm_stmt->no;
4041 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4043 static inline unsigned
4044 gimple_asm_nclobbers (const gasm *asm_stmt)
4046 return asm_stmt->nc;
4049 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4051 static inline unsigned
4052 gimple_asm_nlabels (const gasm *asm_stmt)
4054 return asm_stmt->nl;
4057 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4059 static inline tree
4060 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4062 gcc_gimple_checking_assert (index < asm_stmt->ni);
4063 return asm_stmt->op[index + asm_stmt->no];
4066 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4068 static inline void
4069 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4071 gcc_gimple_checking_assert (index < asm_stmt->ni
4072 && TREE_CODE (in_op) == TREE_LIST);
4073 asm_stmt->op[index + asm_stmt->no] = in_op;
4077 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4079 static inline tree
4080 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4082 gcc_gimple_checking_assert (index < asm_stmt->no);
4083 return asm_stmt->op[index];
4086 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4088 static inline void
4089 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4091 gcc_gimple_checking_assert (index < asm_stmt->no
4092 && TREE_CODE (out_op) == TREE_LIST);
4093 asm_stmt->op[index] = out_op;
4097 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4099 static inline tree
4100 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4102 gcc_gimple_checking_assert (index < asm_stmt->nc);
4103 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4107 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4109 static inline void
4110 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4112 gcc_gimple_checking_assert (index < asm_stmt->nc
4113 && TREE_CODE (clobber_op) == TREE_LIST);
4114 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4117 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4119 static inline tree
4120 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4122 gcc_gimple_checking_assert (index < asm_stmt->nl);
4123 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4126 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4128 static inline void
4129 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4131 gcc_gimple_checking_assert (index < asm_stmt->nl
4132 && TREE_CODE (label_op) == TREE_LIST);
4133 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4136 /* Return the string representing the assembly instruction in
4137 GIMPLE_ASM ASM_STMT. */
4139 static inline const char *
4140 gimple_asm_string (const gasm *asm_stmt)
4142 return asm_stmt->string;
4146 /* Return true if ASM_STMT is marked volatile. */
4148 static inline bool
4149 gimple_asm_volatile_p (const gasm *asm_stmt)
4151 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4155 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4157 static inline void
4158 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4160 if (volatile_p)
4161 asm_stmt->subcode |= GF_ASM_VOLATILE;
4162 else
4163 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4167 /* Return true if ASM_STMT is marked inline. */
4169 static inline bool
4170 gimple_asm_inline_p (const gasm *asm_stmt)
4172 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4176 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4178 static inline void
4179 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4181 if (inline_p)
4182 asm_stmt->subcode |= GF_ASM_INLINE;
4183 else
4184 asm_stmt->subcode &= ~GF_ASM_INLINE;
4188 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4190 static inline void
4191 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4193 if (input_p)
4194 asm_stmt->subcode |= GF_ASM_INPUT;
4195 else
4196 asm_stmt->subcode &= ~GF_ASM_INPUT;
4200 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4202 static inline bool
4203 gimple_asm_input_p (const gasm *asm_stmt)
4205 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4209 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4211 static inline tree
4212 gimple_catch_types (const gcatch *catch_stmt)
4214 return catch_stmt->types;
4218 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4220 static inline tree *
4221 gimple_catch_types_ptr (gcatch *catch_stmt)
4223 return &catch_stmt->types;
4227 /* Return a pointer to the GIMPLE sequence representing the body of
4228 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4230 static inline gimple_seq *
4231 gimple_catch_handler_ptr (gcatch *catch_stmt)
4233 return &catch_stmt->handler;
4237 /* Return the GIMPLE sequence representing the body of the handler of
4238 GIMPLE_CATCH statement CATCH_STMT. */
4240 static inline gimple_seq
4241 gimple_catch_handler (const gcatch *catch_stmt)
4243 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4247 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4249 static inline void
4250 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4252 catch_stmt->types = t;
4256 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4258 static inline void
4259 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4261 catch_stmt->handler = handler;
4265 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4267 static inline tree
4268 gimple_eh_filter_types (const gimple *gs)
4270 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4271 return eh_filter_stmt->types;
4275 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4276 GS. */
4278 static inline tree *
4279 gimple_eh_filter_types_ptr (gimple *gs)
4281 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4282 return &eh_filter_stmt->types;
4286 /* Return a pointer to the sequence of statement to execute when
4287 GIMPLE_EH_FILTER statement fails. */
4289 static inline gimple_seq *
4290 gimple_eh_filter_failure_ptr (gimple *gs)
4292 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4293 return &eh_filter_stmt->failure;
4297 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4298 statement fails. */
4300 static inline gimple_seq
4301 gimple_eh_filter_failure (const gimple *gs)
4303 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4307 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4308 EH_FILTER_STMT. */
4310 static inline void
4311 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4313 eh_filter_stmt->types = types;
4317 /* Set FAILURE to be the sequence of statements to execute on failure
4318 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4320 static inline void
4321 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4322 gimple_seq failure)
4324 eh_filter_stmt->failure = failure;
4327 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4329 static inline tree
4330 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4332 return eh_mnt_stmt->fndecl;
4335 /* Set the function decl to be called by GS to DECL. */
4337 static inline void
4338 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4339 tree decl)
4341 eh_mnt_stmt->fndecl = decl;
4344 /* GIMPLE_EH_ELSE accessors. */
4346 static inline gimple_seq *
4347 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4349 return &eh_else_stmt->n_body;
4352 static inline gimple_seq
4353 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4355 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4358 static inline gimple_seq *
4359 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4361 return &eh_else_stmt->e_body;
4364 static inline gimple_seq
4365 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4367 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4370 static inline void
4371 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4373 eh_else_stmt->n_body = seq;
4376 static inline void
4377 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4379 eh_else_stmt->e_body = seq;
4382 /* GIMPLE_TRY accessors. */
4384 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4385 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4387 static inline enum gimple_try_flags
4388 gimple_try_kind (const gimple *gs)
4390 GIMPLE_CHECK (gs, GIMPLE_TRY);
4391 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4395 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4397 static inline void
4398 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4400 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4401 || kind == GIMPLE_TRY_FINALLY);
4402 if (gimple_try_kind (gs) != kind)
4403 gs->subcode = (unsigned int) kind;
4407 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4409 static inline bool
4410 gimple_try_catch_is_cleanup (const gimple *gs)
4412 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4413 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4417 /* Return a pointer to the sequence of statements used as the
4418 body for GIMPLE_TRY GS. */
4420 static inline gimple_seq *
4421 gimple_try_eval_ptr (gimple *gs)
4423 gtry *try_stmt = as_a <gtry *> (gs);
4424 return &try_stmt->eval;
4428 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4430 static inline gimple_seq
4431 gimple_try_eval (const gimple *gs)
4433 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4437 /* Return a pointer to the sequence of statements used as the cleanup body for
4438 GIMPLE_TRY GS. */
4440 static inline gimple_seq *
4441 gimple_try_cleanup_ptr (gimple *gs)
4443 gtry *try_stmt = as_a <gtry *> (gs);
4444 return &try_stmt->cleanup;
4448 /* Return the sequence of statements used as the cleanup body for
4449 GIMPLE_TRY GS. */
4451 static inline gimple_seq
4452 gimple_try_cleanup (const gimple *gs)
4454 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4458 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4460 static inline void
4461 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4463 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4464 if (catch_is_cleanup)
4465 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4466 else
4467 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4471 /* Set EVAL to be the sequence of statements to use as the body for
4472 GIMPLE_TRY TRY_STMT. */
4474 static inline void
4475 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4477 try_stmt->eval = eval;
4481 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4482 body for GIMPLE_TRY TRY_STMT. */
4484 static inline void
4485 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4487 try_stmt->cleanup = cleanup;
4491 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4493 static inline gimple_seq *
4494 gimple_wce_cleanup_ptr (gimple *gs)
4496 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4497 return &wce_stmt->cleanup;
4501 /* Return the cleanup sequence for cleanup statement GS. */
4503 static inline gimple_seq
4504 gimple_wce_cleanup (gimple *gs)
4506 return *gimple_wce_cleanup_ptr (gs);
4510 /* Set CLEANUP to be the cleanup sequence for GS. */
4512 static inline void
4513 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4515 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4516 wce_stmt->cleanup = cleanup;
4520 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4522 static inline bool
4523 gimple_wce_cleanup_eh_only (const gimple *gs)
4525 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4526 return gs->subcode != 0;
4530 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4532 static inline void
4533 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4535 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4536 gs->subcode = (unsigned int) eh_only_p;
4540 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4542 static inline unsigned
4543 gimple_phi_capacity (const gimple *gs)
4545 const gphi *phi_stmt = as_a <const gphi *> (gs);
4546 return phi_stmt->capacity;
4550 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4551 be exactly the number of incoming edges for the basic block holding
4552 GS. */
4554 static inline unsigned
4555 gimple_phi_num_args (const gimple *gs)
4557 const gphi *phi_stmt = as_a <const gphi *> (gs);
4558 return phi_stmt->nargs;
4562 /* Return the SSA name created by GIMPLE_PHI GS. */
4564 static inline tree
4565 gimple_phi_result (const gphi *gs)
4567 return gs->result;
4570 static inline tree
4571 gimple_phi_result (const gimple *gs)
4573 const gphi *phi_stmt = as_a <const gphi *> (gs);
4574 return gimple_phi_result (phi_stmt);
4577 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4579 static inline tree *
4580 gimple_phi_result_ptr (gphi *gs)
4582 return &gs->result;
4585 static inline tree *
4586 gimple_phi_result_ptr (gimple *gs)
4588 gphi *phi_stmt = as_a <gphi *> (gs);
4589 return gimple_phi_result_ptr (phi_stmt);
4592 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4594 static inline void
4595 gimple_phi_set_result (gphi *phi, tree result)
4597 phi->result = result;
4598 if (result && TREE_CODE (result) == SSA_NAME)
4599 SSA_NAME_DEF_STMT (result) = phi;
4603 /* Return the PHI argument corresponding to incoming edge INDEX for
4604 GIMPLE_PHI GS. */
4606 static inline struct phi_arg_d *
4607 gimple_phi_arg (gphi *gs, unsigned index)
4609 gcc_gimple_checking_assert (index < gs->nargs);
4610 return &(gs->args[index]);
4613 static inline const phi_arg_d *
4614 gimple_phi_arg (const gphi *gs, unsigned index)
4616 gcc_gimple_checking_assert (index < gs->nargs);
4617 return &(gs->args[index]);
4620 static inline struct phi_arg_d *
4621 gimple_phi_arg (gimple *gs, unsigned index)
4623 gphi *phi_stmt = as_a <gphi *> (gs);
4624 return gimple_phi_arg (phi_stmt, index);
4627 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4628 for GIMPLE_PHI PHI. */
4630 static inline void
4631 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4633 gcc_gimple_checking_assert (index < phi->nargs);
4634 phi->args[index] = *phiarg;
4637 /* Return the PHI nodes for basic block BB, or NULL if there are no
4638 PHI nodes. */
4640 static inline gimple_seq
4641 phi_nodes (const_basic_block bb)
4643 gcc_checking_assert (!(bb->flags & BB_RTL));
4644 return bb->il.gimple.phi_nodes;
4647 /* Return a pointer to the PHI nodes for basic block BB. */
4649 static inline gimple_seq *
4650 phi_nodes_ptr (basic_block bb)
4652 gcc_checking_assert (!(bb->flags & BB_RTL));
4653 return &bb->il.gimple.phi_nodes;
4656 /* Return the tree operand for argument I of PHI node GS. */
4658 static inline tree
4659 gimple_phi_arg_def (const gphi *gs, size_t index)
4661 return gimple_phi_arg (gs, index)->def;
4664 static inline tree
4665 gimple_phi_arg_def (gimple *gs, size_t index)
4667 return gimple_phi_arg (gs, index)->def;
4671 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4673 static inline tree *
4674 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4676 return &gimple_phi_arg (phi, index)->def;
4679 /* Return the edge associated with argument I of phi node PHI. */
4681 static inline edge
4682 gimple_phi_arg_edge (const gphi *phi, size_t i)
4684 return EDGE_PRED (gimple_bb (phi), i);
4687 /* Return the source location of gimple argument I of phi node PHI. */
4689 static inline location_t
4690 gimple_phi_arg_location (const gphi *phi, size_t i)
4692 return gimple_phi_arg (phi, i)->locus;
4695 /* Return the source location of the argument on edge E of phi node PHI. */
4697 static inline location_t
4698 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4700 return gimple_phi_arg (phi, e->dest_idx)->locus;
4703 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4705 static inline void
4706 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4708 gimple_phi_arg (phi, i)->locus = loc;
4711 /* Return address of source location of gimple argument I of phi node PHI. */
4713 static inline location_t *
4714 gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4716 return &gimple_phi_arg (phi, i)->locus;
4719 /* Return TRUE if argument I of phi node PHI has a location record. */
4721 static inline bool
4722 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4724 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4727 /* Return the number of arguments that can be accessed by gimple_arg. */
4729 static inline unsigned
4730 gimple_num_args (const gimple *gs)
4732 if (auto phi = dyn_cast<const gphi *> (gs))
4733 return gimple_phi_num_args (phi);
4734 if (auto call = dyn_cast<const gcall *> (gs))
4735 return gimple_call_num_args (call);
4736 return gimple_num_ops (as_a <const gassign *> (gs)) - 1;
4739 /* GS must be an assignment, a call, or a PHI.
4740 If it's an assignment, return rhs operand I.
4741 If it's a call, return function argument I.
4742 If it's a PHI, return the value of PHI argument I. */
4744 static inline tree
4745 gimple_arg (const gimple *gs, unsigned int i)
4747 if (auto phi = dyn_cast<const gphi *> (gs))
4748 return gimple_phi_arg_def (phi, i);
4749 if (auto call = dyn_cast<const gcall *> (gs))
4750 return gimple_call_arg (call, i);
4751 return gimple_op (as_a <const gassign *> (gs), i + 1);
4754 /* Return a pointer to gimple_arg (GS, I). */
4756 static inline tree *
4757 gimple_arg_ptr (gimple *gs, unsigned int i)
4759 if (auto phi = dyn_cast<gphi *> (gs))
4760 return gimple_phi_arg_def_ptr (phi, i);
4761 if (auto call = dyn_cast<gcall *> (gs))
4762 return gimple_call_arg_ptr (call, i);
4763 return gimple_op_ptr (as_a <gassign *> (gs), i + 1);
4766 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4768 static inline int
4769 gimple_resx_region (const gresx *resx_stmt)
4771 return resx_stmt->region;
4774 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4776 static inline void
4777 gimple_resx_set_region (gresx *resx_stmt, int region)
4779 resx_stmt->region = region;
4782 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4784 static inline int
4785 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4787 return eh_dispatch_stmt->region;
4790 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4791 EH_DISPATCH_STMT. */
4793 static inline void
4794 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4796 eh_dispatch_stmt->region = region;
4799 /* Return the number of labels associated with the switch statement GS. */
4801 static inline unsigned
4802 gimple_switch_num_labels (const gswitch *gs)
4804 unsigned num_ops;
4805 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4806 num_ops = gimple_num_ops (gs);
4807 gcc_gimple_checking_assert (num_ops > 1);
4808 return num_ops - 1;
4812 /* Set NLABELS to be the number of labels for the switch statement GS. */
4814 static inline void
4815 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4817 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4818 gimple_set_num_ops (g, nlabels + 1);
4822 /* Return the index variable used by the switch statement GS. */
4824 static inline tree
4825 gimple_switch_index (const gswitch *gs)
4827 return gs->op[0];
4831 /* Return a pointer to the index variable for the switch statement GS. */
4833 static inline tree *
4834 gimple_switch_index_ptr (gswitch *gs)
4836 return &gs->op[0];
4840 /* Set INDEX to be the index variable for switch statement GS. */
4842 static inline void
4843 gimple_switch_set_index (gswitch *gs, tree index)
4845 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4846 gs->op[0] = index;
4850 /* Return the label numbered INDEX. The default label is 0, followed by any
4851 labels in a switch statement. */
4853 static inline tree
4854 gimple_switch_label (const gswitch *gs, unsigned index)
4856 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4857 return gs->op[index + 1];
4860 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4862 static inline void
4863 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4865 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4866 && (label == NULL_TREE
4867 || TREE_CODE (label) == CASE_LABEL_EXPR));
4868 gs->op[index + 1] = label;
4871 /* Return the default label for a switch statement. */
4873 static inline tree
4874 gimple_switch_default_label (const gswitch *gs)
4876 tree label = gimple_switch_label (gs, 0);
4877 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4878 return label;
4881 /* Set the default label for a switch statement. */
4883 static inline void
4884 gimple_switch_set_default_label (gswitch *gs, tree label)
4886 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4887 gimple_switch_set_label (gs, 0, label);
4890 /* Return true if GS is a GIMPLE_DEBUG statement. */
4892 static inline bool
4893 is_gimple_debug (const gimple *gs)
4895 return gimple_code (gs) == GIMPLE_DEBUG;
4899 /* Return the first nondebug statement in GIMPLE sequence S. */
4901 static inline gimple *
4902 gimple_seq_first_nondebug_stmt (gimple_seq s)
4904 gimple_seq_node n = gimple_seq_first (s);
4905 while (n && is_gimple_debug (n))
4906 n = n->next;
4907 return n;
4911 /* Return the last nondebug statement in GIMPLE sequence S. */
4913 static inline gimple *
4914 gimple_seq_last_nondebug_stmt (gimple_seq s)
4916 gimple_seq_node n;
4917 for (n = gimple_seq_last (s);
4918 n && is_gimple_debug (n);
4919 n = n->prev)
4920 if (n == s)
4921 return NULL;
4922 return n;
4926 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4928 static inline bool
4929 gimple_debug_bind_p (const gimple *s)
4931 if (is_gimple_debug (s))
4932 return s->subcode == GIMPLE_DEBUG_BIND;
4934 return false;
4937 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4939 static inline tree
4940 gimple_debug_bind_get_var (const gimple *dbg)
4942 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4943 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4944 return gimple_op (dbg, 0);
4947 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4948 statement. */
4950 static inline tree
4951 gimple_debug_bind_get_value (const gimple *dbg)
4953 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4954 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4955 return gimple_op (dbg, 1);
4958 /* Return a pointer to the value bound to the variable in a
4959 GIMPLE_DEBUG bind statement. */
4961 static inline tree *
4962 gimple_debug_bind_get_value_ptr (gimple *dbg)
4964 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4965 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4966 return gimple_op_ptr (dbg, 1);
4969 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4971 static inline void
4972 gimple_debug_bind_set_var (gimple *dbg, tree var)
4974 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4975 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4976 gimple_set_op (dbg, 0, var);
4979 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4980 statement. */
4982 static inline void
4983 gimple_debug_bind_set_value (gimple *dbg, tree value)
4985 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4986 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4987 gimple_set_op (dbg, 1, value);
4990 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4991 optimized away. */
4992 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4994 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4995 statement. */
4997 static inline void
4998 gimple_debug_bind_reset_value (gimple *dbg)
5000 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5001 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5002 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
5005 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
5006 value. */
5008 static inline bool
5009 gimple_debug_bind_has_value_p (gimple *dbg)
5011 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5012 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5013 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
5016 #undef GIMPLE_DEBUG_BIND_NOVALUE
5018 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
5020 static inline bool
5021 gimple_debug_source_bind_p (const gimple *s)
5023 if (is_gimple_debug (s))
5024 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
5026 return false;
5029 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
5031 static inline tree
5032 gimple_debug_source_bind_get_var (const gimple *dbg)
5034 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5035 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5036 return gimple_op (dbg, 0);
5039 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
5040 statement. */
5042 static inline tree
5043 gimple_debug_source_bind_get_value (const gimple *dbg)
5045 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5046 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5047 return gimple_op (dbg, 1);
5050 /* Return a pointer to the value bound to the variable in a
5051 GIMPLE_DEBUG source bind statement. */
5053 static inline tree *
5054 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
5056 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5057 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5058 return gimple_op_ptr (dbg, 1);
5061 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
5063 static inline void
5064 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
5066 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5067 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5068 gimple_set_op (dbg, 0, var);
5071 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5072 statement. */
5074 static inline void
5075 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
5077 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5078 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5079 gimple_set_op (dbg, 1, value);
5082 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5084 static inline bool
5085 gimple_debug_begin_stmt_p (const gimple *s)
5087 if (is_gimple_debug (s))
5088 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
5090 return false;
5093 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5095 static inline bool
5096 gimple_debug_inline_entry_p (const gimple *s)
5098 if (is_gimple_debug (s))
5099 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5101 return false;
5104 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5106 static inline bool
5107 gimple_debug_nonbind_marker_p (const gimple *s)
5109 if (is_gimple_debug (s))
5110 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5111 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5113 return false;
5116 /* Return the line number for EXPR, or return -1 if we have no line
5117 number information for it. */
5118 static inline int
5119 get_lineno (const gimple *stmt)
5121 location_t loc;
5123 if (!stmt)
5124 return -1;
5126 loc = gimple_location (stmt);
5127 if (loc == UNKNOWN_LOCATION)
5128 return -1;
5130 return LOCATION_LINE (loc);
5133 /* Return a pointer to the body for the OMP statement GS. */
5135 static inline gimple_seq *
5136 gimple_omp_body_ptr (gimple *gs)
5138 return &static_cast <gimple_statement_omp *> (gs)->body;
5141 /* Return the body for the OMP statement GS. */
5143 static inline gimple_seq
5144 gimple_omp_body (const gimple *gs)
5146 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
5149 /* Set BODY to be the body for the OMP statement GS. */
5151 static inline void
5152 gimple_omp_set_body (gimple *gs, gimple_seq body)
5154 static_cast <gimple_statement_omp *> (gs)->body = body;
5158 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5160 static inline tree
5161 gimple_omp_critical_name (const gomp_critical *crit_stmt)
5163 return crit_stmt->name;
5167 /* Return a pointer to the name associated with OMP critical statement
5168 CRIT_STMT. */
5170 static inline tree *
5171 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5173 return &crit_stmt->name;
5177 /* Set NAME to be the name associated with OMP critical statement
5178 CRIT_STMT. */
5180 static inline void
5181 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5183 crit_stmt->name = name;
5187 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5189 static inline tree
5190 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5192 return crit_stmt->clauses;
5196 /* Return a pointer to the clauses associated with OMP critical statement
5197 CRIT_STMT. */
5199 static inline tree *
5200 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5202 return &crit_stmt->clauses;
5206 /* Set CLAUSES to be the clauses associated with OMP critical statement
5207 CRIT_STMT. */
5209 static inline void
5210 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5212 crit_stmt->clauses = clauses;
5216 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5218 static inline tree
5219 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5221 return ord_stmt->clauses;
5225 /* Return a pointer to the clauses associated with OMP ordered statement
5226 ORD_STMT. */
5228 static inline tree *
5229 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5231 return &ord_stmt->clauses;
5235 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5236 ORD_STMT. */
5238 static inline void
5239 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5241 ord_stmt->clauses = clauses;
5245 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5247 static inline tree
5248 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5250 return scan_stmt->clauses;
5254 /* Return a pointer to the clauses associated with OMP scan statement
5255 ORD_STMT. */
5257 static inline tree *
5258 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5260 return &scan_stmt->clauses;
5264 /* Set CLAUSES to be the clauses associated with OMP scan statement
5265 ORD_STMT. */
5267 static inline void
5268 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5270 scan_stmt->clauses = clauses;
5274 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5276 static inline tree
5277 gimple_omp_taskgroup_clauses (const gimple *gs)
5279 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5280 return
5281 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5285 /* Return a pointer to the clauses associated with OMP taskgroup statement
5286 GS. */
5288 static inline tree *
5289 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5291 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5292 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5296 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5297 GS. */
5299 static inline void
5300 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5302 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5303 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5304 = clauses;
5308 /* Return the clauses associated with OMP_MASKED statement GS. */
5310 static inline tree
5311 gimple_omp_masked_clauses (const gimple *gs)
5313 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5314 return
5315 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5319 /* Return a pointer to the clauses associated with OMP masked statement
5320 GS. */
5322 static inline tree *
5323 gimple_omp_masked_clauses_ptr (gimple *gs)
5325 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5326 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5330 /* Set CLAUSES to be the clauses associated with OMP masked statement
5331 GS. */
5333 static inline void
5334 gimple_omp_masked_set_clauses (gimple *gs, tree clauses)
5336 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5337 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5338 = clauses;
5342 /* Return the clauses associated with OMP_SCOPE statement GS. */
5344 static inline tree
5345 gimple_omp_scope_clauses (const gimple *gs)
5347 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5348 return
5349 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5353 /* Return a pointer to the clauses associated with OMP scope statement
5354 GS. */
5356 static inline tree *
5357 gimple_omp_scope_clauses_ptr (gimple *gs)
5359 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5360 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5364 /* Set CLAUSES to be the clauses associated with OMP scope statement
5365 GS. */
5367 static inline void
5368 gimple_omp_scope_set_clauses (gimple *gs, tree clauses)
5370 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5371 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5372 = clauses;
5376 /* Return the kind of the OMP_FOR statemement G. */
5378 static inline int
5379 gimple_omp_for_kind (const gimple *g)
5381 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5382 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5386 /* Set the kind of the OMP_FOR statement G. */
5388 static inline void
5389 gimple_omp_for_set_kind (gomp_for *g, int kind)
5391 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5392 | (kind & GF_OMP_FOR_KIND_MASK);
5396 /* Return true if OMP_FOR statement G has the
5397 GF_OMP_FOR_COMBINED flag set. */
5399 static inline bool
5400 gimple_omp_for_combined_p (const gimple *g)
5402 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5403 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5407 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5408 the boolean value of COMBINED_P. */
5410 static inline void
5411 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5413 if (combined_p)
5414 g->subcode |= GF_OMP_FOR_COMBINED;
5415 else
5416 g->subcode &= ~GF_OMP_FOR_COMBINED;
5420 /* Return true if the OMP_FOR statement G has the
5421 GF_OMP_FOR_COMBINED_INTO flag set. */
5423 static inline bool
5424 gimple_omp_for_combined_into_p (const gimple *g)
5426 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5427 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5431 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5432 on the boolean value of COMBINED_P. */
5434 static inline void
5435 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5437 if (combined_p)
5438 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5439 else
5440 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5444 /* Return the clauses associated with the OMP_FOR statement GS. */
5446 static inline tree
5447 gimple_omp_for_clauses (const gimple *gs)
5449 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5450 return omp_for_stmt->clauses;
5454 /* Return a pointer to the clauses associated with the OMP_FOR statement
5455 GS. */
5457 static inline tree *
5458 gimple_omp_for_clauses_ptr (gimple *gs)
5460 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5461 return &omp_for_stmt->clauses;
5465 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5466 GS. */
5468 static inline void
5469 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5471 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5472 omp_for_stmt->clauses = clauses;
5476 /* Get the collapse count of the OMP_FOR statement GS. */
5478 static inline size_t
5479 gimple_omp_for_collapse (const gimple *gs)
5481 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5482 return omp_for_stmt->collapse;
5486 /* Return the condition code associated with the OMP_FOR statement GS. */
5488 static inline enum tree_code
5489 gimple_omp_for_cond (const gimple *gs, size_t i)
5491 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5492 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5493 return omp_for_stmt->iter[i].cond;
5497 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5499 static inline void
5500 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5502 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5503 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5504 && i < omp_for_stmt->collapse);
5505 omp_for_stmt->iter[i].cond = cond;
5509 /* Return the index variable for the OMP_FOR statement GS. */
5511 static inline tree
5512 gimple_omp_for_index (const gimple *gs, size_t i)
5514 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5515 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5516 return omp_for_stmt->iter[i].index;
5520 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5522 static inline tree *
5523 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5525 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5526 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5527 return &omp_for_stmt->iter[i].index;
5531 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5533 static inline void
5534 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5536 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5537 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5538 omp_for_stmt->iter[i].index = index;
5542 /* Return the initial value for the OMP_FOR statement GS. */
5544 static inline tree
5545 gimple_omp_for_initial (const gimple *gs, size_t i)
5547 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5548 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5549 return omp_for_stmt->iter[i].initial;
5553 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5555 static inline tree *
5556 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5558 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5559 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5560 return &omp_for_stmt->iter[i].initial;
5564 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5566 static inline void
5567 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5569 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5570 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5571 omp_for_stmt->iter[i].initial = initial;
5575 /* Return the final value for the OMP_FOR statement GS. */
5577 static inline tree
5578 gimple_omp_for_final (const gimple *gs, size_t i)
5580 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5581 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5582 return omp_for_stmt->iter[i].final;
5586 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5588 static inline tree *
5589 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5591 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5592 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5593 return &omp_for_stmt->iter[i].final;
5597 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5599 static inline void
5600 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5602 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5603 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5604 omp_for_stmt->iter[i].final = final;
5608 /* Return the increment value for the OMP_FOR statement GS. */
5610 static inline tree
5611 gimple_omp_for_incr (const gimple *gs, size_t i)
5613 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5614 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5615 return omp_for_stmt->iter[i].incr;
5619 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5621 static inline tree *
5622 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5624 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5625 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5626 return &omp_for_stmt->iter[i].incr;
5630 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5632 static inline void
5633 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5635 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5636 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5637 omp_for_stmt->iter[i].incr = incr;
5641 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5642 statement GS starts. */
5644 static inline gimple_seq *
5645 gimple_omp_for_pre_body_ptr (gimple *gs)
5647 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5648 return &omp_for_stmt->pre_body;
5652 /* Return the sequence of statements to execute before the OMP_FOR
5653 statement GS starts. */
5655 static inline gimple_seq
5656 gimple_omp_for_pre_body (const gimple *gs)
5658 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5662 /* Set PRE_BODY to be the sequence of statements to execute before the
5663 OMP_FOR statement GS starts. */
5665 static inline void
5666 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5668 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5669 omp_for_stmt->pre_body = pre_body;
5672 /* Return the clauses associated with OMP_PARALLEL GS. */
5674 static inline tree
5675 gimple_omp_parallel_clauses (const gimple *gs)
5677 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5678 return omp_parallel_stmt->clauses;
5682 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5684 static inline tree *
5685 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5687 return &omp_parallel_stmt->clauses;
5691 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5693 static inline void
5694 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5695 tree clauses)
5697 omp_parallel_stmt->clauses = clauses;
5701 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5703 static inline tree
5704 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5706 return omp_parallel_stmt->child_fn;
5709 /* Return a pointer to the child function used to hold the body of
5710 OMP_PARALLEL_STMT. */
5712 static inline tree *
5713 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5715 return &omp_parallel_stmt->child_fn;
5719 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5721 static inline void
5722 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5723 tree child_fn)
5725 omp_parallel_stmt->child_fn = child_fn;
5729 /* Return the artificial argument used to send variables and values
5730 from the parent to the children threads in OMP_PARALLEL_STMT. */
5732 static inline tree
5733 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5735 return omp_parallel_stmt->data_arg;
5739 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5741 static inline tree *
5742 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5744 return &omp_parallel_stmt->data_arg;
5748 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5750 static inline void
5751 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5752 tree data_arg)
5754 omp_parallel_stmt->data_arg = data_arg;
5757 /* Return the clauses associated with OMP_TASK GS. */
5759 static inline tree
5760 gimple_omp_task_clauses (const gimple *gs)
5762 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5763 return omp_task_stmt->clauses;
5767 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5769 static inline tree *
5770 gimple_omp_task_clauses_ptr (gimple *gs)
5772 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5773 return &omp_task_stmt->clauses;
5777 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5778 GS. */
5780 static inline void
5781 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5783 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5784 omp_task_stmt->clauses = clauses;
5788 /* Return true if OMP task statement G has the
5789 GF_OMP_TASK_TASKLOOP flag set. */
5791 static inline bool
5792 gimple_omp_task_taskloop_p (const gimple *g)
5794 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5795 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5799 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5800 value of TASKLOOP_P. */
5802 static inline void
5803 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5805 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5806 if (taskloop_p)
5807 g->subcode |= GF_OMP_TASK_TASKLOOP;
5808 else
5809 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5813 /* Return true if OMP task statement G has the
5814 GF_OMP_TASK_TASKWAIT flag set. */
5816 static inline bool
5817 gimple_omp_task_taskwait_p (const gimple *g)
5819 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5820 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5824 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5825 value of TASKWAIT_P. */
5827 static inline void
5828 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5830 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5831 if (taskwait_p)
5832 g->subcode |= GF_OMP_TASK_TASKWAIT;
5833 else
5834 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5838 /* Return the child function used to hold the body of OMP_TASK GS. */
5840 static inline tree
5841 gimple_omp_task_child_fn (const gimple *gs)
5843 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5844 return omp_task_stmt->child_fn;
5847 /* Return a pointer to the child function used to hold the body of
5848 OMP_TASK GS. */
5850 static inline tree *
5851 gimple_omp_task_child_fn_ptr (gimple *gs)
5853 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5854 return &omp_task_stmt->child_fn;
5858 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5860 static inline void
5861 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5863 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5864 omp_task_stmt->child_fn = child_fn;
5868 /* Return the artificial argument used to send variables and values
5869 from the parent to the children threads in OMP_TASK GS. */
5871 static inline tree
5872 gimple_omp_task_data_arg (const gimple *gs)
5874 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5875 return omp_task_stmt->data_arg;
5879 /* Return a pointer to the data argument for OMP_TASK GS. */
5881 static inline tree *
5882 gimple_omp_task_data_arg_ptr (gimple *gs)
5884 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5885 return &omp_task_stmt->data_arg;
5889 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5891 static inline void
5892 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5894 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5895 omp_task_stmt->data_arg = data_arg;
5899 /* Return the clauses associated with OMP_TASK GS. */
5901 static inline tree
5902 gimple_omp_taskreg_clauses (const gimple *gs)
5904 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5905 = as_a <const gimple_statement_omp_taskreg *> (gs);
5906 return omp_taskreg_stmt->clauses;
5910 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5912 static inline tree *
5913 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5915 gimple_statement_omp_taskreg *omp_taskreg_stmt
5916 = as_a <gimple_statement_omp_taskreg *> (gs);
5917 return &omp_taskreg_stmt->clauses;
5921 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5922 GS. */
5924 static inline void
5925 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5927 gimple_statement_omp_taskreg *omp_taskreg_stmt
5928 = as_a <gimple_statement_omp_taskreg *> (gs);
5929 omp_taskreg_stmt->clauses = clauses;
5933 /* Return the child function used to hold the body of OMP_TASK GS. */
5935 static inline tree
5936 gimple_omp_taskreg_child_fn (const gimple *gs)
5938 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5939 = as_a <const gimple_statement_omp_taskreg *> (gs);
5940 return omp_taskreg_stmt->child_fn;
5943 /* Return a pointer to the child function used to hold the body of
5944 OMP_TASK GS. */
5946 static inline tree *
5947 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5949 gimple_statement_omp_taskreg *omp_taskreg_stmt
5950 = as_a <gimple_statement_omp_taskreg *> (gs);
5951 return &omp_taskreg_stmt->child_fn;
5955 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5957 static inline void
5958 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5960 gimple_statement_omp_taskreg *omp_taskreg_stmt
5961 = as_a <gimple_statement_omp_taskreg *> (gs);
5962 omp_taskreg_stmt->child_fn = child_fn;
5966 /* Return the artificial argument used to send variables and values
5967 from the parent to the children threads in OMP_TASK GS. */
5969 static inline tree
5970 gimple_omp_taskreg_data_arg (const gimple *gs)
5972 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5973 = as_a <const gimple_statement_omp_taskreg *> (gs);
5974 return omp_taskreg_stmt->data_arg;
5978 /* Return a pointer to the data argument for OMP_TASK GS. */
5980 static inline tree *
5981 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5983 gimple_statement_omp_taskreg *omp_taskreg_stmt
5984 = as_a <gimple_statement_omp_taskreg *> (gs);
5985 return &omp_taskreg_stmt->data_arg;
5989 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5991 static inline void
5992 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5994 gimple_statement_omp_taskreg *omp_taskreg_stmt
5995 = as_a <gimple_statement_omp_taskreg *> (gs);
5996 omp_taskreg_stmt->data_arg = data_arg;
6000 /* Return the copy function used to hold the body of OMP_TASK GS. */
6002 static inline tree
6003 gimple_omp_task_copy_fn (const gimple *gs)
6005 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6006 return omp_task_stmt->copy_fn;
6009 /* Return a pointer to the copy function used to hold the body of
6010 OMP_TASK GS. */
6012 static inline tree *
6013 gimple_omp_task_copy_fn_ptr (gimple *gs)
6015 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6016 return &omp_task_stmt->copy_fn;
6020 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
6022 static inline void
6023 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
6025 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6026 omp_task_stmt->copy_fn = copy_fn;
6030 /* Return size of the data block in bytes in OMP_TASK GS. */
6032 static inline tree
6033 gimple_omp_task_arg_size (const gimple *gs)
6035 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6036 return omp_task_stmt->arg_size;
6040 /* Return a pointer to the data block size for OMP_TASK GS. */
6042 static inline tree *
6043 gimple_omp_task_arg_size_ptr (gimple *gs)
6045 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6046 return &omp_task_stmt->arg_size;
6050 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
6052 static inline void
6053 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
6055 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6056 omp_task_stmt->arg_size = arg_size;
6060 /* Return align of the data block in bytes in OMP_TASK GS. */
6062 static inline tree
6063 gimple_omp_task_arg_align (const gimple *gs)
6065 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6066 return omp_task_stmt->arg_align;
6070 /* Return a pointer to the data block align for OMP_TASK GS. */
6072 static inline tree *
6073 gimple_omp_task_arg_align_ptr (gimple *gs)
6075 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6076 return &omp_task_stmt->arg_align;
6080 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
6082 static inline void
6083 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
6085 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6086 omp_task_stmt->arg_align = arg_align;
6090 /* Return the clauses associated with OMP_SINGLE GS. */
6092 static inline tree
6093 gimple_omp_single_clauses (const gimple *gs)
6095 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
6096 return omp_single_stmt->clauses;
6100 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
6102 static inline tree *
6103 gimple_omp_single_clauses_ptr (gimple *gs)
6105 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
6106 return &omp_single_stmt->clauses;
6110 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
6112 static inline void
6113 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
6115 omp_single_stmt->clauses = clauses;
6119 /* Return the clauses associated with OMP_TARGET GS. */
6121 static inline tree
6122 gimple_omp_target_clauses (const gimple *gs)
6124 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
6125 return omp_target_stmt->clauses;
6129 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
6131 static inline tree *
6132 gimple_omp_target_clauses_ptr (gimple *gs)
6134 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
6135 return &omp_target_stmt->clauses;
6139 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6141 static inline void
6142 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
6143 tree clauses)
6145 omp_target_stmt->clauses = clauses;
6149 /* Return the kind of the OMP_TARGET G. */
6151 static inline int
6152 gimple_omp_target_kind (const gimple *g)
6154 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
6155 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
6159 /* Set the kind of the OMP_TARGET G. */
6161 static inline void
6162 gimple_omp_target_set_kind (gomp_target *g, int kind)
6164 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6165 | (kind & GF_OMP_TARGET_KIND_MASK);
6169 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6171 static inline tree
6172 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6174 return omp_target_stmt->child_fn;
6177 /* Return a pointer to the child function used to hold the body of
6178 OMP_TARGET_STMT. */
6180 static inline tree *
6181 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6183 return &omp_target_stmt->child_fn;
6187 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6189 static inline void
6190 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6191 tree child_fn)
6193 omp_target_stmt->child_fn = child_fn;
6197 /* Return the artificial argument used to send variables and values
6198 from the parent to the children threads in OMP_TARGET_STMT. */
6200 static inline tree
6201 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6203 return omp_target_stmt->data_arg;
6207 /* Return a pointer to the data argument for OMP_TARGET GS. */
6209 static inline tree *
6210 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6212 return &omp_target_stmt->data_arg;
6216 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6218 static inline void
6219 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6220 tree data_arg)
6222 omp_target_stmt->data_arg = data_arg;
6226 /* Return the clauses associated with OMP_TEAMS GS. */
6228 static inline tree
6229 gimple_omp_teams_clauses (const gimple *gs)
6231 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6232 return omp_teams_stmt->clauses;
6236 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6238 static inline tree *
6239 gimple_omp_teams_clauses_ptr (gimple *gs)
6241 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6242 return &omp_teams_stmt->clauses;
6246 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6248 static inline void
6249 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6251 omp_teams_stmt->clauses = clauses;
6254 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6256 static inline tree
6257 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6259 return omp_teams_stmt->child_fn;
6262 /* Return a pointer to the child function used to hold the body of
6263 OMP_TEAMS_STMT. */
6265 static inline tree *
6266 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6268 return &omp_teams_stmt->child_fn;
6272 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6274 static inline void
6275 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6277 omp_teams_stmt->child_fn = child_fn;
6281 /* Return the artificial argument used to send variables and values
6282 from the parent to the children threads in OMP_TEAMS_STMT. */
6284 static inline tree
6285 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6287 return omp_teams_stmt->data_arg;
6291 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6293 static inline tree *
6294 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6296 return &omp_teams_stmt->data_arg;
6300 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6302 static inline void
6303 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6305 omp_teams_stmt->data_arg = data_arg;
6308 /* Return the host flag of an OMP_TEAMS_STMT. */
6310 static inline bool
6311 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6313 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6316 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6318 static inline void
6319 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6321 if (value)
6322 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6323 else
6324 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6327 /* Return the clauses associated with OMP_SECTIONS GS. */
6329 static inline tree
6330 gimple_omp_sections_clauses (const gimple *gs)
6332 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6333 return omp_sections_stmt->clauses;
6337 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6339 static inline tree *
6340 gimple_omp_sections_clauses_ptr (gimple *gs)
6342 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6343 return &omp_sections_stmt->clauses;
6347 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6348 GS. */
6350 static inline void
6351 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6353 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6354 omp_sections_stmt->clauses = clauses;
6358 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6359 in GS. */
6361 static inline tree
6362 gimple_omp_sections_control (const gimple *gs)
6364 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6365 return omp_sections_stmt->control;
6369 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6370 GS. */
6372 static inline tree *
6373 gimple_omp_sections_control_ptr (gimple *gs)
6375 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6376 return &omp_sections_stmt->control;
6380 /* Set CONTROL to be the set of clauses associated with the
6381 GIMPLE_OMP_SECTIONS in GS. */
6383 static inline void
6384 gimple_omp_sections_set_control (gimple *gs, tree control)
6386 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6387 omp_sections_stmt->control = control;
6391 /* Set the value being stored in an atomic store. */
6393 static inline void
6394 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6396 store_stmt->val = val;
6400 /* Return the value being stored in an atomic store. */
6402 static inline tree
6403 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6405 return store_stmt->val;
6409 /* Return a pointer to the value being stored in an atomic store. */
6411 static inline tree *
6412 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6414 return &store_stmt->val;
6418 /* Set the LHS of an atomic load. */
6420 static inline void
6421 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6423 load_stmt->lhs = lhs;
6427 /* Get the LHS of an atomic load. */
6429 static inline tree
6430 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6432 return load_stmt->lhs;
6436 /* Return a pointer to the LHS of an atomic load. */
6438 static inline tree *
6439 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6441 return &load_stmt->lhs;
6445 /* Set the RHS of an atomic load. */
6447 static inline void
6448 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6450 load_stmt->rhs = rhs;
6454 /* Get the RHS of an atomic load. */
6456 static inline tree
6457 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6459 return load_stmt->rhs;
6463 /* Return a pointer to the RHS of an atomic load. */
6465 static inline tree *
6466 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6468 return &load_stmt->rhs;
6472 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6474 static inline tree
6475 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6477 return cont_stmt->control_def;
6480 /* The same as above, but return the address. */
6482 static inline tree *
6483 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6485 return &cont_stmt->control_def;
6488 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6490 static inline void
6491 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6493 cont_stmt->control_def = def;
6497 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6499 static inline tree
6500 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6502 return cont_stmt->control_use;
6506 /* The same as above, but return the address. */
6508 static inline tree *
6509 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6511 return &cont_stmt->control_use;
6515 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6517 static inline void
6518 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6520 cont_stmt->control_use = use;
6523 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6524 TRANSACTION_STMT. */
6526 static inline gimple_seq *
6527 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6529 return &transaction_stmt->body;
6532 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6534 static inline gimple_seq
6535 gimple_transaction_body (const gtransaction *transaction_stmt)
6537 return transaction_stmt->body;
6540 /* Return the label associated with a GIMPLE_TRANSACTION. */
6542 static inline tree
6543 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6545 return transaction_stmt->label_norm;
6548 static inline tree *
6549 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6551 return &transaction_stmt->label_norm;
6554 static inline tree
6555 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6557 return transaction_stmt->label_uninst;
6560 static inline tree *
6561 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6563 return &transaction_stmt->label_uninst;
6566 static inline tree
6567 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6569 return transaction_stmt->label_over;
6572 static inline tree *
6573 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6575 return &transaction_stmt->label_over;
6578 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6580 static inline unsigned int
6581 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6583 return transaction_stmt->subcode;
6586 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6587 TRANSACTION_STMT. */
6589 static inline void
6590 gimple_transaction_set_body (gtransaction *transaction_stmt,
6591 gimple_seq body)
6593 transaction_stmt->body = body;
6596 /* Set the label associated with a GIMPLE_TRANSACTION. */
6598 static inline void
6599 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6601 transaction_stmt->label_norm = label;
6604 static inline void
6605 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6607 transaction_stmt->label_uninst = label;
6610 static inline void
6611 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6613 transaction_stmt->label_over = label;
6616 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6618 static inline void
6619 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6620 unsigned int subcode)
6622 transaction_stmt->subcode = subcode;
6625 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6627 static inline tree *
6628 gimple_return_retval_ptr (greturn *gs)
6630 return &gs->op[0];
6633 /* Return the return value for GIMPLE_RETURN GS. */
6635 static inline tree
6636 gimple_return_retval (const greturn *gs)
6638 return gs->op[0];
6642 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6644 static inline void
6645 gimple_return_set_retval (greturn *gs, tree retval)
6647 gs->op[0] = retval;
6651 /* Returns true when the gimple statement STMT is any of the OMP types. */
6653 #define CASE_GIMPLE_OMP \
6654 case GIMPLE_OMP_PARALLEL: \
6655 case GIMPLE_OMP_TASK: \
6656 case GIMPLE_OMP_FOR: \
6657 case GIMPLE_OMP_SECTIONS: \
6658 case GIMPLE_OMP_SECTIONS_SWITCH: \
6659 case GIMPLE_OMP_SINGLE: \
6660 case GIMPLE_OMP_TARGET: \
6661 case GIMPLE_OMP_TEAMS: \
6662 case GIMPLE_OMP_SCOPE: \
6663 case GIMPLE_OMP_SECTION: \
6664 case GIMPLE_OMP_MASTER: \
6665 case GIMPLE_OMP_MASKED: \
6666 case GIMPLE_OMP_TASKGROUP: \
6667 case GIMPLE_OMP_ORDERED: \
6668 case GIMPLE_OMP_CRITICAL: \
6669 case GIMPLE_OMP_SCAN: \
6670 case GIMPLE_OMP_RETURN: \
6671 case GIMPLE_OMP_ATOMIC_LOAD: \
6672 case GIMPLE_OMP_ATOMIC_STORE: \
6673 case GIMPLE_OMP_CONTINUE
6675 static inline bool
6676 is_gimple_omp (const gimple *stmt)
6678 switch (gimple_code (stmt))
6680 CASE_GIMPLE_OMP:
6681 return true;
6682 default:
6683 return false;
6687 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6688 specifically. */
6690 static inline bool
6691 is_gimple_omp_oacc (const gimple *stmt)
6693 gcc_assert (is_gimple_omp (stmt));
6694 switch (gimple_code (stmt))
6696 case GIMPLE_OMP_ATOMIC_LOAD:
6697 case GIMPLE_OMP_ATOMIC_STORE:
6698 case GIMPLE_OMP_CONTINUE:
6699 case GIMPLE_OMP_RETURN:
6700 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6701 the two. */
6702 gcc_unreachable ();
6704 case GIMPLE_OMP_FOR:
6705 switch (gimple_omp_for_kind (stmt))
6707 case GF_OMP_FOR_KIND_OACC_LOOP:
6708 return true;
6709 default:
6710 return false;
6712 case GIMPLE_OMP_TARGET:
6713 switch (gimple_omp_target_kind (stmt))
6715 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6716 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6717 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6718 case GF_OMP_TARGET_KIND_OACC_DATA:
6719 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6720 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
6721 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
6722 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6723 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6724 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6725 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6726 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS:
6727 return true;
6728 default:
6729 return false;
6731 default:
6732 return false;
6737 /* Return true if the OMP gimple statement STMT is offloaded. */
6739 static inline bool
6740 is_gimple_omp_offloaded (const gimple *stmt)
6742 gcc_assert (is_gimple_omp (stmt));
6743 switch (gimple_code (stmt))
6745 case GIMPLE_OMP_TARGET:
6746 switch (gimple_omp_target_kind (stmt))
6748 case GF_OMP_TARGET_KIND_REGION:
6749 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6750 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6751 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6752 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6753 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6754 return true;
6755 default:
6756 return false;
6758 default:
6759 return false;
6764 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6766 static inline bool
6767 gimple_nop_p (const gimple *g)
6769 return gimple_code (g) == GIMPLE_NOP;
6773 /* Return true if GS is a GIMPLE_RESX. */
6775 static inline bool
6776 is_gimple_resx (const gimple *gs)
6778 return gimple_code (gs) == GIMPLE_RESX;
6782 /* Enum and arrays used for allocation stats. Keep in sync with
6783 gimple.cc:gimple_alloc_kind_names. */
6784 enum gimple_alloc_kind
6786 gimple_alloc_kind_assign, /* Assignments. */
6787 gimple_alloc_kind_phi, /* PHI nodes. */
6788 gimple_alloc_kind_cond, /* Conditionals. */
6789 gimple_alloc_kind_rest, /* Everything else. */
6790 gimple_alloc_kind_all
6793 extern uint64_t gimple_alloc_counts[];
6794 extern uint64_t gimple_alloc_sizes[];
6796 /* Return the allocation kind for a given stmt CODE. */
6797 static inline enum gimple_alloc_kind
6798 gimple_alloc_kind (enum gimple_code code)
6800 switch (code)
6802 case GIMPLE_ASSIGN:
6803 return gimple_alloc_kind_assign;
6804 case GIMPLE_PHI:
6805 return gimple_alloc_kind_phi;
6806 case GIMPLE_COND:
6807 return gimple_alloc_kind_cond;
6808 default:
6809 return gimple_alloc_kind_rest;
6813 /* Return true if a location should not be emitted for this statement
6814 by annotate_all_with_location. */
6816 static inline bool
6817 gimple_do_not_emit_location_p (gimple *g)
6819 return gimple_plf (g, GF_PLF_1);
6822 /* Mark statement G so a location will not be emitted by
6823 annotate_one_with_location. */
6825 static inline void
6826 gimple_set_do_not_emit_location (gimple *g)
6828 /* The PLF flags are initialized to 0 when a new tuple is created,
6829 so no need to initialize it anywhere. */
6830 gimple_set_plf (g, GF_PLF_1, true);
6833 #endif /* GCC_GIMPLE_H */