c++: ICE on anon struct with base [PR96636]
[official-gcc.git] / gcc / gimple.h
blob31d7dd0e550327641bcca62d8278c0d1403d8371
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 << 3) - 1,
198 GF_OMP_ATOMIC_NEED_VALUE = 1 << 3,
199 GF_PREDICT_TAKEN = 1 << 15
202 /* This subcode tells apart different kinds of stmts that are not used
203 for codegen, but rather to retain debug information. */
204 enum gimple_debug_subcode {
205 GIMPLE_DEBUG_BIND = 0,
206 GIMPLE_DEBUG_SOURCE_BIND = 1,
207 GIMPLE_DEBUG_BEGIN_STMT = 2,
208 GIMPLE_DEBUG_INLINE_ENTRY = 3
211 /* Masks for selecting a pass local flag (PLF) to work on. These
212 masks are used by gimple_set_plf and gimple_plf. */
213 enum plf_mask {
214 GF_PLF_1 = 1 << 0,
215 GF_PLF_2 = 1 << 1
218 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
219 are for 64 bit hosts. */
221 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
222 chain_next ("%h.next"), variable_size))
223 gimple
225 /* [ WORD 1 ]
226 Main identifying code for a tuple. */
227 ENUM_BITFIELD(gimple_code) code : 8;
229 /* Nonzero if a warning should not be emitted on this tuple. */
230 unsigned int no_warning : 1;
232 /* Nonzero if this tuple has been visited. Passes are responsible
233 for clearing this bit before using it. */
234 unsigned int visited : 1;
236 /* Nonzero if this tuple represents a non-temporal move. */
237 unsigned int nontemporal_move : 1;
239 /* Pass local flags. These flags are free for any pass to use as
240 they see fit. Passes should not assume that these flags contain
241 any useful value when the pass starts. Any initial state that
242 the pass requires should be set on entry to the pass. See
243 gimple_set_plf and gimple_plf for usage. */
244 unsigned int plf : 2;
246 /* Nonzero if this statement has been modified and needs to have its
247 operands rescanned. */
248 unsigned modified : 1;
250 /* Nonzero if this statement contains volatile operands. */
251 unsigned has_volatile_ops : 1;
253 /* Padding to get subcode to 16 bit alignment. */
254 unsigned pad : 1;
256 /* The SUBCODE field can be used for tuple-specific flags for tuples
257 that do not require subcodes. Note that SUBCODE should be at
258 least as wide as tree codes, as several tuples store tree codes
259 in there. */
260 unsigned int subcode : 16;
262 /* UID of this statement. This is used by passes that want to
263 assign IDs to statements. It must be assigned and used by each
264 pass. By default it should be assumed to contain garbage. */
265 unsigned uid;
267 /* [ WORD 2 ]
268 Locus information for debug info. */
269 location_t location;
271 /* Number of operands in this tuple. */
272 unsigned num_ops;
274 /* [ WORD 3 ]
275 Basic block holding this statement. */
276 basic_block bb;
278 /* [ WORD 4-5 ]
279 Linked lists of gimple statements. The next pointers form
280 a NULL terminated list, the prev pointers are a cyclic list.
281 A gimple statement is hence also a double-ended list of
282 statements, with the pointer itself being the first element,
283 and the prev pointer being the last. */
284 gimple *next;
285 gimple *GTY((skip)) prev;
289 /* Base structure for tuples with operands. */
291 /* This gimple subclass has no tag value. */
292 struct GTY(())
293 gimple_statement_with_ops_base : public gimple
295 /* [ WORD 1-6 ] : base class */
297 /* [ WORD 7 ]
298 SSA operand vectors. NOTE: It should be possible to
299 amalgamate these vectors with the operand vector OP. However,
300 the SSA operand vectors are organized differently and contain
301 more information (like immediate use chaining). */
302 struct use_optype_d GTY((skip (""))) *use_ops;
306 /* Statements that take register operands. */
308 struct GTY((tag("GSS_WITH_OPS")))
309 gimple_statement_with_ops : public gimple_statement_with_ops_base
311 /* [ WORD 1-7 ] : base class */
313 /* [ WORD 8 ]
314 Operand vector. NOTE! This must always be the last field
315 of this structure. In particular, this means that this
316 structure cannot be embedded inside another one. */
317 tree GTY((length ("%h.num_ops"))) op[1];
321 /* Base for statements that take both memory and register operands. */
323 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
324 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
326 /* [ WORD 1-7 ] : base class */
328 /* [ WORD 8-9 ]
329 Virtual operands for this statement. The GC will pick them
330 up via the ssa_names array. */
331 tree GTY((skip (""))) vdef;
332 tree GTY((skip (""))) vuse;
336 /* Statements that take both memory and register operands. */
338 struct GTY((tag("GSS_WITH_MEM_OPS")))
339 gimple_statement_with_memory_ops :
340 public gimple_statement_with_memory_ops_base
342 /* [ WORD 1-9 ] : base class */
344 /* [ WORD 10 ]
345 Operand vector. NOTE! This must always be the last field
346 of this structure. In particular, this means that this
347 structure cannot be embedded inside another one. */
348 tree GTY((length ("%h.num_ops"))) op[1];
352 /* Call statements that take both memory and register operands. */
354 struct GTY((tag("GSS_CALL")))
355 gcall : public gimple_statement_with_memory_ops_base
357 /* [ WORD 1-9 ] : base class */
359 /* [ WORD 10-13 ] */
360 struct pt_solution call_used;
361 struct pt_solution call_clobbered;
363 /* [ WORD 14 ] */
364 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
365 tree GTY ((tag ("0"))) fntype;
366 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
367 } u;
369 /* [ WORD 15 ]
370 Operand vector. NOTE! This must always be the last field
371 of this structure. In particular, this means that this
372 structure cannot be embedded inside another one. */
373 tree GTY((length ("%h.num_ops"))) op[1];
375 static const enum gimple_code code_ = GIMPLE_CALL;
379 /* OMP statements. */
381 struct GTY((tag("GSS_OMP")))
382 gimple_statement_omp : public gimple
384 /* [ WORD 1-6 ] : base class */
386 /* [ WORD 7 ] */
387 gimple_seq body;
391 /* GIMPLE_BIND */
393 struct GTY((tag("GSS_BIND")))
394 gbind : public gimple
396 /* [ WORD 1-6 ] : base class */
398 /* [ WORD 7 ]
399 Variables declared in this scope. */
400 tree vars;
402 /* [ WORD 8 ]
403 This is different than the BLOCK field in gimple,
404 which is analogous to TREE_BLOCK (i.e., the lexical block holding
405 this statement). This field is the equivalent of BIND_EXPR_BLOCK
406 in tree land (i.e., the lexical scope defined by this bind). See
407 gimple-low.c. */
408 tree block;
410 /* [ WORD 9 ] */
411 gimple_seq body;
415 /* GIMPLE_CATCH */
417 struct GTY((tag("GSS_CATCH")))
418 gcatch : public gimple
420 /* [ WORD 1-6 ] : base class */
422 /* [ WORD 7 ] */
423 tree types;
425 /* [ WORD 8 ] */
426 gimple_seq handler;
430 /* GIMPLE_EH_FILTER */
432 struct GTY((tag("GSS_EH_FILTER")))
433 geh_filter : public gimple
435 /* [ WORD 1-6 ] : base class */
437 /* [ WORD 7 ]
438 Filter types. */
439 tree types;
441 /* [ WORD 8 ]
442 Failure actions. */
443 gimple_seq failure;
446 /* GIMPLE_EH_ELSE */
448 struct GTY((tag("GSS_EH_ELSE")))
449 geh_else : public gimple
451 /* [ WORD 1-6 ] : base class */
453 /* [ WORD 7,8 ] */
454 gimple_seq n_body, e_body;
457 /* GIMPLE_EH_MUST_NOT_THROW */
459 struct GTY((tag("GSS_EH_MNT")))
460 geh_mnt : public gimple
462 /* [ WORD 1-6 ] : base class */
464 /* [ WORD 7 ] Abort function decl. */
465 tree fndecl;
468 /* GIMPLE_PHI */
470 struct GTY((tag("GSS_PHI")))
471 gphi : public gimple
473 /* [ WORD 1-6 ] : base class */
475 /* [ WORD 7 ] */
476 unsigned capacity;
477 unsigned nargs;
479 /* [ WORD 8 ] */
480 tree result;
482 /* [ WORD 9 ] */
483 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
487 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
489 struct GTY((tag("GSS_EH_CTRL")))
490 gimple_statement_eh_ctrl : public gimple
492 /* [ WORD 1-6 ] : base class */
494 /* [ WORD 7 ]
495 Exception region number. */
496 int region;
499 struct GTY((tag("GSS_EH_CTRL")))
500 gresx : public gimple_statement_eh_ctrl
502 /* No extra fields; adds invariant:
503 stmt->code == GIMPLE_RESX. */
506 struct GTY((tag("GSS_EH_CTRL")))
507 geh_dispatch : public gimple_statement_eh_ctrl
509 /* No extra fields; adds invariant:
510 stmt->code == GIMPLE_EH_DISPATH. */
514 /* GIMPLE_TRY */
516 struct GTY((tag("GSS_TRY")))
517 gtry : public gimple
519 /* [ WORD 1-6 ] : base class */
521 /* [ WORD 7 ]
522 Expression to evaluate. */
523 gimple_seq eval;
525 /* [ WORD 8 ]
526 Cleanup expression. */
527 gimple_seq cleanup;
530 /* Kind of GIMPLE_TRY statements. */
531 enum gimple_try_flags
533 /* A try/catch. */
534 GIMPLE_TRY_CATCH = 1 << 0,
536 /* A try/finally. */
537 GIMPLE_TRY_FINALLY = 1 << 1,
538 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
540 /* Analogous to TRY_CATCH_IS_CLEANUP. */
541 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
544 /* GIMPLE_WITH_CLEANUP_EXPR */
546 struct GTY((tag("GSS_WCE")))
547 gimple_statement_wce : public gimple
549 /* [ WORD 1-6 ] : base class */
551 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
552 executed if an exception is thrown, not on normal exit of its
553 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
554 in TARGET_EXPRs. */
556 /* [ WORD 7 ]
557 Cleanup expression. */
558 gimple_seq cleanup;
562 /* GIMPLE_ASM */
564 struct GTY((tag("GSS_ASM")))
565 gasm : public gimple_statement_with_memory_ops_base
567 /* [ WORD 1-9 ] : base class */
569 /* [ WORD 10 ]
570 __asm__ statement. */
571 const char *string;
573 /* [ WORD 11 ]
574 Number of inputs, outputs, clobbers, labels. */
575 unsigned char ni;
576 unsigned char no;
577 unsigned char nc;
578 unsigned char nl;
580 /* [ WORD 12 ]
581 Operand vector. NOTE! This must always be the last field
582 of this structure. In particular, this means that this
583 structure cannot be embedded inside another one. */
584 tree GTY((length ("%h.num_ops"))) op[1];
587 /* GIMPLE_OMP_CRITICAL */
589 struct GTY((tag("GSS_OMP_CRITICAL")))
590 gomp_critical : public gimple_statement_omp
592 /* [ WORD 1-7 ] : base class */
594 /* [ WORD 8 ] */
595 tree clauses;
597 /* [ WORD 9 ]
598 Critical section name. */
599 tree name;
603 struct GTY(()) gimple_omp_for_iter {
604 /* Condition code. */
605 enum tree_code cond;
607 /* Index variable. */
608 tree index;
610 /* Initial value. */
611 tree initial;
613 /* Final value. */
614 tree final;
616 /* Increment. */
617 tree incr;
620 /* GIMPLE_OMP_FOR */
622 struct GTY((tag("GSS_OMP_FOR")))
623 gomp_for : public gimple_statement_omp
625 /* [ WORD 1-7 ] : base class */
627 /* [ WORD 8 ] */
628 tree clauses;
630 /* [ WORD 9 ]
631 Number of elements in iter array. */
632 size_t collapse;
634 /* [ WORD 10 ] */
635 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
637 /* [ WORD 11 ]
638 Pre-body evaluated before the loop body begins. */
639 gimple_seq pre_body;
643 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
645 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
646 gimple_statement_omp_parallel_layout : public gimple_statement_omp
648 /* [ WORD 1-7 ] : base class */
650 /* [ WORD 8 ]
651 Clauses. */
652 tree clauses;
654 /* [ WORD 9 ]
655 Child function holding the body of the parallel region. */
656 tree child_fn;
658 /* [ WORD 10 ]
659 Shared data argument. */
660 tree data_arg;
663 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL
669 || stmt->code == GIMPLE_OMP_TASK
670 || stmt->code == GIMPLE_OMP_TEAMS. */
673 /* GIMPLE_OMP_PARALLEL */
674 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
675 gomp_parallel : public gimple_statement_omp_taskreg
677 /* No extra fields; adds invariant:
678 stmt->code == GIMPLE_OMP_PARALLEL. */
681 /* GIMPLE_OMP_TARGET */
682 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
683 gomp_target : public gimple_statement_omp_parallel_layout
685 /* No extra fields; adds invariant:
686 stmt->code == GIMPLE_OMP_TARGET. */
689 /* GIMPLE_OMP_TASK */
691 struct GTY((tag("GSS_OMP_TASK")))
692 gomp_task : public gimple_statement_omp_taskreg
694 /* [ WORD 1-10 ] : base class */
696 /* [ WORD 11 ]
697 Child function holding firstprivate initialization if needed. */
698 tree copy_fn;
700 /* [ WORD 12-13 ]
701 Size and alignment in bytes of the argument data block. */
702 tree arg_size;
703 tree arg_align;
707 /* GIMPLE_OMP_SECTION */
708 /* Uses struct gimple_statement_omp. */
711 /* GIMPLE_OMP_SECTIONS */
713 struct GTY((tag("GSS_OMP_SECTIONS")))
714 gomp_sections : public gimple_statement_omp
716 /* [ WORD 1-7 ] : base class */
718 /* [ WORD 8 ] */
719 tree clauses;
721 /* [ WORD 9 ]
722 The control variable used for deciding which of the sections to
723 execute. */
724 tree control;
727 /* GIMPLE_OMP_CONTINUE.
729 Note: This does not inherit from gimple_statement_omp, because we
730 do not need the body field. */
732 struct GTY((tag("GSS_OMP_CONTINUE")))
733 gomp_continue : public gimple
735 /* [ WORD 1-6 ] : base class */
737 /* [ WORD 7 ] */
738 tree control_def;
740 /* [ WORD 8 ] */
741 tree control_use;
744 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
745 GIMPLE_OMP_SCAN. */
747 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
748 gimple_statement_omp_single_layout : public gimple_statement_omp
750 /* [ WORD 1-7 ] : base class */
752 /* [ WORD 8 ] */
753 tree clauses;
756 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
757 gomp_single : public gimple_statement_omp_single_layout
759 /* No extra fields; adds invariant:
760 stmt->code == GIMPLE_OMP_SINGLE. */
763 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
764 gomp_teams : public gimple_statement_omp_taskreg
766 /* No extra fields; adds invariant:
767 stmt->code == GIMPLE_OMP_TEAMS. */
770 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
771 gomp_ordered : public gimple_statement_omp_single_layout
773 /* No extra fields; adds invariant:
774 stmt->code == GIMPLE_OMP_ORDERED. */
777 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
778 gomp_scan : public gimple_statement_omp_single_layout
780 /* No extra fields; adds invariant:
781 stmt->code == GIMPLE_OMP_SCAN. */
785 /* GIMPLE_OMP_ATOMIC_LOAD.
786 Note: This is based on gimple, not g_s_omp, because g_s_omp
787 contains a sequence, which we don't need here. */
789 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
790 gomp_atomic_load : public gimple
792 /* [ WORD 1-6 ] : base class */
794 /* [ WORD 7-8 ] */
795 tree rhs, lhs;
798 /* GIMPLE_OMP_ATOMIC_STORE.
799 See note on GIMPLE_OMP_ATOMIC_LOAD. */
801 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
802 gimple_statement_omp_atomic_store_layout : public gimple
804 /* [ WORD 1-6 ] : base class */
806 /* [ WORD 7 ] */
807 tree val;
810 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
811 gomp_atomic_store :
812 public gimple_statement_omp_atomic_store_layout
814 /* No extra fields; adds invariant:
815 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
818 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
819 gimple_statement_omp_return :
820 public gimple_statement_omp_atomic_store_layout
822 /* No extra fields; adds invariant:
823 stmt->code == GIMPLE_OMP_RETURN. */
826 /* GIMPLE_TRANSACTION. */
828 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
830 /* The __transaction_atomic was declared [[outer]] or it is
831 __transaction_relaxed. */
832 #define GTMA_IS_OUTER (1u << 0)
833 #define GTMA_IS_RELAXED (1u << 1)
834 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
836 /* The transaction is seen to not have an abort. */
837 #define GTMA_HAVE_ABORT (1u << 2)
838 /* The transaction is seen to have loads or stores. */
839 #define GTMA_HAVE_LOAD (1u << 3)
840 #define GTMA_HAVE_STORE (1u << 4)
841 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
842 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
843 /* The transaction WILL enter serial irrevocable mode.
844 An irrevocable block post-dominates the entire transaction, such
845 that all invocations of the transaction will go serial-irrevocable.
846 In such case, we don't bother instrumenting the transaction, and
847 tell the runtime that it should begin the transaction in
848 serial-irrevocable mode. */
849 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
850 /* The transaction contains no instrumentation code whatsover, most
851 likely because it is guaranteed to go irrevocable upon entry. */
852 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
854 struct GTY((tag("GSS_TRANSACTION")))
855 gtransaction : public gimple_statement_with_memory_ops_base
857 /* [ WORD 1-9 ] : base class */
859 /* [ WORD 10 ] */
860 gimple_seq body;
862 /* [ WORD 11-13 ] */
863 tree label_norm;
864 tree label_uninst;
865 tree label_over;
868 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
869 enum gimple_statement_structure_enum {
870 #include "gsstruct.def"
871 LAST_GSS_ENUM
873 #undef DEFGSSTRUCT
875 /* A statement with the invariant that
876 stmt->code == GIMPLE_COND
877 i.e. a conditional jump statement. */
879 struct GTY((tag("GSS_WITH_OPS")))
880 gcond : public gimple_statement_with_ops
882 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
883 static const enum gimple_code code_ = GIMPLE_COND;
886 /* A statement with the invariant that
887 stmt->code == GIMPLE_DEBUG
888 i.e. a debug statement. */
890 struct GTY((tag("GSS_WITH_OPS")))
891 gdebug : public gimple_statement_with_ops
893 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
896 /* A statement with the invariant that
897 stmt->code == GIMPLE_GOTO
898 i.e. a goto statement. */
900 struct GTY((tag("GSS_WITH_OPS")))
901 ggoto : public gimple_statement_with_ops
903 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
906 /* A statement with the invariant that
907 stmt->code == GIMPLE_LABEL
908 i.e. a label statement. */
910 struct GTY((tag("GSS_WITH_OPS")))
911 glabel : public gimple_statement_with_ops
913 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
916 /* A statement with the invariant that
917 stmt->code == GIMPLE_SWITCH
918 i.e. a switch statement. */
920 struct GTY((tag("GSS_WITH_OPS")))
921 gswitch : public gimple_statement_with_ops
923 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
926 /* A statement with the invariant that
927 stmt->code == GIMPLE_ASSIGN
928 i.e. an assignment statement. */
930 struct GTY((tag("GSS_WITH_MEM_OPS")))
931 gassign : public gimple_statement_with_memory_ops
933 static const enum gimple_code code_ = GIMPLE_ASSIGN;
934 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
937 /* A statement with the invariant that
938 stmt->code == GIMPLE_RETURN
939 i.e. a return statement. */
941 struct GTY((tag("GSS_WITH_MEM_OPS")))
942 greturn : public gimple_statement_with_memory_ops
944 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
947 template <>
948 template <>
949 inline bool
950 is_a_helper <gasm *>::test (gimple *gs)
952 return gs->code == GIMPLE_ASM;
955 template <>
956 template <>
957 inline bool
958 is_a_helper <gassign *>::test (gimple *gs)
960 return gs->code == GIMPLE_ASSIGN;
963 template <>
964 template <>
965 inline bool
966 is_a_helper <const gassign *>::test (const gimple *gs)
968 return gs->code == GIMPLE_ASSIGN;
971 template <>
972 template <>
973 inline bool
974 is_a_helper <gbind *>::test (gimple *gs)
976 return gs->code == GIMPLE_BIND;
979 template <>
980 template <>
981 inline bool
982 is_a_helper <gcall *>::test (gimple *gs)
984 return gs->code == GIMPLE_CALL;
987 template <>
988 template <>
989 inline bool
990 is_a_helper <gcatch *>::test (gimple *gs)
992 return gs->code == GIMPLE_CATCH;
995 template <>
996 template <>
997 inline bool
998 is_a_helper <gcond *>::test (gimple *gs)
1000 return gs->code == GIMPLE_COND;
1003 template <>
1004 template <>
1005 inline bool
1006 is_a_helper <const gcond *>::test (const gimple *gs)
1008 return gs->code == GIMPLE_COND;
1011 template <>
1012 template <>
1013 inline bool
1014 is_a_helper <gdebug *>::test (gimple *gs)
1016 return gs->code == GIMPLE_DEBUG;
1019 template <>
1020 template <>
1021 inline bool
1022 is_a_helper <const gdebug *>::test (const gimple *gs)
1024 return gs->code == GIMPLE_DEBUG;
1027 template <>
1028 template <>
1029 inline bool
1030 is_a_helper <ggoto *>::test (gimple *gs)
1032 return gs->code == GIMPLE_GOTO;
1035 template <>
1036 template <>
1037 inline bool
1038 is_a_helper <const ggoto *>::test (const gimple *gs)
1040 return gs->code == GIMPLE_GOTO;
1043 template <>
1044 template <>
1045 inline bool
1046 is_a_helper <glabel *>::test (gimple *gs)
1048 return gs->code == GIMPLE_LABEL;
1051 template <>
1052 template <>
1053 inline bool
1054 is_a_helper <const glabel *>::test (const gimple *gs)
1056 return gs->code == GIMPLE_LABEL;
1059 template <>
1060 template <>
1061 inline bool
1062 is_a_helper <gresx *>::test (gimple *gs)
1064 return gs->code == GIMPLE_RESX;
1067 template <>
1068 template <>
1069 inline bool
1070 is_a_helper <geh_dispatch *>::test (gimple *gs)
1072 return gs->code == GIMPLE_EH_DISPATCH;
1075 template <>
1076 template <>
1077 inline bool
1078 is_a_helper <geh_else *>::test (gimple *gs)
1080 return gs->code == GIMPLE_EH_ELSE;
1083 template <>
1084 template <>
1085 inline bool
1086 is_a_helper <const geh_else *>::test (const gimple *gs)
1088 return gs->code == GIMPLE_EH_ELSE;
1091 template <>
1092 template <>
1093 inline bool
1094 is_a_helper <geh_filter *>::test (gimple *gs)
1096 return gs->code == GIMPLE_EH_FILTER;
1099 template <>
1100 template <>
1101 inline bool
1102 is_a_helper <geh_mnt *>::test (gimple *gs)
1104 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1107 template <>
1108 template <>
1109 inline bool
1110 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1112 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1115 template <>
1116 template <>
1117 inline bool
1118 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1120 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1123 template <>
1124 template <>
1125 inline bool
1126 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1128 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1131 template <>
1132 template <>
1133 inline bool
1134 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1136 return gs->code == GIMPLE_OMP_RETURN;
1139 template <>
1140 template <>
1141 inline bool
1142 is_a_helper <gomp_continue *>::test (gimple *gs)
1144 return gs->code == GIMPLE_OMP_CONTINUE;
1147 template <>
1148 template <>
1149 inline bool
1150 is_a_helper <gomp_critical *>::test (gimple *gs)
1152 return gs->code == GIMPLE_OMP_CRITICAL;
1155 template <>
1156 template <>
1157 inline bool
1158 is_a_helper <gomp_ordered *>::test (gimple *gs)
1160 return gs->code == GIMPLE_OMP_ORDERED;
1163 template <>
1164 template <>
1165 inline bool
1166 is_a_helper <gomp_scan *>::test (gimple *gs)
1168 return gs->code == GIMPLE_OMP_SCAN;
1171 template <>
1172 template <>
1173 inline bool
1174 is_a_helper <gomp_for *>::test (gimple *gs)
1176 return gs->code == GIMPLE_OMP_FOR;
1179 template <>
1180 template <>
1181 inline bool
1182 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1184 return (gs->code == GIMPLE_OMP_PARALLEL
1185 || gs->code == GIMPLE_OMP_TASK
1186 || gs->code == GIMPLE_OMP_TEAMS);
1189 template <>
1190 template <>
1191 inline bool
1192 is_a_helper <gomp_parallel *>::test (gimple *gs)
1194 return gs->code == GIMPLE_OMP_PARALLEL;
1197 template <>
1198 template <>
1199 inline bool
1200 is_a_helper <gomp_target *>::test (gimple *gs)
1202 return gs->code == GIMPLE_OMP_TARGET;
1205 template <>
1206 template <>
1207 inline bool
1208 is_a_helper <gomp_sections *>::test (gimple *gs)
1210 return gs->code == GIMPLE_OMP_SECTIONS;
1213 template <>
1214 template <>
1215 inline bool
1216 is_a_helper <gomp_single *>::test (gimple *gs)
1218 return gs->code == GIMPLE_OMP_SINGLE;
1221 template <>
1222 template <>
1223 inline bool
1224 is_a_helper <gomp_teams *>::test (gimple *gs)
1226 return gs->code == GIMPLE_OMP_TEAMS;
1229 template <>
1230 template <>
1231 inline bool
1232 is_a_helper <gomp_task *>::test (gimple *gs)
1234 return gs->code == GIMPLE_OMP_TASK;
1237 template <>
1238 template <>
1239 inline bool
1240 is_a_helper <gphi *>::test (gimple *gs)
1242 return gs->code == GIMPLE_PHI;
1245 template <>
1246 template <>
1247 inline bool
1248 is_a_helper <greturn *>::test (gimple *gs)
1250 return gs->code == GIMPLE_RETURN;
1253 template <>
1254 template <>
1255 inline bool
1256 is_a_helper <gswitch *>::test (gimple *gs)
1258 return gs->code == GIMPLE_SWITCH;
1261 template <>
1262 template <>
1263 inline bool
1264 is_a_helper <const gswitch *>::test (const gimple *gs)
1266 return gs->code == GIMPLE_SWITCH;
1269 template <>
1270 template <>
1271 inline bool
1272 is_a_helper <gtransaction *>::test (gimple *gs)
1274 return gs->code == GIMPLE_TRANSACTION;
1277 template <>
1278 template <>
1279 inline bool
1280 is_a_helper <gtry *>::test (gimple *gs)
1282 return gs->code == GIMPLE_TRY;
1285 template <>
1286 template <>
1287 inline bool
1288 is_a_helper <const gtry *>::test (const gimple *gs)
1290 return gs->code == GIMPLE_TRY;
1293 template <>
1294 template <>
1295 inline bool
1296 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1298 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1301 template <>
1302 template <>
1303 inline bool
1304 is_a_helper <const gasm *>::test (const gimple *gs)
1306 return gs->code == GIMPLE_ASM;
1309 template <>
1310 template <>
1311 inline bool
1312 is_a_helper <const gbind *>::test (const gimple *gs)
1314 return gs->code == GIMPLE_BIND;
1317 template <>
1318 template <>
1319 inline bool
1320 is_a_helper <const gcall *>::test (const gimple *gs)
1322 return gs->code == GIMPLE_CALL;
1325 template <>
1326 template <>
1327 inline bool
1328 is_a_helper <const gcatch *>::test (const gimple *gs)
1330 return gs->code == GIMPLE_CATCH;
1333 template <>
1334 template <>
1335 inline bool
1336 is_a_helper <const gresx *>::test (const gimple *gs)
1338 return gs->code == GIMPLE_RESX;
1341 template <>
1342 template <>
1343 inline bool
1344 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1346 return gs->code == GIMPLE_EH_DISPATCH;
1349 template <>
1350 template <>
1351 inline bool
1352 is_a_helper <const geh_filter *>::test (const gimple *gs)
1354 return gs->code == GIMPLE_EH_FILTER;
1357 template <>
1358 template <>
1359 inline bool
1360 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1362 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1365 template <>
1366 template <>
1367 inline bool
1368 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1370 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1373 template <>
1374 template <>
1375 inline bool
1376 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1378 return gs->code == GIMPLE_OMP_RETURN;
1381 template <>
1382 template <>
1383 inline bool
1384 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1386 return gs->code == GIMPLE_OMP_CONTINUE;
1389 template <>
1390 template <>
1391 inline bool
1392 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1394 return gs->code == GIMPLE_OMP_CRITICAL;
1397 template <>
1398 template <>
1399 inline bool
1400 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1402 return gs->code == GIMPLE_OMP_ORDERED;
1405 template <>
1406 template <>
1407 inline bool
1408 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1410 return gs->code == GIMPLE_OMP_SCAN;
1413 template <>
1414 template <>
1415 inline bool
1416 is_a_helper <const gomp_for *>::test (const gimple *gs)
1418 return gs->code == GIMPLE_OMP_FOR;
1421 template <>
1422 template <>
1423 inline bool
1424 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1426 return (gs->code == GIMPLE_OMP_PARALLEL
1427 || gs->code == GIMPLE_OMP_TASK
1428 || gs->code == GIMPLE_OMP_TEAMS);
1431 template <>
1432 template <>
1433 inline bool
1434 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1436 return gs->code == GIMPLE_OMP_PARALLEL;
1439 template <>
1440 template <>
1441 inline bool
1442 is_a_helper <const gomp_target *>::test (const gimple *gs)
1444 return gs->code == GIMPLE_OMP_TARGET;
1447 template <>
1448 template <>
1449 inline bool
1450 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1452 return gs->code == GIMPLE_OMP_SECTIONS;
1455 template <>
1456 template <>
1457 inline bool
1458 is_a_helper <const gomp_single *>::test (const gimple *gs)
1460 return gs->code == GIMPLE_OMP_SINGLE;
1463 template <>
1464 template <>
1465 inline bool
1466 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1468 return gs->code == GIMPLE_OMP_TEAMS;
1471 template <>
1472 template <>
1473 inline bool
1474 is_a_helper <const gomp_task *>::test (const gimple *gs)
1476 return gs->code == GIMPLE_OMP_TASK;
1479 template <>
1480 template <>
1481 inline bool
1482 is_a_helper <const gphi *>::test (const gimple *gs)
1484 return gs->code == GIMPLE_PHI;
1487 template <>
1488 template <>
1489 inline bool
1490 is_a_helper <const greturn *>::test (const gimple *gs)
1492 return gs->code == GIMPLE_RETURN;
1495 template <>
1496 template <>
1497 inline bool
1498 is_a_helper <const gtransaction *>::test (const gimple *gs)
1500 return gs->code == GIMPLE_TRANSACTION;
1503 /* Offset in bytes to the location of the operand vector.
1504 Zero if there is no operand vector for this tuple structure. */
1505 extern size_t const gimple_ops_offset_[];
1507 /* Map GIMPLE codes to GSS codes. */
1508 extern enum gimple_statement_structure_enum const gss_for_code_[];
1510 /* This variable holds the currently expanded gimple statement for purposes
1511 of comminucating the profile info to the builtin expanders. */
1512 extern gimple *currently_expanding_gimple_stmt;
1514 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1515 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1516 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1517 greturn *gimple_build_return (tree);
1518 void gimple_call_reset_alias_info (gcall *);
1519 gcall *gimple_build_call_vec (tree, const vec<tree> &);
1520 gcall *gimple_build_call (tree, unsigned, ...);
1521 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1522 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1523 gcall *gimple_build_call_internal_vec (enum internal_fn, const vec<tree> &);
1524 gcall *gimple_build_call_from_tree (tree, tree);
1525 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1526 gassign *gimple_build_assign (tree, enum tree_code,
1527 tree, tree, tree CXX_MEM_STAT_INFO);
1528 gassign *gimple_build_assign (tree, enum tree_code,
1529 tree, tree CXX_MEM_STAT_INFO);
1530 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1531 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1532 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1533 void gimple_cond_set_condition_from_tree (gcond *, tree);
1534 glabel *gimple_build_label (tree label);
1535 ggoto *gimple_build_goto (tree dest);
1536 gimple *gimple_build_nop (void);
1537 gbind *gimple_build_bind (tree, gimple_seq, tree);
1538 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1539 vec<tree, va_gc> *, vec<tree, va_gc> *,
1540 vec<tree, va_gc> *);
1541 gcatch *gimple_build_catch (tree, gimple_seq);
1542 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1543 geh_mnt *gimple_build_eh_must_not_throw (tree);
1544 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1545 gtry *gimple_build_try (gimple_seq, gimple_seq,
1546 enum gimple_try_flags);
1547 gimple *gimple_build_wce (gimple_seq);
1548 gresx *gimple_build_resx (int);
1549 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1550 gswitch *gimple_build_switch (tree, tree, const vec<tree> &);
1551 geh_dispatch *gimple_build_eh_dispatch (int);
1552 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1553 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1554 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1555 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1556 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1557 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1558 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1559 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1560 tree, tree);
1561 gimple *gimple_build_omp_section (gimple_seq);
1562 gimple *gimple_build_omp_master (gimple_seq);
1563 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1564 gomp_continue *gimple_build_omp_continue (tree, tree);
1565 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1566 gimple *gimple_build_omp_return (bool);
1567 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1568 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1569 gimple *gimple_build_omp_sections_switch (void);
1570 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1571 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1572 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1573 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1574 enum omp_memory_order);
1575 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1576 gtransaction *gimple_build_transaction (gimple_seq);
1577 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1578 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1579 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1580 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1581 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1582 location_t);
1583 extern void annotate_all_with_location (gimple_seq, location_t);
1584 bool empty_body_p (gimple_seq);
1585 gimple_seq gimple_seq_copy (gimple_seq);
1586 bool gimple_call_same_target_p (const gimple *, const gimple *);
1587 int gimple_call_flags (const gimple *);
1588 int gimple_call_arg_flags (const gcall *, unsigned);
1589 int gimple_call_return_flags (const gcall *);
1590 bool gimple_call_nonnull_result_p (gcall *);
1591 tree gimple_call_nonnull_arg (gcall *);
1592 bool gimple_assign_copy_p (gimple *);
1593 bool gimple_assign_ssa_name_copy_p (gimple *);
1594 bool gimple_assign_unary_nop_p (gimple *);
1595 void gimple_set_bb (gimple *, basic_block);
1596 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1597 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1598 tree, tree, tree);
1599 tree gimple_get_lhs (const gimple *);
1600 void gimple_set_lhs (gimple *, tree);
1601 gimple *gimple_copy (gimple *);
1602 void gimple_move_vops (gimple *, gimple *);
1603 bool gimple_has_side_effects (const gimple *);
1604 bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1605 bool gimple_could_trap_p (const gimple *);
1606 bool gimple_assign_rhs_could_trap_p (gimple *);
1607 extern void dump_gimple_statistics (void);
1608 unsigned get_gimple_rhs_num_ops (enum tree_code);
1609 extern tree canonicalize_cond_expr_cond (tree);
1610 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1611 extern bool gimple_compare_field_offset (tree, tree);
1612 extern tree gimple_unsigned_type (tree);
1613 extern tree gimple_signed_type (tree);
1614 extern alias_set_type gimple_get_alias_set (tree);
1615 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1616 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1617 extern combined_fn gimple_call_combined_fn (const gimple *);
1618 extern bool gimple_call_operator_delete_p (const gcall *);
1619 extern bool gimple_call_builtin_p (const gimple *);
1620 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1621 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1622 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1623 extern void dump_decl_set (FILE *, bitmap);
1624 extern bool nonfreeing_call_p (gimple *);
1625 extern bool nonbarrier_call_p (gimple *);
1626 extern bool infer_nonnull_range (gimple *, tree);
1627 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1628 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1629 extern void sort_case_labels (vec<tree> &);
1630 extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
1631 extern void gimple_seq_set_location (gimple_seq, location_t);
1632 extern void gimple_seq_discard (gimple_seq);
1633 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1634 extern bool gimple_inexpensive_call_p (gcall *);
1635 extern bool stmt_can_terminate_bb_p (gimple *);
1636 extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1638 /* Return the disposition for a warning (or all warnings by default)
1639 for a statement. */
1640 extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1641 ATTRIBUTE_NONNULL (1);
1642 /* Set the disposition for a warning (or all warnings by default)
1643 at a location to enabled by default. */
1644 extern void suppress_warning (gimple *, opt_code = all_warnings,
1645 bool = true) ATTRIBUTE_NONNULL (1);
1647 /* Copy the warning disposition mapping from one statement to another. */
1648 extern void copy_warning (gimple *, const gimple *)
1649 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1650 /* Copy the warning disposition mapping from an expression to a statement. */
1651 extern void copy_warning (gimple *, const_tree)
1652 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1653 /* Copy the warning disposition mapping from a statement to an expression. */
1654 extern void copy_warning (tree, const gimple *)
1655 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1657 /* Formal (expression) temporary table handling: multiple occurrences of
1658 the same scalar expression are evaluated into the same temporary. */
1660 typedef struct gimple_temp_hash_elt
1662 tree val; /* Key */
1663 tree temp; /* Value */
1664 } elt_t;
1666 /* Get the number of the next statement uid to be allocated. */
1667 static inline unsigned int
1668 gimple_stmt_max_uid (struct function *fn)
1670 return fn->last_stmt_uid;
1673 /* Set the number of the next statement uid to be allocated. */
1674 static inline void
1675 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1677 fn->last_stmt_uid = maxid;
1680 /* Set the number of the next statement uid to be allocated. */
1681 static inline unsigned int
1682 inc_gimple_stmt_max_uid (struct function *fn)
1684 return fn->last_stmt_uid++;
1687 /* Return the first node in GIMPLE sequence S. */
1689 static inline gimple_seq_node
1690 gimple_seq_first (gimple_seq s)
1692 return s;
1696 /* Return the first statement in GIMPLE sequence S. */
1698 static inline gimple *
1699 gimple_seq_first_stmt (gimple_seq s)
1701 gimple_seq_node n = gimple_seq_first (s);
1702 return n;
1705 /* Return the first statement in GIMPLE sequence S as a gbind *,
1706 verifying that it has code GIMPLE_BIND in a checked build. */
1708 static inline gbind *
1709 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1711 gimple_seq_node n = gimple_seq_first (s);
1712 return as_a <gbind *> (n);
1716 /* Return the last node in GIMPLE sequence S. */
1718 static inline gimple_seq_node
1719 gimple_seq_last (gimple_seq s)
1721 return s ? s->prev : NULL;
1725 /* Return the last statement in GIMPLE sequence S. */
1727 static inline gimple *
1728 gimple_seq_last_stmt (gimple_seq s)
1730 gimple_seq_node n = gimple_seq_last (s);
1731 return n;
1735 /* Set the last node in GIMPLE sequence *PS to LAST. */
1737 static inline void
1738 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1740 (*ps)->prev = last;
1744 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1746 static inline void
1747 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1749 *ps = first;
1753 /* Return true if GIMPLE sequence S is empty. */
1755 static inline bool
1756 gimple_seq_empty_p (gimple_seq s)
1758 return s == NULL;
1761 /* Allocate a new sequence and initialize its first element with STMT. */
1763 static inline gimple_seq
1764 gimple_seq_alloc_with_stmt (gimple *stmt)
1766 gimple_seq seq = NULL;
1767 gimple_seq_add_stmt (&seq, stmt);
1768 return seq;
1772 /* Returns the sequence of statements in BB. */
1774 static inline gimple_seq
1775 bb_seq (const_basic_block bb)
1777 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1780 static inline gimple_seq *
1781 bb_seq_addr (basic_block bb)
1783 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1786 /* Sets the sequence of statements in BB to SEQ. */
1788 static inline void
1789 set_bb_seq (basic_block bb, gimple_seq seq)
1791 gcc_checking_assert (!(bb->flags & BB_RTL));
1792 bb->il.gimple.seq = seq;
1796 /* Return the code for GIMPLE statement G. */
1798 static inline enum gimple_code
1799 gimple_code (const gimple *g)
1801 return g->code;
1805 /* Return the GSS code used by a GIMPLE code. */
1807 static inline enum gimple_statement_structure_enum
1808 gss_for_code (enum gimple_code code)
1810 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1811 return gss_for_code_[code];
1815 /* Return which GSS code is used by GS. */
1817 static inline enum gimple_statement_structure_enum
1818 gimple_statement_structure (gimple *gs)
1820 return gss_for_code (gimple_code (gs));
1824 /* Return true if statement G has sub-statements. This is only true for
1825 High GIMPLE statements. */
1827 static inline bool
1828 gimple_has_substatements (gimple *g)
1830 switch (gimple_code (g))
1832 case GIMPLE_BIND:
1833 case GIMPLE_CATCH:
1834 case GIMPLE_EH_FILTER:
1835 case GIMPLE_EH_ELSE:
1836 case GIMPLE_TRY:
1837 case GIMPLE_OMP_FOR:
1838 case GIMPLE_OMP_MASTER:
1839 case GIMPLE_OMP_TASKGROUP:
1840 case GIMPLE_OMP_ORDERED:
1841 case GIMPLE_OMP_SECTION:
1842 case GIMPLE_OMP_PARALLEL:
1843 case GIMPLE_OMP_TASK:
1844 case GIMPLE_OMP_SECTIONS:
1845 case GIMPLE_OMP_SINGLE:
1846 case GIMPLE_OMP_TARGET:
1847 case GIMPLE_OMP_TEAMS:
1848 case GIMPLE_OMP_CRITICAL:
1849 case GIMPLE_WITH_CLEANUP_EXPR:
1850 case GIMPLE_TRANSACTION:
1851 return true;
1853 default:
1854 return false;
1859 /* Return the basic block holding statement G. */
1861 static inline basic_block
1862 gimple_bb (const gimple *g)
1864 return g->bb;
1868 /* Return the lexical scope block holding statement G. */
1870 static inline tree
1871 gimple_block (const gimple *g)
1873 return LOCATION_BLOCK (g->location);
1876 /* Forward declare. */
1877 static inline void gimple_set_location (gimple *, location_t);
1879 /* Set BLOCK to be the lexical scope block holding statement G. */
1881 static inline void
1882 gimple_set_block (gimple *g, tree block)
1884 gimple_set_location (g, set_block (g->location, block));
1887 /* Return location information for statement G. */
1889 static inline location_t
1890 gimple_location (const gimple *g)
1892 return g->location;
1895 /* Return location information for statement G if g is not NULL.
1896 Otherwise, UNKNOWN_LOCATION is returned. */
1898 static inline location_t
1899 gimple_location_safe (const gimple *g)
1901 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1904 /* Set location information for statement G. */
1906 static inline void
1907 gimple_set_location (gimple *g, location_t location)
1909 /* Copy the no-warning data to the statement location. */
1910 copy_warning (location, g->location);
1911 g->location = location;
1914 /* Return address of the location information for statement G. */
1916 static inline location_t *
1917 gimple_location_ptr (gimple *g)
1919 return &g->location;
1923 /* Return true if G contains location information. */
1925 static inline bool
1926 gimple_has_location (const gimple *g)
1928 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1932 /* Return non-artificial location information for statement G. */
1934 static inline location_t
1935 gimple_nonartificial_location (const gimple *g)
1937 location_t *ploc = NULL;
1939 if (tree block = gimple_block (g))
1940 ploc = block_nonartificial_location (block);
1942 return ploc ? *ploc : gimple_location (g);
1946 /* Return the file name of the location of STMT. */
1948 static inline const char *
1949 gimple_filename (const gimple *stmt)
1951 return LOCATION_FILE (gimple_location (stmt));
1955 /* Return the line number of the location of STMT. */
1957 static inline int
1958 gimple_lineno (const gimple *stmt)
1960 return LOCATION_LINE (gimple_location (stmt));
1964 /* Determine whether SEQ is a singleton. */
1966 static inline bool
1967 gimple_seq_singleton_p (gimple_seq seq)
1969 return ((gimple_seq_first (seq) != NULL)
1970 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1973 /* Return true if no warnings should be emitted for statement STMT. */
1975 static inline bool
1976 gimple_no_warning_p (const gimple *stmt)
1978 return stmt->no_warning;
1981 /* Set the no_warning flag of STMT to NO_WARNING. */
1983 static inline void
1984 gimple_set_no_warning (gimple *stmt, bool no_warning)
1986 stmt->no_warning = (unsigned) no_warning;
1989 /* Set the visited status on statement STMT to VISITED_P.
1991 Please note that this 'visited' property of the gimple statement is
1992 supposed to be undefined at pass boundaries. This means that a
1993 given pass should not assume it contains any useful value when the
1994 pass starts and thus can set it to any value it sees fit.
1996 You can learn more about the visited property of the gimple
1997 statement by reading the comments of the 'visited' data member of
1998 struct gimple.
2001 static inline void
2002 gimple_set_visited (gimple *stmt, bool visited_p)
2004 stmt->visited = (unsigned) visited_p;
2008 /* Return the visited status for statement STMT.
2010 Please note that this 'visited' property of the gimple statement is
2011 supposed to be undefined at pass boundaries. This means that a
2012 given pass should not assume it contains any useful value when the
2013 pass starts and thus can set it to any value it sees fit.
2015 You can learn more about the visited property of the gimple
2016 statement by reading the comments of the 'visited' data member of
2017 struct gimple. */
2019 static inline bool
2020 gimple_visited_p (gimple *stmt)
2022 return stmt->visited;
2026 /* Set pass local flag PLF on statement STMT to VAL_P.
2028 Please note that this PLF property of the gimple statement is
2029 supposed to be undefined at pass boundaries. This means that a
2030 given pass should not assume it contains any useful value when the
2031 pass starts and thus can set it to any value it sees fit.
2033 You can learn more about the PLF property by reading the comment of
2034 the 'plf' data member of struct gimple_statement_structure. */
2036 static inline void
2037 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2039 if (val_p)
2040 stmt->plf |= (unsigned int) plf;
2041 else
2042 stmt->plf &= ~((unsigned int) plf);
2046 /* Return the value of pass local flag PLF on statement STMT.
2048 Please note that this 'plf' property of the gimple statement is
2049 supposed to be undefined at pass boundaries. This means that a
2050 given pass should not assume it contains any useful value when the
2051 pass starts and thus can set it to any value it sees fit.
2053 You can learn more about the plf property by reading the comment of
2054 the 'plf' data member of struct gimple_statement_structure. */
2056 static inline unsigned int
2057 gimple_plf (gimple *stmt, enum plf_mask plf)
2059 return stmt->plf & ((unsigned int) plf);
2063 /* Set the UID of statement.
2065 Please note that this UID property is supposed to be undefined at
2066 pass boundaries. This means that a given pass should not assume it
2067 contains any useful value when the pass starts and thus can set it
2068 to any value it sees fit. */
2070 static inline void
2071 gimple_set_uid (gimple *g, unsigned uid)
2073 g->uid = uid;
2077 /* Return the UID of statement.
2079 Please note that this UID property is supposed to be undefined at
2080 pass boundaries. This means that a given pass should not assume it
2081 contains any useful value when the pass starts and thus can set it
2082 to any value it sees fit. */
2084 static inline unsigned
2085 gimple_uid (const gimple *g)
2087 return g->uid;
2091 /* Make statement G a singleton sequence. */
2093 static inline void
2094 gimple_init_singleton (gimple *g)
2096 g->next = NULL;
2097 g->prev = g;
2101 /* Return true if GIMPLE statement G has register or memory operands. */
2103 static inline bool
2104 gimple_has_ops (const gimple *g)
2106 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2109 template <>
2110 template <>
2111 inline bool
2112 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2114 return gimple_has_ops (gs);
2117 template <>
2118 template <>
2119 inline bool
2120 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2122 return gimple_has_ops (gs);
2125 /* Return true if GIMPLE statement G has memory operands. */
2127 static inline bool
2128 gimple_has_mem_ops (const gimple *g)
2130 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2133 template <>
2134 template <>
2135 inline bool
2136 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2138 return gimple_has_mem_ops (gs);
2141 template <>
2142 template <>
2143 inline bool
2144 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2146 return gimple_has_mem_ops (gs);
2149 /* Return the set of USE operands for statement G. */
2151 static inline struct use_optype_d *
2152 gimple_use_ops (const gimple *g)
2154 const gimple_statement_with_ops *ops_stmt =
2155 dyn_cast <const gimple_statement_with_ops *> (g);
2156 if (!ops_stmt)
2157 return NULL;
2158 return ops_stmt->use_ops;
2162 /* Set USE to be the set of USE operands for statement G. */
2164 static inline void
2165 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2167 gimple_statement_with_ops *ops_stmt =
2168 as_a <gimple_statement_with_ops *> (g);
2169 ops_stmt->use_ops = use;
2173 /* Return the single VUSE operand of the statement G. */
2175 static inline tree
2176 gimple_vuse (const gimple *g)
2178 const gimple_statement_with_memory_ops *mem_ops_stmt =
2179 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2180 if (!mem_ops_stmt)
2181 return NULL_TREE;
2182 return mem_ops_stmt->vuse;
2185 /* Return the single VDEF operand of the statement G. */
2187 static inline tree
2188 gimple_vdef (const gimple *g)
2190 const gimple_statement_with_memory_ops *mem_ops_stmt =
2191 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2192 if (!mem_ops_stmt)
2193 return NULL_TREE;
2194 return mem_ops_stmt->vdef;
2197 /* Return the single VUSE operand of the statement G. */
2199 static inline tree *
2200 gimple_vuse_ptr (gimple *g)
2202 gimple_statement_with_memory_ops *mem_ops_stmt =
2203 dyn_cast <gimple_statement_with_memory_ops *> (g);
2204 if (!mem_ops_stmt)
2205 return NULL;
2206 return &mem_ops_stmt->vuse;
2209 /* Return the single VDEF operand of the statement G. */
2211 static inline tree *
2212 gimple_vdef_ptr (gimple *g)
2214 gimple_statement_with_memory_ops *mem_ops_stmt =
2215 dyn_cast <gimple_statement_with_memory_ops *> (g);
2216 if (!mem_ops_stmt)
2217 return NULL;
2218 return &mem_ops_stmt->vdef;
2221 /* Set the single VUSE operand of the statement G. */
2223 static inline void
2224 gimple_set_vuse (gimple *g, tree vuse)
2226 gimple_statement_with_memory_ops *mem_ops_stmt =
2227 as_a <gimple_statement_with_memory_ops *> (g);
2228 mem_ops_stmt->vuse = vuse;
2231 /* Set the single VDEF operand of the statement G. */
2233 static inline void
2234 gimple_set_vdef (gimple *g, tree vdef)
2236 gimple_statement_with_memory_ops *mem_ops_stmt =
2237 as_a <gimple_statement_with_memory_ops *> (g);
2238 mem_ops_stmt->vdef = vdef;
2242 /* Return true if statement G has operands and the modified field has
2243 been set. */
2245 static inline bool
2246 gimple_modified_p (const gimple *g)
2248 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2252 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2253 a MODIFIED field. */
2255 static inline void
2256 gimple_set_modified (gimple *s, bool modifiedp)
2258 if (gimple_has_ops (s))
2259 s->modified = (unsigned) modifiedp;
2263 /* Return true if statement STMT contains volatile operands. */
2265 static inline bool
2266 gimple_has_volatile_ops (const gimple *stmt)
2268 if (gimple_has_mem_ops (stmt))
2269 return stmt->has_volatile_ops;
2270 else
2271 return false;
2275 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2277 static inline void
2278 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2280 if (gimple_has_mem_ops (stmt))
2281 stmt->has_volatile_ops = (unsigned) volatilep;
2284 /* Return true if STMT is in a transaction. */
2286 static inline bool
2287 gimple_in_transaction (const gimple *stmt)
2289 return bb_in_transaction (gimple_bb (stmt));
2292 /* Return true if statement STMT may access memory. */
2294 static inline bool
2295 gimple_references_memory_p (gimple *stmt)
2297 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2301 /* Return the subcode for OMP statement S. */
2303 static inline unsigned
2304 gimple_omp_subcode (const gimple *s)
2306 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2307 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2308 return s->subcode;
2311 /* Set the subcode for OMP statement S to SUBCODE. */
2313 static inline void
2314 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2316 /* We only have 16 bits for the subcode. Assert that we are not
2317 overflowing it. */
2318 gcc_gimple_checking_assert (subcode < (1 << 16));
2319 s->subcode = subcode;
2322 /* Set the nowait flag on OMP_RETURN statement S. */
2324 static inline void
2325 gimple_omp_return_set_nowait (gimple *s)
2327 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2328 s->subcode |= GF_OMP_RETURN_NOWAIT;
2332 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2333 flag set. */
2335 static inline bool
2336 gimple_omp_return_nowait_p (const gimple *g)
2338 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2339 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2343 /* Set the LHS of OMP return. */
2345 static inline void
2346 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2348 gimple_statement_omp_return *omp_return_stmt =
2349 as_a <gimple_statement_omp_return *> (g);
2350 omp_return_stmt->val = lhs;
2354 /* Get the LHS of OMP return. */
2356 static inline tree
2357 gimple_omp_return_lhs (const gimple *g)
2359 const gimple_statement_omp_return *omp_return_stmt =
2360 as_a <const gimple_statement_omp_return *> (g);
2361 return omp_return_stmt->val;
2365 /* Return a pointer to the LHS of OMP return. */
2367 static inline tree *
2368 gimple_omp_return_lhs_ptr (gimple *g)
2370 gimple_statement_omp_return *omp_return_stmt =
2371 as_a <gimple_statement_omp_return *> (g);
2372 return &omp_return_stmt->val;
2376 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2377 flag set. */
2379 static inline bool
2380 gimple_omp_section_last_p (const gimple *g)
2382 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2383 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2387 /* Set the GF_OMP_SECTION_LAST flag on G. */
2389 static inline void
2390 gimple_omp_section_set_last (gimple *g)
2392 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2393 g->subcode |= GF_OMP_SECTION_LAST;
2397 /* Return true if OMP parallel statement G has the
2398 GF_OMP_PARALLEL_COMBINED flag set. */
2400 static inline bool
2401 gimple_omp_parallel_combined_p (const gimple *g)
2403 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2404 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2408 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2409 value of COMBINED_P. */
2411 static inline void
2412 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2414 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2415 if (combined_p)
2416 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2417 else
2418 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2422 /* Return true if OMP atomic load/store statement G has the
2423 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2425 static inline bool
2426 gimple_omp_atomic_need_value_p (const gimple *g)
2428 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2429 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2430 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2434 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2436 static inline void
2437 gimple_omp_atomic_set_need_value (gimple *g)
2439 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2440 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2441 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2445 /* Return the memory order of the OMP atomic load/store statement G. */
2447 static inline enum omp_memory_order
2448 gimple_omp_atomic_memory_order (const gimple *g)
2450 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2451 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2452 return (enum omp_memory_order)
2453 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2457 /* Set the memory order on G. */
2459 static inline void
2460 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2462 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2463 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2464 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2465 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2469 /* Return the number of operands for statement GS. */
2471 static inline unsigned
2472 gimple_num_ops (const gimple *gs)
2474 return gs->num_ops;
2478 /* Set the number of operands for statement GS. */
2480 static inline void
2481 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2483 gs->num_ops = num_ops;
2487 /* Return the array of operands for statement GS. */
2489 static inline tree *
2490 gimple_ops (gimple *gs)
2492 size_t off;
2494 /* All the tuples have their operand vector at the very bottom
2495 of the structure. Note that those structures that do not
2496 have an operand vector have a zero offset. */
2497 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2498 gcc_gimple_checking_assert (off != 0);
2500 return (tree *) ((char *) gs + off);
2504 /* Return operand I for statement GS. */
2506 static inline tree
2507 gimple_op (const gimple *gs, unsigned i)
2509 if (gimple_has_ops (gs))
2511 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2512 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2514 else
2515 return NULL_TREE;
2518 /* Return a pointer to operand I for statement GS. */
2520 static inline tree *
2521 gimple_op_ptr (gimple *gs, unsigned i)
2523 if (gimple_has_ops (gs))
2525 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2526 return gimple_ops (gs) + i;
2528 else
2529 return NULL;
2532 /* Set operand I of statement GS to OP. */
2534 static inline void
2535 gimple_set_op (gimple *gs, unsigned i, tree op)
2537 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2539 /* Note. It may be tempting to assert that OP matches
2540 is_gimple_operand, but that would be wrong. Different tuples
2541 accept slightly different sets of tree operands. Each caller
2542 should perform its own validation. */
2543 gimple_ops (gs)[i] = op;
2546 /* Return true if GS is a GIMPLE_ASSIGN. */
2548 static inline bool
2549 is_gimple_assign (const gimple *gs)
2551 return gimple_code (gs) == GIMPLE_ASSIGN;
2554 /* Determine if expression CODE is one of the valid expressions that can
2555 be used on the RHS of GIMPLE assignments. */
2557 static inline enum gimple_rhs_class
2558 get_gimple_rhs_class (enum tree_code code)
2560 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2563 /* Return the LHS of assignment statement GS. */
2565 static inline tree
2566 gimple_assign_lhs (const gassign *gs)
2568 return gs->op[0];
2571 static inline tree
2572 gimple_assign_lhs (const gimple *gs)
2574 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2575 return gimple_assign_lhs (ass);
2579 /* Return a pointer to the LHS of assignment statement GS. */
2581 static inline tree *
2582 gimple_assign_lhs_ptr (gassign *gs)
2584 return &gs->op[0];
2587 static inline tree *
2588 gimple_assign_lhs_ptr (gimple *gs)
2590 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2591 return gimple_assign_lhs_ptr (ass);
2595 /* Set LHS to be the LHS operand of assignment statement GS. */
2597 static inline void
2598 gimple_assign_set_lhs (gassign *gs, tree lhs)
2600 gs->op[0] = lhs;
2602 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2603 SSA_NAME_DEF_STMT (lhs) = gs;
2606 static inline void
2607 gimple_assign_set_lhs (gimple *gs, tree lhs)
2609 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2610 gimple_assign_set_lhs (ass, lhs);
2614 /* Return the first operand on the RHS of assignment statement GS. */
2616 static inline tree
2617 gimple_assign_rhs1 (const gassign *gs)
2619 return gs->op[1];
2622 static inline tree
2623 gimple_assign_rhs1 (const gimple *gs)
2625 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2626 return gimple_assign_rhs1 (ass);
2630 /* Return a pointer to the first operand on the RHS of assignment
2631 statement GS. */
2633 static inline tree *
2634 gimple_assign_rhs1_ptr (gassign *gs)
2636 return &gs->op[1];
2639 static inline tree *
2640 gimple_assign_rhs1_ptr (gimple *gs)
2642 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2643 return gimple_assign_rhs1_ptr (ass);
2646 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2648 static inline void
2649 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2651 gs->op[1] = rhs;
2654 static inline void
2655 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2657 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2658 gimple_assign_set_rhs1 (ass, rhs);
2662 /* Return the second operand on the RHS of assignment statement GS.
2663 If GS does not have two operands, NULL is returned instead. */
2665 static inline tree
2666 gimple_assign_rhs2 (const gassign *gs)
2668 if (gimple_num_ops (gs) >= 3)
2669 return gs->op[2];
2670 else
2671 return NULL_TREE;
2674 static inline tree
2675 gimple_assign_rhs2 (const gimple *gs)
2677 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2678 return gimple_assign_rhs2 (ass);
2682 /* Return a pointer to the second operand on the RHS of assignment
2683 statement GS. */
2685 static inline tree *
2686 gimple_assign_rhs2_ptr (gassign *gs)
2688 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2689 return &gs->op[2];
2692 static inline tree *
2693 gimple_assign_rhs2_ptr (gimple *gs)
2695 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2696 return gimple_assign_rhs2_ptr (ass);
2700 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2702 static inline void
2703 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2705 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2706 gs->op[2] = rhs;
2709 static inline void
2710 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2712 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2713 return gimple_assign_set_rhs2 (ass, rhs);
2716 /* Return the third operand on the RHS of assignment statement GS.
2717 If GS does not have two operands, NULL is returned instead. */
2719 static inline tree
2720 gimple_assign_rhs3 (const gassign *gs)
2722 if (gimple_num_ops (gs) >= 4)
2723 return gs->op[3];
2724 else
2725 return NULL_TREE;
2728 static inline tree
2729 gimple_assign_rhs3 (const gimple *gs)
2731 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2732 return gimple_assign_rhs3 (ass);
2735 /* Return a pointer to the third operand on the RHS of assignment
2736 statement GS. */
2738 static inline tree *
2739 gimple_assign_rhs3_ptr (gimple *gs)
2741 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2742 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2743 return &ass->op[3];
2747 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2749 static inline void
2750 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2752 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2753 gs->op[3] = rhs;
2756 static inline void
2757 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2759 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2760 gimple_assign_set_rhs3 (ass, rhs);
2764 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2765 which expect to see only two operands. */
2767 static inline void
2768 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2769 tree op1, tree op2)
2771 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2774 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2775 which expect to see only one operands. */
2777 static inline void
2778 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2779 tree op1)
2781 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2784 /* Returns true if GS is a nontemporal move. */
2786 static inline bool
2787 gimple_assign_nontemporal_move_p (const gassign *gs)
2789 return gs->nontemporal_move;
2792 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2794 static inline void
2795 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2797 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2798 gs->nontemporal_move = nontemporal;
2802 /* Return the code of the expression computed on the rhs of assignment
2803 statement GS. In case that the RHS is a single object, returns the
2804 tree code of the object. */
2806 static inline enum tree_code
2807 gimple_assign_rhs_code (const gassign *gs)
2809 enum tree_code code = (enum tree_code) gs->subcode;
2810 /* While we initially set subcode to the TREE_CODE of the rhs for
2811 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2812 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2813 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2814 code = TREE_CODE (gs->op[1]);
2816 return code;
2819 static inline enum tree_code
2820 gimple_assign_rhs_code (const gimple *gs)
2822 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2823 return gimple_assign_rhs_code (ass);
2827 /* Set CODE to be the code for the expression computed on the RHS of
2828 assignment S. */
2830 static inline void
2831 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2833 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2834 s->subcode = code;
2838 /* Return the gimple rhs class of the code of the expression computed on
2839 the rhs of assignment statement GS.
2840 This will never return GIMPLE_INVALID_RHS. */
2842 static inline enum gimple_rhs_class
2843 gimple_assign_rhs_class (const gimple *gs)
2845 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2848 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2849 there is no operator associated with the assignment itself.
2850 Unlike gimple_assign_copy_p, this predicate returns true for
2851 any RHS operand, including those that perform an operation
2852 and do not have the semantics of a copy, such as COND_EXPR. */
2854 static inline bool
2855 gimple_assign_single_p (const gimple *gs)
2857 return (is_gimple_assign (gs)
2858 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2861 /* Return true if GS performs a store to its lhs. */
2863 static inline bool
2864 gimple_store_p (const gimple *gs)
2866 tree lhs = gimple_get_lhs (gs);
2867 return lhs && !is_gimple_reg (lhs);
2870 /* Return true if GS is an assignment that loads from its rhs1. */
2872 static inline bool
2873 gimple_assign_load_p (const gimple *gs)
2875 tree rhs;
2876 if (!gimple_assign_single_p (gs))
2877 return false;
2878 rhs = gimple_assign_rhs1 (gs);
2879 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2880 return true;
2881 rhs = get_base_address (rhs);
2882 return (DECL_P (rhs)
2883 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2887 /* Return true if S is a type-cast assignment. */
2889 static inline bool
2890 gimple_assign_cast_p (const gimple *s)
2892 if (is_gimple_assign (s))
2894 enum tree_code sc = gimple_assign_rhs_code (s);
2895 return CONVERT_EXPR_CODE_P (sc)
2896 || sc == VIEW_CONVERT_EXPR
2897 || sc == FIX_TRUNC_EXPR;
2900 return false;
2903 /* Return true if S is a clobber statement. */
2905 static inline bool
2906 gimple_clobber_p (const gimple *s)
2908 return gimple_assign_single_p (s)
2909 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2912 /* Return true if GS is a GIMPLE_CALL. */
2914 static inline bool
2915 is_gimple_call (const gimple *gs)
2917 return gimple_code (gs) == GIMPLE_CALL;
2920 /* Return the LHS of call statement GS. */
2922 static inline tree
2923 gimple_call_lhs (const gcall *gs)
2925 return gs->op[0];
2928 static inline tree
2929 gimple_call_lhs (const gimple *gs)
2931 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2932 return gimple_call_lhs (gc);
2936 /* Return a pointer to the LHS of call statement GS. */
2938 static inline tree *
2939 gimple_call_lhs_ptr (gcall *gs)
2941 return &gs->op[0];
2944 static inline tree *
2945 gimple_call_lhs_ptr (gimple *gs)
2947 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2948 return gimple_call_lhs_ptr (gc);
2952 /* Set LHS to be the LHS operand of call statement GS. */
2954 static inline void
2955 gimple_call_set_lhs (gcall *gs, tree lhs)
2957 gs->op[0] = lhs;
2958 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2959 SSA_NAME_DEF_STMT (lhs) = gs;
2962 static inline void
2963 gimple_call_set_lhs (gimple *gs, tree lhs)
2965 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2966 gimple_call_set_lhs (gc, lhs);
2970 /* Return true if call GS calls an internal-only function, as enumerated
2971 by internal_fn. */
2973 static inline bool
2974 gimple_call_internal_p (const gcall *gs)
2976 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2979 static inline bool
2980 gimple_call_internal_p (const gimple *gs)
2982 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2983 return gimple_call_internal_p (gc);
2986 /* Return true if call GS is marked as nocf_check. */
2988 static inline bool
2989 gimple_call_nocf_check_p (const gcall *gs)
2991 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2994 /* Mark statement GS as nocf_check call. */
2996 static inline void
2997 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2999 if (nocf_check)
3000 gs->subcode |= GF_CALL_NOCF_CHECK;
3001 else
3002 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3005 /* Return the target of internal call GS. */
3007 static inline enum internal_fn
3008 gimple_call_internal_fn (const gcall *gs)
3010 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3011 return gs->u.internal_fn;
3014 static inline enum internal_fn
3015 gimple_call_internal_fn (const gimple *gs)
3017 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3018 return gimple_call_internal_fn (gc);
3021 /* Return true, if this internal gimple call is unique. */
3023 static inline bool
3024 gimple_call_internal_unique_p (const gcall *gs)
3026 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3029 static inline bool
3030 gimple_call_internal_unique_p (const gimple *gs)
3032 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3033 return gimple_call_internal_unique_p (gc);
3036 /* Return true if GS is an internal function FN. */
3038 static inline bool
3039 gimple_call_internal_p (const gimple *gs, internal_fn fn)
3041 return (is_gimple_call (gs)
3042 && gimple_call_internal_p (gs)
3043 && gimple_call_internal_fn (gs) == fn);
3046 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3047 that could alter control flow. */
3049 static inline void
3050 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3052 if (ctrl_altering_p)
3053 s->subcode |= GF_CALL_CTRL_ALTERING;
3054 else
3055 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3058 static inline void
3059 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3061 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3062 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3065 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3066 flag is set. Such call could not be a stmt in the middle of a bb. */
3068 static inline bool
3069 gimple_call_ctrl_altering_p (const gcall *gs)
3071 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3074 static inline bool
3075 gimple_call_ctrl_altering_p (const gimple *gs)
3077 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3078 return gimple_call_ctrl_altering_p (gc);
3082 /* Return the function type of the function called by GS. */
3084 static inline tree
3085 gimple_call_fntype (const gcall *gs)
3087 if (gimple_call_internal_p (gs))
3088 return NULL_TREE;
3089 return gs->u.fntype;
3092 static inline tree
3093 gimple_call_fntype (const gimple *gs)
3095 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3096 return gimple_call_fntype (call_stmt);
3099 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3101 static inline void
3102 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3104 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3105 call_stmt->u.fntype = fntype;
3109 /* Return the tree node representing the function called by call
3110 statement GS. */
3112 static inline tree
3113 gimple_call_fn (const gcall *gs)
3115 return gs->op[1];
3118 static inline tree
3119 gimple_call_fn (const gimple *gs)
3121 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3122 return gimple_call_fn (gc);
3125 /* Return a pointer to the tree node representing the function called by call
3126 statement GS. */
3128 static inline tree *
3129 gimple_call_fn_ptr (gcall *gs)
3131 return &gs->op[1];
3134 static inline tree *
3135 gimple_call_fn_ptr (gimple *gs)
3137 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3138 return gimple_call_fn_ptr (gc);
3142 /* Set FN to be the function called by call statement GS. */
3144 static inline void
3145 gimple_call_set_fn (gcall *gs, tree fn)
3147 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3148 gs->op[1] = fn;
3152 /* Set FNDECL to be the function called by call statement GS. */
3154 static inline void
3155 gimple_call_set_fndecl (gcall *gs, tree decl)
3157 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3158 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3159 build_pointer_type (TREE_TYPE (decl)), decl);
3162 static inline void
3163 gimple_call_set_fndecl (gimple *gs, tree decl)
3165 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3166 gimple_call_set_fndecl (gc, decl);
3170 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3172 static inline void
3173 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3175 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3176 call_stmt->u.internal_fn = fn;
3180 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3181 Otherwise return NULL. This function is analogous to
3182 get_callee_fndecl in tree land. */
3184 static inline tree
3185 gimple_call_fndecl (const gcall *gs)
3187 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3190 static inline tree
3191 gimple_call_fndecl (const gimple *gs)
3193 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3194 return gimple_call_fndecl (gc);
3198 /* Return the type returned by call statement GS. */
3200 static inline tree
3201 gimple_call_return_type (const gcall *gs)
3203 tree type = gimple_call_fntype (gs);
3205 if (type == NULL_TREE)
3206 return TREE_TYPE (gimple_call_lhs (gs));
3208 /* The type returned by a function is the type of its
3209 function type. */
3210 return TREE_TYPE (type);
3214 /* Return the static chain for call statement GS. */
3216 static inline tree
3217 gimple_call_chain (const gcall *gs)
3219 return gs->op[2];
3222 static inline tree
3223 gimple_call_chain (const gimple *gs)
3225 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3226 return gimple_call_chain (gc);
3230 /* Return a pointer to the static chain for call statement CALL_STMT. */
3232 static inline tree *
3233 gimple_call_chain_ptr (gcall *call_stmt)
3235 return &call_stmt->op[2];
3238 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3240 static inline void
3241 gimple_call_set_chain (gcall *call_stmt, tree chain)
3243 call_stmt->op[2] = chain;
3247 /* Return the number of arguments used by call statement GS. */
3249 static inline unsigned
3250 gimple_call_num_args (const gcall *gs)
3252 return gimple_num_ops (gs) - 3;
3255 static inline unsigned
3256 gimple_call_num_args (const gimple *gs)
3258 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3259 return gimple_call_num_args (gc);
3263 /* Return the argument at position INDEX for call statement GS. */
3265 static inline tree
3266 gimple_call_arg (const gcall *gs, unsigned index)
3268 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3269 return gs->op[index + 3];
3272 static inline tree
3273 gimple_call_arg (const gimple *gs, unsigned index)
3275 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3276 return gimple_call_arg (gc, index);
3280 /* Return a pointer to the argument at position INDEX for call
3281 statement GS. */
3283 static inline tree *
3284 gimple_call_arg_ptr (gcall *gs, unsigned index)
3286 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3287 return &gs->op[index + 3];
3290 static inline tree *
3291 gimple_call_arg_ptr (gimple *gs, unsigned index)
3293 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3294 return gimple_call_arg_ptr (gc, index);
3298 /* Set ARG to be the argument at position INDEX for call statement GS. */
3300 static inline void
3301 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3303 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3304 gs->op[index + 3] = arg;
3307 static inline void
3308 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3310 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3311 gimple_call_set_arg (gc, index, arg);
3315 /* If TAIL_P is true, mark call statement S as being a tail call
3316 (i.e., a call just before the exit of a function). These calls are
3317 candidate for tail call optimization. */
3319 static inline void
3320 gimple_call_set_tail (gcall *s, bool tail_p)
3322 if (tail_p)
3323 s->subcode |= GF_CALL_TAILCALL;
3324 else
3325 s->subcode &= ~GF_CALL_TAILCALL;
3329 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3331 static inline bool
3332 gimple_call_tail_p (const gcall *s)
3334 return (s->subcode & GF_CALL_TAILCALL) != 0;
3337 /* Mark (or clear) call statement S as requiring tail call optimization. */
3339 static inline void
3340 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3342 if (must_tail_p)
3343 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3344 else
3345 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3348 /* Return true if call statement has been marked as requiring
3349 tail call optimization. */
3351 static inline bool
3352 gimple_call_must_tail_p (const gcall *s)
3354 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3357 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3358 slot optimization. This transformation uses the target of the call
3359 expansion as the return slot for calls that return in memory. */
3361 static inline void
3362 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3364 if (return_slot_opt_p)
3365 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3366 else
3367 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3371 /* Return true if S is marked for return slot optimization. */
3373 static inline bool
3374 gimple_call_return_slot_opt_p (const gcall *s)
3376 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3380 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3381 thunk to the thunked-to function. */
3383 static inline void
3384 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3386 if (from_thunk_p)
3387 s->subcode |= GF_CALL_FROM_THUNK;
3388 else
3389 s->subcode &= ~GF_CALL_FROM_THUNK;
3393 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3395 static inline bool
3396 gimple_call_from_thunk_p (gcall *s)
3398 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3402 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3403 to operator new or delete created from a new or delete expression. */
3405 static inline void
3406 gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3408 if (from_new_or_delete_p)
3409 s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
3410 else
3411 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3415 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3416 from a new or delete expression. */
3418 static inline bool
3419 gimple_call_from_new_or_delete (const gcall *s)
3421 return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
3425 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3426 argument pack in its argument list. */
3428 static inline void
3429 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3431 if (pass_arg_pack_p)
3432 s->subcode |= GF_CALL_VA_ARG_PACK;
3433 else
3434 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3438 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3439 argument pack in its argument list. */
3441 static inline bool
3442 gimple_call_va_arg_pack_p (const gcall *s)
3444 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3448 /* Return true if S is a noreturn call. */
3450 static inline bool
3451 gimple_call_noreturn_p (const gcall *s)
3453 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3456 static inline bool
3457 gimple_call_noreturn_p (const gimple *s)
3459 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3460 return gimple_call_noreturn_p (gc);
3464 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3465 even if the called function can throw in other cases. */
3467 static inline void
3468 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3470 if (nothrow_p)
3471 s->subcode |= GF_CALL_NOTHROW;
3472 else
3473 s->subcode &= ~GF_CALL_NOTHROW;
3476 /* Return true if S is a nothrow call. */
3478 static inline bool
3479 gimple_call_nothrow_p (gcall *s)
3481 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3484 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3485 is known to be emitted for VLA objects. Those are wrapped by
3486 stack_save/stack_restore calls and hence can't lead to unbounded
3487 stack growth even when they occur in loops. */
3489 static inline void
3490 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3492 if (for_var)
3493 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3494 else
3495 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3498 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3500 static inline bool
3501 gimple_call_alloca_for_var_p (gcall *s)
3503 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3506 static inline bool
3507 gimple_call_alloca_for_var_p (gimple *s)
3509 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3510 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3513 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3514 pointers to nested function are descriptors instead of trampolines. */
3516 static inline void
3517 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3519 if (by_descriptor_p)
3520 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3521 else
3522 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3525 /* Return true if S is a by-descriptor call. */
3527 static inline bool
3528 gimple_call_by_descriptor_p (gcall *s)
3530 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3533 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3535 static inline void
3536 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3538 dest_call->subcode = orig_call->subcode;
3542 /* Return a pointer to the points-to solution for the set of call-used
3543 variables of the call CALL_STMT. */
3545 static inline struct pt_solution *
3546 gimple_call_use_set (gcall *call_stmt)
3548 return &call_stmt->call_used;
3551 /* As above, but const. */
3553 static inline const pt_solution *
3554 gimple_call_use_set (const gcall *call_stmt)
3556 return &call_stmt->call_used;
3559 /* Return a pointer to the points-to solution for the set of call-used
3560 variables of the call CALL_STMT. */
3562 static inline struct pt_solution *
3563 gimple_call_clobber_set (gcall *call_stmt)
3565 return &call_stmt->call_clobbered;
3568 /* As above, but const. */
3570 static inline const pt_solution *
3571 gimple_call_clobber_set (const gcall *call_stmt)
3573 return &call_stmt->call_clobbered;
3577 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3578 non-NULL lhs. */
3580 static inline bool
3581 gimple_has_lhs (const gimple *stmt)
3583 if (is_gimple_assign (stmt))
3584 return true;
3585 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3586 return gimple_call_lhs (call) != NULL_TREE;
3587 return false;
3591 /* Return the code of the predicate computed by conditional statement GS. */
3593 static inline enum tree_code
3594 gimple_cond_code (const gcond *gs)
3596 return (enum tree_code) gs->subcode;
3599 static inline enum tree_code
3600 gimple_cond_code (const gimple *gs)
3602 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3603 return gimple_cond_code (gc);
3607 /* Set CODE to be the predicate code for the conditional statement GS. */
3609 static inline void
3610 gimple_cond_set_code (gcond *gs, enum tree_code code)
3612 gs->subcode = code;
3616 /* Return the LHS of the predicate computed by conditional statement GS. */
3618 static inline tree
3619 gimple_cond_lhs (const gcond *gs)
3621 return gs->op[0];
3624 static inline tree
3625 gimple_cond_lhs (const gimple *gs)
3627 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3628 return gimple_cond_lhs (gc);
3631 /* Return the pointer to the LHS of the predicate computed by conditional
3632 statement GS. */
3634 static inline tree *
3635 gimple_cond_lhs_ptr (gcond *gs)
3637 return &gs->op[0];
3640 /* Set LHS to be the LHS operand of the predicate computed by
3641 conditional statement GS. */
3643 static inline void
3644 gimple_cond_set_lhs (gcond *gs, tree lhs)
3646 gs->op[0] = lhs;
3650 /* Return the RHS operand of the predicate computed by conditional GS. */
3652 static inline tree
3653 gimple_cond_rhs (const gcond *gs)
3655 return gs->op[1];
3658 static inline tree
3659 gimple_cond_rhs (const gimple *gs)
3661 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3662 return gimple_cond_rhs (gc);
3665 /* Return the pointer to the RHS operand of the predicate computed by
3666 conditional GS. */
3668 static inline tree *
3669 gimple_cond_rhs_ptr (gcond *gs)
3671 return &gs->op[1];
3675 /* Set RHS to be the RHS operand of the predicate computed by
3676 conditional statement GS. */
3678 static inline void
3679 gimple_cond_set_rhs (gcond *gs, tree rhs)
3681 gs->op[1] = rhs;
3685 /* Return the label used by conditional statement GS when its
3686 predicate evaluates to true. */
3688 static inline tree
3689 gimple_cond_true_label (const gcond *gs)
3691 return gs->op[2];
3695 /* Set LABEL to be the label used by conditional statement GS when its
3696 predicate evaluates to true. */
3698 static inline void
3699 gimple_cond_set_true_label (gcond *gs, tree label)
3701 gs->op[2] = label;
3705 /* Set LABEL to be the label used by conditional statement GS when its
3706 predicate evaluates to false. */
3708 static inline void
3709 gimple_cond_set_false_label (gcond *gs, tree label)
3711 gs->op[3] = label;
3715 /* Return the label used by conditional statement GS when its
3716 predicate evaluates to false. */
3718 static inline tree
3719 gimple_cond_false_label (const gcond *gs)
3721 return gs->op[3];
3725 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3727 static inline void
3728 gimple_cond_make_false (gcond *gs)
3730 gimple_cond_set_lhs (gs, boolean_false_node);
3731 gimple_cond_set_rhs (gs, boolean_false_node);
3732 gs->subcode = NE_EXPR;
3736 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3738 static inline void
3739 gimple_cond_make_true (gcond *gs)
3741 gimple_cond_set_lhs (gs, boolean_true_node);
3742 gimple_cond_set_rhs (gs, boolean_false_node);
3743 gs->subcode = NE_EXPR;
3746 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3747 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3749 static inline bool
3750 gimple_cond_true_p (const gcond *gs)
3752 tree lhs = gimple_cond_lhs (gs);
3753 tree rhs = gimple_cond_rhs (gs);
3754 enum tree_code code = gimple_cond_code (gs);
3756 if (lhs != boolean_true_node && lhs != boolean_false_node)
3757 return false;
3759 if (rhs != boolean_true_node && rhs != boolean_false_node)
3760 return false;
3762 if (code == NE_EXPR && lhs != rhs)
3763 return true;
3765 if (code == EQ_EXPR && lhs == rhs)
3766 return true;
3768 return false;
3771 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3772 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3774 static inline bool
3775 gimple_cond_false_p (const gcond *gs)
3777 tree lhs = gimple_cond_lhs (gs);
3778 tree rhs = gimple_cond_rhs (gs);
3779 enum tree_code code = gimple_cond_code (gs);
3781 if (lhs != boolean_true_node && lhs != boolean_false_node)
3782 return false;
3784 if (rhs != boolean_true_node && rhs != boolean_false_node)
3785 return false;
3787 if (code == NE_EXPR && lhs == rhs)
3788 return true;
3790 if (code == EQ_EXPR && lhs != rhs)
3791 return true;
3793 return false;
3796 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3798 static inline void
3799 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3800 tree rhs)
3802 gimple_cond_set_code (stmt, code);
3803 gimple_cond_set_lhs (stmt, lhs);
3804 gimple_cond_set_rhs (stmt, rhs);
3808 /* Return the tree code for the expression computed by STMT. This is
3809 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3810 GIMPLE_CALL, return CALL_EXPR as the expression code for
3811 consistency. This is useful when the caller needs to deal with the
3812 three kinds of computation that GIMPLE supports. */
3814 static inline enum tree_code
3815 gimple_expr_code (const gimple *stmt)
3817 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3818 return gimple_assign_rhs_code (ass);
3819 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3820 return gimple_cond_code (cond);
3821 else
3823 gcc_gimple_checking_assert (gimple_code (stmt) == GIMPLE_CALL);
3824 return CALL_EXPR;
3829 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3831 static inline tree
3832 gimple_label_label (const glabel *gs)
3834 return gs->op[0];
3838 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3839 GS. */
3841 static inline void
3842 gimple_label_set_label (glabel *gs, tree label)
3844 gs->op[0] = label;
3848 /* Return the destination of the unconditional jump GS. */
3850 static inline tree
3851 gimple_goto_dest (const gimple *gs)
3853 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3854 return gimple_op (gs, 0);
3858 /* Set DEST to be the destination of the unconditonal jump GS. */
3860 static inline void
3861 gimple_goto_set_dest (ggoto *gs, tree dest)
3863 gs->op[0] = dest;
3867 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3869 static inline tree
3870 gimple_bind_vars (const gbind *bind_stmt)
3872 return bind_stmt->vars;
3876 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3877 statement GS. */
3879 static inline void
3880 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3882 bind_stmt->vars = vars;
3886 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3887 statement GS. */
3889 static inline void
3890 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3892 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3896 static inline gimple_seq *
3897 gimple_bind_body_ptr (gbind *bind_stmt)
3899 return &bind_stmt->body;
3902 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3904 static inline gimple_seq
3905 gimple_bind_body (const gbind *gs)
3907 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3911 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3912 statement GS. */
3914 static inline void
3915 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3917 bind_stmt->body = seq;
3921 /* Append a statement to the end of a GIMPLE_BIND's body. */
3923 static inline void
3924 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3926 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3930 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3932 static inline void
3933 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3935 gimple_seq_add_seq (&bind_stmt->body, seq);
3939 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3940 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3942 static inline tree
3943 gimple_bind_block (const gbind *bind_stmt)
3945 return bind_stmt->block;
3949 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3950 statement GS. */
3952 static inline void
3953 gimple_bind_set_block (gbind *bind_stmt, tree block)
3955 gcc_gimple_checking_assert (block == NULL_TREE
3956 || TREE_CODE (block) == BLOCK);
3957 bind_stmt->block = block;
3961 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3963 static inline unsigned
3964 gimple_asm_ninputs (const gasm *asm_stmt)
3966 return asm_stmt->ni;
3970 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3972 static inline unsigned
3973 gimple_asm_noutputs (const gasm *asm_stmt)
3975 return asm_stmt->no;
3979 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3981 static inline unsigned
3982 gimple_asm_nclobbers (const gasm *asm_stmt)
3984 return asm_stmt->nc;
3987 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3989 static inline unsigned
3990 gimple_asm_nlabels (const gasm *asm_stmt)
3992 return asm_stmt->nl;
3995 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3997 static inline tree
3998 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4000 gcc_gimple_checking_assert (index < asm_stmt->ni);
4001 return asm_stmt->op[index + asm_stmt->no];
4004 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4006 static inline void
4007 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4009 gcc_gimple_checking_assert (index < asm_stmt->ni
4010 && TREE_CODE (in_op) == TREE_LIST);
4011 asm_stmt->op[index + asm_stmt->no] = in_op;
4015 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4017 static inline tree
4018 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4020 gcc_gimple_checking_assert (index < asm_stmt->no);
4021 return asm_stmt->op[index];
4024 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4026 static inline void
4027 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4029 gcc_gimple_checking_assert (index < asm_stmt->no
4030 && TREE_CODE (out_op) == TREE_LIST);
4031 asm_stmt->op[index] = out_op;
4035 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4037 static inline tree
4038 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4040 gcc_gimple_checking_assert (index < asm_stmt->nc);
4041 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4045 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4047 static inline void
4048 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4050 gcc_gimple_checking_assert (index < asm_stmt->nc
4051 && TREE_CODE (clobber_op) == TREE_LIST);
4052 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4055 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4057 static inline tree
4058 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4060 gcc_gimple_checking_assert (index < asm_stmt->nl);
4061 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4064 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4066 static inline void
4067 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4069 gcc_gimple_checking_assert (index < asm_stmt->nl
4070 && TREE_CODE (label_op) == TREE_LIST);
4071 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4074 /* Return the string representing the assembly instruction in
4075 GIMPLE_ASM ASM_STMT. */
4077 static inline const char *
4078 gimple_asm_string (const gasm *asm_stmt)
4080 return asm_stmt->string;
4084 /* Return true if ASM_STMT is marked volatile. */
4086 static inline bool
4087 gimple_asm_volatile_p (const gasm *asm_stmt)
4089 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4093 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4095 static inline void
4096 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4098 if (volatile_p)
4099 asm_stmt->subcode |= GF_ASM_VOLATILE;
4100 else
4101 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4105 /* Return true if ASM_STMT is marked inline. */
4107 static inline bool
4108 gimple_asm_inline_p (const gasm *asm_stmt)
4110 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4114 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4116 static inline void
4117 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4119 if (inline_p)
4120 asm_stmt->subcode |= GF_ASM_INLINE;
4121 else
4122 asm_stmt->subcode &= ~GF_ASM_INLINE;
4126 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4128 static inline void
4129 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4131 if (input_p)
4132 asm_stmt->subcode |= GF_ASM_INPUT;
4133 else
4134 asm_stmt->subcode &= ~GF_ASM_INPUT;
4138 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4140 static inline bool
4141 gimple_asm_input_p (const gasm *asm_stmt)
4143 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4147 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4149 static inline tree
4150 gimple_catch_types (const gcatch *catch_stmt)
4152 return catch_stmt->types;
4156 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4158 static inline tree *
4159 gimple_catch_types_ptr (gcatch *catch_stmt)
4161 return &catch_stmt->types;
4165 /* Return a pointer to the GIMPLE sequence representing the body of
4166 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4168 static inline gimple_seq *
4169 gimple_catch_handler_ptr (gcatch *catch_stmt)
4171 return &catch_stmt->handler;
4175 /* Return the GIMPLE sequence representing the body of the handler of
4176 GIMPLE_CATCH statement CATCH_STMT. */
4178 static inline gimple_seq
4179 gimple_catch_handler (const gcatch *catch_stmt)
4181 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4185 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4187 static inline void
4188 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4190 catch_stmt->types = t;
4194 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4196 static inline void
4197 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4199 catch_stmt->handler = handler;
4203 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4205 static inline tree
4206 gimple_eh_filter_types (const gimple *gs)
4208 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4209 return eh_filter_stmt->types;
4213 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4214 GS. */
4216 static inline tree *
4217 gimple_eh_filter_types_ptr (gimple *gs)
4219 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4220 return &eh_filter_stmt->types;
4224 /* Return a pointer to the sequence of statement to execute when
4225 GIMPLE_EH_FILTER statement fails. */
4227 static inline gimple_seq *
4228 gimple_eh_filter_failure_ptr (gimple *gs)
4230 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4231 return &eh_filter_stmt->failure;
4235 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4236 statement fails. */
4238 static inline gimple_seq
4239 gimple_eh_filter_failure (const gimple *gs)
4241 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4245 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4246 EH_FILTER_STMT. */
4248 static inline void
4249 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4251 eh_filter_stmt->types = types;
4255 /* Set FAILURE to be the sequence of statements to execute on failure
4256 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4258 static inline void
4259 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4260 gimple_seq failure)
4262 eh_filter_stmt->failure = failure;
4265 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4267 static inline tree
4268 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4270 return eh_mnt_stmt->fndecl;
4273 /* Set the function decl to be called by GS to DECL. */
4275 static inline void
4276 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4277 tree decl)
4279 eh_mnt_stmt->fndecl = decl;
4282 /* GIMPLE_EH_ELSE accessors. */
4284 static inline gimple_seq *
4285 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4287 return &eh_else_stmt->n_body;
4290 static inline gimple_seq
4291 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4293 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4296 static inline gimple_seq *
4297 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4299 return &eh_else_stmt->e_body;
4302 static inline gimple_seq
4303 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4305 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4308 static inline void
4309 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4311 eh_else_stmt->n_body = seq;
4314 static inline void
4315 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4317 eh_else_stmt->e_body = seq;
4320 /* GIMPLE_TRY accessors. */
4322 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4323 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4325 static inline enum gimple_try_flags
4326 gimple_try_kind (const gimple *gs)
4328 GIMPLE_CHECK (gs, GIMPLE_TRY);
4329 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4333 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4335 static inline void
4336 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4338 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4339 || kind == GIMPLE_TRY_FINALLY);
4340 if (gimple_try_kind (gs) != kind)
4341 gs->subcode = (unsigned int) kind;
4345 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4347 static inline bool
4348 gimple_try_catch_is_cleanup (const gimple *gs)
4350 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4351 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4355 /* Return a pointer to the sequence of statements used as the
4356 body for GIMPLE_TRY GS. */
4358 static inline gimple_seq *
4359 gimple_try_eval_ptr (gimple *gs)
4361 gtry *try_stmt = as_a <gtry *> (gs);
4362 return &try_stmt->eval;
4366 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4368 static inline gimple_seq
4369 gimple_try_eval (const gimple *gs)
4371 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4375 /* Return a pointer to the sequence of statements used as the cleanup body for
4376 GIMPLE_TRY GS. */
4378 static inline gimple_seq *
4379 gimple_try_cleanup_ptr (gimple *gs)
4381 gtry *try_stmt = as_a <gtry *> (gs);
4382 return &try_stmt->cleanup;
4386 /* Return the sequence of statements used as the cleanup body for
4387 GIMPLE_TRY GS. */
4389 static inline gimple_seq
4390 gimple_try_cleanup (const gimple *gs)
4392 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4396 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4398 static inline void
4399 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4401 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4402 if (catch_is_cleanup)
4403 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4404 else
4405 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4409 /* Set EVAL to be the sequence of statements to use as the body for
4410 GIMPLE_TRY TRY_STMT. */
4412 static inline void
4413 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4415 try_stmt->eval = eval;
4419 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4420 body for GIMPLE_TRY TRY_STMT. */
4422 static inline void
4423 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4425 try_stmt->cleanup = cleanup;
4429 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4431 static inline gimple_seq *
4432 gimple_wce_cleanup_ptr (gimple *gs)
4434 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4435 return &wce_stmt->cleanup;
4439 /* Return the cleanup sequence for cleanup statement GS. */
4441 static inline gimple_seq
4442 gimple_wce_cleanup (gimple *gs)
4444 return *gimple_wce_cleanup_ptr (gs);
4448 /* Set CLEANUP to be the cleanup sequence for GS. */
4450 static inline void
4451 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4453 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4454 wce_stmt->cleanup = cleanup;
4458 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4460 static inline bool
4461 gimple_wce_cleanup_eh_only (const gimple *gs)
4463 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4464 return gs->subcode != 0;
4468 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4470 static inline void
4471 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4473 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4474 gs->subcode = (unsigned int) eh_only_p;
4478 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4480 static inline unsigned
4481 gimple_phi_capacity (const gimple *gs)
4483 const gphi *phi_stmt = as_a <const gphi *> (gs);
4484 return phi_stmt->capacity;
4488 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4489 be exactly the number of incoming edges for the basic block holding
4490 GS. */
4492 static inline unsigned
4493 gimple_phi_num_args (const gimple *gs)
4495 const gphi *phi_stmt = as_a <const gphi *> (gs);
4496 return phi_stmt->nargs;
4500 /* Return the SSA name created by GIMPLE_PHI GS. */
4502 static inline tree
4503 gimple_phi_result (const gphi *gs)
4505 return gs->result;
4508 static inline tree
4509 gimple_phi_result (const gimple *gs)
4511 const gphi *phi_stmt = as_a <const gphi *> (gs);
4512 return gimple_phi_result (phi_stmt);
4515 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4517 static inline tree *
4518 gimple_phi_result_ptr (gphi *gs)
4520 return &gs->result;
4523 static inline tree *
4524 gimple_phi_result_ptr (gimple *gs)
4526 gphi *phi_stmt = as_a <gphi *> (gs);
4527 return gimple_phi_result_ptr (phi_stmt);
4530 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4532 static inline void
4533 gimple_phi_set_result (gphi *phi, tree result)
4535 phi->result = result;
4536 if (result && TREE_CODE (result) == SSA_NAME)
4537 SSA_NAME_DEF_STMT (result) = phi;
4541 /* Return the PHI argument corresponding to incoming edge INDEX for
4542 GIMPLE_PHI GS. */
4544 static inline struct phi_arg_d *
4545 gimple_phi_arg (gphi *gs, unsigned index)
4547 gcc_gimple_checking_assert (index < gs->nargs);
4548 return &(gs->args[index]);
4551 static inline const phi_arg_d *
4552 gimple_phi_arg (const gphi *gs, unsigned index)
4554 gcc_gimple_checking_assert (index < gs->nargs);
4555 return &(gs->args[index]);
4558 static inline struct phi_arg_d *
4559 gimple_phi_arg (gimple *gs, unsigned index)
4561 gphi *phi_stmt = as_a <gphi *> (gs);
4562 return gimple_phi_arg (phi_stmt, index);
4565 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4566 for GIMPLE_PHI PHI. */
4568 static inline void
4569 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4571 gcc_gimple_checking_assert (index < phi->nargs);
4572 phi->args[index] = *phiarg;
4575 /* Return the PHI nodes for basic block BB, or NULL if there are no
4576 PHI nodes. */
4578 static inline gimple_seq
4579 phi_nodes (const_basic_block bb)
4581 gcc_checking_assert (!(bb->flags & BB_RTL));
4582 return bb->il.gimple.phi_nodes;
4585 /* Return a pointer to the PHI nodes for basic block BB. */
4587 static inline gimple_seq *
4588 phi_nodes_ptr (basic_block bb)
4590 gcc_checking_assert (!(bb->flags & BB_RTL));
4591 return &bb->il.gimple.phi_nodes;
4594 /* Return the tree operand for argument I of PHI node GS. */
4596 static inline tree
4597 gimple_phi_arg_def (const gphi *gs, size_t index)
4599 return gimple_phi_arg (gs, index)->def;
4602 static inline tree
4603 gimple_phi_arg_def (gimple *gs, size_t index)
4605 return gimple_phi_arg (gs, index)->def;
4609 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4611 static inline tree *
4612 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4614 return &gimple_phi_arg (phi, index)->def;
4617 /* Return the edge associated with argument I of phi node PHI. */
4619 static inline edge
4620 gimple_phi_arg_edge (const gphi *phi, size_t i)
4622 return EDGE_PRED (gimple_bb (phi), i);
4625 /* Return the source location of gimple argument I of phi node PHI. */
4627 static inline location_t
4628 gimple_phi_arg_location (const gphi *phi, size_t i)
4630 return gimple_phi_arg (phi, i)->locus;
4633 /* Return the source location of the argument on edge E of phi node PHI. */
4635 static inline location_t
4636 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4638 return gimple_phi_arg (phi, e->dest_idx)->locus;
4641 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4643 static inline void
4644 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4646 gimple_phi_arg (phi, i)->locus = loc;
4649 /* Return address of source location of gimple argument I of phi node PHI. */
4651 static inline location_t *
4652 gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4654 return &gimple_phi_arg (phi, i)->locus;
4657 /* Return TRUE if argument I of phi node PHI has a location record. */
4659 static inline bool
4660 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4662 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4666 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4668 static inline int
4669 gimple_resx_region (const gresx *resx_stmt)
4671 return resx_stmt->region;
4674 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4676 static inline void
4677 gimple_resx_set_region (gresx *resx_stmt, int region)
4679 resx_stmt->region = region;
4682 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4684 static inline int
4685 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4687 return eh_dispatch_stmt->region;
4690 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4691 EH_DISPATCH_STMT. */
4693 static inline void
4694 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4696 eh_dispatch_stmt->region = region;
4699 /* Return the number of labels associated with the switch statement GS. */
4701 static inline unsigned
4702 gimple_switch_num_labels (const gswitch *gs)
4704 unsigned num_ops;
4705 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4706 num_ops = gimple_num_ops (gs);
4707 gcc_gimple_checking_assert (num_ops > 1);
4708 return num_ops - 1;
4712 /* Set NLABELS to be the number of labels for the switch statement GS. */
4714 static inline void
4715 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4717 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4718 gimple_set_num_ops (g, nlabels + 1);
4722 /* Return the index variable used by the switch statement GS. */
4724 static inline tree
4725 gimple_switch_index (const gswitch *gs)
4727 return gs->op[0];
4731 /* Return a pointer to the index variable for the switch statement GS. */
4733 static inline tree *
4734 gimple_switch_index_ptr (gswitch *gs)
4736 return &gs->op[0];
4740 /* Set INDEX to be the index variable for switch statement GS. */
4742 static inline void
4743 gimple_switch_set_index (gswitch *gs, tree index)
4745 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4746 gs->op[0] = index;
4750 /* Return the label numbered INDEX. The default label is 0, followed by any
4751 labels in a switch statement. */
4753 static inline tree
4754 gimple_switch_label (const gswitch *gs, unsigned index)
4756 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4757 return gs->op[index + 1];
4760 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4762 static inline void
4763 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4765 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4766 && (label == NULL_TREE
4767 || TREE_CODE (label) == CASE_LABEL_EXPR));
4768 gs->op[index + 1] = label;
4771 /* Return the default label for a switch statement. */
4773 static inline tree
4774 gimple_switch_default_label (const gswitch *gs)
4776 tree label = gimple_switch_label (gs, 0);
4777 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4778 return label;
4781 /* Set the default label for a switch statement. */
4783 static inline void
4784 gimple_switch_set_default_label (gswitch *gs, tree label)
4786 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4787 gimple_switch_set_label (gs, 0, label);
4790 /* Return true if GS is a GIMPLE_DEBUG statement. */
4792 static inline bool
4793 is_gimple_debug (const gimple *gs)
4795 return gimple_code (gs) == GIMPLE_DEBUG;
4799 /* Return the first nondebug statement in GIMPLE sequence S. */
4801 static inline gimple *
4802 gimple_seq_first_nondebug_stmt (gimple_seq s)
4804 gimple_seq_node n = gimple_seq_first (s);
4805 while (n && is_gimple_debug (n))
4806 n = n->next;
4807 return n;
4811 /* Return the last nondebug statement in GIMPLE sequence S. */
4813 static inline gimple *
4814 gimple_seq_last_nondebug_stmt (gimple_seq s)
4816 gimple_seq_node n;
4817 for (n = gimple_seq_last (s);
4818 n && is_gimple_debug (n);
4819 n = n->prev)
4820 if (n == s)
4821 return NULL;
4822 return n;
4826 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4828 static inline bool
4829 gimple_debug_bind_p (const gimple *s)
4831 if (is_gimple_debug (s))
4832 return s->subcode == GIMPLE_DEBUG_BIND;
4834 return false;
4837 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4839 static inline tree
4840 gimple_debug_bind_get_var (const gimple *dbg)
4842 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4843 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4844 return gimple_op (dbg, 0);
4847 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4848 statement. */
4850 static inline tree
4851 gimple_debug_bind_get_value (const gimple *dbg)
4853 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4854 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4855 return gimple_op (dbg, 1);
4858 /* Return a pointer to the value bound to the variable in a
4859 GIMPLE_DEBUG bind statement. */
4861 static inline tree *
4862 gimple_debug_bind_get_value_ptr (gimple *dbg)
4864 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4865 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4866 return gimple_op_ptr (dbg, 1);
4869 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4871 static inline void
4872 gimple_debug_bind_set_var (gimple *dbg, tree var)
4874 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4875 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4876 gimple_set_op (dbg, 0, var);
4879 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4880 statement. */
4882 static inline void
4883 gimple_debug_bind_set_value (gimple *dbg, tree value)
4885 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4886 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4887 gimple_set_op (dbg, 1, value);
4890 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4891 optimized away. */
4892 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4894 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4895 statement. */
4897 static inline void
4898 gimple_debug_bind_reset_value (gimple *dbg)
4900 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4901 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4902 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4905 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4906 value. */
4908 static inline bool
4909 gimple_debug_bind_has_value_p (gimple *dbg)
4911 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4912 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4913 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4916 #undef GIMPLE_DEBUG_BIND_NOVALUE
4918 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4920 static inline bool
4921 gimple_debug_source_bind_p (const gimple *s)
4923 if (is_gimple_debug (s))
4924 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4926 return false;
4929 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4931 static inline tree
4932 gimple_debug_source_bind_get_var (const gimple *dbg)
4934 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4935 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4936 return gimple_op (dbg, 0);
4939 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4940 statement. */
4942 static inline tree
4943 gimple_debug_source_bind_get_value (const gimple *dbg)
4945 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4946 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4947 return gimple_op (dbg, 1);
4950 /* Return a pointer to the value bound to the variable in a
4951 GIMPLE_DEBUG source bind statement. */
4953 static inline tree *
4954 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4956 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4957 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4958 return gimple_op_ptr (dbg, 1);
4961 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4963 static inline void
4964 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4966 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4967 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4968 gimple_set_op (dbg, 0, var);
4971 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4972 statement. */
4974 static inline void
4975 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4977 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4978 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4979 gimple_set_op (dbg, 1, value);
4982 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4984 static inline bool
4985 gimple_debug_begin_stmt_p (const gimple *s)
4987 if (is_gimple_debug (s))
4988 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
4990 return false;
4993 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4995 static inline bool
4996 gimple_debug_inline_entry_p (const gimple *s)
4998 if (is_gimple_debug (s))
4999 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5001 return false;
5004 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5006 static inline bool
5007 gimple_debug_nonbind_marker_p (const gimple *s)
5009 if (is_gimple_debug (s))
5010 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5011 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5013 return false;
5016 /* Return the line number for EXPR, or return -1 if we have no line
5017 number information for it. */
5018 static inline int
5019 get_lineno (const gimple *stmt)
5021 location_t loc;
5023 if (!stmt)
5024 return -1;
5026 loc = gimple_location (stmt);
5027 if (loc == UNKNOWN_LOCATION)
5028 return -1;
5030 return LOCATION_LINE (loc);
5033 /* Return a pointer to the body for the OMP statement GS. */
5035 static inline gimple_seq *
5036 gimple_omp_body_ptr (gimple *gs)
5038 return &static_cast <gimple_statement_omp *> (gs)->body;
5041 /* Return the body for the OMP statement GS. */
5043 static inline gimple_seq
5044 gimple_omp_body (const gimple *gs)
5046 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
5049 /* Set BODY to be the body for the OMP statement GS. */
5051 static inline void
5052 gimple_omp_set_body (gimple *gs, gimple_seq body)
5054 static_cast <gimple_statement_omp *> (gs)->body = body;
5058 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5060 static inline tree
5061 gimple_omp_critical_name (const gomp_critical *crit_stmt)
5063 return crit_stmt->name;
5067 /* Return a pointer to the name associated with OMP critical statement
5068 CRIT_STMT. */
5070 static inline tree *
5071 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5073 return &crit_stmt->name;
5077 /* Set NAME to be the name associated with OMP critical statement
5078 CRIT_STMT. */
5080 static inline void
5081 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5083 crit_stmt->name = name;
5087 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5089 static inline tree
5090 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5092 return crit_stmt->clauses;
5096 /* Return a pointer to the clauses associated with OMP critical statement
5097 CRIT_STMT. */
5099 static inline tree *
5100 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5102 return &crit_stmt->clauses;
5106 /* Set CLAUSES to be the clauses associated with OMP critical statement
5107 CRIT_STMT. */
5109 static inline void
5110 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5112 crit_stmt->clauses = clauses;
5116 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5118 static inline tree
5119 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5121 return ord_stmt->clauses;
5125 /* Return a pointer to the clauses associated with OMP ordered statement
5126 ORD_STMT. */
5128 static inline tree *
5129 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5131 return &ord_stmt->clauses;
5135 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5136 ORD_STMT. */
5138 static inline void
5139 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5141 ord_stmt->clauses = clauses;
5145 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5147 static inline tree
5148 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5150 return scan_stmt->clauses;
5154 /* Return a pointer to the clauses associated with OMP scan statement
5155 ORD_STMT. */
5157 static inline tree *
5158 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5160 return &scan_stmt->clauses;
5164 /* Set CLAUSES to be the clauses associated with OMP scan statement
5165 ORD_STMT. */
5167 static inline void
5168 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5170 scan_stmt->clauses = clauses;
5174 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5176 static inline tree
5177 gimple_omp_taskgroup_clauses (const gimple *gs)
5179 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5180 return
5181 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5185 /* Return a pointer to the clauses associated with OMP taskgroup statement
5186 GS. */
5188 static inline tree *
5189 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5191 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5192 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5196 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5197 GS. */
5199 static inline void
5200 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5202 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5203 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5204 = clauses;
5208 /* Return the kind of the OMP_FOR statemement G. */
5210 static inline int
5211 gimple_omp_for_kind (const gimple *g)
5213 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5214 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5218 /* Set the kind of the OMP_FOR statement G. */
5220 static inline void
5221 gimple_omp_for_set_kind (gomp_for *g, int kind)
5223 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5224 | (kind & GF_OMP_FOR_KIND_MASK);
5228 /* Return true if OMP_FOR statement G has the
5229 GF_OMP_FOR_COMBINED flag set. */
5231 static inline bool
5232 gimple_omp_for_combined_p (const gimple *g)
5234 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5235 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5239 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5240 the boolean value of COMBINED_P. */
5242 static inline void
5243 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5245 if (combined_p)
5246 g->subcode |= GF_OMP_FOR_COMBINED;
5247 else
5248 g->subcode &= ~GF_OMP_FOR_COMBINED;
5252 /* Return true if the OMP_FOR statement G has the
5253 GF_OMP_FOR_COMBINED_INTO flag set. */
5255 static inline bool
5256 gimple_omp_for_combined_into_p (const gimple *g)
5258 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5259 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5263 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5264 on the boolean value of COMBINED_P. */
5266 static inline void
5267 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5269 if (combined_p)
5270 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5271 else
5272 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5276 /* Return the clauses associated with the OMP_FOR statement GS. */
5278 static inline tree
5279 gimple_omp_for_clauses (const gimple *gs)
5281 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5282 return omp_for_stmt->clauses;
5286 /* Return a pointer to the clauses associated with the OMP_FOR statement
5287 GS. */
5289 static inline tree *
5290 gimple_omp_for_clauses_ptr (gimple *gs)
5292 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5293 return &omp_for_stmt->clauses;
5297 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5298 GS. */
5300 static inline void
5301 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5303 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5304 omp_for_stmt->clauses = clauses;
5308 /* Get the collapse count of the OMP_FOR statement GS. */
5310 static inline size_t
5311 gimple_omp_for_collapse (const gimple *gs)
5313 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5314 return omp_for_stmt->collapse;
5318 /* Return the condition code associated with the OMP_FOR statement GS. */
5320 static inline enum tree_code
5321 gimple_omp_for_cond (const gimple *gs, size_t i)
5323 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5324 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5325 return omp_for_stmt->iter[i].cond;
5329 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5331 static inline void
5332 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5334 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5335 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5336 && i < omp_for_stmt->collapse);
5337 omp_for_stmt->iter[i].cond = cond;
5341 /* Return the index variable for the OMP_FOR statement GS. */
5343 static inline tree
5344 gimple_omp_for_index (const gimple *gs, size_t i)
5346 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5347 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5348 return omp_for_stmt->iter[i].index;
5352 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5354 static inline tree *
5355 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5357 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5358 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5359 return &omp_for_stmt->iter[i].index;
5363 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5365 static inline void
5366 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5368 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5369 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5370 omp_for_stmt->iter[i].index = index;
5374 /* Return the initial value for the OMP_FOR statement GS. */
5376 static inline tree
5377 gimple_omp_for_initial (const gimple *gs, size_t i)
5379 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5380 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5381 return omp_for_stmt->iter[i].initial;
5385 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5387 static inline tree *
5388 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5390 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5391 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5392 return &omp_for_stmt->iter[i].initial;
5396 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5398 static inline void
5399 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5401 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5402 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5403 omp_for_stmt->iter[i].initial = initial;
5407 /* Return the final value for the OMP_FOR statement GS. */
5409 static inline tree
5410 gimple_omp_for_final (const gimple *gs, size_t i)
5412 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5413 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5414 return omp_for_stmt->iter[i].final;
5418 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5420 static inline tree *
5421 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5423 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5424 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5425 return &omp_for_stmt->iter[i].final;
5429 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5431 static inline void
5432 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5434 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5435 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5436 omp_for_stmt->iter[i].final = final;
5440 /* Return the increment value for the OMP_FOR statement GS. */
5442 static inline tree
5443 gimple_omp_for_incr (const gimple *gs, size_t i)
5445 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5446 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5447 return omp_for_stmt->iter[i].incr;
5451 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5453 static inline tree *
5454 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5456 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5457 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5458 return &omp_for_stmt->iter[i].incr;
5462 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5464 static inline void
5465 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5467 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5468 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5469 omp_for_stmt->iter[i].incr = incr;
5473 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5474 statement GS starts. */
5476 static inline gimple_seq *
5477 gimple_omp_for_pre_body_ptr (gimple *gs)
5479 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5480 return &omp_for_stmt->pre_body;
5484 /* Return the sequence of statements to execute before the OMP_FOR
5485 statement GS starts. */
5487 static inline gimple_seq
5488 gimple_omp_for_pre_body (const gimple *gs)
5490 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5494 /* Set PRE_BODY to be the sequence of statements to execute before the
5495 OMP_FOR statement GS starts. */
5497 static inline void
5498 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5500 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5501 omp_for_stmt->pre_body = pre_body;
5504 /* Return the clauses associated with OMP_PARALLEL GS. */
5506 static inline tree
5507 gimple_omp_parallel_clauses (const gimple *gs)
5509 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5510 return omp_parallel_stmt->clauses;
5514 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5516 static inline tree *
5517 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5519 return &omp_parallel_stmt->clauses;
5523 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5525 static inline void
5526 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5527 tree clauses)
5529 omp_parallel_stmt->clauses = clauses;
5533 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5535 static inline tree
5536 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5538 return omp_parallel_stmt->child_fn;
5541 /* Return a pointer to the child function used to hold the body of
5542 OMP_PARALLEL_STMT. */
5544 static inline tree *
5545 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5547 return &omp_parallel_stmt->child_fn;
5551 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5553 static inline void
5554 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5555 tree child_fn)
5557 omp_parallel_stmt->child_fn = child_fn;
5561 /* Return the artificial argument used to send variables and values
5562 from the parent to the children threads in OMP_PARALLEL_STMT. */
5564 static inline tree
5565 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5567 return omp_parallel_stmt->data_arg;
5571 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5573 static inline tree *
5574 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5576 return &omp_parallel_stmt->data_arg;
5580 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5582 static inline void
5583 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5584 tree data_arg)
5586 omp_parallel_stmt->data_arg = data_arg;
5589 /* Return the clauses associated with OMP_TASK GS. */
5591 static inline tree
5592 gimple_omp_task_clauses (const gimple *gs)
5594 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5595 return omp_task_stmt->clauses;
5599 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5601 static inline tree *
5602 gimple_omp_task_clauses_ptr (gimple *gs)
5604 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5605 return &omp_task_stmt->clauses;
5609 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5610 GS. */
5612 static inline void
5613 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5615 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5616 omp_task_stmt->clauses = clauses;
5620 /* Return true if OMP task statement G has the
5621 GF_OMP_TASK_TASKLOOP flag set. */
5623 static inline bool
5624 gimple_omp_task_taskloop_p (const gimple *g)
5626 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5627 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5631 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5632 value of TASKLOOP_P. */
5634 static inline void
5635 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5637 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5638 if (taskloop_p)
5639 g->subcode |= GF_OMP_TASK_TASKLOOP;
5640 else
5641 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5645 /* Return true if OMP task statement G has the
5646 GF_OMP_TASK_TASKWAIT flag set. */
5648 static inline bool
5649 gimple_omp_task_taskwait_p (const gimple *g)
5651 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5652 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5656 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5657 value of TASKWAIT_P. */
5659 static inline void
5660 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5662 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5663 if (taskwait_p)
5664 g->subcode |= GF_OMP_TASK_TASKWAIT;
5665 else
5666 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5670 /* Return the child function used to hold the body of OMP_TASK GS. */
5672 static inline tree
5673 gimple_omp_task_child_fn (const gimple *gs)
5675 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5676 return omp_task_stmt->child_fn;
5679 /* Return a pointer to the child function used to hold the body of
5680 OMP_TASK GS. */
5682 static inline tree *
5683 gimple_omp_task_child_fn_ptr (gimple *gs)
5685 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5686 return &omp_task_stmt->child_fn;
5690 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5692 static inline void
5693 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5695 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5696 omp_task_stmt->child_fn = child_fn;
5700 /* Return the artificial argument used to send variables and values
5701 from the parent to the children threads in OMP_TASK GS. */
5703 static inline tree
5704 gimple_omp_task_data_arg (const gimple *gs)
5706 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5707 return omp_task_stmt->data_arg;
5711 /* Return a pointer to the data argument for OMP_TASK GS. */
5713 static inline tree *
5714 gimple_omp_task_data_arg_ptr (gimple *gs)
5716 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5717 return &omp_task_stmt->data_arg;
5721 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5723 static inline void
5724 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5726 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5727 omp_task_stmt->data_arg = data_arg;
5731 /* Return the clauses associated with OMP_TASK GS. */
5733 static inline tree
5734 gimple_omp_taskreg_clauses (const gimple *gs)
5736 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5737 = as_a <const gimple_statement_omp_taskreg *> (gs);
5738 return omp_taskreg_stmt->clauses;
5742 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5744 static inline tree *
5745 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5747 gimple_statement_omp_taskreg *omp_taskreg_stmt
5748 = as_a <gimple_statement_omp_taskreg *> (gs);
5749 return &omp_taskreg_stmt->clauses;
5753 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5754 GS. */
5756 static inline void
5757 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5759 gimple_statement_omp_taskreg *omp_taskreg_stmt
5760 = as_a <gimple_statement_omp_taskreg *> (gs);
5761 omp_taskreg_stmt->clauses = clauses;
5765 /* Return the child function used to hold the body of OMP_TASK GS. */
5767 static inline tree
5768 gimple_omp_taskreg_child_fn (const gimple *gs)
5770 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5771 = as_a <const gimple_statement_omp_taskreg *> (gs);
5772 return omp_taskreg_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_taskreg_child_fn_ptr (gimple *gs)
5781 gimple_statement_omp_taskreg *omp_taskreg_stmt
5782 = as_a <gimple_statement_omp_taskreg *> (gs);
5783 return &omp_taskreg_stmt->child_fn;
5787 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5789 static inline void
5790 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5792 gimple_statement_omp_taskreg *omp_taskreg_stmt
5793 = as_a <gimple_statement_omp_taskreg *> (gs);
5794 omp_taskreg_stmt->child_fn = child_fn;
5798 /* Return the artificial argument used to send variables and values
5799 from the parent to the children threads in OMP_TASK GS. */
5801 static inline tree
5802 gimple_omp_taskreg_data_arg (const gimple *gs)
5804 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5805 = as_a <const gimple_statement_omp_taskreg *> (gs);
5806 return omp_taskreg_stmt->data_arg;
5810 /* Return a pointer to the data argument for OMP_TASK GS. */
5812 static inline tree *
5813 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5815 gimple_statement_omp_taskreg *omp_taskreg_stmt
5816 = as_a <gimple_statement_omp_taskreg *> (gs);
5817 return &omp_taskreg_stmt->data_arg;
5821 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5823 static inline void
5824 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5826 gimple_statement_omp_taskreg *omp_taskreg_stmt
5827 = as_a <gimple_statement_omp_taskreg *> (gs);
5828 omp_taskreg_stmt->data_arg = data_arg;
5832 /* Return the copy function used to hold the body of OMP_TASK GS. */
5834 static inline tree
5835 gimple_omp_task_copy_fn (const gimple *gs)
5837 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5838 return omp_task_stmt->copy_fn;
5841 /* Return a pointer to the copy function used to hold the body of
5842 OMP_TASK GS. */
5844 static inline tree *
5845 gimple_omp_task_copy_fn_ptr (gimple *gs)
5847 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5848 return &omp_task_stmt->copy_fn;
5852 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5854 static inline void
5855 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5857 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5858 omp_task_stmt->copy_fn = copy_fn;
5862 /* Return size of the data block in bytes in OMP_TASK GS. */
5864 static inline tree
5865 gimple_omp_task_arg_size (const gimple *gs)
5867 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5868 return omp_task_stmt->arg_size;
5872 /* Return a pointer to the data block size for OMP_TASK GS. */
5874 static inline tree *
5875 gimple_omp_task_arg_size_ptr (gimple *gs)
5877 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5878 return &omp_task_stmt->arg_size;
5882 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5884 static inline void
5885 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5887 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5888 omp_task_stmt->arg_size = arg_size;
5892 /* Return align of the data block in bytes in OMP_TASK GS. */
5894 static inline tree
5895 gimple_omp_task_arg_align (const gimple *gs)
5897 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5898 return omp_task_stmt->arg_align;
5902 /* Return a pointer to the data block align for OMP_TASK GS. */
5904 static inline tree *
5905 gimple_omp_task_arg_align_ptr (gimple *gs)
5907 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5908 return &omp_task_stmt->arg_align;
5912 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5914 static inline void
5915 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5917 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5918 omp_task_stmt->arg_align = arg_align;
5922 /* Return the clauses associated with OMP_SINGLE GS. */
5924 static inline tree
5925 gimple_omp_single_clauses (const gimple *gs)
5927 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5928 return omp_single_stmt->clauses;
5932 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5934 static inline tree *
5935 gimple_omp_single_clauses_ptr (gimple *gs)
5937 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5938 return &omp_single_stmt->clauses;
5942 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5944 static inline void
5945 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5947 omp_single_stmt->clauses = clauses;
5951 /* Return the clauses associated with OMP_TARGET GS. */
5953 static inline tree
5954 gimple_omp_target_clauses (const gimple *gs)
5956 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5957 return omp_target_stmt->clauses;
5961 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5963 static inline tree *
5964 gimple_omp_target_clauses_ptr (gimple *gs)
5966 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5967 return &omp_target_stmt->clauses;
5971 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5973 static inline void
5974 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5975 tree clauses)
5977 omp_target_stmt->clauses = clauses;
5981 /* Return the kind of the OMP_TARGET G. */
5983 static inline int
5984 gimple_omp_target_kind (const gimple *g)
5986 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5987 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5991 /* Set the kind of the OMP_TARGET G. */
5993 static inline void
5994 gimple_omp_target_set_kind (gomp_target *g, int kind)
5996 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5997 | (kind & GF_OMP_TARGET_KIND_MASK);
6001 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6003 static inline tree
6004 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6006 return omp_target_stmt->child_fn;
6009 /* Return a pointer to the child function used to hold the body of
6010 OMP_TARGET_STMT. */
6012 static inline tree *
6013 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6015 return &omp_target_stmt->child_fn;
6019 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6021 static inline void
6022 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6023 tree child_fn)
6025 omp_target_stmt->child_fn = child_fn;
6029 /* Return the artificial argument used to send variables and values
6030 from the parent to the children threads in OMP_TARGET_STMT. */
6032 static inline tree
6033 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6035 return omp_target_stmt->data_arg;
6039 /* Return a pointer to the data argument for OMP_TARGET GS. */
6041 static inline tree *
6042 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6044 return &omp_target_stmt->data_arg;
6048 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6050 static inline void
6051 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6052 tree data_arg)
6054 omp_target_stmt->data_arg = data_arg;
6058 /* Return the clauses associated with OMP_TEAMS GS. */
6060 static inline tree
6061 gimple_omp_teams_clauses (const gimple *gs)
6063 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6064 return omp_teams_stmt->clauses;
6068 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6070 static inline tree *
6071 gimple_omp_teams_clauses_ptr (gimple *gs)
6073 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6074 return &omp_teams_stmt->clauses;
6078 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6080 static inline void
6081 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6083 omp_teams_stmt->clauses = clauses;
6086 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6088 static inline tree
6089 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6091 return omp_teams_stmt->child_fn;
6094 /* Return a pointer to the child function used to hold the body of
6095 OMP_TEAMS_STMT. */
6097 static inline tree *
6098 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6100 return &omp_teams_stmt->child_fn;
6104 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6106 static inline void
6107 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6109 omp_teams_stmt->child_fn = child_fn;
6113 /* Return the artificial argument used to send variables and values
6114 from the parent to the children threads in OMP_TEAMS_STMT. */
6116 static inline tree
6117 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6119 return omp_teams_stmt->data_arg;
6123 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6125 static inline tree *
6126 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6128 return &omp_teams_stmt->data_arg;
6132 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6134 static inline void
6135 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6137 omp_teams_stmt->data_arg = data_arg;
6140 /* Return the host flag of an OMP_TEAMS_STMT. */
6142 static inline bool
6143 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6145 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6148 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6150 static inline void
6151 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6153 if (value)
6154 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6155 else
6156 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6159 /* Return the clauses associated with OMP_SECTIONS GS. */
6161 static inline tree
6162 gimple_omp_sections_clauses (const gimple *gs)
6164 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6165 return omp_sections_stmt->clauses;
6169 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6171 static inline tree *
6172 gimple_omp_sections_clauses_ptr (gimple *gs)
6174 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6175 return &omp_sections_stmt->clauses;
6179 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6180 GS. */
6182 static inline void
6183 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6185 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6186 omp_sections_stmt->clauses = clauses;
6190 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6191 in GS. */
6193 static inline tree
6194 gimple_omp_sections_control (const gimple *gs)
6196 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6197 return omp_sections_stmt->control;
6201 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6202 GS. */
6204 static inline tree *
6205 gimple_omp_sections_control_ptr (gimple *gs)
6207 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6208 return &omp_sections_stmt->control;
6212 /* Set CONTROL to be the set of clauses associated with the
6213 GIMPLE_OMP_SECTIONS in GS. */
6215 static inline void
6216 gimple_omp_sections_set_control (gimple *gs, tree control)
6218 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6219 omp_sections_stmt->control = control;
6223 /* Set the value being stored in an atomic store. */
6225 static inline void
6226 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6228 store_stmt->val = val;
6232 /* Return the value being stored in an atomic store. */
6234 static inline tree
6235 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6237 return store_stmt->val;
6241 /* Return a pointer to the value being stored in an atomic store. */
6243 static inline tree *
6244 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6246 return &store_stmt->val;
6250 /* Set the LHS of an atomic load. */
6252 static inline void
6253 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6255 load_stmt->lhs = lhs;
6259 /* Get the LHS of an atomic load. */
6261 static inline tree
6262 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6264 return load_stmt->lhs;
6268 /* Return a pointer to the LHS of an atomic load. */
6270 static inline tree *
6271 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6273 return &load_stmt->lhs;
6277 /* Set the RHS of an atomic load. */
6279 static inline void
6280 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6282 load_stmt->rhs = rhs;
6286 /* Get the RHS of an atomic load. */
6288 static inline tree
6289 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6291 return load_stmt->rhs;
6295 /* Return a pointer to the RHS of an atomic load. */
6297 static inline tree *
6298 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6300 return &load_stmt->rhs;
6304 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6306 static inline tree
6307 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6309 return cont_stmt->control_def;
6312 /* The same as above, but return the address. */
6314 static inline tree *
6315 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6317 return &cont_stmt->control_def;
6320 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6322 static inline void
6323 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6325 cont_stmt->control_def = def;
6329 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6331 static inline tree
6332 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6334 return cont_stmt->control_use;
6338 /* The same as above, but return the address. */
6340 static inline tree *
6341 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6343 return &cont_stmt->control_use;
6347 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6349 static inline void
6350 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6352 cont_stmt->control_use = use;
6355 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6356 TRANSACTION_STMT. */
6358 static inline gimple_seq *
6359 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6361 return &transaction_stmt->body;
6364 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6366 static inline gimple_seq
6367 gimple_transaction_body (const gtransaction *transaction_stmt)
6369 return transaction_stmt->body;
6372 /* Return the label associated with a GIMPLE_TRANSACTION. */
6374 static inline tree
6375 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6377 return transaction_stmt->label_norm;
6380 static inline tree *
6381 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6383 return &transaction_stmt->label_norm;
6386 static inline tree
6387 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6389 return transaction_stmt->label_uninst;
6392 static inline tree *
6393 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6395 return &transaction_stmt->label_uninst;
6398 static inline tree
6399 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6401 return transaction_stmt->label_over;
6404 static inline tree *
6405 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6407 return &transaction_stmt->label_over;
6410 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6412 static inline unsigned int
6413 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6415 return transaction_stmt->subcode;
6418 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6419 TRANSACTION_STMT. */
6421 static inline void
6422 gimple_transaction_set_body (gtransaction *transaction_stmt,
6423 gimple_seq body)
6425 transaction_stmt->body = body;
6428 /* Set the label associated with a GIMPLE_TRANSACTION. */
6430 static inline void
6431 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6433 transaction_stmt->label_norm = label;
6436 static inline void
6437 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6439 transaction_stmt->label_uninst = label;
6442 static inline void
6443 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6445 transaction_stmt->label_over = label;
6448 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6450 static inline void
6451 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6452 unsigned int subcode)
6454 transaction_stmt->subcode = subcode;
6457 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6459 static inline tree *
6460 gimple_return_retval_ptr (greturn *gs)
6462 return &gs->op[0];
6465 /* Return the return value for GIMPLE_RETURN GS. */
6467 static inline tree
6468 gimple_return_retval (const greturn *gs)
6470 return gs->op[0];
6474 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6476 static inline void
6477 gimple_return_set_retval (greturn *gs, tree retval)
6479 gs->op[0] = retval;
6483 /* Returns true when the gimple statement STMT is any of the OMP types. */
6485 #define CASE_GIMPLE_OMP \
6486 case GIMPLE_OMP_PARALLEL: \
6487 case GIMPLE_OMP_TASK: \
6488 case GIMPLE_OMP_FOR: \
6489 case GIMPLE_OMP_SECTIONS: \
6490 case GIMPLE_OMP_SECTIONS_SWITCH: \
6491 case GIMPLE_OMP_SINGLE: \
6492 case GIMPLE_OMP_TARGET: \
6493 case GIMPLE_OMP_TEAMS: \
6494 case GIMPLE_OMP_SECTION: \
6495 case GIMPLE_OMP_MASTER: \
6496 case GIMPLE_OMP_TASKGROUP: \
6497 case GIMPLE_OMP_ORDERED: \
6498 case GIMPLE_OMP_CRITICAL: \
6499 case GIMPLE_OMP_SCAN: \
6500 case GIMPLE_OMP_RETURN: \
6501 case GIMPLE_OMP_ATOMIC_LOAD: \
6502 case GIMPLE_OMP_ATOMIC_STORE: \
6503 case GIMPLE_OMP_CONTINUE
6505 static inline bool
6506 is_gimple_omp (const gimple *stmt)
6508 switch (gimple_code (stmt))
6510 CASE_GIMPLE_OMP:
6511 return true;
6512 default:
6513 return false;
6517 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6518 specifically. */
6520 static inline bool
6521 is_gimple_omp_oacc (const gimple *stmt)
6523 gcc_assert (is_gimple_omp (stmt));
6524 switch (gimple_code (stmt))
6526 case GIMPLE_OMP_ATOMIC_LOAD:
6527 case GIMPLE_OMP_ATOMIC_STORE:
6528 case GIMPLE_OMP_CONTINUE:
6529 case GIMPLE_OMP_RETURN:
6530 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6531 the two. */
6532 gcc_unreachable ();
6534 case GIMPLE_OMP_FOR:
6535 switch (gimple_omp_for_kind (stmt))
6537 case GF_OMP_FOR_KIND_OACC_LOOP:
6538 return true;
6539 default:
6540 return false;
6542 case GIMPLE_OMP_TARGET:
6543 switch (gimple_omp_target_kind (stmt))
6545 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6546 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6547 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6548 case GF_OMP_TARGET_KIND_OACC_DATA:
6549 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6550 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
6551 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
6552 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6553 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6554 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6555 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6556 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS:
6557 return true;
6558 default:
6559 return false;
6561 default:
6562 return false;
6567 /* Return true if the OMP gimple statement STMT is offloaded. */
6569 static inline bool
6570 is_gimple_omp_offloaded (const gimple *stmt)
6572 gcc_assert (is_gimple_omp (stmt));
6573 switch (gimple_code (stmt))
6575 case GIMPLE_OMP_TARGET:
6576 switch (gimple_omp_target_kind (stmt))
6578 case GF_OMP_TARGET_KIND_REGION:
6579 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6580 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6581 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6582 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6583 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6584 return true;
6585 default:
6586 return false;
6588 default:
6589 return false;
6594 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6596 static inline bool
6597 gimple_nop_p (const gimple *g)
6599 return gimple_code (g) == GIMPLE_NOP;
6603 /* Return true if GS is a GIMPLE_RESX. */
6605 static inline bool
6606 is_gimple_resx (const gimple *gs)
6608 return gimple_code (gs) == GIMPLE_RESX;
6612 /* Enum and arrays used for allocation stats. Keep in sync with
6613 gimple.c:gimple_alloc_kind_names. */
6614 enum gimple_alloc_kind
6616 gimple_alloc_kind_assign, /* Assignments. */
6617 gimple_alloc_kind_phi, /* PHI nodes. */
6618 gimple_alloc_kind_cond, /* Conditionals. */
6619 gimple_alloc_kind_rest, /* Everything else. */
6620 gimple_alloc_kind_all
6623 extern uint64_t gimple_alloc_counts[];
6624 extern uint64_t gimple_alloc_sizes[];
6626 /* Return the allocation kind for a given stmt CODE. */
6627 static inline enum gimple_alloc_kind
6628 gimple_alloc_kind (enum gimple_code code)
6630 switch (code)
6632 case GIMPLE_ASSIGN:
6633 return gimple_alloc_kind_assign;
6634 case GIMPLE_PHI:
6635 return gimple_alloc_kind_phi;
6636 case GIMPLE_COND:
6637 return gimple_alloc_kind_cond;
6638 default:
6639 return gimple_alloc_kind_rest;
6643 /* Return true if a location should not be emitted for this statement
6644 by annotate_all_with_location. */
6646 static inline bool
6647 gimple_do_not_emit_location_p (gimple *g)
6649 return gimple_plf (g, GF_PLF_1);
6652 /* Mark statement G so a location will not be emitted by
6653 annotate_one_with_location. */
6655 static inline void
6656 gimple_set_do_not_emit_location (gimple *g)
6658 /* The PLF flags are initialized to 0 when a new tuple is created,
6659 so no need to initialize it anywhere. */
6660 gimple_set_plf (g, GF_PLF_1, true);
6663 #endif /* GCC_GIMPLE_H */