2018-11-17 Sandra Loosemore <sandra@codesourcery.com>
[official-gcc.git] / gcc / gimple.h
blob9853521f984d035137ba481cba4e0201ca7c0a69
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2018 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN \
50 ATTRIBUTE_COLD;
52 #define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59 template <typename T>
60 static inline T
61 GIMPLE_CHECK2(const gimple *gs,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66 #else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70 #endif
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
75 remove_pointer<T>::type::code_, ERROR_MARK);
76 return ret;
78 template <typename T>
79 static inline T
80 GIMPLE_CHECK2(gimple *gs,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85 #else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89 #endif
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
94 remove_pointer<T>::type::code_, ERROR_MARK);
95 return ret;
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T>
101 static inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 static inline T
108 GIMPLE_CHECK2(const gimple *gs)
110 return as_a <T> (gs);
112 #endif
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1,
140 GF_CALL_FROM_THUNK = 1 << 0,
141 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
142 GF_CALL_TAILCALL = 1 << 2,
143 GF_CALL_VA_ARG_PACK = 1 << 3,
144 GF_CALL_NOTHROW = 1 << 4,
145 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
146 GF_CALL_INTERNAL = 1 << 6,
147 GF_CALL_CTRL_ALTERING = 1 << 7,
148 GF_CALL_MUST_TAIL_CALL = 1 << 9,
149 GF_CALL_BY_DESCRIPTOR = 1 << 10,
150 GF_CALL_NOCF_CHECK = 1 << 11,
151 GF_OMP_PARALLEL_COMBINED = 1 << 0,
152 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
153 GF_OMP_TASK_TASKLOOP = 1 << 0,
154 GF_OMP_TASK_TASKWAIT = 1 << 1,
155 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
156 GF_OMP_FOR_KIND_FOR = 0,
157 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
158 GF_OMP_FOR_KIND_TASKLOOP = 2,
159 GF_OMP_FOR_KIND_OACC_LOOP = 4,
160 GF_OMP_FOR_KIND_GRID_LOOP = 5,
161 /* Flag for SIMD variants of OMP_FOR kinds. */
162 GF_OMP_FOR_SIMD = 1 << 3,
163 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
164 GF_OMP_FOR_COMBINED = 1 << 4,
165 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
166 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
167 statements. */
168 GF_OMP_FOR_GRID_PHONY = 1 << 6,
169 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
170 loop statements. */
171 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6,
172 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7,
173 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
174 GF_OMP_TARGET_KIND_REGION = 0,
175 GF_OMP_TARGET_KIND_DATA = 1,
176 GF_OMP_TARGET_KIND_UPDATE = 2,
177 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
178 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
179 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
180 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
181 GF_OMP_TARGET_KIND_OACC_DATA = 7,
182 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
183 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
184 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
185 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
186 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
187 GF_OMP_TEAMS_HOST = 1 << 1,
189 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
190 a thread synchronization via some sort of barrier. The exact barrier
191 that would otherwise be emitted is dependent on the OMP statement with
192 which this return is associated. */
193 GF_OMP_RETURN_NOWAIT = 1 << 0,
195 GF_OMP_SECTION_LAST = 1 << 0,
196 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 3) - 1,
197 GF_OMP_ATOMIC_NEED_VALUE = 1 << 3,
198 GF_PREDICT_TAKEN = 1 << 15
201 /* This subcode tells apart different kinds of stmts that are not used
202 for codegen, but rather to retain debug information. */
203 enum gimple_debug_subcode {
204 GIMPLE_DEBUG_BIND = 0,
205 GIMPLE_DEBUG_SOURCE_BIND = 1,
206 GIMPLE_DEBUG_BEGIN_STMT = 2,
207 GIMPLE_DEBUG_INLINE_ENTRY = 3
210 /* Masks for selecting a pass local flag (PLF) to work on. These
211 masks are used by gimple_set_plf and gimple_plf. */
212 enum plf_mask {
213 GF_PLF_1 = 1 << 0,
214 GF_PLF_2 = 1 << 1
217 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
218 are for 64 bit hosts. */
220 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
221 chain_next ("%h.next"), variable_size))
222 gimple
224 /* [ WORD 1 ]
225 Main identifying code for a tuple. */
226 ENUM_BITFIELD(gimple_code) code : 8;
228 /* Nonzero if a warning should not be emitted on this tuple. */
229 unsigned int no_warning : 1;
231 /* Nonzero if this tuple has been visited. Passes are responsible
232 for clearing this bit before using it. */
233 unsigned int visited : 1;
235 /* Nonzero if this tuple represents a non-temporal move. */
236 unsigned int nontemporal_move : 1;
238 /* Pass local flags. These flags are free for any pass to use as
239 they see fit. Passes should not assume that these flags contain
240 any useful value when the pass starts. Any initial state that
241 the pass requires should be set on entry to the pass. See
242 gimple_set_plf and gimple_plf for usage. */
243 unsigned int plf : 2;
245 /* Nonzero if this statement has been modified and needs to have its
246 operands rescanned. */
247 unsigned modified : 1;
249 /* Nonzero if this statement contains volatile operands. */
250 unsigned has_volatile_ops : 1;
252 /* Padding to get subcode to 16 bit alignment. */
253 unsigned pad : 1;
255 /* The SUBCODE field can be used for tuple-specific flags for tuples
256 that do not require subcodes. Note that SUBCODE should be at
257 least as wide as tree codes, as several tuples store tree codes
258 in there. */
259 unsigned int subcode : 16;
261 /* UID of this statement. This is used by passes that want to
262 assign IDs to statements. It must be assigned and used by each
263 pass. By default it should be assumed to contain garbage. */
264 unsigned uid;
266 /* [ WORD 2 ]
267 Locus information for debug info. */
268 location_t location;
270 /* Number of operands in this tuple. */
271 unsigned num_ops;
273 /* [ WORD 3 ]
274 Basic block holding this statement. */
275 basic_block bb;
277 /* [ WORD 4-5 ]
278 Linked lists of gimple statements. The next pointers form
279 a NULL terminated list, the prev pointers are a cyclic list.
280 A gimple statement is hence also a double-ended list of
281 statements, with the pointer itself being the first element,
282 and the prev pointer being the last. */
283 gimple *next;
284 gimple *GTY((skip)) prev;
288 /* Base structure for tuples with operands. */
290 /* This gimple subclass has no tag value. */
291 struct GTY(())
292 gimple_statement_with_ops_base : public gimple
294 /* [ WORD 1-6 ] : base class */
296 /* [ WORD 7 ]
297 SSA operand vectors. NOTE: It should be possible to
298 amalgamate these vectors with the operand vector OP. However,
299 the SSA operand vectors are organized differently and contain
300 more information (like immediate use chaining). */
301 struct use_optype_d GTY((skip (""))) *use_ops;
305 /* Statements that take register operands. */
307 struct GTY((tag("GSS_WITH_OPS")))
308 gimple_statement_with_ops : public gimple_statement_with_ops_base
310 /* [ WORD 1-7 ] : base class */
312 /* [ WORD 8 ]
313 Operand vector. NOTE! This must always be the last field
314 of this structure. In particular, this means that this
315 structure cannot be embedded inside another one. */
316 tree GTY((length ("%h.num_ops"))) op[1];
320 /* Base for statements that take both memory and register operands. */
322 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
323 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
325 /* [ WORD 1-7 ] : base class */
327 /* [ WORD 8-9 ]
328 Virtual operands for this statement. The GC will pick them
329 up via the ssa_names array. */
330 tree GTY((skip (""))) vdef;
331 tree GTY((skip (""))) vuse;
335 /* Statements that take both memory and register operands. */
337 struct GTY((tag("GSS_WITH_MEM_OPS")))
338 gimple_statement_with_memory_ops :
339 public gimple_statement_with_memory_ops_base
341 /* [ WORD 1-9 ] : base class */
343 /* [ WORD 10 ]
344 Operand vector. NOTE! This must always be the last field
345 of this structure. In particular, this means that this
346 structure cannot be embedded inside another one. */
347 tree GTY((length ("%h.num_ops"))) op[1];
351 /* Call statements that take both memory and register operands. */
353 struct GTY((tag("GSS_CALL")))
354 gcall : public gimple_statement_with_memory_ops_base
356 /* [ WORD 1-9 ] : base class */
358 /* [ WORD 10-13 ] */
359 struct pt_solution call_used;
360 struct pt_solution call_clobbered;
362 /* [ WORD 14 ] */
363 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
364 tree GTY ((tag ("0"))) fntype;
365 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
366 } u;
368 /* [ WORD 15 ]
369 Operand vector. NOTE! This must always be the last field
370 of this structure. In particular, this means that this
371 structure cannot be embedded inside another one. */
372 tree GTY((length ("%h.num_ops"))) op[1];
374 static const enum gimple_code code_ = GIMPLE_CALL;
378 /* OMP statements. */
380 struct GTY((tag("GSS_OMP")))
381 gimple_statement_omp : public gimple
383 /* [ WORD 1-6 ] : base class */
385 /* [ WORD 7 ] */
386 gimple_seq body;
390 /* GIMPLE_BIND */
392 struct GTY((tag("GSS_BIND")))
393 gbind : public gimple
395 /* [ WORD 1-6 ] : base class */
397 /* [ WORD 7 ]
398 Variables declared in this scope. */
399 tree vars;
401 /* [ WORD 8 ]
402 This is different than the BLOCK field in gimple,
403 which is analogous to TREE_BLOCK (i.e., the lexical block holding
404 this statement). This field is the equivalent of BIND_EXPR_BLOCK
405 in tree land (i.e., the lexical scope defined by this bind). See
406 gimple-low.c. */
407 tree block;
409 /* [ WORD 9 ] */
410 gimple_seq body;
414 /* GIMPLE_CATCH */
416 struct GTY((tag("GSS_CATCH")))
417 gcatch : public gimple
419 /* [ WORD 1-6 ] : base class */
421 /* [ WORD 7 ] */
422 tree types;
424 /* [ WORD 8 ] */
425 gimple_seq handler;
429 /* GIMPLE_EH_FILTER */
431 struct GTY((tag("GSS_EH_FILTER")))
432 geh_filter : public gimple
434 /* [ WORD 1-6 ] : base class */
436 /* [ WORD 7 ]
437 Filter types. */
438 tree types;
440 /* [ WORD 8 ]
441 Failure actions. */
442 gimple_seq failure;
445 /* GIMPLE_EH_ELSE */
447 struct GTY((tag("GSS_EH_ELSE")))
448 geh_else : public gimple
450 /* [ WORD 1-6 ] : base class */
452 /* [ WORD 7,8 ] */
453 gimple_seq n_body, e_body;
456 /* GIMPLE_EH_MUST_NOT_THROW */
458 struct GTY((tag("GSS_EH_MNT")))
459 geh_mnt : public gimple
461 /* [ WORD 1-6 ] : base class */
463 /* [ WORD 7 ] Abort function decl. */
464 tree fndecl;
467 /* GIMPLE_PHI */
469 struct GTY((tag("GSS_PHI")))
470 gphi : public gimple
472 /* [ WORD 1-6 ] : base class */
474 /* [ WORD 7 ] */
475 unsigned capacity;
476 unsigned nargs;
478 /* [ WORD 8 ] */
479 tree result;
481 /* [ WORD 9 ] */
482 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
486 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
488 struct GTY((tag("GSS_EH_CTRL")))
489 gimple_statement_eh_ctrl : public gimple
491 /* [ WORD 1-6 ] : base class */
493 /* [ WORD 7 ]
494 Exception region number. */
495 int region;
498 struct GTY((tag("GSS_EH_CTRL")))
499 gresx : public gimple_statement_eh_ctrl
501 /* No extra fields; adds invariant:
502 stmt->code == GIMPLE_RESX. */
505 struct GTY((tag("GSS_EH_CTRL")))
506 geh_dispatch : public gimple_statement_eh_ctrl
508 /* No extra fields; adds invariant:
509 stmt->code == GIMPLE_EH_DISPATH. */
513 /* GIMPLE_TRY */
515 struct GTY((tag("GSS_TRY")))
516 gtry : public gimple
518 /* [ WORD 1-6 ] : base class */
520 /* [ WORD 7 ]
521 Expression to evaluate. */
522 gimple_seq eval;
524 /* [ WORD 8 ]
525 Cleanup expression. */
526 gimple_seq cleanup;
529 /* Kind of GIMPLE_TRY statements. */
530 enum gimple_try_flags
532 /* A try/catch. */
533 GIMPLE_TRY_CATCH = 1 << 0,
535 /* A try/finally. */
536 GIMPLE_TRY_FINALLY = 1 << 1,
537 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
539 /* Analogous to TRY_CATCH_IS_CLEANUP. */
540 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
543 /* GIMPLE_WITH_CLEANUP_EXPR */
545 struct GTY((tag("GSS_WCE")))
546 gimple_statement_wce : public gimple
548 /* [ WORD 1-6 ] : base class */
550 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
551 executed if an exception is thrown, not on normal exit of its
552 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
553 in TARGET_EXPRs. */
555 /* [ WORD 7 ]
556 Cleanup expression. */
557 gimple_seq cleanup;
561 /* GIMPLE_ASM */
563 struct GTY((tag("GSS_ASM")))
564 gasm : public gimple_statement_with_memory_ops_base
566 /* [ WORD 1-9 ] : base class */
568 /* [ WORD 10 ]
569 __asm__ statement. */
570 const char *string;
572 /* [ WORD 11 ]
573 Number of inputs, outputs, clobbers, labels. */
574 unsigned char ni;
575 unsigned char no;
576 unsigned char nc;
577 unsigned char nl;
579 /* [ WORD 12 ]
580 Operand vector. NOTE! This must always be the last field
581 of this structure. In particular, this means that this
582 structure cannot be embedded inside another one. */
583 tree GTY((length ("%h.num_ops"))) op[1];
586 /* GIMPLE_OMP_CRITICAL */
588 struct GTY((tag("GSS_OMP_CRITICAL")))
589 gomp_critical : public gimple_statement_omp
591 /* [ WORD 1-7 ] : base class */
593 /* [ WORD 8 ] */
594 tree clauses;
596 /* [ WORD 9 ]
597 Critical section name. */
598 tree name;
602 struct GTY(()) gimple_omp_for_iter {
603 /* Condition code. */
604 enum tree_code cond;
606 /* Index variable. */
607 tree index;
609 /* Initial value. */
610 tree initial;
612 /* Final value. */
613 tree final;
615 /* Increment. */
616 tree incr;
619 /* GIMPLE_OMP_FOR */
621 struct GTY((tag("GSS_OMP_FOR")))
622 gomp_for : public gimple_statement_omp
624 /* [ WORD 1-7 ] : base class */
626 /* [ WORD 8 ] */
627 tree clauses;
629 /* [ WORD 9 ]
630 Number of elements in iter array. */
631 size_t collapse;
633 /* [ WORD 10 ] */
634 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
636 /* [ WORD 11 ]
637 Pre-body evaluated before the loop body begins. */
638 gimple_seq pre_body;
642 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
644 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
645 gimple_statement_omp_parallel_layout : public gimple_statement_omp
647 /* [ WORD 1-7 ] : base class */
649 /* [ WORD 8 ]
650 Clauses. */
651 tree clauses;
653 /* [ WORD 9 ]
654 Child function holding the body of the parallel region. */
655 tree child_fn;
657 /* [ WORD 10 ]
658 Shared data argument. */
659 tree data_arg;
662 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
663 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
664 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
666 /* No extra fields; adds invariant:
667 stmt->code == GIMPLE_OMP_PARALLEL
668 || stmt->code == GIMPLE_OMP_TASK
669 || stmt->code == GIMPLE_OMP_TEAMS. */
672 /* GIMPLE_OMP_PARALLEL */
673 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
674 gomp_parallel : public gimple_statement_omp_taskreg
676 /* No extra fields; adds invariant:
677 stmt->code == GIMPLE_OMP_PARALLEL. */
680 /* GIMPLE_OMP_TARGET */
681 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
682 gomp_target : public gimple_statement_omp_parallel_layout
684 /* No extra fields; adds invariant:
685 stmt->code == GIMPLE_OMP_TARGET. */
688 /* GIMPLE_OMP_TASK */
690 struct GTY((tag("GSS_OMP_TASK")))
691 gomp_task : public gimple_statement_omp_taskreg
693 /* [ WORD 1-10 ] : base class */
695 /* [ WORD 11 ]
696 Child function holding firstprivate initialization if needed. */
697 tree copy_fn;
699 /* [ WORD 12-13 ]
700 Size and alignment in bytes of the argument data block. */
701 tree arg_size;
702 tree arg_align;
706 /* GIMPLE_OMP_SECTION */
707 /* Uses struct gimple_statement_omp. */
710 /* GIMPLE_OMP_SECTIONS */
712 struct GTY((tag("GSS_OMP_SECTIONS")))
713 gomp_sections : public gimple_statement_omp
715 /* [ WORD 1-7 ] : base class */
717 /* [ WORD 8 ] */
718 tree clauses;
720 /* [ WORD 9 ]
721 The control variable used for deciding which of the sections to
722 execute. */
723 tree control;
726 /* GIMPLE_OMP_CONTINUE.
728 Note: This does not inherit from gimple_statement_omp, because we
729 do not need the body field. */
731 struct GTY((tag("GSS_OMP_CONTINUE")))
732 gomp_continue : public gimple
734 /* [ WORD 1-6 ] : base class */
736 /* [ WORD 7 ] */
737 tree control_def;
739 /* [ WORD 8 ] */
740 tree control_use;
743 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP. */
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gimple_statement_omp_single_layout : public gimple_statement_omp
748 /* [ WORD 1-7 ] : base class */
750 /* [ WORD 8 ] */
751 tree clauses;
754 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
755 gomp_single : public gimple_statement_omp_single_layout
757 /* No extra fields; adds invariant:
758 stmt->code == GIMPLE_OMP_SINGLE. */
761 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
762 gomp_teams : public gimple_statement_omp_taskreg
764 /* No extra fields; adds invariant:
765 stmt->code == GIMPLE_OMP_TEAMS. */
768 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
769 gomp_ordered : public gimple_statement_omp_single_layout
771 /* No extra fields; adds invariant:
772 stmt->code == GIMPLE_OMP_ORDERED. */
776 /* GIMPLE_OMP_ATOMIC_LOAD.
777 Note: This is based on gimple, not g_s_omp, because g_s_omp
778 contains a sequence, which we don't need here. */
780 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
781 gomp_atomic_load : public gimple
783 /* [ WORD 1-6 ] : base class */
785 /* [ WORD 7-8 ] */
786 tree rhs, lhs;
789 /* GIMPLE_OMP_ATOMIC_STORE.
790 See note on GIMPLE_OMP_ATOMIC_LOAD. */
792 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
793 gimple_statement_omp_atomic_store_layout : public gimple
795 /* [ WORD 1-6 ] : base class */
797 /* [ WORD 7 ] */
798 tree val;
801 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
802 gomp_atomic_store :
803 public gimple_statement_omp_atomic_store_layout
805 /* No extra fields; adds invariant:
806 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
809 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
810 gimple_statement_omp_return :
811 public gimple_statement_omp_atomic_store_layout
813 /* No extra fields; adds invariant:
814 stmt->code == GIMPLE_OMP_RETURN. */
817 /* GIMPLE_TRANSACTION. */
819 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
821 /* The __transaction_atomic was declared [[outer]] or it is
822 __transaction_relaxed. */
823 #define GTMA_IS_OUTER (1u << 0)
824 #define GTMA_IS_RELAXED (1u << 1)
825 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
827 /* The transaction is seen to not have an abort. */
828 #define GTMA_HAVE_ABORT (1u << 2)
829 /* The transaction is seen to have loads or stores. */
830 #define GTMA_HAVE_LOAD (1u << 3)
831 #define GTMA_HAVE_STORE (1u << 4)
832 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
833 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
834 /* The transaction WILL enter serial irrevocable mode.
835 An irrevocable block post-dominates the entire transaction, such
836 that all invocations of the transaction will go serial-irrevocable.
837 In such case, we don't bother instrumenting the transaction, and
838 tell the runtime that it should begin the transaction in
839 serial-irrevocable mode. */
840 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
841 /* The transaction contains no instrumentation code whatsover, most
842 likely because it is guaranteed to go irrevocable upon entry. */
843 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
845 struct GTY((tag("GSS_TRANSACTION")))
846 gtransaction : public gimple_statement_with_memory_ops_base
848 /* [ WORD 1-9 ] : base class */
850 /* [ WORD 10 ] */
851 gimple_seq body;
853 /* [ WORD 11-13 ] */
854 tree label_norm;
855 tree label_uninst;
856 tree label_over;
859 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
860 enum gimple_statement_structure_enum {
861 #include "gsstruct.def"
862 LAST_GSS_ENUM
864 #undef DEFGSSTRUCT
866 /* A statement with the invariant that
867 stmt->code == GIMPLE_COND
868 i.e. a conditional jump statement. */
870 struct GTY((tag("GSS_WITH_OPS")))
871 gcond : public gimple_statement_with_ops
873 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
874 static const enum gimple_code code_ = GIMPLE_COND;
877 /* A statement with the invariant that
878 stmt->code == GIMPLE_DEBUG
879 i.e. a debug statement. */
881 struct GTY((tag("GSS_WITH_OPS")))
882 gdebug : public gimple_statement_with_ops
884 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
887 /* A statement with the invariant that
888 stmt->code == GIMPLE_GOTO
889 i.e. a goto statement. */
891 struct GTY((tag("GSS_WITH_OPS")))
892 ggoto : public gimple_statement_with_ops
894 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
897 /* A statement with the invariant that
898 stmt->code == GIMPLE_LABEL
899 i.e. a label statement. */
901 struct GTY((tag("GSS_WITH_OPS")))
902 glabel : public gimple_statement_with_ops
904 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
907 /* A statement with the invariant that
908 stmt->code == GIMPLE_SWITCH
909 i.e. a switch statement. */
911 struct GTY((tag("GSS_WITH_OPS")))
912 gswitch : public gimple_statement_with_ops
914 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
917 /* A statement with the invariant that
918 stmt->code == GIMPLE_ASSIGN
919 i.e. an assignment statement. */
921 struct GTY((tag("GSS_WITH_MEM_OPS")))
922 gassign : public gimple_statement_with_memory_ops
924 static const enum gimple_code code_ = GIMPLE_ASSIGN;
925 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
928 /* A statement with the invariant that
929 stmt->code == GIMPLE_RETURN
930 i.e. a return statement. */
932 struct GTY((tag("GSS_WITH_MEM_OPS")))
933 greturn : public gimple_statement_with_memory_ops
935 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gasm *>::test (gimple *gs)
943 return gs->code == GIMPLE_ASM;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gassign *>::test (gimple *gs)
951 return gs->code == GIMPLE_ASSIGN;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <const gassign *>::test (const gimple *gs)
959 return gs->code == GIMPLE_ASSIGN;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <gbind *>::test (gimple *gs)
967 return gs->code == GIMPLE_BIND;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gcall *>::test (gimple *gs)
975 return gs->code == GIMPLE_CALL;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <gcatch *>::test (gimple *gs)
983 return gs->code == GIMPLE_CATCH;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <gcond *>::test (gimple *gs)
991 return gs->code == GIMPLE_COND;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <const gcond *>::test (const gimple *gs)
999 return gs->code == GIMPLE_COND;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <gdebug *>::test (gimple *gs)
1007 return gs->code == GIMPLE_DEBUG;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <ggoto *>::test (gimple *gs)
1015 return gs->code == GIMPLE_GOTO;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <glabel *>::test (gimple *gs)
1023 return gs->code == GIMPLE_LABEL;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <gresx *>::test (gimple *gs)
1031 return gs->code == GIMPLE_RESX;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <geh_dispatch *>::test (gimple *gs)
1039 return gs->code == GIMPLE_EH_DISPATCH;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <geh_else *>::test (gimple *gs)
1047 return gs->code == GIMPLE_EH_ELSE;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <geh_filter *>::test (gimple *gs)
1055 return gs->code == GIMPLE_EH_FILTER;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <geh_mnt *>::test (gimple *gs)
1063 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1071 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1079 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1087 return gs->code == GIMPLE_OMP_RETURN;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <gomp_continue *>::test (gimple *gs)
1095 return gs->code == GIMPLE_OMP_CONTINUE;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <gomp_critical *>::test (gimple *gs)
1103 return gs->code == GIMPLE_OMP_CRITICAL;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <gomp_ordered *>::test (gimple *gs)
1111 return gs->code == GIMPLE_OMP_ORDERED;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <gomp_for *>::test (gimple *gs)
1119 return gs->code == GIMPLE_OMP_FOR;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1127 return (gs->code == GIMPLE_OMP_PARALLEL
1128 || gs->code == GIMPLE_OMP_TASK
1129 || gs->code == GIMPLE_OMP_TEAMS);
1132 template <>
1133 template <>
1134 inline bool
1135 is_a_helper <gomp_parallel *>::test (gimple *gs)
1137 return gs->code == GIMPLE_OMP_PARALLEL;
1140 template <>
1141 template <>
1142 inline bool
1143 is_a_helper <gomp_target *>::test (gimple *gs)
1145 return gs->code == GIMPLE_OMP_TARGET;
1148 template <>
1149 template <>
1150 inline bool
1151 is_a_helper <gomp_sections *>::test (gimple *gs)
1153 return gs->code == GIMPLE_OMP_SECTIONS;
1156 template <>
1157 template <>
1158 inline bool
1159 is_a_helper <gomp_single *>::test (gimple *gs)
1161 return gs->code == GIMPLE_OMP_SINGLE;
1164 template <>
1165 template <>
1166 inline bool
1167 is_a_helper <gomp_teams *>::test (gimple *gs)
1169 return gs->code == GIMPLE_OMP_TEAMS;
1172 template <>
1173 template <>
1174 inline bool
1175 is_a_helper <gomp_task *>::test (gimple *gs)
1177 return gs->code == GIMPLE_OMP_TASK;
1180 template <>
1181 template <>
1182 inline bool
1183 is_a_helper <gphi *>::test (gimple *gs)
1185 return gs->code == GIMPLE_PHI;
1188 template <>
1189 template <>
1190 inline bool
1191 is_a_helper <greturn *>::test (gimple *gs)
1193 return gs->code == GIMPLE_RETURN;
1196 template <>
1197 template <>
1198 inline bool
1199 is_a_helper <gswitch *>::test (gimple *gs)
1201 return gs->code == GIMPLE_SWITCH;
1204 template <>
1205 template <>
1206 inline bool
1207 is_a_helper <gtransaction *>::test (gimple *gs)
1209 return gs->code == GIMPLE_TRANSACTION;
1212 template <>
1213 template <>
1214 inline bool
1215 is_a_helper <gtry *>::test (gimple *gs)
1217 return gs->code == GIMPLE_TRY;
1220 template <>
1221 template <>
1222 inline bool
1223 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1225 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1228 template <>
1229 template <>
1230 inline bool
1231 is_a_helper <const gasm *>::test (const gimple *gs)
1233 return gs->code == GIMPLE_ASM;
1236 template <>
1237 template <>
1238 inline bool
1239 is_a_helper <const gbind *>::test (const gimple *gs)
1241 return gs->code == GIMPLE_BIND;
1244 template <>
1245 template <>
1246 inline bool
1247 is_a_helper <const gcall *>::test (const gimple *gs)
1249 return gs->code == GIMPLE_CALL;
1252 template <>
1253 template <>
1254 inline bool
1255 is_a_helper <const gcatch *>::test (const gimple *gs)
1257 return gs->code == GIMPLE_CATCH;
1260 template <>
1261 template <>
1262 inline bool
1263 is_a_helper <const gresx *>::test (const gimple *gs)
1265 return gs->code == GIMPLE_RESX;
1268 template <>
1269 template <>
1270 inline bool
1271 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1273 return gs->code == GIMPLE_EH_DISPATCH;
1276 template <>
1277 template <>
1278 inline bool
1279 is_a_helper <const geh_filter *>::test (const gimple *gs)
1281 return gs->code == GIMPLE_EH_FILTER;
1284 template <>
1285 template <>
1286 inline bool
1287 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1289 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1292 template <>
1293 template <>
1294 inline bool
1295 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1297 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1300 template <>
1301 template <>
1302 inline bool
1303 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1305 return gs->code == GIMPLE_OMP_RETURN;
1308 template <>
1309 template <>
1310 inline bool
1311 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1313 return gs->code == GIMPLE_OMP_CONTINUE;
1316 template <>
1317 template <>
1318 inline bool
1319 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1321 return gs->code == GIMPLE_OMP_CRITICAL;
1324 template <>
1325 template <>
1326 inline bool
1327 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1329 return gs->code == GIMPLE_OMP_ORDERED;
1332 template <>
1333 template <>
1334 inline bool
1335 is_a_helper <const gomp_for *>::test (const gimple *gs)
1337 return gs->code == GIMPLE_OMP_FOR;
1340 template <>
1341 template <>
1342 inline bool
1343 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1345 return (gs->code == GIMPLE_OMP_PARALLEL
1346 || gs->code == GIMPLE_OMP_TASK
1347 || gs->code == GIMPLE_OMP_TEAMS);
1350 template <>
1351 template <>
1352 inline bool
1353 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1355 return gs->code == GIMPLE_OMP_PARALLEL;
1358 template <>
1359 template <>
1360 inline bool
1361 is_a_helper <const gomp_target *>::test (const gimple *gs)
1363 return gs->code == GIMPLE_OMP_TARGET;
1366 template <>
1367 template <>
1368 inline bool
1369 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1371 return gs->code == GIMPLE_OMP_SECTIONS;
1374 template <>
1375 template <>
1376 inline bool
1377 is_a_helper <const gomp_single *>::test (const gimple *gs)
1379 return gs->code == GIMPLE_OMP_SINGLE;
1382 template <>
1383 template <>
1384 inline bool
1385 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1387 return gs->code == GIMPLE_OMP_TEAMS;
1390 template <>
1391 template <>
1392 inline bool
1393 is_a_helper <const gomp_task *>::test (const gimple *gs)
1395 return gs->code == GIMPLE_OMP_TASK;
1398 template <>
1399 template <>
1400 inline bool
1401 is_a_helper <const gphi *>::test (const gimple *gs)
1403 return gs->code == GIMPLE_PHI;
1406 template <>
1407 template <>
1408 inline bool
1409 is_a_helper <const gtransaction *>::test (const gimple *gs)
1411 return gs->code == GIMPLE_TRANSACTION;
1414 /* Offset in bytes to the location of the operand vector.
1415 Zero if there is no operand vector for this tuple structure. */
1416 extern size_t const gimple_ops_offset_[];
1418 /* Map GIMPLE codes to GSS codes. */
1419 extern enum gimple_statement_structure_enum const gss_for_code_[];
1421 /* This variable holds the currently expanded gimple statement for purposes
1422 of comminucating the profile info to the builtin expanders. */
1423 extern gimple *currently_expanding_gimple_stmt;
1425 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1426 greturn *gimple_build_return (tree);
1427 void gimple_call_reset_alias_info (gcall *);
1428 gcall *gimple_build_call_vec (tree, vec<tree> );
1429 gcall *gimple_build_call (tree, unsigned, ...);
1430 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1431 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1432 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1433 gcall *gimple_build_call_from_tree (tree, tree);
1434 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1435 gassign *gimple_build_assign (tree, enum tree_code,
1436 tree, tree, tree CXX_MEM_STAT_INFO);
1437 gassign *gimple_build_assign (tree, enum tree_code,
1438 tree, tree CXX_MEM_STAT_INFO);
1439 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1440 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1441 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1442 void gimple_cond_set_condition_from_tree (gcond *, tree);
1443 glabel *gimple_build_label (tree label);
1444 ggoto *gimple_build_goto (tree dest);
1445 gimple *gimple_build_nop (void);
1446 gbind *gimple_build_bind (tree, gimple_seq, tree);
1447 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1448 vec<tree, va_gc> *, vec<tree, va_gc> *,
1449 vec<tree, va_gc> *);
1450 gcatch *gimple_build_catch (tree, gimple_seq);
1451 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1452 geh_mnt *gimple_build_eh_must_not_throw (tree);
1453 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1454 gtry *gimple_build_try (gimple_seq, gimple_seq,
1455 enum gimple_try_flags);
1456 gimple *gimple_build_wce (gimple_seq);
1457 gresx *gimple_build_resx (int);
1458 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1459 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1460 geh_dispatch *gimple_build_eh_dispatch (int);
1461 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1462 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1463 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1464 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1465 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1466 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1467 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1468 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1469 tree, tree);
1470 gimple *gimple_build_omp_section (gimple_seq);
1471 gimple *gimple_build_omp_master (gimple_seq);
1472 gimple *gimple_build_omp_grid_body (gimple_seq);
1473 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1474 gomp_continue *gimple_build_omp_continue (tree, tree);
1475 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1476 gimple *gimple_build_omp_return (bool);
1477 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1478 gimple *gimple_build_omp_sections_switch (void);
1479 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1480 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1481 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1482 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1483 enum omp_memory_order);
1484 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1485 gtransaction *gimple_build_transaction (gimple_seq);
1486 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1487 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1488 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1489 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1490 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1491 location_t);
1492 extern void annotate_all_with_location (gimple_seq, location_t);
1493 bool empty_body_p (gimple_seq);
1494 gimple_seq gimple_seq_copy (gimple_seq);
1495 bool gimple_call_same_target_p (const gimple *, const gimple *);
1496 int gimple_call_flags (const gimple *);
1497 int gimple_call_arg_flags (const gcall *, unsigned);
1498 int gimple_call_return_flags (const gcall *);
1499 bool gimple_call_nonnull_result_p (gcall *);
1500 tree gimple_call_nonnull_arg (gcall *);
1501 bool gimple_assign_copy_p (gimple *);
1502 bool gimple_assign_ssa_name_copy_p (gimple *);
1503 bool gimple_assign_unary_nop_p (gimple *);
1504 void gimple_set_bb (gimple *, basic_block);
1505 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1506 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1507 tree, tree, tree);
1508 tree gimple_get_lhs (const gimple *);
1509 void gimple_set_lhs (gimple *, tree);
1510 gimple *gimple_copy (gimple *);
1511 bool gimple_has_side_effects (const gimple *);
1512 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1513 bool gimple_could_trap_p (gimple *);
1514 bool gimple_assign_rhs_could_trap_p (gimple *);
1515 extern void dump_gimple_statistics (void);
1516 unsigned get_gimple_rhs_num_ops (enum tree_code);
1517 extern tree canonicalize_cond_expr_cond (tree);
1518 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1519 extern bool gimple_compare_field_offset (tree, tree);
1520 extern tree gimple_unsigned_type (tree);
1521 extern tree gimple_signed_type (tree);
1522 extern alias_set_type gimple_get_alias_set (tree);
1523 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1524 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1525 extern combined_fn gimple_call_combined_fn (const gimple *);
1526 extern bool gimple_call_builtin_p (const gimple *);
1527 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1528 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1529 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1530 extern void dump_decl_set (FILE *, bitmap);
1531 extern bool nonfreeing_call_p (gimple *);
1532 extern bool nonbarrier_call_p (gimple *);
1533 extern bool infer_nonnull_range (gimple *, tree);
1534 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1535 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1536 extern void sort_case_labels (vec<tree>);
1537 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1538 extern void gimple_seq_set_location (gimple_seq, location_t);
1539 extern void gimple_seq_discard (gimple_seq);
1540 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1541 extern bool gimple_inexpensive_call_p (gcall *);
1542 extern bool stmt_can_terminate_bb_p (gimple *);
1544 /* Formal (expression) temporary table handling: multiple occurrences of
1545 the same scalar expression are evaluated into the same temporary. */
1547 typedef struct gimple_temp_hash_elt
1549 tree val; /* Key */
1550 tree temp; /* Value */
1551 } elt_t;
1553 /* Get the number of the next statement uid to be allocated. */
1554 static inline unsigned int
1555 gimple_stmt_max_uid (struct function *fn)
1557 return fn->last_stmt_uid;
1560 /* Set the number of the next statement uid to be allocated. */
1561 static inline void
1562 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1564 fn->last_stmt_uid = maxid;
1567 /* Set the number of the next statement uid to be allocated. */
1568 static inline unsigned int
1569 inc_gimple_stmt_max_uid (struct function *fn)
1571 return fn->last_stmt_uid++;
1574 /* Return the first node in GIMPLE sequence S. */
1576 static inline gimple_seq_node
1577 gimple_seq_first (gimple_seq s)
1579 return s;
1583 /* Return the first statement in GIMPLE sequence S. */
1585 static inline gimple *
1586 gimple_seq_first_stmt (gimple_seq s)
1588 gimple_seq_node n = gimple_seq_first (s);
1589 return n;
1592 /* Return the first statement in GIMPLE sequence S as a gbind *,
1593 verifying that it has code GIMPLE_BIND in a checked build. */
1595 static inline gbind *
1596 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1598 gimple_seq_node n = gimple_seq_first (s);
1599 return as_a <gbind *> (n);
1603 /* Return the last node in GIMPLE sequence S. */
1605 static inline gimple_seq_node
1606 gimple_seq_last (gimple_seq s)
1608 return s ? s->prev : NULL;
1612 /* Return the last statement in GIMPLE sequence S. */
1614 static inline gimple *
1615 gimple_seq_last_stmt (gimple_seq s)
1617 gimple_seq_node n = gimple_seq_last (s);
1618 return n;
1622 /* Set the last node in GIMPLE sequence *PS to LAST. */
1624 static inline void
1625 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1627 (*ps)->prev = last;
1631 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1633 static inline void
1634 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1636 *ps = first;
1640 /* Return true if GIMPLE sequence S is empty. */
1642 static inline bool
1643 gimple_seq_empty_p (gimple_seq s)
1645 return s == NULL;
1648 /* Allocate a new sequence and initialize its first element with STMT. */
1650 static inline gimple_seq
1651 gimple_seq_alloc_with_stmt (gimple *stmt)
1653 gimple_seq seq = NULL;
1654 gimple_seq_add_stmt (&seq, stmt);
1655 return seq;
1659 /* Returns the sequence of statements in BB. */
1661 static inline gimple_seq
1662 bb_seq (const_basic_block bb)
1664 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1667 static inline gimple_seq *
1668 bb_seq_addr (basic_block bb)
1670 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1673 /* Sets the sequence of statements in BB to SEQ. */
1675 static inline void
1676 set_bb_seq (basic_block bb, gimple_seq seq)
1678 gcc_checking_assert (!(bb->flags & BB_RTL));
1679 bb->il.gimple.seq = seq;
1683 /* Return the code for GIMPLE statement G. */
1685 static inline enum gimple_code
1686 gimple_code (const gimple *g)
1688 return g->code;
1692 /* Return the GSS code used by a GIMPLE code. */
1694 static inline enum gimple_statement_structure_enum
1695 gss_for_code (enum gimple_code code)
1697 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1698 return gss_for_code_[code];
1702 /* Return which GSS code is used by GS. */
1704 static inline enum gimple_statement_structure_enum
1705 gimple_statement_structure (gimple *gs)
1707 return gss_for_code (gimple_code (gs));
1711 /* Return true if statement G has sub-statements. This is only true for
1712 High GIMPLE statements. */
1714 static inline bool
1715 gimple_has_substatements (gimple *g)
1717 switch (gimple_code (g))
1719 case GIMPLE_BIND:
1720 case GIMPLE_CATCH:
1721 case GIMPLE_EH_FILTER:
1722 case GIMPLE_EH_ELSE:
1723 case GIMPLE_TRY:
1724 case GIMPLE_OMP_FOR:
1725 case GIMPLE_OMP_MASTER:
1726 case GIMPLE_OMP_TASKGROUP:
1727 case GIMPLE_OMP_ORDERED:
1728 case GIMPLE_OMP_SECTION:
1729 case GIMPLE_OMP_PARALLEL:
1730 case GIMPLE_OMP_TASK:
1731 case GIMPLE_OMP_SECTIONS:
1732 case GIMPLE_OMP_SINGLE:
1733 case GIMPLE_OMP_TARGET:
1734 case GIMPLE_OMP_TEAMS:
1735 case GIMPLE_OMP_CRITICAL:
1736 case GIMPLE_WITH_CLEANUP_EXPR:
1737 case GIMPLE_TRANSACTION:
1738 case GIMPLE_OMP_GRID_BODY:
1739 return true;
1741 default:
1742 return false;
1747 /* Return the basic block holding statement G. */
1749 static inline basic_block
1750 gimple_bb (const gimple *g)
1752 return g->bb;
1756 /* Return the lexical scope block holding statement G. */
1758 static inline tree
1759 gimple_block (const gimple *g)
1761 return LOCATION_BLOCK (g->location);
1765 /* Set BLOCK to be the lexical scope block holding statement G. */
1767 static inline void
1768 gimple_set_block (gimple *g, tree block)
1770 g->location = set_block (g->location, block);
1774 /* Return location information for statement G. */
1776 static inline location_t
1777 gimple_location (const gimple *g)
1779 return g->location;
1782 /* Return location information for statement G if g is not NULL.
1783 Otherwise, UNKNOWN_LOCATION is returned. */
1785 static inline location_t
1786 gimple_location_safe (const gimple *g)
1788 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1791 /* Set location information for statement G. */
1793 static inline void
1794 gimple_set_location (gimple *g, location_t location)
1796 g->location = location;
1800 /* Return true if G contains location information. */
1802 static inline bool
1803 gimple_has_location (const gimple *g)
1805 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1809 /* Return non-artificial location information for statement G. */
1811 static inline location_t
1812 gimple_nonartificial_location (const gimple *g)
1814 location_t *ploc = NULL;
1816 if (tree block = gimple_block (g))
1817 ploc = block_nonartificial_location (block);
1819 return ploc ? *ploc : gimple_location (g);
1823 /* Return the file name of the location of STMT. */
1825 static inline const char *
1826 gimple_filename (const gimple *stmt)
1828 return LOCATION_FILE (gimple_location (stmt));
1832 /* Return the line number of the location of STMT. */
1834 static inline int
1835 gimple_lineno (const gimple *stmt)
1837 return LOCATION_LINE (gimple_location (stmt));
1841 /* Determine whether SEQ is a singleton. */
1843 static inline bool
1844 gimple_seq_singleton_p (gimple_seq seq)
1846 return ((gimple_seq_first (seq) != NULL)
1847 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1850 /* Return true if no warnings should be emitted for statement STMT. */
1852 static inline bool
1853 gimple_no_warning_p (const gimple *stmt)
1855 return stmt->no_warning;
1858 /* Set the no_warning flag of STMT to NO_WARNING. */
1860 static inline void
1861 gimple_set_no_warning (gimple *stmt, bool no_warning)
1863 stmt->no_warning = (unsigned) no_warning;
1866 /* Set the visited status on statement STMT to VISITED_P.
1868 Please note that this 'visited' property of the gimple statement is
1869 supposed to be undefined at pass boundaries. This means that a
1870 given pass should not assume it contains any useful value when the
1871 pass starts and thus can set it to any value it sees fit.
1873 You can learn more about the visited property of the gimple
1874 statement by reading the comments of the 'visited' data member of
1875 struct gimple.
1878 static inline void
1879 gimple_set_visited (gimple *stmt, bool visited_p)
1881 stmt->visited = (unsigned) visited_p;
1885 /* Return the visited status for statement STMT.
1887 Please note that this 'visited' property of the gimple statement is
1888 supposed to be undefined at pass boundaries. This means that a
1889 given pass should not assume it contains any useful value when the
1890 pass starts and thus can set it to any value it sees fit.
1892 You can learn more about the visited property of the gimple
1893 statement by reading the comments of the 'visited' data member of
1894 struct gimple. */
1896 static inline bool
1897 gimple_visited_p (gimple *stmt)
1899 return stmt->visited;
1903 /* Set pass local flag PLF on statement STMT to VAL_P.
1905 Please note that this PLF property of the gimple statement is
1906 supposed to be undefined at pass boundaries. This means that a
1907 given pass should not assume it contains any useful value when the
1908 pass starts and thus can set it to any value it sees fit.
1910 You can learn more about the PLF property by reading the comment of
1911 the 'plf' data member of struct gimple_statement_structure. */
1913 static inline void
1914 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1916 if (val_p)
1917 stmt->plf |= (unsigned int) plf;
1918 else
1919 stmt->plf &= ~((unsigned int) plf);
1923 /* Return the value of pass local flag PLF on statement STMT.
1925 Please note that this 'plf' property of the gimple statement is
1926 supposed to be undefined at pass boundaries. This means that a
1927 given pass should not assume it contains any useful value when the
1928 pass starts and thus can set it to any value it sees fit.
1930 You can learn more about the plf property by reading the comment of
1931 the 'plf' data member of struct gimple_statement_structure. */
1933 static inline unsigned int
1934 gimple_plf (gimple *stmt, enum plf_mask plf)
1936 return stmt->plf & ((unsigned int) plf);
1940 /* Set the UID of statement.
1942 Please note that this UID property is supposed to be undefined at
1943 pass boundaries. This means that a given pass should not assume it
1944 contains any useful value when the pass starts and thus can set it
1945 to any value it sees fit. */
1947 static inline void
1948 gimple_set_uid (gimple *g, unsigned uid)
1950 g->uid = uid;
1954 /* Return the UID of statement.
1956 Please note that this UID property is supposed to be undefined at
1957 pass boundaries. This means that a given pass should not assume it
1958 contains any useful value when the pass starts and thus can set it
1959 to any value it sees fit. */
1961 static inline unsigned
1962 gimple_uid (const gimple *g)
1964 return g->uid;
1968 /* Make statement G a singleton sequence. */
1970 static inline void
1971 gimple_init_singleton (gimple *g)
1973 g->next = NULL;
1974 g->prev = g;
1978 /* Return true if GIMPLE statement G has register or memory operands. */
1980 static inline bool
1981 gimple_has_ops (const gimple *g)
1983 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1986 template <>
1987 template <>
1988 inline bool
1989 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1991 return gimple_has_ops (gs);
1994 template <>
1995 template <>
1996 inline bool
1997 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1999 return gimple_has_ops (gs);
2002 /* Return true if GIMPLE statement G has memory operands. */
2004 static inline bool
2005 gimple_has_mem_ops (const gimple *g)
2007 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2010 template <>
2011 template <>
2012 inline bool
2013 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2015 return gimple_has_mem_ops (gs);
2018 template <>
2019 template <>
2020 inline bool
2021 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2023 return gimple_has_mem_ops (gs);
2026 /* Return the set of USE operands for statement G. */
2028 static inline struct use_optype_d *
2029 gimple_use_ops (const gimple *g)
2031 const gimple_statement_with_ops *ops_stmt =
2032 dyn_cast <const gimple_statement_with_ops *> (g);
2033 if (!ops_stmt)
2034 return NULL;
2035 return ops_stmt->use_ops;
2039 /* Set USE to be the set of USE operands for statement G. */
2041 static inline void
2042 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2044 gimple_statement_with_ops *ops_stmt =
2045 as_a <gimple_statement_with_ops *> (g);
2046 ops_stmt->use_ops = use;
2050 /* Return the single VUSE operand of the statement G. */
2052 static inline tree
2053 gimple_vuse (const gimple *g)
2055 const gimple_statement_with_memory_ops *mem_ops_stmt =
2056 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2057 if (!mem_ops_stmt)
2058 return NULL_TREE;
2059 return mem_ops_stmt->vuse;
2062 /* Return the single VDEF operand of the statement G. */
2064 static inline tree
2065 gimple_vdef (const gimple *g)
2067 const gimple_statement_with_memory_ops *mem_ops_stmt =
2068 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2069 if (!mem_ops_stmt)
2070 return NULL_TREE;
2071 return mem_ops_stmt->vdef;
2074 /* Return the single VUSE operand of the statement G. */
2076 static inline tree *
2077 gimple_vuse_ptr (gimple *g)
2079 gimple_statement_with_memory_ops *mem_ops_stmt =
2080 dyn_cast <gimple_statement_with_memory_ops *> (g);
2081 if (!mem_ops_stmt)
2082 return NULL;
2083 return &mem_ops_stmt->vuse;
2086 /* Return the single VDEF operand of the statement G. */
2088 static inline tree *
2089 gimple_vdef_ptr (gimple *g)
2091 gimple_statement_with_memory_ops *mem_ops_stmt =
2092 dyn_cast <gimple_statement_with_memory_ops *> (g);
2093 if (!mem_ops_stmt)
2094 return NULL;
2095 return &mem_ops_stmt->vdef;
2098 /* Set the single VUSE operand of the statement G. */
2100 static inline void
2101 gimple_set_vuse (gimple *g, tree vuse)
2103 gimple_statement_with_memory_ops *mem_ops_stmt =
2104 as_a <gimple_statement_with_memory_ops *> (g);
2105 mem_ops_stmt->vuse = vuse;
2108 /* Set the single VDEF operand of the statement G. */
2110 static inline void
2111 gimple_set_vdef (gimple *g, tree vdef)
2113 gimple_statement_with_memory_ops *mem_ops_stmt =
2114 as_a <gimple_statement_with_memory_ops *> (g);
2115 mem_ops_stmt->vdef = vdef;
2119 /* Return true if statement G has operands and the modified field has
2120 been set. */
2122 static inline bool
2123 gimple_modified_p (const gimple *g)
2125 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2129 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2130 a MODIFIED field. */
2132 static inline void
2133 gimple_set_modified (gimple *s, bool modifiedp)
2135 if (gimple_has_ops (s))
2136 s->modified = (unsigned) modifiedp;
2140 /* Return the tree code for the expression computed by STMT. This is
2141 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2142 GIMPLE_CALL, return CALL_EXPR as the expression code for
2143 consistency. This is useful when the caller needs to deal with the
2144 three kinds of computation that GIMPLE supports. */
2146 static inline enum tree_code
2147 gimple_expr_code (const gimple *stmt)
2149 enum gimple_code code = gimple_code (stmt);
2150 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2151 return (enum tree_code) stmt->subcode;
2152 else
2154 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2155 return CALL_EXPR;
2160 /* Return true if statement STMT contains volatile operands. */
2162 static inline bool
2163 gimple_has_volatile_ops (const gimple *stmt)
2165 if (gimple_has_mem_ops (stmt))
2166 return stmt->has_volatile_ops;
2167 else
2168 return false;
2172 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2174 static inline void
2175 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2177 if (gimple_has_mem_ops (stmt))
2178 stmt->has_volatile_ops = (unsigned) volatilep;
2181 /* Return true if STMT is in a transaction. */
2183 static inline bool
2184 gimple_in_transaction (const gimple *stmt)
2186 return bb_in_transaction (gimple_bb (stmt));
2189 /* Return true if statement STMT may access memory. */
2191 static inline bool
2192 gimple_references_memory_p (gimple *stmt)
2194 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2198 /* Return the subcode for OMP statement S. */
2200 static inline unsigned
2201 gimple_omp_subcode (const gimple *s)
2203 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2204 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2205 return s->subcode;
2208 /* Set the subcode for OMP statement S to SUBCODE. */
2210 static inline void
2211 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2213 /* We only have 16 bits for the subcode. Assert that we are not
2214 overflowing it. */
2215 gcc_gimple_checking_assert (subcode < (1 << 16));
2216 s->subcode = subcode;
2219 /* Set the nowait flag on OMP_RETURN statement S. */
2221 static inline void
2222 gimple_omp_return_set_nowait (gimple *s)
2224 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2225 s->subcode |= GF_OMP_RETURN_NOWAIT;
2229 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2230 flag set. */
2232 static inline bool
2233 gimple_omp_return_nowait_p (const gimple *g)
2235 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2236 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2240 /* Set the LHS of OMP return. */
2242 static inline void
2243 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2245 gimple_statement_omp_return *omp_return_stmt =
2246 as_a <gimple_statement_omp_return *> (g);
2247 omp_return_stmt->val = lhs;
2251 /* Get the LHS of OMP return. */
2253 static inline tree
2254 gimple_omp_return_lhs (const gimple *g)
2256 const gimple_statement_omp_return *omp_return_stmt =
2257 as_a <const gimple_statement_omp_return *> (g);
2258 return omp_return_stmt->val;
2262 /* Return a pointer to the LHS of OMP return. */
2264 static inline tree *
2265 gimple_omp_return_lhs_ptr (gimple *g)
2267 gimple_statement_omp_return *omp_return_stmt =
2268 as_a <gimple_statement_omp_return *> (g);
2269 return &omp_return_stmt->val;
2273 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2274 flag set. */
2276 static inline bool
2277 gimple_omp_section_last_p (const gimple *g)
2279 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2280 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2284 /* Set the GF_OMP_SECTION_LAST flag on G. */
2286 static inline void
2287 gimple_omp_section_set_last (gimple *g)
2289 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2290 g->subcode |= GF_OMP_SECTION_LAST;
2294 /* Return true if OMP parallel statement G has the
2295 GF_OMP_PARALLEL_COMBINED flag set. */
2297 static inline bool
2298 gimple_omp_parallel_combined_p (const gimple *g)
2300 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2301 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2305 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2306 value of COMBINED_P. */
2308 static inline void
2309 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2311 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2312 if (combined_p)
2313 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2314 else
2315 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2319 /* Return true if OMP atomic load/store statement G has the
2320 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2322 static inline bool
2323 gimple_omp_atomic_need_value_p (const gimple *g)
2325 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2326 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2327 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2331 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2333 static inline void
2334 gimple_omp_atomic_set_need_value (gimple *g)
2336 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2337 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2338 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2342 /* Return the memory order of the OMP atomic load/store statement G. */
2344 static inline enum omp_memory_order
2345 gimple_omp_atomic_memory_order (const gimple *g)
2347 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2348 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2349 return (enum omp_memory_order)
2350 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2354 /* Set the memory order on G. */
2356 static inline void
2357 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2359 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2360 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2361 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2362 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2366 /* Return the number of operands for statement GS. */
2368 static inline unsigned
2369 gimple_num_ops (const gimple *gs)
2371 return gs->num_ops;
2375 /* Set the number of operands for statement GS. */
2377 static inline void
2378 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2380 gs->num_ops = num_ops;
2384 /* Return the array of operands for statement GS. */
2386 static inline tree *
2387 gimple_ops (gimple *gs)
2389 size_t off;
2391 /* All the tuples have their operand vector at the very bottom
2392 of the structure. Note that those structures that do not
2393 have an operand vector have a zero offset. */
2394 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2395 gcc_gimple_checking_assert (off != 0);
2397 return (tree *) ((char *) gs + off);
2401 /* Return operand I for statement GS. */
2403 static inline tree
2404 gimple_op (const gimple *gs, unsigned i)
2406 if (gimple_has_ops (gs))
2408 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2409 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2411 else
2412 return NULL_TREE;
2415 /* Return a pointer to operand I for statement GS. */
2417 static inline tree *
2418 gimple_op_ptr (gimple *gs, unsigned i)
2420 if (gimple_has_ops (gs))
2422 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2423 return gimple_ops (gs) + i;
2425 else
2426 return NULL;
2429 /* Set operand I of statement GS to OP. */
2431 static inline void
2432 gimple_set_op (gimple *gs, unsigned i, tree op)
2434 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2436 /* Note. It may be tempting to assert that OP matches
2437 is_gimple_operand, but that would be wrong. Different tuples
2438 accept slightly different sets of tree operands. Each caller
2439 should perform its own validation. */
2440 gimple_ops (gs)[i] = op;
2443 /* Return true if GS is a GIMPLE_ASSIGN. */
2445 static inline bool
2446 is_gimple_assign (const gimple *gs)
2448 return gimple_code (gs) == GIMPLE_ASSIGN;
2451 /* Determine if expression CODE is one of the valid expressions that can
2452 be used on the RHS of GIMPLE assignments. */
2454 static inline enum gimple_rhs_class
2455 get_gimple_rhs_class (enum tree_code code)
2457 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2460 /* Return the LHS of assignment statement GS. */
2462 static inline tree
2463 gimple_assign_lhs (const gassign *gs)
2465 return gs->op[0];
2468 static inline tree
2469 gimple_assign_lhs (const gimple *gs)
2471 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2472 return gimple_assign_lhs (ass);
2476 /* Return a pointer to the LHS of assignment statement GS. */
2478 static inline tree *
2479 gimple_assign_lhs_ptr (gassign *gs)
2481 return &gs->op[0];
2484 static inline tree *
2485 gimple_assign_lhs_ptr (gimple *gs)
2487 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2488 return gimple_assign_lhs_ptr (ass);
2492 /* Set LHS to be the LHS operand of assignment statement GS. */
2494 static inline void
2495 gimple_assign_set_lhs (gassign *gs, tree lhs)
2497 gs->op[0] = lhs;
2499 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2500 SSA_NAME_DEF_STMT (lhs) = gs;
2503 static inline void
2504 gimple_assign_set_lhs (gimple *gs, tree lhs)
2506 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2507 gimple_assign_set_lhs (ass, lhs);
2511 /* Return the first operand on the RHS of assignment statement GS. */
2513 static inline tree
2514 gimple_assign_rhs1 (const gassign *gs)
2516 return gs->op[1];
2519 static inline tree
2520 gimple_assign_rhs1 (const gimple *gs)
2522 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2523 return gimple_assign_rhs1 (ass);
2527 /* Return a pointer to the first operand on the RHS of assignment
2528 statement GS. */
2530 static inline tree *
2531 gimple_assign_rhs1_ptr (gassign *gs)
2533 return &gs->op[1];
2536 static inline tree *
2537 gimple_assign_rhs1_ptr (gimple *gs)
2539 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2540 return gimple_assign_rhs1_ptr (ass);
2543 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2545 static inline void
2546 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2548 gs->op[1] = rhs;
2551 static inline void
2552 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2554 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2555 gimple_assign_set_rhs1 (ass, rhs);
2559 /* Return the second operand on the RHS of assignment statement GS.
2560 If GS does not have two operands, NULL is returned instead. */
2562 static inline tree
2563 gimple_assign_rhs2 (const gassign *gs)
2565 if (gimple_num_ops (gs) >= 3)
2566 return gs->op[2];
2567 else
2568 return NULL_TREE;
2571 static inline tree
2572 gimple_assign_rhs2 (const gimple *gs)
2574 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2575 return gimple_assign_rhs2 (ass);
2579 /* Return a pointer to the second operand on the RHS of assignment
2580 statement GS. */
2582 static inline tree *
2583 gimple_assign_rhs2_ptr (gassign *gs)
2585 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2586 return &gs->op[2];
2589 static inline tree *
2590 gimple_assign_rhs2_ptr (gimple *gs)
2592 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2593 return gimple_assign_rhs2_ptr (ass);
2597 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2599 static inline void
2600 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2602 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2603 gs->op[2] = rhs;
2606 static inline void
2607 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2609 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2610 return gimple_assign_set_rhs2 (ass, rhs);
2613 /* Return the third operand on the RHS of assignment statement GS.
2614 If GS does not have two operands, NULL is returned instead. */
2616 static inline tree
2617 gimple_assign_rhs3 (const gassign *gs)
2619 if (gimple_num_ops (gs) >= 4)
2620 return gs->op[3];
2621 else
2622 return NULL_TREE;
2625 static inline tree
2626 gimple_assign_rhs3 (const gimple *gs)
2628 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2629 return gimple_assign_rhs3 (ass);
2632 /* Return a pointer to the third operand on the RHS of assignment
2633 statement GS. */
2635 static inline tree *
2636 gimple_assign_rhs3_ptr (gimple *gs)
2638 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2639 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2640 return &ass->op[3];
2644 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2646 static inline void
2647 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2649 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2650 gs->op[3] = rhs;
2653 static inline void
2654 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2656 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2657 gimple_assign_set_rhs3 (ass, rhs);
2661 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2662 which expect to see only two operands. */
2664 static inline void
2665 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2666 tree op1, tree op2)
2668 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2671 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2672 which expect to see only one operands. */
2674 static inline void
2675 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2676 tree op1)
2678 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2681 /* Returns true if GS is a nontemporal move. */
2683 static inline bool
2684 gimple_assign_nontemporal_move_p (const gassign *gs)
2686 return gs->nontemporal_move;
2689 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2691 static inline void
2692 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2694 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2695 gs->nontemporal_move = nontemporal;
2699 /* Return the code of the expression computed on the rhs of assignment
2700 statement GS. In case that the RHS is a single object, returns the
2701 tree code of the object. */
2703 static inline enum tree_code
2704 gimple_assign_rhs_code (const gassign *gs)
2706 enum tree_code code = (enum tree_code) gs->subcode;
2707 /* While we initially set subcode to the TREE_CODE of the rhs for
2708 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2709 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2710 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2711 code = TREE_CODE (gs->op[1]);
2713 return code;
2716 static inline enum tree_code
2717 gimple_assign_rhs_code (const gimple *gs)
2719 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2720 return gimple_assign_rhs_code (ass);
2724 /* Set CODE to be the code for the expression computed on the RHS of
2725 assignment S. */
2727 static inline void
2728 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2730 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2731 s->subcode = code;
2735 /* Return the gimple rhs class of the code of the expression computed on
2736 the rhs of assignment statement GS.
2737 This will never return GIMPLE_INVALID_RHS. */
2739 static inline enum gimple_rhs_class
2740 gimple_assign_rhs_class (const gimple *gs)
2742 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2745 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2746 there is no operator associated with the assignment itself.
2747 Unlike gimple_assign_copy_p, this predicate returns true for
2748 any RHS operand, including those that perform an operation
2749 and do not have the semantics of a copy, such as COND_EXPR. */
2751 static inline bool
2752 gimple_assign_single_p (const gimple *gs)
2754 return (is_gimple_assign (gs)
2755 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2758 /* Return true if GS performs a store to its lhs. */
2760 static inline bool
2761 gimple_store_p (const gimple *gs)
2763 tree lhs = gimple_get_lhs (gs);
2764 return lhs && !is_gimple_reg (lhs);
2767 /* Return true if GS is an assignment that loads from its rhs1. */
2769 static inline bool
2770 gimple_assign_load_p (const gimple *gs)
2772 tree rhs;
2773 if (!gimple_assign_single_p (gs))
2774 return false;
2775 rhs = gimple_assign_rhs1 (gs);
2776 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2777 return true;
2778 rhs = get_base_address (rhs);
2779 return (DECL_P (rhs)
2780 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2784 /* Return true if S is a type-cast assignment. */
2786 static inline bool
2787 gimple_assign_cast_p (const gimple *s)
2789 if (is_gimple_assign (s))
2791 enum tree_code sc = gimple_assign_rhs_code (s);
2792 return CONVERT_EXPR_CODE_P (sc)
2793 || sc == VIEW_CONVERT_EXPR
2794 || sc == FIX_TRUNC_EXPR;
2797 return false;
2800 /* Return true if S is a clobber statement. */
2802 static inline bool
2803 gimple_clobber_p (const gimple *s)
2805 return gimple_assign_single_p (s)
2806 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2809 /* Return true if GS is a GIMPLE_CALL. */
2811 static inline bool
2812 is_gimple_call (const gimple *gs)
2814 return gimple_code (gs) == GIMPLE_CALL;
2817 /* Return the LHS of call statement GS. */
2819 static inline tree
2820 gimple_call_lhs (const gcall *gs)
2822 return gs->op[0];
2825 static inline tree
2826 gimple_call_lhs (const gimple *gs)
2828 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2829 return gimple_call_lhs (gc);
2833 /* Return a pointer to the LHS of call statement GS. */
2835 static inline tree *
2836 gimple_call_lhs_ptr (gcall *gs)
2838 return &gs->op[0];
2841 static inline tree *
2842 gimple_call_lhs_ptr (gimple *gs)
2844 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2845 return gimple_call_lhs_ptr (gc);
2849 /* Set LHS to be the LHS operand of call statement GS. */
2851 static inline void
2852 gimple_call_set_lhs (gcall *gs, tree lhs)
2854 gs->op[0] = lhs;
2855 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2856 SSA_NAME_DEF_STMT (lhs) = gs;
2859 static inline void
2860 gimple_call_set_lhs (gimple *gs, tree lhs)
2862 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2863 gimple_call_set_lhs (gc, lhs);
2867 /* Return true if call GS calls an internal-only function, as enumerated
2868 by internal_fn. */
2870 static inline bool
2871 gimple_call_internal_p (const gcall *gs)
2873 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2876 static inline bool
2877 gimple_call_internal_p (const gimple *gs)
2879 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2880 return gimple_call_internal_p (gc);
2883 /* Return true if call GS is marked as nocf_check. */
2885 static inline bool
2886 gimple_call_nocf_check_p (const gcall *gs)
2888 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2891 /* Mark statement GS as nocf_check call. */
2893 static inline void
2894 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2896 if (nocf_check)
2897 gs->subcode |= GF_CALL_NOCF_CHECK;
2898 else
2899 gs->subcode &= ~GF_CALL_NOCF_CHECK;
2902 /* Return the target of internal call GS. */
2904 static inline enum internal_fn
2905 gimple_call_internal_fn (const gcall *gs)
2907 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2908 return gs->u.internal_fn;
2911 static inline enum internal_fn
2912 gimple_call_internal_fn (const gimple *gs)
2914 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2915 return gimple_call_internal_fn (gc);
2918 /* Return true, if this internal gimple call is unique. */
2920 static inline bool
2921 gimple_call_internal_unique_p (const gcall *gs)
2923 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2926 static inline bool
2927 gimple_call_internal_unique_p (const gimple *gs)
2929 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2930 return gimple_call_internal_unique_p (gc);
2933 /* Return true if GS is an internal function FN. */
2935 static inline bool
2936 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2938 return (is_gimple_call (gs)
2939 && gimple_call_internal_p (gs)
2940 && gimple_call_internal_fn (gs) == fn);
2943 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2944 that could alter control flow. */
2946 static inline void
2947 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2949 if (ctrl_altering_p)
2950 s->subcode |= GF_CALL_CTRL_ALTERING;
2951 else
2952 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2955 static inline void
2956 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2958 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2959 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2962 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2963 flag is set. Such call could not be a stmt in the middle of a bb. */
2965 static inline bool
2966 gimple_call_ctrl_altering_p (const gcall *gs)
2968 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2971 static inline bool
2972 gimple_call_ctrl_altering_p (const gimple *gs)
2974 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2975 return gimple_call_ctrl_altering_p (gc);
2979 /* Return the function type of the function called by GS. */
2981 static inline tree
2982 gimple_call_fntype (const gcall *gs)
2984 if (gimple_call_internal_p (gs))
2985 return NULL_TREE;
2986 return gs->u.fntype;
2989 static inline tree
2990 gimple_call_fntype (const gimple *gs)
2992 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2993 return gimple_call_fntype (call_stmt);
2996 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2998 static inline void
2999 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3001 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3002 call_stmt->u.fntype = fntype;
3006 /* Return the tree node representing the function called by call
3007 statement GS. */
3009 static inline tree
3010 gimple_call_fn (const gcall *gs)
3012 return gs->op[1];
3015 static inline tree
3016 gimple_call_fn (const gimple *gs)
3018 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3019 return gimple_call_fn (gc);
3022 /* Return a pointer to the tree node representing the function called by call
3023 statement GS. */
3025 static inline tree *
3026 gimple_call_fn_ptr (gcall *gs)
3028 return &gs->op[1];
3031 static inline tree *
3032 gimple_call_fn_ptr (gimple *gs)
3034 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3035 return gimple_call_fn_ptr (gc);
3039 /* Set FN to be the function called by call statement GS. */
3041 static inline void
3042 gimple_call_set_fn (gcall *gs, tree fn)
3044 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3045 gs->op[1] = fn;
3049 /* Set FNDECL to be the function called by call statement GS. */
3051 static inline void
3052 gimple_call_set_fndecl (gcall *gs, tree decl)
3054 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3055 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3056 build_pointer_type (TREE_TYPE (decl)), decl);
3059 static inline void
3060 gimple_call_set_fndecl (gimple *gs, tree decl)
3062 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3063 gimple_call_set_fndecl (gc, decl);
3067 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3069 static inline void
3070 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3072 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3073 call_stmt->u.internal_fn = fn;
3077 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3078 Otherwise return NULL. This function is analogous to
3079 get_callee_fndecl in tree land. */
3081 static inline tree
3082 gimple_call_fndecl (const gcall *gs)
3084 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3087 static inline tree
3088 gimple_call_fndecl (const gimple *gs)
3090 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3091 return gimple_call_fndecl (gc);
3095 /* Return the type returned by call statement GS. */
3097 static inline tree
3098 gimple_call_return_type (const gcall *gs)
3100 tree type = gimple_call_fntype (gs);
3102 if (type == NULL_TREE)
3103 return TREE_TYPE (gimple_call_lhs (gs));
3105 /* The type returned by a function is the type of its
3106 function type. */
3107 return TREE_TYPE (type);
3111 /* Return the static chain for call statement GS. */
3113 static inline tree
3114 gimple_call_chain (const gcall *gs)
3116 return gs->op[2];
3119 static inline tree
3120 gimple_call_chain (const gimple *gs)
3122 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3123 return gimple_call_chain (gc);
3127 /* Return a pointer to the static chain for call statement CALL_STMT. */
3129 static inline tree *
3130 gimple_call_chain_ptr (gcall *call_stmt)
3132 return &call_stmt->op[2];
3135 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3137 static inline void
3138 gimple_call_set_chain (gcall *call_stmt, tree chain)
3140 call_stmt->op[2] = chain;
3144 /* Return the number of arguments used by call statement GS. */
3146 static inline unsigned
3147 gimple_call_num_args (const gcall *gs)
3149 return gimple_num_ops (gs) - 3;
3152 static inline unsigned
3153 gimple_call_num_args (const gimple *gs)
3155 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3156 return gimple_call_num_args (gc);
3160 /* Return the argument at position INDEX for call statement GS. */
3162 static inline tree
3163 gimple_call_arg (const gcall *gs, unsigned index)
3165 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3166 return gs->op[index + 3];
3169 static inline tree
3170 gimple_call_arg (const gimple *gs, unsigned index)
3172 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3173 return gimple_call_arg (gc, index);
3177 /* Return a pointer to the argument at position INDEX for call
3178 statement GS. */
3180 static inline tree *
3181 gimple_call_arg_ptr (gcall *gs, unsigned index)
3183 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3184 return &gs->op[index + 3];
3187 static inline tree *
3188 gimple_call_arg_ptr (gimple *gs, unsigned index)
3190 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3191 return gimple_call_arg_ptr (gc, index);
3195 /* Set ARG to be the argument at position INDEX for call statement GS. */
3197 static inline void
3198 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3200 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3201 gs->op[index + 3] = arg;
3204 static inline void
3205 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3207 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3208 gimple_call_set_arg (gc, index, arg);
3212 /* If TAIL_P is true, mark call statement S as being a tail call
3213 (i.e., a call just before the exit of a function). These calls are
3214 candidate for tail call optimization. */
3216 static inline void
3217 gimple_call_set_tail (gcall *s, bool tail_p)
3219 if (tail_p)
3220 s->subcode |= GF_CALL_TAILCALL;
3221 else
3222 s->subcode &= ~GF_CALL_TAILCALL;
3226 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3228 static inline bool
3229 gimple_call_tail_p (gcall *s)
3231 return (s->subcode & GF_CALL_TAILCALL) != 0;
3234 /* Mark (or clear) call statement S as requiring tail call optimization. */
3236 static inline void
3237 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3239 if (must_tail_p)
3240 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3241 else
3242 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3245 /* Return true if call statement has been marked as requiring
3246 tail call optimization. */
3248 static inline bool
3249 gimple_call_must_tail_p (const gcall *s)
3251 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3254 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3255 slot optimization. This transformation uses the target of the call
3256 expansion as the return slot for calls that return in memory. */
3258 static inline void
3259 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3261 if (return_slot_opt_p)
3262 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3263 else
3264 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3268 /* Return true if S is marked for return slot optimization. */
3270 static inline bool
3271 gimple_call_return_slot_opt_p (gcall *s)
3273 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3277 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3278 thunk to the thunked-to function. */
3280 static inline void
3281 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3283 if (from_thunk_p)
3284 s->subcode |= GF_CALL_FROM_THUNK;
3285 else
3286 s->subcode &= ~GF_CALL_FROM_THUNK;
3290 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3292 static inline bool
3293 gimple_call_from_thunk_p (gcall *s)
3295 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3299 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3300 argument pack in its argument list. */
3302 static inline void
3303 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3305 if (pass_arg_pack_p)
3306 s->subcode |= GF_CALL_VA_ARG_PACK;
3307 else
3308 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3312 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3313 argument pack in its argument list. */
3315 static inline bool
3316 gimple_call_va_arg_pack_p (gcall *s)
3318 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3322 /* Return true if S is a noreturn call. */
3324 static inline bool
3325 gimple_call_noreturn_p (const gcall *s)
3327 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3330 static inline bool
3331 gimple_call_noreturn_p (const gimple *s)
3333 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3334 return gimple_call_noreturn_p (gc);
3338 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3339 even if the called function can throw in other cases. */
3341 static inline void
3342 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3344 if (nothrow_p)
3345 s->subcode |= GF_CALL_NOTHROW;
3346 else
3347 s->subcode &= ~GF_CALL_NOTHROW;
3350 /* Return true if S is a nothrow call. */
3352 static inline bool
3353 gimple_call_nothrow_p (gcall *s)
3355 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3358 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3359 is known to be emitted for VLA objects. Those are wrapped by
3360 stack_save/stack_restore calls and hence can't lead to unbounded
3361 stack growth even when they occur in loops. */
3363 static inline void
3364 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3366 if (for_var)
3367 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3368 else
3369 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3372 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3374 static inline bool
3375 gimple_call_alloca_for_var_p (gcall *s)
3377 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3380 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3381 pointers to nested function are descriptors instead of trampolines. */
3383 static inline void
3384 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3386 if (by_descriptor_p)
3387 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3388 else
3389 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3392 /* Return true if S is a by-descriptor call. */
3394 static inline bool
3395 gimple_call_by_descriptor_p (gcall *s)
3397 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3400 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3402 static inline void
3403 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3405 dest_call->subcode = orig_call->subcode;
3409 /* Return a pointer to the points-to solution for the set of call-used
3410 variables of the call CALL_STMT. */
3412 static inline struct pt_solution *
3413 gimple_call_use_set (gcall *call_stmt)
3415 return &call_stmt->call_used;
3419 /* Return a pointer to the points-to solution for the set of call-used
3420 variables of the call CALL_STMT. */
3422 static inline struct pt_solution *
3423 gimple_call_clobber_set (gcall *call_stmt)
3425 return &call_stmt->call_clobbered;
3429 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3430 non-NULL lhs. */
3432 static inline bool
3433 gimple_has_lhs (gimple *stmt)
3435 if (is_gimple_assign (stmt))
3436 return true;
3437 if (gcall *call = dyn_cast <gcall *> (stmt))
3438 return gimple_call_lhs (call) != NULL_TREE;
3439 return false;
3443 /* Return the code of the predicate computed by conditional statement GS. */
3445 static inline enum tree_code
3446 gimple_cond_code (const gcond *gs)
3448 return (enum tree_code) gs->subcode;
3451 static inline enum tree_code
3452 gimple_cond_code (const gimple *gs)
3454 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3455 return gimple_cond_code (gc);
3459 /* Set CODE to be the predicate code for the conditional statement GS. */
3461 static inline void
3462 gimple_cond_set_code (gcond *gs, enum tree_code code)
3464 gs->subcode = code;
3468 /* Return the LHS of the predicate computed by conditional statement GS. */
3470 static inline tree
3471 gimple_cond_lhs (const gcond *gs)
3473 return gs->op[0];
3476 static inline tree
3477 gimple_cond_lhs (const gimple *gs)
3479 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3480 return gimple_cond_lhs (gc);
3483 /* Return the pointer to the LHS of the predicate computed by conditional
3484 statement GS. */
3486 static inline tree *
3487 gimple_cond_lhs_ptr (gcond *gs)
3489 return &gs->op[0];
3492 /* Set LHS to be the LHS operand of the predicate computed by
3493 conditional statement GS. */
3495 static inline void
3496 gimple_cond_set_lhs (gcond *gs, tree lhs)
3498 gs->op[0] = lhs;
3502 /* Return the RHS operand of the predicate computed by conditional GS. */
3504 static inline tree
3505 gimple_cond_rhs (const gcond *gs)
3507 return gs->op[1];
3510 static inline tree
3511 gimple_cond_rhs (const gimple *gs)
3513 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3514 return gimple_cond_rhs (gc);
3517 /* Return the pointer to the RHS operand of the predicate computed by
3518 conditional GS. */
3520 static inline tree *
3521 gimple_cond_rhs_ptr (gcond *gs)
3523 return &gs->op[1];
3527 /* Set RHS to be the RHS operand of the predicate computed by
3528 conditional statement GS. */
3530 static inline void
3531 gimple_cond_set_rhs (gcond *gs, tree rhs)
3533 gs->op[1] = rhs;
3537 /* Return the label used by conditional statement GS when its
3538 predicate evaluates to true. */
3540 static inline tree
3541 gimple_cond_true_label (const gcond *gs)
3543 return gs->op[2];
3547 /* Set LABEL to be the label used by conditional statement GS when its
3548 predicate evaluates to true. */
3550 static inline void
3551 gimple_cond_set_true_label (gcond *gs, tree label)
3553 gs->op[2] = label;
3557 /* Set LABEL to be the label used by conditional statement GS when its
3558 predicate evaluates to false. */
3560 static inline void
3561 gimple_cond_set_false_label (gcond *gs, tree label)
3563 gs->op[3] = label;
3567 /* Return the label used by conditional statement GS when its
3568 predicate evaluates to false. */
3570 static inline tree
3571 gimple_cond_false_label (const gcond *gs)
3573 return gs->op[3];
3577 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3579 static inline void
3580 gimple_cond_make_false (gcond *gs)
3582 gimple_cond_set_lhs (gs, boolean_false_node);
3583 gimple_cond_set_rhs (gs, boolean_false_node);
3584 gs->subcode = NE_EXPR;
3588 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3590 static inline void
3591 gimple_cond_make_true (gcond *gs)
3593 gimple_cond_set_lhs (gs, boolean_true_node);
3594 gimple_cond_set_rhs (gs, boolean_false_node);
3595 gs->subcode = NE_EXPR;
3598 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3599 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3601 static inline bool
3602 gimple_cond_true_p (const gcond *gs)
3604 tree lhs = gimple_cond_lhs (gs);
3605 tree rhs = gimple_cond_rhs (gs);
3606 enum tree_code code = gimple_cond_code (gs);
3608 if (lhs != boolean_true_node && lhs != boolean_false_node)
3609 return false;
3611 if (rhs != boolean_true_node && rhs != boolean_false_node)
3612 return false;
3614 if (code == NE_EXPR && lhs != rhs)
3615 return true;
3617 if (code == EQ_EXPR && lhs == rhs)
3618 return true;
3620 return false;
3623 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3624 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3626 static inline bool
3627 gimple_cond_false_p (const gcond *gs)
3629 tree lhs = gimple_cond_lhs (gs);
3630 tree rhs = gimple_cond_rhs (gs);
3631 enum tree_code code = gimple_cond_code (gs);
3633 if (lhs != boolean_true_node && lhs != boolean_false_node)
3634 return false;
3636 if (rhs != boolean_true_node && rhs != boolean_false_node)
3637 return false;
3639 if (code == NE_EXPR && lhs == rhs)
3640 return true;
3642 if (code == EQ_EXPR && lhs != rhs)
3643 return true;
3645 return false;
3648 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3650 static inline void
3651 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3652 tree rhs)
3654 gimple_cond_set_code (stmt, code);
3655 gimple_cond_set_lhs (stmt, lhs);
3656 gimple_cond_set_rhs (stmt, rhs);
3659 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3661 static inline tree
3662 gimple_label_label (const glabel *gs)
3664 return gs->op[0];
3668 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3669 GS. */
3671 static inline void
3672 gimple_label_set_label (glabel *gs, tree label)
3674 gs->op[0] = label;
3678 /* Return the destination of the unconditional jump GS. */
3680 static inline tree
3681 gimple_goto_dest (const gimple *gs)
3683 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3684 return gimple_op (gs, 0);
3688 /* Set DEST to be the destination of the unconditonal jump GS. */
3690 static inline void
3691 gimple_goto_set_dest (ggoto *gs, tree dest)
3693 gs->op[0] = dest;
3697 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3699 static inline tree
3700 gimple_bind_vars (const gbind *bind_stmt)
3702 return bind_stmt->vars;
3706 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3707 statement GS. */
3709 static inline void
3710 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3712 bind_stmt->vars = vars;
3716 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3717 statement GS. */
3719 static inline void
3720 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3722 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3726 static inline gimple_seq *
3727 gimple_bind_body_ptr (gbind *bind_stmt)
3729 return &bind_stmt->body;
3732 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3734 static inline gimple_seq
3735 gimple_bind_body (gbind *gs)
3737 return *gimple_bind_body_ptr (gs);
3741 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3742 statement GS. */
3744 static inline void
3745 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3747 bind_stmt->body = seq;
3751 /* Append a statement to the end of a GIMPLE_BIND's body. */
3753 static inline void
3754 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3756 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3760 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3762 static inline void
3763 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3765 gimple_seq_add_seq (&bind_stmt->body, seq);
3769 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3770 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3772 static inline tree
3773 gimple_bind_block (const gbind *bind_stmt)
3775 return bind_stmt->block;
3779 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3780 statement GS. */
3782 static inline void
3783 gimple_bind_set_block (gbind *bind_stmt, tree block)
3785 gcc_gimple_checking_assert (block == NULL_TREE
3786 || TREE_CODE (block) == BLOCK);
3787 bind_stmt->block = block;
3791 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3793 static inline unsigned
3794 gimple_asm_ninputs (const gasm *asm_stmt)
3796 return asm_stmt->ni;
3800 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3802 static inline unsigned
3803 gimple_asm_noutputs (const gasm *asm_stmt)
3805 return asm_stmt->no;
3809 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3811 static inline unsigned
3812 gimple_asm_nclobbers (const gasm *asm_stmt)
3814 return asm_stmt->nc;
3817 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3819 static inline unsigned
3820 gimple_asm_nlabels (const gasm *asm_stmt)
3822 return asm_stmt->nl;
3825 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3827 static inline tree
3828 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3830 gcc_gimple_checking_assert (index < asm_stmt->ni);
3831 return asm_stmt->op[index + asm_stmt->no];
3834 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3836 static inline void
3837 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3839 gcc_gimple_checking_assert (index < asm_stmt->ni
3840 && TREE_CODE (in_op) == TREE_LIST);
3841 asm_stmt->op[index + asm_stmt->no] = in_op;
3845 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3847 static inline tree
3848 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3850 gcc_gimple_checking_assert (index < asm_stmt->no);
3851 return asm_stmt->op[index];
3854 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3856 static inline void
3857 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3859 gcc_gimple_checking_assert (index < asm_stmt->no
3860 && TREE_CODE (out_op) == TREE_LIST);
3861 asm_stmt->op[index] = out_op;
3865 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3867 static inline tree
3868 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3870 gcc_gimple_checking_assert (index < asm_stmt->nc);
3871 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3875 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3877 static inline void
3878 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3880 gcc_gimple_checking_assert (index < asm_stmt->nc
3881 && TREE_CODE (clobber_op) == TREE_LIST);
3882 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3885 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3887 static inline tree
3888 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3890 gcc_gimple_checking_assert (index < asm_stmt->nl);
3891 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3894 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3896 static inline void
3897 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3899 gcc_gimple_checking_assert (index < asm_stmt->nl
3900 && TREE_CODE (label_op) == TREE_LIST);
3901 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3904 /* Return the string representing the assembly instruction in
3905 GIMPLE_ASM ASM_STMT. */
3907 static inline const char *
3908 gimple_asm_string (const gasm *asm_stmt)
3910 return asm_stmt->string;
3914 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3916 static inline bool
3917 gimple_asm_volatile_p (const gasm *asm_stmt)
3919 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3923 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3925 static inline void
3926 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3928 if (volatile_p)
3929 asm_stmt->subcode |= GF_ASM_VOLATILE;
3930 else
3931 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3935 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3937 static inline void
3938 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3940 if (input_p)
3941 asm_stmt->subcode |= GF_ASM_INPUT;
3942 else
3943 asm_stmt->subcode &= ~GF_ASM_INPUT;
3947 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3949 static inline bool
3950 gimple_asm_input_p (const gasm *asm_stmt)
3952 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3956 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3958 static inline tree
3959 gimple_catch_types (const gcatch *catch_stmt)
3961 return catch_stmt->types;
3965 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3967 static inline tree *
3968 gimple_catch_types_ptr (gcatch *catch_stmt)
3970 return &catch_stmt->types;
3974 /* Return a pointer to the GIMPLE sequence representing the body of
3975 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3977 static inline gimple_seq *
3978 gimple_catch_handler_ptr (gcatch *catch_stmt)
3980 return &catch_stmt->handler;
3984 /* Return the GIMPLE sequence representing the body of the handler of
3985 GIMPLE_CATCH statement CATCH_STMT. */
3987 static inline gimple_seq
3988 gimple_catch_handler (gcatch *catch_stmt)
3990 return *gimple_catch_handler_ptr (catch_stmt);
3994 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3996 static inline void
3997 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3999 catch_stmt->types = t;
4003 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4005 static inline void
4006 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4008 catch_stmt->handler = handler;
4012 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4014 static inline tree
4015 gimple_eh_filter_types (const gimple *gs)
4017 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4018 return eh_filter_stmt->types;
4022 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4023 GS. */
4025 static inline tree *
4026 gimple_eh_filter_types_ptr (gimple *gs)
4028 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4029 return &eh_filter_stmt->types;
4033 /* Return a pointer to the sequence of statement to execute when
4034 GIMPLE_EH_FILTER statement fails. */
4036 static inline gimple_seq *
4037 gimple_eh_filter_failure_ptr (gimple *gs)
4039 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4040 return &eh_filter_stmt->failure;
4044 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4045 statement fails. */
4047 static inline gimple_seq
4048 gimple_eh_filter_failure (gimple *gs)
4050 return *gimple_eh_filter_failure_ptr (gs);
4054 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4055 EH_FILTER_STMT. */
4057 static inline void
4058 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4060 eh_filter_stmt->types = types;
4064 /* Set FAILURE to be the sequence of statements to execute on failure
4065 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4067 static inline void
4068 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4069 gimple_seq failure)
4071 eh_filter_stmt->failure = failure;
4074 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4076 static inline tree
4077 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4079 return eh_mnt_stmt->fndecl;
4082 /* Set the function decl to be called by GS to DECL. */
4084 static inline void
4085 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4086 tree decl)
4088 eh_mnt_stmt->fndecl = decl;
4091 /* GIMPLE_EH_ELSE accessors. */
4093 static inline gimple_seq *
4094 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4096 return &eh_else_stmt->n_body;
4099 static inline gimple_seq
4100 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4102 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4105 static inline gimple_seq *
4106 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4108 return &eh_else_stmt->e_body;
4111 static inline gimple_seq
4112 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4114 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4117 static inline void
4118 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4120 eh_else_stmt->n_body = seq;
4123 static inline void
4124 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4126 eh_else_stmt->e_body = seq;
4129 /* GIMPLE_TRY accessors. */
4131 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4132 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4134 static inline enum gimple_try_flags
4135 gimple_try_kind (const gimple *gs)
4137 GIMPLE_CHECK (gs, GIMPLE_TRY);
4138 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4142 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4144 static inline void
4145 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4147 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4148 || kind == GIMPLE_TRY_FINALLY);
4149 if (gimple_try_kind (gs) != kind)
4150 gs->subcode = (unsigned int) kind;
4154 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4156 static inline bool
4157 gimple_try_catch_is_cleanup (const gimple *gs)
4159 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4160 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4164 /* Return a pointer to the sequence of statements used as the
4165 body for GIMPLE_TRY GS. */
4167 static inline gimple_seq *
4168 gimple_try_eval_ptr (gimple *gs)
4170 gtry *try_stmt = as_a <gtry *> (gs);
4171 return &try_stmt->eval;
4175 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4177 static inline gimple_seq
4178 gimple_try_eval (gimple *gs)
4180 return *gimple_try_eval_ptr (gs);
4184 /* Return a pointer to the sequence of statements used as the cleanup body for
4185 GIMPLE_TRY GS. */
4187 static inline gimple_seq *
4188 gimple_try_cleanup_ptr (gimple *gs)
4190 gtry *try_stmt = as_a <gtry *> (gs);
4191 return &try_stmt->cleanup;
4195 /* Return the sequence of statements used as the cleanup body for
4196 GIMPLE_TRY GS. */
4198 static inline gimple_seq
4199 gimple_try_cleanup (gimple *gs)
4201 return *gimple_try_cleanup_ptr (gs);
4205 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4207 static inline void
4208 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4210 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4211 if (catch_is_cleanup)
4212 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4213 else
4214 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4218 /* Set EVAL to be the sequence of statements to use as the body for
4219 GIMPLE_TRY TRY_STMT. */
4221 static inline void
4222 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4224 try_stmt->eval = eval;
4228 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4229 body for GIMPLE_TRY TRY_STMT. */
4231 static inline void
4232 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4234 try_stmt->cleanup = cleanup;
4238 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4240 static inline gimple_seq *
4241 gimple_wce_cleanup_ptr (gimple *gs)
4243 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4244 return &wce_stmt->cleanup;
4248 /* Return the cleanup sequence for cleanup statement GS. */
4250 static inline gimple_seq
4251 gimple_wce_cleanup (gimple *gs)
4253 return *gimple_wce_cleanup_ptr (gs);
4257 /* Set CLEANUP to be the cleanup sequence for GS. */
4259 static inline void
4260 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4262 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4263 wce_stmt->cleanup = cleanup;
4267 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4269 static inline bool
4270 gimple_wce_cleanup_eh_only (const gimple *gs)
4272 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4273 return gs->subcode != 0;
4277 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4279 static inline void
4280 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4282 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4283 gs->subcode = (unsigned int) eh_only_p;
4287 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4289 static inline unsigned
4290 gimple_phi_capacity (const gimple *gs)
4292 const gphi *phi_stmt = as_a <const gphi *> (gs);
4293 return phi_stmt->capacity;
4297 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4298 be exactly the number of incoming edges for the basic block holding
4299 GS. */
4301 static inline unsigned
4302 gimple_phi_num_args (const gimple *gs)
4304 const gphi *phi_stmt = as_a <const gphi *> (gs);
4305 return phi_stmt->nargs;
4309 /* Return the SSA name created by GIMPLE_PHI GS. */
4311 static inline tree
4312 gimple_phi_result (const gphi *gs)
4314 return gs->result;
4317 static inline tree
4318 gimple_phi_result (const gimple *gs)
4320 const gphi *phi_stmt = as_a <const gphi *> (gs);
4321 return gimple_phi_result (phi_stmt);
4324 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4326 static inline tree *
4327 gimple_phi_result_ptr (gphi *gs)
4329 return &gs->result;
4332 static inline tree *
4333 gimple_phi_result_ptr (gimple *gs)
4335 gphi *phi_stmt = as_a <gphi *> (gs);
4336 return gimple_phi_result_ptr (phi_stmt);
4339 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4341 static inline void
4342 gimple_phi_set_result (gphi *phi, tree result)
4344 phi->result = result;
4345 if (result && TREE_CODE (result) == SSA_NAME)
4346 SSA_NAME_DEF_STMT (result) = phi;
4350 /* Return the PHI argument corresponding to incoming edge INDEX for
4351 GIMPLE_PHI GS. */
4353 static inline struct phi_arg_d *
4354 gimple_phi_arg (gphi *gs, unsigned index)
4356 gcc_gimple_checking_assert (index < gs->nargs);
4357 return &(gs->args[index]);
4360 static inline struct phi_arg_d *
4361 gimple_phi_arg (gimple *gs, unsigned index)
4363 gphi *phi_stmt = as_a <gphi *> (gs);
4364 return gimple_phi_arg (phi_stmt, index);
4367 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4368 for GIMPLE_PHI PHI. */
4370 static inline void
4371 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4373 gcc_gimple_checking_assert (index < phi->nargs);
4374 phi->args[index] = *phiarg;
4377 /* Return the PHI nodes for basic block BB, or NULL if there are no
4378 PHI nodes. */
4380 static inline gimple_seq
4381 phi_nodes (const_basic_block bb)
4383 gcc_checking_assert (!(bb->flags & BB_RTL));
4384 return bb->il.gimple.phi_nodes;
4387 /* Return a pointer to the PHI nodes for basic block BB. */
4389 static inline gimple_seq *
4390 phi_nodes_ptr (basic_block bb)
4392 gcc_checking_assert (!(bb->flags & BB_RTL));
4393 return &bb->il.gimple.phi_nodes;
4396 /* Return the tree operand for argument I of PHI node GS. */
4398 static inline tree
4399 gimple_phi_arg_def (gphi *gs, size_t index)
4401 return gimple_phi_arg (gs, index)->def;
4404 static inline tree
4405 gimple_phi_arg_def (gimple *gs, size_t index)
4407 return gimple_phi_arg (gs, index)->def;
4411 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4413 static inline tree *
4414 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4416 return &gimple_phi_arg (phi, index)->def;
4419 /* Return the edge associated with argument I of phi node PHI. */
4421 static inline edge
4422 gimple_phi_arg_edge (gphi *phi, size_t i)
4424 return EDGE_PRED (gimple_bb (phi), i);
4427 /* Return the source location of gimple argument I of phi node PHI. */
4429 static inline location_t
4430 gimple_phi_arg_location (gphi *phi, size_t i)
4432 return gimple_phi_arg (phi, i)->locus;
4435 /* Return the source location of the argument on edge E of phi node PHI. */
4437 static inline location_t
4438 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4440 return gimple_phi_arg (phi, e->dest_idx)->locus;
4443 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4445 static inline void
4446 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4448 gimple_phi_arg (phi, i)->locus = loc;
4451 /* Return TRUE if argument I of phi node PHI has a location record. */
4453 static inline bool
4454 gimple_phi_arg_has_location (gphi *phi, size_t i)
4456 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4460 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4462 static inline int
4463 gimple_resx_region (const gresx *resx_stmt)
4465 return resx_stmt->region;
4468 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4470 static inline void
4471 gimple_resx_set_region (gresx *resx_stmt, int region)
4473 resx_stmt->region = region;
4476 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4478 static inline int
4479 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4481 return eh_dispatch_stmt->region;
4484 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4485 EH_DISPATCH_STMT. */
4487 static inline void
4488 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4490 eh_dispatch_stmt->region = region;
4493 /* Return the number of labels associated with the switch statement GS. */
4495 static inline unsigned
4496 gimple_switch_num_labels (const gswitch *gs)
4498 unsigned num_ops;
4499 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4500 num_ops = gimple_num_ops (gs);
4501 gcc_gimple_checking_assert (num_ops > 1);
4502 return num_ops - 1;
4506 /* Set NLABELS to be the number of labels for the switch statement GS. */
4508 static inline void
4509 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4511 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4512 gimple_set_num_ops (g, nlabels + 1);
4516 /* Return the index variable used by the switch statement GS. */
4518 static inline tree
4519 gimple_switch_index (const gswitch *gs)
4521 return gs->op[0];
4525 /* Return a pointer to the index variable for the switch statement GS. */
4527 static inline tree *
4528 gimple_switch_index_ptr (gswitch *gs)
4530 return &gs->op[0];
4534 /* Set INDEX to be the index variable for switch statement GS. */
4536 static inline void
4537 gimple_switch_set_index (gswitch *gs, tree index)
4539 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4540 gs->op[0] = index;
4544 /* Return the label numbered INDEX. The default label is 0, followed by any
4545 labels in a switch statement. */
4547 static inline tree
4548 gimple_switch_label (const gswitch *gs, unsigned index)
4550 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4551 return gs->op[index + 1];
4554 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4556 static inline void
4557 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4559 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4560 && (label == NULL_TREE
4561 || TREE_CODE (label) == CASE_LABEL_EXPR));
4562 gs->op[index + 1] = label;
4565 /* Return the default label for a switch statement. */
4567 static inline tree
4568 gimple_switch_default_label (const gswitch *gs)
4570 tree label = gimple_switch_label (gs, 0);
4571 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4572 return label;
4575 /* Set the default label for a switch statement. */
4577 static inline void
4578 gimple_switch_set_default_label (gswitch *gs, tree label)
4580 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4581 gimple_switch_set_label (gs, 0, label);
4584 /* Return true if GS is a GIMPLE_DEBUG statement. */
4586 static inline bool
4587 is_gimple_debug (const gimple *gs)
4589 return gimple_code (gs) == GIMPLE_DEBUG;
4593 /* Return the last nondebug statement in GIMPLE sequence S. */
4595 static inline gimple *
4596 gimple_seq_last_nondebug_stmt (gimple_seq s)
4598 gimple_seq_node n;
4599 for (n = gimple_seq_last (s);
4600 n && is_gimple_debug (n);
4601 n = n->prev)
4602 if (n->prev == s)
4603 return NULL;
4604 return n;
4608 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4610 static inline bool
4611 gimple_debug_bind_p (const gimple *s)
4613 if (is_gimple_debug (s))
4614 return s->subcode == GIMPLE_DEBUG_BIND;
4616 return false;
4619 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4621 static inline tree
4622 gimple_debug_bind_get_var (gimple *dbg)
4624 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4625 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4626 return gimple_op (dbg, 0);
4629 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4630 statement. */
4632 static inline tree
4633 gimple_debug_bind_get_value (gimple *dbg)
4635 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4636 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4637 return gimple_op (dbg, 1);
4640 /* Return a pointer to the value bound to the variable in a
4641 GIMPLE_DEBUG bind statement. */
4643 static inline tree *
4644 gimple_debug_bind_get_value_ptr (gimple *dbg)
4646 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4647 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4648 return gimple_op_ptr (dbg, 1);
4651 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4653 static inline void
4654 gimple_debug_bind_set_var (gimple *dbg, tree var)
4656 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4657 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4658 gimple_set_op (dbg, 0, var);
4661 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4662 statement. */
4664 static inline void
4665 gimple_debug_bind_set_value (gimple *dbg, tree value)
4667 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4668 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4669 gimple_set_op (dbg, 1, value);
4672 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4673 optimized away. */
4674 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4676 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4677 statement. */
4679 static inline void
4680 gimple_debug_bind_reset_value (gimple *dbg)
4682 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4683 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4684 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4687 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4688 value. */
4690 static inline bool
4691 gimple_debug_bind_has_value_p (gimple *dbg)
4693 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4694 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4695 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4698 #undef GIMPLE_DEBUG_BIND_NOVALUE
4700 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4702 static inline bool
4703 gimple_debug_source_bind_p (const gimple *s)
4705 if (is_gimple_debug (s))
4706 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4708 return false;
4711 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4713 static inline tree
4714 gimple_debug_source_bind_get_var (gimple *dbg)
4716 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4717 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4718 return gimple_op (dbg, 0);
4721 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4722 statement. */
4724 static inline tree
4725 gimple_debug_source_bind_get_value (gimple *dbg)
4727 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4728 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4729 return gimple_op (dbg, 1);
4732 /* Return a pointer to the value bound to the variable in a
4733 GIMPLE_DEBUG source bind statement. */
4735 static inline tree *
4736 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4738 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4739 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4740 return gimple_op_ptr (dbg, 1);
4743 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4745 static inline void
4746 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4748 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4749 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4750 gimple_set_op (dbg, 0, var);
4753 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4754 statement. */
4756 static inline void
4757 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4759 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4760 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4761 gimple_set_op (dbg, 1, value);
4764 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4766 static inline bool
4767 gimple_debug_begin_stmt_p (const gimple *s)
4769 if (is_gimple_debug (s))
4770 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4772 return false;
4775 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4777 static inline bool
4778 gimple_debug_inline_entry_p (const gimple *s)
4780 if (is_gimple_debug (s))
4781 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4783 return false;
4786 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4788 static inline bool
4789 gimple_debug_nonbind_marker_p (const gimple *s)
4791 if (is_gimple_debug (s))
4792 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
4793 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4795 return false;
4798 /* Return the line number for EXPR, or return -1 if we have no line
4799 number information for it. */
4800 static inline int
4801 get_lineno (const gimple *stmt)
4803 location_t loc;
4805 if (!stmt)
4806 return -1;
4808 loc = gimple_location (stmt);
4809 if (loc == UNKNOWN_LOCATION)
4810 return -1;
4812 return LOCATION_LINE (loc);
4815 /* Return a pointer to the body for the OMP statement GS. */
4817 static inline gimple_seq *
4818 gimple_omp_body_ptr (gimple *gs)
4820 return &static_cast <gimple_statement_omp *> (gs)->body;
4823 /* Return the body for the OMP statement GS. */
4825 static inline gimple_seq
4826 gimple_omp_body (gimple *gs)
4828 return *gimple_omp_body_ptr (gs);
4831 /* Set BODY to be the body for the OMP statement GS. */
4833 static inline void
4834 gimple_omp_set_body (gimple *gs, gimple_seq body)
4836 static_cast <gimple_statement_omp *> (gs)->body = body;
4840 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4842 static inline tree
4843 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4845 return crit_stmt->name;
4849 /* Return a pointer to the name associated with OMP critical statement
4850 CRIT_STMT. */
4852 static inline tree *
4853 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4855 return &crit_stmt->name;
4859 /* Set NAME to be the name associated with OMP critical statement
4860 CRIT_STMT. */
4862 static inline void
4863 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4865 crit_stmt->name = name;
4869 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4871 static inline tree
4872 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4874 return crit_stmt->clauses;
4878 /* Return a pointer to the clauses associated with OMP critical statement
4879 CRIT_STMT. */
4881 static inline tree *
4882 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4884 return &crit_stmt->clauses;
4888 /* Set CLAUSES to be the clauses associated with OMP critical statement
4889 CRIT_STMT. */
4891 static inline void
4892 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4894 crit_stmt->clauses = clauses;
4898 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4900 static inline tree
4901 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4903 return ord_stmt->clauses;
4907 /* Return a pointer to the clauses associated with OMP ordered statement
4908 ORD_STMT. */
4910 static inline tree *
4911 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4913 return &ord_stmt->clauses;
4917 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4918 ORD_STMT. */
4920 static inline void
4921 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4923 ord_stmt->clauses = clauses;
4927 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
4929 static inline tree
4930 gimple_omp_taskgroup_clauses (const gimple *gs)
4932 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
4933 return
4934 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
4938 /* Return a pointer to the clauses associated with OMP taskgroup statement
4939 GS. */
4941 static inline tree *
4942 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
4944 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
4945 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
4949 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
4950 GS. */
4952 static inline void
4953 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
4955 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
4956 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
4957 = clauses;
4961 /* Return the kind of the OMP_FOR statemement G. */
4963 static inline int
4964 gimple_omp_for_kind (const gimple *g)
4966 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4967 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4971 /* Set the kind of the OMP_FOR statement G. */
4973 static inline void
4974 gimple_omp_for_set_kind (gomp_for *g, int kind)
4976 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4977 | (kind & GF_OMP_FOR_KIND_MASK);
4981 /* Return true if OMP_FOR statement G has the
4982 GF_OMP_FOR_COMBINED flag set. */
4984 static inline bool
4985 gimple_omp_for_combined_p (const gimple *g)
4987 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4988 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4992 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4993 the boolean value of COMBINED_P. */
4995 static inline void
4996 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4998 if (combined_p)
4999 g->subcode |= GF_OMP_FOR_COMBINED;
5000 else
5001 g->subcode &= ~GF_OMP_FOR_COMBINED;
5005 /* Return true if the OMP_FOR statement G has the
5006 GF_OMP_FOR_COMBINED_INTO flag set. */
5008 static inline bool
5009 gimple_omp_for_combined_into_p (const gimple *g)
5011 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5012 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5016 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5017 on the boolean value of COMBINED_P. */
5019 static inline void
5020 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5022 if (combined_p)
5023 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5024 else
5025 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5029 /* Return the clauses associated with the OMP_FOR statement GS. */
5031 static inline tree
5032 gimple_omp_for_clauses (const gimple *gs)
5034 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5035 return omp_for_stmt->clauses;
5039 /* Return a pointer to the clauses associated with the OMP_FOR statement
5040 GS. */
5042 static inline tree *
5043 gimple_omp_for_clauses_ptr (gimple *gs)
5045 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5046 return &omp_for_stmt->clauses;
5050 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5051 GS. */
5053 static inline void
5054 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5056 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5057 omp_for_stmt->clauses = clauses;
5061 /* Get the collapse count of the OMP_FOR statement GS. */
5063 static inline size_t
5064 gimple_omp_for_collapse (gimple *gs)
5066 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5067 return omp_for_stmt->collapse;
5071 /* Return the condition code associated with the OMP_FOR statement GS. */
5073 static inline enum tree_code
5074 gimple_omp_for_cond (const gimple *gs, size_t i)
5076 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5077 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5078 return omp_for_stmt->iter[i].cond;
5082 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5084 static inline void
5085 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5087 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5088 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5089 && i < omp_for_stmt->collapse);
5090 omp_for_stmt->iter[i].cond = cond;
5094 /* Return the index variable for the OMP_FOR statement GS. */
5096 static inline tree
5097 gimple_omp_for_index (const gimple *gs, size_t i)
5099 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5100 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5101 return omp_for_stmt->iter[i].index;
5105 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5107 static inline tree *
5108 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5110 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5111 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5112 return &omp_for_stmt->iter[i].index;
5116 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5118 static inline void
5119 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5121 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5122 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5123 omp_for_stmt->iter[i].index = index;
5127 /* Return the initial value for the OMP_FOR statement GS. */
5129 static inline tree
5130 gimple_omp_for_initial (const gimple *gs, size_t i)
5132 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5133 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5134 return omp_for_stmt->iter[i].initial;
5138 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5140 static inline tree *
5141 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5143 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5144 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5145 return &omp_for_stmt->iter[i].initial;
5149 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5151 static inline void
5152 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5154 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5155 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5156 omp_for_stmt->iter[i].initial = initial;
5160 /* Return the final value for the OMP_FOR statement GS. */
5162 static inline tree
5163 gimple_omp_for_final (const gimple *gs, size_t i)
5165 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5166 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5167 return omp_for_stmt->iter[i].final;
5171 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5173 static inline tree *
5174 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5176 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5177 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5178 return &omp_for_stmt->iter[i].final;
5182 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5184 static inline void
5185 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5187 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5188 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5189 omp_for_stmt->iter[i].final = final;
5193 /* Return the increment value for the OMP_FOR statement GS. */
5195 static inline tree
5196 gimple_omp_for_incr (const gimple *gs, size_t i)
5198 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5199 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5200 return omp_for_stmt->iter[i].incr;
5204 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5206 static inline tree *
5207 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5209 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5210 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5211 return &omp_for_stmt->iter[i].incr;
5215 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5217 static inline void
5218 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5220 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5221 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5222 omp_for_stmt->iter[i].incr = incr;
5226 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5227 statement GS starts. */
5229 static inline gimple_seq *
5230 gimple_omp_for_pre_body_ptr (gimple *gs)
5232 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5233 return &omp_for_stmt->pre_body;
5237 /* Return the sequence of statements to execute before the OMP_FOR
5238 statement GS starts. */
5240 static inline gimple_seq
5241 gimple_omp_for_pre_body (gimple *gs)
5243 return *gimple_omp_for_pre_body_ptr (gs);
5247 /* Set PRE_BODY to be the sequence of statements to execute before the
5248 OMP_FOR statement GS starts. */
5250 static inline void
5251 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5253 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5254 omp_for_stmt->pre_body = pre_body;
5257 /* Return the kernel_phony of OMP_FOR statement. */
5259 static inline bool
5260 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5262 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5263 != GF_OMP_FOR_KIND_GRID_LOOP);
5264 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5267 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5269 static inline void
5270 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5272 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5273 != GF_OMP_FOR_KIND_GRID_LOOP);
5274 if (value)
5275 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5276 else
5277 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5280 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5282 static inline bool
5283 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5285 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5286 == GF_OMP_FOR_KIND_GRID_LOOP);
5287 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5290 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5292 static inline void
5293 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5295 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5296 == GF_OMP_FOR_KIND_GRID_LOOP);
5297 if (value)
5298 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5299 else
5300 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5303 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5304 groups. */
5306 static inline bool
5307 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5309 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5310 == GF_OMP_FOR_KIND_GRID_LOOP);
5311 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5314 /* Set group_iter flag of OMP_FOR to VALUE. */
5316 static inline void
5317 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5319 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5320 == GF_OMP_FOR_KIND_GRID_LOOP);
5321 if (value)
5322 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5323 else
5324 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5327 /* Return the clauses associated with OMP_PARALLEL GS. */
5329 static inline tree
5330 gimple_omp_parallel_clauses (const gimple *gs)
5332 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5333 return omp_parallel_stmt->clauses;
5337 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5339 static inline tree *
5340 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5342 return &omp_parallel_stmt->clauses;
5346 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5348 static inline void
5349 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5350 tree clauses)
5352 omp_parallel_stmt->clauses = clauses;
5356 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5358 static inline tree
5359 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5361 return omp_parallel_stmt->child_fn;
5364 /* Return a pointer to the child function used to hold the body of
5365 OMP_PARALLEL_STMT. */
5367 static inline tree *
5368 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5370 return &omp_parallel_stmt->child_fn;
5374 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5376 static inline void
5377 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5378 tree child_fn)
5380 omp_parallel_stmt->child_fn = child_fn;
5384 /* Return the artificial argument used to send variables and values
5385 from the parent to the children threads in OMP_PARALLEL_STMT. */
5387 static inline tree
5388 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5390 return omp_parallel_stmt->data_arg;
5394 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5396 static inline tree *
5397 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5399 return &omp_parallel_stmt->data_arg;
5403 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5405 static inline void
5406 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5407 tree data_arg)
5409 omp_parallel_stmt->data_arg = data_arg;
5412 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5414 static inline bool
5415 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5417 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5420 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5422 static inline void
5423 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5425 if (value)
5426 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5427 else
5428 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5431 /* Return the clauses associated with OMP_TASK GS. */
5433 static inline tree
5434 gimple_omp_task_clauses (const gimple *gs)
5436 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5437 return omp_task_stmt->clauses;
5441 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5443 static inline tree *
5444 gimple_omp_task_clauses_ptr (gimple *gs)
5446 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5447 return &omp_task_stmt->clauses;
5451 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5452 GS. */
5454 static inline void
5455 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5457 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5458 omp_task_stmt->clauses = clauses;
5462 /* Return true if OMP task statement G has the
5463 GF_OMP_TASK_TASKLOOP flag set. */
5465 static inline bool
5466 gimple_omp_task_taskloop_p (const gimple *g)
5468 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5469 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5473 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5474 value of TASKLOOP_P. */
5476 static inline void
5477 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5479 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5480 if (taskloop_p)
5481 g->subcode |= GF_OMP_TASK_TASKLOOP;
5482 else
5483 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5487 /* Return true if OMP task statement G has the
5488 GF_OMP_TASK_TASKWAIT flag set. */
5490 static inline bool
5491 gimple_omp_task_taskwait_p (const gimple *g)
5493 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5494 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5498 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5499 value of TASKWAIT_P. */
5501 static inline void
5502 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5504 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5505 if (taskwait_p)
5506 g->subcode |= GF_OMP_TASK_TASKWAIT;
5507 else
5508 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5512 /* Return the child function used to hold the body of OMP_TASK GS. */
5514 static inline tree
5515 gimple_omp_task_child_fn (const gimple *gs)
5517 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5518 return omp_task_stmt->child_fn;
5521 /* Return a pointer to the child function used to hold the body of
5522 OMP_TASK GS. */
5524 static inline tree *
5525 gimple_omp_task_child_fn_ptr (gimple *gs)
5527 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5528 return &omp_task_stmt->child_fn;
5532 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5534 static inline void
5535 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5537 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5538 omp_task_stmt->child_fn = child_fn;
5542 /* Return the artificial argument used to send variables and values
5543 from the parent to the children threads in OMP_TASK GS. */
5545 static inline tree
5546 gimple_omp_task_data_arg (const gimple *gs)
5548 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5549 return omp_task_stmt->data_arg;
5553 /* Return a pointer to the data argument for OMP_TASK GS. */
5555 static inline tree *
5556 gimple_omp_task_data_arg_ptr (gimple *gs)
5558 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5559 return &omp_task_stmt->data_arg;
5563 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5565 static inline void
5566 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5568 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5569 omp_task_stmt->data_arg = data_arg;
5573 /* Return the clauses associated with OMP_TASK GS. */
5575 static inline tree
5576 gimple_omp_taskreg_clauses (const gimple *gs)
5578 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5579 = as_a <const gimple_statement_omp_taskreg *> (gs);
5580 return omp_taskreg_stmt->clauses;
5584 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5586 static inline tree *
5587 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5589 gimple_statement_omp_taskreg *omp_taskreg_stmt
5590 = as_a <gimple_statement_omp_taskreg *> (gs);
5591 return &omp_taskreg_stmt->clauses;
5595 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5596 GS. */
5598 static inline void
5599 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5601 gimple_statement_omp_taskreg *omp_taskreg_stmt
5602 = as_a <gimple_statement_omp_taskreg *> (gs);
5603 omp_taskreg_stmt->clauses = clauses;
5607 /* Return the child function used to hold the body of OMP_TASK GS. */
5609 static inline tree
5610 gimple_omp_taskreg_child_fn (const gimple *gs)
5612 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5613 = as_a <const gimple_statement_omp_taskreg *> (gs);
5614 return omp_taskreg_stmt->child_fn;
5617 /* Return a pointer to the child function used to hold the body of
5618 OMP_TASK GS. */
5620 static inline tree *
5621 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5623 gimple_statement_omp_taskreg *omp_taskreg_stmt
5624 = as_a <gimple_statement_omp_taskreg *> (gs);
5625 return &omp_taskreg_stmt->child_fn;
5629 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5631 static inline void
5632 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5634 gimple_statement_omp_taskreg *omp_taskreg_stmt
5635 = as_a <gimple_statement_omp_taskreg *> (gs);
5636 omp_taskreg_stmt->child_fn = child_fn;
5640 /* Return the artificial argument used to send variables and values
5641 from the parent to the children threads in OMP_TASK GS. */
5643 static inline tree
5644 gimple_omp_taskreg_data_arg (const gimple *gs)
5646 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5647 = as_a <const gimple_statement_omp_taskreg *> (gs);
5648 return omp_taskreg_stmt->data_arg;
5652 /* Return a pointer to the data argument for OMP_TASK GS. */
5654 static inline tree *
5655 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5657 gimple_statement_omp_taskreg *omp_taskreg_stmt
5658 = as_a <gimple_statement_omp_taskreg *> (gs);
5659 return &omp_taskreg_stmt->data_arg;
5663 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5665 static inline void
5666 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5668 gimple_statement_omp_taskreg *omp_taskreg_stmt
5669 = as_a <gimple_statement_omp_taskreg *> (gs);
5670 omp_taskreg_stmt->data_arg = data_arg;
5674 /* Return the copy function used to hold the body of OMP_TASK GS. */
5676 static inline tree
5677 gimple_omp_task_copy_fn (const gimple *gs)
5679 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5680 return omp_task_stmt->copy_fn;
5683 /* Return a pointer to the copy function used to hold the body of
5684 OMP_TASK GS. */
5686 static inline tree *
5687 gimple_omp_task_copy_fn_ptr (gimple *gs)
5689 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5690 return &omp_task_stmt->copy_fn;
5694 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5696 static inline void
5697 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5699 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5700 omp_task_stmt->copy_fn = copy_fn;
5704 /* Return size of the data block in bytes in OMP_TASK GS. */
5706 static inline tree
5707 gimple_omp_task_arg_size (const gimple *gs)
5709 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5710 return omp_task_stmt->arg_size;
5714 /* Return a pointer to the data block size for OMP_TASK GS. */
5716 static inline tree *
5717 gimple_omp_task_arg_size_ptr (gimple *gs)
5719 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5720 return &omp_task_stmt->arg_size;
5724 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5726 static inline void
5727 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5729 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5730 omp_task_stmt->arg_size = arg_size;
5734 /* Return align of the data block in bytes in OMP_TASK GS. */
5736 static inline tree
5737 gimple_omp_task_arg_align (const gimple *gs)
5739 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5740 return omp_task_stmt->arg_align;
5744 /* Return a pointer to the data block align for OMP_TASK GS. */
5746 static inline tree *
5747 gimple_omp_task_arg_align_ptr (gimple *gs)
5749 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5750 return &omp_task_stmt->arg_align;
5754 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5756 static inline void
5757 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5759 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5760 omp_task_stmt->arg_align = arg_align;
5764 /* Return the clauses associated with OMP_SINGLE GS. */
5766 static inline tree
5767 gimple_omp_single_clauses (const gimple *gs)
5769 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5770 return omp_single_stmt->clauses;
5774 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5776 static inline tree *
5777 gimple_omp_single_clauses_ptr (gimple *gs)
5779 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5780 return &omp_single_stmt->clauses;
5784 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5786 static inline void
5787 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5789 omp_single_stmt->clauses = clauses;
5793 /* Return the clauses associated with OMP_TARGET GS. */
5795 static inline tree
5796 gimple_omp_target_clauses (const gimple *gs)
5798 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5799 return omp_target_stmt->clauses;
5803 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5805 static inline tree *
5806 gimple_omp_target_clauses_ptr (gimple *gs)
5808 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5809 return &omp_target_stmt->clauses;
5813 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5815 static inline void
5816 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5817 tree clauses)
5819 omp_target_stmt->clauses = clauses;
5823 /* Return the kind of the OMP_TARGET G. */
5825 static inline int
5826 gimple_omp_target_kind (const gimple *g)
5828 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5829 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5833 /* Set the kind of the OMP_TARGET G. */
5835 static inline void
5836 gimple_omp_target_set_kind (gomp_target *g, int kind)
5838 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5839 | (kind & GF_OMP_TARGET_KIND_MASK);
5843 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5845 static inline tree
5846 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5848 return omp_target_stmt->child_fn;
5851 /* Return a pointer to the child function used to hold the body of
5852 OMP_TARGET_STMT. */
5854 static inline tree *
5855 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5857 return &omp_target_stmt->child_fn;
5861 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5863 static inline void
5864 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5865 tree child_fn)
5867 omp_target_stmt->child_fn = child_fn;
5871 /* Return the artificial argument used to send variables and values
5872 from the parent to the children threads in OMP_TARGET_STMT. */
5874 static inline tree
5875 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5877 return omp_target_stmt->data_arg;
5881 /* Return a pointer to the data argument for OMP_TARGET GS. */
5883 static inline tree *
5884 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5886 return &omp_target_stmt->data_arg;
5890 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5892 static inline void
5893 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5894 tree data_arg)
5896 omp_target_stmt->data_arg = data_arg;
5900 /* Return the clauses associated with OMP_TEAMS GS. */
5902 static inline tree
5903 gimple_omp_teams_clauses (const gimple *gs)
5905 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5906 return omp_teams_stmt->clauses;
5910 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5912 static inline tree *
5913 gimple_omp_teams_clauses_ptr (gimple *gs)
5915 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5916 return &omp_teams_stmt->clauses;
5920 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5922 static inline void
5923 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5925 omp_teams_stmt->clauses = clauses;
5928 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
5930 static inline tree
5931 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
5933 return omp_teams_stmt->child_fn;
5936 /* Return a pointer to the child function used to hold the body of
5937 OMP_TEAMS_STMT. */
5939 static inline tree *
5940 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
5942 return &omp_teams_stmt->child_fn;
5946 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
5948 static inline void
5949 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
5951 omp_teams_stmt->child_fn = child_fn;
5955 /* Return the artificial argument used to send variables and values
5956 from the parent to the children threads in OMP_TEAMS_STMT. */
5958 static inline tree
5959 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
5961 return omp_teams_stmt->data_arg;
5965 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
5967 static inline tree *
5968 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
5970 return &omp_teams_stmt->data_arg;
5974 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
5976 static inline void
5977 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
5979 omp_teams_stmt->data_arg = data_arg;
5982 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5984 static inline bool
5985 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5987 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5990 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5992 static inline void
5993 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5995 if (value)
5996 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5997 else
5998 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
6001 /* Return the host flag of an OMP_TEAMS_STMT. */
6003 static inline bool
6004 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6006 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6009 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6011 static inline void
6012 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6014 if (value)
6015 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6016 else
6017 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6020 /* Return the clauses associated with OMP_SECTIONS GS. */
6022 static inline tree
6023 gimple_omp_sections_clauses (const gimple *gs)
6025 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6026 return omp_sections_stmt->clauses;
6030 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6032 static inline tree *
6033 gimple_omp_sections_clauses_ptr (gimple *gs)
6035 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6036 return &omp_sections_stmt->clauses;
6040 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6041 GS. */
6043 static inline void
6044 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6046 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6047 omp_sections_stmt->clauses = clauses;
6051 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6052 in GS. */
6054 static inline tree
6055 gimple_omp_sections_control (const gimple *gs)
6057 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6058 return omp_sections_stmt->control;
6062 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6063 GS. */
6065 static inline tree *
6066 gimple_omp_sections_control_ptr (gimple *gs)
6068 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6069 return &omp_sections_stmt->control;
6073 /* Set CONTROL to be the set of clauses associated with the
6074 GIMPLE_OMP_SECTIONS in GS. */
6076 static inline void
6077 gimple_omp_sections_set_control (gimple *gs, tree control)
6079 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6080 omp_sections_stmt->control = control;
6084 /* Set the value being stored in an atomic store. */
6086 static inline void
6087 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6089 store_stmt->val = val;
6093 /* Return the value being stored in an atomic store. */
6095 static inline tree
6096 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6098 return store_stmt->val;
6102 /* Return a pointer to the value being stored in an atomic store. */
6104 static inline tree *
6105 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6107 return &store_stmt->val;
6111 /* Set the LHS of an atomic load. */
6113 static inline void
6114 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6116 load_stmt->lhs = lhs;
6120 /* Get the LHS of an atomic load. */
6122 static inline tree
6123 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6125 return load_stmt->lhs;
6129 /* Return a pointer to the LHS of an atomic load. */
6131 static inline tree *
6132 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6134 return &load_stmt->lhs;
6138 /* Set the RHS of an atomic load. */
6140 static inline void
6141 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6143 load_stmt->rhs = rhs;
6147 /* Get the RHS of an atomic load. */
6149 static inline tree
6150 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6152 return load_stmt->rhs;
6156 /* Return a pointer to the RHS of an atomic load. */
6158 static inline tree *
6159 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6161 return &load_stmt->rhs;
6165 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6167 static inline tree
6168 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6170 return cont_stmt->control_def;
6173 /* The same as above, but return the address. */
6175 static inline tree *
6176 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6178 return &cont_stmt->control_def;
6181 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6183 static inline void
6184 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6186 cont_stmt->control_def = def;
6190 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6192 static inline tree
6193 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6195 return cont_stmt->control_use;
6199 /* The same as above, but return the address. */
6201 static inline tree *
6202 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6204 return &cont_stmt->control_use;
6208 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6210 static inline void
6211 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6213 cont_stmt->control_use = use;
6216 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6217 TRANSACTION_STMT. */
6219 static inline gimple_seq *
6220 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6222 return &transaction_stmt->body;
6225 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6227 static inline gimple_seq
6228 gimple_transaction_body (gtransaction *transaction_stmt)
6230 return transaction_stmt->body;
6233 /* Return the label associated with a GIMPLE_TRANSACTION. */
6235 static inline tree
6236 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6238 return transaction_stmt->label_norm;
6241 static inline tree *
6242 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6244 return &transaction_stmt->label_norm;
6247 static inline tree
6248 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6250 return transaction_stmt->label_uninst;
6253 static inline tree *
6254 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6256 return &transaction_stmt->label_uninst;
6259 static inline tree
6260 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6262 return transaction_stmt->label_over;
6265 static inline tree *
6266 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6268 return &transaction_stmt->label_over;
6271 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6273 static inline unsigned int
6274 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6276 return transaction_stmt->subcode;
6279 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6280 TRANSACTION_STMT. */
6282 static inline void
6283 gimple_transaction_set_body (gtransaction *transaction_stmt,
6284 gimple_seq body)
6286 transaction_stmt->body = body;
6289 /* Set the label associated with a GIMPLE_TRANSACTION. */
6291 static inline void
6292 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6294 transaction_stmt->label_norm = label;
6297 static inline void
6298 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6300 transaction_stmt->label_uninst = label;
6303 static inline void
6304 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6306 transaction_stmt->label_over = label;
6309 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6311 static inline void
6312 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6313 unsigned int subcode)
6315 transaction_stmt->subcode = subcode;
6318 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6320 static inline tree *
6321 gimple_return_retval_ptr (greturn *gs)
6323 return &gs->op[0];
6326 /* Return the return value for GIMPLE_RETURN GS. */
6328 static inline tree
6329 gimple_return_retval (const greturn *gs)
6331 return gs->op[0];
6335 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6337 static inline void
6338 gimple_return_set_retval (greturn *gs, tree retval)
6340 gs->op[0] = retval;
6344 /* Returns true when the gimple statement STMT is any of the OMP types. */
6346 #define CASE_GIMPLE_OMP \
6347 case GIMPLE_OMP_PARALLEL: \
6348 case GIMPLE_OMP_TASK: \
6349 case GIMPLE_OMP_FOR: \
6350 case GIMPLE_OMP_SECTIONS: \
6351 case GIMPLE_OMP_SECTIONS_SWITCH: \
6352 case GIMPLE_OMP_SINGLE: \
6353 case GIMPLE_OMP_TARGET: \
6354 case GIMPLE_OMP_TEAMS: \
6355 case GIMPLE_OMP_SECTION: \
6356 case GIMPLE_OMP_MASTER: \
6357 case GIMPLE_OMP_TASKGROUP: \
6358 case GIMPLE_OMP_ORDERED: \
6359 case GIMPLE_OMP_CRITICAL: \
6360 case GIMPLE_OMP_RETURN: \
6361 case GIMPLE_OMP_ATOMIC_LOAD: \
6362 case GIMPLE_OMP_ATOMIC_STORE: \
6363 case GIMPLE_OMP_CONTINUE: \
6364 case GIMPLE_OMP_GRID_BODY
6366 static inline bool
6367 is_gimple_omp (const gimple *stmt)
6369 switch (gimple_code (stmt))
6371 CASE_GIMPLE_OMP:
6372 return true;
6373 default:
6374 return false;
6378 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6379 specifically. */
6381 static inline bool
6382 is_gimple_omp_oacc (const gimple *stmt)
6384 gcc_assert (is_gimple_omp (stmt));
6385 switch (gimple_code (stmt))
6387 case GIMPLE_OMP_FOR:
6388 switch (gimple_omp_for_kind (stmt))
6390 case GF_OMP_FOR_KIND_OACC_LOOP:
6391 return true;
6392 default:
6393 return false;
6395 case GIMPLE_OMP_TARGET:
6396 switch (gimple_omp_target_kind (stmt))
6398 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6399 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6400 case GF_OMP_TARGET_KIND_OACC_DATA:
6401 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6402 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6403 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6404 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6405 return true;
6406 default:
6407 return false;
6409 default:
6410 return false;
6415 /* Return true if the OMP gimple statement STMT is offloaded. */
6417 static inline bool
6418 is_gimple_omp_offloaded (const gimple *stmt)
6420 gcc_assert (is_gimple_omp (stmt));
6421 switch (gimple_code (stmt))
6423 case GIMPLE_OMP_TARGET:
6424 switch (gimple_omp_target_kind (stmt))
6426 case GF_OMP_TARGET_KIND_REGION:
6427 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6428 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6429 return true;
6430 default:
6431 return false;
6433 default:
6434 return false;
6439 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6441 static inline bool
6442 gimple_nop_p (const gimple *g)
6444 return gimple_code (g) == GIMPLE_NOP;
6448 /* Return true if GS is a GIMPLE_RESX. */
6450 static inline bool
6451 is_gimple_resx (const gimple *gs)
6453 return gimple_code (gs) == GIMPLE_RESX;
6456 /* Return the type of the main expression computed by STMT. Return
6457 void_type_node if the statement computes nothing. */
6459 static inline tree
6460 gimple_expr_type (const gimple *stmt)
6462 enum gimple_code code = gimple_code (stmt);
6463 /* In general we want to pass out a type that can be substituted
6464 for both the RHS and the LHS types if there is a possibly
6465 useless conversion involved. That means returning the
6466 original RHS type as far as we can reconstruct it. */
6467 if (code == GIMPLE_CALL)
6469 const gcall *call_stmt = as_a <const gcall *> (stmt);
6470 if (gimple_call_internal_p (call_stmt))
6471 switch (gimple_call_internal_fn (call_stmt))
6473 case IFN_MASK_STORE:
6474 case IFN_SCATTER_STORE:
6475 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6476 case IFN_MASK_SCATTER_STORE:
6477 return TREE_TYPE (gimple_call_arg (call_stmt, 4));
6478 default:
6479 break;
6481 return gimple_call_return_type (call_stmt);
6483 else if (code == GIMPLE_ASSIGN)
6485 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6486 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6487 else
6488 /* As fallback use the type of the LHS. */
6489 return TREE_TYPE (gimple_get_lhs (stmt));
6491 else if (code == GIMPLE_COND)
6492 return boolean_type_node;
6493 else
6494 return void_type_node;
6497 /* Enum and arrays used for allocation stats. Keep in sync with
6498 gimple.c:gimple_alloc_kind_names. */
6499 enum gimple_alloc_kind
6501 gimple_alloc_kind_assign, /* Assignments. */
6502 gimple_alloc_kind_phi, /* PHI nodes. */
6503 gimple_alloc_kind_cond, /* Conditionals. */
6504 gimple_alloc_kind_rest, /* Everything else. */
6505 gimple_alloc_kind_all
6508 extern uint64_t gimple_alloc_counts[];
6509 extern uint64_t gimple_alloc_sizes[];
6511 /* Return the allocation kind for a given stmt CODE. */
6512 static inline enum gimple_alloc_kind
6513 gimple_alloc_kind (enum gimple_code code)
6515 switch (code)
6517 case GIMPLE_ASSIGN:
6518 return gimple_alloc_kind_assign;
6519 case GIMPLE_PHI:
6520 return gimple_alloc_kind_phi;
6521 case GIMPLE_COND:
6522 return gimple_alloc_kind_cond;
6523 default:
6524 return gimple_alloc_kind_rest;
6528 /* Return true if a location should not be emitted for this statement
6529 by annotate_all_with_location. */
6531 static inline bool
6532 gimple_do_not_emit_location_p (gimple *g)
6534 return gimple_plf (g, GF_PLF_1);
6537 /* Mark statement G so a location will not be emitted by
6538 annotate_one_with_location. */
6540 static inline void
6541 gimple_set_do_not_emit_location (gimple *g)
6543 /* The PLF flags are initialized to 0 when a new tuple is created,
6544 so no need to initialize it anywhere. */
6545 gimple_set_plf (g, GF_PLF_1, true);
6548 #endif /* GCC_GIMPLE_H */