typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter and use it in calls...
[official-gcc.git] / gcc / gimple.h
blob5a190b1714dc9ee7e9b0c15eec6d315d7a9685cb
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2019 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 <ggoto *>::test (gimple *gs)
1023 return gs->code == GIMPLE_GOTO;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <glabel *>::test (gimple *gs)
1031 return gs->code == GIMPLE_LABEL;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <gresx *>::test (gimple *gs)
1039 return gs->code == GIMPLE_RESX;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <geh_dispatch *>::test (gimple *gs)
1047 return gs->code == GIMPLE_EH_DISPATCH;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <geh_else *>::test (gimple *gs)
1055 return gs->code == GIMPLE_EH_ELSE;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <geh_filter *>::test (gimple *gs)
1063 return gs->code == GIMPLE_EH_FILTER;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <geh_mnt *>::test (gimple *gs)
1071 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1079 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1087 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1095 return gs->code == GIMPLE_OMP_RETURN;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <gomp_continue *>::test (gimple *gs)
1103 return gs->code == GIMPLE_OMP_CONTINUE;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <gomp_critical *>::test (gimple *gs)
1111 return gs->code == GIMPLE_OMP_CRITICAL;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <gomp_ordered *>::test (gimple *gs)
1119 return gs->code == GIMPLE_OMP_ORDERED;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <gomp_scan *>::test (gimple *gs)
1127 return gs->code == GIMPLE_OMP_SCAN;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <gomp_for *>::test (gimple *gs)
1135 return gs->code == GIMPLE_OMP_FOR;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1143 return (gs->code == GIMPLE_OMP_PARALLEL
1144 || gs->code == GIMPLE_OMP_TASK
1145 || gs->code == GIMPLE_OMP_TEAMS);
1148 template <>
1149 template <>
1150 inline bool
1151 is_a_helper <gomp_parallel *>::test (gimple *gs)
1153 return gs->code == GIMPLE_OMP_PARALLEL;
1156 template <>
1157 template <>
1158 inline bool
1159 is_a_helper <gomp_target *>::test (gimple *gs)
1161 return gs->code == GIMPLE_OMP_TARGET;
1164 template <>
1165 template <>
1166 inline bool
1167 is_a_helper <gomp_sections *>::test (gimple *gs)
1169 return gs->code == GIMPLE_OMP_SECTIONS;
1172 template <>
1173 template <>
1174 inline bool
1175 is_a_helper <gomp_single *>::test (gimple *gs)
1177 return gs->code == GIMPLE_OMP_SINGLE;
1180 template <>
1181 template <>
1182 inline bool
1183 is_a_helper <gomp_teams *>::test (gimple *gs)
1185 return gs->code == GIMPLE_OMP_TEAMS;
1188 template <>
1189 template <>
1190 inline bool
1191 is_a_helper <gomp_task *>::test (gimple *gs)
1193 return gs->code == GIMPLE_OMP_TASK;
1196 template <>
1197 template <>
1198 inline bool
1199 is_a_helper <gphi *>::test (gimple *gs)
1201 return gs->code == GIMPLE_PHI;
1204 template <>
1205 template <>
1206 inline bool
1207 is_a_helper <greturn *>::test (gimple *gs)
1209 return gs->code == GIMPLE_RETURN;
1212 template <>
1213 template <>
1214 inline bool
1215 is_a_helper <gswitch *>::test (gimple *gs)
1217 return gs->code == GIMPLE_SWITCH;
1220 template <>
1221 template <>
1222 inline bool
1223 is_a_helper <gtransaction *>::test (gimple *gs)
1225 return gs->code == GIMPLE_TRANSACTION;
1228 template <>
1229 template <>
1230 inline bool
1231 is_a_helper <gtry *>::test (gimple *gs)
1233 return gs->code == GIMPLE_TRY;
1236 template <>
1237 template <>
1238 inline bool
1239 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1241 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1244 template <>
1245 template <>
1246 inline bool
1247 is_a_helper <const gasm *>::test (const gimple *gs)
1249 return gs->code == GIMPLE_ASM;
1252 template <>
1253 template <>
1254 inline bool
1255 is_a_helper <const gbind *>::test (const gimple *gs)
1257 return gs->code == GIMPLE_BIND;
1260 template <>
1261 template <>
1262 inline bool
1263 is_a_helper <const gcall *>::test (const gimple *gs)
1265 return gs->code == GIMPLE_CALL;
1268 template <>
1269 template <>
1270 inline bool
1271 is_a_helper <const gcatch *>::test (const gimple *gs)
1273 return gs->code == GIMPLE_CATCH;
1276 template <>
1277 template <>
1278 inline bool
1279 is_a_helper <const gresx *>::test (const gimple *gs)
1281 return gs->code == GIMPLE_RESX;
1284 template <>
1285 template <>
1286 inline bool
1287 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1289 return gs->code == GIMPLE_EH_DISPATCH;
1292 template <>
1293 template <>
1294 inline bool
1295 is_a_helper <const geh_filter *>::test (const gimple *gs)
1297 return gs->code == GIMPLE_EH_FILTER;
1300 template <>
1301 template <>
1302 inline bool
1303 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1305 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1308 template <>
1309 template <>
1310 inline bool
1311 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1313 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1316 template <>
1317 template <>
1318 inline bool
1319 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1321 return gs->code == GIMPLE_OMP_RETURN;
1324 template <>
1325 template <>
1326 inline bool
1327 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1329 return gs->code == GIMPLE_OMP_CONTINUE;
1332 template <>
1333 template <>
1334 inline bool
1335 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1337 return gs->code == GIMPLE_OMP_CRITICAL;
1340 template <>
1341 template <>
1342 inline bool
1343 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1345 return gs->code == GIMPLE_OMP_ORDERED;
1348 template <>
1349 template <>
1350 inline bool
1351 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1353 return gs->code == GIMPLE_OMP_SCAN;
1356 template <>
1357 template <>
1358 inline bool
1359 is_a_helper <const gomp_for *>::test (const gimple *gs)
1361 return gs->code == GIMPLE_OMP_FOR;
1364 template <>
1365 template <>
1366 inline bool
1367 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1369 return (gs->code == GIMPLE_OMP_PARALLEL
1370 || gs->code == GIMPLE_OMP_TASK
1371 || gs->code == GIMPLE_OMP_TEAMS);
1374 template <>
1375 template <>
1376 inline bool
1377 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1379 return gs->code == GIMPLE_OMP_PARALLEL;
1382 template <>
1383 template <>
1384 inline bool
1385 is_a_helper <const gomp_target *>::test (const gimple *gs)
1387 return gs->code == GIMPLE_OMP_TARGET;
1390 template <>
1391 template <>
1392 inline bool
1393 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1395 return gs->code == GIMPLE_OMP_SECTIONS;
1398 template <>
1399 template <>
1400 inline bool
1401 is_a_helper <const gomp_single *>::test (const gimple *gs)
1403 return gs->code == GIMPLE_OMP_SINGLE;
1406 template <>
1407 template <>
1408 inline bool
1409 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1411 return gs->code == GIMPLE_OMP_TEAMS;
1414 template <>
1415 template <>
1416 inline bool
1417 is_a_helper <const gomp_task *>::test (const gimple *gs)
1419 return gs->code == GIMPLE_OMP_TASK;
1422 template <>
1423 template <>
1424 inline bool
1425 is_a_helper <const gphi *>::test (const gimple *gs)
1427 return gs->code == GIMPLE_PHI;
1430 template <>
1431 template <>
1432 inline bool
1433 is_a_helper <const gtransaction *>::test (const gimple *gs)
1435 return gs->code == GIMPLE_TRANSACTION;
1438 /* Offset in bytes to the location of the operand vector.
1439 Zero if there is no operand vector for this tuple structure. */
1440 extern size_t const gimple_ops_offset_[];
1442 /* Map GIMPLE codes to GSS codes. */
1443 extern enum gimple_statement_structure_enum const gss_for_code_[];
1445 /* This variable holds the currently expanded gimple statement for purposes
1446 of comminucating the profile info to the builtin expanders. */
1447 extern gimple *currently_expanding_gimple_stmt;
1449 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1450 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1451 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1452 greturn *gimple_build_return (tree);
1453 void gimple_call_reset_alias_info (gcall *);
1454 gcall *gimple_build_call_vec (tree, vec<tree> );
1455 gcall *gimple_build_call (tree, unsigned, ...);
1456 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1457 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1458 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1459 gcall *gimple_build_call_from_tree (tree, tree);
1460 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1461 gassign *gimple_build_assign (tree, enum tree_code,
1462 tree, tree, tree CXX_MEM_STAT_INFO);
1463 gassign *gimple_build_assign (tree, enum tree_code,
1464 tree, tree CXX_MEM_STAT_INFO);
1465 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1466 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1467 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1468 void gimple_cond_set_condition_from_tree (gcond *, tree);
1469 glabel *gimple_build_label (tree label);
1470 ggoto *gimple_build_goto (tree dest);
1471 gimple *gimple_build_nop (void);
1472 gbind *gimple_build_bind (tree, gimple_seq, tree);
1473 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1474 vec<tree, va_gc> *, vec<tree, va_gc> *,
1475 vec<tree, va_gc> *);
1476 gcatch *gimple_build_catch (tree, gimple_seq);
1477 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1478 geh_mnt *gimple_build_eh_must_not_throw (tree);
1479 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1480 gtry *gimple_build_try (gimple_seq, gimple_seq,
1481 enum gimple_try_flags);
1482 gimple *gimple_build_wce (gimple_seq);
1483 gresx *gimple_build_resx (int);
1484 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1485 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1486 geh_dispatch *gimple_build_eh_dispatch (int);
1487 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1488 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1489 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1490 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1491 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1492 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1493 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1494 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1495 tree, tree);
1496 gimple *gimple_build_omp_section (gimple_seq);
1497 gimple *gimple_build_omp_master (gimple_seq);
1498 gimple *gimple_build_omp_grid_body (gimple_seq);
1499 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1500 gomp_continue *gimple_build_omp_continue (tree, tree);
1501 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1502 gimple *gimple_build_omp_return (bool);
1503 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1504 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1505 gimple *gimple_build_omp_sections_switch (void);
1506 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1507 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1508 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1509 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1510 enum omp_memory_order);
1511 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1512 gtransaction *gimple_build_transaction (gimple_seq);
1513 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1514 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1515 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1516 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1517 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1518 location_t);
1519 extern void annotate_all_with_location (gimple_seq, location_t);
1520 bool empty_body_p (gimple_seq);
1521 gimple_seq gimple_seq_copy (gimple_seq);
1522 bool gimple_call_same_target_p (const gimple *, const gimple *);
1523 int gimple_call_flags (const gimple *);
1524 int gimple_call_arg_flags (const gcall *, unsigned);
1525 int gimple_call_return_flags (const gcall *);
1526 bool gimple_call_nonnull_result_p (gcall *);
1527 tree gimple_call_nonnull_arg (gcall *);
1528 bool gimple_assign_copy_p (gimple *);
1529 bool gimple_assign_ssa_name_copy_p (gimple *);
1530 bool gimple_assign_unary_nop_p (gimple *);
1531 void gimple_set_bb (gimple *, basic_block);
1532 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1533 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1534 tree, tree, tree);
1535 tree gimple_get_lhs (const gimple *);
1536 void gimple_set_lhs (gimple *, tree);
1537 gimple *gimple_copy (gimple *);
1538 void gimple_move_vops (gimple *, gimple *);
1539 bool gimple_has_side_effects (const gimple *);
1540 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1541 bool gimple_could_trap_p (gimple *);
1542 bool gimple_assign_rhs_could_trap_p (gimple *);
1543 extern void dump_gimple_statistics (void);
1544 unsigned get_gimple_rhs_num_ops (enum tree_code);
1545 extern tree canonicalize_cond_expr_cond (tree);
1546 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1547 extern bool gimple_compare_field_offset (tree, tree);
1548 extern tree gimple_unsigned_type (tree);
1549 extern tree gimple_signed_type (tree);
1550 extern alias_set_type gimple_get_alias_set (tree);
1551 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1552 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1553 extern combined_fn gimple_call_combined_fn (const gimple *);
1554 extern bool gimple_call_operator_delete_p (const gcall *);
1555 extern bool gimple_call_builtin_p (const gimple *);
1556 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1557 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1558 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1559 extern void dump_decl_set (FILE *, bitmap);
1560 extern bool nonfreeing_call_p (gimple *);
1561 extern bool nonbarrier_call_p (gimple *);
1562 extern bool infer_nonnull_range (gimple *, tree);
1563 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1564 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1565 extern void sort_case_labels (vec<tree>);
1566 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1567 extern void gimple_seq_set_location (gimple_seq, location_t);
1568 extern void gimple_seq_discard (gimple_seq);
1569 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1570 extern bool gimple_inexpensive_call_p (gcall *);
1571 extern bool stmt_can_terminate_bb_p (gimple *);
1573 /* Formal (expression) temporary table handling: multiple occurrences of
1574 the same scalar expression are evaluated into the same temporary. */
1576 typedef struct gimple_temp_hash_elt
1578 tree val; /* Key */
1579 tree temp; /* Value */
1580 } elt_t;
1582 /* Get the number of the next statement uid to be allocated. */
1583 static inline unsigned int
1584 gimple_stmt_max_uid (struct function *fn)
1586 return fn->last_stmt_uid;
1589 /* Set the number of the next statement uid to be allocated. */
1590 static inline void
1591 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1593 fn->last_stmt_uid = maxid;
1596 /* Set the number of the next statement uid to be allocated. */
1597 static inline unsigned int
1598 inc_gimple_stmt_max_uid (struct function *fn)
1600 return fn->last_stmt_uid++;
1603 /* Return the first node in GIMPLE sequence S. */
1605 static inline gimple_seq_node
1606 gimple_seq_first (gimple_seq s)
1608 return s;
1612 /* Return the first statement in GIMPLE sequence S. */
1614 static inline gimple *
1615 gimple_seq_first_stmt (gimple_seq s)
1617 gimple_seq_node n = gimple_seq_first (s);
1618 return n;
1621 /* Return the first statement in GIMPLE sequence S as a gbind *,
1622 verifying that it has code GIMPLE_BIND in a checked build. */
1624 static inline gbind *
1625 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1627 gimple_seq_node n = gimple_seq_first (s);
1628 return as_a <gbind *> (n);
1632 /* Return the last node in GIMPLE sequence S. */
1634 static inline gimple_seq_node
1635 gimple_seq_last (gimple_seq s)
1637 return s ? s->prev : NULL;
1641 /* Return the last statement in GIMPLE sequence S. */
1643 static inline gimple *
1644 gimple_seq_last_stmt (gimple_seq s)
1646 gimple_seq_node n = gimple_seq_last (s);
1647 return n;
1651 /* Set the last node in GIMPLE sequence *PS to LAST. */
1653 static inline void
1654 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1656 (*ps)->prev = last;
1660 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1662 static inline void
1663 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1665 *ps = first;
1669 /* Return true if GIMPLE sequence S is empty. */
1671 static inline bool
1672 gimple_seq_empty_p (gimple_seq s)
1674 return s == NULL;
1677 /* Allocate a new sequence and initialize its first element with STMT. */
1679 static inline gimple_seq
1680 gimple_seq_alloc_with_stmt (gimple *stmt)
1682 gimple_seq seq = NULL;
1683 gimple_seq_add_stmt (&seq, stmt);
1684 return seq;
1688 /* Returns the sequence of statements in BB. */
1690 static inline gimple_seq
1691 bb_seq (const_basic_block bb)
1693 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1696 static inline gimple_seq *
1697 bb_seq_addr (basic_block bb)
1699 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1702 /* Sets the sequence of statements in BB to SEQ. */
1704 static inline void
1705 set_bb_seq (basic_block bb, gimple_seq seq)
1707 gcc_checking_assert (!(bb->flags & BB_RTL));
1708 bb->il.gimple.seq = seq;
1712 /* Return the code for GIMPLE statement G. */
1714 static inline enum gimple_code
1715 gimple_code (const gimple *g)
1717 return g->code;
1721 /* Return the GSS code used by a GIMPLE code. */
1723 static inline enum gimple_statement_structure_enum
1724 gss_for_code (enum gimple_code code)
1726 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1727 return gss_for_code_[code];
1731 /* Return which GSS code is used by GS. */
1733 static inline enum gimple_statement_structure_enum
1734 gimple_statement_structure (gimple *gs)
1736 return gss_for_code (gimple_code (gs));
1740 /* Return true if statement G has sub-statements. This is only true for
1741 High GIMPLE statements. */
1743 static inline bool
1744 gimple_has_substatements (gimple *g)
1746 switch (gimple_code (g))
1748 case GIMPLE_BIND:
1749 case GIMPLE_CATCH:
1750 case GIMPLE_EH_FILTER:
1751 case GIMPLE_EH_ELSE:
1752 case GIMPLE_TRY:
1753 case GIMPLE_OMP_FOR:
1754 case GIMPLE_OMP_MASTER:
1755 case GIMPLE_OMP_TASKGROUP:
1756 case GIMPLE_OMP_ORDERED:
1757 case GIMPLE_OMP_SECTION:
1758 case GIMPLE_OMP_PARALLEL:
1759 case GIMPLE_OMP_TASK:
1760 case GIMPLE_OMP_SECTIONS:
1761 case GIMPLE_OMP_SINGLE:
1762 case GIMPLE_OMP_TARGET:
1763 case GIMPLE_OMP_TEAMS:
1764 case GIMPLE_OMP_CRITICAL:
1765 case GIMPLE_WITH_CLEANUP_EXPR:
1766 case GIMPLE_TRANSACTION:
1767 case GIMPLE_OMP_GRID_BODY:
1768 return true;
1770 default:
1771 return false;
1776 /* Return the basic block holding statement G. */
1778 static inline basic_block
1779 gimple_bb (const gimple *g)
1781 return g->bb;
1785 /* Return the lexical scope block holding statement G. */
1787 static inline tree
1788 gimple_block (const gimple *g)
1790 return LOCATION_BLOCK (g->location);
1794 /* Set BLOCK to be the lexical scope block holding statement G. */
1796 static inline void
1797 gimple_set_block (gimple *g, tree block)
1799 g->location = set_block (g->location, block);
1803 /* Return location information for statement G. */
1805 static inline location_t
1806 gimple_location (const gimple *g)
1808 return g->location;
1811 /* Return location information for statement G if g is not NULL.
1812 Otherwise, UNKNOWN_LOCATION is returned. */
1814 static inline location_t
1815 gimple_location_safe (const gimple *g)
1817 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1820 /* Set location information for statement G. */
1822 static inline void
1823 gimple_set_location (gimple *g, location_t location)
1825 g->location = location;
1829 /* Return true if G contains location information. */
1831 static inline bool
1832 gimple_has_location (const gimple *g)
1834 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1838 /* Return non-artificial location information for statement G. */
1840 static inline location_t
1841 gimple_nonartificial_location (const gimple *g)
1843 location_t *ploc = NULL;
1845 if (tree block = gimple_block (g))
1846 ploc = block_nonartificial_location (block);
1848 return ploc ? *ploc : gimple_location (g);
1852 /* Return the file name of the location of STMT. */
1854 static inline const char *
1855 gimple_filename (const gimple *stmt)
1857 return LOCATION_FILE (gimple_location (stmt));
1861 /* Return the line number of the location of STMT. */
1863 static inline int
1864 gimple_lineno (const gimple *stmt)
1866 return LOCATION_LINE (gimple_location (stmt));
1870 /* Determine whether SEQ is a singleton. */
1872 static inline bool
1873 gimple_seq_singleton_p (gimple_seq seq)
1875 return ((gimple_seq_first (seq) != NULL)
1876 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1879 /* Return true if no warnings should be emitted for statement STMT. */
1881 static inline bool
1882 gimple_no_warning_p (const gimple *stmt)
1884 return stmt->no_warning;
1887 /* Set the no_warning flag of STMT to NO_WARNING. */
1889 static inline void
1890 gimple_set_no_warning (gimple *stmt, bool no_warning)
1892 stmt->no_warning = (unsigned) no_warning;
1895 /* Set the visited status on statement STMT to VISITED_P.
1897 Please note that this 'visited' property of the gimple statement is
1898 supposed to be undefined at pass boundaries. This means that a
1899 given pass should not assume it contains any useful value when the
1900 pass starts and thus can set it to any value it sees fit.
1902 You can learn more about the visited property of the gimple
1903 statement by reading the comments of the 'visited' data member of
1904 struct gimple.
1907 static inline void
1908 gimple_set_visited (gimple *stmt, bool visited_p)
1910 stmt->visited = (unsigned) visited_p;
1914 /* Return the visited status for statement STMT.
1916 Please note that this 'visited' property of the gimple statement is
1917 supposed to be undefined at pass boundaries. This means that a
1918 given pass should not assume it contains any useful value when the
1919 pass starts and thus can set it to any value it sees fit.
1921 You can learn more about the visited property of the gimple
1922 statement by reading the comments of the 'visited' data member of
1923 struct gimple. */
1925 static inline bool
1926 gimple_visited_p (gimple *stmt)
1928 return stmt->visited;
1932 /* Set pass local flag PLF on statement STMT to VAL_P.
1934 Please note that this PLF property of the gimple statement is
1935 supposed to be undefined at pass boundaries. This means that a
1936 given pass should not assume it contains any useful value when the
1937 pass starts and thus can set it to any value it sees fit.
1939 You can learn more about the PLF property by reading the comment of
1940 the 'plf' data member of struct gimple_statement_structure. */
1942 static inline void
1943 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1945 if (val_p)
1946 stmt->plf |= (unsigned int) plf;
1947 else
1948 stmt->plf &= ~((unsigned int) plf);
1952 /* Return the value of pass local flag PLF on statement STMT.
1954 Please note that this 'plf' property of the gimple statement is
1955 supposed to be undefined at pass boundaries. This means that a
1956 given pass should not assume it contains any useful value when the
1957 pass starts and thus can set it to any value it sees fit.
1959 You can learn more about the plf property by reading the comment of
1960 the 'plf' data member of struct gimple_statement_structure. */
1962 static inline unsigned int
1963 gimple_plf (gimple *stmt, enum plf_mask plf)
1965 return stmt->plf & ((unsigned int) plf);
1969 /* Set the UID of statement.
1971 Please note that this UID property is supposed to be undefined at
1972 pass boundaries. This means that a given pass should not assume it
1973 contains any useful value when the pass starts and thus can set it
1974 to any value it sees fit. */
1976 static inline void
1977 gimple_set_uid (gimple *g, unsigned uid)
1979 g->uid = uid;
1983 /* Return the UID of statement.
1985 Please note that this UID property is supposed to be undefined at
1986 pass boundaries. This means that a given pass should not assume it
1987 contains any useful value when the pass starts and thus can set it
1988 to any value it sees fit. */
1990 static inline unsigned
1991 gimple_uid (const gimple *g)
1993 return g->uid;
1997 /* Make statement G a singleton sequence. */
1999 static inline void
2000 gimple_init_singleton (gimple *g)
2002 g->next = NULL;
2003 g->prev = g;
2007 /* Return true if GIMPLE statement G has register or memory operands. */
2009 static inline bool
2010 gimple_has_ops (const gimple *g)
2012 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2015 template <>
2016 template <>
2017 inline bool
2018 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2020 return gimple_has_ops (gs);
2023 template <>
2024 template <>
2025 inline bool
2026 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2028 return gimple_has_ops (gs);
2031 /* Return true if GIMPLE statement G has memory operands. */
2033 static inline bool
2034 gimple_has_mem_ops (const gimple *g)
2036 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2039 template <>
2040 template <>
2041 inline bool
2042 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2044 return gimple_has_mem_ops (gs);
2047 template <>
2048 template <>
2049 inline bool
2050 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2052 return gimple_has_mem_ops (gs);
2055 /* Return the set of USE operands for statement G. */
2057 static inline struct use_optype_d *
2058 gimple_use_ops (const gimple *g)
2060 const gimple_statement_with_ops *ops_stmt =
2061 dyn_cast <const gimple_statement_with_ops *> (g);
2062 if (!ops_stmt)
2063 return NULL;
2064 return ops_stmt->use_ops;
2068 /* Set USE to be the set of USE operands for statement G. */
2070 static inline void
2071 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2073 gimple_statement_with_ops *ops_stmt =
2074 as_a <gimple_statement_with_ops *> (g);
2075 ops_stmt->use_ops = use;
2079 /* Return the single VUSE operand of the statement G. */
2081 static inline tree
2082 gimple_vuse (const gimple *g)
2084 const gimple_statement_with_memory_ops *mem_ops_stmt =
2085 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2086 if (!mem_ops_stmt)
2087 return NULL_TREE;
2088 return mem_ops_stmt->vuse;
2091 /* Return the single VDEF operand of the statement G. */
2093 static inline tree
2094 gimple_vdef (const gimple *g)
2096 const gimple_statement_with_memory_ops *mem_ops_stmt =
2097 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2098 if (!mem_ops_stmt)
2099 return NULL_TREE;
2100 return mem_ops_stmt->vdef;
2103 /* Return the single VUSE operand of the statement G. */
2105 static inline tree *
2106 gimple_vuse_ptr (gimple *g)
2108 gimple_statement_with_memory_ops *mem_ops_stmt =
2109 dyn_cast <gimple_statement_with_memory_ops *> (g);
2110 if (!mem_ops_stmt)
2111 return NULL;
2112 return &mem_ops_stmt->vuse;
2115 /* Return the single VDEF operand of the statement G. */
2117 static inline tree *
2118 gimple_vdef_ptr (gimple *g)
2120 gimple_statement_with_memory_ops *mem_ops_stmt =
2121 dyn_cast <gimple_statement_with_memory_ops *> (g);
2122 if (!mem_ops_stmt)
2123 return NULL;
2124 return &mem_ops_stmt->vdef;
2127 /* Set the single VUSE operand of the statement G. */
2129 static inline void
2130 gimple_set_vuse (gimple *g, tree vuse)
2132 gimple_statement_with_memory_ops *mem_ops_stmt =
2133 as_a <gimple_statement_with_memory_ops *> (g);
2134 mem_ops_stmt->vuse = vuse;
2137 /* Set the single VDEF operand of the statement G. */
2139 static inline void
2140 gimple_set_vdef (gimple *g, tree vdef)
2142 gimple_statement_with_memory_ops *mem_ops_stmt =
2143 as_a <gimple_statement_with_memory_ops *> (g);
2144 mem_ops_stmt->vdef = vdef;
2148 /* Return true if statement G has operands and the modified field has
2149 been set. */
2151 static inline bool
2152 gimple_modified_p (const gimple *g)
2154 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2158 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2159 a MODIFIED field. */
2161 static inline void
2162 gimple_set_modified (gimple *s, bool modifiedp)
2164 if (gimple_has_ops (s))
2165 s->modified = (unsigned) modifiedp;
2169 /* Return the tree code for the expression computed by STMT. This is
2170 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2171 GIMPLE_CALL, return CALL_EXPR as the expression code for
2172 consistency. This is useful when the caller needs to deal with the
2173 three kinds of computation that GIMPLE supports. */
2175 static inline enum tree_code
2176 gimple_expr_code (const gimple *stmt)
2178 enum gimple_code code = gimple_code (stmt);
2179 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2180 return (enum tree_code) stmt->subcode;
2181 else
2183 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2184 return CALL_EXPR;
2189 /* Return true if statement STMT contains volatile operands. */
2191 static inline bool
2192 gimple_has_volatile_ops (const gimple *stmt)
2194 if (gimple_has_mem_ops (stmt))
2195 return stmt->has_volatile_ops;
2196 else
2197 return false;
2201 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2203 static inline void
2204 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2206 if (gimple_has_mem_ops (stmt))
2207 stmt->has_volatile_ops = (unsigned) volatilep;
2210 /* Return true if STMT is in a transaction. */
2212 static inline bool
2213 gimple_in_transaction (const gimple *stmt)
2215 return bb_in_transaction (gimple_bb (stmt));
2218 /* Return true if statement STMT may access memory. */
2220 static inline bool
2221 gimple_references_memory_p (gimple *stmt)
2223 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2227 /* Return the subcode for OMP statement S. */
2229 static inline unsigned
2230 gimple_omp_subcode (const gimple *s)
2232 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2233 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2234 return s->subcode;
2237 /* Set the subcode for OMP statement S to SUBCODE. */
2239 static inline void
2240 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2242 /* We only have 16 bits for the subcode. Assert that we are not
2243 overflowing it. */
2244 gcc_gimple_checking_assert (subcode < (1 << 16));
2245 s->subcode = subcode;
2248 /* Set the nowait flag on OMP_RETURN statement S. */
2250 static inline void
2251 gimple_omp_return_set_nowait (gimple *s)
2253 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2254 s->subcode |= GF_OMP_RETURN_NOWAIT;
2258 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2259 flag set. */
2261 static inline bool
2262 gimple_omp_return_nowait_p (const gimple *g)
2264 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2265 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2269 /* Set the LHS of OMP return. */
2271 static inline void
2272 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2274 gimple_statement_omp_return *omp_return_stmt =
2275 as_a <gimple_statement_omp_return *> (g);
2276 omp_return_stmt->val = lhs;
2280 /* Get the LHS of OMP return. */
2282 static inline tree
2283 gimple_omp_return_lhs (const gimple *g)
2285 const gimple_statement_omp_return *omp_return_stmt =
2286 as_a <const gimple_statement_omp_return *> (g);
2287 return omp_return_stmt->val;
2291 /* Return a pointer to the LHS of OMP return. */
2293 static inline tree *
2294 gimple_omp_return_lhs_ptr (gimple *g)
2296 gimple_statement_omp_return *omp_return_stmt =
2297 as_a <gimple_statement_omp_return *> (g);
2298 return &omp_return_stmt->val;
2302 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2303 flag set. */
2305 static inline bool
2306 gimple_omp_section_last_p (const gimple *g)
2308 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2309 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2313 /* Set the GF_OMP_SECTION_LAST flag on G. */
2315 static inline void
2316 gimple_omp_section_set_last (gimple *g)
2318 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2319 g->subcode |= GF_OMP_SECTION_LAST;
2323 /* Return true if OMP parallel statement G has the
2324 GF_OMP_PARALLEL_COMBINED flag set. */
2326 static inline bool
2327 gimple_omp_parallel_combined_p (const gimple *g)
2329 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2330 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2334 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2335 value of COMBINED_P. */
2337 static inline void
2338 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2340 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2341 if (combined_p)
2342 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2343 else
2344 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2348 /* Return true if OMP atomic load/store statement G has the
2349 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2351 static inline bool
2352 gimple_omp_atomic_need_value_p (const gimple *g)
2354 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2355 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2356 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2360 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2362 static inline void
2363 gimple_omp_atomic_set_need_value (gimple *g)
2365 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2366 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2367 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2371 /* Return the memory order of the OMP atomic load/store statement G. */
2373 static inline enum omp_memory_order
2374 gimple_omp_atomic_memory_order (const gimple *g)
2376 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2377 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2378 return (enum omp_memory_order)
2379 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2383 /* Set the memory order on G. */
2385 static inline void
2386 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2388 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2389 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2390 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2391 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2395 /* Return the number of operands for statement GS. */
2397 static inline unsigned
2398 gimple_num_ops (const gimple *gs)
2400 return gs->num_ops;
2404 /* Set the number of operands for statement GS. */
2406 static inline void
2407 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2409 gs->num_ops = num_ops;
2413 /* Return the array of operands for statement GS. */
2415 static inline tree *
2416 gimple_ops (gimple *gs)
2418 size_t off;
2420 /* All the tuples have their operand vector at the very bottom
2421 of the structure. Note that those structures that do not
2422 have an operand vector have a zero offset. */
2423 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2424 gcc_gimple_checking_assert (off != 0);
2426 return (tree *) ((char *) gs + off);
2430 /* Return operand I for statement GS. */
2432 static inline tree
2433 gimple_op (const gimple *gs, unsigned i)
2435 if (gimple_has_ops (gs))
2437 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2438 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2440 else
2441 return NULL_TREE;
2444 /* Return a pointer to operand I for statement GS. */
2446 static inline tree *
2447 gimple_op_ptr (gimple *gs, unsigned i)
2449 if (gimple_has_ops (gs))
2451 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2452 return gimple_ops (gs) + i;
2454 else
2455 return NULL;
2458 /* Set operand I of statement GS to OP. */
2460 static inline void
2461 gimple_set_op (gimple *gs, unsigned i, tree op)
2463 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2465 /* Note. It may be tempting to assert that OP matches
2466 is_gimple_operand, but that would be wrong. Different tuples
2467 accept slightly different sets of tree operands. Each caller
2468 should perform its own validation. */
2469 gimple_ops (gs)[i] = op;
2472 /* Return true if GS is a GIMPLE_ASSIGN. */
2474 static inline bool
2475 is_gimple_assign (const gimple *gs)
2477 return gimple_code (gs) == GIMPLE_ASSIGN;
2480 /* Determine if expression CODE is one of the valid expressions that can
2481 be used on the RHS of GIMPLE assignments. */
2483 static inline enum gimple_rhs_class
2484 get_gimple_rhs_class (enum tree_code code)
2486 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2489 /* Return the LHS of assignment statement GS. */
2491 static inline tree
2492 gimple_assign_lhs (const gassign *gs)
2494 return gs->op[0];
2497 static inline tree
2498 gimple_assign_lhs (const gimple *gs)
2500 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2501 return gimple_assign_lhs (ass);
2505 /* Return a pointer to the LHS of assignment statement GS. */
2507 static inline tree *
2508 gimple_assign_lhs_ptr (gassign *gs)
2510 return &gs->op[0];
2513 static inline tree *
2514 gimple_assign_lhs_ptr (gimple *gs)
2516 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2517 return gimple_assign_lhs_ptr (ass);
2521 /* Set LHS to be the LHS operand of assignment statement GS. */
2523 static inline void
2524 gimple_assign_set_lhs (gassign *gs, tree lhs)
2526 gs->op[0] = lhs;
2528 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2529 SSA_NAME_DEF_STMT (lhs) = gs;
2532 static inline void
2533 gimple_assign_set_lhs (gimple *gs, tree lhs)
2535 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2536 gimple_assign_set_lhs (ass, lhs);
2540 /* Return the first operand on the RHS of assignment statement GS. */
2542 static inline tree
2543 gimple_assign_rhs1 (const gassign *gs)
2545 return gs->op[1];
2548 static inline tree
2549 gimple_assign_rhs1 (const gimple *gs)
2551 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2552 return gimple_assign_rhs1 (ass);
2556 /* Return a pointer to the first operand on the RHS of assignment
2557 statement GS. */
2559 static inline tree *
2560 gimple_assign_rhs1_ptr (gassign *gs)
2562 return &gs->op[1];
2565 static inline tree *
2566 gimple_assign_rhs1_ptr (gimple *gs)
2568 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2569 return gimple_assign_rhs1_ptr (ass);
2572 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2574 static inline void
2575 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2577 gs->op[1] = rhs;
2580 static inline void
2581 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2583 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2584 gimple_assign_set_rhs1 (ass, rhs);
2588 /* Return the second operand on the RHS of assignment statement GS.
2589 If GS does not have two operands, NULL is returned instead. */
2591 static inline tree
2592 gimple_assign_rhs2 (const gassign *gs)
2594 if (gimple_num_ops (gs) >= 3)
2595 return gs->op[2];
2596 else
2597 return NULL_TREE;
2600 static inline tree
2601 gimple_assign_rhs2 (const gimple *gs)
2603 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2604 return gimple_assign_rhs2 (ass);
2608 /* Return a pointer to the second operand on the RHS of assignment
2609 statement GS. */
2611 static inline tree *
2612 gimple_assign_rhs2_ptr (gassign *gs)
2614 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2615 return &gs->op[2];
2618 static inline tree *
2619 gimple_assign_rhs2_ptr (gimple *gs)
2621 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2622 return gimple_assign_rhs2_ptr (ass);
2626 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2628 static inline void
2629 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2631 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2632 gs->op[2] = rhs;
2635 static inline void
2636 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2638 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2639 return gimple_assign_set_rhs2 (ass, rhs);
2642 /* Return the third operand on the RHS of assignment statement GS.
2643 If GS does not have two operands, NULL is returned instead. */
2645 static inline tree
2646 gimple_assign_rhs3 (const gassign *gs)
2648 if (gimple_num_ops (gs) >= 4)
2649 return gs->op[3];
2650 else
2651 return NULL_TREE;
2654 static inline tree
2655 gimple_assign_rhs3 (const gimple *gs)
2657 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2658 return gimple_assign_rhs3 (ass);
2661 /* Return a pointer to the third operand on the RHS of assignment
2662 statement GS. */
2664 static inline tree *
2665 gimple_assign_rhs3_ptr (gimple *gs)
2667 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2668 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2669 return &ass->op[3];
2673 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2675 static inline void
2676 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2678 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2679 gs->op[3] = rhs;
2682 static inline void
2683 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2685 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2686 gimple_assign_set_rhs3 (ass, rhs);
2690 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2691 which expect to see only two operands. */
2693 static inline void
2694 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2695 tree op1, tree op2)
2697 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2700 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2701 which expect to see only one operands. */
2703 static inline void
2704 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2705 tree op1)
2707 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2710 /* Returns true if GS is a nontemporal move. */
2712 static inline bool
2713 gimple_assign_nontemporal_move_p (const gassign *gs)
2715 return gs->nontemporal_move;
2718 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2720 static inline void
2721 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2723 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2724 gs->nontemporal_move = nontemporal;
2728 /* Return the code of the expression computed on the rhs of assignment
2729 statement GS. In case that the RHS is a single object, returns the
2730 tree code of the object. */
2732 static inline enum tree_code
2733 gimple_assign_rhs_code (const gassign *gs)
2735 enum tree_code code = (enum tree_code) gs->subcode;
2736 /* While we initially set subcode to the TREE_CODE of the rhs for
2737 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2738 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2739 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2740 code = TREE_CODE (gs->op[1]);
2742 return code;
2745 static inline enum tree_code
2746 gimple_assign_rhs_code (const gimple *gs)
2748 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2749 return gimple_assign_rhs_code (ass);
2753 /* Set CODE to be the code for the expression computed on the RHS of
2754 assignment S. */
2756 static inline void
2757 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2759 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2760 s->subcode = code;
2764 /* Return the gimple rhs class of the code of the expression computed on
2765 the rhs of assignment statement GS.
2766 This will never return GIMPLE_INVALID_RHS. */
2768 static inline enum gimple_rhs_class
2769 gimple_assign_rhs_class (const gimple *gs)
2771 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2774 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2775 there is no operator associated with the assignment itself.
2776 Unlike gimple_assign_copy_p, this predicate returns true for
2777 any RHS operand, including those that perform an operation
2778 and do not have the semantics of a copy, such as COND_EXPR. */
2780 static inline bool
2781 gimple_assign_single_p (const gimple *gs)
2783 return (is_gimple_assign (gs)
2784 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2787 /* Return true if GS performs a store to its lhs. */
2789 static inline bool
2790 gimple_store_p (const gimple *gs)
2792 tree lhs = gimple_get_lhs (gs);
2793 return lhs && !is_gimple_reg (lhs);
2796 /* Return true if GS is an assignment that loads from its rhs1. */
2798 static inline bool
2799 gimple_assign_load_p (const gimple *gs)
2801 tree rhs;
2802 if (!gimple_assign_single_p (gs))
2803 return false;
2804 rhs = gimple_assign_rhs1 (gs);
2805 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2806 return true;
2807 rhs = get_base_address (rhs);
2808 return (DECL_P (rhs)
2809 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2813 /* Return true if S is a type-cast assignment. */
2815 static inline bool
2816 gimple_assign_cast_p (const gimple *s)
2818 if (is_gimple_assign (s))
2820 enum tree_code sc = gimple_assign_rhs_code (s);
2821 return CONVERT_EXPR_CODE_P (sc)
2822 || sc == VIEW_CONVERT_EXPR
2823 || sc == FIX_TRUNC_EXPR;
2826 return false;
2829 /* Return true if S is a clobber statement. */
2831 static inline bool
2832 gimple_clobber_p (const gimple *s)
2834 return gimple_assign_single_p (s)
2835 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2838 /* Return true if GS is a GIMPLE_CALL. */
2840 static inline bool
2841 is_gimple_call (const gimple *gs)
2843 return gimple_code (gs) == GIMPLE_CALL;
2846 /* Return the LHS of call statement GS. */
2848 static inline tree
2849 gimple_call_lhs (const gcall *gs)
2851 return gs->op[0];
2854 static inline tree
2855 gimple_call_lhs (const gimple *gs)
2857 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2858 return gimple_call_lhs (gc);
2862 /* Return a pointer to the LHS of call statement GS. */
2864 static inline tree *
2865 gimple_call_lhs_ptr (gcall *gs)
2867 return &gs->op[0];
2870 static inline tree *
2871 gimple_call_lhs_ptr (gimple *gs)
2873 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2874 return gimple_call_lhs_ptr (gc);
2878 /* Set LHS to be the LHS operand of call statement GS. */
2880 static inline void
2881 gimple_call_set_lhs (gcall *gs, tree lhs)
2883 gs->op[0] = lhs;
2884 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2885 SSA_NAME_DEF_STMT (lhs) = gs;
2888 static inline void
2889 gimple_call_set_lhs (gimple *gs, tree lhs)
2891 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2892 gimple_call_set_lhs (gc, lhs);
2896 /* Return true if call GS calls an internal-only function, as enumerated
2897 by internal_fn. */
2899 static inline bool
2900 gimple_call_internal_p (const gcall *gs)
2902 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2905 static inline bool
2906 gimple_call_internal_p (const gimple *gs)
2908 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2909 return gimple_call_internal_p (gc);
2912 /* Return true if call GS is marked as nocf_check. */
2914 static inline bool
2915 gimple_call_nocf_check_p (const gcall *gs)
2917 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2920 /* Mark statement GS as nocf_check call. */
2922 static inline void
2923 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2925 if (nocf_check)
2926 gs->subcode |= GF_CALL_NOCF_CHECK;
2927 else
2928 gs->subcode &= ~GF_CALL_NOCF_CHECK;
2931 /* Return the target of internal call GS. */
2933 static inline enum internal_fn
2934 gimple_call_internal_fn (const gcall *gs)
2936 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2937 return gs->u.internal_fn;
2940 static inline enum internal_fn
2941 gimple_call_internal_fn (const gimple *gs)
2943 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2944 return gimple_call_internal_fn (gc);
2947 /* Return true, if this internal gimple call is unique. */
2949 static inline bool
2950 gimple_call_internal_unique_p (const gcall *gs)
2952 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2955 static inline bool
2956 gimple_call_internal_unique_p (const gimple *gs)
2958 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2959 return gimple_call_internal_unique_p (gc);
2962 /* Return true if GS is an internal function FN. */
2964 static inline bool
2965 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2967 return (is_gimple_call (gs)
2968 && gimple_call_internal_p (gs)
2969 && gimple_call_internal_fn (gs) == fn);
2972 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2973 that could alter control flow. */
2975 static inline void
2976 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2978 if (ctrl_altering_p)
2979 s->subcode |= GF_CALL_CTRL_ALTERING;
2980 else
2981 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2984 static inline void
2985 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2987 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2988 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2991 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2992 flag is set. Such call could not be a stmt in the middle of a bb. */
2994 static inline bool
2995 gimple_call_ctrl_altering_p (const gcall *gs)
2997 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3000 static inline bool
3001 gimple_call_ctrl_altering_p (const gimple *gs)
3003 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3004 return gimple_call_ctrl_altering_p (gc);
3008 /* Return the function type of the function called by GS. */
3010 static inline tree
3011 gimple_call_fntype (const gcall *gs)
3013 if (gimple_call_internal_p (gs))
3014 return NULL_TREE;
3015 return gs->u.fntype;
3018 static inline tree
3019 gimple_call_fntype (const gimple *gs)
3021 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3022 return gimple_call_fntype (call_stmt);
3025 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3027 static inline void
3028 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3030 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3031 call_stmt->u.fntype = fntype;
3035 /* Return the tree node representing the function called by call
3036 statement GS. */
3038 static inline tree
3039 gimple_call_fn (const gcall *gs)
3041 return gs->op[1];
3044 static inline tree
3045 gimple_call_fn (const gimple *gs)
3047 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3048 return gimple_call_fn (gc);
3051 /* Return a pointer to the tree node representing the function called by call
3052 statement GS. */
3054 static inline tree *
3055 gimple_call_fn_ptr (gcall *gs)
3057 return &gs->op[1];
3060 static inline tree *
3061 gimple_call_fn_ptr (gimple *gs)
3063 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3064 return gimple_call_fn_ptr (gc);
3068 /* Set FN to be the function called by call statement GS. */
3070 static inline void
3071 gimple_call_set_fn (gcall *gs, tree fn)
3073 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3074 gs->op[1] = fn;
3078 /* Set FNDECL to be the function called by call statement GS. */
3080 static inline void
3081 gimple_call_set_fndecl (gcall *gs, tree decl)
3083 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3084 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3085 build_pointer_type (TREE_TYPE (decl)), decl);
3088 static inline void
3089 gimple_call_set_fndecl (gimple *gs, tree decl)
3091 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3092 gimple_call_set_fndecl (gc, decl);
3096 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3098 static inline void
3099 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3101 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3102 call_stmt->u.internal_fn = fn;
3106 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3107 Otherwise return NULL. This function is analogous to
3108 get_callee_fndecl in tree land. */
3110 static inline tree
3111 gimple_call_fndecl (const gcall *gs)
3113 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3116 static inline tree
3117 gimple_call_fndecl (const gimple *gs)
3119 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3120 return gimple_call_fndecl (gc);
3124 /* Return the type returned by call statement GS. */
3126 static inline tree
3127 gimple_call_return_type (const gcall *gs)
3129 tree type = gimple_call_fntype (gs);
3131 if (type == NULL_TREE)
3132 return TREE_TYPE (gimple_call_lhs (gs));
3134 /* The type returned by a function is the type of its
3135 function type. */
3136 return TREE_TYPE (type);
3140 /* Return the static chain for call statement GS. */
3142 static inline tree
3143 gimple_call_chain (const gcall *gs)
3145 return gs->op[2];
3148 static inline tree
3149 gimple_call_chain (const gimple *gs)
3151 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3152 return gimple_call_chain (gc);
3156 /* Return a pointer to the static chain for call statement CALL_STMT. */
3158 static inline tree *
3159 gimple_call_chain_ptr (gcall *call_stmt)
3161 return &call_stmt->op[2];
3164 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3166 static inline void
3167 gimple_call_set_chain (gcall *call_stmt, tree chain)
3169 call_stmt->op[2] = chain;
3173 /* Return the number of arguments used by call statement GS. */
3175 static inline unsigned
3176 gimple_call_num_args (const gcall *gs)
3178 return gimple_num_ops (gs) - 3;
3181 static inline unsigned
3182 gimple_call_num_args (const gimple *gs)
3184 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3185 return gimple_call_num_args (gc);
3189 /* Return the argument at position INDEX for call statement GS. */
3191 static inline tree
3192 gimple_call_arg (const gcall *gs, unsigned index)
3194 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3195 return gs->op[index + 3];
3198 static inline tree
3199 gimple_call_arg (const gimple *gs, unsigned index)
3201 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3202 return gimple_call_arg (gc, index);
3206 /* Return a pointer to the argument at position INDEX for call
3207 statement GS. */
3209 static inline tree *
3210 gimple_call_arg_ptr (gcall *gs, unsigned index)
3212 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3213 return &gs->op[index + 3];
3216 static inline tree *
3217 gimple_call_arg_ptr (gimple *gs, unsigned index)
3219 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3220 return gimple_call_arg_ptr (gc, index);
3224 /* Set ARG to be the argument at position INDEX for call statement GS. */
3226 static inline void
3227 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3229 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3230 gs->op[index + 3] = arg;
3233 static inline void
3234 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3236 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3237 gimple_call_set_arg (gc, index, arg);
3241 /* If TAIL_P is true, mark call statement S as being a tail call
3242 (i.e., a call just before the exit of a function). These calls are
3243 candidate for tail call optimization. */
3245 static inline void
3246 gimple_call_set_tail (gcall *s, bool tail_p)
3248 if (tail_p)
3249 s->subcode |= GF_CALL_TAILCALL;
3250 else
3251 s->subcode &= ~GF_CALL_TAILCALL;
3255 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3257 static inline bool
3258 gimple_call_tail_p (gcall *s)
3260 return (s->subcode & GF_CALL_TAILCALL) != 0;
3263 /* Mark (or clear) call statement S as requiring tail call optimization. */
3265 static inline void
3266 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3268 if (must_tail_p)
3269 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3270 else
3271 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3274 /* Return true if call statement has been marked as requiring
3275 tail call optimization. */
3277 static inline bool
3278 gimple_call_must_tail_p (const gcall *s)
3280 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3283 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3284 slot optimization. This transformation uses the target of the call
3285 expansion as the return slot for calls that return in memory. */
3287 static inline void
3288 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3290 if (return_slot_opt_p)
3291 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3292 else
3293 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3297 /* Return true if S is marked for return slot optimization. */
3299 static inline bool
3300 gimple_call_return_slot_opt_p (gcall *s)
3302 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3306 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3307 thunk to the thunked-to function. */
3309 static inline void
3310 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3312 if (from_thunk_p)
3313 s->subcode |= GF_CALL_FROM_THUNK;
3314 else
3315 s->subcode &= ~GF_CALL_FROM_THUNK;
3319 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3321 static inline bool
3322 gimple_call_from_thunk_p (gcall *s)
3324 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3328 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3329 argument pack in its argument list. */
3331 static inline void
3332 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3334 if (pass_arg_pack_p)
3335 s->subcode |= GF_CALL_VA_ARG_PACK;
3336 else
3337 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3341 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3342 argument pack in its argument list. */
3344 static inline bool
3345 gimple_call_va_arg_pack_p (gcall *s)
3347 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3351 /* Return true if S is a noreturn call. */
3353 static inline bool
3354 gimple_call_noreturn_p (const gcall *s)
3356 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3359 static inline bool
3360 gimple_call_noreturn_p (const gimple *s)
3362 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3363 return gimple_call_noreturn_p (gc);
3367 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3368 even if the called function can throw in other cases. */
3370 static inline void
3371 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3373 if (nothrow_p)
3374 s->subcode |= GF_CALL_NOTHROW;
3375 else
3376 s->subcode &= ~GF_CALL_NOTHROW;
3379 /* Return true if S is a nothrow call. */
3381 static inline bool
3382 gimple_call_nothrow_p (gcall *s)
3384 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3387 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3388 is known to be emitted for VLA objects. Those are wrapped by
3389 stack_save/stack_restore calls and hence can't lead to unbounded
3390 stack growth even when they occur in loops. */
3392 static inline void
3393 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3395 if (for_var)
3396 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3397 else
3398 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3401 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3403 static inline bool
3404 gimple_call_alloca_for_var_p (gcall *s)
3406 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3409 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3410 pointers to nested function are descriptors instead of trampolines. */
3412 static inline void
3413 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3415 if (by_descriptor_p)
3416 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3417 else
3418 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3421 /* Return true if S is a by-descriptor call. */
3423 static inline bool
3424 gimple_call_by_descriptor_p (gcall *s)
3426 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3429 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3431 static inline void
3432 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3434 dest_call->subcode = orig_call->subcode;
3438 /* Return a pointer to the points-to solution for the set of call-used
3439 variables of the call CALL_STMT. */
3441 static inline struct pt_solution *
3442 gimple_call_use_set (gcall *call_stmt)
3444 return &call_stmt->call_used;
3448 /* Return a pointer to the points-to solution for the set of call-used
3449 variables of the call CALL_STMT. */
3451 static inline struct pt_solution *
3452 gimple_call_clobber_set (gcall *call_stmt)
3454 return &call_stmt->call_clobbered;
3458 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3459 non-NULL lhs. */
3461 static inline bool
3462 gimple_has_lhs (gimple *stmt)
3464 if (is_gimple_assign (stmt))
3465 return true;
3466 if (gcall *call = dyn_cast <gcall *> (stmt))
3467 return gimple_call_lhs (call) != NULL_TREE;
3468 return false;
3472 /* Return the code of the predicate computed by conditional statement GS. */
3474 static inline enum tree_code
3475 gimple_cond_code (const gcond *gs)
3477 return (enum tree_code) gs->subcode;
3480 static inline enum tree_code
3481 gimple_cond_code (const gimple *gs)
3483 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3484 return gimple_cond_code (gc);
3488 /* Set CODE to be the predicate code for the conditional statement GS. */
3490 static inline void
3491 gimple_cond_set_code (gcond *gs, enum tree_code code)
3493 gs->subcode = code;
3497 /* Return the LHS of the predicate computed by conditional statement GS. */
3499 static inline tree
3500 gimple_cond_lhs (const gcond *gs)
3502 return gs->op[0];
3505 static inline tree
3506 gimple_cond_lhs (const gimple *gs)
3508 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3509 return gimple_cond_lhs (gc);
3512 /* Return the pointer to the LHS of the predicate computed by conditional
3513 statement GS. */
3515 static inline tree *
3516 gimple_cond_lhs_ptr (gcond *gs)
3518 return &gs->op[0];
3521 /* Set LHS to be the LHS operand of the predicate computed by
3522 conditional statement GS. */
3524 static inline void
3525 gimple_cond_set_lhs (gcond *gs, tree lhs)
3527 gs->op[0] = lhs;
3531 /* Return the RHS operand of the predicate computed by conditional GS. */
3533 static inline tree
3534 gimple_cond_rhs (const gcond *gs)
3536 return gs->op[1];
3539 static inline tree
3540 gimple_cond_rhs (const gimple *gs)
3542 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3543 return gimple_cond_rhs (gc);
3546 /* Return the pointer to the RHS operand of the predicate computed by
3547 conditional GS. */
3549 static inline tree *
3550 gimple_cond_rhs_ptr (gcond *gs)
3552 return &gs->op[1];
3556 /* Set RHS to be the RHS operand of the predicate computed by
3557 conditional statement GS. */
3559 static inline void
3560 gimple_cond_set_rhs (gcond *gs, tree rhs)
3562 gs->op[1] = rhs;
3566 /* Return the label used by conditional statement GS when its
3567 predicate evaluates to true. */
3569 static inline tree
3570 gimple_cond_true_label (const gcond *gs)
3572 return gs->op[2];
3576 /* Set LABEL to be the label used by conditional statement GS when its
3577 predicate evaluates to true. */
3579 static inline void
3580 gimple_cond_set_true_label (gcond *gs, tree label)
3582 gs->op[2] = label;
3586 /* Set LABEL to be the label used by conditional statement GS when its
3587 predicate evaluates to false. */
3589 static inline void
3590 gimple_cond_set_false_label (gcond *gs, tree label)
3592 gs->op[3] = label;
3596 /* Return the label used by conditional statement GS when its
3597 predicate evaluates to false. */
3599 static inline tree
3600 gimple_cond_false_label (const gcond *gs)
3602 return gs->op[3];
3606 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3608 static inline void
3609 gimple_cond_make_false (gcond *gs)
3611 gimple_cond_set_lhs (gs, boolean_false_node);
3612 gimple_cond_set_rhs (gs, boolean_false_node);
3613 gs->subcode = NE_EXPR;
3617 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3619 static inline void
3620 gimple_cond_make_true (gcond *gs)
3622 gimple_cond_set_lhs (gs, boolean_true_node);
3623 gimple_cond_set_rhs (gs, boolean_false_node);
3624 gs->subcode = NE_EXPR;
3627 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3628 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3630 static inline bool
3631 gimple_cond_true_p (const gcond *gs)
3633 tree lhs = gimple_cond_lhs (gs);
3634 tree rhs = gimple_cond_rhs (gs);
3635 enum tree_code code = gimple_cond_code (gs);
3637 if (lhs != boolean_true_node && lhs != boolean_false_node)
3638 return false;
3640 if (rhs != boolean_true_node && rhs != boolean_false_node)
3641 return false;
3643 if (code == NE_EXPR && lhs != rhs)
3644 return true;
3646 if (code == EQ_EXPR && lhs == rhs)
3647 return true;
3649 return false;
3652 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3653 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3655 static inline bool
3656 gimple_cond_false_p (const gcond *gs)
3658 tree lhs = gimple_cond_lhs (gs);
3659 tree rhs = gimple_cond_rhs (gs);
3660 enum tree_code code = gimple_cond_code (gs);
3662 if (lhs != boolean_true_node && lhs != boolean_false_node)
3663 return false;
3665 if (rhs != boolean_true_node && rhs != boolean_false_node)
3666 return false;
3668 if (code == NE_EXPR && lhs == rhs)
3669 return true;
3671 if (code == EQ_EXPR && lhs != rhs)
3672 return true;
3674 return false;
3677 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3679 static inline void
3680 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3681 tree rhs)
3683 gimple_cond_set_code (stmt, code);
3684 gimple_cond_set_lhs (stmt, lhs);
3685 gimple_cond_set_rhs (stmt, rhs);
3688 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3690 static inline tree
3691 gimple_label_label (const glabel *gs)
3693 return gs->op[0];
3697 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3698 GS. */
3700 static inline void
3701 gimple_label_set_label (glabel *gs, tree label)
3703 gs->op[0] = label;
3707 /* Return the destination of the unconditional jump GS. */
3709 static inline tree
3710 gimple_goto_dest (const gimple *gs)
3712 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3713 return gimple_op (gs, 0);
3717 /* Set DEST to be the destination of the unconditonal jump GS. */
3719 static inline void
3720 gimple_goto_set_dest (ggoto *gs, tree dest)
3722 gs->op[0] = dest;
3726 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3728 static inline tree
3729 gimple_bind_vars (const gbind *bind_stmt)
3731 return bind_stmt->vars;
3735 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3736 statement GS. */
3738 static inline void
3739 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3741 bind_stmt->vars = vars;
3745 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3746 statement GS. */
3748 static inline void
3749 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3751 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3755 static inline gimple_seq *
3756 gimple_bind_body_ptr (gbind *bind_stmt)
3758 return &bind_stmt->body;
3761 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3763 static inline gimple_seq
3764 gimple_bind_body (gbind *gs)
3766 return *gimple_bind_body_ptr (gs);
3770 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3771 statement GS. */
3773 static inline void
3774 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3776 bind_stmt->body = seq;
3780 /* Append a statement to the end of a GIMPLE_BIND's body. */
3782 static inline void
3783 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3785 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3789 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3791 static inline void
3792 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3794 gimple_seq_add_seq (&bind_stmt->body, seq);
3798 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3799 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3801 static inline tree
3802 gimple_bind_block (const gbind *bind_stmt)
3804 return bind_stmt->block;
3808 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3809 statement GS. */
3811 static inline void
3812 gimple_bind_set_block (gbind *bind_stmt, tree block)
3814 gcc_gimple_checking_assert (block == NULL_TREE
3815 || TREE_CODE (block) == BLOCK);
3816 bind_stmt->block = block;
3820 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3822 static inline unsigned
3823 gimple_asm_ninputs (const gasm *asm_stmt)
3825 return asm_stmt->ni;
3829 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3831 static inline unsigned
3832 gimple_asm_noutputs (const gasm *asm_stmt)
3834 return asm_stmt->no;
3838 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3840 static inline unsigned
3841 gimple_asm_nclobbers (const gasm *asm_stmt)
3843 return asm_stmt->nc;
3846 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3848 static inline unsigned
3849 gimple_asm_nlabels (const gasm *asm_stmt)
3851 return asm_stmt->nl;
3854 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3856 static inline tree
3857 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3859 gcc_gimple_checking_assert (index < asm_stmt->ni);
3860 return asm_stmt->op[index + asm_stmt->no];
3863 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3865 static inline void
3866 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3868 gcc_gimple_checking_assert (index < asm_stmt->ni
3869 && TREE_CODE (in_op) == TREE_LIST);
3870 asm_stmt->op[index + asm_stmt->no] = in_op;
3874 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3876 static inline tree
3877 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3879 gcc_gimple_checking_assert (index < asm_stmt->no);
3880 return asm_stmt->op[index];
3883 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3885 static inline void
3886 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3888 gcc_gimple_checking_assert (index < asm_stmt->no
3889 && TREE_CODE (out_op) == TREE_LIST);
3890 asm_stmt->op[index] = out_op;
3894 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3896 static inline tree
3897 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3899 gcc_gimple_checking_assert (index < asm_stmt->nc);
3900 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3904 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3906 static inline void
3907 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3909 gcc_gimple_checking_assert (index < asm_stmt->nc
3910 && TREE_CODE (clobber_op) == TREE_LIST);
3911 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3914 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3916 static inline tree
3917 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3919 gcc_gimple_checking_assert (index < asm_stmt->nl);
3920 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3923 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3925 static inline void
3926 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3928 gcc_gimple_checking_assert (index < asm_stmt->nl
3929 && TREE_CODE (label_op) == TREE_LIST);
3930 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3933 /* Return the string representing the assembly instruction in
3934 GIMPLE_ASM ASM_STMT. */
3936 static inline const char *
3937 gimple_asm_string (const gasm *asm_stmt)
3939 return asm_stmt->string;
3943 /* Return true if ASM_STMT is marked volatile. */
3945 static inline bool
3946 gimple_asm_volatile_p (const gasm *asm_stmt)
3948 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3952 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
3954 static inline void
3955 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3957 if (volatile_p)
3958 asm_stmt->subcode |= GF_ASM_VOLATILE;
3959 else
3960 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3964 /* Return true if ASM_STMT is marked inline. */
3966 static inline bool
3967 gimple_asm_inline_p (const gasm *asm_stmt)
3969 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
3973 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
3975 static inline void
3976 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
3978 if (inline_p)
3979 asm_stmt->subcode |= GF_ASM_INLINE;
3980 else
3981 asm_stmt->subcode &= ~GF_ASM_INLINE;
3985 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3987 static inline void
3988 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3990 if (input_p)
3991 asm_stmt->subcode |= GF_ASM_INPUT;
3992 else
3993 asm_stmt->subcode &= ~GF_ASM_INPUT;
3997 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3999 static inline bool
4000 gimple_asm_input_p (const gasm *asm_stmt)
4002 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4006 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4008 static inline tree
4009 gimple_catch_types (const gcatch *catch_stmt)
4011 return catch_stmt->types;
4015 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4017 static inline tree *
4018 gimple_catch_types_ptr (gcatch *catch_stmt)
4020 return &catch_stmt->types;
4024 /* Return a pointer to the GIMPLE sequence representing the body of
4025 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4027 static inline gimple_seq *
4028 gimple_catch_handler_ptr (gcatch *catch_stmt)
4030 return &catch_stmt->handler;
4034 /* Return the GIMPLE sequence representing the body of the handler of
4035 GIMPLE_CATCH statement CATCH_STMT. */
4037 static inline gimple_seq
4038 gimple_catch_handler (gcatch *catch_stmt)
4040 return *gimple_catch_handler_ptr (catch_stmt);
4044 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4046 static inline void
4047 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4049 catch_stmt->types = t;
4053 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4055 static inline void
4056 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4058 catch_stmt->handler = handler;
4062 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4064 static inline tree
4065 gimple_eh_filter_types (const gimple *gs)
4067 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4068 return eh_filter_stmt->types;
4072 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4073 GS. */
4075 static inline tree *
4076 gimple_eh_filter_types_ptr (gimple *gs)
4078 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4079 return &eh_filter_stmt->types;
4083 /* Return a pointer to the sequence of statement to execute when
4084 GIMPLE_EH_FILTER statement fails. */
4086 static inline gimple_seq *
4087 gimple_eh_filter_failure_ptr (gimple *gs)
4089 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4090 return &eh_filter_stmt->failure;
4094 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4095 statement fails. */
4097 static inline gimple_seq
4098 gimple_eh_filter_failure (gimple *gs)
4100 return *gimple_eh_filter_failure_ptr (gs);
4104 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4105 EH_FILTER_STMT. */
4107 static inline void
4108 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4110 eh_filter_stmt->types = types;
4114 /* Set FAILURE to be the sequence of statements to execute on failure
4115 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4117 static inline void
4118 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4119 gimple_seq failure)
4121 eh_filter_stmt->failure = failure;
4124 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4126 static inline tree
4127 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4129 return eh_mnt_stmt->fndecl;
4132 /* Set the function decl to be called by GS to DECL. */
4134 static inline void
4135 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4136 tree decl)
4138 eh_mnt_stmt->fndecl = decl;
4141 /* GIMPLE_EH_ELSE accessors. */
4143 static inline gimple_seq *
4144 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4146 return &eh_else_stmt->n_body;
4149 static inline gimple_seq
4150 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4152 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4155 static inline gimple_seq *
4156 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4158 return &eh_else_stmt->e_body;
4161 static inline gimple_seq
4162 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4164 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4167 static inline void
4168 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4170 eh_else_stmt->n_body = seq;
4173 static inline void
4174 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4176 eh_else_stmt->e_body = seq;
4179 /* GIMPLE_TRY accessors. */
4181 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4182 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4184 static inline enum gimple_try_flags
4185 gimple_try_kind (const gimple *gs)
4187 GIMPLE_CHECK (gs, GIMPLE_TRY);
4188 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4192 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4194 static inline void
4195 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4197 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4198 || kind == GIMPLE_TRY_FINALLY);
4199 if (gimple_try_kind (gs) != kind)
4200 gs->subcode = (unsigned int) kind;
4204 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4206 static inline bool
4207 gimple_try_catch_is_cleanup (const gimple *gs)
4209 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4210 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4214 /* Return a pointer to the sequence of statements used as the
4215 body for GIMPLE_TRY GS. */
4217 static inline gimple_seq *
4218 gimple_try_eval_ptr (gimple *gs)
4220 gtry *try_stmt = as_a <gtry *> (gs);
4221 return &try_stmt->eval;
4225 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4227 static inline gimple_seq
4228 gimple_try_eval (gimple *gs)
4230 return *gimple_try_eval_ptr (gs);
4234 /* Return a pointer to the sequence of statements used as the cleanup body for
4235 GIMPLE_TRY GS. */
4237 static inline gimple_seq *
4238 gimple_try_cleanup_ptr (gimple *gs)
4240 gtry *try_stmt = as_a <gtry *> (gs);
4241 return &try_stmt->cleanup;
4245 /* Return the sequence of statements used as the cleanup body for
4246 GIMPLE_TRY GS. */
4248 static inline gimple_seq
4249 gimple_try_cleanup (gimple *gs)
4251 return *gimple_try_cleanup_ptr (gs);
4255 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4257 static inline void
4258 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4260 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4261 if (catch_is_cleanup)
4262 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4263 else
4264 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4268 /* Set EVAL to be the sequence of statements to use as the body for
4269 GIMPLE_TRY TRY_STMT. */
4271 static inline void
4272 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4274 try_stmt->eval = eval;
4278 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4279 body for GIMPLE_TRY TRY_STMT. */
4281 static inline void
4282 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4284 try_stmt->cleanup = cleanup;
4288 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4290 static inline gimple_seq *
4291 gimple_wce_cleanup_ptr (gimple *gs)
4293 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4294 return &wce_stmt->cleanup;
4298 /* Return the cleanup sequence for cleanup statement GS. */
4300 static inline gimple_seq
4301 gimple_wce_cleanup (gimple *gs)
4303 return *gimple_wce_cleanup_ptr (gs);
4307 /* Set CLEANUP to be the cleanup sequence for GS. */
4309 static inline void
4310 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4312 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4313 wce_stmt->cleanup = cleanup;
4317 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4319 static inline bool
4320 gimple_wce_cleanup_eh_only (const gimple *gs)
4322 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4323 return gs->subcode != 0;
4327 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4329 static inline void
4330 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4332 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4333 gs->subcode = (unsigned int) eh_only_p;
4337 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4339 static inline unsigned
4340 gimple_phi_capacity (const gimple *gs)
4342 const gphi *phi_stmt = as_a <const gphi *> (gs);
4343 return phi_stmt->capacity;
4347 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4348 be exactly the number of incoming edges for the basic block holding
4349 GS. */
4351 static inline unsigned
4352 gimple_phi_num_args (const gimple *gs)
4354 const gphi *phi_stmt = as_a <const gphi *> (gs);
4355 return phi_stmt->nargs;
4359 /* Return the SSA name created by GIMPLE_PHI GS. */
4361 static inline tree
4362 gimple_phi_result (const gphi *gs)
4364 return gs->result;
4367 static inline tree
4368 gimple_phi_result (const gimple *gs)
4370 const gphi *phi_stmt = as_a <const gphi *> (gs);
4371 return gimple_phi_result (phi_stmt);
4374 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4376 static inline tree *
4377 gimple_phi_result_ptr (gphi *gs)
4379 return &gs->result;
4382 static inline tree *
4383 gimple_phi_result_ptr (gimple *gs)
4385 gphi *phi_stmt = as_a <gphi *> (gs);
4386 return gimple_phi_result_ptr (phi_stmt);
4389 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4391 static inline void
4392 gimple_phi_set_result (gphi *phi, tree result)
4394 phi->result = result;
4395 if (result && TREE_CODE (result) == SSA_NAME)
4396 SSA_NAME_DEF_STMT (result) = phi;
4400 /* Return the PHI argument corresponding to incoming edge INDEX for
4401 GIMPLE_PHI GS. */
4403 static inline struct phi_arg_d *
4404 gimple_phi_arg (gphi *gs, unsigned index)
4406 gcc_gimple_checking_assert (index < gs->nargs);
4407 return &(gs->args[index]);
4410 static inline struct phi_arg_d *
4411 gimple_phi_arg (gimple *gs, unsigned index)
4413 gphi *phi_stmt = as_a <gphi *> (gs);
4414 return gimple_phi_arg (phi_stmt, index);
4417 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4418 for GIMPLE_PHI PHI. */
4420 static inline void
4421 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4423 gcc_gimple_checking_assert (index < phi->nargs);
4424 phi->args[index] = *phiarg;
4427 /* Return the PHI nodes for basic block BB, or NULL if there are no
4428 PHI nodes. */
4430 static inline gimple_seq
4431 phi_nodes (const_basic_block bb)
4433 gcc_checking_assert (!(bb->flags & BB_RTL));
4434 return bb->il.gimple.phi_nodes;
4437 /* Return a pointer to the PHI nodes for basic block BB. */
4439 static inline gimple_seq *
4440 phi_nodes_ptr (basic_block bb)
4442 gcc_checking_assert (!(bb->flags & BB_RTL));
4443 return &bb->il.gimple.phi_nodes;
4446 /* Return the tree operand for argument I of PHI node GS. */
4448 static inline tree
4449 gimple_phi_arg_def (gphi *gs, size_t index)
4451 return gimple_phi_arg (gs, index)->def;
4454 static inline tree
4455 gimple_phi_arg_def (gimple *gs, size_t index)
4457 return gimple_phi_arg (gs, index)->def;
4461 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4463 static inline tree *
4464 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4466 return &gimple_phi_arg (phi, index)->def;
4469 /* Return the edge associated with argument I of phi node PHI. */
4471 static inline edge
4472 gimple_phi_arg_edge (gphi *phi, size_t i)
4474 return EDGE_PRED (gimple_bb (phi), i);
4477 /* Return the source location of gimple argument I of phi node PHI. */
4479 static inline location_t
4480 gimple_phi_arg_location (gphi *phi, size_t i)
4482 return gimple_phi_arg (phi, i)->locus;
4485 /* Return the source location of the argument on edge E of phi node PHI. */
4487 static inline location_t
4488 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4490 return gimple_phi_arg (phi, e->dest_idx)->locus;
4493 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4495 static inline void
4496 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4498 gimple_phi_arg (phi, i)->locus = loc;
4501 /* Return TRUE if argument I of phi node PHI has a location record. */
4503 static inline bool
4504 gimple_phi_arg_has_location (gphi *phi, size_t i)
4506 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4510 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4512 static inline int
4513 gimple_resx_region (const gresx *resx_stmt)
4515 return resx_stmt->region;
4518 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4520 static inline void
4521 gimple_resx_set_region (gresx *resx_stmt, int region)
4523 resx_stmt->region = region;
4526 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4528 static inline int
4529 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4531 return eh_dispatch_stmt->region;
4534 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4535 EH_DISPATCH_STMT. */
4537 static inline void
4538 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4540 eh_dispatch_stmt->region = region;
4543 /* Return the number of labels associated with the switch statement GS. */
4545 static inline unsigned
4546 gimple_switch_num_labels (const gswitch *gs)
4548 unsigned num_ops;
4549 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4550 num_ops = gimple_num_ops (gs);
4551 gcc_gimple_checking_assert (num_ops > 1);
4552 return num_ops - 1;
4556 /* Set NLABELS to be the number of labels for the switch statement GS. */
4558 static inline void
4559 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4561 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4562 gimple_set_num_ops (g, nlabels + 1);
4566 /* Return the index variable used by the switch statement GS. */
4568 static inline tree
4569 gimple_switch_index (const gswitch *gs)
4571 return gs->op[0];
4575 /* Return a pointer to the index variable for the switch statement GS. */
4577 static inline tree *
4578 gimple_switch_index_ptr (gswitch *gs)
4580 return &gs->op[0];
4584 /* Set INDEX to be the index variable for switch statement GS. */
4586 static inline void
4587 gimple_switch_set_index (gswitch *gs, tree index)
4589 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4590 gs->op[0] = index;
4594 /* Return the label numbered INDEX. The default label is 0, followed by any
4595 labels in a switch statement. */
4597 static inline tree
4598 gimple_switch_label (const gswitch *gs, unsigned index)
4600 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4601 return gs->op[index + 1];
4604 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4606 static inline void
4607 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4609 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4610 && (label == NULL_TREE
4611 || TREE_CODE (label) == CASE_LABEL_EXPR));
4612 gs->op[index + 1] = label;
4615 /* Return the default label for a switch statement. */
4617 static inline tree
4618 gimple_switch_default_label (const gswitch *gs)
4620 tree label = gimple_switch_label (gs, 0);
4621 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4622 return label;
4625 /* Set the default label for a switch statement. */
4627 static inline void
4628 gimple_switch_set_default_label (gswitch *gs, tree label)
4630 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4631 gimple_switch_set_label (gs, 0, label);
4634 /* Return true if GS is a GIMPLE_DEBUG statement. */
4636 static inline bool
4637 is_gimple_debug (const gimple *gs)
4639 return gimple_code (gs) == GIMPLE_DEBUG;
4643 /* Return the last nondebug statement in GIMPLE sequence S. */
4645 static inline gimple *
4646 gimple_seq_last_nondebug_stmt (gimple_seq s)
4648 gimple_seq_node n;
4649 for (n = gimple_seq_last (s);
4650 n && is_gimple_debug (n);
4651 n = n->prev)
4652 if (n->prev == s)
4653 return NULL;
4654 return n;
4658 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4660 static inline bool
4661 gimple_debug_bind_p (const gimple *s)
4663 if (is_gimple_debug (s))
4664 return s->subcode == GIMPLE_DEBUG_BIND;
4666 return false;
4669 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4671 static inline tree
4672 gimple_debug_bind_get_var (gimple *dbg)
4674 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4675 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4676 return gimple_op (dbg, 0);
4679 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4680 statement. */
4682 static inline tree
4683 gimple_debug_bind_get_value (gimple *dbg)
4685 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4686 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4687 return gimple_op (dbg, 1);
4690 /* Return a pointer to the value bound to the variable in a
4691 GIMPLE_DEBUG bind statement. */
4693 static inline tree *
4694 gimple_debug_bind_get_value_ptr (gimple *dbg)
4696 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4697 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4698 return gimple_op_ptr (dbg, 1);
4701 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4703 static inline void
4704 gimple_debug_bind_set_var (gimple *dbg, tree var)
4706 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4707 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4708 gimple_set_op (dbg, 0, var);
4711 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4712 statement. */
4714 static inline void
4715 gimple_debug_bind_set_value (gimple *dbg, tree value)
4717 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4718 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4719 gimple_set_op (dbg, 1, value);
4722 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4723 optimized away. */
4724 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4726 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4727 statement. */
4729 static inline void
4730 gimple_debug_bind_reset_value (gimple *dbg)
4732 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4733 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4734 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4737 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4738 value. */
4740 static inline bool
4741 gimple_debug_bind_has_value_p (gimple *dbg)
4743 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4744 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4745 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4748 #undef GIMPLE_DEBUG_BIND_NOVALUE
4750 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4752 static inline bool
4753 gimple_debug_source_bind_p (const gimple *s)
4755 if (is_gimple_debug (s))
4756 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4758 return false;
4761 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4763 static inline tree
4764 gimple_debug_source_bind_get_var (gimple *dbg)
4766 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4767 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4768 return gimple_op (dbg, 0);
4771 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4772 statement. */
4774 static inline tree
4775 gimple_debug_source_bind_get_value (gimple *dbg)
4777 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4778 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4779 return gimple_op (dbg, 1);
4782 /* Return a pointer to the value bound to the variable in a
4783 GIMPLE_DEBUG source bind statement. */
4785 static inline tree *
4786 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4788 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4789 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4790 return gimple_op_ptr (dbg, 1);
4793 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4795 static inline void
4796 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4798 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4799 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4800 gimple_set_op (dbg, 0, var);
4803 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4804 statement. */
4806 static inline void
4807 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4809 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4810 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4811 gimple_set_op (dbg, 1, value);
4814 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4816 static inline bool
4817 gimple_debug_begin_stmt_p (const gimple *s)
4819 if (is_gimple_debug (s))
4820 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4822 return false;
4825 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4827 static inline bool
4828 gimple_debug_inline_entry_p (const gimple *s)
4830 if (is_gimple_debug (s))
4831 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4833 return false;
4836 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4838 static inline bool
4839 gimple_debug_nonbind_marker_p (const gimple *s)
4841 if (is_gimple_debug (s))
4842 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
4843 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
4845 return false;
4848 /* Return the line number for EXPR, or return -1 if we have no line
4849 number information for it. */
4850 static inline int
4851 get_lineno (const gimple *stmt)
4853 location_t loc;
4855 if (!stmt)
4856 return -1;
4858 loc = gimple_location (stmt);
4859 if (loc == UNKNOWN_LOCATION)
4860 return -1;
4862 return LOCATION_LINE (loc);
4865 /* Return a pointer to the body for the OMP statement GS. */
4867 static inline gimple_seq *
4868 gimple_omp_body_ptr (gimple *gs)
4870 return &static_cast <gimple_statement_omp *> (gs)->body;
4873 /* Return the body for the OMP statement GS. */
4875 static inline gimple_seq
4876 gimple_omp_body (gimple *gs)
4878 return *gimple_omp_body_ptr (gs);
4881 /* Set BODY to be the body for the OMP statement GS. */
4883 static inline void
4884 gimple_omp_set_body (gimple *gs, gimple_seq body)
4886 static_cast <gimple_statement_omp *> (gs)->body = body;
4890 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4892 static inline tree
4893 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4895 return crit_stmt->name;
4899 /* Return a pointer to the name associated with OMP critical statement
4900 CRIT_STMT. */
4902 static inline tree *
4903 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4905 return &crit_stmt->name;
4909 /* Set NAME to be the name associated with OMP critical statement
4910 CRIT_STMT. */
4912 static inline void
4913 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4915 crit_stmt->name = name;
4919 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4921 static inline tree
4922 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4924 return crit_stmt->clauses;
4928 /* Return a pointer to the clauses associated with OMP critical statement
4929 CRIT_STMT. */
4931 static inline tree *
4932 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4934 return &crit_stmt->clauses;
4938 /* Set CLAUSES to be the clauses associated with OMP critical statement
4939 CRIT_STMT. */
4941 static inline void
4942 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4944 crit_stmt->clauses = clauses;
4948 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4950 static inline tree
4951 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4953 return ord_stmt->clauses;
4957 /* Return a pointer to the clauses associated with OMP ordered statement
4958 ORD_STMT. */
4960 static inline tree *
4961 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4963 return &ord_stmt->clauses;
4967 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4968 ORD_STMT. */
4970 static inline void
4971 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4973 ord_stmt->clauses = clauses;
4977 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
4979 static inline tree
4980 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
4982 return scan_stmt->clauses;
4986 /* Return a pointer to the clauses associated with OMP scan statement
4987 ORD_STMT. */
4989 static inline tree *
4990 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
4992 return &scan_stmt->clauses;
4996 /* Set CLAUSES to be the clauses associated with OMP scan statement
4997 ORD_STMT. */
4999 static inline void
5000 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5002 scan_stmt->clauses = clauses;
5006 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5008 static inline tree
5009 gimple_omp_taskgroup_clauses (const gimple *gs)
5011 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5012 return
5013 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5017 /* Return a pointer to the clauses associated with OMP taskgroup statement
5018 GS. */
5020 static inline tree *
5021 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5023 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5024 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5028 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5029 GS. */
5031 static inline void
5032 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5034 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5035 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5036 = clauses;
5040 /* Return the kind of the OMP_FOR statemement G. */
5042 static inline int
5043 gimple_omp_for_kind (const gimple *g)
5045 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5046 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5050 /* Set the kind of the OMP_FOR statement G. */
5052 static inline void
5053 gimple_omp_for_set_kind (gomp_for *g, int kind)
5055 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5056 | (kind & GF_OMP_FOR_KIND_MASK);
5060 /* Return true if OMP_FOR statement G has the
5061 GF_OMP_FOR_COMBINED flag set. */
5063 static inline bool
5064 gimple_omp_for_combined_p (const gimple *g)
5066 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5067 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5071 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5072 the boolean value of COMBINED_P. */
5074 static inline void
5075 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5077 if (combined_p)
5078 g->subcode |= GF_OMP_FOR_COMBINED;
5079 else
5080 g->subcode &= ~GF_OMP_FOR_COMBINED;
5084 /* Return true if the OMP_FOR statement G has the
5085 GF_OMP_FOR_COMBINED_INTO flag set. */
5087 static inline bool
5088 gimple_omp_for_combined_into_p (const gimple *g)
5090 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5091 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5095 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5096 on the boolean value of COMBINED_P. */
5098 static inline void
5099 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5101 if (combined_p)
5102 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5103 else
5104 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5108 /* Return the clauses associated with the OMP_FOR statement GS. */
5110 static inline tree
5111 gimple_omp_for_clauses (const gimple *gs)
5113 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5114 return omp_for_stmt->clauses;
5118 /* Return a pointer to the clauses associated with the OMP_FOR statement
5119 GS. */
5121 static inline tree *
5122 gimple_omp_for_clauses_ptr (gimple *gs)
5124 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5125 return &omp_for_stmt->clauses;
5129 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5130 GS. */
5132 static inline void
5133 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5135 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5136 omp_for_stmt->clauses = clauses;
5140 /* Get the collapse count of the OMP_FOR statement GS. */
5142 static inline size_t
5143 gimple_omp_for_collapse (gimple *gs)
5145 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5146 return omp_for_stmt->collapse;
5150 /* Return the condition code associated with the OMP_FOR statement GS. */
5152 static inline enum tree_code
5153 gimple_omp_for_cond (const gimple *gs, size_t i)
5155 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5156 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5157 return omp_for_stmt->iter[i].cond;
5161 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5163 static inline void
5164 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5166 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5167 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5168 && i < omp_for_stmt->collapse);
5169 omp_for_stmt->iter[i].cond = cond;
5173 /* Return the index variable for the OMP_FOR statement GS. */
5175 static inline tree
5176 gimple_omp_for_index (const gimple *gs, size_t i)
5178 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5179 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5180 return omp_for_stmt->iter[i].index;
5184 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5186 static inline tree *
5187 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5189 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5190 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5191 return &omp_for_stmt->iter[i].index;
5195 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5197 static inline void
5198 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5200 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5201 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5202 omp_for_stmt->iter[i].index = index;
5206 /* Return the initial value for the OMP_FOR statement GS. */
5208 static inline tree
5209 gimple_omp_for_initial (const gimple *gs, size_t i)
5211 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5212 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5213 return omp_for_stmt->iter[i].initial;
5217 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5219 static inline tree *
5220 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5222 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5223 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5224 return &omp_for_stmt->iter[i].initial;
5228 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5230 static inline void
5231 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5233 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5234 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5235 omp_for_stmt->iter[i].initial = initial;
5239 /* Return the final value for the OMP_FOR statement GS. */
5241 static inline tree
5242 gimple_omp_for_final (const gimple *gs, size_t i)
5244 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5245 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5246 return omp_for_stmt->iter[i].final;
5250 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5252 static inline tree *
5253 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5255 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5256 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5257 return &omp_for_stmt->iter[i].final;
5261 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5263 static inline void
5264 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5266 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5267 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5268 omp_for_stmt->iter[i].final = final;
5272 /* Return the increment value for the OMP_FOR statement GS. */
5274 static inline tree
5275 gimple_omp_for_incr (const gimple *gs, size_t i)
5277 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5278 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5279 return omp_for_stmt->iter[i].incr;
5283 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5285 static inline tree *
5286 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5288 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5289 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5290 return &omp_for_stmt->iter[i].incr;
5294 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5296 static inline void
5297 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5299 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5300 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5301 omp_for_stmt->iter[i].incr = incr;
5305 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5306 statement GS starts. */
5308 static inline gimple_seq *
5309 gimple_omp_for_pre_body_ptr (gimple *gs)
5311 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5312 return &omp_for_stmt->pre_body;
5316 /* Return the sequence of statements to execute before the OMP_FOR
5317 statement GS starts. */
5319 static inline gimple_seq
5320 gimple_omp_for_pre_body (gimple *gs)
5322 return *gimple_omp_for_pre_body_ptr (gs);
5326 /* Set PRE_BODY to be the sequence of statements to execute before the
5327 OMP_FOR statement GS starts. */
5329 static inline void
5330 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5332 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5333 omp_for_stmt->pre_body = pre_body;
5336 /* Return the kernel_phony of OMP_FOR statement. */
5338 static inline bool
5339 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5341 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5342 != GF_OMP_FOR_KIND_GRID_LOOP);
5343 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5346 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5348 static inline void
5349 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5351 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5352 != GF_OMP_FOR_KIND_GRID_LOOP);
5353 if (value)
5354 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5355 else
5356 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5359 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5361 static inline bool
5362 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5364 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5365 == GF_OMP_FOR_KIND_GRID_LOOP);
5366 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5369 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5371 static inline void
5372 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5374 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5375 == GF_OMP_FOR_KIND_GRID_LOOP);
5376 if (value)
5377 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5378 else
5379 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5382 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5383 groups. */
5385 static inline bool
5386 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5388 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5389 == GF_OMP_FOR_KIND_GRID_LOOP);
5390 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5393 /* Set group_iter flag of OMP_FOR to VALUE. */
5395 static inline void
5396 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5398 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5399 == GF_OMP_FOR_KIND_GRID_LOOP);
5400 if (value)
5401 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5402 else
5403 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5406 /* Return the clauses associated with OMP_PARALLEL GS. */
5408 static inline tree
5409 gimple_omp_parallel_clauses (const gimple *gs)
5411 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5412 return omp_parallel_stmt->clauses;
5416 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5418 static inline tree *
5419 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5421 return &omp_parallel_stmt->clauses;
5425 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5427 static inline void
5428 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5429 tree clauses)
5431 omp_parallel_stmt->clauses = clauses;
5435 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5437 static inline tree
5438 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5440 return omp_parallel_stmt->child_fn;
5443 /* Return a pointer to the child function used to hold the body of
5444 OMP_PARALLEL_STMT. */
5446 static inline tree *
5447 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5449 return &omp_parallel_stmt->child_fn;
5453 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5455 static inline void
5456 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5457 tree child_fn)
5459 omp_parallel_stmt->child_fn = child_fn;
5463 /* Return the artificial argument used to send variables and values
5464 from the parent to the children threads in OMP_PARALLEL_STMT. */
5466 static inline tree
5467 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5469 return omp_parallel_stmt->data_arg;
5473 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5475 static inline tree *
5476 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5478 return &omp_parallel_stmt->data_arg;
5482 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5484 static inline void
5485 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5486 tree data_arg)
5488 omp_parallel_stmt->data_arg = data_arg;
5491 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5493 static inline bool
5494 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5496 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5499 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5501 static inline void
5502 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5504 if (value)
5505 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5506 else
5507 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5510 /* Return the clauses associated with OMP_TASK GS. */
5512 static inline tree
5513 gimple_omp_task_clauses (const gimple *gs)
5515 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5516 return omp_task_stmt->clauses;
5520 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5522 static inline tree *
5523 gimple_omp_task_clauses_ptr (gimple *gs)
5525 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5526 return &omp_task_stmt->clauses;
5530 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5531 GS. */
5533 static inline void
5534 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5536 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5537 omp_task_stmt->clauses = clauses;
5541 /* Return true if OMP task statement G has the
5542 GF_OMP_TASK_TASKLOOP flag set. */
5544 static inline bool
5545 gimple_omp_task_taskloop_p (const gimple *g)
5547 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5548 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5552 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5553 value of TASKLOOP_P. */
5555 static inline void
5556 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5558 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5559 if (taskloop_p)
5560 g->subcode |= GF_OMP_TASK_TASKLOOP;
5561 else
5562 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5566 /* Return true if OMP task statement G has the
5567 GF_OMP_TASK_TASKWAIT flag set. */
5569 static inline bool
5570 gimple_omp_task_taskwait_p (const gimple *g)
5572 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5573 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5577 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5578 value of TASKWAIT_P. */
5580 static inline void
5581 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5583 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5584 if (taskwait_p)
5585 g->subcode |= GF_OMP_TASK_TASKWAIT;
5586 else
5587 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5591 /* Return the child function used to hold the body of OMP_TASK GS. */
5593 static inline tree
5594 gimple_omp_task_child_fn (const gimple *gs)
5596 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5597 return omp_task_stmt->child_fn;
5600 /* Return a pointer to the child function used to hold the body of
5601 OMP_TASK GS. */
5603 static inline tree *
5604 gimple_omp_task_child_fn_ptr (gimple *gs)
5606 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5607 return &omp_task_stmt->child_fn;
5611 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5613 static inline void
5614 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5616 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5617 omp_task_stmt->child_fn = child_fn;
5621 /* Return the artificial argument used to send variables and values
5622 from the parent to the children threads in OMP_TASK GS. */
5624 static inline tree
5625 gimple_omp_task_data_arg (const gimple *gs)
5627 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5628 return omp_task_stmt->data_arg;
5632 /* Return a pointer to the data argument for OMP_TASK GS. */
5634 static inline tree *
5635 gimple_omp_task_data_arg_ptr (gimple *gs)
5637 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5638 return &omp_task_stmt->data_arg;
5642 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5644 static inline void
5645 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5647 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5648 omp_task_stmt->data_arg = data_arg;
5652 /* Return the clauses associated with OMP_TASK GS. */
5654 static inline tree
5655 gimple_omp_taskreg_clauses (const gimple *gs)
5657 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5658 = as_a <const gimple_statement_omp_taskreg *> (gs);
5659 return omp_taskreg_stmt->clauses;
5663 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5665 static inline tree *
5666 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5668 gimple_statement_omp_taskreg *omp_taskreg_stmt
5669 = as_a <gimple_statement_omp_taskreg *> (gs);
5670 return &omp_taskreg_stmt->clauses;
5674 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5675 GS. */
5677 static inline void
5678 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5680 gimple_statement_omp_taskreg *omp_taskreg_stmt
5681 = as_a <gimple_statement_omp_taskreg *> (gs);
5682 omp_taskreg_stmt->clauses = clauses;
5686 /* Return the child function used to hold the body of OMP_TASK GS. */
5688 static inline tree
5689 gimple_omp_taskreg_child_fn (const gimple *gs)
5691 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5692 = as_a <const gimple_statement_omp_taskreg *> (gs);
5693 return omp_taskreg_stmt->child_fn;
5696 /* Return a pointer to the child function used to hold the body of
5697 OMP_TASK GS. */
5699 static inline tree *
5700 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5702 gimple_statement_omp_taskreg *omp_taskreg_stmt
5703 = as_a <gimple_statement_omp_taskreg *> (gs);
5704 return &omp_taskreg_stmt->child_fn;
5708 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5710 static inline void
5711 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5713 gimple_statement_omp_taskreg *omp_taskreg_stmt
5714 = as_a <gimple_statement_omp_taskreg *> (gs);
5715 omp_taskreg_stmt->child_fn = child_fn;
5719 /* Return the artificial argument used to send variables and values
5720 from the parent to the children threads in OMP_TASK GS. */
5722 static inline tree
5723 gimple_omp_taskreg_data_arg (const gimple *gs)
5725 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5726 = as_a <const gimple_statement_omp_taskreg *> (gs);
5727 return omp_taskreg_stmt->data_arg;
5731 /* Return a pointer to the data argument for OMP_TASK GS. */
5733 static inline tree *
5734 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5736 gimple_statement_omp_taskreg *omp_taskreg_stmt
5737 = as_a <gimple_statement_omp_taskreg *> (gs);
5738 return &omp_taskreg_stmt->data_arg;
5742 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5744 static inline void
5745 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5747 gimple_statement_omp_taskreg *omp_taskreg_stmt
5748 = as_a <gimple_statement_omp_taskreg *> (gs);
5749 omp_taskreg_stmt->data_arg = data_arg;
5753 /* Return the copy function used to hold the body of OMP_TASK GS. */
5755 static inline tree
5756 gimple_omp_task_copy_fn (const gimple *gs)
5758 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5759 return omp_task_stmt->copy_fn;
5762 /* Return a pointer to the copy function used to hold the body of
5763 OMP_TASK GS. */
5765 static inline tree *
5766 gimple_omp_task_copy_fn_ptr (gimple *gs)
5768 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5769 return &omp_task_stmt->copy_fn;
5773 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5775 static inline void
5776 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5778 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5779 omp_task_stmt->copy_fn = copy_fn;
5783 /* Return size of the data block in bytes in OMP_TASK GS. */
5785 static inline tree
5786 gimple_omp_task_arg_size (const gimple *gs)
5788 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5789 return omp_task_stmt->arg_size;
5793 /* Return a pointer to the data block size for OMP_TASK GS. */
5795 static inline tree *
5796 gimple_omp_task_arg_size_ptr (gimple *gs)
5798 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5799 return &omp_task_stmt->arg_size;
5803 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5805 static inline void
5806 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5808 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5809 omp_task_stmt->arg_size = arg_size;
5813 /* Return align of the data block in bytes in OMP_TASK GS. */
5815 static inline tree
5816 gimple_omp_task_arg_align (const gimple *gs)
5818 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5819 return omp_task_stmt->arg_align;
5823 /* Return a pointer to the data block align for OMP_TASK GS. */
5825 static inline tree *
5826 gimple_omp_task_arg_align_ptr (gimple *gs)
5828 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5829 return &omp_task_stmt->arg_align;
5833 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5835 static inline void
5836 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5838 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5839 omp_task_stmt->arg_align = arg_align;
5843 /* Return the clauses associated with OMP_SINGLE GS. */
5845 static inline tree
5846 gimple_omp_single_clauses (const gimple *gs)
5848 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5849 return omp_single_stmt->clauses;
5853 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5855 static inline tree *
5856 gimple_omp_single_clauses_ptr (gimple *gs)
5858 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5859 return &omp_single_stmt->clauses;
5863 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5865 static inline void
5866 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5868 omp_single_stmt->clauses = clauses;
5872 /* Return the clauses associated with OMP_TARGET GS. */
5874 static inline tree
5875 gimple_omp_target_clauses (const gimple *gs)
5877 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5878 return omp_target_stmt->clauses;
5882 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5884 static inline tree *
5885 gimple_omp_target_clauses_ptr (gimple *gs)
5887 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5888 return &omp_target_stmt->clauses;
5892 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5894 static inline void
5895 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5896 tree clauses)
5898 omp_target_stmt->clauses = clauses;
5902 /* Return the kind of the OMP_TARGET G. */
5904 static inline int
5905 gimple_omp_target_kind (const gimple *g)
5907 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5908 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5912 /* Set the kind of the OMP_TARGET G. */
5914 static inline void
5915 gimple_omp_target_set_kind (gomp_target *g, int kind)
5917 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5918 | (kind & GF_OMP_TARGET_KIND_MASK);
5922 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5924 static inline tree
5925 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5927 return omp_target_stmt->child_fn;
5930 /* Return a pointer to the child function used to hold the body of
5931 OMP_TARGET_STMT. */
5933 static inline tree *
5934 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5936 return &omp_target_stmt->child_fn;
5940 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5942 static inline void
5943 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5944 tree child_fn)
5946 omp_target_stmt->child_fn = child_fn;
5950 /* Return the artificial argument used to send variables and values
5951 from the parent to the children threads in OMP_TARGET_STMT. */
5953 static inline tree
5954 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5956 return omp_target_stmt->data_arg;
5960 /* Return a pointer to the data argument for OMP_TARGET GS. */
5962 static inline tree *
5963 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5965 return &omp_target_stmt->data_arg;
5969 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5971 static inline void
5972 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5973 tree data_arg)
5975 omp_target_stmt->data_arg = data_arg;
5979 /* Return the clauses associated with OMP_TEAMS GS. */
5981 static inline tree
5982 gimple_omp_teams_clauses (const gimple *gs)
5984 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5985 return omp_teams_stmt->clauses;
5989 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5991 static inline tree *
5992 gimple_omp_teams_clauses_ptr (gimple *gs)
5994 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5995 return &omp_teams_stmt->clauses;
5999 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6001 static inline void
6002 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6004 omp_teams_stmt->clauses = clauses;
6007 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6009 static inline tree
6010 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6012 return omp_teams_stmt->child_fn;
6015 /* Return a pointer to the child function used to hold the body of
6016 OMP_TEAMS_STMT. */
6018 static inline tree *
6019 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6021 return &omp_teams_stmt->child_fn;
6025 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6027 static inline void
6028 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6030 omp_teams_stmt->child_fn = child_fn;
6034 /* Return the artificial argument used to send variables and values
6035 from the parent to the children threads in OMP_TEAMS_STMT. */
6037 static inline tree
6038 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6040 return omp_teams_stmt->data_arg;
6044 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6046 static inline tree *
6047 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6049 return &omp_teams_stmt->data_arg;
6053 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6055 static inline void
6056 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6058 omp_teams_stmt->data_arg = data_arg;
6061 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
6063 static inline bool
6064 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
6066 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
6069 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
6071 static inline void
6072 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
6074 if (value)
6075 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
6076 else
6077 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
6080 /* Return the host flag of an OMP_TEAMS_STMT. */
6082 static inline bool
6083 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6085 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6088 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6090 static inline void
6091 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6093 if (value)
6094 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6095 else
6096 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6099 /* Return the clauses associated with OMP_SECTIONS GS. */
6101 static inline tree
6102 gimple_omp_sections_clauses (const gimple *gs)
6104 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6105 return omp_sections_stmt->clauses;
6109 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6111 static inline tree *
6112 gimple_omp_sections_clauses_ptr (gimple *gs)
6114 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6115 return &omp_sections_stmt->clauses;
6119 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6120 GS. */
6122 static inline void
6123 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6125 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6126 omp_sections_stmt->clauses = clauses;
6130 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6131 in GS. */
6133 static inline tree
6134 gimple_omp_sections_control (const gimple *gs)
6136 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6137 return omp_sections_stmt->control;
6141 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6142 GS. */
6144 static inline tree *
6145 gimple_omp_sections_control_ptr (gimple *gs)
6147 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6148 return &omp_sections_stmt->control;
6152 /* Set CONTROL to be the set of clauses associated with the
6153 GIMPLE_OMP_SECTIONS in GS. */
6155 static inline void
6156 gimple_omp_sections_set_control (gimple *gs, tree control)
6158 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6159 omp_sections_stmt->control = control;
6163 /* Set the value being stored in an atomic store. */
6165 static inline void
6166 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6168 store_stmt->val = val;
6172 /* Return the value being stored in an atomic store. */
6174 static inline tree
6175 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6177 return store_stmt->val;
6181 /* Return a pointer to the value being stored in an atomic store. */
6183 static inline tree *
6184 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6186 return &store_stmt->val;
6190 /* Set the LHS of an atomic load. */
6192 static inline void
6193 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6195 load_stmt->lhs = lhs;
6199 /* Get the LHS of an atomic load. */
6201 static inline tree
6202 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6204 return load_stmt->lhs;
6208 /* Return a pointer to the LHS of an atomic load. */
6210 static inline tree *
6211 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6213 return &load_stmt->lhs;
6217 /* Set the RHS of an atomic load. */
6219 static inline void
6220 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6222 load_stmt->rhs = rhs;
6226 /* Get the RHS of an atomic load. */
6228 static inline tree
6229 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6231 return load_stmt->rhs;
6235 /* Return a pointer to the RHS of an atomic load. */
6237 static inline tree *
6238 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6240 return &load_stmt->rhs;
6244 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6246 static inline tree
6247 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6249 return cont_stmt->control_def;
6252 /* The same as above, but return the address. */
6254 static inline tree *
6255 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6257 return &cont_stmt->control_def;
6260 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6262 static inline void
6263 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6265 cont_stmt->control_def = def;
6269 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6271 static inline tree
6272 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6274 return cont_stmt->control_use;
6278 /* The same as above, but return the address. */
6280 static inline tree *
6281 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6283 return &cont_stmt->control_use;
6287 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6289 static inline void
6290 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6292 cont_stmt->control_use = use;
6295 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6296 TRANSACTION_STMT. */
6298 static inline gimple_seq *
6299 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6301 return &transaction_stmt->body;
6304 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6306 static inline gimple_seq
6307 gimple_transaction_body (gtransaction *transaction_stmt)
6309 return transaction_stmt->body;
6312 /* Return the label associated with a GIMPLE_TRANSACTION. */
6314 static inline tree
6315 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6317 return transaction_stmt->label_norm;
6320 static inline tree *
6321 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6323 return &transaction_stmt->label_norm;
6326 static inline tree
6327 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6329 return transaction_stmt->label_uninst;
6332 static inline tree *
6333 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6335 return &transaction_stmt->label_uninst;
6338 static inline tree
6339 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6341 return transaction_stmt->label_over;
6344 static inline tree *
6345 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6347 return &transaction_stmt->label_over;
6350 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6352 static inline unsigned int
6353 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6355 return transaction_stmt->subcode;
6358 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6359 TRANSACTION_STMT. */
6361 static inline void
6362 gimple_transaction_set_body (gtransaction *transaction_stmt,
6363 gimple_seq body)
6365 transaction_stmt->body = body;
6368 /* Set the label associated with a GIMPLE_TRANSACTION. */
6370 static inline void
6371 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6373 transaction_stmt->label_norm = label;
6376 static inline void
6377 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6379 transaction_stmt->label_uninst = label;
6382 static inline void
6383 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6385 transaction_stmt->label_over = label;
6388 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6390 static inline void
6391 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6392 unsigned int subcode)
6394 transaction_stmt->subcode = subcode;
6397 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6399 static inline tree *
6400 gimple_return_retval_ptr (greturn *gs)
6402 return &gs->op[0];
6405 /* Return the return value for GIMPLE_RETURN GS. */
6407 static inline tree
6408 gimple_return_retval (const greturn *gs)
6410 return gs->op[0];
6414 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6416 static inline void
6417 gimple_return_set_retval (greturn *gs, tree retval)
6419 gs->op[0] = retval;
6423 /* Returns true when the gimple statement STMT is any of the OMP types. */
6425 #define CASE_GIMPLE_OMP \
6426 case GIMPLE_OMP_PARALLEL: \
6427 case GIMPLE_OMP_TASK: \
6428 case GIMPLE_OMP_FOR: \
6429 case GIMPLE_OMP_SECTIONS: \
6430 case GIMPLE_OMP_SECTIONS_SWITCH: \
6431 case GIMPLE_OMP_SINGLE: \
6432 case GIMPLE_OMP_TARGET: \
6433 case GIMPLE_OMP_TEAMS: \
6434 case GIMPLE_OMP_SECTION: \
6435 case GIMPLE_OMP_MASTER: \
6436 case GIMPLE_OMP_TASKGROUP: \
6437 case GIMPLE_OMP_ORDERED: \
6438 case GIMPLE_OMP_CRITICAL: \
6439 case GIMPLE_OMP_SCAN: \
6440 case GIMPLE_OMP_RETURN: \
6441 case GIMPLE_OMP_ATOMIC_LOAD: \
6442 case GIMPLE_OMP_ATOMIC_STORE: \
6443 case GIMPLE_OMP_CONTINUE: \
6444 case GIMPLE_OMP_GRID_BODY
6446 static inline bool
6447 is_gimple_omp (const gimple *stmt)
6449 switch (gimple_code (stmt))
6451 CASE_GIMPLE_OMP:
6452 return true;
6453 default:
6454 return false;
6458 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6459 specifically. */
6461 static inline bool
6462 is_gimple_omp_oacc (const gimple *stmt)
6464 gcc_assert (is_gimple_omp (stmt));
6465 switch (gimple_code (stmt))
6467 case GIMPLE_OMP_FOR:
6468 switch (gimple_omp_for_kind (stmt))
6470 case GF_OMP_FOR_KIND_OACC_LOOP:
6471 return true;
6472 default:
6473 return false;
6475 case GIMPLE_OMP_TARGET:
6476 switch (gimple_omp_target_kind (stmt))
6478 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6479 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6480 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6481 case GF_OMP_TARGET_KIND_OACC_DATA:
6482 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6483 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6484 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6485 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6486 return true;
6487 default:
6488 return false;
6490 default:
6491 return false;
6496 /* Return true if the OMP gimple statement STMT is offloaded. */
6498 static inline bool
6499 is_gimple_omp_offloaded (const gimple *stmt)
6501 gcc_assert (is_gimple_omp (stmt));
6502 switch (gimple_code (stmt))
6504 case GIMPLE_OMP_TARGET:
6505 switch (gimple_omp_target_kind (stmt))
6507 case GF_OMP_TARGET_KIND_REGION:
6508 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6509 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6510 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6511 return true;
6512 default:
6513 return false;
6515 default:
6516 return false;
6521 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6523 static inline bool
6524 gimple_nop_p (const gimple *g)
6526 return gimple_code (g) == GIMPLE_NOP;
6530 /* Return true if GS is a GIMPLE_RESX. */
6532 static inline bool
6533 is_gimple_resx (const gimple *gs)
6535 return gimple_code (gs) == GIMPLE_RESX;
6538 /* Return the type of the main expression computed by STMT. Return
6539 void_type_node if the statement computes nothing. */
6541 static inline tree
6542 gimple_expr_type (const gimple *stmt)
6544 enum gimple_code code = gimple_code (stmt);
6545 /* In general we want to pass out a type that can be substituted
6546 for both the RHS and the LHS types if there is a possibly
6547 useless conversion involved. That means returning the
6548 original RHS type as far as we can reconstruct it. */
6549 if (code == GIMPLE_CALL)
6551 const gcall *call_stmt = as_a <const gcall *> (stmt);
6552 if (gimple_call_internal_p (call_stmt))
6553 switch (gimple_call_internal_fn (call_stmt))
6555 case IFN_MASK_STORE:
6556 case IFN_SCATTER_STORE:
6557 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6558 case IFN_MASK_SCATTER_STORE:
6559 return TREE_TYPE (gimple_call_arg (call_stmt, 4));
6560 default:
6561 break;
6563 return gimple_call_return_type (call_stmt);
6565 else if (code == GIMPLE_ASSIGN)
6567 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6568 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6569 else
6570 /* As fallback use the type of the LHS. */
6571 return TREE_TYPE (gimple_get_lhs (stmt));
6573 else if (code == GIMPLE_COND)
6574 return boolean_type_node;
6575 else
6576 return void_type_node;
6579 /* Enum and arrays used for allocation stats. Keep in sync with
6580 gimple.c:gimple_alloc_kind_names. */
6581 enum gimple_alloc_kind
6583 gimple_alloc_kind_assign, /* Assignments. */
6584 gimple_alloc_kind_phi, /* PHI nodes. */
6585 gimple_alloc_kind_cond, /* Conditionals. */
6586 gimple_alloc_kind_rest, /* Everything else. */
6587 gimple_alloc_kind_all
6590 extern uint64_t gimple_alloc_counts[];
6591 extern uint64_t gimple_alloc_sizes[];
6593 /* Return the allocation kind for a given stmt CODE. */
6594 static inline enum gimple_alloc_kind
6595 gimple_alloc_kind (enum gimple_code code)
6597 switch (code)
6599 case GIMPLE_ASSIGN:
6600 return gimple_alloc_kind_assign;
6601 case GIMPLE_PHI:
6602 return gimple_alloc_kind_phi;
6603 case GIMPLE_COND:
6604 return gimple_alloc_kind_cond;
6605 default:
6606 return gimple_alloc_kind_rest;
6610 /* Return true if a location should not be emitted for this statement
6611 by annotate_all_with_location. */
6613 static inline bool
6614 gimple_do_not_emit_location_p (gimple *g)
6616 return gimple_plf (g, GF_PLF_1);
6619 /* Mark statement G so a location will not be emitted by
6620 annotate_one_with_location. */
6622 static inline void
6623 gimple_set_do_not_emit_location (gimple *g)
6625 /* The PLF flags are initialized to 0 when a new tuple is created,
6626 so no need to initialize it anywhere. */
6627 gimple_set_plf (g, GF_PLF_1, true);
6630 #endif /* GCC_GIMPLE_H */