Default to dwarf version 4 on hppa64-hpux
[official-gcc.git] / gcc / gimple.h
blob303623b3cedb2273458f42119cf6303bef2d4f43
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2021 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN \
50 ATTRIBUTE_COLD;
52 #define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59 template <typename T>
60 static inline T
61 GIMPLE_CHECK2(const gimple *gs,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66 #else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70 #endif
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
75 remove_pointer<T>::type::code_, ERROR_MARK);
76 return ret;
78 template <typename T>
79 static inline T
80 GIMPLE_CHECK2(gimple *gs,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85 #else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89 #endif
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
94 remove_pointer<T>::type::code_, ERROR_MARK);
95 return ret;
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T>
101 static inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 static inline T
108 GIMPLE_CHECK2(const gimple *gs)
110 return as_a <T> (gs);
112 #endif
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1,
140 GF_ASM_INLINE = 1 << 2,
141 GF_CALL_FROM_THUNK = 1 << 0,
142 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
143 GF_CALL_TAILCALL = 1 << 2,
144 GF_CALL_VA_ARG_PACK = 1 << 3,
145 GF_CALL_NOTHROW = 1 << 4,
146 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
147 GF_CALL_INTERNAL = 1 << 6,
148 GF_CALL_CTRL_ALTERING = 1 << 7,
149 GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 GF_CALL_NOCF_CHECK = 1 << 11,
152 GF_CALL_FROM_NEW_OR_DELETE = 1 << 12,
153 GF_OMP_PARALLEL_COMBINED = 1 << 0,
154 GF_OMP_TASK_TASKLOOP = 1 << 0,
155 GF_OMP_TASK_TASKWAIT = 1 << 1,
156 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
157 GF_OMP_FOR_KIND_FOR = 0,
158 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
159 GF_OMP_FOR_KIND_TASKLOOP = 2,
160 GF_OMP_FOR_KIND_OACC_LOOP = 4,
161 GF_OMP_FOR_KIND_SIMD = 5,
162 GF_OMP_FOR_COMBINED = 1 << 3,
163 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
164 GF_OMP_TARGET_KIND_MASK = (1 << 5) - 1,
165 GF_OMP_TARGET_KIND_REGION = 0,
166 GF_OMP_TARGET_KIND_DATA = 1,
167 GF_OMP_TARGET_KIND_UPDATE = 2,
168 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
169 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
170 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
171 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
172 GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
173 GF_OMP_TARGET_KIND_OACC_DATA = 8,
174 GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
175 GF_OMP_TARGET_KIND_OACC_ENTER_DATA = 10,
176 GF_OMP_TARGET_KIND_OACC_EXIT_DATA = 11,
177 GF_OMP_TARGET_KIND_OACC_DECLARE = 12,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 13,
179 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
180 decomposed part, parallelized. */
181 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED = 14,
182 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
183 decomposed part, "gang-single". */
184 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE = 15,
185 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
186 decomposed parts' 'data' construct. */
187 GF_OMP_TARGET_KIND_OACC_DATA_KERNELS = 16,
188 GF_OMP_TEAMS_HOST = 1 << 0,
190 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
191 a thread synchronization via some sort of barrier. The exact barrier
192 that would otherwise be emitted is dependent on the OMP statement with
193 which this return is associated. */
194 GF_OMP_RETURN_NOWAIT = 1 << 0,
196 GF_OMP_SECTION_LAST = 1 << 0,
197 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 6) - 1,
198 GF_OMP_ATOMIC_NEED_VALUE = 1 << 6,
199 GF_OMP_ATOMIC_WEAK = 1 << 7,
200 GF_PREDICT_TAKEN = 1 << 15
203 /* This subcode tells apart different kinds of stmts that are not used
204 for codegen, but rather to retain debug information. */
205 enum gimple_debug_subcode {
206 GIMPLE_DEBUG_BIND = 0,
207 GIMPLE_DEBUG_SOURCE_BIND = 1,
208 GIMPLE_DEBUG_BEGIN_STMT = 2,
209 GIMPLE_DEBUG_INLINE_ENTRY = 3
212 /* Masks for selecting a pass local flag (PLF) to work on. These
213 masks are used by gimple_set_plf and gimple_plf. */
214 enum plf_mask {
215 GF_PLF_1 = 1 << 0,
216 GF_PLF_2 = 1 << 1
219 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
220 are for 64 bit hosts. */
222 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
223 chain_next ("%h.next"), variable_size))
224 gimple
226 /* [ WORD 1 ]
227 Main identifying code for a tuple. */
228 ENUM_BITFIELD(gimple_code) code : 8;
230 /* Nonzero if a warning should not be emitted on this tuple. */
231 unsigned int no_warning : 1;
233 /* Nonzero if this tuple has been visited. Passes are responsible
234 for clearing this bit before using it. */
235 unsigned int visited : 1;
237 /* Nonzero if this tuple represents a non-temporal move. */
238 unsigned int nontemporal_move : 1;
240 /* Pass local flags. These flags are free for any pass to use as
241 they see fit. Passes should not assume that these flags contain
242 any useful value when the pass starts. Any initial state that
243 the pass requires should be set on entry to the pass. See
244 gimple_set_plf and gimple_plf for usage. */
245 unsigned int plf : 2;
247 /* Nonzero if this statement has been modified and needs to have its
248 operands rescanned. */
249 unsigned modified : 1;
251 /* Nonzero if this statement contains volatile operands. */
252 unsigned has_volatile_ops : 1;
254 /* Padding to get subcode to 16 bit alignment. */
255 unsigned pad : 1;
257 /* The SUBCODE field can be used for tuple-specific flags for tuples
258 that do not require subcodes. Note that SUBCODE should be at
259 least as wide as tree codes, as several tuples store tree codes
260 in there. */
261 unsigned int subcode : 16;
263 /* UID of this statement. This is used by passes that want to
264 assign IDs to statements. It must be assigned and used by each
265 pass. By default it should be assumed to contain garbage. */
266 unsigned uid;
268 /* [ WORD 2 ]
269 Locus information for debug info. */
270 location_t location;
272 /* Number of operands in this tuple. */
273 unsigned num_ops;
275 /* [ WORD 3 ]
276 Basic block holding this statement. */
277 basic_block bb;
279 /* [ WORD 4-5 ]
280 Linked lists of gimple statements. The next pointers form
281 a NULL terminated list, the prev pointers are a cyclic list.
282 A gimple statement is hence also a double-ended list of
283 statements, with the pointer itself being the first element,
284 and the prev pointer being the last. */
285 gimple *next;
286 gimple *GTY((skip)) prev;
290 /* Base structure for tuples with operands. */
292 /* This gimple subclass has no tag value. */
293 struct GTY(())
294 gimple_statement_with_ops_base : public gimple
296 /* [ WORD 1-6 ] : base class */
298 /* [ WORD 7 ]
299 SSA operand vectors. NOTE: It should be possible to
300 amalgamate these vectors with the operand vector OP. However,
301 the SSA operand vectors are organized differently and contain
302 more information (like immediate use chaining). */
303 struct use_optype_d GTY((skip (""))) *use_ops;
307 /* Statements that take register operands. */
309 struct GTY((tag("GSS_WITH_OPS")))
310 gimple_statement_with_ops : public gimple_statement_with_ops_base
312 /* [ WORD 1-7 ] : base class */
314 /* [ WORD 8 ]
315 Operand vector. NOTE! This must always be the last field
316 of this structure. In particular, this means that this
317 structure cannot be embedded inside another one. */
318 tree GTY((length ("%h.num_ops"))) op[1];
322 /* Base for statements that take both memory and register operands. */
324 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
325 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
327 /* [ WORD 1-7 ] : base class */
329 /* [ WORD 8-9 ]
330 Virtual operands for this statement. The GC will pick them
331 up via the ssa_names array. */
332 tree GTY((skip (""))) vdef;
333 tree GTY((skip (""))) vuse;
337 /* Statements that take both memory and register operands. */
339 struct GTY((tag("GSS_WITH_MEM_OPS")))
340 gimple_statement_with_memory_ops :
341 public gimple_statement_with_memory_ops_base
343 /* [ WORD 1-9 ] : base class */
345 /* [ WORD 10 ]
346 Operand vector. NOTE! This must always be the last field
347 of this structure. In particular, this means that this
348 structure cannot be embedded inside another one. */
349 tree GTY((length ("%h.num_ops"))) op[1];
353 /* Call statements that take both memory and register operands. */
355 struct GTY((tag("GSS_CALL")))
356 gcall : public gimple_statement_with_memory_ops_base
358 /* [ WORD 1-9 ] : base class */
360 /* [ WORD 10-13 ] */
361 struct pt_solution call_used;
362 struct pt_solution call_clobbered;
364 /* [ WORD 14 ] */
365 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
366 tree GTY ((tag ("0"))) fntype;
367 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
368 } u;
370 /* [ WORD 15 ]
371 Operand vector. NOTE! This must always be the last field
372 of this structure. In particular, this means that this
373 structure cannot be embedded inside another one. */
374 tree GTY((length ("%h.num_ops"))) op[1];
376 static const enum gimple_code code_ = GIMPLE_CALL;
380 /* OMP statements. */
382 struct GTY((tag("GSS_OMP")))
383 gimple_statement_omp : public gimple
385 /* [ WORD 1-6 ] : base class */
387 /* [ WORD 7 ] */
388 gimple_seq body;
392 /* GIMPLE_BIND */
394 struct GTY((tag("GSS_BIND")))
395 gbind : public gimple
397 /* [ WORD 1-6 ] : base class */
399 /* [ WORD 7 ]
400 Variables declared in this scope. */
401 tree vars;
403 /* [ WORD 8 ]
404 This is different than the BLOCK field in gimple,
405 which is analogous to TREE_BLOCK (i.e., the lexical block holding
406 this statement). This field is the equivalent of BIND_EXPR_BLOCK
407 in tree land (i.e., the lexical scope defined by this bind). See
408 gimple-low.c. */
409 tree block;
411 /* [ WORD 9 ] */
412 gimple_seq body;
416 /* GIMPLE_CATCH */
418 struct GTY((tag("GSS_CATCH")))
419 gcatch : public gimple
421 /* [ WORD 1-6 ] : base class */
423 /* [ WORD 7 ] */
424 tree types;
426 /* [ WORD 8 ] */
427 gimple_seq handler;
431 /* GIMPLE_EH_FILTER */
433 struct GTY((tag("GSS_EH_FILTER")))
434 geh_filter : public gimple
436 /* [ WORD 1-6 ] : base class */
438 /* [ WORD 7 ]
439 Filter types. */
440 tree types;
442 /* [ WORD 8 ]
443 Failure actions. */
444 gimple_seq failure;
447 /* GIMPLE_EH_ELSE */
449 struct GTY((tag("GSS_EH_ELSE")))
450 geh_else : public gimple
452 /* [ WORD 1-6 ] : base class */
454 /* [ WORD 7,8 ] */
455 gimple_seq n_body, e_body;
458 /* GIMPLE_EH_MUST_NOT_THROW */
460 struct GTY((tag("GSS_EH_MNT")))
461 geh_mnt : public gimple
463 /* [ WORD 1-6 ] : base class */
465 /* [ WORD 7 ] Abort function decl. */
466 tree fndecl;
469 /* GIMPLE_PHI */
471 struct GTY((tag("GSS_PHI")))
472 gphi : public gimple
474 /* [ WORD 1-6 ] : base class */
476 /* [ WORD 7 ] */
477 unsigned capacity;
478 unsigned nargs;
480 /* [ WORD 8 ] */
481 tree result;
483 /* [ WORD 9 ] */
484 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
488 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
490 struct GTY((tag("GSS_EH_CTRL")))
491 gimple_statement_eh_ctrl : public gimple
493 /* [ WORD 1-6 ] : base class */
495 /* [ WORD 7 ]
496 Exception region number. */
497 int region;
500 struct GTY((tag("GSS_EH_CTRL")))
501 gresx : public gimple_statement_eh_ctrl
503 /* No extra fields; adds invariant:
504 stmt->code == GIMPLE_RESX. */
507 struct GTY((tag("GSS_EH_CTRL")))
508 geh_dispatch : public gimple_statement_eh_ctrl
510 /* No extra fields; adds invariant:
511 stmt->code == GIMPLE_EH_DISPATH. */
515 /* GIMPLE_TRY */
517 struct GTY((tag("GSS_TRY")))
518 gtry : public gimple
520 /* [ WORD 1-6 ] : base class */
522 /* [ WORD 7 ]
523 Expression to evaluate. */
524 gimple_seq eval;
526 /* [ WORD 8 ]
527 Cleanup expression. */
528 gimple_seq cleanup;
531 /* Kind of GIMPLE_TRY statements. */
532 enum gimple_try_flags
534 /* A try/catch. */
535 GIMPLE_TRY_CATCH = 1 << 0,
537 /* A try/finally. */
538 GIMPLE_TRY_FINALLY = 1 << 1,
539 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
541 /* Analogous to TRY_CATCH_IS_CLEANUP. */
542 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
545 /* GIMPLE_WITH_CLEANUP_EXPR */
547 struct GTY((tag("GSS_WCE")))
548 gimple_statement_wce : public gimple
550 /* [ WORD 1-6 ] : base class */
552 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
553 executed if an exception is thrown, not on normal exit of its
554 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
555 in TARGET_EXPRs. */
557 /* [ WORD 7 ]
558 Cleanup expression. */
559 gimple_seq cleanup;
563 /* GIMPLE_ASM */
565 struct GTY((tag("GSS_ASM")))
566 gasm : public gimple_statement_with_memory_ops_base
568 /* [ WORD 1-9 ] : base class */
570 /* [ WORD 10 ]
571 __asm__ statement. */
572 const char *string;
574 /* [ WORD 11 ]
575 Number of inputs, outputs, clobbers, labels. */
576 unsigned char ni;
577 unsigned char no;
578 unsigned char nc;
579 unsigned char nl;
581 /* [ WORD 12 ]
582 Operand vector. NOTE! This must always be the last field
583 of this structure. In particular, this means that this
584 structure cannot be embedded inside another one. */
585 tree GTY((length ("%h.num_ops"))) op[1];
588 /* GIMPLE_OMP_CRITICAL */
590 struct GTY((tag("GSS_OMP_CRITICAL")))
591 gomp_critical : public gimple_statement_omp
593 /* [ WORD 1-7 ] : base class */
595 /* [ WORD 8 ] */
596 tree clauses;
598 /* [ WORD 9 ]
599 Critical section name. */
600 tree name;
604 struct GTY(()) gimple_omp_for_iter {
605 /* Condition code. */
606 enum tree_code cond;
608 /* Index variable. */
609 tree index;
611 /* Initial value. */
612 tree initial;
614 /* Final value. */
615 tree final;
617 /* Increment. */
618 tree incr;
621 /* GIMPLE_OMP_FOR */
623 struct GTY((tag("GSS_OMP_FOR")))
624 gomp_for : public gimple_statement_omp
626 /* [ WORD 1-7 ] : base class */
628 /* [ WORD 8 ] */
629 tree clauses;
631 /* [ WORD 9 ]
632 Number of elements in iter array. */
633 size_t collapse;
635 /* [ WORD 10 ] */
636 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
638 /* [ WORD 11 ]
639 Pre-body evaluated before the loop body begins. */
640 gimple_seq pre_body;
644 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
646 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
647 gimple_statement_omp_parallel_layout : public gimple_statement_omp
649 /* [ WORD 1-7 ] : base class */
651 /* [ WORD 8 ]
652 Clauses. */
653 tree clauses;
655 /* [ WORD 9 ]
656 Child function holding the body of the parallel region. */
657 tree child_fn;
659 /* [ WORD 10 ]
660 Shared data argument. */
661 tree data_arg;
664 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
665 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
666 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
668 /* No extra fields; adds invariant:
669 stmt->code == GIMPLE_OMP_PARALLEL
670 || stmt->code == GIMPLE_OMP_TASK
671 || stmt->code == GIMPLE_OMP_TEAMS. */
674 /* GIMPLE_OMP_PARALLEL */
675 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
676 gomp_parallel : public gimple_statement_omp_taskreg
678 /* No extra fields; adds invariant:
679 stmt->code == GIMPLE_OMP_PARALLEL. */
682 /* GIMPLE_OMP_TARGET */
683 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
684 gomp_target : public gimple_statement_omp_parallel_layout
686 /* No extra fields; adds invariant:
687 stmt->code == GIMPLE_OMP_TARGET. */
690 /* GIMPLE_OMP_TASK */
692 struct GTY((tag("GSS_OMP_TASK")))
693 gomp_task : public gimple_statement_omp_taskreg
695 /* [ WORD 1-10 ] : base class */
697 /* [ WORD 11 ]
698 Child function holding firstprivate initialization if needed. */
699 tree copy_fn;
701 /* [ WORD 12-13 ]
702 Size and alignment in bytes of the argument data block. */
703 tree arg_size;
704 tree arg_align;
708 /* GIMPLE_OMP_SECTION */
709 /* Uses struct gimple_statement_omp. */
712 /* GIMPLE_OMP_SECTIONS */
714 struct GTY((tag("GSS_OMP_SECTIONS")))
715 gomp_sections : public gimple_statement_omp
717 /* [ WORD 1-7 ] : base class */
719 /* [ WORD 8 ] */
720 tree clauses;
722 /* [ WORD 9 ]
723 The control variable used for deciding which of the sections to
724 execute. */
725 tree control;
728 /* GIMPLE_OMP_CONTINUE.
730 Note: This does not inherit from gimple_statement_omp, because we
731 do not need the body field. */
733 struct GTY((tag("GSS_OMP_CONTINUE")))
734 gomp_continue : public gimple
736 /* [ WORD 1-6 ] : base class */
738 /* [ WORD 7 ] */
739 tree control_def;
741 /* [ WORD 8 ] */
742 tree control_use;
745 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
746 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
748 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
749 gimple_statement_omp_single_layout : public gimple_statement_omp
751 /* [ WORD 1-7 ] : base class */
753 /* [ WORD 8 ] */
754 tree clauses;
757 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
758 gomp_single : public gimple_statement_omp_single_layout
760 /* No extra fields; adds invariant:
761 stmt->code == GIMPLE_OMP_SINGLE. */
764 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
765 gomp_teams : public gimple_statement_omp_taskreg
767 /* No extra fields; adds invariant:
768 stmt->code == GIMPLE_OMP_TEAMS. */
771 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
772 gomp_ordered : public gimple_statement_omp_single_layout
774 /* No extra fields; adds invariant:
775 stmt->code == GIMPLE_OMP_ORDERED. */
778 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
779 gomp_scan : public gimple_statement_omp_single_layout
781 /* No extra fields; adds invariant:
782 stmt->code == GIMPLE_OMP_SCAN. */
786 /* GIMPLE_OMP_ATOMIC_LOAD.
787 Note: This is based on gimple, not g_s_omp, because g_s_omp
788 contains a sequence, which we don't need here. */
790 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
791 gomp_atomic_load : public gimple
793 /* [ WORD 1-6 ] : base class */
795 /* [ WORD 7-8 ] */
796 tree rhs, lhs;
799 /* GIMPLE_OMP_ATOMIC_STORE.
800 See note on GIMPLE_OMP_ATOMIC_LOAD. */
802 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
803 gimple_statement_omp_atomic_store_layout : public gimple
805 /* [ WORD 1-6 ] : base class */
807 /* [ WORD 7 ] */
808 tree val;
811 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
812 gomp_atomic_store :
813 public gimple_statement_omp_atomic_store_layout
815 /* No extra fields; adds invariant:
816 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
819 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
820 gimple_statement_omp_return :
821 public gimple_statement_omp_atomic_store_layout
823 /* No extra fields; adds invariant:
824 stmt->code == GIMPLE_OMP_RETURN. */
827 /* GIMPLE_TRANSACTION. */
829 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
831 /* The __transaction_atomic was declared [[outer]] or it is
832 __transaction_relaxed. */
833 #define GTMA_IS_OUTER (1u << 0)
834 #define GTMA_IS_RELAXED (1u << 1)
835 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
837 /* The transaction is seen to not have an abort. */
838 #define GTMA_HAVE_ABORT (1u << 2)
839 /* The transaction is seen to have loads or stores. */
840 #define GTMA_HAVE_LOAD (1u << 3)
841 #define GTMA_HAVE_STORE (1u << 4)
842 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
843 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
844 /* The transaction WILL enter serial irrevocable mode.
845 An irrevocable block post-dominates the entire transaction, such
846 that all invocations of the transaction will go serial-irrevocable.
847 In such case, we don't bother instrumenting the transaction, and
848 tell the runtime that it should begin the transaction in
849 serial-irrevocable mode. */
850 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
851 /* The transaction contains no instrumentation code whatsover, most
852 likely because it is guaranteed to go irrevocable upon entry. */
853 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
855 struct GTY((tag("GSS_TRANSACTION")))
856 gtransaction : public gimple_statement_with_memory_ops_base
858 /* [ WORD 1-9 ] : base class */
860 /* [ WORD 10 ] */
861 gimple_seq body;
863 /* [ WORD 11-13 ] */
864 tree label_norm;
865 tree label_uninst;
866 tree label_over;
869 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
870 enum gimple_statement_structure_enum {
871 #include "gsstruct.def"
872 LAST_GSS_ENUM
874 #undef DEFGSSTRUCT
876 /* A statement with the invariant that
877 stmt->code == GIMPLE_COND
878 i.e. a conditional jump statement. */
880 struct GTY((tag("GSS_WITH_OPS")))
881 gcond : public gimple_statement_with_ops
883 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
884 static const enum gimple_code code_ = GIMPLE_COND;
887 /* A statement with the invariant that
888 stmt->code == GIMPLE_DEBUG
889 i.e. a debug statement. */
891 struct GTY((tag("GSS_WITH_OPS")))
892 gdebug : public gimple_statement_with_ops
894 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
897 /* A statement with the invariant that
898 stmt->code == GIMPLE_GOTO
899 i.e. a goto statement. */
901 struct GTY((tag("GSS_WITH_OPS")))
902 ggoto : public gimple_statement_with_ops
904 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
907 /* A statement with the invariant that
908 stmt->code == GIMPLE_LABEL
909 i.e. a label statement. */
911 struct GTY((tag("GSS_WITH_OPS")))
912 glabel : public gimple_statement_with_ops
914 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
917 /* A statement with the invariant that
918 stmt->code == GIMPLE_SWITCH
919 i.e. a switch statement. */
921 struct GTY((tag("GSS_WITH_OPS")))
922 gswitch : public gimple_statement_with_ops
924 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
927 /* A statement with the invariant that
928 stmt->code == GIMPLE_ASSIGN
929 i.e. an assignment statement. */
931 struct GTY((tag("GSS_WITH_MEM_OPS")))
932 gassign : public gimple_statement_with_memory_ops
934 static const enum gimple_code code_ = GIMPLE_ASSIGN;
935 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
938 /* A statement with the invariant that
939 stmt->code == GIMPLE_RETURN
940 i.e. a return statement. */
942 struct GTY((tag("GSS_WITH_MEM_OPS")))
943 greturn : public gimple_statement_with_memory_ops
945 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
948 template <>
949 template <>
950 inline bool
951 is_a_helper <gasm *>::test (gimple *gs)
953 return gs->code == GIMPLE_ASM;
956 template <>
957 template <>
958 inline bool
959 is_a_helper <gassign *>::test (gimple *gs)
961 return gs->code == GIMPLE_ASSIGN;
964 template <>
965 template <>
966 inline bool
967 is_a_helper <const gassign *>::test (const gimple *gs)
969 return gs->code == GIMPLE_ASSIGN;
972 template <>
973 template <>
974 inline bool
975 is_a_helper <gbind *>::test (gimple *gs)
977 return gs->code == GIMPLE_BIND;
980 template <>
981 template <>
982 inline bool
983 is_a_helper <gcall *>::test (gimple *gs)
985 return gs->code == GIMPLE_CALL;
988 template <>
989 template <>
990 inline bool
991 is_a_helper <gcatch *>::test (gimple *gs)
993 return gs->code == GIMPLE_CATCH;
996 template <>
997 template <>
998 inline bool
999 is_a_helper <gcond *>::test (gimple *gs)
1001 return gs->code == GIMPLE_COND;
1004 template <>
1005 template <>
1006 inline bool
1007 is_a_helper <const gcond *>::test (const gimple *gs)
1009 return gs->code == GIMPLE_COND;
1012 template <>
1013 template <>
1014 inline bool
1015 is_a_helper <gdebug *>::test (gimple *gs)
1017 return gs->code == GIMPLE_DEBUG;
1020 template <>
1021 template <>
1022 inline bool
1023 is_a_helper <const gdebug *>::test (const gimple *gs)
1025 return gs->code == GIMPLE_DEBUG;
1028 template <>
1029 template <>
1030 inline bool
1031 is_a_helper <ggoto *>::test (gimple *gs)
1033 return gs->code == GIMPLE_GOTO;
1036 template <>
1037 template <>
1038 inline bool
1039 is_a_helper <const ggoto *>::test (const gimple *gs)
1041 return gs->code == GIMPLE_GOTO;
1044 template <>
1045 template <>
1046 inline bool
1047 is_a_helper <glabel *>::test (gimple *gs)
1049 return gs->code == GIMPLE_LABEL;
1052 template <>
1053 template <>
1054 inline bool
1055 is_a_helper <const glabel *>::test (const gimple *gs)
1057 return gs->code == GIMPLE_LABEL;
1060 template <>
1061 template <>
1062 inline bool
1063 is_a_helper <gresx *>::test (gimple *gs)
1065 return gs->code == GIMPLE_RESX;
1068 template <>
1069 template <>
1070 inline bool
1071 is_a_helper <geh_dispatch *>::test (gimple *gs)
1073 return gs->code == GIMPLE_EH_DISPATCH;
1076 template <>
1077 template <>
1078 inline bool
1079 is_a_helper <geh_else *>::test (gimple *gs)
1081 return gs->code == GIMPLE_EH_ELSE;
1084 template <>
1085 template <>
1086 inline bool
1087 is_a_helper <const geh_else *>::test (const gimple *gs)
1089 return gs->code == GIMPLE_EH_ELSE;
1092 template <>
1093 template <>
1094 inline bool
1095 is_a_helper <geh_filter *>::test (gimple *gs)
1097 return gs->code == GIMPLE_EH_FILTER;
1100 template <>
1101 template <>
1102 inline bool
1103 is_a_helper <geh_mnt *>::test (gimple *gs)
1105 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1108 template <>
1109 template <>
1110 inline bool
1111 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1113 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1116 template <>
1117 template <>
1118 inline bool
1119 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1121 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1124 template <>
1125 template <>
1126 inline bool
1127 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1129 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1132 template <>
1133 template <>
1134 inline bool
1135 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1137 return gs->code == GIMPLE_OMP_RETURN;
1140 template <>
1141 template <>
1142 inline bool
1143 is_a_helper <gomp_continue *>::test (gimple *gs)
1145 return gs->code == GIMPLE_OMP_CONTINUE;
1148 template <>
1149 template <>
1150 inline bool
1151 is_a_helper <gomp_critical *>::test (gimple *gs)
1153 return gs->code == GIMPLE_OMP_CRITICAL;
1156 template <>
1157 template <>
1158 inline bool
1159 is_a_helper <gomp_ordered *>::test (gimple *gs)
1161 return gs->code == GIMPLE_OMP_ORDERED;
1164 template <>
1165 template <>
1166 inline bool
1167 is_a_helper <gomp_scan *>::test (gimple *gs)
1169 return gs->code == GIMPLE_OMP_SCAN;
1172 template <>
1173 template <>
1174 inline bool
1175 is_a_helper <gomp_for *>::test (gimple *gs)
1177 return gs->code == GIMPLE_OMP_FOR;
1180 template <>
1181 template <>
1182 inline bool
1183 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1185 return (gs->code == GIMPLE_OMP_PARALLEL
1186 || gs->code == GIMPLE_OMP_TASK
1187 || gs->code == GIMPLE_OMP_TEAMS);
1190 template <>
1191 template <>
1192 inline bool
1193 is_a_helper <gomp_parallel *>::test (gimple *gs)
1195 return gs->code == GIMPLE_OMP_PARALLEL;
1198 template <>
1199 template <>
1200 inline bool
1201 is_a_helper <gomp_target *>::test (gimple *gs)
1203 return gs->code == GIMPLE_OMP_TARGET;
1206 template <>
1207 template <>
1208 inline bool
1209 is_a_helper <gomp_sections *>::test (gimple *gs)
1211 return gs->code == GIMPLE_OMP_SECTIONS;
1214 template <>
1215 template <>
1216 inline bool
1217 is_a_helper <gomp_single *>::test (gimple *gs)
1219 return gs->code == GIMPLE_OMP_SINGLE;
1222 template <>
1223 template <>
1224 inline bool
1225 is_a_helper <gomp_teams *>::test (gimple *gs)
1227 return gs->code == GIMPLE_OMP_TEAMS;
1230 template <>
1231 template <>
1232 inline bool
1233 is_a_helper <gomp_task *>::test (gimple *gs)
1235 return gs->code == GIMPLE_OMP_TASK;
1238 template <>
1239 template <>
1240 inline bool
1241 is_a_helper <gphi *>::test (gimple *gs)
1243 return gs->code == GIMPLE_PHI;
1246 template <>
1247 template <>
1248 inline bool
1249 is_a_helper <greturn *>::test (gimple *gs)
1251 return gs->code == GIMPLE_RETURN;
1254 template <>
1255 template <>
1256 inline bool
1257 is_a_helper <gswitch *>::test (gimple *gs)
1259 return gs->code == GIMPLE_SWITCH;
1262 template <>
1263 template <>
1264 inline bool
1265 is_a_helper <const gswitch *>::test (const gimple *gs)
1267 return gs->code == GIMPLE_SWITCH;
1270 template <>
1271 template <>
1272 inline bool
1273 is_a_helper <gtransaction *>::test (gimple *gs)
1275 return gs->code == GIMPLE_TRANSACTION;
1278 template <>
1279 template <>
1280 inline bool
1281 is_a_helper <gtry *>::test (gimple *gs)
1283 return gs->code == GIMPLE_TRY;
1286 template <>
1287 template <>
1288 inline bool
1289 is_a_helper <const gtry *>::test (const gimple *gs)
1291 return gs->code == GIMPLE_TRY;
1294 template <>
1295 template <>
1296 inline bool
1297 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1299 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1302 template <>
1303 template <>
1304 inline bool
1305 is_a_helper <const gasm *>::test (const gimple *gs)
1307 return gs->code == GIMPLE_ASM;
1310 template <>
1311 template <>
1312 inline bool
1313 is_a_helper <const gbind *>::test (const gimple *gs)
1315 return gs->code == GIMPLE_BIND;
1318 template <>
1319 template <>
1320 inline bool
1321 is_a_helper <const gcall *>::test (const gimple *gs)
1323 return gs->code == GIMPLE_CALL;
1326 template <>
1327 template <>
1328 inline bool
1329 is_a_helper <const gcatch *>::test (const gimple *gs)
1331 return gs->code == GIMPLE_CATCH;
1334 template <>
1335 template <>
1336 inline bool
1337 is_a_helper <const gresx *>::test (const gimple *gs)
1339 return gs->code == GIMPLE_RESX;
1342 template <>
1343 template <>
1344 inline bool
1345 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1347 return gs->code == GIMPLE_EH_DISPATCH;
1350 template <>
1351 template <>
1352 inline bool
1353 is_a_helper <const geh_filter *>::test (const gimple *gs)
1355 return gs->code == GIMPLE_EH_FILTER;
1358 template <>
1359 template <>
1360 inline bool
1361 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1363 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1366 template <>
1367 template <>
1368 inline bool
1369 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1371 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1374 template <>
1375 template <>
1376 inline bool
1377 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1379 return gs->code == GIMPLE_OMP_RETURN;
1382 template <>
1383 template <>
1384 inline bool
1385 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1387 return gs->code == GIMPLE_OMP_CONTINUE;
1390 template <>
1391 template <>
1392 inline bool
1393 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1395 return gs->code == GIMPLE_OMP_CRITICAL;
1398 template <>
1399 template <>
1400 inline bool
1401 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1403 return gs->code == GIMPLE_OMP_ORDERED;
1406 template <>
1407 template <>
1408 inline bool
1409 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1411 return gs->code == GIMPLE_OMP_SCAN;
1414 template <>
1415 template <>
1416 inline bool
1417 is_a_helper <const gomp_for *>::test (const gimple *gs)
1419 return gs->code == GIMPLE_OMP_FOR;
1422 template <>
1423 template <>
1424 inline bool
1425 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1427 return (gs->code == GIMPLE_OMP_PARALLEL
1428 || gs->code == GIMPLE_OMP_TASK
1429 || gs->code == GIMPLE_OMP_TEAMS);
1432 template <>
1433 template <>
1434 inline bool
1435 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1437 return gs->code == GIMPLE_OMP_PARALLEL;
1440 template <>
1441 template <>
1442 inline bool
1443 is_a_helper <const gomp_target *>::test (const gimple *gs)
1445 return gs->code == GIMPLE_OMP_TARGET;
1448 template <>
1449 template <>
1450 inline bool
1451 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1453 return gs->code == GIMPLE_OMP_SECTIONS;
1456 template <>
1457 template <>
1458 inline bool
1459 is_a_helper <const gomp_single *>::test (const gimple *gs)
1461 return gs->code == GIMPLE_OMP_SINGLE;
1464 template <>
1465 template <>
1466 inline bool
1467 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1469 return gs->code == GIMPLE_OMP_TEAMS;
1472 template <>
1473 template <>
1474 inline bool
1475 is_a_helper <const gomp_task *>::test (const gimple *gs)
1477 return gs->code == GIMPLE_OMP_TASK;
1480 template <>
1481 template <>
1482 inline bool
1483 is_a_helper <const gphi *>::test (const gimple *gs)
1485 return gs->code == GIMPLE_PHI;
1488 template <>
1489 template <>
1490 inline bool
1491 is_a_helper <const greturn *>::test (const gimple *gs)
1493 return gs->code == GIMPLE_RETURN;
1496 template <>
1497 template <>
1498 inline bool
1499 is_a_helper <const gtransaction *>::test (const gimple *gs)
1501 return gs->code == GIMPLE_TRANSACTION;
1504 /* Offset in bytes to the location of the operand vector.
1505 Zero if there is no operand vector for this tuple structure. */
1506 extern size_t const gimple_ops_offset_[];
1508 /* Map GIMPLE codes to GSS codes. */
1509 extern enum gimple_statement_structure_enum const gss_for_code_[];
1511 /* This variable holds the currently expanded gimple statement for purposes
1512 of comminucating the profile info to the builtin expanders. */
1513 extern gimple *currently_expanding_gimple_stmt;
1515 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1516 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1517 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1518 greturn *gimple_build_return (tree);
1519 void gimple_call_reset_alias_info (gcall *);
1520 gcall *gimple_build_call_vec (tree, const vec<tree> &);
1521 gcall *gimple_build_call (tree, unsigned, ...);
1522 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1523 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1524 gcall *gimple_build_call_internal_vec (enum internal_fn, const vec<tree> &);
1525 gcall *gimple_build_call_from_tree (tree, tree);
1526 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1527 gassign *gimple_build_assign (tree, enum tree_code,
1528 tree, tree, tree CXX_MEM_STAT_INFO);
1529 gassign *gimple_build_assign (tree, enum tree_code,
1530 tree, tree CXX_MEM_STAT_INFO);
1531 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1532 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1533 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1534 void gimple_cond_set_condition_from_tree (gcond *, tree);
1535 glabel *gimple_build_label (tree label);
1536 ggoto *gimple_build_goto (tree dest);
1537 gimple *gimple_build_nop (void);
1538 gbind *gimple_build_bind (tree, gimple_seq, tree);
1539 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1540 vec<tree, va_gc> *, vec<tree, va_gc> *,
1541 vec<tree, va_gc> *);
1542 gcatch *gimple_build_catch (tree, gimple_seq);
1543 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1544 geh_mnt *gimple_build_eh_must_not_throw (tree);
1545 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1546 gtry *gimple_build_try (gimple_seq, gimple_seq,
1547 enum gimple_try_flags);
1548 gimple *gimple_build_wce (gimple_seq);
1549 gresx *gimple_build_resx (int);
1550 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1551 gswitch *gimple_build_switch (tree, tree, const vec<tree> &);
1552 geh_dispatch *gimple_build_eh_dispatch (int);
1553 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1554 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1555 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1556 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1557 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1558 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1559 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1560 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1561 tree, tree);
1562 gimple *gimple_build_omp_section (gimple_seq);
1563 gimple *gimple_build_omp_scope (gimple_seq, tree);
1564 gimple *gimple_build_omp_master (gimple_seq);
1565 gimple *gimple_build_omp_masked (gimple_seq, tree);
1566 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1567 gomp_continue *gimple_build_omp_continue (tree, tree);
1568 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1569 gimple *gimple_build_omp_return (bool);
1570 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1571 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1572 gimple *gimple_build_omp_sections_switch (void);
1573 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1574 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1575 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1576 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1577 enum omp_memory_order);
1578 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1579 gtransaction *gimple_build_transaction (gimple_seq);
1580 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1581 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1582 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1583 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1584 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1585 location_t);
1586 extern void annotate_all_with_location (gimple_seq, location_t);
1587 bool empty_body_p (gimple_seq);
1588 gimple_seq gimple_seq_copy (gimple_seq);
1589 bool gimple_call_same_target_p (const gimple *, const gimple *);
1590 int gimple_call_flags (const gimple *);
1591 int gimple_call_arg_flags (const gcall *, unsigned);
1592 int gimple_call_return_flags (const gcall *);
1593 bool gimple_call_nonnull_result_p (gcall *);
1594 tree gimple_call_nonnull_arg (gcall *);
1595 bool gimple_assign_copy_p (gimple *);
1596 bool gimple_assign_ssa_name_copy_p (gimple *);
1597 bool gimple_assign_unary_nop_p (gimple *);
1598 void gimple_set_bb (gimple *, basic_block);
1599 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1600 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1601 tree, tree, tree);
1602 tree gimple_get_lhs (const gimple *);
1603 void gimple_set_lhs (gimple *, tree);
1604 gimple *gimple_copy (gimple *);
1605 void gimple_move_vops (gimple *, gimple *);
1606 bool gimple_has_side_effects (const gimple *);
1607 bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1608 bool gimple_could_trap_p (const gimple *);
1609 bool gimple_assign_rhs_could_trap_p (gimple *);
1610 extern void dump_gimple_statistics (void);
1611 unsigned get_gimple_rhs_num_ops (enum tree_code);
1612 extern tree canonicalize_cond_expr_cond (tree);
1613 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1614 extern bool gimple_compare_field_offset (tree, tree);
1615 extern tree gimple_unsigned_type (tree);
1616 extern tree gimple_signed_type (tree);
1617 extern alias_set_type gimple_get_alias_set (tree);
1618 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1619 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1620 extern combined_fn gimple_call_combined_fn (const gimple *);
1621 extern bool gimple_call_operator_delete_p (const gcall *);
1622 extern bool gimple_call_builtin_p (const gimple *);
1623 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1624 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1625 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1626 extern void dump_decl_set (FILE *, bitmap);
1627 extern bool nonfreeing_call_p (gimple *);
1628 extern bool nonbarrier_call_p (gimple *);
1629 extern bool infer_nonnull_range (gimple *, tree);
1630 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1631 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1632 extern void sort_case_labels (vec<tree> &);
1633 extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
1634 extern void gimple_seq_set_location (gimple_seq, location_t);
1635 extern void gimple_seq_discard (gimple_seq);
1636 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1637 extern bool gimple_inexpensive_call_p (gcall *);
1638 extern bool stmt_can_terminate_bb_p (gimple *);
1639 extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1641 /* Return the disposition for a warning (or all warnings by default)
1642 for a statement. */
1643 extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1644 ATTRIBUTE_NONNULL (1);
1645 /* Set the disposition for a warning (or all warnings by default)
1646 at a location to enabled by default. */
1647 extern void suppress_warning (gimple *, opt_code = all_warnings,
1648 bool = true) ATTRIBUTE_NONNULL (1);
1650 /* Copy the warning disposition mapping from one statement to another. */
1651 extern void copy_warning (gimple *, const gimple *)
1652 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1653 /* Copy the warning disposition mapping from an expression to a statement. */
1654 extern void copy_warning (gimple *, const_tree)
1655 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1656 /* Copy the warning disposition mapping from a statement to an expression. */
1657 extern void copy_warning (tree, const gimple *)
1658 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1660 /* Formal (expression) temporary table handling: multiple occurrences of
1661 the same scalar expression are evaluated into the same temporary. */
1663 typedef struct gimple_temp_hash_elt
1665 tree val; /* Key */
1666 tree temp; /* Value */
1667 } elt_t;
1669 /* Get the number of the next statement uid to be allocated. */
1670 static inline unsigned int
1671 gimple_stmt_max_uid (struct function *fn)
1673 return fn->last_stmt_uid;
1676 /* Set the number of the next statement uid to be allocated. */
1677 static inline void
1678 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1680 fn->last_stmt_uid = maxid;
1683 /* Set the number of the next statement uid to be allocated. */
1684 static inline unsigned int
1685 inc_gimple_stmt_max_uid (struct function *fn)
1687 return fn->last_stmt_uid++;
1690 /* Return the first node in GIMPLE sequence S. */
1692 static inline gimple_seq_node
1693 gimple_seq_first (gimple_seq s)
1695 return s;
1699 /* Return the first statement in GIMPLE sequence S. */
1701 static inline gimple *
1702 gimple_seq_first_stmt (gimple_seq s)
1704 gimple_seq_node n = gimple_seq_first (s);
1705 return n;
1708 /* Return the first statement in GIMPLE sequence S as a gbind *,
1709 verifying that it has code GIMPLE_BIND in a checked build. */
1711 static inline gbind *
1712 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1714 gimple_seq_node n = gimple_seq_first (s);
1715 return as_a <gbind *> (n);
1719 /* Return the last node in GIMPLE sequence S. */
1721 static inline gimple_seq_node
1722 gimple_seq_last (gimple_seq s)
1724 return s ? s->prev : NULL;
1728 /* Return the last statement in GIMPLE sequence S. */
1730 static inline gimple *
1731 gimple_seq_last_stmt (gimple_seq s)
1733 gimple_seq_node n = gimple_seq_last (s);
1734 return n;
1738 /* Set the last node in GIMPLE sequence *PS to LAST. */
1740 static inline void
1741 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1743 (*ps)->prev = last;
1747 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1749 static inline void
1750 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1752 *ps = first;
1756 /* Return true if GIMPLE sequence S is empty. */
1758 static inline bool
1759 gimple_seq_empty_p (gimple_seq s)
1761 return s == NULL;
1764 /* Allocate a new sequence and initialize its first element with STMT. */
1766 static inline gimple_seq
1767 gimple_seq_alloc_with_stmt (gimple *stmt)
1769 gimple_seq seq = NULL;
1770 gimple_seq_add_stmt (&seq, stmt);
1771 return seq;
1775 /* Returns the sequence of statements in BB. */
1777 static inline gimple_seq
1778 bb_seq (const_basic_block bb)
1780 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1783 static inline gimple_seq *
1784 bb_seq_addr (basic_block bb)
1786 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1789 /* Sets the sequence of statements in BB to SEQ. */
1791 static inline void
1792 set_bb_seq (basic_block bb, gimple_seq seq)
1794 gcc_checking_assert (!(bb->flags & BB_RTL));
1795 bb->il.gimple.seq = seq;
1799 /* Return the code for GIMPLE statement G. */
1801 static inline enum gimple_code
1802 gimple_code (const gimple *g)
1804 return g->code;
1808 /* Return the GSS code used by a GIMPLE code. */
1810 static inline enum gimple_statement_structure_enum
1811 gss_for_code (enum gimple_code code)
1813 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1814 return gss_for_code_[code];
1818 /* Return which GSS code is used by GS. */
1820 static inline enum gimple_statement_structure_enum
1821 gimple_statement_structure (gimple *gs)
1823 return gss_for_code (gimple_code (gs));
1827 /* Return true if statement G has sub-statements. This is only true for
1828 High GIMPLE statements. */
1830 static inline bool
1831 gimple_has_substatements (gimple *g)
1833 switch (gimple_code (g))
1835 case GIMPLE_BIND:
1836 case GIMPLE_CATCH:
1837 case GIMPLE_EH_FILTER:
1838 case GIMPLE_EH_ELSE:
1839 case GIMPLE_TRY:
1840 case GIMPLE_OMP_FOR:
1841 case GIMPLE_OMP_MASTER:
1842 case GIMPLE_OMP_MASKED:
1843 case GIMPLE_OMP_TASKGROUP:
1844 case GIMPLE_OMP_ORDERED:
1845 case GIMPLE_OMP_SECTION:
1846 case GIMPLE_OMP_PARALLEL:
1847 case GIMPLE_OMP_TASK:
1848 case GIMPLE_OMP_SCOPE:
1849 case GIMPLE_OMP_SECTIONS:
1850 case GIMPLE_OMP_SINGLE:
1851 case GIMPLE_OMP_TARGET:
1852 case GIMPLE_OMP_TEAMS:
1853 case GIMPLE_OMP_CRITICAL:
1854 case GIMPLE_WITH_CLEANUP_EXPR:
1855 case GIMPLE_TRANSACTION:
1856 return true;
1858 default:
1859 return false;
1864 /* Return the basic block holding statement G. */
1866 static inline basic_block
1867 gimple_bb (const gimple *g)
1869 return g->bb;
1873 /* Return the lexical scope block holding statement G. */
1875 static inline tree
1876 gimple_block (const gimple *g)
1878 return LOCATION_BLOCK (g->location);
1881 /* Forward declare. */
1882 static inline void gimple_set_location (gimple *, location_t);
1884 /* Set BLOCK to be the lexical scope block holding statement G. */
1886 static inline void
1887 gimple_set_block (gimple *g, tree block)
1889 gimple_set_location (g, set_block (g->location, block));
1892 /* Return location information for statement G. */
1894 static inline location_t
1895 gimple_location (const gimple *g)
1897 return g->location;
1900 /* Return location information for statement G if g is not NULL.
1901 Otherwise, UNKNOWN_LOCATION is returned. */
1903 static inline location_t
1904 gimple_location_safe (const gimple *g)
1906 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1909 /* Set location information for statement G. */
1911 static inline void
1912 gimple_set_location (gimple *g, location_t location)
1914 /* Copy the no-warning data to the statement location. */
1915 copy_warning (location, g->location);
1916 g->location = location;
1919 /* Return address of the location information for statement G. */
1921 static inline location_t *
1922 gimple_location_ptr (gimple *g)
1924 return &g->location;
1928 /* Return true if G contains location information. */
1930 static inline bool
1931 gimple_has_location (const gimple *g)
1933 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1937 /* Return non-artificial location information for statement G. */
1939 static inline location_t
1940 gimple_nonartificial_location (const gimple *g)
1942 location_t *ploc = NULL;
1944 if (tree block = gimple_block (g))
1945 ploc = block_nonartificial_location (block);
1947 return ploc ? *ploc : gimple_location (g);
1951 /* Return the file name of the location of STMT. */
1953 static inline const char *
1954 gimple_filename (const gimple *stmt)
1956 return LOCATION_FILE (gimple_location (stmt));
1960 /* Return the line number of the location of STMT. */
1962 static inline int
1963 gimple_lineno (const gimple *stmt)
1965 return LOCATION_LINE (gimple_location (stmt));
1969 /* Determine whether SEQ is a singleton. */
1971 static inline bool
1972 gimple_seq_singleton_p (gimple_seq seq)
1974 return ((gimple_seq_first (seq) != NULL)
1975 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1978 /* Return true if no warnings should be emitted for statement STMT. */
1980 static inline bool
1981 gimple_no_warning_p (const gimple *stmt)
1983 return stmt->no_warning;
1986 /* Set the no_warning flag of STMT to NO_WARNING. */
1988 static inline void
1989 gimple_set_no_warning (gimple *stmt, bool no_warning)
1991 stmt->no_warning = (unsigned) no_warning;
1994 /* Set the visited status on statement STMT to VISITED_P.
1996 Please note that this 'visited' property of the gimple statement is
1997 supposed to be undefined at pass boundaries. This means that a
1998 given pass should not assume it contains any useful value when the
1999 pass starts and thus can set it to any value it sees fit.
2001 You can learn more about the visited property of the gimple
2002 statement by reading the comments of the 'visited' data member of
2003 struct gimple.
2006 static inline void
2007 gimple_set_visited (gimple *stmt, bool visited_p)
2009 stmt->visited = (unsigned) visited_p;
2013 /* Return the visited status for statement STMT.
2015 Please note that this 'visited' property of the gimple statement is
2016 supposed to be undefined at pass boundaries. This means that a
2017 given pass should not assume it contains any useful value when the
2018 pass starts and thus can set it to any value it sees fit.
2020 You can learn more about the visited property of the gimple
2021 statement by reading the comments of the 'visited' data member of
2022 struct gimple. */
2024 static inline bool
2025 gimple_visited_p (gimple *stmt)
2027 return stmt->visited;
2031 /* Set pass local flag PLF on statement STMT to VAL_P.
2033 Please note that this PLF property of the gimple statement is
2034 supposed to be undefined at pass boundaries. This means that a
2035 given pass should not assume it contains any useful value when the
2036 pass starts and thus can set it to any value it sees fit.
2038 You can learn more about the PLF property by reading the comment of
2039 the 'plf' data member of struct gimple_statement_structure. */
2041 static inline void
2042 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2044 if (val_p)
2045 stmt->plf |= (unsigned int) plf;
2046 else
2047 stmt->plf &= ~((unsigned int) plf);
2051 /* Return the value of pass local flag PLF on statement STMT.
2053 Please note that this 'plf' property of the gimple statement is
2054 supposed to be undefined at pass boundaries. This means that a
2055 given pass should not assume it contains any useful value when the
2056 pass starts and thus can set it to any value it sees fit.
2058 You can learn more about the plf property by reading the comment of
2059 the 'plf' data member of struct gimple_statement_structure. */
2061 static inline unsigned int
2062 gimple_plf (gimple *stmt, enum plf_mask plf)
2064 return stmt->plf & ((unsigned int) plf);
2068 /* Set the UID of statement.
2070 Please note that this UID property is supposed to be undefined at
2071 pass boundaries. This means that a given pass should not assume it
2072 contains any useful value when the pass starts and thus can set it
2073 to any value it sees fit. */
2075 static inline void
2076 gimple_set_uid (gimple *g, unsigned uid)
2078 g->uid = uid;
2082 /* Return the UID of statement.
2084 Please note that this UID property is supposed to be undefined at
2085 pass boundaries. This means that a given pass should not assume it
2086 contains any useful value when the pass starts and thus can set it
2087 to any value it sees fit. */
2089 static inline unsigned
2090 gimple_uid (const gimple *g)
2092 return g->uid;
2096 /* Make statement G a singleton sequence. */
2098 static inline void
2099 gimple_init_singleton (gimple *g)
2101 g->next = NULL;
2102 g->prev = g;
2106 /* Return true if GIMPLE statement G has register or memory operands. */
2108 static inline bool
2109 gimple_has_ops (const gimple *g)
2111 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2114 template <>
2115 template <>
2116 inline bool
2117 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2119 return gimple_has_ops (gs);
2122 template <>
2123 template <>
2124 inline bool
2125 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2127 return gimple_has_ops (gs);
2130 /* Return true if GIMPLE statement G has memory operands. */
2132 static inline bool
2133 gimple_has_mem_ops (const gimple *g)
2135 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2138 template <>
2139 template <>
2140 inline bool
2141 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2143 return gimple_has_mem_ops (gs);
2146 template <>
2147 template <>
2148 inline bool
2149 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2151 return gimple_has_mem_ops (gs);
2154 /* Return the set of USE operands for statement G. */
2156 static inline struct use_optype_d *
2157 gimple_use_ops (const gimple *g)
2159 const gimple_statement_with_ops *ops_stmt =
2160 dyn_cast <const gimple_statement_with_ops *> (g);
2161 if (!ops_stmt)
2162 return NULL;
2163 return ops_stmt->use_ops;
2167 /* Set USE to be the set of USE operands for statement G. */
2169 static inline void
2170 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2172 gimple_statement_with_ops *ops_stmt =
2173 as_a <gimple_statement_with_ops *> (g);
2174 ops_stmt->use_ops = use;
2178 /* Return the single VUSE operand of the statement G. */
2180 static inline tree
2181 gimple_vuse (const gimple *g)
2183 const gimple_statement_with_memory_ops *mem_ops_stmt =
2184 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2185 if (!mem_ops_stmt)
2186 return NULL_TREE;
2187 return mem_ops_stmt->vuse;
2190 /* Return the single VDEF operand of the statement G. */
2192 static inline tree
2193 gimple_vdef (const gimple *g)
2195 const gimple_statement_with_memory_ops *mem_ops_stmt =
2196 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2197 if (!mem_ops_stmt)
2198 return NULL_TREE;
2199 return mem_ops_stmt->vdef;
2202 /* Return the single VUSE operand of the statement G. */
2204 static inline tree *
2205 gimple_vuse_ptr (gimple *g)
2207 gimple_statement_with_memory_ops *mem_ops_stmt =
2208 dyn_cast <gimple_statement_with_memory_ops *> (g);
2209 if (!mem_ops_stmt)
2210 return NULL;
2211 return &mem_ops_stmt->vuse;
2214 /* Return the single VDEF operand of the statement G. */
2216 static inline tree *
2217 gimple_vdef_ptr (gimple *g)
2219 gimple_statement_with_memory_ops *mem_ops_stmt =
2220 dyn_cast <gimple_statement_with_memory_ops *> (g);
2221 if (!mem_ops_stmt)
2222 return NULL;
2223 return &mem_ops_stmt->vdef;
2226 /* Set the single VUSE operand of the statement G. */
2228 static inline void
2229 gimple_set_vuse (gimple *g, tree vuse)
2231 gimple_statement_with_memory_ops *mem_ops_stmt =
2232 as_a <gimple_statement_with_memory_ops *> (g);
2233 mem_ops_stmt->vuse = vuse;
2236 /* Set the single VDEF operand of the statement G. */
2238 static inline void
2239 gimple_set_vdef (gimple *g, tree vdef)
2241 gimple_statement_with_memory_ops *mem_ops_stmt =
2242 as_a <gimple_statement_with_memory_ops *> (g);
2243 mem_ops_stmt->vdef = vdef;
2247 /* Return true if statement G has operands and the modified field has
2248 been set. */
2250 static inline bool
2251 gimple_modified_p (const gimple *g)
2253 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2257 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2258 a MODIFIED field. */
2260 static inline void
2261 gimple_set_modified (gimple *s, bool modifiedp)
2263 if (gimple_has_ops (s))
2264 s->modified = (unsigned) modifiedp;
2268 /* Return true if statement STMT contains volatile operands. */
2270 static inline bool
2271 gimple_has_volatile_ops (const gimple *stmt)
2273 if (gimple_has_mem_ops (stmt))
2274 return stmt->has_volatile_ops;
2275 else
2276 return false;
2280 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2282 static inline void
2283 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2285 if (gimple_has_mem_ops (stmt))
2286 stmt->has_volatile_ops = (unsigned) volatilep;
2289 /* Return true if STMT is in a transaction. */
2291 static inline bool
2292 gimple_in_transaction (const gimple *stmt)
2294 return bb_in_transaction (gimple_bb (stmt));
2297 /* Return true if statement STMT may access memory. */
2299 static inline bool
2300 gimple_references_memory_p (gimple *stmt)
2302 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2306 /* Return the subcode for OMP statement S. */
2308 static inline unsigned
2309 gimple_omp_subcode (const gimple *s)
2311 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2312 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2313 return s->subcode;
2316 /* Set the subcode for OMP statement S to SUBCODE. */
2318 static inline void
2319 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2321 /* We only have 16 bits for the subcode. Assert that we are not
2322 overflowing it. */
2323 gcc_gimple_checking_assert (subcode < (1 << 16));
2324 s->subcode = subcode;
2327 /* Set the nowait flag on OMP_RETURN statement S. */
2329 static inline void
2330 gimple_omp_return_set_nowait (gimple *s)
2332 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2333 s->subcode |= GF_OMP_RETURN_NOWAIT;
2337 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2338 flag set. */
2340 static inline bool
2341 gimple_omp_return_nowait_p (const gimple *g)
2343 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2344 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2348 /* Set the LHS of OMP return. */
2350 static inline void
2351 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2353 gimple_statement_omp_return *omp_return_stmt =
2354 as_a <gimple_statement_omp_return *> (g);
2355 omp_return_stmt->val = lhs;
2359 /* Get the LHS of OMP return. */
2361 static inline tree
2362 gimple_omp_return_lhs (const gimple *g)
2364 const gimple_statement_omp_return *omp_return_stmt =
2365 as_a <const gimple_statement_omp_return *> (g);
2366 return omp_return_stmt->val;
2370 /* Return a pointer to the LHS of OMP return. */
2372 static inline tree *
2373 gimple_omp_return_lhs_ptr (gimple *g)
2375 gimple_statement_omp_return *omp_return_stmt =
2376 as_a <gimple_statement_omp_return *> (g);
2377 return &omp_return_stmt->val;
2381 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2382 flag set. */
2384 static inline bool
2385 gimple_omp_section_last_p (const gimple *g)
2387 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2388 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2392 /* Set the GF_OMP_SECTION_LAST flag on G. */
2394 static inline void
2395 gimple_omp_section_set_last (gimple *g)
2397 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2398 g->subcode |= GF_OMP_SECTION_LAST;
2402 /* Return true if OMP parallel statement G has the
2403 GF_OMP_PARALLEL_COMBINED flag set. */
2405 static inline bool
2406 gimple_omp_parallel_combined_p (const gimple *g)
2408 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2409 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2413 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2414 value of COMBINED_P. */
2416 static inline void
2417 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2419 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2420 if (combined_p)
2421 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2422 else
2423 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2427 /* Return true if OMP atomic load/store statement G has the
2428 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2430 static inline bool
2431 gimple_omp_atomic_need_value_p (const gimple *g)
2433 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2434 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2435 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2439 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2441 static inline void
2442 gimple_omp_atomic_set_need_value (gimple *g)
2444 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2445 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2446 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2450 /* Return true if OMP atomic load/store statement G has the
2451 GF_OMP_ATOMIC_WEAK flag set. */
2453 static inline bool
2454 gimple_omp_atomic_weak_p (const gimple *g)
2456 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2457 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2458 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_WEAK) != 0;
2462 /* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2464 static inline void
2465 gimple_omp_atomic_set_weak (gimple *g)
2467 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2468 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2469 g->subcode |= GF_OMP_ATOMIC_WEAK;
2473 /* Return the memory order of the OMP atomic load/store statement G. */
2475 static inline enum omp_memory_order
2476 gimple_omp_atomic_memory_order (const gimple *g)
2478 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2479 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2480 return (enum omp_memory_order)
2481 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2485 /* Set the memory order on G. */
2487 static inline void
2488 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2490 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2491 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2492 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2493 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2497 /* Return the number of operands for statement GS. */
2499 static inline unsigned
2500 gimple_num_ops (const gimple *gs)
2502 return gs->num_ops;
2506 /* Set the number of operands for statement GS. */
2508 static inline void
2509 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2511 gs->num_ops = num_ops;
2515 /* Return the array of operands for statement GS. */
2517 static inline tree *
2518 gimple_ops (gimple *gs)
2520 size_t off;
2522 /* All the tuples have their operand vector at the very bottom
2523 of the structure. Note that those structures that do not
2524 have an operand vector have a zero offset. */
2525 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2526 gcc_gimple_checking_assert (off != 0);
2528 return (tree *) ((char *) gs + off);
2532 /* Return operand I for statement GS. */
2534 static inline tree
2535 gimple_op (const gimple *gs, unsigned i)
2537 if (gimple_has_ops (gs))
2539 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2540 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2542 else
2543 return NULL_TREE;
2546 /* Return a pointer to operand I for statement GS. */
2548 static inline tree *
2549 gimple_op_ptr (gimple *gs, unsigned i)
2551 if (gimple_has_ops (gs))
2553 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2554 return gimple_ops (gs) + i;
2556 else
2557 return NULL;
2560 /* Set operand I of statement GS to OP. */
2562 static inline void
2563 gimple_set_op (gimple *gs, unsigned i, tree op)
2565 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2567 /* Note. It may be tempting to assert that OP matches
2568 is_gimple_operand, but that would be wrong. Different tuples
2569 accept slightly different sets of tree operands. Each caller
2570 should perform its own validation. */
2571 gimple_ops (gs)[i] = op;
2574 /* Return true if GS is a GIMPLE_ASSIGN. */
2576 static inline bool
2577 is_gimple_assign (const gimple *gs)
2579 return gimple_code (gs) == GIMPLE_ASSIGN;
2582 /* Determine if expression CODE is one of the valid expressions that can
2583 be used on the RHS of GIMPLE assignments. */
2585 static inline enum gimple_rhs_class
2586 get_gimple_rhs_class (enum tree_code code)
2588 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2591 /* Return the LHS of assignment statement GS. */
2593 static inline tree
2594 gimple_assign_lhs (const gassign *gs)
2596 return gs->op[0];
2599 static inline tree
2600 gimple_assign_lhs (const gimple *gs)
2602 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2603 return gimple_assign_lhs (ass);
2607 /* Return a pointer to the LHS of assignment statement GS. */
2609 static inline tree *
2610 gimple_assign_lhs_ptr (gassign *gs)
2612 return &gs->op[0];
2615 static inline tree *
2616 gimple_assign_lhs_ptr (gimple *gs)
2618 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2619 return gimple_assign_lhs_ptr (ass);
2623 /* Set LHS to be the LHS operand of assignment statement GS. */
2625 static inline void
2626 gimple_assign_set_lhs (gassign *gs, tree lhs)
2628 gs->op[0] = lhs;
2630 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2631 SSA_NAME_DEF_STMT (lhs) = gs;
2634 static inline void
2635 gimple_assign_set_lhs (gimple *gs, tree lhs)
2637 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2638 gimple_assign_set_lhs (ass, lhs);
2642 /* Return the first operand on the RHS of assignment statement GS. */
2644 static inline tree
2645 gimple_assign_rhs1 (const gassign *gs)
2647 return gs->op[1];
2650 static inline tree
2651 gimple_assign_rhs1 (const gimple *gs)
2653 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2654 return gimple_assign_rhs1 (ass);
2658 /* Return a pointer to the first operand on the RHS of assignment
2659 statement GS. */
2661 static inline tree *
2662 gimple_assign_rhs1_ptr (gassign *gs)
2664 return &gs->op[1];
2667 static inline tree *
2668 gimple_assign_rhs1_ptr (gimple *gs)
2670 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2671 return gimple_assign_rhs1_ptr (ass);
2674 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2676 static inline void
2677 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2679 gs->op[1] = rhs;
2682 static inline void
2683 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2685 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2686 gimple_assign_set_rhs1 (ass, rhs);
2690 /* Return the second operand on the RHS of assignment statement GS.
2691 If GS does not have two operands, NULL is returned instead. */
2693 static inline tree
2694 gimple_assign_rhs2 (const gassign *gs)
2696 if (gimple_num_ops (gs) >= 3)
2697 return gs->op[2];
2698 else
2699 return NULL_TREE;
2702 static inline tree
2703 gimple_assign_rhs2 (const gimple *gs)
2705 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2706 return gimple_assign_rhs2 (ass);
2710 /* Return a pointer to the second operand on the RHS of assignment
2711 statement GS. */
2713 static inline tree *
2714 gimple_assign_rhs2_ptr (gassign *gs)
2716 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2717 return &gs->op[2];
2720 static inline tree *
2721 gimple_assign_rhs2_ptr (gimple *gs)
2723 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2724 return gimple_assign_rhs2_ptr (ass);
2728 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2730 static inline void
2731 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2733 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2734 gs->op[2] = rhs;
2737 static inline void
2738 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2740 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2741 return gimple_assign_set_rhs2 (ass, rhs);
2744 /* Return the third operand on the RHS of assignment statement GS.
2745 If GS does not have two operands, NULL is returned instead. */
2747 static inline tree
2748 gimple_assign_rhs3 (const gassign *gs)
2750 if (gimple_num_ops (gs) >= 4)
2751 return gs->op[3];
2752 else
2753 return NULL_TREE;
2756 static inline tree
2757 gimple_assign_rhs3 (const gimple *gs)
2759 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2760 return gimple_assign_rhs3 (ass);
2763 /* Return a pointer to the third operand on the RHS of assignment
2764 statement GS. */
2766 static inline tree *
2767 gimple_assign_rhs3_ptr (gimple *gs)
2769 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2770 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2771 return &ass->op[3];
2775 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2777 static inline void
2778 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2780 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2781 gs->op[3] = rhs;
2784 static inline void
2785 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2787 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2788 gimple_assign_set_rhs3 (ass, rhs);
2792 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2793 which expect to see only two operands. */
2795 static inline void
2796 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2797 tree op1, tree op2)
2799 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2802 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2803 which expect to see only one operands. */
2805 static inline void
2806 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2807 tree op1)
2809 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2812 /* Returns true if GS is a nontemporal move. */
2814 static inline bool
2815 gimple_assign_nontemporal_move_p (const gassign *gs)
2817 return gs->nontemporal_move;
2820 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2822 static inline void
2823 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2825 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2826 gs->nontemporal_move = nontemporal;
2830 /* Return the code of the expression computed on the rhs of assignment
2831 statement GS. In case that the RHS is a single object, returns the
2832 tree code of the object. */
2834 static inline enum tree_code
2835 gimple_assign_rhs_code (const gassign *gs)
2837 enum tree_code code = (enum tree_code) gs->subcode;
2838 /* While we initially set subcode to the TREE_CODE of the rhs for
2839 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2840 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2841 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2842 code = TREE_CODE (gs->op[1]);
2844 return code;
2847 static inline enum tree_code
2848 gimple_assign_rhs_code (const gimple *gs)
2850 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2851 return gimple_assign_rhs_code (ass);
2855 /* Set CODE to be the code for the expression computed on the RHS of
2856 assignment S. */
2858 static inline void
2859 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2861 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2862 s->subcode = code;
2866 /* Return the gimple rhs class of the code of the expression computed on
2867 the rhs of assignment statement GS.
2868 This will never return GIMPLE_INVALID_RHS. */
2870 static inline enum gimple_rhs_class
2871 gimple_assign_rhs_class (const gimple *gs)
2873 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2876 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2877 there is no operator associated with the assignment itself.
2878 Unlike gimple_assign_copy_p, this predicate returns true for
2879 any RHS operand, including those that perform an operation
2880 and do not have the semantics of a copy, such as COND_EXPR. */
2882 static inline bool
2883 gimple_assign_single_p (const gimple *gs)
2885 return (is_gimple_assign (gs)
2886 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2889 /* Return true if GS performs a store to its lhs. */
2891 static inline bool
2892 gimple_store_p (const gimple *gs)
2894 tree lhs = gimple_get_lhs (gs);
2895 return lhs && !is_gimple_reg (lhs);
2898 /* Return true if GS is an assignment that loads from its rhs1. */
2900 static inline bool
2901 gimple_assign_load_p (const gimple *gs)
2903 tree rhs;
2904 if (!gimple_assign_single_p (gs))
2905 return false;
2906 rhs = gimple_assign_rhs1 (gs);
2907 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2908 return true;
2909 rhs = get_base_address (rhs);
2910 return (DECL_P (rhs)
2911 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2915 /* Return true if S is a type-cast assignment. */
2917 static inline bool
2918 gimple_assign_cast_p (const gimple *s)
2920 if (is_gimple_assign (s))
2922 enum tree_code sc = gimple_assign_rhs_code (s);
2923 return CONVERT_EXPR_CODE_P (sc)
2924 || sc == VIEW_CONVERT_EXPR
2925 || sc == FIX_TRUNC_EXPR;
2928 return false;
2931 /* Return true if S is a clobber statement. */
2933 static inline bool
2934 gimple_clobber_p (const gimple *s)
2936 return gimple_assign_single_p (s)
2937 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2940 /* Return true if GS is a GIMPLE_CALL. */
2942 static inline bool
2943 is_gimple_call (const gimple *gs)
2945 return gimple_code (gs) == GIMPLE_CALL;
2948 /* Return the LHS of call statement GS. */
2950 static inline tree
2951 gimple_call_lhs (const gcall *gs)
2953 return gs->op[0];
2956 static inline tree
2957 gimple_call_lhs (const gimple *gs)
2959 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2960 return gimple_call_lhs (gc);
2964 /* Return a pointer to the LHS of call statement GS. */
2966 static inline tree *
2967 gimple_call_lhs_ptr (gcall *gs)
2969 return &gs->op[0];
2972 static inline tree *
2973 gimple_call_lhs_ptr (gimple *gs)
2975 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2976 return gimple_call_lhs_ptr (gc);
2980 /* Set LHS to be the LHS operand of call statement GS. */
2982 static inline void
2983 gimple_call_set_lhs (gcall *gs, tree lhs)
2985 gs->op[0] = lhs;
2986 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2987 SSA_NAME_DEF_STMT (lhs) = gs;
2990 static inline void
2991 gimple_call_set_lhs (gimple *gs, tree lhs)
2993 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2994 gimple_call_set_lhs (gc, lhs);
2998 /* Return true if call GS calls an internal-only function, as enumerated
2999 by internal_fn. */
3001 static inline bool
3002 gimple_call_internal_p (const gcall *gs)
3004 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3007 static inline bool
3008 gimple_call_internal_p (const gimple *gs)
3010 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3011 return gimple_call_internal_p (gc);
3014 /* Return true if call GS is marked as nocf_check. */
3016 static inline bool
3017 gimple_call_nocf_check_p (const gcall *gs)
3019 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3022 /* Mark statement GS as nocf_check call. */
3024 static inline void
3025 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
3027 if (nocf_check)
3028 gs->subcode |= GF_CALL_NOCF_CHECK;
3029 else
3030 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3033 /* Return the target of internal call GS. */
3035 static inline enum internal_fn
3036 gimple_call_internal_fn (const gcall *gs)
3038 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3039 return gs->u.internal_fn;
3042 static inline enum internal_fn
3043 gimple_call_internal_fn (const gimple *gs)
3045 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3046 return gimple_call_internal_fn (gc);
3049 /* Return true, if this internal gimple call is unique. */
3051 static inline bool
3052 gimple_call_internal_unique_p (const gcall *gs)
3054 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3057 static inline bool
3058 gimple_call_internal_unique_p (const gimple *gs)
3060 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3061 return gimple_call_internal_unique_p (gc);
3064 /* Return true if GS is an internal function FN. */
3066 static inline bool
3067 gimple_call_internal_p (const gimple *gs, internal_fn fn)
3069 return (is_gimple_call (gs)
3070 && gimple_call_internal_p (gs)
3071 && gimple_call_internal_fn (gs) == fn);
3074 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3075 that could alter control flow. */
3077 static inline void
3078 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3080 if (ctrl_altering_p)
3081 s->subcode |= GF_CALL_CTRL_ALTERING;
3082 else
3083 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3086 static inline void
3087 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3089 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3090 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3093 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3094 flag is set. Such call could not be a stmt in the middle of a bb. */
3096 static inline bool
3097 gimple_call_ctrl_altering_p (const gcall *gs)
3099 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3102 static inline bool
3103 gimple_call_ctrl_altering_p (const gimple *gs)
3105 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3106 return gimple_call_ctrl_altering_p (gc);
3110 /* Return the function type of the function called by GS. */
3112 static inline tree
3113 gimple_call_fntype (const gcall *gs)
3115 if (gimple_call_internal_p (gs))
3116 return NULL_TREE;
3117 return gs->u.fntype;
3120 static inline tree
3121 gimple_call_fntype (const gimple *gs)
3123 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3124 return gimple_call_fntype (call_stmt);
3127 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3129 static inline void
3130 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3132 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3133 call_stmt->u.fntype = fntype;
3137 /* Return the tree node representing the function called by call
3138 statement GS. */
3140 static inline tree
3141 gimple_call_fn (const gcall *gs)
3143 return gs->op[1];
3146 static inline tree
3147 gimple_call_fn (const gimple *gs)
3149 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3150 return gimple_call_fn (gc);
3153 /* Return a pointer to the tree node representing the function called by call
3154 statement GS. */
3156 static inline tree *
3157 gimple_call_fn_ptr (gcall *gs)
3159 return &gs->op[1];
3162 static inline tree *
3163 gimple_call_fn_ptr (gimple *gs)
3165 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3166 return gimple_call_fn_ptr (gc);
3170 /* Set FN to be the function called by call statement GS. */
3172 static inline void
3173 gimple_call_set_fn (gcall *gs, tree fn)
3175 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3176 gs->op[1] = fn;
3180 /* Set FNDECL to be the function called by call statement GS. */
3182 static inline void
3183 gimple_call_set_fndecl (gcall *gs, tree decl)
3185 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3186 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3187 build_pointer_type (TREE_TYPE (decl)), decl);
3190 static inline void
3191 gimple_call_set_fndecl (gimple *gs, tree decl)
3193 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3194 gimple_call_set_fndecl (gc, decl);
3198 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3200 static inline void
3201 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3203 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3204 call_stmt->u.internal_fn = fn;
3208 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3209 Otherwise return NULL. This function is analogous to
3210 get_callee_fndecl in tree land. */
3212 static inline tree
3213 gimple_call_fndecl (const gcall *gs)
3215 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3218 static inline tree
3219 gimple_call_fndecl (const gimple *gs)
3221 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3222 return gimple_call_fndecl (gc);
3226 /* Return the type returned by call statement GS. */
3228 static inline tree
3229 gimple_call_return_type (const gcall *gs)
3231 tree type = gimple_call_fntype (gs);
3233 if (type == NULL_TREE)
3234 return TREE_TYPE (gimple_call_lhs (gs));
3236 /* The type returned by a function is the type of its
3237 function type. */
3238 return TREE_TYPE (type);
3242 /* Return the static chain for call statement GS. */
3244 static inline tree
3245 gimple_call_chain (const gcall *gs)
3247 return gs->op[2];
3250 static inline tree
3251 gimple_call_chain (const gimple *gs)
3253 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3254 return gimple_call_chain (gc);
3258 /* Return a pointer to the static chain for call statement CALL_STMT. */
3260 static inline tree *
3261 gimple_call_chain_ptr (gcall *call_stmt)
3263 return &call_stmt->op[2];
3266 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3268 static inline void
3269 gimple_call_set_chain (gcall *call_stmt, tree chain)
3271 call_stmt->op[2] = chain;
3275 /* Return the number of arguments used by call statement GS. */
3277 static inline unsigned
3278 gimple_call_num_args (const gcall *gs)
3280 return gimple_num_ops (gs) - 3;
3283 static inline unsigned
3284 gimple_call_num_args (const gimple *gs)
3286 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3287 return gimple_call_num_args (gc);
3291 /* Return the argument at position INDEX for call statement GS. */
3293 static inline tree
3294 gimple_call_arg (const gcall *gs, unsigned index)
3296 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3297 return gs->op[index + 3];
3300 static inline tree
3301 gimple_call_arg (const gimple *gs, unsigned index)
3303 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3304 return gimple_call_arg (gc, index);
3308 /* Return a pointer to the argument at position INDEX for call
3309 statement GS. */
3311 static inline tree *
3312 gimple_call_arg_ptr (gcall *gs, unsigned index)
3314 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3315 return &gs->op[index + 3];
3318 static inline tree *
3319 gimple_call_arg_ptr (gimple *gs, unsigned index)
3321 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3322 return gimple_call_arg_ptr (gc, index);
3326 /* Set ARG to be the argument at position INDEX for call statement GS. */
3328 static inline void
3329 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3331 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3332 gs->op[index + 3] = arg;
3335 static inline void
3336 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3338 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3339 gimple_call_set_arg (gc, index, arg);
3343 /* If TAIL_P is true, mark call statement S as being a tail call
3344 (i.e., a call just before the exit of a function). These calls are
3345 candidate for tail call optimization. */
3347 static inline void
3348 gimple_call_set_tail (gcall *s, bool tail_p)
3350 if (tail_p)
3351 s->subcode |= GF_CALL_TAILCALL;
3352 else
3353 s->subcode &= ~GF_CALL_TAILCALL;
3357 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3359 static inline bool
3360 gimple_call_tail_p (const gcall *s)
3362 return (s->subcode & GF_CALL_TAILCALL) != 0;
3365 /* Mark (or clear) call statement S as requiring tail call optimization. */
3367 static inline void
3368 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3370 if (must_tail_p)
3371 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3372 else
3373 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3376 /* Return true if call statement has been marked as requiring
3377 tail call optimization. */
3379 static inline bool
3380 gimple_call_must_tail_p (const gcall *s)
3382 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3385 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3386 slot optimization. This transformation uses the target of the call
3387 expansion as the return slot for calls that return in memory. */
3389 static inline void
3390 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3392 if (return_slot_opt_p)
3393 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3394 else
3395 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3399 /* Return true if S is marked for return slot optimization. */
3401 static inline bool
3402 gimple_call_return_slot_opt_p (const gcall *s)
3404 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3408 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3409 thunk to the thunked-to function. */
3411 static inline void
3412 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3414 if (from_thunk_p)
3415 s->subcode |= GF_CALL_FROM_THUNK;
3416 else
3417 s->subcode &= ~GF_CALL_FROM_THUNK;
3421 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3423 static inline bool
3424 gimple_call_from_thunk_p (gcall *s)
3426 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3430 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3431 to operator new or delete created from a new or delete expression. */
3433 static inline void
3434 gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3436 if (from_new_or_delete_p)
3437 s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
3438 else
3439 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3443 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3444 from a new or delete expression. */
3446 static inline bool
3447 gimple_call_from_new_or_delete (const gcall *s)
3449 return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
3453 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3454 argument pack in its argument list. */
3456 static inline void
3457 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3459 if (pass_arg_pack_p)
3460 s->subcode |= GF_CALL_VA_ARG_PACK;
3461 else
3462 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3466 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3467 argument pack in its argument list. */
3469 static inline bool
3470 gimple_call_va_arg_pack_p (const gcall *s)
3472 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3476 /* Return true if S is a noreturn call. */
3478 static inline bool
3479 gimple_call_noreturn_p (const gcall *s)
3481 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3484 static inline bool
3485 gimple_call_noreturn_p (const gimple *s)
3487 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3488 return gimple_call_noreturn_p (gc);
3492 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3493 even if the called function can throw in other cases. */
3495 static inline void
3496 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3498 if (nothrow_p)
3499 s->subcode |= GF_CALL_NOTHROW;
3500 else
3501 s->subcode &= ~GF_CALL_NOTHROW;
3504 /* Return true if S is a nothrow call. */
3506 static inline bool
3507 gimple_call_nothrow_p (gcall *s)
3509 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3512 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3513 is known to be emitted for VLA objects. Those are wrapped by
3514 stack_save/stack_restore calls and hence can't lead to unbounded
3515 stack growth even when they occur in loops. */
3517 static inline void
3518 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3520 if (for_var)
3521 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3522 else
3523 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3526 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3528 static inline bool
3529 gimple_call_alloca_for_var_p (gcall *s)
3531 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3534 static inline bool
3535 gimple_call_alloca_for_var_p (gimple *s)
3537 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3538 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3541 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3542 pointers to nested function are descriptors instead of trampolines. */
3544 static inline void
3545 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3547 if (by_descriptor_p)
3548 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3549 else
3550 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3553 /* Return true if S is a by-descriptor call. */
3555 static inline bool
3556 gimple_call_by_descriptor_p (gcall *s)
3558 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3561 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3563 static inline void
3564 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3566 dest_call->subcode = orig_call->subcode;
3570 /* Return a pointer to the points-to solution for the set of call-used
3571 variables of the call CALL_STMT. */
3573 static inline struct pt_solution *
3574 gimple_call_use_set (gcall *call_stmt)
3576 return &call_stmt->call_used;
3579 /* As above, but const. */
3581 static inline const pt_solution *
3582 gimple_call_use_set (const gcall *call_stmt)
3584 return &call_stmt->call_used;
3587 /* Return a pointer to the points-to solution for the set of call-used
3588 variables of the call CALL_STMT. */
3590 static inline struct pt_solution *
3591 gimple_call_clobber_set (gcall *call_stmt)
3593 return &call_stmt->call_clobbered;
3596 /* As above, but const. */
3598 static inline const pt_solution *
3599 gimple_call_clobber_set (const gcall *call_stmt)
3601 return &call_stmt->call_clobbered;
3605 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3606 non-NULL lhs. */
3608 static inline bool
3609 gimple_has_lhs (const gimple *stmt)
3611 if (is_gimple_assign (stmt))
3612 return true;
3613 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3614 return gimple_call_lhs (call) != NULL_TREE;
3615 return false;
3619 /* Return the code of the predicate computed by conditional statement GS. */
3621 static inline enum tree_code
3622 gimple_cond_code (const gcond *gs)
3624 return (enum tree_code) gs->subcode;
3627 static inline enum tree_code
3628 gimple_cond_code (const gimple *gs)
3630 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3631 return gimple_cond_code (gc);
3635 /* Set CODE to be the predicate code for the conditional statement GS. */
3637 static inline void
3638 gimple_cond_set_code (gcond *gs, enum tree_code code)
3640 gs->subcode = code;
3644 /* Return the LHS of the predicate computed by conditional statement GS. */
3646 static inline tree
3647 gimple_cond_lhs (const gcond *gs)
3649 return gs->op[0];
3652 static inline tree
3653 gimple_cond_lhs (const gimple *gs)
3655 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3656 return gimple_cond_lhs (gc);
3659 /* Return the pointer to the LHS of the predicate computed by conditional
3660 statement GS. */
3662 static inline tree *
3663 gimple_cond_lhs_ptr (gcond *gs)
3665 return &gs->op[0];
3668 /* Set LHS to be the LHS operand of the predicate computed by
3669 conditional statement GS. */
3671 static inline void
3672 gimple_cond_set_lhs (gcond *gs, tree lhs)
3674 gs->op[0] = lhs;
3678 /* Return the RHS operand of the predicate computed by conditional GS. */
3680 static inline tree
3681 gimple_cond_rhs (const gcond *gs)
3683 return gs->op[1];
3686 static inline tree
3687 gimple_cond_rhs (const gimple *gs)
3689 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3690 return gimple_cond_rhs (gc);
3693 /* Return the pointer to the RHS operand of the predicate computed by
3694 conditional GS. */
3696 static inline tree *
3697 gimple_cond_rhs_ptr (gcond *gs)
3699 return &gs->op[1];
3703 /* Set RHS to be the RHS operand of the predicate computed by
3704 conditional statement GS. */
3706 static inline void
3707 gimple_cond_set_rhs (gcond *gs, tree rhs)
3709 gs->op[1] = rhs;
3713 /* Return the label used by conditional statement GS when its
3714 predicate evaluates to true. */
3716 static inline tree
3717 gimple_cond_true_label (const gcond *gs)
3719 return gs->op[2];
3723 /* Set LABEL to be the label used by conditional statement GS when its
3724 predicate evaluates to true. */
3726 static inline void
3727 gimple_cond_set_true_label (gcond *gs, tree label)
3729 gs->op[2] = label;
3733 /* Set LABEL to be the label used by conditional statement GS when its
3734 predicate evaluates to false. */
3736 static inline void
3737 gimple_cond_set_false_label (gcond *gs, tree label)
3739 gs->op[3] = label;
3743 /* Return the label used by conditional statement GS when its
3744 predicate evaluates to false. */
3746 static inline tree
3747 gimple_cond_false_label (const gcond *gs)
3749 return gs->op[3];
3753 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3755 static inline void
3756 gimple_cond_make_false (gcond *gs)
3758 gimple_cond_set_lhs (gs, boolean_false_node);
3759 gimple_cond_set_rhs (gs, boolean_false_node);
3760 gs->subcode = NE_EXPR;
3764 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3766 static inline void
3767 gimple_cond_make_true (gcond *gs)
3769 gimple_cond_set_lhs (gs, boolean_true_node);
3770 gimple_cond_set_rhs (gs, boolean_false_node);
3771 gs->subcode = NE_EXPR;
3774 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3775 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3777 static inline bool
3778 gimple_cond_true_p (const gcond *gs)
3780 tree lhs = gimple_cond_lhs (gs);
3781 tree rhs = gimple_cond_rhs (gs);
3782 enum tree_code code = gimple_cond_code (gs);
3784 if (lhs != boolean_true_node && lhs != boolean_false_node)
3785 return false;
3787 if (rhs != boolean_true_node && rhs != boolean_false_node)
3788 return false;
3790 if (code == NE_EXPR && lhs != rhs)
3791 return true;
3793 if (code == EQ_EXPR && lhs == rhs)
3794 return true;
3796 return false;
3799 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3800 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3802 static inline bool
3803 gimple_cond_false_p (const gcond *gs)
3805 tree lhs = gimple_cond_lhs (gs);
3806 tree rhs = gimple_cond_rhs (gs);
3807 enum tree_code code = gimple_cond_code (gs);
3809 if (lhs != boolean_true_node && lhs != boolean_false_node)
3810 return false;
3812 if (rhs != boolean_true_node && rhs != boolean_false_node)
3813 return false;
3815 if (code == NE_EXPR && lhs == rhs)
3816 return true;
3818 if (code == EQ_EXPR && lhs != rhs)
3819 return true;
3821 return false;
3824 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3826 static inline void
3827 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3828 tree rhs)
3830 gimple_cond_set_code (stmt, code);
3831 gimple_cond_set_lhs (stmt, lhs);
3832 gimple_cond_set_rhs (stmt, rhs);
3836 /* Return the tree code for the expression computed by STMT. This is
3837 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3838 GIMPLE_CALL, return CALL_EXPR as the expression code for
3839 consistency. This is useful when the caller needs to deal with the
3840 three kinds of computation that GIMPLE supports. */
3842 static inline enum tree_code
3843 gimple_expr_code (const gimple *stmt)
3845 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3846 return gimple_assign_rhs_code (ass);
3847 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3848 return gimple_cond_code (cond);
3849 else
3851 gcc_gimple_checking_assert (gimple_code (stmt) == GIMPLE_CALL);
3852 return CALL_EXPR;
3857 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3859 static inline tree
3860 gimple_label_label (const glabel *gs)
3862 return gs->op[0];
3866 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3867 GS. */
3869 static inline void
3870 gimple_label_set_label (glabel *gs, tree label)
3872 gs->op[0] = label;
3876 /* Return the destination of the unconditional jump GS. */
3878 static inline tree
3879 gimple_goto_dest (const gimple *gs)
3881 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3882 return gimple_op (gs, 0);
3886 /* Set DEST to be the destination of the unconditonal jump GS. */
3888 static inline void
3889 gimple_goto_set_dest (ggoto *gs, tree dest)
3891 gs->op[0] = dest;
3895 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3897 static inline tree
3898 gimple_bind_vars (const gbind *bind_stmt)
3900 return bind_stmt->vars;
3904 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3905 statement GS. */
3907 static inline void
3908 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3910 bind_stmt->vars = vars;
3914 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3915 statement GS. */
3917 static inline void
3918 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3920 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3924 static inline gimple_seq *
3925 gimple_bind_body_ptr (gbind *bind_stmt)
3927 return &bind_stmt->body;
3930 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3932 static inline gimple_seq
3933 gimple_bind_body (const gbind *gs)
3935 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3939 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3940 statement GS. */
3942 static inline void
3943 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3945 bind_stmt->body = seq;
3949 /* Append a statement to the end of a GIMPLE_BIND's body. */
3951 static inline void
3952 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3954 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3958 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3960 static inline void
3961 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3963 gimple_seq_add_seq (&bind_stmt->body, seq);
3967 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3968 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3970 static inline tree
3971 gimple_bind_block (const gbind *bind_stmt)
3973 return bind_stmt->block;
3977 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3978 statement GS. */
3980 static inline void
3981 gimple_bind_set_block (gbind *bind_stmt, tree block)
3983 gcc_gimple_checking_assert (block == NULL_TREE
3984 || TREE_CODE (block) == BLOCK);
3985 bind_stmt->block = block;
3989 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3991 static inline unsigned
3992 gimple_asm_ninputs (const gasm *asm_stmt)
3994 return asm_stmt->ni;
3998 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4000 static inline unsigned
4001 gimple_asm_noutputs (const gasm *asm_stmt)
4003 return asm_stmt->no;
4007 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4009 static inline unsigned
4010 gimple_asm_nclobbers (const gasm *asm_stmt)
4012 return asm_stmt->nc;
4015 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4017 static inline unsigned
4018 gimple_asm_nlabels (const gasm *asm_stmt)
4020 return asm_stmt->nl;
4023 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4025 static inline tree
4026 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4028 gcc_gimple_checking_assert (index < asm_stmt->ni);
4029 return asm_stmt->op[index + asm_stmt->no];
4032 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4034 static inline void
4035 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4037 gcc_gimple_checking_assert (index < asm_stmt->ni
4038 && TREE_CODE (in_op) == TREE_LIST);
4039 asm_stmt->op[index + asm_stmt->no] = in_op;
4043 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4045 static inline tree
4046 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4048 gcc_gimple_checking_assert (index < asm_stmt->no);
4049 return asm_stmt->op[index];
4052 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4054 static inline void
4055 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4057 gcc_gimple_checking_assert (index < asm_stmt->no
4058 && TREE_CODE (out_op) == TREE_LIST);
4059 asm_stmt->op[index] = out_op;
4063 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4065 static inline tree
4066 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4068 gcc_gimple_checking_assert (index < asm_stmt->nc);
4069 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4073 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4075 static inline void
4076 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4078 gcc_gimple_checking_assert (index < asm_stmt->nc
4079 && TREE_CODE (clobber_op) == TREE_LIST);
4080 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4083 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4085 static inline tree
4086 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4088 gcc_gimple_checking_assert (index < asm_stmt->nl);
4089 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4092 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4094 static inline void
4095 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4097 gcc_gimple_checking_assert (index < asm_stmt->nl
4098 && TREE_CODE (label_op) == TREE_LIST);
4099 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4102 /* Return the string representing the assembly instruction in
4103 GIMPLE_ASM ASM_STMT. */
4105 static inline const char *
4106 gimple_asm_string (const gasm *asm_stmt)
4108 return asm_stmt->string;
4112 /* Return true if ASM_STMT is marked volatile. */
4114 static inline bool
4115 gimple_asm_volatile_p (const gasm *asm_stmt)
4117 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4121 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4123 static inline void
4124 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4126 if (volatile_p)
4127 asm_stmt->subcode |= GF_ASM_VOLATILE;
4128 else
4129 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4133 /* Return true if ASM_STMT is marked inline. */
4135 static inline bool
4136 gimple_asm_inline_p (const gasm *asm_stmt)
4138 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4142 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4144 static inline void
4145 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4147 if (inline_p)
4148 asm_stmt->subcode |= GF_ASM_INLINE;
4149 else
4150 asm_stmt->subcode &= ~GF_ASM_INLINE;
4154 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4156 static inline void
4157 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4159 if (input_p)
4160 asm_stmt->subcode |= GF_ASM_INPUT;
4161 else
4162 asm_stmt->subcode &= ~GF_ASM_INPUT;
4166 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4168 static inline bool
4169 gimple_asm_input_p (const gasm *asm_stmt)
4171 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4175 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4177 static inline tree
4178 gimple_catch_types (const gcatch *catch_stmt)
4180 return catch_stmt->types;
4184 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4186 static inline tree *
4187 gimple_catch_types_ptr (gcatch *catch_stmt)
4189 return &catch_stmt->types;
4193 /* Return a pointer to the GIMPLE sequence representing the body of
4194 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4196 static inline gimple_seq *
4197 gimple_catch_handler_ptr (gcatch *catch_stmt)
4199 return &catch_stmt->handler;
4203 /* Return the GIMPLE sequence representing the body of the handler of
4204 GIMPLE_CATCH statement CATCH_STMT. */
4206 static inline gimple_seq
4207 gimple_catch_handler (const gcatch *catch_stmt)
4209 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4213 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4215 static inline void
4216 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4218 catch_stmt->types = t;
4222 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4224 static inline void
4225 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4227 catch_stmt->handler = handler;
4231 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4233 static inline tree
4234 gimple_eh_filter_types (const gimple *gs)
4236 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4237 return eh_filter_stmt->types;
4241 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4242 GS. */
4244 static inline tree *
4245 gimple_eh_filter_types_ptr (gimple *gs)
4247 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4248 return &eh_filter_stmt->types;
4252 /* Return a pointer to the sequence of statement to execute when
4253 GIMPLE_EH_FILTER statement fails. */
4255 static inline gimple_seq *
4256 gimple_eh_filter_failure_ptr (gimple *gs)
4258 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4259 return &eh_filter_stmt->failure;
4263 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4264 statement fails. */
4266 static inline gimple_seq
4267 gimple_eh_filter_failure (const gimple *gs)
4269 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4273 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4274 EH_FILTER_STMT. */
4276 static inline void
4277 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4279 eh_filter_stmt->types = types;
4283 /* Set FAILURE to be the sequence of statements to execute on failure
4284 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4286 static inline void
4287 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4288 gimple_seq failure)
4290 eh_filter_stmt->failure = failure;
4293 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4295 static inline tree
4296 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4298 return eh_mnt_stmt->fndecl;
4301 /* Set the function decl to be called by GS to DECL. */
4303 static inline void
4304 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4305 tree decl)
4307 eh_mnt_stmt->fndecl = decl;
4310 /* GIMPLE_EH_ELSE accessors. */
4312 static inline gimple_seq *
4313 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4315 return &eh_else_stmt->n_body;
4318 static inline gimple_seq
4319 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4321 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4324 static inline gimple_seq *
4325 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4327 return &eh_else_stmt->e_body;
4330 static inline gimple_seq
4331 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4333 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4336 static inline void
4337 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4339 eh_else_stmt->n_body = seq;
4342 static inline void
4343 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4345 eh_else_stmt->e_body = seq;
4348 /* GIMPLE_TRY accessors. */
4350 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4351 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4353 static inline enum gimple_try_flags
4354 gimple_try_kind (const gimple *gs)
4356 GIMPLE_CHECK (gs, GIMPLE_TRY);
4357 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4361 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4363 static inline void
4364 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4366 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4367 || kind == GIMPLE_TRY_FINALLY);
4368 if (gimple_try_kind (gs) != kind)
4369 gs->subcode = (unsigned int) kind;
4373 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4375 static inline bool
4376 gimple_try_catch_is_cleanup (const gimple *gs)
4378 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4379 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4383 /* Return a pointer to the sequence of statements used as the
4384 body for GIMPLE_TRY GS. */
4386 static inline gimple_seq *
4387 gimple_try_eval_ptr (gimple *gs)
4389 gtry *try_stmt = as_a <gtry *> (gs);
4390 return &try_stmt->eval;
4394 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4396 static inline gimple_seq
4397 gimple_try_eval (const gimple *gs)
4399 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4403 /* Return a pointer to the sequence of statements used as the cleanup body for
4404 GIMPLE_TRY GS. */
4406 static inline gimple_seq *
4407 gimple_try_cleanup_ptr (gimple *gs)
4409 gtry *try_stmt = as_a <gtry *> (gs);
4410 return &try_stmt->cleanup;
4414 /* Return the sequence of statements used as the cleanup body for
4415 GIMPLE_TRY GS. */
4417 static inline gimple_seq
4418 gimple_try_cleanup (const gimple *gs)
4420 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4424 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4426 static inline void
4427 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4429 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4430 if (catch_is_cleanup)
4431 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4432 else
4433 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4437 /* Set EVAL to be the sequence of statements to use as the body for
4438 GIMPLE_TRY TRY_STMT. */
4440 static inline void
4441 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4443 try_stmt->eval = eval;
4447 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4448 body for GIMPLE_TRY TRY_STMT. */
4450 static inline void
4451 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4453 try_stmt->cleanup = cleanup;
4457 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4459 static inline gimple_seq *
4460 gimple_wce_cleanup_ptr (gimple *gs)
4462 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4463 return &wce_stmt->cleanup;
4467 /* Return the cleanup sequence for cleanup statement GS. */
4469 static inline gimple_seq
4470 gimple_wce_cleanup (gimple *gs)
4472 return *gimple_wce_cleanup_ptr (gs);
4476 /* Set CLEANUP to be the cleanup sequence for GS. */
4478 static inline void
4479 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4481 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4482 wce_stmt->cleanup = cleanup;
4486 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4488 static inline bool
4489 gimple_wce_cleanup_eh_only (const gimple *gs)
4491 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4492 return gs->subcode != 0;
4496 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4498 static inline void
4499 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4501 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4502 gs->subcode = (unsigned int) eh_only_p;
4506 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4508 static inline unsigned
4509 gimple_phi_capacity (const gimple *gs)
4511 const gphi *phi_stmt = as_a <const gphi *> (gs);
4512 return phi_stmt->capacity;
4516 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4517 be exactly the number of incoming edges for the basic block holding
4518 GS. */
4520 static inline unsigned
4521 gimple_phi_num_args (const gimple *gs)
4523 const gphi *phi_stmt = as_a <const gphi *> (gs);
4524 return phi_stmt->nargs;
4528 /* Return the SSA name created by GIMPLE_PHI GS. */
4530 static inline tree
4531 gimple_phi_result (const gphi *gs)
4533 return gs->result;
4536 static inline tree
4537 gimple_phi_result (const gimple *gs)
4539 const gphi *phi_stmt = as_a <const gphi *> (gs);
4540 return gimple_phi_result (phi_stmt);
4543 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4545 static inline tree *
4546 gimple_phi_result_ptr (gphi *gs)
4548 return &gs->result;
4551 static inline tree *
4552 gimple_phi_result_ptr (gimple *gs)
4554 gphi *phi_stmt = as_a <gphi *> (gs);
4555 return gimple_phi_result_ptr (phi_stmt);
4558 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4560 static inline void
4561 gimple_phi_set_result (gphi *phi, tree result)
4563 phi->result = result;
4564 if (result && TREE_CODE (result) == SSA_NAME)
4565 SSA_NAME_DEF_STMT (result) = phi;
4569 /* Return the PHI argument corresponding to incoming edge INDEX for
4570 GIMPLE_PHI GS. */
4572 static inline struct phi_arg_d *
4573 gimple_phi_arg (gphi *gs, unsigned index)
4575 gcc_gimple_checking_assert (index < gs->nargs);
4576 return &(gs->args[index]);
4579 static inline const phi_arg_d *
4580 gimple_phi_arg (const gphi *gs, unsigned index)
4582 gcc_gimple_checking_assert (index < gs->nargs);
4583 return &(gs->args[index]);
4586 static inline struct phi_arg_d *
4587 gimple_phi_arg (gimple *gs, unsigned index)
4589 gphi *phi_stmt = as_a <gphi *> (gs);
4590 return gimple_phi_arg (phi_stmt, index);
4593 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4594 for GIMPLE_PHI PHI. */
4596 static inline void
4597 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4599 gcc_gimple_checking_assert (index < phi->nargs);
4600 phi->args[index] = *phiarg;
4603 /* Return the PHI nodes for basic block BB, or NULL if there are no
4604 PHI nodes. */
4606 static inline gimple_seq
4607 phi_nodes (const_basic_block bb)
4609 gcc_checking_assert (!(bb->flags & BB_RTL));
4610 return bb->il.gimple.phi_nodes;
4613 /* Return a pointer to the PHI nodes for basic block BB. */
4615 static inline gimple_seq *
4616 phi_nodes_ptr (basic_block bb)
4618 gcc_checking_assert (!(bb->flags & BB_RTL));
4619 return &bb->il.gimple.phi_nodes;
4622 /* Return the tree operand for argument I of PHI node GS. */
4624 static inline tree
4625 gimple_phi_arg_def (const gphi *gs, size_t index)
4627 return gimple_phi_arg (gs, index)->def;
4630 static inline tree
4631 gimple_phi_arg_def (gimple *gs, size_t index)
4633 return gimple_phi_arg (gs, index)->def;
4637 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4639 static inline tree *
4640 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4642 return &gimple_phi_arg (phi, index)->def;
4645 /* Return the edge associated with argument I of phi node PHI. */
4647 static inline edge
4648 gimple_phi_arg_edge (const gphi *phi, size_t i)
4650 return EDGE_PRED (gimple_bb (phi), i);
4653 /* Return the source location of gimple argument I of phi node PHI. */
4655 static inline location_t
4656 gimple_phi_arg_location (const gphi *phi, size_t i)
4658 return gimple_phi_arg (phi, i)->locus;
4661 /* Return the source location of the argument on edge E of phi node PHI. */
4663 static inline location_t
4664 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4666 return gimple_phi_arg (phi, e->dest_idx)->locus;
4669 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4671 static inline void
4672 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4674 gimple_phi_arg (phi, i)->locus = loc;
4677 /* Return address of source location of gimple argument I of phi node PHI. */
4679 static inline location_t *
4680 gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4682 return &gimple_phi_arg (phi, i)->locus;
4685 /* Return TRUE if argument I of phi node PHI has a location record. */
4687 static inline bool
4688 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4690 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4694 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4696 static inline int
4697 gimple_resx_region (const gresx *resx_stmt)
4699 return resx_stmt->region;
4702 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4704 static inline void
4705 gimple_resx_set_region (gresx *resx_stmt, int region)
4707 resx_stmt->region = region;
4710 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4712 static inline int
4713 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4715 return eh_dispatch_stmt->region;
4718 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4719 EH_DISPATCH_STMT. */
4721 static inline void
4722 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4724 eh_dispatch_stmt->region = region;
4727 /* Return the number of labels associated with the switch statement GS. */
4729 static inline unsigned
4730 gimple_switch_num_labels (const gswitch *gs)
4732 unsigned num_ops;
4733 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4734 num_ops = gimple_num_ops (gs);
4735 gcc_gimple_checking_assert (num_ops > 1);
4736 return num_ops - 1;
4740 /* Set NLABELS to be the number of labels for the switch statement GS. */
4742 static inline void
4743 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4745 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4746 gimple_set_num_ops (g, nlabels + 1);
4750 /* Return the index variable used by the switch statement GS. */
4752 static inline tree
4753 gimple_switch_index (const gswitch *gs)
4755 return gs->op[0];
4759 /* Return a pointer to the index variable for the switch statement GS. */
4761 static inline tree *
4762 gimple_switch_index_ptr (gswitch *gs)
4764 return &gs->op[0];
4768 /* Set INDEX to be the index variable for switch statement GS. */
4770 static inline void
4771 gimple_switch_set_index (gswitch *gs, tree index)
4773 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4774 gs->op[0] = index;
4778 /* Return the label numbered INDEX. The default label is 0, followed by any
4779 labels in a switch statement. */
4781 static inline tree
4782 gimple_switch_label (const gswitch *gs, unsigned index)
4784 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4785 return gs->op[index + 1];
4788 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4790 static inline void
4791 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4793 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4794 && (label == NULL_TREE
4795 || TREE_CODE (label) == CASE_LABEL_EXPR));
4796 gs->op[index + 1] = label;
4799 /* Return the default label for a switch statement. */
4801 static inline tree
4802 gimple_switch_default_label (const gswitch *gs)
4804 tree label = gimple_switch_label (gs, 0);
4805 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4806 return label;
4809 /* Set the default label for a switch statement. */
4811 static inline void
4812 gimple_switch_set_default_label (gswitch *gs, tree label)
4814 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4815 gimple_switch_set_label (gs, 0, label);
4818 /* Return true if GS is a GIMPLE_DEBUG statement. */
4820 static inline bool
4821 is_gimple_debug (const gimple *gs)
4823 return gimple_code (gs) == GIMPLE_DEBUG;
4827 /* Return the first nondebug statement in GIMPLE sequence S. */
4829 static inline gimple *
4830 gimple_seq_first_nondebug_stmt (gimple_seq s)
4832 gimple_seq_node n = gimple_seq_first (s);
4833 while (n && is_gimple_debug (n))
4834 n = n->next;
4835 return n;
4839 /* Return the last nondebug statement in GIMPLE sequence S. */
4841 static inline gimple *
4842 gimple_seq_last_nondebug_stmt (gimple_seq s)
4844 gimple_seq_node n;
4845 for (n = gimple_seq_last (s);
4846 n && is_gimple_debug (n);
4847 n = n->prev)
4848 if (n == s)
4849 return NULL;
4850 return n;
4854 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4856 static inline bool
4857 gimple_debug_bind_p (const gimple *s)
4859 if (is_gimple_debug (s))
4860 return s->subcode == GIMPLE_DEBUG_BIND;
4862 return false;
4865 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4867 static inline tree
4868 gimple_debug_bind_get_var (const gimple *dbg)
4870 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4871 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4872 return gimple_op (dbg, 0);
4875 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4876 statement. */
4878 static inline tree
4879 gimple_debug_bind_get_value (const gimple *dbg)
4881 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4882 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4883 return gimple_op (dbg, 1);
4886 /* Return a pointer to the value bound to the variable in a
4887 GIMPLE_DEBUG bind statement. */
4889 static inline tree *
4890 gimple_debug_bind_get_value_ptr (gimple *dbg)
4892 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4893 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4894 return gimple_op_ptr (dbg, 1);
4897 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4899 static inline void
4900 gimple_debug_bind_set_var (gimple *dbg, tree var)
4902 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4903 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4904 gimple_set_op (dbg, 0, var);
4907 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4908 statement. */
4910 static inline void
4911 gimple_debug_bind_set_value (gimple *dbg, tree value)
4913 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4914 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4915 gimple_set_op (dbg, 1, value);
4918 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4919 optimized away. */
4920 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4922 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4923 statement. */
4925 static inline void
4926 gimple_debug_bind_reset_value (gimple *dbg)
4928 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4929 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4930 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4933 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4934 value. */
4936 static inline bool
4937 gimple_debug_bind_has_value_p (gimple *dbg)
4939 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4940 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4941 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4944 #undef GIMPLE_DEBUG_BIND_NOVALUE
4946 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4948 static inline bool
4949 gimple_debug_source_bind_p (const gimple *s)
4951 if (is_gimple_debug (s))
4952 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4954 return false;
4957 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4959 static inline tree
4960 gimple_debug_source_bind_get_var (const gimple *dbg)
4962 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4963 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4964 return gimple_op (dbg, 0);
4967 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4968 statement. */
4970 static inline tree
4971 gimple_debug_source_bind_get_value (const gimple *dbg)
4973 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4974 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4975 return gimple_op (dbg, 1);
4978 /* Return a pointer to the value bound to the variable in a
4979 GIMPLE_DEBUG source bind statement. */
4981 static inline tree *
4982 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4984 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4985 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4986 return gimple_op_ptr (dbg, 1);
4989 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4991 static inline void
4992 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4994 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4995 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4996 gimple_set_op (dbg, 0, var);
4999 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5000 statement. */
5002 static inline void
5003 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
5005 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5006 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5007 gimple_set_op (dbg, 1, value);
5010 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5012 static inline bool
5013 gimple_debug_begin_stmt_p (const gimple *s)
5015 if (is_gimple_debug (s))
5016 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
5018 return false;
5021 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5023 static inline bool
5024 gimple_debug_inline_entry_p (const gimple *s)
5026 if (is_gimple_debug (s))
5027 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5029 return false;
5032 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5034 static inline bool
5035 gimple_debug_nonbind_marker_p (const gimple *s)
5037 if (is_gimple_debug (s))
5038 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5039 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5041 return false;
5044 /* Return the line number for EXPR, or return -1 if we have no line
5045 number information for it. */
5046 static inline int
5047 get_lineno (const gimple *stmt)
5049 location_t loc;
5051 if (!stmt)
5052 return -1;
5054 loc = gimple_location (stmt);
5055 if (loc == UNKNOWN_LOCATION)
5056 return -1;
5058 return LOCATION_LINE (loc);
5061 /* Return a pointer to the body for the OMP statement GS. */
5063 static inline gimple_seq *
5064 gimple_omp_body_ptr (gimple *gs)
5066 return &static_cast <gimple_statement_omp *> (gs)->body;
5069 /* Return the body for the OMP statement GS. */
5071 static inline gimple_seq
5072 gimple_omp_body (const gimple *gs)
5074 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
5077 /* Set BODY to be the body for the OMP statement GS. */
5079 static inline void
5080 gimple_omp_set_body (gimple *gs, gimple_seq body)
5082 static_cast <gimple_statement_omp *> (gs)->body = body;
5086 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5088 static inline tree
5089 gimple_omp_critical_name (const gomp_critical *crit_stmt)
5091 return crit_stmt->name;
5095 /* Return a pointer to the name associated with OMP critical statement
5096 CRIT_STMT. */
5098 static inline tree *
5099 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5101 return &crit_stmt->name;
5105 /* Set NAME to be the name associated with OMP critical statement
5106 CRIT_STMT. */
5108 static inline void
5109 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5111 crit_stmt->name = name;
5115 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5117 static inline tree
5118 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5120 return crit_stmt->clauses;
5124 /* Return a pointer to the clauses associated with OMP critical statement
5125 CRIT_STMT. */
5127 static inline tree *
5128 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5130 return &crit_stmt->clauses;
5134 /* Set CLAUSES to be the clauses associated with OMP critical statement
5135 CRIT_STMT. */
5137 static inline void
5138 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5140 crit_stmt->clauses = clauses;
5144 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5146 static inline tree
5147 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5149 return ord_stmt->clauses;
5153 /* Return a pointer to the clauses associated with OMP ordered statement
5154 ORD_STMT. */
5156 static inline tree *
5157 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5159 return &ord_stmt->clauses;
5163 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5164 ORD_STMT. */
5166 static inline void
5167 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5169 ord_stmt->clauses = clauses;
5173 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5175 static inline tree
5176 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5178 return scan_stmt->clauses;
5182 /* Return a pointer to the clauses associated with OMP scan statement
5183 ORD_STMT. */
5185 static inline tree *
5186 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5188 return &scan_stmt->clauses;
5192 /* Set CLAUSES to be the clauses associated with OMP scan statement
5193 ORD_STMT. */
5195 static inline void
5196 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5198 scan_stmt->clauses = clauses;
5202 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5204 static inline tree
5205 gimple_omp_taskgroup_clauses (const gimple *gs)
5207 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5208 return
5209 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5213 /* Return a pointer to the clauses associated with OMP taskgroup statement
5214 GS. */
5216 static inline tree *
5217 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5219 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5220 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5224 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5225 GS. */
5227 static inline void
5228 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5230 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5231 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5232 = clauses;
5236 /* Return the clauses associated with OMP_MASKED statement GS. */
5238 static inline tree
5239 gimple_omp_masked_clauses (const gimple *gs)
5241 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5242 return
5243 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5247 /* Return a pointer to the clauses associated with OMP masked statement
5248 GS. */
5250 static inline tree *
5251 gimple_omp_masked_clauses_ptr (gimple *gs)
5253 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5254 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5258 /* Set CLAUSES to be the clauses associated with OMP masked statement
5259 GS. */
5261 static inline void
5262 gimple_omp_masked_set_clauses (gimple *gs, tree clauses)
5264 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5265 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5266 = clauses;
5270 /* Return the clauses associated with OMP_SCOPE statement GS. */
5272 static inline tree
5273 gimple_omp_scope_clauses (const gimple *gs)
5275 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5276 return
5277 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5281 /* Return a pointer to the clauses associated with OMP scope statement
5282 GS. */
5284 static inline tree *
5285 gimple_omp_scope_clauses_ptr (gimple *gs)
5287 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5288 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5292 /* Set CLAUSES to be the clauses associated with OMP scope statement
5293 GS. */
5295 static inline void
5296 gimple_omp_scope_set_clauses (gimple *gs, tree clauses)
5298 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5299 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5300 = clauses;
5304 /* Return the kind of the OMP_FOR statemement G. */
5306 static inline int
5307 gimple_omp_for_kind (const gimple *g)
5309 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5310 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5314 /* Set the kind of the OMP_FOR statement G. */
5316 static inline void
5317 gimple_omp_for_set_kind (gomp_for *g, int kind)
5319 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5320 | (kind & GF_OMP_FOR_KIND_MASK);
5324 /* Return true if OMP_FOR statement G has the
5325 GF_OMP_FOR_COMBINED flag set. */
5327 static inline bool
5328 gimple_omp_for_combined_p (const gimple *g)
5330 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5331 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5335 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5336 the boolean value of COMBINED_P. */
5338 static inline void
5339 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5341 if (combined_p)
5342 g->subcode |= GF_OMP_FOR_COMBINED;
5343 else
5344 g->subcode &= ~GF_OMP_FOR_COMBINED;
5348 /* Return true if the OMP_FOR statement G has the
5349 GF_OMP_FOR_COMBINED_INTO flag set. */
5351 static inline bool
5352 gimple_omp_for_combined_into_p (const gimple *g)
5354 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5355 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5359 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5360 on the boolean value of COMBINED_P. */
5362 static inline void
5363 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5365 if (combined_p)
5366 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5367 else
5368 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5372 /* Return the clauses associated with the OMP_FOR statement GS. */
5374 static inline tree
5375 gimple_omp_for_clauses (const gimple *gs)
5377 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5378 return omp_for_stmt->clauses;
5382 /* Return a pointer to the clauses associated with the OMP_FOR statement
5383 GS. */
5385 static inline tree *
5386 gimple_omp_for_clauses_ptr (gimple *gs)
5388 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5389 return &omp_for_stmt->clauses;
5393 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5394 GS. */
5396 static inline void
5397 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5399 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5400 omp_for_stmt->clauses = clauses;
5404 /* Get the collapse count of the OMP_FOR statement GS. */
5406 static inline size_t
5407 gimple_omp_for_collapse (const gimple *gs)
5409 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5410 return omp_for_stmt->collapse;
5414 /* Return the condition code associated with the OMP_FOR statement GS. */
5416 static inline enum tree_code
5417 gimple_omp_for_cond (const gimple *gs, size_t i)
5419 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5420 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5421 return omp_for_stmt->iter[i].cond;
5425 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5427 static inline void
5428 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5430 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5431 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5432 && i < omp_for_stmt->collapse);
5433 omp_for_stmt->iter[i].cond = cond;
5437 /* Return the index variable for the OMP_FOR statement GS. */
5439 static inline tree
5440 gimple_omp_for_index (const gimple *gs, size_t i)
5442 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5443 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5444 return omp_for_stmt->iter[i].index;
5448 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5450 static inline tree *
5451 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5453 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5454 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5455 return &omp_for_stmt->iter[i].index;
5459 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5461 static inline void
5462 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5464 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5465 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5466 omp_for_stmt->iter[i].index = index;
5470 /* Return the initial value for the OMP_FOR statement GS. */
5472 static inline tree
5473 gimple_omp_for_initial (const gimple *gs, size_t i)
5475 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5476 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5477 return omp_for_stmt->iter[i].initial;
5481 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5483 static inline tree *
5484 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5486 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5487 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5488 return &omp_for_stmt->iter[i].initial;
5492 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5494 static inline void
5495 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5497 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5498 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5499 omp_for_stmt->iter[i].initial = initial;
5503 /* Return the final value for the OMP_FOR statement GS. */
5505 static inline tree
5506 gimple_omp_for_final (const gimple *gs, size_t i)
5508 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5509 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5510 return omp_for_stmt->iter[i].final;
5514 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5516 static inline tree *
5517 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5519 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5520 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5521 return &omp_for_stmt->iter[i].final;
5525 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5527 static inline void
5528 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5530 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5531 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5532 omp_for_stmt->iter[i].final = final;
5536 /* Return the increment value for the OMP_FOR statement GS. */
5538 static inline tree
5539 gimple_omp_for_incr (const gimple *gs, size_t i)
5541 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5542 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5543 return omp_for_stmt->iter[i].incr;
5547 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5549 static inline tree *
5550 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5552 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5553 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5554 return &omp_for_stmt->iter[i].incr;
5558 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5560 static inline void
5561 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5563 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5564 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5565 omp_for_stmt->iter[i].incr = incr;
5569 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5570 statement GS starts. */
5572 static inline gimple_seq *
5573 gimple_omp_for_pre_body_ptr (gimple *gs)
5575 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5576 return &omp_for_stmt->pre_body;
5580 /* Return the sequence of statements to execute before the OMP_FOR
5581 statement GS starts. */
5583 static inline gimple_seq
5584 gimple_omp_for_pre_body (const gimple *gs)
5586 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5590 /* Set PRE_BODY to be the sequence of statements to execute before the
5591 OMP_FOR statement GS starts. */
5593 static inline void
5594 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5596 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5597 omp_for_stmt->pre_body = pre_body;
5600 /* Return the clauses associated with OMP_PARALLEL GS. */
5602 static inline tree
5603 gimple_omp_parallel_clauses (const gimple *gs)
5605 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5606 return omp_parallel_stmt->clauses;
5610 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5612 static inline tree *
5613 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5615 return &omp_parallel_stmt->clauses;
5619 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5621 static inline void
5622 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5623 tree clauses)
5625 omp_parallel_stmt->clauses = clauses;
5629 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5631 static inline tree
5632 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5634 return omp_parallel_stmt->child_fn;
5637 /* Return a pointer to the child function used to hold the body of
5638 OMP_PARALLEL_STMT. */
5640 static inline tree *
5641 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5643 return &omp_parallel_stmt->child_fn;
5647 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5649 static inline void
5650 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5651 tree child_fn)
5653 omp_parallel_stmt->child_fn = child_fn;
5657 /* Return the artificial argument used to send variables and values
5658 from the parent to the children threads in OMP_PARALLEL_STMT. */
5660 static inline tree
5661 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5663 return omp_parallel_stmt->data_arg;
5667 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5669 static inline tree *
5670 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5672 return &omp_parallel_stmt->data_arg;
5676 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5678 static inline void
5679 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5680 tree data_arg)
5682 omp_parallel_stmt->data_arg = data_arg;
5685 /* Return the clauses associated with OMP_TASK GS. */
5687 static inline tree
5688 gimple_omp_task_clauses (const gimple *gs)
5690 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5691 return omp_task_stmt->clauses;
5695 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5697 static inline tree *
5698 gimple_omp_task_clauses_ptr (gimple *gs)
5700 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5701 return &omp_task_stmt->clauses;
5705 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5706 GS. */
5708 static inline void
5709 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5711 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5712 omp_task_stmt->clauses = clauses;
5716 /* Return true if OMP task statement G has the
5717 GF_OMP_TASK_TASKLOOP flag set. */
5719 static inline bool
5720 gimple_omp_task_taskloop_p (const gimple *g)
5722 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5723 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5727 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5728 value of TASKLOOP_P. */
5730 static inline void
5731 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5733 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5734 if (taskloop_p)
5735 g->subcode |= GF_OMP_TASK_TASKLOOP;
5736 else
5737 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5741 /* Return true if OMP task statement G has the
5742 GF_OMP_TASK_TASKWAIT flag set. */
5744 static inline bool
5745 gimple_omp_task_taskwait_p (const gimple *g)
5747 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5748 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5752 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5753 value of TASKWAIT_P. */
5755 static inline void
5756 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5758 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5759 if (taskwait_p)
5760 g->subcode |= GF_OMP_TASK_TASKWAIT;
5761 else
5762 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5766 /* Return the child function used to hold the body of OMP_TASK GS. */
5768 static inline tree
5769 gimple_omp_task_child_fn (const gimple *gs)
5771 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5772 return omp_task_stmt->child_fn;
5775 /* Return a pointer to the child function used to hold the body of
5776 OMP_TASK GS. */
5778 static inline tree *
5779 gimple_omp_task_child_fn_ptr (gimple *gs)
5781 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5782 return &omp_task_stmt->child_fn;
5786 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5788 static inline void
5789 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5791 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5792 omp_task_stmt->child_fn = child_fn;
5796 /* Return the artificial argument used to send variables and values
5797 from the parent to the children threads in OMP_TASK GS. */
5799 static inline tree
5800 gimple_omp_task_data_arg (const gimple *gs)
5802 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5803 return omp_task_stmt->data_arg;
5807 /* Return a pointer to the data argument for OMP_TASK GS. */
5809 static inline tree *
5810 gimple_omp_task_data_arg_ptr (gimple *gs)
5812 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5813 return &omp_task_stmt->data_arg;
5817 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5819 static inline void
5820 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5822 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5823 omp_task_stmt->data_arg = data_arg;
5827 /* Return the clauses associated with OMP_TASK GS. */
5829 static inline tree
5830 gimple_omp_taskreg_clauses (const gimple *gs)
5832 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5833 = as_a <const gimple_statement_omp_taskreg *> (gs);
5834 return omp_taskreg_stmt->clauses;
5838 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5840 static inline tree *
5841 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5843 gimple_statement_omp_taskreg *omp_taskreg_stmt
5844 = as_a <gimple_statement_omp_taskreg *> (gs);
5845 return &omp_taskreg_stmt->clauses;
5849 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5850 GS. */
5852 static inline void
5853 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5855 gimple_statement_omp_taskreg *omp_taskreg_stmt
5856 = as_a <gimple_statement_omp_taskreg *> (gs);
5857 omp_taskreg_stmt->clauses = clauses;
5861 /* Return the child function used to hold the body of OMP_TASK GS. */
5863 static inline tree
5864 gimple_omp_taskreg_child_fn (const gimple *gs)
5866 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5867 = as_a <const gimple_statement_omp_taskreg *> (gs);
5868 return omp_taskreg_stmt->child_fn;
5871 /* Return a pointer to the child function used to hold the body of
5872 OMP_TASK GS. */
5874 static inline tree *
5875 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5877 gimple_statement_omp_taskreg *omp_taskreg_stmt
5878 = as_a <gimple_statement_omp_taskreg *> (gs);
5879 return &omp_taskreg_stmt->child_fn;
5883 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5885 static inline void
5886 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5888 gimple_statement_omp_taskreg *omp_taskreg_stmt
5889 = as_a <gimple_statement_omp_taskreg *> (gs);
5890 omp_taskreg_stmt->child_fn = child_fn;
5894 /* Return the artificial argument used to send variables and values
5895 from the parent to the children threads in OMP_TASK GS. */
5897 static inline tree
5898 gimple_omp_taskreg_data_arg (const gimple *gs)
5900 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5901 = as_a <const gimple_statement_omp_taskreg *> (gs);
5902 return omp_taskreg_stmt->data_arg;
5906 /* Return a pointer to the data argument for OMP_TASK GS. */
5908 static inline tree *
5909 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5911 gimple_statement_omp_taskreg *omp_taskreg_stmt
5912 = as_a <gimple_statement_omp_taskreg *> (gs);
5913 return &omp_taskreg_stmt->data_arg;
5917 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5919 static inline void
5920 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5922 gimple_statement_omp_taskreg *omp_taskreg_stmt
5923 = as_a <gimple_statement_omp_taskreg *> (gs);
5924 omp_taskreg_stmt->data_arg = data_arg;
5928 /* Return the copy function used to hold the body of OMP_TASK GS. */
5930 static inline tree
5931 gimple_omp_task_copy_fn (const gimple *gs)
5933 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5934 return omp_task_stmt->copy_fn;
5937 /* Return a pointer to the copy function used to hold the body of
5938 OMP_TASK GS. */
5940 static inline tree *
5941 gimple_omp_task_copy_fn_ptr (gimple *gs)
5943 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5944 return &omp_task_stmt->copy_fn;
5948 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5950 static inline void
5951 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5953 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5954 omp_task_stmt->copy_fn = copy_fn;
5958 /* Return size of the data block in bytes in OMP_TASK GS. */
5960 static inline tree
5961 gimple_omp_task_arg_size (const gimple *gs)
5963 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5964 return omp_task_stmt->arg_size;
5968 /* Return a pointer to the data block size for OMP_TASK GS. */
5970 static inline tree *
5971 gimple_omp_task_arg_size_ptr (gimple *gs)
5973 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5974 return &omp_task_stmt->arg_size;
5978 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5980 static inline void
5981 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5983 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5984 omp_task_stmt->arg_size = arg_size;
5988 /* Return align of the data block in bytes in OMP_TASK GS. */
5990 static inline tree
5991 gimple_omp_task_arg_align (const gimple *gs)
5993 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5994 return omp_task_stmt->arg_align;
5998 /* Return a pointer to the data block align for OMP_TASK GS. */
6000 static inline tree *
6001 gimple_omp_task_arg_align_ptr (gimple *gs)
6003 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6004 return &omp_task_stmt->arg_align;
6008 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
6010 static inline void
6011 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
6013 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6014 omp_task_stmt->arg_align = arg_align;
6018 /* Return the clauses associated with OMP_SINGLE GS. */
6020 static inline tree
6021 gimple_omp_single_clauses (const gimple *gs)
6023 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
6024 return omp_single_stmt->clauses;
6028 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
6030 static inline tree *
6031 gimple_omp_single_clauses_ptr (gimple *gs)
6033 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
6034 return &omp_single_stmt->clauses;
6038 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
6040 static inline void
6041 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
6043 omp_single_stmt->clauses = clauses;
6047 /* Return the clauses associated with OMP_TARGET GS. */
6049 static inline tree
6050 gimple_omp_target_clauses (const gimple *gs)
6052 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
6053 return omp_target_stmt->clauses;
6057 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
6059 static inline tree *
6060 gimple_omp_target_clauses_ptr (gimple *gs)
6062 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
6063 return &omp_target_stmt->clauses;
6067 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6069 static inline void
6070 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
6071 tree clauses)
6073 omp_target_stmt->clauses = clauses;
6077 /* Return the kind of the OMP_TARGET G. */
6079 static inline int
6080 gimple_omp_target_kind (const gimple *g)
6082 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
6083 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
6087 /* Set the kind of the OMP_TARGET G. */
6089 static inline void
6090 gimple_omp_target_set_kind (gomp_target *g, int kind)
6092 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6093 | (kind & GF_OMP_TARGET_KIND_MASK);
6097 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6099 static inline tree
6100 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6102 return omp_target_stmt->child_fn;
6105 /* Return a pointer to the child function used to hold the body of
6106 OMP_TARGET_STMT. */
6108 static inline tree *
6109 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6111 return &omp_target_stmt->child_fn;
6115 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6117 static inline void
6118 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6119 tree child_fn)
6121 omp_target_stmt->child_fn = child_fn;
6125 /* Return the artificial argument used to send variables and values
6126 from the parent to the children threads in OMP_TARGET_STMT. */
6128 static inline tree
6129 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6131 return omp_target_stmt->data_arg;
6135 /* Return a pointer to the data argument for OMP_TARGET GS. */
6137 static inline tree *
6138 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6140 return &omp_target_stmt->data_arg;
6144 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6146 static inline void
6147 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6148 tree data_arg)
6150 omp_target_stmt->data_arg = data_arg;
6154 /* Return the clauses associated with OMP_TEAMS GS. */
6156 static inline tree
6157 gimple_omp_teams_clauses (const gimple *gs)
6159 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6160 return omp_teams_stmt->clauses;
6164 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6166 static inline tree *
6167 gimple_omp_teams_clauses_ptr (gimple *gs)
6169 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6170 return &omp_teams_stmt->clauses;
6174 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6176 static inline void
6177 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6179 omp_teams_stmt->clauses = clauses;
6182 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6184 static inline tree
6185 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6187 return omp_teams_stmt->child_fn;
6190 /* Return a pointer to the child function used to hold the body of
6191 OMP_TEAMS_STMT. */
6193 static inline tree *
6194 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6196 return &omp_teams_stmt->child_fn;
6200 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6202 static inline void
6203 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6205 omp_teams_stmt->child_fn = child_fn;
6209 /* Return the artificial argument used to send variables and values
6210 from the parent to the children threads in OMP_TEAMS_STMT. */
6212 static inline tree
6213 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6215 return omp_teams_stmt->data_arg;
6219 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6221 static inline tree *
6222 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6224 return &omp_teams_stmt->data_arg;
6228 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6230 static inline void
6231 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6233 omp_teams_stmt->data_arg = data_arg;
6236 /* Return the host flag of an OMP_TEAMS_STMT. */
6238 static inline bool
6239 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6241 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6244 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6246 static inline void
6247 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6249 if (value)
6250 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6251 else
6252 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6255 /* Return the clauses associated with OMP_SECTIONS GS. */
6257 static inline tree
6258 gimple_omp_sections_clauses (const gimple *gs)
6260 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6261 return omp_sections_stmt->clauses;
6265 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6267 static inline tree *
6268 gimple_omp_sections_clauses_ptr (gimple *gs)
6270 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6271 return &omp_sections_stmt->clauses;
6275 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6276 GS. */
6278 static inline void
6279 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6281 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6282 omp_sections_stmt->clauses = clauses;
6286 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6287 in GS. */
6289 static inline tree
6290 gimple_omp_sections_control (const gimple *gs)
6292 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6293 return omp_sections_stmt->control;
6297 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6298 GS. */
6300 static inline tree *
6301 gimple_omp_sections_control_ptr (gimple *gs)
6303 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6304 return &omp_sections_stmt->control;
6308 /* Set CONTROL to be the set of clauses associated with the
6309 GIMPLE_OMP_SECTIONS in GS. */
6311 static inline void
6312 gimple_omp_sections_set_control (gimple *gs, tree control)
6314 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6315 omp_sections_stmt->control = control;
6319 /* Set the value being stored in an atomic store. */
6321 static inline void
6322 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6324 store_stmt->val = val;
6328 /* Return the value being stored in an atomic store. */
6330 static inline tree
6331 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6333 return store_stmt->val;
6337 /* Return a pointer to the value being stored in an atomic store. */
6339 static inline tree *
6340 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6342 return &store_stmt->val;
6346 /* Set the LHS of an atomic load. */
6348 static inline void
6349 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6351 load_stmt->lhs = lhs;
6355 /* Get the LHS of an atomic load. */
6357 static inline tree
6358 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6360 return load_stmt->lhs;
6364 /* Return a pointer to the LHS of an atomic load. */
6366 static inline tree *
6367 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6369 return &load_stmt->lhs;
6373 /* Set the RHS of an atomic load. */
6375 static inline void
6376 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6378 load_stmt->rhs = rhs;
6382 /* Get the RHS of an atomic load. */
6384 static inline tree
6385 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6387 return load_stmt->rhs;
6391 /* Return a pointer to the RHS of an atomic load. */
6393 static inline tree *
6394 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6396 return &load_stmt->rhs;
6400 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6402 static inline tree
6403 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6405 return cont_stmt->control_def;
6408 /* The same as above, but return the address. */
6410 static inline tree *
6411 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6413 return &cont_stmt->control_def;
6416 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6418 static inline void
6419 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6421 cont_stmt->control_def = def;
6425 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6427 static inline tree
6428 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6430 return cont_stmt->control_use;
6434 /* The same as above, but return the address. */
6436 static inline tree *
6437 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6439 return &cont_stmt->control_use;
6443 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6445 static inline void
6446 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6448 cont_stmt->control_use = use;
6451 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6452 TRANSACTION_STMT. */
6454 static inline gimple_seq *
6455 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6457 return &transaction_stmt->body;
6460 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6462 static inline gimple_seq
6463 gimple_transaction_body (const gtransaction *transaction_stmt)
6465 return transaction_stmt->body;
6468 /* Return the label associated with a GIMPLE_TRANSACTION. */
6470 static inline tree
6471 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6473 return transaction_stmt->label_norm;
6476 static inline tree *
6477 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6479 return &transaction_stmt->label_norm;
6482 static inline tree
6483 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6485 return transaction_stmt->label_uninst;
6488 static inline tree *
6489 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6491 return &transaction_stmt->label_uninst;
6494 static inline tree
6495 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6497 return transaction_stmt->label_over;
6500 static inline tree *
6501 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6503 return &transaction_stmt->label_over;
6506 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6508 static inline unsigned int
6509 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6511 return transaction_stmt->subcode;
6514 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6515 TRANSACTION_STMT. */
6517 static inline void
6518 gimple_transaction_set_body (gtransaction *transaction_stmt,
6519 gimple_seq body)
6521 transaction_stmt->body = body;
6524 /* Set the label associated with a GIMPLE_TRANSACTION. */
6526 static inline void
6527 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6529 transaction_stmt->label_norm = label;
6532 static inline void
6533 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6535 transaction_stmt->label_uninst = label;
6538 static inline void
6539 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6541 transaction_stmt->label_over = label;
6544 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6546 static inline void
6547 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6548 unsigned int subcode)
6550 transaction_stmt->subcode = subcode;
6553 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6555 static inline tree *
6556 gimple_return_retval_ptr (greturn *gs)
6558 return &gs->op[0];
6561 /* Return the return value for GIMPLE_RETURN GS. */
6563 static inline tree
6564 gimple_return_retval (const greturn *gs)
6566 return gs->op[0];
6570 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6572 static inline void
6573 gimple_return_set_retval (greturn *gs, tree retval)
6575 gs->op[0] = retval;
6579 /* Returns true when the gimple statement STMT is any of the OMP types. */
6581 #define CASE_GIMPLE_OMP \
6582 case GIMPLE_OMP_PARALLEL: \
6583 case GIMPLE_OMP_TASK: \
6584 case GIMPLE_OMP_FOR: \
6585 case GIMPLE_OMP_SECTIONS: \
6586 case GIMPLE_OMP_SECTIONS_SWITCH: \
6587 case GIMPLE_OMP_SINGLE: \
6588 case GIMPLE_OMP_TARGET: \
6589 case GIMPLE_OMP_TEAMS: \
6590 case GIMPLE_OMP_SCOPE: \
6591 case GIMPLE_OMP_SECTION: \
6592 case GIMPLE_OMP_MASTER: \
6593 case GIMPLE_OMP_MASKED: \
6594 case GIMPLE_OMP_TASKGROUP: \
6595 case GIMPLE_OMP_ORDERED: \
6596 case GIMPLE_OMP_CRITICAL: \
6597 case GIMPLE_OMP_SCAN: \
6598 case GIMPLE_OMP_RETURN: \
6599 case GIMPLE_OMP_ATOMIC_LOAD: \
6600 case GIMPLE_OMP_ATOMIC_STORE: \
6601 case GIMPLE_OMP_CONTINUE
6603 static inline bool
6604 is_gimple_omp (const gimple *stmt)
6606 switch (gimple_code (stmt))
6608 CASE_GIMPLE_OMP:
6609 return true;
6610 default:
6611 return false;
6615 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6616 specifically. */
6618 static inline bool
6619 is_gimple_omp_oacc (const gimple *stmt)
6621 gcc_assert (is_gimple_omp (stmt));
6622 switch (gimple_code (stmt))
6624 case GIMPLE_OMP_ATOMIC_LOAD:
6625 case GIMPLE_OMP_ATOMIC_STORE:
6626 case GIMPLE_OMP_CONTINUE:
6627 case GIMPLE_OMP_RETURN:
6628 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6629 the two. */
6630 gcc_unreachable ();
6632 case GIMPLE_OMP_FOR:
6633 switch (gimple_omp_for_kind (stmt))
6635 case GF_OMP_FOR_KIND_OACC_LOOP:
6636 return true;
6637 default:
6638 return false;
6640 case GIMPLE_OMP_TARGET:
6641 switch (gimple_omp_target_kind (stmt))
6643 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6644 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6645 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6646 case GF_OMP_TARGET_KIND_OACC_DATA:
6647 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6648 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
6649 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
6650 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6651 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6652 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6653 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6654 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS:
6655 return true;
6656 default:
6657 return false;
6659 default:
6660 return false;
6665 /* Return true if the OMP gimple statement STMT is offloaded. */
6667 static inline bool
6668 is_gimple_omp_offloaded (const gimple *stmt)
6670 gcc_assert (is_gimple_omp (stmt));
6671 switch (gimple_code (stmt))
6673 case GIMPLE_OMP_TARGET:
6674 switch (gimple_omp_target_kind (stmt))
6676 case GF_OMP_TARGET_KIND_REGION:
6677 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6678 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6679 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6680 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6681 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6682 return true;
6683 default:
6684 return false;
6686 default:
6687 return false;
6692 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6694 static inline bool
6695 gimple_nop_p (const gimple *g)
6697 return gimple_code (g) == GIMPLE_NOP;
6701 /* Return true if GS is a GIMPLE_RESX. */
6703 static inline bool
6704 is_gimple_resx (const gimple *gs)
6706 return gimple_code (gs) == GIMPLE_RESX;
6710 /* Enum and arrays used for allocation stats. Keep in sync with
6711 gimple.c:gimple_alloc_kind_names. */
6712 enum gimple_alloc_kind
6714 gimple_alloc_kind_assign, /* Assignments. */
6715 gimple_alloc_kind_phi, /* PHI nodes. */
6716 gimple_alloc_kind_cond, /* Conditionals. */
6717 gimple_alloc_kind_rest, /* Everything else. */
6718 gimple_alloc_kind_all
6721 extern uint64_t gimple_alloc_counts[];
6722 extern uint64_t gimple_alloc_sizes[];
6724 /* Return the allocation kind for a given stmt CODE. */
6725 static inline enum gimple_alloc_kind
6726 gimple_alloc_kind (enum gimple_code code)
6728 switch (code)
6730 case GIMPLE_ASSIGN:
6731 return gimple_alloc_kind_assign;
6732 case GIMPLE_PHI:
6733 return gimple_alloc_kind_phi;
6734 case GIMPLE_COND:
6735 return gimple_alloc_kind_cond;
6736 default:
6737 return gimple_alloc_kind_rest;
6741 /* Return true if a location should not be emitted for this statement
6742 by annotate_all_with_location. */
6744 static inline bool
6745 gimple_do_not_emit_location_p (gimple *g)
6747 return gimple_plf (g, GF_PLF_1);
6750 /* Mark statement G so a location will not be emitted by
6751 annotate_one_with_location. */
6753 static inline void
6754 gimple_set_do_not_emit_location (gimple *g)
6756 /* The PLF flags are initialized to 0 when a new tuple is created,
6757 so no need to initialize it anywhere. */
6758 gimple_set_plf (g, GF_PLF_1, true);
6761 #endif /* GCC_GIMPLE_H */