Fix PR 93568 (thinko)
[official-gcc.git] / gcc / gimple.h
blob192f19ad23ab8fee8ff6f73087de98c39f11ced0
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2020 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN \
50 ATTRIBUTE_COLD;
52 #define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59 template <typename T>
60 static inline T
61 GIMPLE_CHECK2(const gimple *gs,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66 #else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70 #endif
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
75 remove_pointer<T>::type::code_, ERROR_MARK);
76 return ret;
78 template <typename T>
79 static inline T
80 GIMPLE_CHECK2(gimple *gs,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85 #else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89 #endif
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
94 remove_pointer<T>::type::code_, ERROR_MARK);
95 return ret;
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T>
101 static inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 static inline T
108 GIMPLE_CHECK2(const gimple *gs)
110 return as_a <T> (gs);
112 #endif
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1,
140 GF_ASM_INLINE = 1 << 2,
141 GF_CALL_FROM_THUNK = 1 << 0,
142 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
143 GF_CALL_TAILCALL = 1 << 2,
144 GF_CALL_VA_ARG_PACK = 1 << 3,
145 GF_CALL_NOTHROW = 1 << 4,
146 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
147 GF_CALL_INTERNAL = 1 << 6,
148 GF_CALL_CTRL_ALTERING = 1 << 7,
149 GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 GF_CALL_NOCF_CHECK = 1 << 11,
152 GF_OMP_PARALLEL_COMBINED = 1 << 0,
153 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
154 GF_OMP_TASK_TASKLOOP = 1 << 0,
155 GF_OMP_TASK_TASKWAIT = 1 << 1,
156 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
157 GF_OMP_FOR_KIND_FOR = 0,
158 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
159 GF_OMP_FOR_KIND_TASKLOOP = 2,
160 GF_OMP_FOR_KIND_OACC_LOOP = 4,
161 GF_OMP_FOR_KIND_GRID_LOOP = 5,
162 GF_OMP_FOR_KIND_SIMD = 6,
163 GF_OMP_FOR_COMBINED = 1 << 3,
164 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
165 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
166 statements. */
167 GF_OMP_FOR_GRID_PHONY = 1 << 5,
168 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
169 loop statements. */
170 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 5,
171 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 6,
172 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
173 GF_OMP_TARGET_KIND_REGION = 0,
174 GF_OMP_TARGET_KIND_DATA = 1,
175 GF_OMP_TARGET_KIND_UPDATE = 2,
176 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
177 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
178 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
179 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
180 GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
181 GF_OMP_TARGET_KIND_OACC_DATA = 8,
182 GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
183 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 10,
184 GF_OMP_TARGET_KIND_OACC_DECLARE = 11,
185 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 12,
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,
744 GIMPLE_OMP_SCAN. */
746 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
747 gimple_statement_omp_single_layout : public gimple_statement_omp
749 /* [ WORD 1-7 ] : base class */
751 /* [ WORD 8 ] */
752 tree clauses;
755 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
756 gomp_single : public gimple_statement_omp_single_layout
758 /* No extra fields; adds invariant:
759 stmt->code == GIMPLE_OMP_SINGLE. */
762 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
763 gomp_teams : public gimple_statement_omp_taskreg
765 /* No extra fields; adds invariant:
766 stmt->code == GIMPLE_OMP_TEAMS. */
769 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
770 gomp_ordered : public gimple_statement_omp_single_layout
772 /* No extra fields; adds invariant:
773 stmt->code == GIMPLE_OMP_ORDERED. */
776 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
777 gomp_scan : public gimple_statement_omp_single_layout
779 /* No extra fields; adds invariant:
780 stmt->code == GIMPLE_OMP_SCAN. */
784 /* GIMPLE_OMP_ATOMIC_LOAD.
785 Note: This is based on gimple, not g_s_omp, because g_s_omp
786 contains a sequence, which we don't need here. */
788 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
789 gomp_atomic_load : public gimple
791 /* [ WORD 1-6 ] : base class */
793 /* [ WORD 7-8 ] */
794 tree rhs, lhs;
797 /* GIMPLE_OMP_ATOMIC_STORE.
798 See note on GIMPLE_OMP_ATOMIC_LOAD. */
800 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 gimple_statement_omp_atomic_store_layout : public gimple
803 /* [ WORD 1-6 ] : base class */
805 /* [ WORD 7 ] */
806 tree val;
809 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
810 gomp_atomic_store :
811 public gimple_statement_omp_atomic_store_layout
813 /* No extra fields; adds invariant:
814 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
817 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
818 gimple_statement_omp_return :
819 public gimple_statement_omp_atomic_store_layout
821 /* No extra fields; adds invariant:
822 stmt->code == GIMPLE_OMP_RETURN. */
825 /* GIMPLE_TRANSACTION. */
827 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
829 /* The __transaction_atomic was declared [[outer]] or it is
830 __transaction_relaxed. */
831 #define GTMA_IS_OUTER (1u << 0)
832 #define GTMA_IS_RELAXED (1u << 1)
833 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
835 /* The transaction is seen to not have an abort. */
836 #define GTMA_HAVE_ABORT (1u << 2)
837 /* The transaction is seen to have loads or stores. */
838 #define GTMA_HAVE_LOAD (1u << 3)
839 #define GTMA_HAVE_STORE (1u << 4)
840 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
841 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
842 /* The transaction WILL enter serial irrevocable mode.
843 An irrevocable block post-dominates the entire transaction, such
844 that all invocations of the transaction will go serial-irrevocable.
845 In such case, we don't bother instrumenting the transaction, and
846 tell the runtime that it should begin the transaction in
847 serial-irrevocable mode. */
848 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
849 /* The transaction contains no instrumentation code whatsover, most
850 likely because it is guaranteed to go irrevocable upon entry. */
851 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
853 struct GTY((tag("GSS_TRANSACTION")))
854 gtransaction : public gimple_statement_with_memory_ops_base
856 /* [ WORD 1-9 ] : base class */
858 /* [ WORD 10 ] */
859 gimple_seq body;
861 /* [ WORD 11-13 ] */
862 tree label_norm;
863 tree label_uninst;
864 tree label_over;
867 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
868 enum gimple_statement_structure_enum {
869 #include "gsstruct.def"
870 LAST_GSS_ENUM
872 #undef DEFGSSTRUCT
874 /* A statement with the invariant that
875 stmt->code == GIMPLE_COND
876 i.e. a conditional jump statement. */
878 struct GTY((tag("GSS_WITH_OPS")))
879 gcond : public gimple_statement_with_ops
881 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
882 static const enum gimple_code code_ = GIMPLE_COND;
885 /* A statement with the invariant that
886 stmt->code == GIMPLE_DEBUG
887 i.e. a debug statement. */
889 struct GTY((tag("GSS_WITH_OPS")))
890 gdebug : public gimple_statement_with_ops
892 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
895 /* A statement with the invariant that
896 stmt->code == GIMPLE_GOTO
897 i.e. a goto statement. */
899 struct GTY((tag("GSS_WITH_OPS")))
900 ggoto : public gimple_statement_with_ops
902 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
905 /* A statement with the invariant that
906 stmt->code == GIMPLE_LABEL
907 i.e. a label statement. */
909 struct GTY((tag("GSS_WITH_OPS")))
910 glabel : public gimple_statement_with_ops
912 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
915 /* A statement with the invariant that
916 stmt->code == GIMPLE_SWITCH
917 i.e. a switch statement. */
919 struct GTY((tag("GSS_WITH_OPS")))
920 gswitch : public gimple_statement_with_ops
922 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
925 /* A statement with the invariant that
926 stmt->code == GIMPLE_ASSIGN
927 i.e. an assignment statement. */
929 struct GTY((tag("GSS_WITH_MEM_OPS")))
930 gassign : public gimple_statement_with_memory_ops
932 static const enum gimple_code code_ = GIMPLE_ASSIGN;
933 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
936 /* A statement with the invariant that
937 stmt->code == GIMPLE_RETURN
938 i.e. a return statement. */
940 struct GTY((tag("GSS_WITH_MEM_OPS")))
941 greturn : public gimple_statement_with_memory_ops
943 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gasm *>::test (gimple *gs)
951 return gs->code == GIMPLE_ASM;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <gassign *>::test (gimple *gs)
959 return gs->code == GIMPLE_ASSIGN;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <const gassign *>::test (const gimple *gs)
967 return gs->code == GIMPLE_ASSIGN;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gbind *>::test (gimple *gs)
975 return gs->code == GIMPLE_BIND;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <gcall *>::test (gimple *gs)
983 return gs->code == GIMPLE_CALL;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <gcatch *>::test (gimple *gs)
991 return gs->code == GIMPLE_CATCH;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <gcond *>::test (gimple *gs)
999 return gs->code == GIMPLE_COND;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <const gcond *>::test (const gimple *gs)
1007 return gs->code == GIMPLE_COND;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <gdebug *>::test (gimple *gs)
1015 return gs->code == GIMPLE_DEBUG;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <const gdebug *>::test (const gimple *gs)
1023 return gs->code == GIMPLE_DEBUG;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <ggoto *>::test (gimple *gs)
1031 return gs->code == GIMPLE_GOTO;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <const ggoto *>::test (const gimple *gs)
1039 return gs->code == GIMPLE_GOTO;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <glabel *>::test (gimple *gs)
1047 return gs->code == GIMPLE_LABEL;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <const glabel *>::test (const gimple *gs)
1055 return gs->code == GIMPLE_LABEL;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <gresx *>::test (gimple *gs)
1063 return gs->code == GIMPLE_RESX;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <geh_dispatch *>::test (gimple *gs)
1071 return gs->code == GIMPLE_EH_DISPATCH;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <geh_else *>::test (gimple *gs)
1079 return gs->code == GIMPLE_EH_ELSE;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <const geh_else *>::test (const gimple *gs)
1087 return gs->code == GIMPLE_EH_ELSE;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <geh_filter *>::test (gimple *gs)
1095 return gs->code == GIMPLE_EH_FILTER;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <geh_mnt *>::test (gimple *gs)
1103 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1111 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1119 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1127 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1135 return gs->code == GIMPLE_OMP_RETURN;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <gomp_continue *>::test (gimple *gs)
1143 return gs->code == GIMPLE_OMP_CONTINUE;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <gomp_critical *>::test (gimple *gs)
1151 return gs->code == GIMPLE_OMP_CRITICAL;
1154 template <>
1155 template <>
1156 inline bool
1157 is_a_helper <gomp_ordered *>::test (gimple *gs)
1159 return gs->code == GIMPLE_OMP_ORDERED;
1162 template <>
1163 template <>
1164 inline bool
1165 is_a_helper <gomp_scan *>::test (gimple *gs)
1167 return gs->code == GIMPLE_OMP_SCAN;
1170 template <>
1171 template <>
1172 inline bool
1173 is_a_helper <gomp_for *>::test (gimple *gs)
1175 return gs->code == GIMPLE_OMP_FOR;
1178 template <>
1179 template <>
1180 inline bool
1181 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1183 return (gs->code == GIMPLE_OMP_PARALLEL
1184 || gs->code == GIMPLE_OMP_TASK
1185 || gs->code == GIMPLE_OMP_TEAMS);
1188 template <>
1189 template <>
1190 inline bool
1191 is_a_helper <gomp_parallel *>::test (gimple *gs)
1193 return gs->code == GIMPLE_OMP_PARALLEL;
1196 template <>
1197 template <>
1198 inline bool
1199 is_a_helper <gomp_target *>::test (gimple *gs)
1201 return gs->code == GIMPLE_OMP_TARGET;
1204 template <>
1205 template <>
1206 inline bool
1207 is_a_helper <gomp_sections *>::test (gimple *gs)
1209 return gs->code == GIMPLE_OMP_SECTIONS;
1212 template <>
1213 template <>
1214 inline bool
1215 is_a_helper <gomp_single *>::test (gimple *gs)
1217 return gs->code == GIMPLE_OMP_SINGLE;
1220 template <>
1221 template <>
1222 inline bool
1223 is_a_helper <gomp_teams *>::test (gimple *gs)
1225 return gs->code == GIMPLE_OMP_TEAMS;
1228 template <>
1229 template <>
1230 inline bool
1231 is_a_helper <gomp_task *>::test (gimple *gs)
1233 return gs->code == GIMPLE_OMP_TASK;
1236 template <>
1237 template <>
1238 inline bool
1239 is_a_helper <gphi *>::test (gimple *gs)
1241 return gs->code == GIMPLE_PHI;
1244 template <>
1245 template <>
1246 inline bool
1247 is_a_helper <greturn *>::test (gimple *gs)
1249 return gs->code == GIMPLE_RETURN;
1252 template <>
1253 template <>
1254 inline bool
1255 is_a_helper <gswitch *>::test (gimple *gs)
1257 return gs->code == GIMPLE_SWITCH;
1260 template <>
1261 template <>
1262 inline bool
1263 is_a_helper <const gswitch *>::test (const gimple *gs)
1265 return gs->code == GIMPLE_SWITCH;
1268 template <>
1269 template <>
1270 inline bool
1271 is_a_helper <gtransaction *>::test (gimple *gs)
1273 return gs->code == GIMPLE_TRANSACTION;
1276 template <>
1277 template <>
1278 inline bool
1279 is_a_helper <gtry *>::test (gimple *gs)
1281 return gs->code == GIMPLE_TRY;
1284 template <>
1285 template <>
1286 inline bool
1287 is_a_helper <const gtry *>::test (const gimple *gs)
1289 return gs->code == GIMPLE_TRY;
1292 template <>
1293 template <>
1294 inline bool
1295 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1297 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1300 template <>
1301 template <>
1302 inline bool
1303 is_a_helper <const gasm *>::test (const gimple *gs)
1305 return gs->code == GIMPLE_ASM;
1308 template <>
1309 template <>
1310 inline bool
1311 is_a_helper <const gbind *>::test (const gimple *gs)
1313 return gs->code == GIMPLE_BIND;
1316 template <>
1317 template <>
1318 inline bool
1319 is_a_helper <const gcall *>::test (const gimple *gs)
1321 return gs->code == GIMPLE_CALL;
1324 template <>
1325 template <>
1326 inline bool
1327 is_a_helper <const gcatch *>::test (const gimple *gs)
1329 return gs->code == GIMPLE_CATCH;
1332 template <>
1333 template <>
1334 inline bool
1335 is_a_helper <const gresx *>::test (const gimple *gs)
1337 return gs->code == GIMPLE_RESX;
1340 template <>
1341 template <>
1342 inline bool
1343 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1345 return gs->code == GIMPLE_EH_DISPATCH;
1348 template <>
1349 template <>
1350 inline bool
1351 is_a_helper <const geh_filter *>::test (const gimple *gs)
1353 return gs->code == GIMPLE_EH_FILTER;
1356 template <>
1357 template <>
1358 inline bool
1359 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1361 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1364 template <>
1365 template <>
1366 inline bool
1367 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1369 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1372 template <>
1373 template <>
1374 inline bool
1375 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1377 return gs->code == GIMPLE_OMP_RETURN;
1380 template <>
1381 template <>
1382 inline bool
1383 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1385 return gs->code == GIMPLE_OMP_CONTINUE;
1388 template <>
1389 template <>
1390 inline bool
1391 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1393 return gs->code == GIMPLE_OMP_CRITICAL;
1396 template <>
1397 template <>
1398 inline bool
1399 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1401 return gs->code == GIMPLE_OMP_ORDERED;
1404 template <>
1405 template <>
1406 inline bool
1407 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1409 return gs->code == GIMPLE_OMP_SCAN;
1412 template <>
1413 template <>
1414 inline bool
1415 is_a_helper <const gomp_for *>::test (const gimple *gs)
1417 return gs->code == GIMPLE_OMP_FOR;
1420 template <>
1421 template <>
1422 inline bool
1423 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1425 return (gs->code == GIMPLE_OMP_PARALLEL
1426 || gs->code == GIMPLE_OMP_TASK
1427 || gs->code == GIMPLE_OMP_TEAMS);
1430 template <>
1431 template <>
1432 inline bool
1433 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1435 return gs->code == GIMPLE_OMP_PARALLEL;
1438 template <>
1439 template <>
1440 inline bool
1441 is_a_helper <const gomp_target *>::test (const gimple *gs)
1443 return gs->code == GIMPLE_OMP_TARGET;
1446 template <>
1447 template <>
1448 inline bool
1449 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1451 return gs->code == GIMPLE_OMP_SECTIONS;
1454 template <>
1455 template <>
1456 inline bool
1457 is_a_helper <const gomp_single *>::test (const gimple *gs)
1459 return gs->code == GIMPLE_OMP_SINGLE;
1462 template <>
1463 template <>
1464 inline bool
1465 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1467 return gs->code == GIMPLE_OMP_TEAMS;
1470 template <>
1471 template <>
1472 inline bool
1473 is_a_helper <const gomp_task *>::test (const gimple *gs)
1475 return gs->code == GIMPLE_OMP_TASK;
1478 template <>
1479 template <>
1480 inline bool
1481 is_a_helper <const gphi *>::test (const gimple *gs)
1483 return gs->code == GIMPLE_PHI;
1486 template <>
1487 template <>
1488 inline bool
1489 is_a_helper <const greturn *>::test (const gimple *gs)
1491 return gs->code == GIMPLE_RETURN;
1494 template <>
1495 template <>
1496 inline bool
1497 is_a_helper <const gtransaction *>::test (const gimple *gs)
1499 return gs->code == GIMPLE_TRANSACTION;
1502 /* Offset in bytes to the location of the operand vector.
1503 Zero if there is no operand vector for this tuple structure. */
1504 extern size_t const gimple_ops_offset_[];
1506 /* Map GIMPLE codes to GSS codes. */
1507 extern enum gimple_statement_structure_enum const gss_for_code_[];
1509 /* This variable holds the currently expanded gimple statement for purposes
1510 of comminucating the profile info to the builtin expanders. */
1511 extern gimple *currently_expanding_gimple_stmt;
1513 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1514 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1515 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1516 greturn *gimple_build_return (tree);
1517 void gimple_call_reset_alias_info (gcall *);
1518 gcall *gimple_build_call_vec (tree, vec<tree> );
1519 gcall *gimple_build_call (tree, unsigned, ...);
1520 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1521 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1522 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1523 gcall *gimple_build_call_from_tree (tree, tree);
1524 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1525 gassign *gimple_build_assign (tree, enum tree_code,
1526 tree, tree, tree CXX_MEM_STAT_INFO);
1527 gassign *gimple_build_assign (tree, enum tree_code,
1528 tree, tree CXX_MEM_STAT_INFO);
1529 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1530 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1531 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1532 void gimple_cond_set_condition_from_tree (gcond *, tree);
1533 glabel *gimple_build_label (tree label);
1534 ggoto *gimple_build_goto (tree dest);
1535 gimple *gimple_build_nop (void);
1536 gbind *gimple_build_bind (tree, gimple_seq, tree);
1537 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1538 vec<tree, va_gc> *, vec<tree, va_gc> *,
1539 vec<tree, va_gc> *);
1540 gcatch *gimple_build_catch (tree, gimple_seq);
1541 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1542 geh_mnt *gimple_build_eh_must_not_throw (tree);
1543 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1544 gtry *gimple_build_try (gimple_seq, gimple_seq,
1545 enum gimple_try_flags);
1546 gimple *gimple_build_wce (gimple_seq);
1547 gresx *gimple_build_resx (int);
1548 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1549 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1550 geh_dispatch *gimple_build_eh_dispatch (int);
1551 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1552 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1553 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1554 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1555 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1556 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1557 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1558 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1559 tree, tree);
1560 gimple *gimple_build_omp_section (gimple_seq);
1561 gimple *gimple_build_omp_master (gimple_seq);
1562 gimple *gimple_build_omp_grid_body (gimple_seq);
1563 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1564 gomp_continue *gimple_build_omp_continue (tree, tree);
1565 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1566 gimple *gimple_build_omp_return (bool);
1567 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1568 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1569 gimple *gimple_build_omp_sections_switch (void);
1570 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1571 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1572 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1573 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1574 enum omp_memory_order);
1575 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1576 gtransaction *gimple_build_transaction (gimple_seq);
1577 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1578 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1579 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1580 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1581 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1582 location_t);
1583 extern void annotate_all_with_location (gimple_seq, location_t);
1584 bool empty_body_p (gimple_seq);
1585 gimple_seq gimple_seq_copy (gimple_seq);
1586 bool gimple_call_same_target_p (const gimple *, const gimple *);
1587 int gimple_call_flags (const gimple *);
1588 int gimple_call_arg_flags (const gcall *, unsigned);
1589 int gimple_call_return_flags (const gcall *);
1590 bool gimple_call_nonnull_result_p (gcall *);
1591 tree gimple_call_nonnull_arg (gcall *);
1592 bool gimple_assign_copy_p (gimple *);
1593 bool gimple_assign_ssa_name_copy_p (gimple *);
1594 bool gimple_assign_unary_nop_p (gimple *);
1595 void gimple_set_bb (gimple *, basic_block);
1596 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1597 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1598 tree, tree, tree);
1599 tree gimple_get_lhs (const gimple *);
1600 void gimple_set_lhs (gimple *, tree);
1601 gimple *gimple_copy (gimple *);
1602 void gimple_move_vops (gimple *, gimple *);
1603 bool gimple_has_side_effects (const gimple *);
1604 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1605 bool gimple_could_trap_p (gimple *);
1606 bool gimple_assign_rhs_could_trap_p (gimple *);
1607 extern void dump_gimple_statistics (void);
1608 unsigned get_gimple_rhs_num_ops (enum tree_code);
1609 extern tree canonicalize_cond_expr_cond (tree);
1610 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1611 extern bool gimple_compare_field_offset (tree, tree);
1612 extern tree gimple_unsigned_type (tree);
1613 extern tree gimple_signed_type (tree);
1614 extern alias_set_type gimple_get_alias_set (tree);
1615 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1616 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1617 extern combined_fn gimple_call_combined_fn (const gimple *);
1618 extern bool gimple_call_operator_delete_p (const gcall *);
1619 extern bool gimple_call_builtin_p (const gimple *);
1620 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1621 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1622 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1623 extern void dump_decl_set (FILE *, bitmap);
1624 extern bool nonfreeing_call_p (gimple *);
1625 extern bool nonbarrier_call_p (gimple *);
1626 extern bool infer_nonnull_range (gimple *, tree);
1627 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1628 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1629 extern void sort_case_labels (vec<tree>);
1630 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1631 extern void gimple_seq_set_location (gimple_seq, location_t);
1632 extern void gimple_seq_discard (gimple_seq);
1633 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1634 extern bool gimple_inexpensive_call_p (gcall *);
1635 extern bool stmt_can_terminate_bb_p (gimple *);
1637 /* Formal (expression) temporary table handling: multiple occurrences of
1638 the same scalar expression are evaluated into the same temporary. */
1640 typedef struct gimple_temp_hash_elt
1642 tree val; /* Key */
1643 tree temp; /* Value */
1644 } elt_t;
1646 /* Get the number of the next statement uid to be allocated. */
1647 static inline unsigned int
1648 gimple_stmt_max_uid (struct function *fn)
1650 return fn->last_stmt_uid;
1653 /* Set the number of the next statement uid to be allocated. */
1654 static inline void
1655 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1657 fn->last_stmt_uid = maxid;
1660 /* Set the number of the next statement uid to be allocated. */
1661 static inline unsigned int
1662 inc_gimple_stmt_max_uid (struct function *fn)
1664 return fn->last_stmt_uid++;
1667 /* Return the first node in GIMPLE sequence S. */
1669 static inline gimple_seq_node
1670 gimple_seq_first (gimple_seq s)
1672 return s;
1676 /* Return the first statement in GIMPLE sequence S. */
1678 static inline gimple *
1679 gimple_seq_first_stmt (gimple_seq s)
1681 gimple_seq_node n = gimple_seq_first (s);
1682 return n;
1685 /* Return the first statement in GIMPLE sequence S as a gbind *,
1686 verifying that it has code GIMPLE_BIND in a checked build. */
1688 static inline gbind *
1689 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1691 gimple_seq_node n = gimple_seq_first (s);
1692 return as_a <gbind *> (n);
1696 /* Return the last node in GIMPLE sequence S. */
1698 static inline gimple_seq_node
1699 gimple_seq_last (gimple_seq s)
1701 return s ? s->prev : NULL;
1705 /* Return the last statement in GIMPLE sequence S. */
1707 static inline gimple *
1708 gimple_seq_last_stmt (gimple_seq s)
1710 gimple_seq_node n = gimple_seq_last (s);
1711 return n;
1715 /* Set the last node in GIMPLE sequence *PS to LAST. */
1717 static inline void
1718 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1720 (*ps)->prev = last;
1724 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1726 static inline void
1727 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1729 *ps = first;
1733 /* Return true if GIMPLE sequence S is empty. */
1735 static inline bool
1736 gimple_seq_empty_p (gimple_seq s)
1738 return s == NULL;
1741 /* Allocate a new sequence and initialize its first element with STMT. */
1743 static inline gimple_seq
1744 gimple_seq_alloc_with_stmt (gimple *stmt)
1746 gimple_seq seq = NULL;
1747 gimple_seq_add_stmt (&seq, stmt);
1748 return seq;
1752 /* Returns the sequence of statements in BB. */
1754 static inline gimple_seq
1755 bb_seq (const_basic_block bb)
1757 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1760 static inline gimple_seq *
1761 bb_seq_addr (basic_block bb)
1763 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1766 /* Sets the sequence of statements in BB to SEQ. */
1768 static inline void
1769 set_bb_seq (basic_block bb, gimple_seq seq)
1771 gcc_checking_assert (!(bb->flags & BB_RTL));
1772 bb->il.gimple.seq = seq;
1776 /* Return the code for GIMPLE statement G. */
1778 static inline enum gimple_code
1779 gimple_code (const gimple *g)
1781 return g->code;
1785 /* Return the GSS code used by a GIMPLE code. */
1787 static inline enum gimple_statement_structure_enum
1788 gss_for_code (enum gimple_code code)
1790 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1791 return gss_for_code_[code];
1795 /* Return which GSS code is used by GS. */
1797 static inline enum gimple_statement_structure_enum
1798 gimple_statement_structure (gimple *gs)
1800 return gss_for_code (gimple_code (gs));
1804 /* Return true if statement G has sub-statements. This is only true for
1805 High GIMPLE statements. */
1807 static inline bool
1808 gimple_has_substatements (gimple *g)
1810 switch (gimple_code (g))
1812 case GIMPLE_BIND:
1813 case GIMPLE_CATCH:
1814 case GIMPLE_EH_FILTER:
1815 case GIMPLE_EH_ELSE:
1816 case GIMPLE_TRY:
1817 case GIMPLE_OMP_FOR:
1818 case GIMPLE_OMP_MASTER:
1819 case GIMPLE_OMP_TASKGROUP:
1820 case GIMPLE_OMP_ORDERED:
1821 case GIMPLE_OMP_SECTION:
1822 case GIMPLE_OMP_PARALLEL:
1823 case GIMPLE_OMP_TASK:
1824 case GIMPLE_OMP_SECTIONS:
1825 case GIMPLE_OMP_SINGLE:
1826 case GIMPLE_OMP_TARGET:
1827 case GIMPLE_OMP_TEAMS:
1828 case GIMPLE_OMP_CRITICAL:
1829 case GIMPLE_WITH_CLEANUP_EXPR:
1830 case GIMPLE_TRANSACTION:
1831 case GIMPLE_OMP_GRID_BODY:
1832 return true;
1834 default:
1835 return false;
1840 /* Return the basic block holding statement G. */
1842 static inline basic_block
1843 gimple_bb (const gimple *g)
1845 return g->bb;
1849 /* Return the lexical scope block holding statement G. */
1851 static inline tree
1852 gimple_block (const gimple *g)
1854 return LOCATION_BLOCK (g->location);
1858 /* Set BLOCK to be the lexical scope block holding statement G. */
1860 static inline void
1861 gimple_set_block (gimple *g, tree block)
1863 g->location = set_block (g->location, block);
1867 /* Return location information for statement G. */
1869 static inline location_t
1870 gimple_location (const gimple *g)
1872 return g->location;
1875 /* Return location information for statement G if g is not NULL.
1876 Otherwise, UNKNOWN_LOCATION is returned. */
1878 static inline location_t
1879 gimple_location_safe (const gimple *g)
1881 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1884 /* Set location information for statement G. */
1886 static inline void
1887 gimple_set_location (gimple *g, location_t location)
1889 g->location = location;
1893 /* Return true if G contains location information. */
1895 static inline bool
1896 gimple_has_location (const gimple *g)
1898 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1902 /* Return non-artificial location information for statement G. */
1904 static inline location_t
1905 gimple_nonartificial_location (const gimple *g)
1907 location_t *ploc = NULL;
1909 if (tree block = gimple_block (g))
1910 ploc = block_nonartificial_location (block);
1912 return ploc ? *ploc : gimple_location (g);
1916 /* Return the file name of the location of STMT. */
1918 static inline const char *
1919 gimple_filename (const gimple *stmt)
1921 return LOCATION_FILE (gimple_location (stmt));
1925 /* Return the line number of the location of STMT. */
1927 static inline int
1928 gimple_lineno (const gimple *stmt)
1930 return LOCATION_LINE (gimple_location (stmt));
1934 /* Determine whether SEQ is a singleton. */
1936 static inline bool
1937 gimple_seq_singleton_p (gimple_seq seq)
1939 return ((gimple_seq_first (seq) != NULL)
1940 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1943 /* Return true if no warnings should be emitted for statement STMT. */
1945 static inline bool
1946 gimple_no_warning_p (const gimple *stmt)
1948 return stmt->no_warning;
1951 /* Set the no_warning flag of STMT to NO_WARNING. */
1953 static inline void
1954 gimple_set_no_warning (gimple *stmt, bool no_warning)
1956 stmt->no_warning = (unsigned) no_warning;
1959 /* Set the visited status on statement STMT to VISITED_P.
1961 Please note that this 'visited' property of the gimple statement is
1962 supposed to be undefined at pass boundaries. This means that a
1963 given pass should not assume it contains any useful value when the
1964 pass starts and thus can set it to any value it sees fit.
1966 You can learn more about the visited property of the gimple
1967 statement by reading the comments of the 'visited' data member of
1968 struct gimple.
1971 static inline void
1972 gimple_set_visited (gimple *stmt, bool visited_p)
1974 stmt->visited = (unsigned) visited_p;
1978 /* Return the visited status for statement STMT.
1980 Please note that this 'visited' property of the gimple statement is
1981 supposed to be undefined at pass boundaries. This means that a
1982 given pass should not assume it contains any useful value when the
1983 pass starts and thus can set it to any value it sees fit.
1985 You can learn more about the visited property of the gimple
1986 statement by reading the comments of the 'visited' data member of
1987 struct gimple. */
1989 static inline bool
1990 gimple_visited_p (gimple *stmt)
1992 return stmt->visited;
1996 /* Set pass local flag PLF on statement STMT to VAL_P.
1998 Please note that this PLF property of the gimple statement is
1999 supposed to be undefined at pass boundaries. This means that a
2000 given pass should not assume it contains any useful value when the
2001 pass starts and thus can set it to any value it sees fit.
2003 You can learn more about the PLF property by reading the comment of
2004 the 'plf' data member of struct gimple_statement_structure. */
2006 static inline void
2007 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2009 if (val_p)
2010 stmt->plf |= (unsigned int) plf;
2011 else
2012 stmt->plf &= ~((unsigned int) plf);
2016 /* Return the value of pass local flag PLF on statement STMT.
2018 Please note that this 'plf' property of the gimple statement is
2019 supposed to be undefined at pass boundaries. This means that a
2020 given pass should not assume it contains any useful value when the
2021 pass starts and thus can set it to any value it sees fit.
2023 You can learn more about the plf property by reading the comment of
2024 the 'plf' data member of struct gimple_statement_structure. */
2026 static inline unsigned int
2027 gimple_plf (gimple *stmt, enum plf_mask plf)
2029 return stmt->plf & ((unsigned int) plf);
2033 /* Set the UID of statement.
2035 Please note that this UID property is supposed to be undefined at
2036 pass boundaries. This means that a given pass should not assume it
2037 contains any useful value when the pass starts and thus can set it
2038 to any value it sees fit. */
2040 static inline void
2041 gimple_set_uid (gimple *g, unsigned uid)
2043 g->uid = uid;
2047 /* Return the UID of statement.
2049 Please note that this UID property is supposed to be undefined at
2050 pass boundaries. This means that a given pass should not assume it
2051 contains any useful value when the pass starts and thus can set it
2052 to any value it sees fit. */
2054 static inline unsigned
2055 gimple_uid (const gimple *g)
2057 return g->uid;
2061 /* Make statement G a singleton sequence. */
2063 static inline void
2064 gimple_init_singleton (gimple *g)
2066 g->next = NULL;
2067 g->prev = g;
2071 /* Return true if GIMPLE statement G has register or memory operands. */
2073 static inline bool
2074 gimple_has_ops (const gimple *g)
2076 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2079 template <>
2080 template <>
2081 inline bool
2082 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2084 return gimple_has_ops (gs);
2087 template <>
2088 template <>
2089 inline bool
2090 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2092 return gimple_has_ops (gs);
2095 /* Return true if GIMPLE statement G has memory operands. */
2097 static inline bool
2098 gimple_has_mem_ops (const gimple *g)
2100 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2103 template <>
2104 template <>
2105 inline bool
2106 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2108 return gimple_has_mem_ops (gs);
2111 template <>
2112 template <>
2113 inline bool
2114 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2116 return gimple_has_mem_ops (gs);
2119 /* Return the set of USE operands for statement G. */
2121 static inline struct use_optype_d *
2122 gimple_use_ops (const gimple *g)
2124 const gimple_statement_with_ops *ops_stmt =
2125 dyn_cast <const gimple_statement_with_ops *> (g);
2126 if (!ops_stmt)
2127 return NULL;
2128 return ops_stmt->use_ops;
2132 /* Set USE to be the set of USE operands for statement G. */
2134 static inline void
2135 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2137 gimple_statement_with_ops *ops_stmt =
2138 as_a <gimple_statement_with_ops *> (g);
2139 ops_stmt->use_ops = use;
2143 /* Return the single VUSE operand of the statement G. */
2145 static inline tree
2146 gimple_vuse (const gimple *g)
2148 const gimple_statement_with_memory_ops *mem_ops_stmt =
2149 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2150 if (!mem_ops_stmt)
2151 return NULL_TREE;
2152 return mem_ops_stmt->vuse;
2155 /* Return the single VDEF operand of the statement G. */
2157 static inline tree
2158 gimple_vdef (const gimple *g)
2160 const gimple_statement_with_memory_ops *mem_ops_stmt =
2161 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2162 if (!mem_ops_stmt)
2163 return NULL_TREE;
2164 return mem_ops_stmt->vdef;
2167 /* Return the single VUSE operand of the statement G. */
2169 static inline tree *
2170 gimple_vuse_ptr (gimple *g)
2172 gimple_statement_with_memory_ops *mem_ops_stmt =
2173 dyn_cast <gimple_statement_with_memory_ops *> (g);
2174 if (!mem_ops_stmt)
2175 return NULL;
2176 return &mem_ops_stmt->vuse;
2179 /* Return the single VDEF operand of the statement G. */
2181 static inline tree *
2182 gimple_vdef_ptr (gimple *g)
2184 gimple_statement_with_memory_ops *mem_ops_stmt =
2185 dyn_cast <gimple_statement_with_memory_ops *> (g);
2186 if (!mem_ops_stmt)
2187 return NULL;
2188 return &mem_ops_stmt->vdef;
2191 /* Set the single VUSE operand of the statement G. */
2193 static inline void
2194 gimple_set_vuse (gimple *g, tree vuse)
2196 gimple_statement_with_memory_ops *mem_ops_stmt =
2197 as_a <gimple_statement_with_memory_ops *> (g);
2198 mem_ops_stmt->vuse = vuse;
2201 /* Set the single VDEF operand of the statement G. */
2203 static inline void
2204 gimple_set_vdef (gimple *g, tree vdef)
2206 gimple_statement_with_memory_ops *mem_ops_stmt =
2207 as_a <gimple_statement_with_memory_ops *> (g);
2208 mem_ops_stmt->vdef = vdef;
2212 /* Return true if statement G has operands and the modified field has
2213 been set. */
2215 static inline bool
2216 gimple_modified_p (const gimple *g)
2218 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2222 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2223 a MODIFIED field. */
2225 static inline void
2226 gimple_set_modified (gimple *s, bool modifiedp)
2228 if (gimple_has_ops (s))
2229 s->modified = (unsigned) modifiedp;
2233 /* Return the tree code for the expression computed by STMT. This is
2234 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2235 GIMPLE_CALL, return CALL_EXPR as the expression code for
2236 consistency. This is useful when the caller needs to deal with the
2237 three kinds of computation that GIMPLE supports. */
2239 static inline enum tree_code
2240 gimple_expr_code (const gimple *stmt)
2242 enum gimple_code code = gimple_code (stmt);
2243 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2244 return (enum tree_code) stmt->subcode;
2245 else
2247 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2248 return CALL_EXPR;
2253 /* Return true if statement STMT contains volatile operands. */
2255 static inline bool
2256 gimple_has_volatile_ops (const gimple *stmt)
2258 if (gimple_has_mem_ops (stmt))
2259 return stmt->has_volatile_ops;
2260 else
2261 return false;
2265 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2267 static inline void
2268 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2270 if (gimple_has_mem_ops (stmt))
2271 stmt->has_volatile_ops = (unsigned) volatilep;
2274 /* Return true if STMT is in a transaction. */
2276 static inline bool
2277 gimple_in_transaction (const gimple *stmt)
2279 return bb_in_transaction (gimple_bb (stmt));
2282 /* Return true if statement STMT may access memory. */
2284 static inline bool
2285 gimple_references_memory_p (gimple *stmt)
2287 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2291 /* Return the subcode for OMP statement S. */
2293 static inline unsigned
2294 gimple_omp_subcode (const gimple *s)
2296 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2297 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2298 return s->subcode;
2301 /* Set the subcode for OMP statement S to SUBCODE. */
2303 static inline void
2304 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2306 /* We only have 16 bits for the subcode. Assert that we are not
2307 overflowing it. */
2308 gcc_gimple_checking_assert (subcode < (1 << 16));
2309 s->subcode = subcode;
2312 /* Set the nowait flag on OMP_RETURN statement S. */
2314 static inline void
2315 gimple_omp_return_set_nowait (gimple *s)
2317 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2318 s->subcode |= GF_OMP_RETURN_NOWAIT;
2322 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2323 flag set. */
2325 static inline bool
2326 gimple_omp_return_nowait_p (const gimple *g)
2328 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2329 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2333 /* Set the LHS of OMP return. */
2335 static inline void
2336 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2338 gimple_statement_omp_return *omp_return_stmt =
2339 as_a <gimple_statement_omp_return *> (g);
2340 omp_return_stmt->val = lhs;
2344 /* Get the LHS of OMP return. */
2346 static inline tree
2347 gimple_omp_return_lhs (const gimple *g)
2349 const gimple_statement_omp_return *omp_return_stmt =
2350 as_a <const gimple_statement_omp_return *> (g);
2351 return omp_return_stmt->val;
2355 /* Return a pointer to the LHS of OMP return. */
2357 static inline tree *
2358 gimple_omp_return_lhs_ptr (gimple *g)
2360 gimple_statement_omp_return *omp_return_stmt =
2361 as_a <gimple_statement_omp_return *> (g);
2362 return &omp_return_stmt->val;
2366 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2367 flag set. */
2369 static inline bool
2370 gimple_omp_section_last_p (const gimple *g)
2372 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2373 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2377 /* Set the GF_OMP_SECTION_LAST flag on G. */
2379 static inline void
2380 gimple_omp_section_set_last (gimple *g)
2382 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2383 g->subcode |= GF_OMP_SECTION_LAST;
2387 /* Return true if OMP parallel statement G has the
2388 GF_OMP_PARALLEL_COMBINED flag set. */
2390 static inline bool
2391 gimple_omp_parallel_combined_p (const gimple *g)
2393 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2394 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2398 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2399 value of COMBINED_P. */
2401 static inline void
2402 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2404 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2405 if (combined_p)
2406 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2407 else
2408 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2412 /* Return true if OMP atomic load/store statement G has the
2413 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2415 static inline bool
2416 gimple_omp_atomic_need_value_p (const gimple *g)
2418 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2419 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2420 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2424 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2426 static inline void
2427 gimple_omp_atomic_set_need_value (gimple *g)
2429 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2430 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2431 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2435 /* Return the memory order of the OMP atomic load/store statement G. */
2437 static inline enum omp_memory_order
2438 gimple_omp_atomic_memory_order (const gimple *g)
2440 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2441 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2442 return (enum omp_memory_order)
2443 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2447 /* Set the memory order on G. */
2449 static inline void
2450 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2452 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2453 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2454 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2455 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2459 /* Return the number of operands for statement GS. */
2461 static inline unsigned
2462 gimple_num_ops (const gimple *gs)
2464 return gs->num_ops;
2468 /* Set the number of operands for statement GS. */
2470 static inline void
2471 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2473 gs->num_ops = num_ops;
2477 /* Return the array of operands for statement GS. */
2479 static inline tree *
2480 gimple_ops (gimple *gs)
2482 size_t off;
2484 /* All the tuples have their operand vector at the very bottom
2485 of the structure. Note that those structures that do not
2486 have an operand vector have a zero offset. */
2487 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2488 gcc_gimple_checking_assert (off != 0);
2490 return (tree *) ((char *) gs + off);
2494 /* Return operand I for statement GS. */
2496 static inline tree
2497 gimple_op (const gimple *gs, unsigned i)
2499 if (gimple_has_ops (gs))
2501 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2502 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2504 else
2505 return NULL_TREE;
2508 /* Return a pointer to operand I for statement GS. */
2510 static inline tree *
2511 gimple_op_ptr (gimple *gs, unsigned i)
2513 if (gimple_has_ops (gs))
2515 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2516 return gimple_ops (gs) + i;
2518 else
2519 return NULL;
2522 /* Set operand I of statement GS to OP. */
2524 static inline void
2525 gimple_set_op (gimple *gs, unsigned i, tree op)
2527 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2529 /* Note. It may be tempting to assert that OP matches
2530 is_gimple_operand, but that would be wrong. Different tuples
2531 accept slightly different sets of tree operands. Each caller
2532 should perform its own validation. */
2533 gimple_ops (gs)[i] = op;
2536 /* Return true if GS is a GIMPLE_ASSIGN. */
2538 static inline bool
2539 is_gimple_assign (const gimple *gs)
2541 return gimple_code (gs) == GIMPLE_ASSIGN;
2544 /* Determine if expression CODE is one of the valid expressions that can
2545 be used on the RHS of GIMPLE assignments. */
2547 static inline enum gimple_rhs_class
2548 get_gimple_rhs_class (enum tree_code code)
2550 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2553 /* Return the LHS of assignment statement GS. */
2555 static inline tree
2556 gimple_assign_lhs (const gassign *gs)
2558 return gs->op[0];
2561 static inline tree
2562 gimple_assign_lhs (const gimple *gs)
2564 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2565 return gimple_assign_lhs (ass);
2569 /* Return a pointer to the LHS of assignment statement GS. */
2571 static inline tree *
2572 gimple_assign_lhs_ptr (gassign *gs)
2574 return &gs->op[0];
2577 static inline tree *
2578 gimple_assign_lhs_ptr (gimple *gs)
2580 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2581 return gimple_assign_lhs_ptr (ass);
2585 /* Set LHS to be the LHS operand of assignment statement GS. */
2587 static inline void
2588 gimple_assign_set_lhs (gassign *gs, tree lhs)
2590 gs->op[0] = lhs;
2592 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2593 SSA_NAME_DEF_STMT (lhs) = gs;
2596 static inline void
2597 gimple_assign_set_lhs (gimple *gs, tree lhs)
2599 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2600 gimple_assign_set_lhs (ass, lhs);
2604 /* Return the first operand on the RHS of assignment statement GS. */
2606 static inline tree
2607 gimple_assign_rhs1 (const gassign *gs)
2609 return gs->op[1];
2612 static inline tree
2613 gimple_assign_rhs1 (const gimple *gs)
2615 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2616 return gimple_assign_rhs1 (ass);
2620 /* Return a pointer to the first operand on the RHS of assignment
2621 statement GS. */
2623 static inline tree *
2624 gimple_assign_rhs1_ptr (gassign *gs)
2626 return &gs->op[1];
2629 static inline tree *
2630 gimple_assign_rhs1_ptr (gimple *gs)
2632 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2633 return gimple_assign_rhs1_ptr (ass);
2636 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2638 static inline void
2639 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2641 gs->op[1] = rhs;
2644 static inline void
2645 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2647 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2648 gimple_assign_set_rhs1 (ass, rhs);
2652 /* Return the second operand on the RHS of assignment statement GS.
2653 If GS does not have two operands, NULL is returned instead. */
2655 static inline tree
2656 gimple_assign_rhs2 (const gassign *gs)
2658 if (gimple_num_ops (gs) >= 3)
2659 return gs->op[2];
2660 else
2661 return NULL_TREE;
2664 static inline tree
2665 gimple_assign_rhs2 (const gimple *gs)
2667 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2668 return gimple_assign_rhs2 (ass);
2672 /* Return a pointer to the second operand on the RHS of assignment
2673 statement GS. */
2675 static inline tree *
2676 gimple_assign_rhs2_ptr (gassign *gs)
2678 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2679 return &gs->op[2];
2682 static inline tree *
2683 gimple_assign_rhs2_ptr (gimple *gs)
2685 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2686 return gimple_assign_rhs2_ptr (ass);
2690 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2692 static inline void
2693 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2695 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2696 gs->op[2] = rhs;
2699 static inline void
2700 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2702 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2703 return gimple_assign_set_rhs2 (ass, rhs);
2706 /* Return the third operand on the RHS of assignment statement GS.
2707 If GS does not have two operands, NULL is returned instead. */
2709 static inline tree
2710 gimple_assign_rhs3 (const gassign *gs)
2712 if (gimple_num_ops (gs) >= 4)
2713 return gs->op[3];
2714 else
2715 return NULL_TREE;
2718 static inline tree
2719 gimple_assign_rhs3 (const gimple *gs)
2721 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2722 return gimple_assign_rhs3 (ass);
2725 /* Return a pointer to the third operand on the RHS of assignment
2726 statement GS. */
2728 static inline tree *
2729 gimple_assign_rhs3_ptr (gimple *gs)
2731 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2732 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2733 return &ass->op[3];
2737 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2739 static inline void
2740 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2742 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2743 gs->op[3] = rhs;
2746 static inline void
2747 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2749 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2750 gimple_assign_set_rhs3 (ass, rhs);
2754 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2755 which expect to see only two operands. */
2757 static inline void
2758 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2759 tree op1, tree op2)
2761 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2764 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2765 which expect to see only one operands. */
2767 static inline void
2768 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2769 tree op1)
2771 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2774 /* Returns true if GS is a nontemporal move. */
2776 static inline bool
2777 gimple_assign_nontemporal_move_p (const gassign *gs)
2779 return gs->nontemporal_move;
2782 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2784 static inline void
2785 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2787 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2788 gs->nontemporal_move = nontemporal;
2792 /* Return the code of the expression computed on the rhs of assignment
2793 statement GS. In case that the RHS is a single object, returns the
2794 tree code of the object. */
2796 static inline enum tree_code
2797 gimple_assign_rhs_code (const gassign *gs)
2799 enum tree_code code = (enum tree_code) gs->subcode;
2800 /* While we initially set subcode to the TREE_CODE of the rhs for
2801 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2802 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2803 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2804 code = TREE_CODE (gs->op[1]);
2806 return code;
2809 static inline enum tree_code
2810 gimple_assign_rhs_code (const gimple *gs)
2812 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2813 return gimple_assign_rhs_code (ass);
2817 /* Set CODE to be the code for the expression computed on the RHS of
2818 assignment S. */
2820 static inline void
2821 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2823 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2824 s->subcode = code;
2828 /* Return the gimple rhs class of the code of the expression computed on
2829 the rhs of assignment statement GS.
2830 This will never return GIMPLE_INVALID_RHS. */
2832 static inline enum gimple_rhs_class
2833 gimple_assign_rhs_class (const gimple *gs)
2835 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2838 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2839 there is no operator associated with the assignment itself.
2840 Unlike gimple_assign_copy_p, this predicate returns true for
2841 any RHS operand, including those that perform an operation
2842 and do not have the semantics of a copy, such as COND_EXPR. */
2844 static inline bool
2845 gimple_assign_single_p (const gimple *gs)
2847 return (is_gimple_assign (gs)
2848 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2851 /* Return true if GS performs a store to its lhs. */
2853 static inline bool
2854 gimple_store_p (const gimple *gs)
2856 tree lhs = gimple_get_lhs (gs);
2857 return lhs && !is_gimple_reg (lhs);
2860 /* Return true if GS is an assignment that loads from its rhs1. */
2862 static inline bool
2863 gimple_assign_load_p (const gimple *gs)
2865 tree rhs;
2866 if (!gimple_assign_single_p (gs))
2867 return false;
2868 rhs = gimple_assign_rhs1 (gs);
2869 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2870 return true;
2871 rhs = get_base_address (rhs);
2872 return (DECL_P (rhs)
2873 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2877 /* Return true if S is a type-cast assignment. */
2879 static inline bool
2880 gimple_assign_cast_p (const gimple *s)
2882 if (is_gimple_assign (s))
2884 enum tree_code sc = gimple_assign_rhs_code (s);
2885 return CONVERT_EXPR_CODE_P (sc)
2886 || sc == VIEW_CONVERT_EXPR
2887 || sc == FIX_TRUNC_EXPR;
2890 return false;
2893 /* Return true if S is a clobber statement. */
2895 static inline bool
2896 gimple_clobber_p (const gimple *s)
2898 return gimple_assign_single_p (s)
2899 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2902 /* Return true if GS is a GIMPLE_CALL. */
2904 static inline bool
2905 is_gimple_call (const gimple *gs)
2907 return gimple_code (gs) == GIMPLE_CALL;
2910 /* Return the LHS of call statement GS. */
2912 static inline tree
2913 gimple_call_lhs (const gcall *gs)
2915 return gs->op[0];
2918 static inline tree
2919 gimple_call_lhs (const gimple *gs)
2921 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2922 return gimple_call_lhs (gc);
2926 /* Return a pointer to the LHS of call statement GS. */
2928 static inline tree *
2929 gimple_call_lhs_ptr (gcall *gs)
2931 return &gs->op[0];
2934 static inline tree *
2935 gimple_call_lhs_ptr (gimple *gs)
2937 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2938 return gimple_call_lhs_ptr (gc);
2942 /* Set LHS to be the LHS operand of call statement GS. */
2944 static inline void
2945 gimple_call_set_lhs (gcall *gs, tree lhs)
2947 gs->op[0] = lhs;
2948 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2949 SSA_NAME_DEF_STMT (lhs) = gs;
2952 static inline void
2953 gimple_call_set_lhs (gimple *gs, tree lhs)
2955 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2956 gimple_call_set_lhs (gc, lhs);
2960 /* Return true if call GS calls an internal-only function, as enumerated
2961 by internal_fn. */
2963 static inline bool
2964 gimple_call_internal_p (const gcall *gs)
2966 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2969 static inline bool
2970 gimple_call_internal_p (const gimple *gs)
2972 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2973 return gimple_call_internal_p (gc);
2976 /* Return true if call GS is marked as nocf_check. */
2978 static inline bool
2979 gimple_call_nocf_check_p (const gcall *gs)
2981 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2984 /* Mark statement GS as nocf_check call. */
2986 static inline void
2987 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2989 if (nocf_check)
2990 gs->subcode |= GF_CALL_NOCF_CHECK;
2991 else
2992 gs->subcode &= ~GF_CALL_NOCF_CHECK;
2995 /* Return the target of internal call GS. */
2997 static inline enum internal_fn
2998 gimple_call_internal_fn (const gcall *gs)
3000 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3001 return gs->u.internal_fn;
3004 static inline enum internal_fn
3005 gimple_call_internal_fn (const gimple *gs)
3007 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3008 return gimple_call_internal_fn (gc);
3011 /* Return true, if this internal gimple call is unique. */
3013 static inline bool
3014 gimple_call_internal_unique_p (const gcall *gs)
3016 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3019 static inline bool
3020 gimple_call_internal_unique_p (const gimple *gs)
3022 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3023 return gimple_call_internal_unique_p (gc);
3026 /* Return true if GS is an internal function FN. */
3028 static inline bool
3029 gimple_call_internal_p (const gimple *gs, internal_fn fn)
3031 return (is_gimple_call (gs)
3032 && gimple_call_internal_p (gs)
3033 && gimple_call_internal_fn (gs) == fn);
3036 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3037 that could alter control flow. */
3039 static inline void
3040 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3042 if (ctrl_altering_p)
3043 s->subcode |= GF_CALL_CTRL_ALTERING;
3044 else
3045 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3048 static inline void
3049 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3051 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3052 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3055 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3056 flag is set. Such call could not be a stmt in the middle of a bb. */
3058 static inline bool
3059 gimple_call_ctrl_altering_p (const gcall *gs)
3061 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3064 static inline bool
3065 gimple_call_ctrl_altering_p (const gimple *gs)
3067 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3068 return gimple_call_ctrl_altering_p (gc);
3072 /* Return the function type of the function called by GS. */
3074 static inline tree
3075 gimple_call_fntype (const gcall *gs)
3077 if (gimple_call_internal_p (gs))
3078 return NULL_TREE;
3079 return gs->u.fntype;
3082 static inline tree
3083 gimple_call_fntype (const gimple *gs)
3085 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3086 return gimple_call_fntype (call_stmt);
3089 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3091 static inline void
3092 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3094 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3095 call_stmt->u.fntype = fntype;
3099 /* Return the tree node representing the function called by call
3100 statement GS. */
3102 static inline tree
3103 gimple_call_fn (const gcall *gs)
3105 return gs->op[1];
3108 static inline tree
3109 gimple_call_fn (const gimple *gs)
3111 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3112 return gimple_call_fn (gc);
3115 /* Return a pointer to the tree node representing the function called by call
3116 statement GS. */
3118 static inline tree *
3119 gimple_call_fn_ptr (gcall *gs)
3121 return &gs->op[1];
3124 static inline tree *
3125 gimple_call_fn_ptr (gimple *gs)
3127 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3128 return gimple_call_fn_ptr (gc);
3132 /* Set FN to be the function called by call statement GS. */
3134 static inline void
3135 gimple_call_set_fn (gcall *gs, tree fn)
3137 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3138 gs->op[1] = fn;
3142 /* Set FNDECL to be the function called by call statement GS. */
3144 static inline void
3145 gimple_call_set_fndecl (gcall *gs, tree decl)
3147 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3148 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3149 build_pointer_type (TREE_TYPE (decl)), decl);
3152 static inline void
3153 gimple_call_set_fndecl (gimple *gs, tree decl)
3155 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3156 gimple_call_set_fndecl (gc, decl);
3160 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3162 static inline void
3163 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3165 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3166 call_stmt->u.internal_fn = fn;
3170 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3171 Otherwise return NULL. This function is analogous to
3172 get_callee_fndecl in tree land. */
3174 static inline tree
3175 gimple_call_fndecl (const gcall *gs)
3177 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3180 static inline tree
3181 gimple_call_fndecl (const gimple *gs)
3183 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3184 return gimple_call_fndecl (gc);
3188 /* Return the type returned by call statement GS. */
3190 static inline tree
3191 gimple_call_return_type (const gcall *gs)
3193 tree type = gimple_call_fntype (gs);
3195 if (type == NULL_TREE)
3196 return TREE_TYPE (gimple_call_lhs (gs));
3198 /* The type returned by a function is the type of its
3199 function type. */
3200 return TREE_TYPE (type);
3204 /* Return the static chain for call statement GS. */
3206 static inline tree
3207 gimple_call_chain (const gcall *gs)
3209 return gs->op[2];
3212 static inline tree
3213 gimple_call_chain (const gimple *gs)
3215 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3216 return gimple_call_chain (gc);
3220 /* Return a pointer to the static chain for call statement CALL_STMT. */
3222 static inline tree *
3223 gimple_call_chain_ptr (gcall *call_stmt)
3225 return &call_stmt->op[2];
3228 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3230 static inline void
3231 gimple_call_set_chain (gcall *call_stmt, tree chain)
3233 call_stmt->op[2] = chain;
3237 /* Return the number of arguments used by call statement GS. */
3239 static inline unsigned
3240 gimple_call_num_args (const gcall *gs)
3242 return gimple_num_ops (gs) - 3;
3245 static inline unsigned
3246 gimple_call_num_args (const gimple *gs)
3248 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3249 return gimple_call_num_args (gc);
3253 /* Return the argument at position INDEX for call statement GS. */
3255 static inline tree
3256 gimple_call_arg (const gcall *gs, unsigned index)
3258 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3259 return gs->op[index + 3];
3262 static inline tree
3263 gimple_call_arg (const gimple *gs, unsigned index)
3265 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3266 return gimple_call_arg (gc, index);
3270 /* Return a pointer to the argument at position INDEX for call
3271 statement GS. */
3273 static inline tree *
3274 gimple_call_arg_ptr (gcall *gs, unsigned index)
3276 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3277 return &gs->op[index + 3];
3280 static inline tree *
3281 gimple_call_arg_ptr (gimple *gs, unsigned index)
3283 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3284 return gimple_call_arg_ptr (gc, index);
3288 /* Set ARG to be the argument at position INDEX for call statement GS. */
3290 static inline void
3291 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3293 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3294 gs->op[index + 3] = arg;
3297 static inline void
3298 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3300 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3301 gimple_call_set_arg (gc, index, arg);
3305 /* If TAIL_P is true, mark call statement S as being a tail call
3306 (i.e., a call just before the exit of a function). These calls are
3307 candidate for tail call optimization. */
3309 static inline void
3310 gimple_call_set_tail (gcall *s, bool tail_p)
3312 if (tail_p)
3313 s->subcode |= GF_CALL_TAILCALL;
3314 else
3315 s->subcode &= ~GF_CALL_TAILCALL;
3319 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3321 static inline bool
3322 gimple_call_tail_p (const gcall *s)
3324 return (s->subcode & GF_CALL_TAILCALL) != 0;
3327 /* Mark (or clear) call statement S as requiring tail call optimization. */
3329 static inline void
3330 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3332 if (must_tail_p)
3333 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3334 else
3335 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3338 /* Return true if call statement has been marked as requiring
3339 tail call optimization. */
3341 static inline bool
3342 gimple_call_must_tail_p (const gcall *s)
3344 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3347 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3348 slot optimization. This transformation uses the target of the call
3349 expansion as the return slot for calls that return in memory. */
3351 static inline void
3352 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3354 if (return_slot_opt_p)
3355 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3356 else
3357 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3361 /* Return true if S is marked for return slot optimization. */
3363 static inline bool
3364 gimple_call_return_slot_opt_p (const gcall *s)
3366 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3370 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3371 thunk to the thunked-to function. */
3373 static inline void
3374 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3376 if (from_thunk_p)
3377 s->subcode |= GF_CALL_FROM_THUNK;
3378 else
3379 s->subcode &= ~GF_CALL_FROM_THUNK;
3383 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3385 static inline bool
3386 gimple_call_from_thunk_p (gcall *s)
3388 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3392 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3393 argument pack in its argument list. */
3395 static inline void
3396 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3398 if (pass_arg_pack_p)
3399 s->subcode |= GF_CALL_VA_ARG_PACK;
3400 else
3401 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3405 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3406 argument pack in its argument list. */
3408 static inline bool
3409 gimple_call_va_arg_pack_p (const gcall *s)
3411 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3415 /* Return true if S is a noreturn call. */
3417 static inline bool
3418 gimple_call_noreturn_p (const gcall *s)
3420 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3423 static inline bool
3424 gimple_call_noreturn_p (const gimple *s)
3426 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3427 return gimple_call_noreturn_p (gc);
3431 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3432 even if the called function can throw in other cases. */
3434 static inline void
3435 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3437 if (nothrow_p)
3438 s->subcode |= GF_CALL_NOTHROW;
3439 else
3440 s->subcode &= ~GF_CALL_NOTHROW;
3443 /* Return true if S is a nothrow call. */
3445 static inline bool
3446 gimple_call_nothrow_p (gcall *s)
3448 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3451 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3452 is known to be emitted for VLA objects. Those are wrapped by
3453 stack_save/stack_restore calls and hence can't lead to unbounded
3454 stack growth even when they occur in loops. */
3456 static inline void
3457 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3459 if (for_var)
3460 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3461 else
3462 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3465 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3467 static inline bool
3468 gimple_call_alloca_for_var_p (gcall *s)
3470 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3473 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3474 pointers to nested function are descriptors instead of trampolines. */
3476 static inline void
3477 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3479 if (by_descriptor_p)
3480 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3481 else
3482 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3485 /* Return true if S is a by-descriptor call. */
3487 static inline bool
3488 gimple_call_by_descriptor_p (gcall *s)
3490 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3493 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3495 static inline void
3496 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3498 dest_call->subcode = orig_call->subcode;
3502 /* Return a pointer to the points-to solution for the set of call-used
3503 variables of the call CALL_STMT. */
3505 static inline struct pt_solution *
3506 gimple_call_use_set (gcall *call_stmt)
3508 return &call_stmt->call_used;
3511 /* As above, but const. */
3513 static inline const pt_solution *
3514 gimple_call_use_set (const gcall *call_stmt)
3516 return &call_stmt->call_used;
3519 /* Return a pointer to the points-to solution for the set of call-used
3520 variables of the call CALL_STMT. */
3522 static inline struct pt_solution *
3523 gimple_call_clobber_set (gcall *call_stmt)
3525 return &call_stmt->call_clobbered;
3528 /* As above, but const. */
3530 static inline const pt_solution *
3531 gimple_call_clobber_set (const gcall *call_stmt)
3533 return &call_stmt->call_clobbered;
3537 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3538 non-NULL lhs. */
3540 static inline bool
3541 gimple_has_lhs (const gimple *stmt)
3543 if (is_gimple_assign (stmt))
3544 return true;
3545 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3546 return gimple_call_lhs (call) != NULL_TREE;
3547 return false;
3551 /* Return the code of the predicate computed by conditional statement GS. */
3553 static inline enum tree_code
3554 gimple_cond_code (const gcond *gs)
3556 return (enum tree_code) gs->subcode;
3559 static inline enum tree_code
3560 gimple_cond_code (const gimple *gs)
3562 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3563 return gimple_cond_code (gc);
3567 /* Set CODE to be the predicate code for the conditional statement GS. */
3569 static inline void
3570 gimple_cond_set_code (gcond *gs, enum tree_code code)
3572 gs->subcode = code;
3576 /* Return the LHS of the predicate computed by conditional statement GS. */
3578 static inline tree
3579 gimple_cond_lhs (const gcond *gs)
3581 return gs->op[0];
3584 static inline tree
3585 gimple_cond_lhs (const gimple *gs)
3587 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3588 return gimple_cond_lhs (gc);
3591 /* Return the pointer to the LHS of the predicate computed by conditional
3592 statement GS. */
3594 static inline tree *
3595 gimple_cond_lhs_ptr (gcond *gs)
3597 return &gs->op[0];
3600 /* Set LHS to be the LHS operand of the predicate computed by
3601 conditional statement GS. */
3603 static inline void
3604 gimple_cond_set_lhs (gcond *gs, tree lhs)
3606 gs->op[0] = lhs;
3610 /* Return the RHS operand of the predicate computed by conditional GS. */
3612 static inline tree
3613 gimple_cond_rhs (const gcond *gs)
3615 return gs->op[1];
3618 static inline tree
3619 gimple_cond_rhs (const gimple *gs)
3621 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3622 return gimple_cond_rhs (gc);
3625 /* Return the pointer to the RHS operand of the predicate computed by
3626 conditional GS. */
3628 static inline tree *
3629 gimple_cond_rhs_ptr (gcond *gs)
3631 return &gs->op[1];
3635 /* Set RHS to be the RHS operand of the predicate computed by
3636 conditional statement GS. */
3638 static inline void
3639 gimple_cond_set_rhs (gcond *gs, tree rhs)
3641 gs->op[1] = rhs;
3645 /* Return the label used by conditional statement GS when its
3646 predicate evaluates to true. */
3648 static inline tree
3649 gimple_cond_true_label (const gcond *gs)
3651 return gs->op[2];
3655 /* Set LABEL to be the label used by conditional statement GS when its
3656 predicate evaluates to true. */
3658 static inline void
3659 gimple_cond_set_true_label (gcond *gs, tree label)
3661 gs->op[2] = label;
3665 /* Set LABEL to be the label used by conditional statement GS when its
3666 predicate evaluates to false. */
3668 static inline void
3669 gimple_cond_set_false_label (gcond *gs, tree label)
3671 gs->op[3] = label;
3675 /* Return the label used by conditional statement GS when its
3676 predicate evaluates to false. */
3678 static inline tree
3679 gimple_cond_false_label (const gcond *gs)
3681 return gs->op[3];
3685 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3687 static inline void
3688 gimple_cond_make_false (gcond *gs)
3690 gimple_cond_set_lhs (gs, boolean_false_node);
3691 gimple_cond_set_rhs (gs, boolean_false_node);
3692 gs->subcode = NE_EXPR;
3696 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3698 static inline void
3699 gimple_cond_make_true (gcond *gs)
3701 gimple_cond_set_lhs (gs, boolean_true_node);
3702 gimple_cond_set_rhs (gs, boolean_false_node);
3703 gs->subcode = NE_EXPR;
3706 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3707 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3709 static inline bool
3710 gimple_cond_true_p (const gcond *gs)
3712 tree lhs = gimple_cond_lhs (gs);
3713 tree rhs = gimple_cond_rhs (gs);
3714 enum tree_code code = gimple_cond_code (gs);
3716 if (lhs != boolean_true_node && lhs != boolean_false_node)
3717 return false;
3719 if (rhs != boolean_true_node && rhs != boolean_false_node)
3720 return false;
3722 if (code == NE_EXPR && lhs != rhs)
3723 return true;
3725 if (code == EQ_EXPR && lhs == rhs)
3726 return true;
3728 return false;
3731 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3732 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3734 static inline bool
3735 gimple_cond_false_p (const gcond *gs)
3737 tree lhs = gimple_cond_lhs (gs);
3738 tree rhs = gimple_cond_rhs (gs);
3739 enum tree_code code = gimple_cond_code (gs);
3741 if (lhs != boolean_true_node && lhs != boolean_false_node)
3742 return false;
3744 if (rhs != boolean_true_node && rhs != boolean_false_node)
3745 return false;
3747 if (code == NE_EXPR && lhs == rhs)
3748 return true;
3750 if (code == EQ_EXPR && lhs != rhs)
3751 return true;
3753 return false;
3756 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3758 static inline void
3759 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3760 tree rhs)
3762 gimple_cond_set_code (stmt, code);
3763 gimple_cond_set_lhs (stmt, lhs);
3764 gimple_cond_set_rhs (stmt, rhs);
3767 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3769 static inline tree
3770 gimple_label_label (const glabel *gs)
3772 return gs->op[0];
3776 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3777 GS. */
3779 static inline void
3780 gimple_label_set_label (glabel *gs, tree label)
3782 gs->op[0] = label;
3786 /* Return the destination of the unconditional jump GS. */
3788 static inline tree
3789 gimple_goto_dest (const gimple *gs)
3791 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3792 return gimple_op (gs, 0);
3796 /* Set DEST to be the destination of the unconditonal jump GS. */
3798 static inline void
3799 gimple_goto_set_dest (ggoto *gs, tree dest)
3801 gs->op[0] = dest;
3805 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3807 static inline tree
3808 gimple_bind_vars (const gbind *bind_stmt)
3810 return bind_stmt->vars;
3814 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3815 statement GS. */
3817 static inline void
3818 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3820 bind_stmt->vars = vars;
3824 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3825 statement GS. */
3827 static inline void
3828 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3830 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3834 static inline gimple_seq *
3835 gimple_bind_body_ptr (gbind *bind_stmt)
3837 return &bind_stmt->body;
3840 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3842 static inline gimple_seq
3843 gimple_bind_body (const gbind *gs)
3845 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3849 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3850 statement GS. */
3852 static inline void
3853 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3855 bind_stmt->body = seq;
3859 /* Append a statement to the end of a GIMPLE_BIND's body. */
3861 static inline void
3862 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3864 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3868 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3870 static inline void
3871 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3873 gimple_seq_add_seq (&bind_stmt->body, seq);
3877 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3878 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3880 static inline tree
3881 gimple_bind_block (const gbind *bind_stmt)
3883 return bind_stmt->block;
3887 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3888 statement GS. */
3890 static inline void
3891 gimple_bind_set_block (gbind *bind_stmt, tree block)
3893 gcc_gimple_checking_assert (block == NULL_TREE
3894 || TREE_CODE (block) == BLOCK);
3895 bind_stmt->block = block;
3899 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3901 static inline unsigned
3902 gimple_asm_ninputs (const gasm *asm_stmt)
3904 return asm_stmt->ni;
3908 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3910 static inline unsigned
3911 gimple_asm_noutputs (const gasm *asm_stmt)
3913 return asm_stmt->no;
3917 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3919 static inline unsigned
3920 gimple_asm_nclobbers (const gasm *asm_stmt)
3922 return asm_stmt->nc;
3925 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3927 static inline unsigned
3928 gimple_asm_nlabels (const gasm *asm_stmt)
3930 return asm_stmt->nl;
3933 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3935 static inline tree
3936 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3938 gcc_gimple_checking_assert (index < asm_stmt->ni);
3939 return asm_stmt->op[index + asm_stmt->no];
3942 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3944 static inline void
3945 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3947 gcc_gimple_checking_assert (index < asm_stmt->ni
3948 && TREE_CODE (in_op) == TREE_LIST);
3949 asm_stmt->op[index + asm_stmt->no] = in_op;
3953 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3955 static inline tree
3956 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3958 gcc_gimple_checking_assert (index < asm_stmt->no);
3959 return asm_stmt->op[index];
3962 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3964 static inline void
3965 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3967 gcc_gimple_checking_assert (index < asm_stmt->no
3968 && TREE_CODE (out_op) == TREE_LIST);
3969 asm_stmt->op[index] = out_op;
3973 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3975 static inline tree
3976 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3978 gcc_gimple_checking_assert (index < asm_stmt->nc);
3979 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3983 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3985 static inline void
3986 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3988 gcc_gimple_checking_assert (index < asm_stmt->nc
3989 && TREE_CODE (clobber_op) == TREE_LIST);
3990 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3993 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3995 static inline tree
3996 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3998 gcc_gimple_checking_assert (index < asm_stmt->nl);
3999 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
4002 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4004 static inline void
4005 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4007 gcc_gimple_checking_assert (index < asm_stmt->nl
4008 && TREE_CODE (label_op) == TREE_LIST);
4009 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
4012 /* Return the string representing the assembly instruction in
4013 GIMPLE_ASM ASM_STMT. */
4015 static inline const char *
4016 gimple_asm_string (const gasm *asm_stmt)
4018 return asm_stmt->string;
4022 /* Return true if ASM_STMT is marked volatile. */
4024 static inline bool
4025 gimple_asm_volatile_p (const gasm *asm_stmt)
4027 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4031 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4033 static inline void
4034 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4036 if (volatile_p)
4037 asm_stmt->subcode |= GF_ASM_VOLATILE;
4038 else
4039 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4043 /* Return true if ASM_STMT is marked inline. */
4045 static inline bool
4046 gimple_asm_inline_p (const gasm *asm_stmt)
4048 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4052 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4054 static inline void
4055 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4057 if (inline_p)
4058 asm_stmt->subcode |= GF_ASM_INLINE;
4059 else
4060 asm_stmt->subcode &= ~GF_ASM_INLINE;
4064 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4066 static inline void
4067 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4069 if (input_p)
4070 asm_stmt->subcode |= GF_ASM_INPUT;
4071 else
4072 asm_stmt->subcode &= ~GF_ASM_INPUT;
4076 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4078 static inline bool
4079 gimple_asm_input_p (const gasm *asm_stmt)
4081 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4085 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4087 static inline tree
4088 gimple_catch_types (const gcatch *catch_stmt)
4090 return catch_stmt->types;
4094 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4096 static inline tree *
4097 gimple_catch_types_ptr (gcatch *catch_stmt)
4099 return &catch_stmt->types;
4103 /* Return a pointer to the GIMPLE sequence representing the body of
4104 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4106 static inline gimple_seq *
4107 gimple_catch_handler_ptr (gcatch *catch_stmt)
4109 return &catch_stmt->handler;
4113 /* Return the GIMPLE sequence representing the body of the handler of
4114 GIMPLE_CATCH statement CATCH_STMT. */
4116 static inline gimple_seq
4117 gimple_catch_handler (const gcatch *catch_stmt)
4119 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4123 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4125 static inline void
4126 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4128 catch_stmt->types = t;
4132 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4134 static inline void
4135 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4137 catch_stmt->handler = handler;
4141 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4143 static inline tree
4144 gimple_eh_filter_types (const gimple *gs)
4146 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4147 return eh_filter_stmt->types;
4151 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4152 GS. */
4154 static inline tree *
4155 gimple_eh_filter_types_ptr (gimple *gs)
4157 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4158 return &eh_filter_stmt->types;
4162 /* Return a pointer to the sequence of statement to execute when
4163 GIMPLE_EH_FILTER statement fails. */
4165 static inline gimple_seq *
4166 gimple_eh_filter_failure_ptr (gimple *gs)
4168 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4169 return &eh_filter_stmt->failure;
4173 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4174 statement fails. */
4176 static inline gimple_seq
4177 gimple_eh_filter_failure (const gimple *gs)
4179 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4183 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4184 EH_FILTER_STMT. */
4186 static inline void
4187 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4189 eh_filter_stmt->types = types;
4193 /* Set FAILURE to be the sequence of statements to execute on failure
4194 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4196 static inline void
4197 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4198 gimple_seq failure)
4200 eh_filter_stmt->failure = failure;
4203 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4205 static inline tree
4206 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4208 return eh_mnt_stmt->fndecl;
4211 /* Set the function decl to be called by GS to DECL. */
4213 static inline void
4214 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4215 tree decl)
4217 eh_mnt_stmt->fndecl = decl;
4220 /* GIMPLE_EH_ELSE accessors. */
4222 static inline gimple_seq *
4223 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4225 return &eh_else_stmt->n_body;
4228 static inline gimple_seq
4229 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4231 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4234 static inline gimple_seq *
4235 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4237 return &eh_else_stmt->e_body;
4240 static inline gimple_seq
4241 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4243 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4246 static inline void
4247 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4249 eh_else_stmt->n_body = seq;
4252 static inline void
4253 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4255 eh_else_stmt->e_body = seq;
4258 /* GIMPLE_TRY accessors. */
4260 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4261 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4263 static inline enum gimple_try_flags
4264 gimple_try_kind (const gimple *gs)
4266 GIMPLE_CHECK (gs, GIMPLE_TRY);
4267 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4271 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4273 static inline void
4274 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4276 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4277 || kind == GIMPLE_TRY_FINALLY);
4278 if (gimple_try_kind (gs) != kind)
4279 gs->subcode = (unsigned int) kind;
4283 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4285 static inline bool
4286 gimple_try_catch_is_cleanup (const gimple *gs)
4288 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4289 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4293 /* Return a pointer to the sequence of statements used as the
4294 body for GIMPLE_TRY GS. */
4296 static inline gimple_seq *
4297 gimple_try_eval_ptr (gimple *gs)
4299 gtry *try_stmt = as_a <gtry *> (gs);
4300 return &try_stmt->eval;
4304 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4306 static inline gimple_seq
4307 gimple_try_eval (const gimple *gs)
4309 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4313 /* Return a pointer to the sequence of statements used as the cleanup body for
4314 GIMPLE_TRY GS. */
4316 static inline gimple_seq *
4317 gimple_try_cleanup_ptr (gimple *gs)
4319 gtry *try_stmt = as_a <gtry *> (gs);
4320 return &try_stmt->cleanup;
4324 /* Return the sequence of statements used as the cleanup body for
4325 GIMPLE_TRY GS. */
4327 static inline gimple_seq
4328 gimple_try_cleanup (const gimple *gs)
4330 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4334 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4336 static inline void
4337 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4339 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4340 if (catch_is_cleanup)
4341 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4342 else
4343 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4347 /* Set EVAL to be the sequence of statements to use as the body for
4348 GIMPLE_TRY TRY_STMT. */
4350 static inline void
4351 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4353 try_stmt->eval = eval;
4357 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4358 body for GIMPLE_TRY TRY_STMT. */
4360 static inline void
4361 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4363 try_stmt->cleanup = cleanup;
4367 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4369 static inline gimple_seq *
4370 gimple_wce_cleanup_ptr (gimple *gs)
4372 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4373 return &wce_stmt->cleanup;
4377 /* Return the cleanup sequence for cleanup statement GS. */
4379 static inline gimple_seq
4380 gimple_wce_cleanup (gimple *gs)
4382 return *gimple_wce_cleanup_ptr (gs);
4386 /* Set CLEANUP to be the cleanup sequence for GS. */
4388 static inline void
4389 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4391 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4392 wce_stmt->cleanup = cleanup;
4396 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4398 static inline bool
4399 gimple_wce_cleanup_eh_only (const gimple *gs)
4401 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4402 return gs->subcode != 0;
4406 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4408 static inline void
4409 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4411 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4412 gs->subcode = (unsigned int) eh_only_p;
4416 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4418 static inline unsigned
4419 gimple_phi_capacity (const gimple *gs)
4421 const gphi *phi_stmt = as_a <const gphi *> (gs);
4422 return phi_stmt->capacity;
4426 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4427 be exactly the number of incoming edges for the basic block holding
4428 GS. */
4430 static inline unsigned
4431 gimple_phi_num_args (const gimple *gs)
4433 const gphi *phi_stmt = as_a <const gphi *> (gs);
4434 return phi_stmt->nargs;
4438 /* Return the SSA name created by GIMPLE_PHI GS. */
4440 static inline tree
4441 gimple_phi_result (const gphi *gs)
4443 return gs->result;
4446 static inline tree
4447 gimple_phi_result (const gimple *gs)
4449 const gphi *phi_stmt = as_a <const gphi *> (gs);
4450 return gimple_phi_result (phi_stmt);
4453 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4455 static inline tree *
4456 gimple_phi_result_ptr (gphi *gs)
4458 return &gs->result;
4461 static inline tree *
4462 gimple_phi_result_ptr (gimple *gs)
4464 gphi *phi_stmt = as_a <gphi *> (gs);
4465 return gimple_phi_result_ptr (phi_stmt);
4468 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4470 static inline void
4471 gimple_phi_set_result (gphi *phi, tree result)
4473 phi->result = result;
4474 if (result && TREE_CODE (result) == SSA_NAME)
4475 SSA_NAME_DEF_STMT (result) = phi;
4479 /* Return the PHI argument corresponding to incoming edge INDEX for
4480 GIMPLE_PHI GS. */
4482 static inline struct phi_arg_d *
4483 gimple_phi_arg (gphi *gs, unsigned index)
4485 gcc_gimple_checking_assert (index < gs->nargs);
4486 return &(gs->args[index]);
4489 static inline const phi_arg_d *
4490 gimple_phi_arg (const gphi *gs, unsigned index)
4492 gcc_gimple_checking_assert (index < gs->nargs);
4493 return &(gs->args[index]);
4496 static inline struct phi_arg_d *
4497 gimple_phi_arg (gimple *gs, unsigned index)
4499 gphi *phi_stmt = as_a <gphi *> (gs);
4500 return gimple_phi_arg (phi_stmt, index);
4503 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4504 for GIMPLE_PHI PHI. */
4506 static inline void
4507 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4509 gcc_gimple_checking_assert (index < phi->nargs);
4510 phi->args[index] = *phiarg;
4513 /* Return the PHI nodes for basic block BB, or NULL if there are no
4514 PHI nodes. */
4516 static inline gimple_seq
4517 phi_nodes (const_basic_block bb)
4519 gcc_checking_assert (!(bb->flags & BB_RTL));
4520 return bb->il.gimple.phi_nodes;
4523 /* Return a pointer to the PHI nodes for basic block BB. */
4525 static inline gimple_seq *
4526 phi_nodes_ptr (basic_block bb)
4528 gcc_checking_assert (!(bb->flags & BB_RTL));
4529 return &bb->il.gimple.phi_nodes;
4532 /* Return the tree operand for argument I of PHI node GS. */
4534 static inline tree
4535 gimple_phi_arg_def (const gphi *gs, size_t index)
4537 return gimple_phi_arg (gs, index)->def;
4540 static inline tree
4541 gimple_phi_arg_def (gimple *gs, size_t index)
4543 return gimple_phi_arg (gs, index)->def;
4547 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4549 static inline tree *
4550 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4552 return &gimple_phi_arg (phi, index)->def;
4555 /* Return the edge associated with argument I of phi node PHI. */
4557 static inline edge
4558 gimple_phi_arg_edge (const gphi *phi, size_t i)
4560 return EDGE_PRED (gimple_bb (phi), i);
4563 /* Return the source location of gimple argument I of phi node PHI. */
4565 static inline location_t
4566 gimple_phi_arg_location (const gphi *phi, size_t i)
4568 return gimple_phi_arg (phi, i)->locus;
4571 /* Return the source location of the argument on edge E of phi node PHI. */
4573 static inline location_t
4574 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4576 return gimple_phi_arg (phi, e->dest_idx)->locus;
4579 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4581 static inline void
4582 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4584 gimple_phi_arg (phi, i)->locus = loc;
4587 /* Return TRUE if argument I of phi node PHI has a location record. */
4589 static inline bool
4590 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4592 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4596 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4598 static inline int
4599 gimple_resx_region (const gresx *resx_stmt)
4601 return resx_stmt->region;
4604 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4606 static inline void
4607 gimple_resx_set_region (gresx *resx_stmt, int region)
4609 resx_stmt->region = region;
4612 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4614 static inline int
4615 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4617 return eh_dispatch_stmt->region;
4620 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4621 EH_DISPATCH_STMT. */
4623 static inline void
4624 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4626 eh_dispatch_stmt->region = region;
4629 /* Return the number of labels associated with the switch statement GS. */
4631 static inline unsigned
4632 gimple_switch_num_labels (const gswitch *gs)
4634 unsigned num_ops;
4635 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4636 num_ops = gimple_num_ops (gs);
4637 gcc_gimple_checking_assert (num_ops > 1);
4638 return num_ops - 1;
4642 /* Set NLABELS to be the number of labels for the switch statement GS. */
4644 static inline void
4645 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4647 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4648 gimple_set_num_ops (g, nlabels + 1);
4652 /* Return the index variable used by the switch statement GS. */
4654 static inline tree
4655 gimple_switch_index (const gswitch *gs)
4657 return gs->op[0];
4661 /* Return a pointer to the index variable for the switch statement GS. */
4663 static inline tree *
4664 gimple_switch_index_ptr (gswitch *gs)
4666 return &gs->op[0];
4670 /* Set INDEX to be the index variable for switch statement GS. */
4672 static inline void
4673 gimple_switch_set_index (gswitch *gs, tree index)
4675 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4676 gs->op[0] = index;
4680 /* Return the label numbered INDEX. The default label is 0, followed by any
4681 labels in a switch statement. */
4683 static inline tree
4684 gimple_switch_label (const gswitch *gs, unsigned index)
4686 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4687 return gs->op[index + 1];
4690 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4692 static inline void
4693 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4695 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4696 && (label == NULL_TREE
4697 || TREE_CODE (label) == CASE_LABEL_EXPR));
4698 gs->op[index + 1] = label;
4701 /* Return the default label for a switch statement. */
4703 static inline tree
4704 gimple_switch_default_label (const gswitch *gs)
4706 tree label = gimple_switch_label (gs, 0);
4707 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4708 return label;
4711 /* Set the default label for a switch statement. */
4713 static inline void
4714 gimple_switch_set_default_label (gswitch *gs, tree label)
4716 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4717 gimple_switch_set_label (gs, 0, label);
4720 /* Return true if GS is a GIMPLE_DEBUG statement. */
4722 static inline bool
4723 is_gimple_debug (const gimple *gs)
4725 return gimple_code (gs) == GIMPLE_DEBUG;
4729 /* Return the last nondebug statement in GIMPLE sequence S. */
4731 static inline gimple *
4732 gimple_seq_last_nondebug_stmt (gimple_seq s)
4734 gimple_seq_node n;
4735 for (n = gimple_seq_last (s);
4736 n && is_gimple_debug (n);
4737 n = n->prev)
4738 if (n->prev == s)
4739 return NULL;
4740 return n;
4744 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4746 static inline bool
4747 gimple_debug_bind_p (const gimple *s)
4749 if (is_gimple_debug (s))
4750 return s->subcode == GIMPLE_DEBUG_BIND;
4752 return false;
4755 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4757 static inline tree
4758 gimple_debug_bind_get_var (const gimple *dbg)
4760 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4761 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4762 return gimple_op (dbg, 0);
4765 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4766 statement. */
4768 static inline tree
4769 gimple_debug_bind_get_value (const gimple *dbg)
4771 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4772 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4773 return gimple_op (dbg, 1);
4776 /* Return a pointer to the value bound to the variable in a
4777 GIMPLE_DEBUG bind statement. */
4779 static inline tree *
4780 gimple_debug_bind_get_value_ptr (gimple *dbg)
4782 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4783 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4784 return gimple_op_ptr (dbg, 1);
4787 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4789 static inline void
4790 gimple_debug_bind_set_var (gimple *dbg, tree var)
4792 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4793 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4794 gimple_set_op (dbg, 0, var);
4797 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4798 statement. */
4800 static inline void
4801 gimple_debug_bind_set_value (gimple *dbg, tree value)
4803 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4804 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4805 gimple_set_op (dbg, 1, value);
4808 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4809 optimized away. */
4810 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4812 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4813 statement. */
4815 static inline void
4816 gimple_debug_bind_reset_value (gimple *dbg)
4818 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4819 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4820 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4823 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4824 value. */
4826 static inline bool
4827 gimple_debug_bind_has_value_p (gimple *dbg)
4829 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4830 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4831 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4834 #undef GIMPLE_DEBUG_BIND_NOVALUE
4836 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4838 static inline bool
4839 gimple_debug_source_bind_p (const gimple *s)
4841 if (is_gimple_debug (s))
4842 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4844 return false;
4847 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4849 static inline tree
4850 gimple_debug_source_bind_get_var (const gimple *dbg)
4852 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4853 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4854 return gimple_op (dbg, 0);
4857 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4858 statement. */
4860 static inline tree
4861 gimple_debug_source_bind_get_value (const gimple *dbg)
4863 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4864 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4865 return gimple_op (dbg, 1);
4868 /* Return a pointer to the value bound to the variable in a
4869 GIMPLE_DEBUG source bind statement. */
4871 static inline tree *
4872 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4874 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4875 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4876 return gimple_op_ptr (dbg, 1);
4879 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4881 static inline void
4882 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4884 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4885 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4886 gimple_set_op (dbg, 0, var);
4889 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4890 statement. */
4892 static inline void
4893 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4895 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4896 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4897 gimple_set_op (dbg, 1, value);
4900 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4902 static inline bool
4903 gimple_debug_begin_stmt_p (const gimple *s)
4905 if (is_gimple_debug (s))
4906 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4908 return false;
4911 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4913 static inline bool
4914 gimple_debug_inline_entry_p (const gimple *s)
4916 if (is_gimple_debug (s))
4917 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4919 return false;
4922 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4924 static inline bool
4925 gimple_debug_nonbind_marker_p (const gimple *s)
4927 if (is_gimple_debug (s))
4928 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
4929 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4931 return false;
4934 /* Return the line number for EXPR, or return -1 if we have no line
4935 number information for it. */
4936 static inline int
4937 get_lineno (const gimple *stmt)
4939 location_t loc;
4941 if (!stmt)
4942 return -1;
4944 loc = gimple_location (stmt);
4945 if (loc == UNKNOWN_LOCATION)
4946 return -1;
4948 return LOCATION_LINE (loc);
4951 /* Return a pointer to the body for the OMP statement GS. */
4953 static inline gimple_seq *
4954 gimple_omp_body_ptr (gimple *gs)
4956 return &static_cast <gimple_statement_omp *> (gs)->body;
4959 /* Return the body for the OMP statement GS. */
4961 static inline gimple_seq
4962 gimple_omp_body (const gimple *gs)
4964 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
4967 /* Set BODY to be the body for the OMP statement GS. */
4969 static inline void
4970 gimple_omp_set_body (gimple *gs, gimple_seq body)
4972 static_cast <gimple_statement_omp *> (gs)->body = body;
4976 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4978 static inline tree
4979 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4981 return crit_stmt->name;
4985 /* Return a pointer to the name associated with OMP critical statement
4986 CRIT_STMT. */
4988 static inline tree *
4989 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4991 return &crit_stmt->name;
4995 /* Set NAME to be the name associated with OMP critical statement
4996 CRIT_STMT. */
4998 static inline void
4999 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5001 crit_stmt->name = name;
5005 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5007 static inline tree
5008 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5010 return crit_stmt->clauses;
5014 /* Return a pointer to the clauses associated with OMP critical statement
5015 CRIT_STMT. */
5017 static inline tree *
5018 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5020 return &crit_stmt->clauses;
5024 /* Set CLAUSES to be the clauses associated with OMP critical statement
5025 CRIT_STMT. */
5027 static inline void
5028 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5030 crit_stmt->clauses = clauses;
5034 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5036 static inline tree
5037 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5039 return ord_stmt->clauses;
5043 /* Return a pointer to the clauses associated with OMP ordered statement
5044 ORD_STMT. */
5046 static inline tree *
5047 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5049 return &ord_stmt->clauses;
5053 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5054 ORD_STMT. */
5056 static inline void
5057 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5059 ord_stmt->clauses = clauses;
5063 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5065 static inline tree
5066 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5068 return scan_stmt->clauses;
5072 /* Return a pointer to the clauses associated with OMP scan statement
5073 ORD_STMT. */
5075 static inline tree *
5076 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5078 return &scan_stmt->clauses;
5082 /* Set CLAUSES to be the clauses associated with OMP scan statement
5083 ORD_STMT. */
5085 static inline void
5086 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5088 scan_stmt->clauses = clauses;
5092 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5094 static inline tree
5095 gimple_omp_taskgroup_clauses (const gimple *gs)
5097 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5098 return
5099 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5103 /* Return a pointer to the clauses associated with OMP taskgroup statement
5104 GS. */
5106 static inline tree *
5107 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5109 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5110 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5114 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5115 GS. */
5117 static inline void
5118 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5120 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5121 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5122 = clauses;
5126 /* Return the kind of the OMP_FOR statemement G. */
5128 static inline int
5129 gimple_omp_for_kind (const gimple *g)
5131 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5132 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5136 /* Set the kind of the OMP_FOR statement G. */
5138 static inline void
5139 gimple_omp_for_set_kind (gomp_for *g, int kind)
5141 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5142 | (kind & GF_OMP_FOR_KIND_MASK);
5146 /* Return true if OMP_FOR statement G has the
5147 GF_OMP_FOR_COMBINED flag set. */
5149 static inline bool
5150 gimple_omp_for_combined_p (const gimple *g)
5152 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5153 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5157 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5158 the boolean value of COMBINED_P. */
5160 static inline void
5161 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5163 if (combined_p)
5164 g->subcode |= GF_OMP_FOR_COMBINED;
5165 else
5166 g->subcode &= ~GF_OMP_FOR_COMBINED;
5170 /* Return true if the OMP_FOR statement G has the
5171 GF_OMP_FOR_COMBINED_INTO flag set. */
5173 static inline bool
5174 gimple_omp_for_combined_into_p (const gimple *g)
5176 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5177 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5181 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5182 on the boolean value of COMBINED_P. */
5184 static inline void
5185 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5187 if (combined_p)
5188 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5189 else
5190 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5194 /* Return the clauses associated with the OMP_FOR statement GS. */
5196 static inline tree
5197 gimple_omp_for_clauses (const gimple *gs)
5199 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5200 return omp_for_stmt->clauses;
5204 /* Return a pointer to the clauses associated with the OMP_FOR statement
5205 GS. */
5207 static inline tree *
5208 gimple_omp_for_clauses_ptr (gimple *gs)
5210 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5211 return &omp_for_stmt->clauses;
5215 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5216 GS. */
5218 static inline void
5219 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5221 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5222 omp_for_stmt->clauses = clauses;
5226 /* Get the collapse count of the OMP_FOR statement GS. */
5228 static inline size_t
5229 gimple_omp_for_collapse (const gimple *gs)
5231 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5232 return omp_for_stmt->collapse;
5236 /* Return the condition code associated with the OMP_FOR statement GS. */
5238 static inline enum tree_code
5239 gimple_omp_for_cond (const gimple *gs, size_t i)
5241 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5242 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5243 return omp_for_stmt->iter[i].cond;
5247 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5249 static inline void
5250 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5252 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5253 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5254 && i < omp_for_stmt->collapse);
5255 omp_for_stmt->iter[i].cond = cond;
5259 /* Return the index variable for the OMP_FOR statement GS. */
5261 static inline tree
5262 gimple_omp_for_index (const gimple *gs, size_t i)
5264 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5265 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5266 return omp_for_stmt->iter[i].index;
5270 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5272 static inline tree *
5273 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5275 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5276 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5277 return &omp_for_stmt->iter[i].index;
5281 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5283 static inline void
5284 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5286 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5287 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5288 omp_for_stmt->iter[i].index = index;
5292 /* Return the initial value for the OMP_FOR statement GS. */
5294 static inline tree
5295 gimple_omp_for_initial (const gimple *gs, size_t i)
5297 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5298 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5299 return omp_for_stmt->iter[i].initial;
5303 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5305 static inline tree *
5306 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5308 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5309 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5310 return &omp_for_stmt->iter[i].initial;
5314 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5316 static inline void
5317 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5319 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5320 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5321 omp_for_stmt->iter[i].initial = initial;
5325 /* Return the final value for the OMP_FOR statement GS. */
5327 static inline tree
5328 gimple_omp_for_final (const gimple *gs, size_t i)
5330 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5331 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5332 return omp_for_stmt->iter[i].final;
5336 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5338 static inline tree *
5339 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5341 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5342 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5343 return &omp_for_stmt->iter[i].final;
5347 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5349 static inline void
5350 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5352 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5353 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5354 omp_for_stmt->iter[i].final = final;
5358 /* Return the increment value for the OMP_FOR statement GS. */
5360 static inline tree
5361 gimple_omp_for_incr (const gimple *gs, size_t i)
5363 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5364 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5365 return omp_for_stmt->iter[i].incr;
5369 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5371 static inline tree *
5372 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5374 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5375 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5376 return &omp_for_stmt->iter[i].incr;
5380 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5382 static inline void
5383 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5385 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5386 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5387 omp_for_stmt->iter[i].incr = incr;
5391 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5392 statement GS starts. */
5394 static inline gimple_seq *
5395 gimple_omp_for_pre_body_ptr (gimple *gs)
5397 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5398 return &omp_for_stmt->pre_body;
5402 /* Return the sequence of statements to execute before the OMP_FOR
5403 statement GS starts. */
5405 static inline gimple_seq
5406 gimple_omp_for_pre_body (const gimple *gs)
5408 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5412 /* Set PRE_BODY to be the sequence of statements to execute before the
5413 OMP_FOR statement GS starts. */
5415 static inline void
5416 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5418 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5419 omp_for_stmt->pre_body = pre_body;
5422 /* Return the kernel_phony of OMP_FOR statement. */
5424 static inline bool
5425 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5427 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5428 != GF_OMP_FOR_KIND_GRID_LOOP);
5429 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5432 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5434 static inline void
5435 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5437 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5438 != GF_OMP_FOR_KIND_GRID_LOOP);
5439 if (value)
5440 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5441 else
5442 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5445 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5447 static inline bool
5448 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5450 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5451 == GF_OMP_FOR_KIND_GRID_LOOP);
5452 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5455 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5457 static inline void
5458 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5460 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5461 == GF_OMP_FOR_KIND_GRID_LOOP);
5462 if (value)
5463 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5464 else
5465 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5468 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5469 groups. */
5471 static inline bool
5472 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5474 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5475 == GF_OMP_FOR_KIND_GRID_LOOP);
5476 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5479 /* Set group_iter flag of OMP_FOR to VALUE. */
5481 static inline void
5482 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5484 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5485 == GF_OMP_FOR_KIND_GRID_LOOP);
5486 if (value)
5487 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5488 else
5489 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5492 /* Return the clauses associated with OMP_PARALLEL GS. */
5494 static inline tree
5495 gimple_omp_parallel_clauses (const gimple *gs)
5497 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5498 return omp_parallel_stmt->clauses;
5502 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5504 static inline tree *
5505 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5507 return &omp_parallel_stmt->clauses;
5511 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5513 static inline void
5514 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5515 tree clauses)
5517 omp_parallel_stmt->clauses = clauses;
5521 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5523 static inline tree
5524 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5526 return omp_parallel_stmt->child_fn;
5529 /* Return a pointer to the child function used to hold the body of
5530 OMP_PARALLEL_STMT. */
5532 static inline tree *
5533 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5535 return &omp_parallel_stmt->child_fn;
5539 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5541 static inline void
5542 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5543 tree child_fn)
5545 omp_parallel_stmt->child_fn = child_fn;
5549 /* Return the artificial argument used to send variables and values
5550 from the parent to the children threads in OMP_PARALLEL_STMT. */
5552 static inline tree
5553 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5555 return omp_parallel_stmt->data_arg;
5559 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5561 static inline tree *
5562 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5564 return &omp_parallel_stmt->data_arg;
5568 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5570 static inline void
5571 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5572 tree data_arg)
5574 omp_parallel_stmt->data_arg = data_arg;
5577 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5579 static inline bool
5580 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5582 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5585 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5587 static inline void
5588 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5590 if (value)
5591 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5592 else
5593 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5596 /* Return the clauses associated with OMP_TASK GS. */
5598 static inline tree
5599 gimple_omp_task_clauses (const gimple *gs)
5601 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5602 return omp_task_stmt->clauses;
5606 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5608 static inline tree *
5609 gimple_omp_task_clauses_ptr (gimple *gs)
5611 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5612 return &omp_task_stmt->clauses;
5616 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5617 GS. */
5619 static inline void
5620 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5622 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5623 omp_task_stmt->clauses = clauses;
5627 /* Return true if OMP task statement G has the
5628 GF_OMP_TASK_TASKLOOP flag set. */
5630 static inline bool
5631 gimple_omp_task_taskloop_p (const gimple *g)
5633 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5634 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5638 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5639 value of TASKLOOP_P. */
5641 static inline void
5642 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5644 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5645 if (taskloop_p)
5646 g->subcode |= GF_OMP_TASK_TASKLOOP;
5647 else
5648 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5652 /* Return true if OMP task statement G has the
5653 GF_OMP_TASK_TASKWAIT flag set. */
5655 static inline bool
5656 gimple_omp_task_taskwait_p (const gimple *g)
5658 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5659 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5663 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5664 value of TASKWAIT_P. */
5666 static inline void
5667 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5669 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5670 if (taskwait_p)
5671 g->subcode |= GF_OMP_TASK_TASKWAIT;
5672 else
5673 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5677 /* Return the child function used to hold the body of OMP_TASK GS. */
5679 static inline tree
5680 gimple_omp_task_child_fn (const gimple *gs)
5682 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5683 return omp_task_stmt->child_fn;
5686 /* Return a pointer to the child function used to hold the body of
5687 OMP_TASK GS. */
5689 static inline tree *
5690 gimple_omp_task_child_fn_ptr (gimple *gs)
5692 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5693 return &omp_task_stmt->child_fn;
5697 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5699 static inline void
5700 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5702 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5703 omp_task_stmt->child_fn = child_fn;
5707 /* Return the artificial argument used to send variables and values
5708 from the parent to the children threads in OMP_TASK GS. */
5710 static inline tree
5711 gimple_omp_task_data_arg (const gimple *gs)
5713 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5714 return omp_task_stmt->data_arg;
5718 /* Return a pointer to the data argument for OMP_TASK GS. */
5720 static inline tree *
5721 gimple_omp_task_data_arg_ptr (gimple *gs)
5723 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5724 return &omp_task_stmt->data_arg;
5728 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5730 static inline void
5731 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5733 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5734 omp_task_stmt->data_arg = data_arg;
5738 /* Return the clauses associated with OMP_TASK GS. */
5740 static inline tree
5741 gimple_omp_taskreg_clauses (const gimple *gs)
5743 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5744 = as_a <const gimple_statement_omp_taskreg *> (gs);
5745 return omp_taskreg_stmt->clauses;
5749 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5751 static inline tree *
5752 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5754 gimple_statement_omp_taskreg *omp_taskreg_stmt
5755 = as_a <gimple_statement_omp_taskreg *> (gs);
5756 return &omp_taskreg_stmt->clauses;
5760 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5761 GS. */
5763 static inline void
5764 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5766 gimple_statement_omp_taskreg *omp_taskreg_stmt
5767 = as_a <gimple_statement_omp_taskreg *> (gs);
5768 omp_taskreg_stmt->clauses = clauses;
5772 /* Return the child function used to hold the body of OMP_TASK GS. */
5774 static inline tree
5775 gimple_omp_taskreg_child_fn (const gimple *gs)
5777 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5778 = as_a <const gimple_statement_omp_taskreg *> (gs);
5779 return omp_taskreg_stmt->child_fn;
5782 /* Return a pointer to the child function used to hold the body of
5783 OMP_TASK GS. */
5785 static inline tree *
5786 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5788 gimple_statement_omp_taskreg *omp_taskreg_stmt
5789 = as_a <gimple_statement_omp_taskreg *> (gs);
5790 return &omp_taskreg_stmt->child_fn;
5794 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5796 static inline void
5797 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5799 gimple_statement_omp_taskreg *omp_taskreg_stmt
5800 = as_a <gimple_statement_omp_taskreg *> (gs);
5801 omp_taskreg_stmt->child_fn = child_fn;
5805 /* Return the artificial argument used to send variables and values
5806 from the parent to the children threads in OMP_TASK GS. */
5808 static inline tree
5809 gimple_omp_taskreg_data_arg (const gimple *gs)
5811 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5812 = as_a <const gimple_statement_omp_taskreg *> (gs);
5813 return omp_taskreg_stmt->data_arg;
5817 /* Return a pointer to the data argument for OMP_TASK GS. */
5819 static inline tree *
5820 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5822 gimple_statement_omp_taskreg *omp_taskreg_stmt
5823 = as_a <gimple_statement_omp_taskreg *> (gs);
5824 return &omp_taskreg_stmt->data_arg;
5828 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5830 static inline void
5831 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5833 gimple_statement_omp_taskreg *omp_taskreg_stmt
5834 = as_a <gimple_statement_omp_taskreg *> (gs);
5835 omp_taskreg_stmt->data_arg = data_arg;
5839 /* Return the copy function used to hold the body of OMP_TASK GS. */
5841 static inline tree
5842 gimple_omp_task_copy_fn (const gimple *gs)
5844 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5845 return omp_task_stmt->copy_fn;
5848 /* Return a pointer to the copy function used to hold the body of
5849 OMP_TASK GS. */
5851 static inline tree *
5852 gimple_omp_task_copy_fn_ptr (gimple *gs)
5854 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5855 return &omp_task_stmt->copy_fn;
5859 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5861 static inline void
5862 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5864 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5865 omp_task_stmt->copy_fn = copy_fn;
5869 /* Return size of the data block in bytes in OMP_TASK GS. */
5871 static inline tree
5872 gimple_omp_task_arg_size (const gimple *gs)
5874 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5875 return omp_task_stmt->arg_size;
5879 /* Return a pointer to the data block size for OMP_TASK GS. */
5881 static inline tree *
5882 gimple_omp_task_arg_size_ptr (gimple *gs)
5884 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5885 return &omp_task_stmt->arg_size;
5889 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5891 static inline void
5892 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5894 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5895 omp_task_stmt->arg_size = arg_size;
5899 /* Return align of the data block in bytes in OMP_TASK GS. */
5901 static inline tree
5902 gimple_omp_task_arg_align (const gimple *gs)
5904 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5905 return omp_task_stmt->arg_align;
5909 /* Return a pointer to the data block align for OMP_TASK GS. */
5911 static inline tree *
5912 gimple_omp_task_arg_align_ptr (gimple *gs)
5914 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5915 return &omp_task_stmt->arg_align;
5919 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5921 static inline void
5922 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5924 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5925 omp_task_stmt->arg_align = arg_align;
5929 /* Return the clauses associated with OMP_SINGLE GS. */
5931 static inline tree
5932 gimple_omp_single_clauses (const gimple *gs)
5934 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5935 return omp_single_stmt->clauses;
5939 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5941 static inline tree *
5942 gimple_omp_single_clauses_ptr (gimple *gs)
5944 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5945 return &omp_single_stmt->clauses;
5949 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5951 static inline void
5952 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5954 omp_single_stmt->clauses = clauses;
5958 /* Return the clauses associated with OMP_TARGET GS. */
5960 static inline tree
5961 gimple_omp_target_clauses (const gimple *gs)
5963 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5964 return omp_target_stmt->clauses;
5968 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5970 static inline tree *
5971 gimple_omp_target_clauses_ptr (gimple *gs)
5973 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5974 return &omp_target_stmt->clauses;
5978 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5980 static inline void
5981 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5982 tree clauses)
5984 omp_target_stmt->clauses = clauses;
5988 /* Return the kind of the OMP_TARGET G. */
5990 static inline int
5991 gimple_omp_target_kind (const gimple *g)
5993 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5994 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5998 /* Set the kind of the OMP_TARGET G. */
6000 static inline void
6001 gimple_omp_target_set_kind (gomp_target *g, int kind)
6003 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6004 | (kind & GF_OMP_TARGET_KIND_MASK);
6008 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6010 static inline tree
6011 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6013 return omp_target_stmt->child_fn;
6016 /* Return a pointer to the child function used to hold the body of
6017 OMP_TARGET_STMT. */
6019 static inline tree *
6020 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6022 return &omp_target_stmt->child_fn;
6026 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6028 static inline void
6029 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6030 tree child_fn)
6032 omp_target_stmt->child_fn = child_fn;
6036 /* Return the artificial argument used to send variables and values
6037 from the parent to the children threads in OMP_TARGET_STMT. */
6039 static inline tree
6040 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6042 return omp_target_stmt->data_arg;
6046 /* Return a pointer to the data argument for OMP_TARGET GS. */
6048 static inline tree *
6049 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6051 return &omp_target_stmt->data_arg;
6055 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6057 static inline void
6058 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6059 tree data_arg)
6061 omp_target_stmt->data_arg = data_arg;
6065 /* Return the clauses associated with OMP_TEAMS GS. */
6067 static inline tree
6068 gimple_omp_teams_clauses (const gimple *gs)
6070 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6071 return omp_teams_stmt->clauses;
6075 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6077 static inline tree *
6078 gimple_omp_teams_clauses_ptr (gimple *gs)
6080 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6081 return &omp_teams_stmt->clauses;
6085 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6087 static inline void
6088 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6090 omp_teams_stmt->clauses = clauses;
6093 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6095 static inline tree
6096 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6098 return omp_teams_stmt->child_fn;
6101 /* Return a pointer to the child function used to hold the body of
6102 OMP_TEAMS_STMT. */
6104 static inline tree *
6105 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6107 return &omp_teams_stmt->child_fn;
6111 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6113 static inline void
6114 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6116 omp_teams_stmt->child_fn = child_fn;
6120 /* Return the artificial argument used to send variables and values
6121 from the parent to the children threads in OMP_TEAMS_STMT. */
6123 static inline tree
6124 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6126 return omp_teams_stmt->data_arg;
6130 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6132 static inline tree *
6133 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6135 return &omp_teams_stmt->data_arg;
6139 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6141 static inline void
6142 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6144 omp_teams_stmt->data_arg = data_arg;
6147 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
6149 static inline bool
6150 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
6152 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
6155 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
6157 static inline void
6158 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
6160 if (value)
6161 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
6162 else
6163 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
6166 /* Return the host flag of an OMP_TEAMS_STMT. */
6168 static inline bool
6169 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6171 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6174 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6176 static inline void
6177 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6179 if (value)
6180 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6181 else
6182 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6185 /* Return the clauses associated with OMP_SECTIONS GS. */
6187 static inline tree
6188 gimple_omp_sections_clauses (const gimple *gs)
6190 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6191 return omp_sections_stmt->clauses;
6195 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6197 static inline tree *
6198 gimple_omp_sections_clauses_ptr (gimple *gs)
6200 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6201 return &omp_sections_stmt->clauses;
6205 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6206 GS. */
6208 static inline void
6209 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6211 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6212 omp_sections_stmt->clauses = clauses;
6216 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6217 in GS. */
6219 static inline tree
6220 gimple_omp_sections_control (const gimple *gs)
6222 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6223 return omp_sections_stmt->control;
6227 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6228 GS. */
6230 static inline tree *
6231 gimple_omp_sections_control_ptr (gimple *gs)
6233 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6234 return &omp_sections_stmt->control;
6238 /* Set CONTROL to be the set of clauses associated with the
6239 GIMPLE_OMP_SECTIONS in GS. */
6241 static inline void
6242 gimple_omp_sections_set_control (gimple *gs, tree control)
6244 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6245 omp_sections_stmt->control = control;
6249 /* Set the value being stored in an atomic store. */
6251 static inline void
6252 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6254 store_stmt->val = val;
6258 /* Return the value being stored in an atomic store. */
6260 static inline tree
6261 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6263 return store_stmt->val;
6267 /* Return a pointer to the value being stored in an atomic store. */
6269 static inline tree *
6270 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6272 return &store_stmt->val;
6276 /* Set the LHS of an atomic load. */
6278 static inline void
6279 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6281 load_stmt->lhs = lhs;
6285 /* Get the LHS of an atomic load. */
6287 static inline tree
6288 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6290 return load_stmt->lhs;
6294 /* Return a pointer to the LHS of an atomic load. */
6296 static inline tree *
6297 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6299 return &load_stmt->lhs;
6303 /* Set the RHS of an atomic load. */
6305 static inline void
6306 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6308 load_stmt->rhs = rhs;
6312 /* Get the RHS of an atomic load. */
6314 static inline tree
6315 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6317 return load_stmt->rhs;
6321 /* Return a pointer to the RHS of an atomic load. */
6323 static inline tree *
6324 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6326 return &load_stmt->rhs;
6330 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6332 static inline tree
6333 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6335 return cont_stmt->control_def;
6338 /* The same as above, but return the address. */
6340 static inline tree *
6341 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6343 return &cont_stmt->control_def;
6346 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6348 static inline void
6349 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6351 cont_stmt->control_def = def;
6355 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6357 static inline tree
6358 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6360 return cont_stmt->control_use;
6364 /* The same as above, but return the address. */
6366 static inline tree *
6367 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6369 return &cont_stmt->control_use;
6373 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6375 static inline void
6376 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6378 cont_stmt->control_use = use;
6381 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6382 TRANSACTION_STMT. */
6384 static inline gimple_seq *
6385 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6387 return &transaction_stmt->body;
6390 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6392 static inline gimple_seq
6393 gimple_transaction_body (const gtransaction *transaction_stmt)
6395 return transaction_stmt->body;
6398 /* Return the label associated with a GIMPLE_TRANSACTION. */
6400 static inline tree
6401 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6403 return transaction_stmt->label_norm;
6406 static inline tree *
6407 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6409 return &transaction_stmt->label_norm;
6412 static inline tree
6413 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6415 return transaction_stmt->label_uninst;
6418 static inline tree *
6419 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6421 return &transaction_stmt->label_uninst;
6424 static inline tree
6425 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6427 return transaction_stmt->label_over;
6430 static inline tree *
6431 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6433 return &transaction_stmt->label_over;
6436 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6438 static inline unsigned int
6439 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6441 return transaction_stmt->subcode;
6444 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6445 TRANSACTION_STMT. */
6447 static inline void
6448 gimple_transaction_set_body (gtransaction *transaction_stmt,
6449 gimple_seq body)
6451 transaction_stmt->body = body;
6454 /* Set the label associated with a GIMPLE_TRANSACTION. */
6456 static inline void
6457 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6459 transaction_stmt->label_norm = label;
6462 static inline void
6463 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6465 transaction_stmt->label_uninst = label;
6468 static inline void
6469 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6471 transaction_stmt->label_over = label;
6474 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6476 static inline void
6477 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6478 unsigned int subcode)
6480 transaction_stmt->subcode = subcode;
6483 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6485 static inline tree *
6486 gimple_return_retval_ptr (greturn *gs)
6488 return &gs->op[0];
6491 /* Return the return value for GIMPLE_RETURN GS. */
6493 static inline tree
6494 gimple_return_retval (const greturn *gs)
6496 return gs->op[0];
6500 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6502 static inline void
6503 gimple_return_set_retval (greturn *gs, tree retval)
6505 gs->op[0] = retval;
6509 /* Returns true when the gimple statement STMT is any of the OMP types. */
6511 #define CASE_GIMPLE_OMP \
6512 case GIMPLE_OMP_PARALLEL: \
6513 case GIMPLE_OMP_TASK: \
6514 case GIMPLE_OMP_FOR: \
6515 case GIMPLE_OMP_SECTIONS: \
6516 case GIMPLE_OMP_SECTIONS_SWITCH: \
6517 case GIMPLE_OMP_SINGLE: \
6518 case GIMPLE_OMP_TARGET: \
6519 case GIMPLE_OMP_TEAMS: \
6520 case GIMPLE_OMP_SECTION: \
6521 case GIMPLE_OMP_MASTER: \
6522 case GIMPLE_OMP_TASKGROUP: \
6523 case GIMPLE_OMP_ORDERED: \
6524 case GIMPLE_OMP_CRITICAL: \
6525 case GIMPLE_OMP_SCAN: \
6526 case GIMPLE_OMP_RETURN: \
6527 case GIMPLE_OMP_ATOMIC_LOAD: \
6528 case GIMPLE_OMP_ATOMIC_STORE: \
6529 case GIMPLE_OMP_CONTINUE: \
6530 case GIMPLE_OMP_GRID_BODY
6532 static inline bool
6533 is_gimple_omp (const gimple *stmt)
6535 switch (gimple_code (stmt))
6537 CASE_GIMPLE_OMP:
6538 return true;
6539 default:
6540 return false;
6544 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6545 specifically. */
6547 static inline bool
6548 is_gimple_omp_oacc (const gimple *stmt)
6550 gcc_assert (is_gimple_omp (stmt));
6551 switch (gimple_code (stmt))
6553 case GIMPLE_OMP_FOR:
6554 switch (gimple_omp_for_kind (stmt))
6556 case GF_OMP_FOR_KIND_OACC_LOOP:
6557 return true;
6558 default:
6559 return false;
6561 case GIMPLE_OMP_TARGET:
6562 switch (gimple_omp_target_kind (stmt))
6564 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6565 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6566 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6567 case GF_OMP_TARGET_KIND_OACC_DATA:
6568 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6569 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6570 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6571 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6572 return true;
6573 default:
6574 return false;
6576 default:
6577 return false;
6582 /* Return true if the OMP gimple statement STMT is offloaded. */
6584 static inline bool
6585 is_gimple_omp_offloaded (const gimple *stmt)
6587 gcc_assert (is_gimple_omp (stmt));
6588 switch (gimple_code (stmt))
6590 case GIMPLE_OMP_TARGET:
6591 switch (gimple_omp_target_kind (stmt))
6593 case GF_OMP_TARGET_KIND_REGION:
6594 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6595 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6596 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6597 return true;
6598 default:
6599 return false;
6601 default:
6602 return false;
6607 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6609 static inline bool
6610 gimple_nop_p (const gimple *g)
6612 return gimple_code (g) == GIMPLE_NOP;
6616 /* Return true if GS is a GIMPLE_RESX. */
6618 static inline bool
6619 is_gimple_resx (const gimple *gs)
6621 return gimple_code (gs) == GIMPLE_RESX;
6624 /* Return the type of the main expression computed by STMT. Return
6625 void_type_node if the statement computes nothing. */
6627 static inline tree
6628 gimple_expr_type (const gimple *stmt)
6630 enum gimple_code code = gimple_code (stmt);
6631 /* In general we want to pass out a type that can be substituted
6632 for both the RHS and the LHS types if there is a possibly
6633 useless conversion involved. That means returning the
6634 original RHS type as far as we can reconstruct it. */
6635 if (code == GIMPLE_CALL)
6637 const gcall *call_stmt = as_a <const gcall *> (stmt);
6638 if (gimple_call_internal_p (call_stmt))
6639 switch (gimple_call_internal_fn (call_stmt))
6641 case IFN_MASK_STORE:
6642 case IFN_SCATTER_STORE:
6643 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6644 case IFN_MASK_SCATTER_STORE:
6645 return TREE_TYPE (gimple_call_arg (call_stmt, 4));
6646 default:
6647 break;
6649 return gimple_call_return_type (call_stmt);
6651 else if (code == GIMPLE_ASSIGN)
6653 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6654 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6655 else
6656 /* As fallback use the type of the LHS. */
6657 return TREE_TYPE (gimple_get_lhs (stmt));
6659 else if (code == GIMPLE_COND)
6660 return boolean_type_node;
6661 else
6662 return void_type_node;
6665 /* Enum and arrays used for allocation stats. Keep in sync with
6666 gimple.c:gimple_alloc_kind_names. */
6667 enum gimple_alloc_kind
6669 gimple_alloc_kind_assign, /* Assignments. */
6670 gimple_alloc_kind_phi, /* PHI nodes. */
6671 gimple_alloc_kind_cond, /* Conditionals. */
6672 gimple_alloc_kind_rest, /* Everything else. */
6673 gimple_alloc_kind_all
6676 extern uint64_t gimple_alloc_counts[];
6677 extern uint64_t gimple_alloc_sizes[];
6679 /* Return the allocation kind for a given stmt CODE. */
6680 static inline enum gimple_alloc_kind
6681 gimple_alloc_kind (enum gimple_code code)
6683 switch (code)
6685 case GIMPLE_ASSIGN:
6686 return gimple_alloc_kind_assign;
6687 case GIMPLE_PHI:
6688 return gimple_alloc_kind_phi;
6689 case GIMPLE_COND:
6690 return gimple_alloc_kind_cond;
6691 default:
6692 return gimple_alloc_kind_rest;
6696 /* Return true if a location should not be emitted for this statement
6697 by annotate_all_with_location. */
6699 static inline bool
6700 gimple_do_not_emit_location_p (gimple *g)
6702 return gimple_plf (g, GF_PLF_1);
6705 /* Mark statement G so a location will not be emitted by
6706 annotate_one_with_location. */
6708 static inline void
6709 gimple_set_do_not_emit_location (gimple *g)
6711 /* The PLF flags are initialized to 0 when a new tuple is created,
6712 so no need to initialize it anywhere. */
6713 gimple_set_plf (g, GF_PLF_1, true);
6716 #endif /* GCC_GIMPLE_H */