RISC-V: Make stack_save_restore tests more robust
[official-gcc.git] / gcc / gimple.h
blob2d0ac103636d077bac1015a6bca0910b4c9db891
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2023 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 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 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 inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 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_ORDERED_STANDALONE = 1 << 0,
198 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 6) - 1,
199 GF_OMP_ATOMIC_NEED_VALUE = 1 << 6,
200 GF_OMP_ATOMIC_WEAK = 1 << 7,
201 GF_PREDICT_TAKEN = 1 << 15
204 /* This subcode tells apart different kinds of stmts that are not used
205 for codegen, but rather to retain debug information. */
206 enum gimple_debug_subcode {
207 GIMPLE_DEBUG_BIND = 0,
208 GIMPLE_DEBUG_SOURCE_BIND = 1,
209 GIMPLE_DEBUG_BEGIN_STMT = 2,
210 GIMPLE_DEBUG_INLINE_ENTRY = 3
213 /* Masks for selecting a pass local flag (PLF) to work on. These
214 masks are used by gimple_set_plf and gimple_plf. */
215 enum plf_mask {
216 GF_PLF_1 = 1 << 0,
217 GF_PLF_2 = 1 << 1
220 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
221 are for 64 bit hosts. */
223 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
224 chain_next ("%h.next"), variable_size))
225 gimple
227 /* [ WORD 1 ]
228 Main identifying code for a tuple. */
229 ENUM_BITFIELD(gimple_code) code : 8;
231 /* Nonzero if a warning should not be emitted on this tuple. */
232 unsigned int no_warning : 1;
234 /* Nonzero if this tuple has been visited. Passes are responsible
235 for clearing this bit before using it. */
236 unsigned int visited : 1;
238 /* Nonzero if this tuple represents a non-temporal move. */
239 unsigned int nontemporal_move : 1;
241 /* Pass local flags. These flags are free for any pass to use as
242 they see fit. Passes should not assume that these flags contain
243 any useful value when the pass starts. Any initial state that
244 the pass requires should be set on entry to the pass. See
245 gimple_set_plf and gimple_plf for usage. */
246 unsigned int plf : 2;
248 /* Nonzero if this statement has been modified and needs to have its
249 operands rescanned. */
250 unsigned modified : 1;
252 /* Nonzero if this statement contains volatile operands. */
253 unsigned has_volatile_ops : 1;
255 /* Padding to get subcode to 16 bit alignment. */
256 unsigned pad : 1;
258 /* The SUBCODE field can be used for tuple-specific flags for tuples
259 that do not require subcodes. Note that SUBCODE should be at
260 least as wide as tree codes, as several tuples store tree codes
261 in there. */
262 unsigned int subcode : 16;
264 /* UID of this statement. This is used by passes that want to
265 assign IDs to statements. It must be assigned and used by each
266 pass. By default it should be assumed to contain garbage. */
267 unsigned uid;
269 /* [ WORD 2 ]
270 Locus information for debug info. */
271 location_t location;
273 /* Number of operands in this tuple. */
274 unsigned num_ops;
276 /* [ WORD 3 ]
277 Basic block holding this statement. */
278 basic_block bb;
280 /* [ WORD 4-5 ]
281 Linked lists of gimple statements. The next pointers form
282 a NULL terminated list, the prev pointers are a cyclic list.
283 A gimple statement is hence also a double-ended list of
284 statements, with the pointer itself being the first element,
285 and the prev pointer being the last. */
286 gimple *next;
287 gimple *GTY((skip)) prev;
291 /* Base structure for tuples with operands. */
293 /* This gimple subclass has no tag value. */
294 struct GTY(())
295 gimple_statement_with_ops_base : public gimple
297 /* [ WORD 1-6 ] : base class */
299 /* [ WORD 7 ]
300 SSA operand vectors. NOTE: It should be possible to
301 amalgamate these vectors with the operand vector OP. However,
302 the SSA operand vectors are organized differently and contain
303 more information (like immediate use chaining). */
304 struct use_optype_d GTY((skip (""))) *use_ops;
308 /* Statements that take register operands. */
310 struct GTY((tag("GSS_WITH_OPS")))
311 gimple_statement_with_ops : public gimple_statement_with_ops_base
313 /* [ WORD 1-7 ] : base class */
315 /* [ WORD 8 ]
316 Operand vector. NOTE! This must always be the last field
317 of this structure. In particular, this means that this
318 structure cannot be embedded inside another one. */
319 tree GTY((length ("%h.num_ops"))) op[1];
323 /* Base for statements that take both memory and register operands. */
325 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
326 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
328 /* [ WORD 1-7 ] : base class */
330 /* [ WORD 8-9 ]
331 Virtual operands for this statement. The GC will pick them
332 up via the ssa_names array. */
333 tree GTY((skip (""))) vdef;
334 tree GTY((skip (""))) vuse;
338 /* Statements that take both memory and register operands. */
340 struct GTY((tag("GSS_WITH_MEM_OPS")))
341 gimple_statement_with_memory_ops :
342 public gimple_statement_with_memory_ops_base
344 /* [ WORD 1-9 ] : base class */
346 /* [ WORD 10 ]
347 Operand vector. NOTE! This must always be the last field
348 of this structure. In particular, this means that this
349 structure cannot be embedded inside another one. */
350 tree GTY((length ("%h.num_ops"))) op[1];
354 /* Call statements that take both memory and register operands. */
356 struct GTY((tag("GSS_CALL")))
357 gcall : public gimple_statement_with_memory_ops_base
359 /* [ WORD 1-9 ] : base class */
361 /* [ WORD 10-13 ] */
362 struct pt_solution call_used;
363 struct pt_solution call_clobbered;
365 /* [ WORD 14 ] */
366 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
367 tree GTY ((tag ("0"))) fntype;
368 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
369 } u;
371 /* [ WORD 15 ]
372 Operand vector. NOTE! This must always be the last field
373 of this structure. In particular, this means that this
374 structure cannot be embedded inside another one. */
375 tree GTY((length ("%h.num_ops"))) op[1];
377 static const enum gimple_code code_ = GIMPLE_CALL;
381 /* OMP statements. */
383 struct GTY((tag("GSS_OMP")))
384 gimple_statement_omp : public gimple
386 /* [ WORD 1-6 ] : base class */
388 /* [ WORD 7 ] */
389 gimple_seq body;
393 /* GIMPLE_BIND */
395 struct GTY((tag("GSS_BIND")))
396 gbind : public gimple
398 /* [ WORD 1-6 ] : base class */
400 /* [ WORD 7 ]
401 Variables declared in this scope. */
402 tree vars;
404 /* [ WORD 8 ]
405 This is different than the BLOCK field in gimple,
406 which is analogous to TREE_BLOCK (i.e., the lexical block holding
407 this statement). This field is the equivalent of BIND_EXPR_BLOCK
408 in tree land (i.e., the lexical scope defined by this bind). See
409 gimple-low.cc. */
410 tree block;
412 /* [ WORD 9 ] */
413 gimple_seq body;
417 /* GIMPLE_CATCH */
419 struct GTY((tag("GSS_CATCH")))
420 gcatch : public gimple
422 /* [ WORD 1-6 ] : base class */
424 /* [ WORD 7 ] */
425 tree types;
427 /* [ WORD 8 ] */
428 gimple_seq handler;
432 /* GIMPLE_EH_FILTER */
434 struct GTY((tag("GSS_EH_FILTER")))
435 geh_filter : public gimple
437 /* [ WORD 1-6 ] : base class */
439 /* [ WORD 7 ]
440 Filter types. */
441 tree types;
443 /* [ WORD 8 ]
444 Failure actions. */
445 gimple_seq failure;
448 /* GIMPLE_EH_ELSE */
450 struct GTY((tag("GSS_EH_ELSE")))
451 geh_else : public gimple
453 /* [ WORD 1-6 ] : base class */
455 /* [ WORD 7,8 ] */
456 gimple_seq n_body, e_body;
459 /* GIMPLE_EH_MUST_NOT_THROW */
461 struct GTY((tag("GSS_EH_MNT")))
462 geh_mnt : public gimple
464 /* [ WORD 1-6 ] : base class */
466 /* [ WORD 7 ] Abort function decl. */
467 tree fndecl;
470 /* GIMPLE_PHI */
472 struct GTY((tag("GSS_PHI")))
473 gphi : public gimple
475 /* [ WORD 1-6 ] : base class */
477 /* [ WORD 7 ] */
478 unsigned capacity;
479 unsigned nargs;
481 /* [ WORD 8 ] */
482 tree result;
484 /* [ WORD 9 ] */
485 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
489 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
491 struct GTY((tag("GSS_EH_CTRL")))
492 gimple_statement_eh_ctrl : public gimple
494 /* [ WORD 1-6 ] : base class */
496 /* [ WORD 7 ]
497 Exception region number. */
498 int region;
501 struct GTY((tag("GSS_EH_CTRL")))
502 gresx : public gimple_statement_eh_ctrl
504 /* No extra fields; adds invariant:
505 stmt->code == GIMPLE_RESX. */
508 struct GTY((tag("GSS_EH_CTRL")))
509 geh_dispatch : public gimple_statement_eh_ctrl
511 /* No extra fields; adds invariant:
512 stmt->code == GIMPLE_EH_DISPATH. */
516 /* GIMPLE_TRY */
518 struct GTY((tag("GSS_TRY")))
519 gtry : public gimple
521 /* [ WORD 1-6 ] : base class */
523 /* [ WORD 7 ]
524 Expression to evaluate. */
525 gimple_seq eval;
527 /* [ WORD 8 ]
528 Cleanup expression. */
529 gimple_seq cleanup;
532 /* Kind of GIMPLE_TRY statements. */
533 enum gimple_try_flags
535 /* A try/catch. */
536 GIMPLE_TRY_CATCH = 1 << 0,
538 /* A try/finally. */
539 GIMPLE_TRY_FINALLY = 1 << 1,
540 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
542 /* Analogous to TRY_CATCH_IS_CLEANUP. */
543 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
546 /* GIMPLE_WITH_CLEANUP_EXPR */
548 struct GTY((tag("GSS_WCE")))
549 gimple_statement_wce : public gimple
551 /* [ WORD 1-6 ] : base class */
553 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
554 executed if an exception is thrown, not on normal exit of its
555 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
556 in TARGET_EXPRs. */
558 /* [ WORD 7 ]
559 Cleanup expression. */
560 gimple_seq cleanup;
564 /* GIMPLE_ASM */
566 struct GTY((tag("GSS_ASM")))
567 gasm : public gimple_statement_with_memory_ops_base
569 /* [ WORD 1-9 ] : base class */
571 /* [ WORD 10 ]
572 __asm__ statement. */
573 const char *string;
575 /* [ WORD 11 ]
576 Number of inputs, outputs, clobbers, labels. */
577 unsigned char ni;
578 unsigned char no;
579 unsigned char nc;
580 unsigned char nl;
582 /* [ WORD 12 ]
583 Operand vector. NOTE! This must always be the last field
584 of this structure. In particular, this means that this
585 structure cannot be embedded inside another one. */
586 tree GTY((length ("%h.num_ops"))) op[1];
589 /* GIMPLE_OMP_CRITICAL */
591 struct GTY((tag("GSS_OMP_CRITICAL")))
592 gomp_critical : public gimple_statement_omp
594 /* [ WORD 1-7 ] : base class */
596 /* [ WORD 8 ] */
597 tree clauses;
599 /* [ WORD 9 ]
600 Critical section name. */
601 tree name;
605 struct GTY(()) gimple_omp_for_iter {
606 /* Condition code. */
607 enum tree_code cond;
609 /* Index variable. */
610 tree index;
612 /* Initial value. */
613 tree initial;
615 /* Final value. */
616 tree final;
618 /* Increment. */
619 tree incr;
622 /* GIMPLE_OMP_FOR */
624 struct GTY((tag("GSS_OMP_FOR")))
625 gomp_for : public gimple_statement_omp
627 /* [ WORD 1-7 ] : base class */
629 /* [ WORD 8 ] */
630 tree clauses;
632 /* [ WORD 9 ]
633 Number of elements in iter array. */
634 size_t collapse;
636 /* [ WORD 10 ] */
637 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
639 /* [ WORD 11 ]
640 Pre-body evaluated before the loop body begins. */
641 gimple_seq pre_body;
645 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
647 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
648 gimple_statement_omp_parallel_layout : public gimple_statement_omp
650 /* [ WORD 1-7 ] : base class */
652 /* [ WORD 8 ]
653 Clauses. */
654 tree clauses;
656 /* [ WORD 9 ]
657 Child function holding the body of the parallel region. */
658 tree child_fn;
660 /* [ WORD 10 ]
661 Shared data argument. */
662 tree data_arg;
665 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
666 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
667 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_PARALLEL
671 || stmt->code == GIMPLE_OMP_TASK
672 || stmt->code == GIMPLE_OMP_TEAMS. */
675 /* GIMPLE_OMP_PARALLEL */
676 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
677 gomp_parallel : public gimple_statement_omp_taskreg
679 /* No extra fields; adds invariant:
680 stmt->code == GIMPLE_OMP_PARALLEL. */
683 /* GIMPLE_OMP_TARGET */
684 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
685 gomp_target : public gimple_statement_omp_parallel_layout
687 /* No extra fields; adds invariant:
688 stmt->code == GIMPLE_OMP_TARGET. */
691 /* GIMPLE_OMP_TASK */
693 struct GTY((tag("GSS_OMP_TASK")))
694 gomp_task : public gimple_statement_omp_taskreg
696 /* [ WORD 1-10 ] : base class */
698 /* [ WORD 11 ]
699 Child function holding firstprivate initialization if needed. */
700 tree copy_fn;
702 /* [ WORD 12-13 ]
703 Size and alignment in bytes of the argument data block. */
704 tree arg_size;
705 tree arg_align;
709 /* GIMPLE_OMP_SECTION */
710 /* Uses struct gimple_statement_omp. */
713 /* GIMPLE_OMP_SECTIONS */
715 struct GTY((tag("GSS_OMP_SECTIONS")))
716 gomp_sections : public gimple_statement_omp
718 /* [ WORD 1-7 ] : base class */
720 /* [ WORD 8 ] */
721 tree clauses;
723 /* [ WORD 9 ]
724 The control variable used for deciding which of the sections to
725 execute. */
726 tree control;
729 /* GIMPLE_OMP_CONTINUE.
731 Note: This does not inherit from gimple_statement_omp, because we
732 do not need the body field. */
734 struct GTY((tag("GSS_OMP_CONTINUE")))
735 gomp_continue : public gimple
737 /* [ WORD 1-6 ] : base class */
739 /* [ WORD 7 ] */
740 tree control_def;
742 /* [ WORD 8 ] */
743 tree control_use;
746 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
747 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
749 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
750 gimple_statement_omp_single_layout : public gimple_statement_omp
752 /* [ WORD 1-7 ] : base class */
754 /* [ WORD 8 ] */
755 tree clauses;
758 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
759 gomp_single : public gimple_statement_omp_single_layout
761 /* No extra fields; adds invariant:
762 stmt->code == GIMPLE_OMP_SINGLE. */
765 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
766 gomp_teams : public gimple_statement_omp_taskreg
768 /* No extra fields; adds invariant:
769 stmt->code == GIMPLE_OMP_TEAMS. */
772 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
773 gomp_ordered : public gimple_statement_omp_single_layout
775 /* No extra fields; adds invariant:
776 stmt->code == GIMPLE_OMP_ORDERED. */
779 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
780 gomp_scan : public gimple_statement_omp_single_layout
782 /* No extra fields; adds invariant:
783 stmt->code == GIMPLE_OMP_SCAN. */
787 /* GIMPLE_OMP_ATOMIC_LOAD.
788 Note: This is based on gimple, not g_s_omp, because g_s_omp
789 contains a sequence, which we don't need here. */
791 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
792 gomp_atomic_load : public gimple
794 /* [ WORD 1-6 ] : base class */
796 /* [ WORD 7-8 ] */
797 tree rhs, lhs;
800 /* GIMPLE_OMP_ATOMIC_STORE.
801 See note on GIMPLE_OMP_ATOMIC_LOAD. */
803 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
804 gimple_statement_omp_atomic_store_layout : public gimple
806 /* [ WORD 1-6 ] : base class */
808 /* [ WORD 7 ] */
809 tree val;
812 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
813 gomp_atomic_store :
814 public gimple_statement_omp_atomic_store_layout
816 /* No extra fields; adds invariant:
817 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
820 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
821 gimple_statement_omp_return :
822 public gimple_statement_omp_atomic_store_layout
824 /* No extra fields; adds invariant:
825 stmt->code == GIMPLE_OMP_RETURN. */
828 /* Assumptions. */
830 struct GTY((tag("GSS_ASSUME")))
831 gimple_statement_assume : public gimple
833 /* [ WORD 1-6 ] : base class */
835 /* [ WORD 7 ] */
836 tree guard;
838 /* [ WORD 8 ] */
839 gimple_seq body;
842 /* GIMPLE_TRANSACTION. */
844 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
846 /* The __transaction_atomic was declared [[outer]] or it is
847 __transaction_relaxed. */
848 #define GTMA_IS_OUTER (1u << 0)
849 #define GTMA_IS_RELAXED (1u << 1)
850 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
852 /* The transaction is seen to not have an abort. */
853 #define GTMA_HAVE_ABORT (1u << 2)
854 /* The transaction is seen to have loads or stores. */
855 #define GTMA_HAVE_LOAD (1u << 3)
856 #define GTMA_HAVE_STORE (1u << 4)
857 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
858 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
859 /* The transaction WILL enter serial irrevocable mode.
860 An irrevocable block post-dominates the entire transaction, such
861 that all invocations of the transaction will go serial-irrevocable.
862 In such case, we don't bother instrumenting the transaction, and
863 tell the runtime that it should begin the transaction in
864 serial-irrevocable mode. */
865 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
866 /* The transaction contains no instrumentation code whatsover, most
867 likely because it is guaranteed to go irrevocable upon entry. */
868 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
870 struct GTY((tag("GSS_TRANSACTION")))
871 gtransaction : public gimple_statement_with_memory_ops_base
873 /* [ WORD 1-9 ] : base class */
875 /* [ WORD 10 ] */
876 gimple_seq body;
878 /* [ WORD 11-13 ] */
879 tree label_norm;
880 tree label_uninst;
881 tree label_over;
884 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
885 enum gimple_statement_structure_enum {
886 #include "gsstruct.def"
887 LAST_GSS_ENUM
889 #undef DEFGSSTRUCT
891 /* A statement with the invariant that
892 stmt->code == GIMPLE_COND
893 i.e. a conditional jump statement. */
895 struct GTY((tag("GSS_WITH_OPS")))
896 gcond : public gimple_statement_with_ops
898 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
899 static const enum gimple_code code_ = GIMPLE_COND;
902 /* A statement with the invariant that
903 stmt->code == GIMPLE_DEBUG
904 i.e. a debug statement. */
906 struct GTY((tag("GSS_WITH_OPS")))
907 gdebug : public gimple_statement_with_ops
909 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
912 /* A statement with the invariant that
913 stmt->code == GIMPLE_GOTO
914 i.e. a goto statement. */
916 struct GTY((tag("GSS_WITH_OPS")))
917 ggoto : public gimple_statement_with_ops
919 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
922 /* A statement with the invariant that
923 stmt->code == GIMPLE_LABEL
924 i.e. a label statement. */
926 struct GTY((tag("GSS_WITH_OPS")))
927 glabel : public gimple_statement_with_ops
929 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
932 /* A statement with the invariant that
933 stmt->code == GIMPLE_SWITCH
934 i.e. a switch statement. */
936 struct GTY((tag("GSS_WITH_OPS")))
937 gswitch : public gimple_statement_with_ops
939 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
942 /* A statement with the invariant that
943 stmt->code == GIMPLE_ASSIGN
944 i.e. an assignment statement. */
946 struct GTY((tag("GSS_WITH_MEM_OPS")))
947 gassign : public gimple_statement_with_memory_ops
949 static const enum gimple_code code_ = GIMPLE_ASSIGN;
950 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
953 /* A statement with the invariant that
954 stmt->code == GIMPLE_RETURN
955 i.e. a return statement. */
957 struct GTY((tag("GSS_WITH_MEM_OPS")))
958 greturn : public gimple_statement_with_memory_ops
960 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
963 template <>
964 template <>
965 inline bool
966 is_a_helper <gasm *>::test (gimple *gs)
968 return gs->code == GIMPLE_ASM;
971 template <>
972 template <>
973 inline bool
974 is_a_helper <gassign *>::test (gimple *gs)
976 return gs->code == GIMPLE_ASSIGN;
979 template <>
980 template <>
981 inline bool
982 is_a_helper <const gassign *>::test (const gimple *gs)
984 return gs->code == GIMPLE_ASSIGN;
987 template <>
988 template <>
989 inline bool
990 is_a_helper <gbind *>::test (gimple *gs)
992 return gs->code == GIMPLE_BIND;
995 template <>
996 template <>
997 inline bool
998 is_a_helper <gcall *>::test (gimple *gs)
1000 return gs->code == GIMPLE_CALL;
1003 template <>
1004 template <>
1005 inline bool
1006 is_a_helper <gcatch *>::test (gimple *gs)
1008 return gs->code == GIMPLE_CATCH;
1011 template <>
1012 template <>
1013 inline bool
1014 is_a_helper <gcond *>::test (gimple *gs)
1016 return gs->code == GIMPLE_COND;
1019 template <>
1020 template <>
1021 inline bool
1022 is_a_helper <const gcond *>::test (const gimple *gs)
1024 return gs->code == GIMPLE_COND;
1027 template <>
1028 template <>
1029 inline bool
1030 is_a_helper <gdebug *>::test (gimple *gs)
1032 return gs->code == GIMPLE_DEBUG;
1035 template <>
1036 template <>
1037 inline bool
1038 is_a_helper <const gdebug *>::test (const gimple *gs)
1040 return gs->code == GIMPLE_DEBUG;
1043 template <>
1044 template <>
1045 inline bool
1046 is_a_helper <ggoto *>::test (gimple *gs)
1048 return gs->code == GIMPLE_GOTO;
1051 template <>
1052 template <>
1053 inline bool
1054 is_a_helper <const ggoto *>::test (const gimple *gs)
1056 return gs->code == GIMPLE_GOTO;
1059 template <>
1060 template <>
1061 inline bool
1062 is_a_helper <glabel *>::test (gimple *gs)
1064 return gs->code == GIMPLE_LABEL;
1067 template <>
1068 template <>
1069 inline bool
1070 is_a_helper <const glabel *>::test (const gimple *gs)
1072 return gs->code == GIMPLE_LABEL;
1075 template <>
1076 template <>
1077 inline bool
1078 is_a_helper <gresx *>::test (gimple *gs)
1080 return gs->code == GIMPLE_RESX;
1083 template <>
1084 template <>
1085 inline bool
1086 is_a_helper <geh_dispatch *>::test (gimple *gs)
1088 return gs->code == GIMPLE_EH_DISPATCH;
1091 template <>
1092 template <>
1093 inline bool
1094 is_a_helper <geh_else *>::test (gimple *gs)
1096 return gs->code == GIMPLE_EH_ELSE;
1099 template <>
1100 template <>
1101 inline bool
1102 is_a_helper <const geh_else *>::test (const gimple *gs)
1104 return gs->code == GIMPLE_EH_ELSE;
1107 template <>
1108 template <>
1109 inline bool
1110 is_a_helper <geh_filter *>::test (gimple *gs)
1112 return gs->code == GIMPLE_EH_FILTER;
1115 template <>
1116 template <>
1117 inline bool
1118 is_a_helper <geh_mnt *>::test (gimple *gs)
1120 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1123 template <>
1124 template <>
1125 inline bool
1126 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1128 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1131 template <>
1132 template <>
1133 inline bool
1134 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1136 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1139 template <>
1140 template <>
1141 inline bool
1142 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1144 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1147 template <>
1148 template <>
1149 inline bool
1150 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1152 return gs->code == GIMPLE_OMP_RETURN;
1155 template <>
1156 template <>
1157 inline bool
1158 is_a_helper <gomp_continue *>::test (gimple *gs)
1160 return gs->code == GIMPLE_OMP_CONTINUE;
1163 template <>
1164 template <>
1165 inline bool
1166 is_a_helper <gomp_critical *>::test (gimple *gs)
1168 return gs->code == GIMPLE_OMP_CRITICAL;
1171 template <>
1172 template <>
1173 inline bool
1174 is_a_helper <gomp_ordered *>::test (gimple *gs)
1176 return gs->code == GIMPLE_OMP_ORDERED;
1179 template <>
1180 template <>
1181 inline bool
1182 is_a_helper <gomp_scan *>::test (gimple *gs)
1184 return gs->code == GIMPLE_OMP_SCAN;
1187 template <>
1188 template <>
1189 inline bool
1190 is_a_helper <gomp_for *>::test (gimple *gs)
1192 return gs->code == GIMPLE_OMP_FOR;
1195 template <>
1196 template <>
1197 inline bool
1198 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1200 return (gs->code == GIMPLE_OMP_PARALLEL
1201 || gs->code == GIMPLE_OMP_TASK
1202 || gs->code == GIMPLE_OMP_TEAMS);
1205 template <>
1206 template <>
1207 inline bool
1208 is_a_helper <gomp_parallel *>::test (gimple *gs)
1210 return gs->code == GIMPLE_OMP_PARALLEL;
1213 template <>
1214 template <>
1215 inline bool
1216 is_a_helper <gomp_target *>::test (gimple *gs)
1218 return gs->code == GIMPLE_OMP_TARGET;
1221 template <>
1222 template <>
1223 inline bool
1224 is_a_helper <gomp_sections *>::test (gimple *gs)
1226 return gs->code == GIMPLE_OMP_SECTIONS;
1229 template <>
1230 template <>
1231 inline bool
1232 is_a_helper <gomp_single *>::test (gimple *gs)
1234 return gs->code == GIMPLE_OMP_SINGLE;
1237 template <>
1238 template <>
1239 inline bool
1240 is_a_helper <gomp_teams *>::test (gimple *gs)
1242 return gs->code == GIMPLE_OMP_TEAMS;
1245 template <>
1246 template <>
1247 inline bool
1248 is_a_helper <gomp_task *>::test (gimple *gs)
1250 return gs->code == GIMPLE_OMP_TASK;
1253 template <>
1254 template <>
1255 inline bool
1256 is_a_helper <gphi *>::test (gimple *gs)
1258 return gs->code == GIMPLE_PHI;
1261 template <>
1262 template <>
1263 inline bool
1264 is_a_helper <greturn *>::test (gimple *gs)
1266 return gs->code == GIMPLE_RETURN;
1269 template <>
1270 template <>
1271 inline bool
1272 is_a_helper <gswitch *>::test (gimple *gs)
1274 return gs->code == GIMPLE_SWITCH;
1277 template <>
1278 template <>
1279 inline bool
1280 is_a_helper <const gswitch *>::test (const gimple *gs)
1282 return gs->code == GIMPLE_SWITCH;
1285 template <>
1286 template <>
1287 inline bool
1288 is_a_helper <gimple_statement_assume *>::test (gimple *gs)
1290 return gs->code == GIMPLE_ASSUME;
1293 template <>
1294 template <>
1295 inline bool
1296 is_a_helper <gtransaction *>::test (gimple *gs)
1298 return gs->code == GIMPLE_TRANSACTION;
1301 template <>
1302 template <>
1303 inline bool
1304 is_a_helper <gtry *>::test (gimple *gs)
1306 return gs->code == GIMPLE_TRY;
1309 template <>
1310 template <>
1311 inline bool
1312 is_a_helper <const gtry *>::test (const gimple *gs)
1314 return gs->code == GIMPLE_TRY;
1317 template <>
1318 template <>
1319 inline bool
1320 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1322 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1325 template <>
1326 template <>
1327 inline bool
1328 is_a_helper <const gasm *>::test (const gimple *gs)
1330 return gs->code == GIMPLE_ASM;
1333 template <>
1334 template <>
1335 inline bool
1336 is_a_helper <const gbind *>::test (const gimple *gs)
1338 return gs->code == GIMPLE_BIND;
1341 template <>
1342 template <>
1343 inline bool
1344 is_a_helper <const gcall *>::test (const gimple *gs)
1346 return gs->code == GIMPLE_CALL;
1349 template <>
1350 template <>
1351 inline bool
1352 is_a_helper <const gcatch *>::test (const gimple *gs)
1354 return gs->code == GIMPLE_CATCH;
1357 template <>
1358 template <>
1359 inline bool
1360 is_a_helper <const gresx *>::test (const gimple *gs)
1362 return gs->code == GIMPLE_RESX;
1365 template <>
1366 template <>
1367 inline bool
1368 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1370 return gs->code == GIMPLE_EH_DISPATCH;
1373 template <>
1374 template <>
1375 inline bool
1376 is_a_helper <const geh_filter *>::test (const gimple *gs)
1378 return gs->code == GIMPLE_EH_FILTER;
1381 template <>
1382 template <>
1383 inline bool
1384 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1386 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1389 template <>
1390 template <>
1391 inline bool
1392 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1394 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1397 template <>
1398 template <>
1399 inline bool
1400 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1402 return gs->code == GIMPLE_OMP_RETURN;
1405 template <>
1406 template <>
1407 inline bool
1408 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1410 return gs->code == GIMPLE_OMP_CONTINUE;
1413 template <>
1414 template <>
1415 inline bool
1416 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1418 return gs->code == GIMPLE_OMP_CRITICAL;
1421 template <>
1422 template <>
1423 inline bool
1424 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1426 return gs->code == GIMPLE_OMP_ORDERED;
1429 template <>
1430 template <>
1431 inline bool
1432 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1434 return gs->code == GIMPLE_OMP_SCAN;
1437 template <>
1438 template <>
1439 inline bool
1440 is_a_helper <const gomp_for *>::test (const gimple *gs)
1442 return gs->code == GIMPLE_OMP_FOR;
1445 template <>
1446 template <>
1447 inline bool
1448 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1450 return (gs->code == GIMPLE_OMP_PARALLEL
1451 || gs->code == GIMPLE_OMP_TASK
1452 || gs->code == GIMPLE_OMP_TEAMS);
1455 template <>
1456 template <>
1457 inline bool
1458 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1460 return gs->code == GIMPLE_OMP_PARALLEL;
1463 template <>
1464 template <>
1465 inline bool
1466 is_a_helper <const gomp_target *>::test (const gimple *gs)
1468 return gs->code == GIMPLE_OMP_TARGET;
1471 template <>
1472 template <>
1473 inline bool
1474 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1476 return gs->code == GIMPLE_OMP_SECTIONS;
1479 template <>
1480 template <>
1481 inline bool
1482 is_a_helper <const gomp_single *>::test (const gimple *gs)
1484 return gs->code == GIMPLE_OMP_SINGLE;
1487 template <>
1488 template <>
1489 inline bool
1490 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1492 return gs->code == GIMPLE_OMP_TEAMS;
1495 template <>
1496 template <>
1497 inline bool
1498 is_a_helper <const gomp_task *>::test (const gimple *gs)
1500 return gs->code == GIMPLE_OMP_TASK;
1503 template <>
1504 template <>
1505 inline bool
1506 is_a_helper <const gphi *>::test (const gimple *gs)
1508 return gs->code == GIMPLE_PHI;
1511 template <>
1512 template <>
1513 inline bool
1514 is_a_helper <const greturn *>::test (const gimple *gs)
1516 return gs->code == GIMPLE_RETURN;
1519 template <>
1520 template <>
1521 inline bool
1522 is_a_helper <const gimple_statement_assume *>::test (const gimple *gs)
1524 return gs->code == GIMPLE_ASSUME;
1527 template <>
1528 template <>
1529 inline bool
1530 is_a_helper <const gtransaction *>::test (const gimple *gs)
1532 return gs->code == GIMPLE_TRANSACTION;
1535 /* Offset in bytes to the location of the operand vector.
1536 Zero if there is no operand vector for this tuple structure. */
1537 extern size_t const gimple_ops_offset_[];
1539 /* Map GIMPLE codes to GSS codes. */
1540 extern enum gimple_statement_structure_enum const gss_for_code_[];
1542 /* This variable holds the currently expanded gimple statement for purposes
1543 of comminucating the profile info to the builtin expanders. */
1544 extern gimple *currently_expanding_gimple_stmt;
1546 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1547 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1548 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1549 greturn *gimple_build_return (tree);
1550 void gimple_call_reset_alias_info (gcall *);
1551 gcall *gimple_build_call_vec (tree, const vec<tree> &);
1552 gcall *gimple_build_call (tree, unsigned, ...);
1553 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1554 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1555 gcall *gimple_build_call_internal_vec (enum internal_fn, const vec<tree> &);
1556 gcall *gimple_build_call_from_tree (tree, tree);
1557 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1558 gassign *gimple_build_assign (tree, enum tree_code,
1559 tree, tree, tree CXX_MEM_STAT_INFO);
1560 gassign *gimple_build_assign (tree, enum tree_code,
1561 tree, tree CXX_MEM_STAT_INFO);
1562 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1563 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1564 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1565 void gimple_cond_set_condition_from_tree (gcond *, tree);
1566 glabel *gimple_build_label (tree label);
1567 ggoto *gimple_build_goto (tree dest);
1568 gimple *gimple_build_nop (void);
1569 gbind *gimple_build_bind (tree, gimple_seq, tree);
1570 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1571 vec<tree, va_gc> *, vec<tree, va_gc> *,
1572 vec<tree, va_gc> *);
1573 gcatch *gimple_build_catch (tree, gimple_seq);
1574 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1575 geh_mnt *gimple_build_eh_must_not_throw (tree);
1576 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1577 gtry *gimple_build_try (gimple_seq, gimple_seq,
1578 enum gimple_try_flags);
1579 gimple *gimple_build_wce (gimple_seq);
1580 gresx *gimple_build_resx (int);
1581 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1582 gswitch *gimple_build_switch (tree, tree, const vec<tree> &);
1583 geh_dispatch *gimple_build_eh_dispatch (int);
1584 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1585 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1586 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1587 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1588 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1589 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1590 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1591 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1592 tree, tree);
1593 gimple *gimple_build_omp_section (gimple_seq);
1594 gimple *gimple_build_omp_structured_block (gimple_seq);
1595 gimple *gimple_build_omp_scope (gimple_seq, tree);
1596 gimple *gimple_build_omp_master (gimple_seq);
1597 gimple *gimple_build_omp_masked (gimple_seq, tree);
1598 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1599 gomp_continue *gimple_build_omp_continue (tree, tree);
1600 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1601 gimple *gimple_build_omp_return (bool);
1602 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1603 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1604 gimple *gimple_build_omp_sections_switch (void);
1605 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1606 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1607 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1608 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1609 enum omp_memory_order);
1610 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1611 gimple *gimple_build_assume (tree, gimple_seq);
1612 gtransaction *gimple_build_transaction (gimple_seq);
1613 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1614 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1615 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1616 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1617 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1618 location_t);
1619 extern void annotate_all_with_location (gimple_seq, location_t);
1620 bool empty_body_p (gimple_seq);
1621 gimple_seq gimple_seq_copy (gimple_seq);
1622 bool gimple_call_same_target_p (const gimple *, const gimple *);
1623 int gimple_call_flags (const gimple *);
1624 int gimple_call_arg_flags (const gcall *, unsigned);
1625 int gimple_call_retslot_flags (const gcall *);
1626 int gimple_call_static_chain_flags (const gcall *);
1627 int gimple_call_return_flags (const gcall *);
1628 bool gimple_call_nonnull_result_p (gcall *);
1629 tree gimple_call_nonnull_arg (gcall *);
1630 bool gimple_assign_copy_p (gimple *);
1631 bool gimple_assign_ssa_name_copy_p (gimple *);
1632 bool gimple_assign_unary_nop_p (gimple *);
1633 bool gimple_assign_load_p (const gimple *);
1634 void gimple_set_bb (gimple *, basic_block);
1635 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1636 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1637 tree, tree, tree);
1638 tree gimple_get_lhs (const gimple *);
1639 void gimple_set_lhs (gimple *, tree);
1640 gimple *gimple_copy (gimple *);
1641 void gimple_move_vops (gimple *, gimple *);
1642 bool gimple_has_side_effects (const gimple *);
1643 bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1644 bool gimple_could_trap_p (const gimple *);
1645 bool gimple_assign_rhs_could_trap_p (gimple *);
1646 extern void dump_gimple_statistics (void);
1647 unsigned get_gimple_rhs_num_ops (enum tree_code);
1648 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1649 extern bool gimple_compare_field_offset (tree, tree);
1650 extern tree gimple_unsigned_type (tree);
1651 extern tree gimple_signed_type (tree);
1652 extern alias_set_type gimple_get_alias_set (tree);
1653 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1654 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1655 extern combined_fn gimple_call_combined_fn (const gimple *);
1656 extern bool gimple_call_operator_delete_p (const gcall *);
1657 extern bool gimple_call_builtin_p (const gimple *);
1658 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1659 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1660 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1661 extern void dump_decl_set (FILE *, bitmap);
1662 extern bool nonfreeing_call_p (gimple *);
1663 extern bool nonbarrier_call_p (gimple *);
1664 extern bool infer_nonnull_range (gimple *, tree);
1665 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1666 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1667 extern void sort_case_labels (vec<tree> &);
1668 extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
1669 extern void gimple_seq_set_location (gimple_seq, location_t);
1670 extern void gimple_seq_discard (gimple_seq);
1671 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1672 extern bool gimple_inexpensive_call_p (gcall *);
1673 extern bool stmt_can_terminate_bb_p (gimple *);
1674 extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1675 gcall *gimple_build_builtin_unreachable (location_t);
1677 /* Return the disposition for a warning (or all warnings by default)
1678 for a statement. */
1679 extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1680 ATTRIBUTE_NONNULL (1);
1681 /* Set the disposition for a warning (or all warnings by default)
1682 at a location to enabled by default. */
1683 extern void suppress_warning (gimple *, opt_code = all_warnings,
1684 bool = true) ATTRIBUTE_NONNULL (1);
1686 /* Copy the warning disposition mapping from one statement to another. */
1687 extern void copy_warning (gimple *, const gimple *)
1688 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1689 /* Copy the warning disposition mapping from an expression to a statement. */
1690 extern void copy_warning (gimple *, const_tree)
1691 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1692 /* Copy the warning disposition mapping from a statement to an expression. */
1693 extern void copy_warning (tree, const gimple *)
1694 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1696 /* Formal (expression) temporary table handling: multiple occurrences of
1697 the same scalar expression are evaluated into the same temporary. */
1699 typedef struct gimple_temp_hash_elt
1701 tree val; /* Key */
1702 tree temp; /* Value */
1703 } elt_t;
1705 /* Get the number of the next statement uid to be allocated. */
1706 inline unsigned int
1707 gimple_stmt_max_uid (struct function *fn)
1709 return fn->last_stmt_uid;
1712 /* Set the number of the next statement uid to be allocated. */
1713 inline void
1714 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1716 fn->last_stmt_uid = maxid;
1719 /* Set the number of the next statement uid to be allocated. */
1720 inline unsigned int
1721 inc_gimple_stmt_max_uid (struct function *fn)
1723 return fn->last_stmt_uid++;
1726 /* Return the first node in GIMPLE sequence S. */
1728 inline gimple_seq_node
1729 gimple_seq_first (gimple_seq s)
1731 return s;
1735 /* Return the first statement in GIMPLE sequence S. */
1737 inline gimple *
1738 gimple_seq_first_stmt (gimple_seq s)
1740 gimple_seq_node n = gimple_seq_first (s);
1741 return n;
1744 /* Return the first statement in GIMPLE sequence S as a gbind *,
1745 verifying that it has code GIMPLE_BIND in a checked build. */
1747 inline gbind *
1748 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1750 gimple_seq_node n = gimple_seq_first (s);
1751 return as_a <gbind *> (n);
1755 /* Return the last node in GIMPLE sequence S. */
1757 inline gimple_seq_node
1758 gimple_seq_last (gimple_seq s)
1760 return s ? s->prev : NULL;
1764 /* Return the last statement in GIMPLE sequence S. */
1766 inline gimple *
1767 gimple_seq_last_stmt (gimple_seq s)
1769 gimple_seq_node n = gimple_seq_last (s);
1770 return n;
1774 /* Set the last node in GIMPLE sequence *PS to LAST. */
1776 inline void
1777 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1779 (*ps)->prev = last;
1783 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1785 inline void
1786 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1788 *ps = first;
1792 /* Return true if GIMPLE sequence S is empty. */
1794 inline bool
1795 gimple_seq_empty_p (gimple_seq s)
1797 return s == NULL;
1800 /* Allocate a new sequence and initialize its first element with STMT. */
1802 inline gimple_seq
1803 gimple_seq_alloc_with_stmt (gimple *stmt)
1805 gimple_seq seq = NULL;
1806 gimple_seq_add_stmt (&seq, stmt);
1807 return seq;
1811 /* Returns the sequence of statements in BB. */
1813 inline gimple_seq
1814 bb_seq (const_basic_block bb)
1816 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1819 inline gimple_seq *
1820 bb_seq_addr (basic_block bb)
1822 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1825 /* Sets the sequence of statements in BB to SEQ. */
1827 inline void
1828 set_bb_seq (basic_block bb, gimple_seq seq)
1830 gcc_checking_assert (!(bb->flags & BB_RTL));
1831 bb->il.gimple.seq = seq;
1835 /* Return the code for GIMPLE statement G. */
1837 inline enum gimple_code
1838 gimple_code (const gimple *g)
1840 return g->code;
1844 /* Return the GSS code used by a GIMPLE code. */
1846 inline enum gimple_statement_structure_enum
1847 gss_for_code (enum gimple_code code)
1849 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1850 return gss_for_code_[code];
1854 /* Return which GSS code is used by GS. */
1856 inline enum gimple_statement_structure_enum
1857 gimple_statement_structure (gimple *gs)
1859 return gss_for_code (gimple_code (gs));
1863 /* Return true if statement G has sub-statements. This is only true for
1864 High GIMPLE statements. */
1866 inline bool
1867 gimple_has_substatements (gimple *g)
1869 switch (gimple_code (g))
1871 case GIMPLE_ASSUME:
1872 case GIMPLE_BIND:
1873 case GIMPLE_CATCH:
1874 case GIMPLE_EH_FILTER:
1875 case GIMPLE_EH_ELSE:
1876 case GIMPLE_TRY:
1877 case GIMPLE_OMP_FOR:
1878 case GIMPLE_OMP_MASTER:
1879 case GIMPLE_OMP_MASKED:
1880 case GIMPLE_OMP_TASKGROUP:
1881 case GIMPLE_OMP_ORDERED:
1882 case GIMPLE_OMP_SECTION:
1883 case GIMPLE_OMP_STRUCTURED_BLOCK:
1884 case GIMPLE_OMP_PARALLEL:
1885 case GIMPLE_OMP_TASK:
1886 case GIMPLE_OMP_SCOPE:
1887 case GIMPLE_OMP_SECTIONS:
1888 case GIMPLE_OMP_SINGLE:
1889 case GIMPLE_OMP_TARGET:
1890 case GIMPLE_OMP_TEAMS:
1891 case GIMPLE_OMP_CRITICAL:
1892 case GIMPLE_WITH_CLEANUP_EXPR:
1893 case GIMPLE_TRANSACTION:
1894 return true;
1896 default:
1897 return false;
1902 /* Return the basic block holding statement G. */
1904 inline basic_block
1905 gimple_bb (const gimple *g)
1907 return g->bb;
1911 /* Return the lexical scope block holding statement G. */
1913 inline tree
1914 gimple_block (const gimple *g)
1916 return LOCATION_BLOCK (g->location);
1919 /* Forward declare. */
1920 inline void gimple_set_location (gimple *, location_t);
1922 /* Set BLOCK to be the lexical scope block holding statement G. */
1924 inline void
1925 gimple_set_block (gimple *g, tree block)
1927 gimple_set_location (g, set_block (g->location, block));
1930 /* Return location information for statement G. */
1932 inline location_t
1933 gimple_location (const gimple *g)
1935 return g->location;
1938 /* Return location information for statement G if g is not NULL.
1939 Otherwise, UNKNOWN_LOCATION is returned. */
1941 inline location_t
1942 gimple_location_safe (const gimple *g)
1944 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1947 /* Set location information for statement G. */
1949 inline void
1950 gimple_set_location (gimple *g, location_t location)
1952 /* Copy the no-warning data to the statement location. */
1953 if (g->location != UNKNOWN_LOCATION)
1954 copy_warning (location, g->location);
1955 g->location = location;
1958 /* Return address of the location information for statement G. */
1960 inline location_t *
1961 gimple_location_ptr (gimple *g)
1963 return &g->location;
1967 /* Return true if G contains location information. */
1969 inline bool
1970 gimple_has_location (const gimple *g)
1972 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1976 /* Return non-artificial location information for statement G. */
1978 inline location_t
1979 gimple_nonartificial_location (const gimple *g)
1981 location_t *ploc = NULL;
1983 if (tree block = gimple_block (g))
1984 ploc = block_nonartificial_location (block);
1986 return ploc ? *ploc : gimple_location (g);
1990 /* Return the file name of the location of STMT. */
1992 inline const char *
1993 gimple_filename (const gimple *stmt)
1995 return LOCATION_FILE (gimple_location (stmt));
1999 /* Return the line number of the location of STMT. */
2001 inline int
2002 gimple_lineno (const gimple *stmt)
2004 return LOCATION_LINE (gimple_location (stmt));
2008 /* Determine whether SEQ is a singleton. */
2010 inline bool
2011 gimple_seq_singleton_p (gimple_seq seq)
2013 return ((gimple_seq_first (seq) != NULL)
2014 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
2017 /* Return true if no warnings should be emitted for statement STMT. */
2019 inline bool
2020 gimple_no_warning_p (const gimple *stmt)
2022 return stmt->no_warning;
2025 /* Set the no_warning flag of STMT to NO_WARNING. */
2027 inline void
2028 gimple_set_no_warning (gimple *stmt, bool no_warning)
2030 stmt->no_warning = (unsigned) no_warning;
2033 /* Set the visited status on statement STMT to VISITED_P.
2035 Please note that this 'visited' property of the gimple statement is
2036 supposed to be undefined at pass boundaries. This means that a
2037 given pass should not assume it contains any useful value when the
2038 pass starts and thus can set it to any value it sees fit.
2040 You can learn more about the visited property of the gimple
2041 statement by reading the comments of the 'visited' data member of
2042 struct gimple.
2045 inline void
2046 gimple_set_visited (gimple *stmt, bool visited_p)
2048 stmt->visited = (unsigned) visited_p;
2052 /* Return the visited status for statement STMT.
2054 Please note that this 'visited' property of the gimple statement is
2055 supposed to be undefined at pass boundaries. This means that a
2056 given pass should not assume it contains any useful value when the
2057 pass starts and thus can set it to any value it sees fit.
2059 You can learn more about the visited property of the gimple
2060 statement by reading the comments of the 'visited' data member of
2061 struct gimple. */
2063 inline bool
2064 gimple_visited_p (gimple *stmt)
2066 return stmt->visited;
2070 /* Set pass local flag PLF on statement STMT to VAL_P.
2072 Please note that this PLF property of the gimple statement is
2073 supposed to be undefined at pass boundaries. This means that a
2074 given pass should not assume it contains any useful value when the
2075 pass starts and thus can set it to any value it sees fit.
2077 You can learn more about the PLF property by reading the comment of
2078 the 'plf' data member of struct gimple_statement_structure. */
2080 inline void
2081 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2083 if (val_p)
2084 stmt->plf |= (unsigned int) plf;
2085 else
2086 stmt->plf &= ~((unsigned int) plf);
2090 /* Return the value of pass local flag PLF on statement STMT.
2092 Please note that this 'plf' property of the gimple statement is
2093 supposed to be undefined at pass boundaries. This means that a
2094 given pass should not assume it contains any useful value when the
2095 pass starts and thus can set it to any value it sees fit.
2097 You can learn more about the plf property by reading the comment of
2098 the 'plf' data member of struct gimple_statement_structure. */
2100 inline unsigned int
2101 gimple_plf (gimple *stmt, enum plf_mask plf)
2103 return stmt->plf & ((unsigned int) plf);
2107 /* Set the UID of statement.
2109 Please note that this UID property is supposed to be undefined at
2110 pass boundaries. This means that a given pass should not assume it
2111 contains any useful value when the pass starts and thus can set it
2112 to any value it sees fit. */
2114 inline void
2115 gimple_set_uid (gimple *g, unsigned uid)
2117 g->uid = uid;
2121 /* Return the UID of statement.
2123 Please note that this UID property is supposed to be undefined at
2124 pass boundaries. This means that a given pass should not assume it
2125 contains any useful value when the pass starts and thus can set it
2126 to any value it sees fit. */
2128 inline unsigned
2129 gimple_uid (const gimple *g)
2131 return g->uid;
2135 /* Make statement G a singleton sequence. */
2137 inline void
2138 gimple_init_singleton (gimple *g)
2140 g->next = NULL;
2141 g->prev = g;
2145 /* Return true if GIMPLE statement G has register or memory operands. */
2147 inline bool
2148 gimple_has_ops (const gimple *g)
2150 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2153 template <>
2154 template <>
2155 inline bool
2156 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2158 return gimple_has_ops (gs);
2161 template <>
2162 template <>
2163 inline bool
2164 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2166 return gimple_has_ops (gs);
2169 /* Return true if GIMPLE statement G has memory operands. */
2171 inline bool
2172 gimple_has_mem_ops (const gimple *g)
2174 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2177 template <>
2178 template <>
2179 inline bool
2180 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2182 return gimple_has_mem_ops (gs);
2185 template <>
2186 template <>
2187 inline bool
2188 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2190 return gimple_has_mem_ops (gs);
2193 /* Return the set of USE operands for statement G. */
2195 inline struct use_optype_d *
2196 gimple_use_ops (const gimple *g)
2198 const gimple_statement_with_ops *ops_stmt =
2199 dyn_cast <const gimple_statement_with_ops *> (g);
2200 if (!ops_stmt)
2201 return NULL;
2202 return ops_stmt->use_ops;
2206 /* Set USE to be the set of USE operands for statement G. */
2208 inline void
2209 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2211 gimple_statement_with_ops *ops_stmt =
2212 as_a <gimple_statement_with_ops *> (g);
2213 ops_stmt->use_ops = use;
2217 /* Return the single VUSE operand of the statement G. */
2219 inline tree
2220 gimple_vuse (const gimple *g)
2222 const gimple_statement_with_memory_ops *mem_ops_stmt =
2223 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2224 if (!mem_ops_stmt)
2225 return NULL_TREE;
2226 return mem_ops_stmt->vuse;
2229 /* Return the single VDEF operand of the statement G. */
2231 inline tree
2232 gimple_vdef (const gimple *g)
2234 const gimple_statement_with_memory_ops *mem_ops_stmt =
2235 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2236 if (!mem_ops_stmt)
2237 return NULL_TREE;
2238 return mem_ops_stmt->vdef;
2241 /* Return the single VUSE operand of the statement G. */
2243 inline tree *
2244 gimple_vuse_ptr (gimple *g)
2246 gimple_statement_with_memory_ops *mem_ops_stmt =
2247 dyn_cast <gimple_statement_with_memory_ops *> (g);
2248 if (!mem_ops_stmt)
2249 return NULL;
2250 return &mem_ops_stmt->vuse;
2253 /* Return the single VDEF operand of the statement G. */
2255 inline tree *
2256 gimple_vdef_ptr (gimple *g)
2258 gimple_statement_with_memory_ops *mem_ops_stmt =
2259 dyn_cast <gimple_statement_with_memory_ops *> (g);
2260 if (!mem_ops_stmt)
2261 return NULL;
2262 return &mem_ops_stmt->vdef;
2265 /* Set the single VUSE operand of the statement G. */
2267 inline void
2268 gimple_set_vuse (gimple *g, tree vuse)
2270 gimple_statement_with_memory_ops *mem_ops_stmt =
2271 as_a <gimple_statement_with_memory_ops *> (g);
2272 mem_ops_stmt->vuse = vuse;
2275 /* Set the single VDEF operand of the statement G. */
2277 inline void
2278 gimple_set_vdef (gimple *g, tree vdef)
2280 gimple_statement_with_memory_ops *mem_ops_stmt =
2281 as_a <gimple_statement_with_memory_ops *> (g);
2282 mem_ops_stmt->vdef = vdef;
2286 /* Return true if statement G has operands and the modified field has
2287 been set. */
2289 inline bool
2290 gimple_modified_p (const gimple *g)
2292 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2296 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2297 a MODIFIED field. */
2299 inline void
2300 gimple_set_modified (gimple *s, bool modifiedp)
2302 if (gimple_has_ops (s))
2303 s->modified = (unsigned) modifiedp;
2307 /* Return true if statement STMT contains volatile operands. */
2309 inline bool
2310 gimple_has_volatile_ops (const gimple *stmt)
2312 if (gimple_has_mem_ops (stmt))
2313 return stmt->has_volatile_ops;
2314 else
2315 return false;
2319 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2321 inline void
2322 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2324 if (gimple_has_mem_ops (stmt))
2325 stmt->has_volatile_ops = (unsigned) volatilep;
2328 /* Return true if STMT is in a transaction. */
2330 inline bool
2331 gimple_in_transaction (const gimple *stmt)
2333 return bb_in_transaction (gimple_bb (stmt));
2336 /* Return true if statement STMT may access memory. */
2338 inline bool
2339 gimple_references_memory_p (gimple *stmt)
2341 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2345 /* Return the subcode for OMP statement S. */
2347 inline unsigned
2348 gimple_omp_subcode (const gimple *s)
2350 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2351 && gimple_code (s) <= GIMPLE_OMP_ORDERED);
2352 return s->subcode;
2355 /* Set the subcode for OMP statement S to SUBCODE. */
2357 inline void
2358 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2360 /* We only have 16 bits for the subcode. Assert that we are not
2361 overflowing it. */
2362 gcc_gimple_checking_assert (subcode < (1 << 16));
2363 s->subcode = subcode;
2366 /* Set the nowait flag on OMP_RETURN statement S. */
2368 inline void
2369 gimple_omp_return_set_nowait (gimple *s)
2371 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2372 s->subcode |= GF_OMP_RETURN_NOWAIT;
2376 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2377 flag set. */
2379 inline bool
2380 gimple_omp_return_nowait_p (const gimple *g)
2382 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2383 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2387 /* Set the LHS of OMP return. */
2389 inline void
2390 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2392 gimple_statement_omp_return *omp_return_stmt =
2393 as_a <gimple_statement_omp_return *> (g);
2394 omp_return_stmt->val = lhs;
2398 /* Get the LHS of OMP return. */
2400 inline tree
2401 gimple_omp_return_lhs (const gimple *g)
2403 const gimple_statement_omp_return *omp_return_stmt =
2404 as_a <const gimple_statement_omp_return *> (g);
2405 return omp_return_stmt->val;
2409 /* Return a pointer to the LHS of OMP return. */
2411 inline tree *
2412 gimple_omp_return_lhs_ptr (gimple *g)
2414 gimple_statement_omp_return *omp_return_stmt =
2415 as_a <gimple_statement_omp_return *> (g);
2416 return &omp_return_stmt->val;
2420 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2421 flag set. */
2423 inline bool
2424 gimple_omp_section_last_p (const gimple *g)
2426 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2427 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2431 /* Set the GF_OMP_SECTION_LAST flag on G. */
2433 inline void
2434 gimple_omp_section_set_last (gimple *g)
2436 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2437 g->subcode |= GF_OMP_SECTION_LAST;
2441 /* Return true if OMP ordered construct is stand-alone
2442 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2444 inline bool
2445 gimple_omp_ordered_standalone_p (const gimple *g)
2447 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2448 return (gimple_omp_subcode (g) & GF_OMP_ORDERED_STANDALONE) != 0;
2452 /* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2454 inline void
2455 gimple_omp_ordered_standalone (gimple *g)
2457 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2458 g->subcode |= GF_OMP_ORDERED_STANDALONE;
2462 /* Return true if OMP parallel statement G has the
2463 GF_OMP_PARALLEL_COMBINED flag set. */
2465 inline bool
2466 gimple_omp_parallel_combined_p (const gimple *g)
2468 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2469 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2473 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2474 value of COMBINED_P. */
2476 inline void
2477 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2479 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2480 if (combined_p)
2481 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2482 else
2483 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2487 /* Return true if OMP atomic load/store statement G has the
2488 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2490 inline bool
2491 gimple_omp_atomic_need_value_p (const gimple *g)
2493 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2494 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2495 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2499 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2501 inline void
2502 gimple_omp_atomic_set_need_value (gimple *g)
2504 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2505 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2506 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2510 /* Return true if OMP atomic load/store statement G has the
2511 GF_OMP_ATOMIC_WEAK flag set. */
2513 inline bool
2514 gimple_omp_atomic_weak_p (const gimple *g)
2516 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2517 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2518 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_WEAK) != 0;
2522 /* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2524 inline void
2525 gimple_omp_atomic_set_weak (gimple *g)
2527 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2528 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2529 g->subcode |= GF_OMP_ATOMIC_WEAK;
2533 /* Return the memory order of the OMP atomic load/store statement G. */
2535 inline enum omp_memory_order
2536 gimple_omp_atomic_memory_order (const gimple *g)
2538 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2539 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2540 return (enum omp_memory_order)
2541 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2545 /* Set the memory order on G. */
2547 inline void
2548 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2550 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2551 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2552 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2553 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2557 /* Return the number of operands for statement GS. */
2559 inline unsigned
2560 gimple_num_ops (const gimple *gs)
2562 return gs->num_ops;
2566 /* Set the number of operands for statement GS. */
2568 inline void
2569 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2571 gs->num_ops = num_ops;
2575 /* Return the array of operands for statement GS. */
2577 inline tree *
2578 gimple_ops (gimple *gs)
2580 size_t off;
2582 /* All the tuples have their operand vector at the very bottom
2583 of the structure. Note that those structures that do not
2584 have an operand vector have a zero offset. */
2585 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2586 gcc_gimple_checking_assert (off != 0);
2588 return (tree *) ((char *) gs + off);
2592 /* Return operand I for statement GS. */
2594 inline tree
2595 gimple_op (const gimple *gs, unsigned i)
2597 if (gimple_has_ops (gs))
2599 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2600 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2602 else
2603 return NULL_TREE;
2606 /* Return a pointer to operand I for statement GS. */
2608 inline tree *
2609 gimple_op_ptr (gimple *gs, unsigned i)
2611 if (gimple_has_ops (gs))
2613 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2614 return gimple_ops (gs) + i;
2616 else
2617 return NULL;
2620 /* Set operand I of statement GS to OP. */
2622 inline void
2623 gimple_set_op (gimple *gs, unsigned i, tree op)
2625 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2627 /* Note. It may be tempting to assert that OP matches
2628 is_gimple_operand, but that would be wrong. Different tuples
2629 accept slightly different sets of tree operands. Each caller
2630 should perform its own validation. */
2631 gimple_ops (gs)[i] = op;
2634 /* Return true if GS is a GIMPLE_ASSIGN. */
2636 inline bool
2637 is_gimple_assign (const gimple *gs)
2639 return gimple_code (gs) == GIMPLE_ASSIGN;
2642 /* Determine if expression CODE is one of the valid expressions that can
2643 be used on the RHS of GIMPLE assignments. */
2645 inline enum gimple_rhs_class
2646 get_gimple_rhs_class (enum tree_code code)
2648 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2651 /* Return the LHS of assignment statement GS. */
2653 inline tree
2654 gimple_assign_lhs (const gassign *gs)
2656 return gs->op[0];
2659 inline tree
2660 gimple_assign_lhs (const gimple *gs)
2662 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2663 return gimple_assign_lhs (ass);
2667 /* Return a pointer to the LHS of assignment statement GS. */
2669 inline tree *
2670 gimple_assign_lhs_ptr (gassign *gs)
2672 return &gs->op[0];
2675 inline tree *
2676 gimple_assign_lhs_ptr (gimple *gs)
2678 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2679 return gimple_assign_lhs_ptr (ass);
2683 /* Set LHS to be the LHS operand of assignment statement GS. */
2685 inline void
2686 gimple_assign_set_lhs (gassign *gs, tree lhs)
2688 gs->op[0] = lhs;
2690 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2691 SSA_NAME_DEF_STMT (lhs) = gs;
2694 inline void
2695 gimple_assign_set_lhs (gimple *gs, tree lhs)
2697 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2698 gimple_assign_set_lhs (ass, lhs);
2702 /* Return the first operand on the RHS of assignment statement GS. */
2704 inline tree
2705 gimple_assign_rhs1 (const gassign *gs)
2707 return gs->op[1];
2710 inline tree
2711 gimple_assign_rhs1 (const gimple *gs)
2713 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2714 return gimple_assign_rhs1 (ass);
2718 /* Return a pointer to the first operand on the RHS of assignment
2719 statement GS. */
2721 inline tree *
2722 gimple_assign_rhs1_ptr (gassign *gs)
2724 return &gs->op[1];
2727 inline tree *
2728 gimple_assign_rhs1_ptr (gimple *gs)
2730 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2731 return gimple_assign_rhs1_ptr (ass);
2734 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2736 inline void
2737 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2739 gs->op[1] = rhs;
2742 inline void
2743 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2745 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2746 gimple_assign_set_rhs1 (ass, rhs);
2750 /* Return the second operand on the RHS of assignment statement GS.
2751 If GS does not have two operands, NULL is returned instead. */
2753 inline tree
2754 gimple_assign_rhs2 (const gassign *gs)
2756 if (gimple_num_ops (gs) >= 3)
2757 return gs->op[2];
2758 else
2759 return NULL_TREE;
2762 inline tree
2763 gimple_assign_rhs2 (const gimple *gs)
2765 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2766 return gimple_assign_rhs2 (ass);
2770 /* Return a pointer to the second operand on the RHS of assignment
2771 statement GS. */
2773 inline tree *
2774 gimple_assign_rhs2_ptr (gassign *gs)
2776 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2777 return &gs->op[2];
2780 inline tree *
2781 gimple_assign_rhs2_ptr (gimple *gs)
2783 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2784 return gimple_assign_rhs2_ptr (ass);
2788 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2790 inline void
2791 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2793 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2794 gs->op[2] = rhs;
2797 inline void
2798 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2800 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2801 return gimple_assign_set_rhs2 (ass, rhs);
2804 /* Return the third operand on the RHS of assignment statement GS.
2805 If GS does not have two operands, NULL is returned instead. */
2807 inline tree
2808 gimple_assign_rhs3 (const gassign *gs)
2810 if (gimple_num_ops (gs) >= 4)
2811 return gs->op[3];
2812 else
2813 return NULL_TREE;
2816 inline tree
2817 gimple_assign_rhs3 (const gimple *gs)
2819 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2820 return gimple_assign_rhs3 (ass);
2823 /* Return a pointer to the third operand on the RHS of assignment
2824 statement GS. */
2826 inline tree *
2827 gimple_assign_rhs3_ptr (gimple *gs)
2829 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2830 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2831 return &ass->op[3];
2835 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2837 inline void
2838 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2840 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2841 gs->op[3] = rhs;
2844 inline void
2845 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2847 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2848 gimple_assign_set_rhs3 (ass, rhs);
2852 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2853 which expect to see only two operands. */
2855 inline void
2856 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2857 tree op1, tree op2)
2859 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2862 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2863 which expect to see only one operands. */
2865 inline void
2866 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2867 tree op1)
2869 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2872 /* Returns true if GS is a nontemporal move. */
2874 inline bool
2875 gimple_assign_nontemporal_move_p (const gassign *gs)
2877 return gs->nontemporal_move;
2880 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2882 inline void
2883 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2885 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2886 gs->nontemporal_move = nontemporal;
2890 /* Return the code of the expression computed on the rhs of assignment
2891 statement GS. In case that the RHS is a single object, returns the
2892 tree code of the object. */
2894 inline enum tree_code
2895 gimple_assign_rhs_code (const gassign *gs)
2897 enum tree_code code = (enum tree_code) gs->subcode;
2898 /* While we initially set subcode to the TREE_CODE of the rhs for
2899 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2900 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2901 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2902 code = TREE_CODE (gs->op[1]);
2904 return code;
2907 inline enum tree_code
2908 gimple_assign_rhs_code (const gimple *gs)
2910 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2911 return gimple_assign_rhs_code (ass);
2915 /* Set CODE to be the code for the expression computed on the RHS of
2916 assignment S. */
2918 inline void
2919 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2921 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2922 s->subcode = code;
2926 /* Return the gimple rhs class of the code of the expression computed on
2927 the rhs of assignment statement GS.
2928 This will never return GIMPLE_INVALID_RHS. */
2930 inline enum gimple_rhs_class
2931 gimple_assign_rhs_class (const gimple *gs)
2933 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2936 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2937 there is no operator associated with the assignment itself.
2938 Unlike gimple_assign_copy_p, this predicate returns true for
2939 any RHS operand, including those that perform an operation
2940 and do not have the semantics of a copy, such as COND_EXPR. */
2942 inline bool
2943 gimple_assign_single_p (const gimple *gs)
2945 return (is_gimple_assign (gs)
2946 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2949 /* Return true if GS performs a store to its lhs. */
2951 inline bool
2952 gimple_store_p (const gimple *gs)
2954 tree lhs = gimple_get_lhs (gs);
2955 return lhs && !is_gimple_reg (lhs);
2958 /* Return true if S is a type-cast assignment. */
2960 inline bool
2961 gimple_assign_cast_p (const gimple *s)
2963 if (is_gimple_assign (s))
2965 enum tree_code sc = gimple_assign_rhs_code (s);
2966 return CONVERT_EXPR_CODE_P (sc)
2967 || sc == VIEW_CONVERT_EXPR
2968 || sc == FIX_TRUNC_EXPR;
2971 return false;
2974 /* Return true if S is a clobber statement. */
2976 inline bool
2977 gimple_clobber_p (const gimple *s)
2979 return gimple_assign_single_p (s)
2980 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2983 /* Return true if S is a clobber statement. */
2985 inline bool
2986 gimple_clobber_p (const gimple *s, enum clobber_kind kind)
2988 return gimple_clobber_p (s)
2989 && CLOBBER_KIND (gimple_assign_rhs1 (s)) == kind;
2992 /* Return true if GS is a GIMPLE_CALL. */
2994 inline bool
2995 is_gimple_call (const gimple *gs)
2997 return gimple_code (gs) == GIMPLE_CALL;
3000 /* Return the LHS of call statement GS. */
3002 inline tree
3003 gimple_call_lhs (const gcall *gs)
3005 return gs->op[0];
3008 inline tree
3009 gimple_call_lhs (const gimple *gs)
3011 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3012 return gimple_call_lhs (gc);
3016 /* Return a pointer to the LHS of call statement GS. */
3018 inline tree *
3019 gimple_call_lhs_ptr (gcall *gs)
3021 return &gs->op[0];
3024 inline tree *
3025 gimple_call_lhs_ptr (gimple *gs)
3027 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3028 return gimple_call_lhs_ptr (gc);
3032 /* Set LHS to be the LHS operand of call statement GS. */
3034 inline void
3035 gimple_call_set_lhs (gcall *gs, tree lhs)
3037 gs->op[0] = lhs;
3038 if (lhs && TREE_CODE (lhs) == SSA_NAME)
3039 SSA_NAME_DEF_STMT (lhs) = gs;
3042 inline void
3043 gimple_call_set_lhs (gimple *gs, tree lhs)
3045 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3046 gimple_call_set_lhs (gc, lhs);
3050 /* Return true if call GS calls an internal-only function, as enumerated
3051 by internal_fn. */
3053 inline bool
3054 gimple_call_internal_p (const gcall *gs)
3056 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3059 inline bool
3060 gimple_call_internal_p (const gimple *gs)
3062 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3063 return gimple_call_internal_p (gc);
3066 /* Return true if call GS is marked as nocf_check. */
3068 inline bool
3069 gimple_call_nocf_check_p (const gcall *gs)
3071 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3074 /* Mark statement GS as nocf_check call. */
3076 inline void
3077 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
3079 if (nocf_check)
3080 gs->subcode |= GF_CALL_NOCF_CHECK;
3081 else
3082 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3085 /* Return the target of internal call GS. */
3087 inline enum internal_fn
3088 gimple_call_internal_fn (const gcall *gs)
3090 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3091 return gs->u.internal_fn;
3094 inline enum internal_fn
3095 gimple_call_internal_fn (const gimple *gs)
3097 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3098 return gimple_call_internal_fn (gc);
3101 /* Return true, if this internal gimple call is unique. */
3103 inline bool
3104 gimple_call_internal_unique_p (const gcall *gs)
3106 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3109 inline bool
3110 gimple_call_internal_unique_p (const gimple *gs)
3112 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3113 return gimple_call_internal_unique_p (gc);
3116 /* Return true if GS is an internal function FN. */
3118 inline bool
3119 gimple_call_internal_p (const gimple *gs, internal_fn fn)
3121 return (is_gimple_call (gs)
3122 && gimple_call_internal_p (gs)
3123 && gimple_call_internal_fn (gs) == fn);
3126 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3127 that could alter control flow. */
3129 inline void
3130 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3132 if (ctrl_altering_p)
3133 s->subcode |= GF_CALL_CTRL_ALTERING;
3134 else
3135 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3138 inline void
3139 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3141 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3142 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3145 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3146 flag is set. Such call could not be a stmt in the middle of a bb. */
3148 inline bool
3149 gimple_call_ctrl_altering_p (const gcall *gs)
3151 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3154 inline bool
3155 gimple_call_ctrl_altering_p (const gimple *gs)
3157 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3158 return gimple_call_ctrl_altering_p (gc);
3162 /* Return the function type of the function called by GS. */
3164 inline tree
3165 gimple_call_fntype (const gcall *gs)
3167 if (gimple_call_internal_p (gs))
3168 return NULL_TREE;
3169 return gs->u.fntype;
3172 inline tree
3173 gimple_call_fntype (const gimple *gs)
3175 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3176 return gimple_call_fntype (call_stmt);
3179 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3181 inline void
3182 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3184 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3185 call_stmt->u.fntype = fntype;
3189 /* Return the tree node representing the function called by call
3190 statement GS. */
3192 inline tree
3193 gimple_call_fn (const gcall *gs)
3195 return gs->op[1];
3198 inline tree
3199 gimple_call_fn (const gimple *gs)
3201 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3202 return gimple_call_fn (gc);
3205 /* Return a pointer to the tree node representing the function called by call
3206 statement GS. */
3208 inline tree *
3209 gimple_call_fn_ptr (gcall *gs)
3211 return &gs->op[1];
3214 inline tree *
3215 gimple_call_fn_ptr (gimple *gs)
3217 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3218 return gimple_call_fn_ptr (gc);
3222 /* Set FN to be the function called by call statement GS. */
3224 inline void
3225 gimple_call_set_fn (gcall *gs, tree fn)
3227 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3228 gs->op[1] = fn;
3232 /* Set FNDECL to be the function called by call statement GS. */
3234 inline void
3235 gimple_call_set_fndecl (gcall *gs, tree decl)
3237 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3238 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3239 build_pointer_type (TREE_TYPE (decl)), decl);
3242 inline void
3243 gimple_call_set_fndecl (gimple *gs, tree decl)
3245 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3246 gimple_call_set_fndecl (gc, decl);
3250 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3252 inline void
3253 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3255 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3256 call_stmt->u.internal_fn = fn;
3260 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3261 Otherwise return NULL. This function is analogous to
3262 get_callee_fndecl in tree land. */
3264 inline tree
3265 gimple_call_fndecl (const gcall *gs)
3267 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3270 inline tree
3271 gimple_call_fndecl (const gimple *gs)
3273 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3274 return gimple_call_fndecl (gc);
3278 /* Return the type returned by call statement GS. */
3280 inline tree
3281 gimple_call_return_type (const gcall *gs)
3283 tree type = gimple_call_fntype (gs);
3285 if (type == NULL_TREE)
3286 return TREE_TYPE (gimple_call_lhs (gs));
3288 /* The type returned by a function is the type of its
3289 function type. */
3290 return TREE_TYPE (type);
3294 /* Return the static chain for call statement GS. */
3296 inline tree
3297 gimple_call_chain (const gcall *gs)
3299 return gs->op[2];
3302 inline tree
3303 gimple_call_chain (const gimple *gs)
3305 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3306 return gimple_call_chain (gc);
3310 /* Return a pointer to the static chain for call statement CALL_STMT. */
3312 inline tree *
3313 gimple_call_chain_ptr (gcall *call_stmt)
3315 return &call_stmt->op[2];
3318 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3320 inline void
3321 gimple_call_set_chain (gcall *call_stmt, tree chain)
3323 call_stmt->op[2] = chain;
3327 /* Return the number of arguments used by call statement GS. */
3329 inline unsigned
3330 gimple_call_num_args (const gcall *gs)
3332 return gimple_num_ops (gs) - 3;
3335 inline unsigned
3336 gimple_call_num_args (const gimple *gs)
3338 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3339 return gimple_call_num_args (gc);
3343 /* Return the argument at position INDEX for call statement GS. */
3345 inline tree
3346 gimple_call_arg (const gcall *gs, unsigned index)
3348 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3349 return gs->op[index + 3];
3352 inline tree
3353 gimple_call_arg (const gimple *gs, unsigned index)
3355 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3356 return gimple_call_arg (gc, index);
3360 /* Return a pointer to the argument at position INDEX for call
3361 statement GS. */
3363 inline tree *
3364 gimple_call_arg_ptr (gcall *gs, unsigned index)
3366 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3367 return &gs->op[index + 3];
3370 inline tree *
3371 gimple_call_arg_ptr (gimple *gs, unsigned index)
3373 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3374 return gimple_call_arg_ptr (gc, index);
3378 /* Set ARG to be the argument at position INDEX for call statement GS. */
3380 inline void
3381 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3383 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3384 gs->op[index + 3] = arg;
3387 inline void
3388 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3390 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3391 gimple_call_set_arg (gc, index, arg);
3395 /* If TAIL_P is true, mark call statement S as being a tail call
3396 (i.e., a call just before the exit of a function). These calls are
3397 candidate for tail call optimization. */
3399 inline void
3400 gimple_call_set_tail (gcall *s, bool tail_p)
3402 if (tail_p)
3403 s->subcode |= GF_CALL_TAILCALL;
3404 else
3405 s->subcode &= ~GF_CALL_TAILCALL;
3409 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3411 inline bool
3412 gimple_call_tail_p (const gcall *s)
3414 return (s->subcode & GF_CALL_TAILCALL) != 0;
3417 /* Mark (or clear) call statement S as requiring tail call optimization. */
3419 inline void
3420 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3422 if (must_tail_p)
3423 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3424 else
3425 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3428 /* Return true if call statement has been marked as requiring
3429 tail call optimization. */
3431 inline bool
3432 gimple_call_must_tail_p (const gcall *s)
3434 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3437 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3438 slot optimization. This transformation uses the target of the call
3439 expansion as the return slot for calls that return in memory. */
3441 inline void
3442 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3444 if (return_slot_opt_p)
3445 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3446 else
3447 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3451 /* Return true if S is marked for return slot optimization. */
3453 inline bool
3454 gimple_call_return_slot_opt_p (const gcall *s)
3456 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3460 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3461 thunk to the thunked-to function. */
3463 inline void
3464 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3466 if (from_thunk_p)
3467 s->subcode |= GF_CALL_FROM_THUNK;
3468 else
3469 s->subcode &= ~GF_CALL_FROM_THUNK;
3473 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3475 inline bool
3476 gimple_call_from_thunk_p (gcall *s)
3478 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3482 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3483 to operator new or delete created from a new or delete expression. */
3485 inline void
3486 gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3488 if (from_new_or_delete_p)
3489 s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
3490 else
3491 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3495 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3496 from a new or delete expression. */
3498 inline bool
3499 gimple_call_from_new_or_delete (const gcall *s)
3501 return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
3505 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3506 argument pack in its argument list. */
3508 inline void
3509 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3511 if (pass_arg_pack_p)
3512 s->subcode |= GF_CALL_VA_ARG_PACK;
3513 else
3514 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3518 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3519 argument pack in its argument list. */
3521 inline bool
3522 gimple_call_va_arg_pack_p (const gcall *s)
3524 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3528 /* Return true if S is a noreturn call. */
3530 inline bool
3531 gimple_call_noreturn_p (const gcall *s)
3533 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3536 inline bool
3537 gimple_call_noreturn_p (const gimple *s)
3539 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3540 return gimple_call_noreturn_p (gc);
3544 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3545 even if the called function can throw in other cases. */
3547 inline void
3548 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3550 if (nothrow_p)
3551 s->subcode |= GF_CALL_NOTHROW;
3552 else
3553 s->subcode &= ~GF_CALL_NOTHROW;
3556 /* Return true if S is a nothrow call. */
3558 inline bool
3559 gimple_call_nothrow_p (gcall *s)
3561 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3564 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3565 is known to be emitted for VLA objects. Those are wrapped by
3566 stack_save/stack_restore calls and hence can't lead to unbounded
3567 stack growth even when they occur in loops. */
3569 inline void
3570 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3572 if (for_var)
3573 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3574 else
3575 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3578 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3580 inline bool
3581 gimple_call_alloca_for_var_p (gcall *s)
3583 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3586 inline bool
3587 gimple_call_alloca_for_var_p (gimple *s)
3589 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3590 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3593 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3594 pointers to nested function are descriptors instead of trampolines. */
3596 inline void
3597 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3599 if (by_descriptor_p)
3600 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3601 else
3602 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3605 /* Return true if S is a by-descriptor call. */
3607 inline bool
3608 gimple_call_by_descriptor_p (gcall *s)
3610 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3613 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3615 inline void
3616 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3618 dest_call->subcode = orig_call->subcode;
3622 /* Return a pointer to the points-to solution for the set of call-used
3623 variables of the call CALL_STMT. */
3625 inline struct pt_solution *
3626 gimple_call_use_set (gcall *call_stmt)
3628 return &call_stmt->call_used;
3631 /* As above, but const. */
3633 inline const pt_solution *
3634 gimple_call_use_set (const gcall *call_stmt)
3636 return &call_stmt->call_used;
3639 /* Return a pointer to the points-to solution for the set of call-used
3640 variables of the call CALL_STMT. */
3642 inline struct pt_solution *
3643 gimple_call_clobber_set (gcall *call_stmt)
3645 return &call_stmt->call_clobbered;
3648 /* As above, but const. */
3650 inline const pt_solution *
3651 gimple_call_clobber_set (const gcall *call_stmt)
3653 return &call_stmt->call_clobbered;
3657 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3658 non-NULL lhs. */
3660 inline bool
3661 gimple_has_lhs (const gimple *stmt)
3663 if (is_gimple_assign (stmt))
3664 return true;
3665 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3666 return gimple_call_lhs (call) != NULL_TREE;
3667 return false;
3671 /* Return the code of the predicate computed by conditional statement GS. */
3673 inline enum tree_code
3674 gimple_cond_code (const gcond *gs)
3676 return (enum tree_code) gs->subcode;
3679 inline enum tree_code
3680 gimple_cond_code (const gimple *gs)
3682 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3683 return gimple_cond_code (gc);
3687 /* Set CODE to be the predicate code for the conditional statement GS. */
3689 inline void
3690 gimple_cond_set_code (gcond *gs, enum tree_code code)
3692 gs->subcode = code;
3696 /* Return the LHS of the predicate computed by conditional statement GS. */
3698 inline tree
3699 gimple_cond_lhs (const gcond *gs)
3701 return gs->op[0];
3704 inline tree
3705 gimple_cond_lhs (const gimple *gs)
3707 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3708 return gimple_cond_lhs (gc);
3711 /* Return the pointer to the LHS of the predicate computed by conditional
3712 statement GS. */
3714 inline tree *
3715 gimple_cond_lhs_ptr (gcond *gs)
3717 return &gs->op[0];
3720 /* Set LHS to be the LHS operand of the predicate computed by
3721 conditional statement GS. */
3723 inline void
3724 gimple_cond_set_lhs (gcond *gs, tree lhs)
3726 gs->op[0] = lhs;
3730 /* Return the RHS operand of the predicate computed by conditional GS. */
3732 inline tree
3733 gimple_cond_rhs (const gcond *gs)
3735 return gs->op[1];
3738 inline tree
3739 gimple_cond_rhs (const gimple *gs)
3741 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3742 return gimple_cond_rhs (gc);
3745 /* Return the pointer to the RHS operand of the predicate computed by
3746 conditional GS. */
3748 inline tree *
3749 gimple_cond_rhs_ptr (gcond *gs)
3751 return &gs->op[1];
3755 /* Set RHS to be the RHS operand of the predicate computed by
3756 conditional statement GS. */
3758 inline void
3759 gimple_cond_set_rhs (gcond *gs, tree rhs)
3761 gs->op[1] = rhs;
3765 /* Return the label used by conditional statement GS when its
3766 predicate evaluates to true. */
3768 inline tree
3769 gimple_cond_true_label (const gcond *gs)
3771 return gs->op[2];
3775 /* Set LABEL to be the label used by conditional statement GS when its
3776 predicate evaluates to true. */
3778 inline void
3779 gimple_cond_set_true_label (gcond *gs, tree label)
3781 gs->op[2] = label;
3785 /* Set LABEL to be the label used by conditional statement GS when its
3786 predicate evaluates to false. */
3788 inline void
3789 gimple_cond_set_false_label (gcond *gs, tree label)
3791 gs->op[3] = label;
3795 /* Return the label used by conditional statement GS when its
3796 predicate evaluates to false. */
3798 inline tree
3799 gimple_cond_false_label (const gcond *gs)
3801 return gs->op[3];
3805 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3807 inline void
3808 gimple_cond_make_false (gcond *gs)
3810 gimple_cond_set_lhs (gs, boolean_false_node);
3811 gimple_cond_set_rhs (gs, boolean_false_node);
3812 gs->subcode = NE_EXPR;
3816 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3818 inline void
3819 gimple_cond_make_true (gcond *gs)
3821 gimple_cond_set_lhs (gs, boolean_true_node);
3822 gimple_cond_set_rhs (gs, boolean_false_node);
3823 gs->subcode = NE_EXPR;
3826 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3827 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3829 inline bool
3830 gimple_cond_true_p (const gcond *gs)
3832 tree lhs = gimple_cond_lhs (gs);
3833 tree rhs = gimple_cond_rhs (gs);
3834 enum tree_code code = gimple_cond_code (gs);
3836 if (lhs != boolean_true_node && lhs != boolean_false_node)
3837 return false;
3839 if (rhs != boolean_true_node && rhs != boolean_false_node)
3840 return false;
3842 if (code == NE_EXPR && lhs != rhs)
3843 return true;
3845 if (code == EQ_EXPR && lhs == rhs)
3846 return true;
3848 return false;
3851 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3852 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3854 inline bool
3855 gimple_cond_false_p (const gcond *gs)
3857 tree lhs = gimple_cond_lhs (gs);
3858 tree rhs = gimple_cond_rhs (gs);
3859 enum tree_code code = gimple_cond_code (gs);
3861 if (lhs != boolean_true_node && lhs != boolean_false_node)
3862 return false;
3864 if (rhs != boolean_true_node && rhs != boolean_false_node)
3865 return false;
3867 if (code == NE_EXPR && lhs == rhs)
3868 return true;
3870 if (code == EQ_EXPR && lhs != rhs)
3871 return true;
3873 return false;
3876 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3878 inline void
3879 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3880 tree rhs)
3882 gimple_cond_set_code (stmt, code);
3883 gimple_cond_set_lhs (stmt, lhs);
3884 gimple_cond_set_rhs (stmt, rhs);
3888 /* Return the tree code for the expression computed by STMT. This is
3889 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3890 GIMPLE_CALL, return CALL_EXPR as the expression code for
3891 consistency. This is useful when the caller needs to deal with the
3892 three kinds of computation that GIMPLE supports. */
3894 inline enum tree_code
3895 gimple_expr_code (const gimple *stmt)
3897 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3898 return gimple_assign_rhs_code (ass);
3899 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3900 return gimple_cond_code (cond);
3901 else
3903 gcc_gimple_checking_assert (gimple_code (stmt) == GIMPLE_CALL);
3904 return CALL_EXPR;
3909 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3911 inline tree
3912 gimple_label_label (const glabel *gs)
3914 return gs->op[0];
3918 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3919 GS. */
3921 inline void
3922 gimple_label_set_label (glabel *gs, tree label)
3924 gs->op[0] = label;
3928 /* Return the destination of the unconditional jump GS. */
3930 inline tree
3931 gimple_goto_dest (const gimple *gs)
3933 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3934 return gimple_op (gs, 0);
3938 /* Set DEST to be the destination of the unconditonal jump GS. */
3940 inline void
3941 gimple_goto_set_dest (ggoto *gs, tree dest)
3943 gs->op[0] = dest;
3947 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3949 inline tree
3950 gimple_bind_vars (const gbind *bind_stmt)
3952 return bind_stmt->vars;
3956 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3957 statement GS. */
3959 inline void
3960 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3962 bind_stmt->vars = vars;
3966 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3967 statement GS. */
3969 inline void
3970 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3972 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3976 inline gimple_seq *
3977 gimple_bind_body_ptr (gbind *bind_stmt)
3979 return &bind_stmt->body;
3982 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3984 inline gimple_seq
3985 gimple_bind_body (const gbind *gs)
3987 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
3991 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3992 statement GS. */
3994 inline void
3995 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3997 bind_stmt->body = seq;
4001 /* Append a statement to the end of a GIMPLE_BIND's body. */
4003 inline void
4004 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
4006 gimple_seq_add_stmt (&bind_stmt->body, stmt);
4010 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
4012 inline void
4013 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
4015 gimple_seq_add_seq (&bind_stmt->body, seq);
4019 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4020 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4022 inline tree
4023 gimple_bind_block (const gbind *bind_stmt)
4025 return bind_stmt->block;
4029 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4030 statement GS. */
4032 inline void
4033 gimple_bind_set_block (gbind *bind_stmt, tree block)
4035 gcc_gimple_checking_assert (block == NULL_TREE
4036 || TREE_CODE (block) == BLOCK);
4037 bind_stmt->block = block;
4041 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4043 inline unsigned
4044 gimple_asm_ninputs (const gasm *asm_stmt)
4046 return asm_stmt->ni;
4050 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4052 inline unsigned
4053 gimple_asm_noutputs (const gasm *asm_stmt)
4055 return asm_stmt->no;
4059 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4061 inline unsigned
4062 gimple_asm_nclobbers (const gasm *asm_stmt)
4064 return asm_stmt->nc;
4067 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4069 inline unsigned
4070 gimple_asm_nlabels (const gasm *asm_stmt)
4072 return asm_stmt->nl;
4075 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4077 inline tree
4078 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4080 gcc_gimple_checking_assert (index < asm_stmt->ni);
4081 return asm_stmt->op[index + asm_stmt->no];
4084 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4086 inline void
4087 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4089 gcc_gimple_checking_assert (index < asm_stmt->ni
4090 && TREE_CODE (in_op) == TREE_LIST);
4091 asm_stmt->op[index + asm_stmt->no] = in_op;
4095 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4097 inline tree
4098 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4100 gcc_gimple_checking_assert (index < asm_stmt->no);
4101 return asm_stmt->op[index];
4104 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4106 inline void
4107 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4109 gcc_gimple_checking_assert (index < asm_stmt->no
4110 && TREE_CODE (out_op) == TREE_LIST);
4111 asm_stmt->op[index] = out_op;
4115 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4117 inline tree
4118 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4120 gcc_gimple_checking_assert (index < asm_stmt->nc);
4121 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4125 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4127 inline void
4128 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4130 gcc_gimple_checking_assert (index < asm_stmt->nc
4131 && TREE_CODE (clobber_op) == TREE_LIST);
4132 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4135 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4137 inline tree
4138 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4140 gcc_gimple_checking_assert (index < asm_stmt->nl);
4141 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4144 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4146 inline void
4147 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4149 gcc_gimple_checking_assert (index < asm_stmt->nl
4150 && TREE_CODE (label_op) == TREE_LIST);
4151 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4154 /* Return the string representing the assembly instruction in
4155 GIMPLE_ASM ASM_STMT. */
4157 inline const char *
4158 gimple_asm_string (const gasm *asm_stmt)
4160 return asm_stmt->string;
4164 /* Return true if ASM_STMT is marked volatile. */
4166 inline bool
4167 gimple_asm_volatile_p (const gasm *asm_stmt)
4169 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4173 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4175 inline void
4176 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4178 if (volatile_p)
4179 asm_stmt->subcode |= GF_ASM_VOLATILE;
4180 else
4181 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4185 /* Return true if ASM_STMT is marked inline. */
4187 inline bool
4188 gimple_asm_inline_p (const gasm *asm_stmt)
4190 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4194 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4196 inline void
4197 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4199 if (inline_p)
4200 asm_stmt->subcode |= GF_ASM_INLINE;
4201 else
4202 asm_stmt->subcode &= ~GF_ASM_INLINE;
4206 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4208 inline void
4209 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
4211 if (input_p)
4212 asm_stmt->subcode |= GF_ASM_INPUT;
4213 else
4214 asm_stmt->subcode &= ~GF_ASM_INPUT;
4218 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4220 inline bool
4221 gimple_asm_input_p (const gasm *asm_stmt)
4223 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
4227 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4229 inline tree
4230 gimple_catch_types (const gcatch *catch_stmt)
4232 return catch_stmt->types;
4236 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4238 inline tree *
4239 gimple_catch_types_ptr (gcatch *catch_stmt)
4241 return &catch_stmt->types;
4245 /* Return a pointer to the GIMPLE sequence representing the body of
4246 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4248 inline gimple_seq *
4249 gimple_catch_handler_ptr (gcatch *catch_stmt)
4251 return &catch_stmt->handler;
4255 /* Return the GIMPLE sequence representing the body of the handler of
4256 GIMPLE_CATCH statement CATCH_STMT. */
4258 inline gimple_seq
4259 gimple_catch_handler (const gcatch *catch_stmt)
4261 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4265 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4267 inline void
4268 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4270 catch_stmt->types = t;
4274 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4276 inline void
4277 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4279 catch_stmt->handler = handler;
4283 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4285 inline tree
4286 gimple_eh_filter_types (const gimple *gs)
4288 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4289 return eh_filter_stmt->types;
4293 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4294 GS. */
4296 inline tree *
4297 gimple_eh_filter_types_ptr (gimple *gs)
4299 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4300 return &eh_filter_stmt->types;
4304 /* Return a pointer to the sequence of statement to execute when
4305 GIMPLE_EH_FILTER statement fails. */
4307 inline gimple_seq *
4308 gimple_eh_filter_failure_ptr (gimple *gs)
4310 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4311 return &eh_filter_stmt->failure;
4315 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4316 statement fails. */
4318 inline gimple_seq
4319 gimple_eh_filter_failure (const gimple *gs)
4321 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4325 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4326 EH_FILTER_STMT. */
4328 inline void
4329 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4331 eh_filter_stmt->types = types;
4335 /* Set FAILURE to be the sequence of statements to execute on failure
4336 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4338 inline void
4339 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4340 gimple_seq failure)
4342 eh_filter_stmt->failure = failure;
4345 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4347 inline tree
4348 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4350 return eh_mnt_stmt->fndecl;
4353 /* Set the function decl to be called by GS to DECL. */
4355 inline void
4356 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4357 tree decl)
4359 eh_mnt_stmt->fndecl = decl;
4362 /* GIMPLE_EH_ELSE accessors. */
4364 inline gimple_seq *
4365 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4367 return &eh_else_stmt->n_body;
4370 inline gimple_seq
4371 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4373 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4376 inline gimple_seq *
4377 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4379 return &eh_else_stmt->e_body;
4382 inline gimple_seq
4383 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4385 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4388 inline void
4389 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4391 eh_else_stmt->n_body = seq;
4394 inline void
4395 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4397 eh_else_stmt->e_body = seq;
4400 /* GIMPLE_TRY accessors. */
4402 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4403 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4405 inline enum gimple_try_flags
4406 gimple_try_kind (const gimple *gs)
4408 GIMPLE_CHECK (gs, GIMPLE_TRY);
4409 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4413 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4415 inline void
4416 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4418 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4419 || kind == GIMPLE_TRY_FINALLY);
4420 if (gimple_try_kind (gs) != kind)
4421 gs->subcode = (unsigned int) kind;
4425 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4427 inline bool
4428 gimple_try_catch_is_cleanup (const gimple *gs)
4430 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4431 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4435 /* Return a pointer to the sequence of statements used as the
4436 body for GIMPLE_TRY GS. */
4438 inline gimple_seq *
4439 gimple_try_eval_ptr (gimple *gs)
4441 gtry *try_stmt = as_a <gtry *> (gs);
4442 return &try_stmt->eval;
4446 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4448 inline gimple_seq
4449 gimple_try_eval (const gimple *gs)
4451 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4455 /* Return a pointer to the sequence of statements used as the cleanup body for
4456 GIMPLE_TRY GS. */
4458 inline gimple_seq *
4459 gimple_try_cleanup_ptr (gimple *gs)
4461 gtry *try_stmt = as_a <gtry *> (gs);
4462 return &try_stmt->cleanup;
4466 /* Return the sequence of statements used as the cleanup body for
4467 GIMPLE_TRY GS. */
4469 inline gimple_seq
4470 gimple_try_cleanup (const gimple *gs)
4472 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4476 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4478 inline void
4479 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4481 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4482 if (catch_is_cleanup)
4483 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4484 else
4485 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4489 /* Set EVAL to be the sequence of statements to use as the body for
4490 GIMPLE_TRY TRY_STMT. */
4492 inline void
4493 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4495 try_stmt->eval = eval;
4499 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4500 body for GIMPLE_TRY TRY_STMT. */
4502 inline void
4503 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4505 try_stmt->cleanup = cleanup;
4509 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4511 inline gimple_seq *
4512 gimple_wce_cleanup_ptr (gimple *gs)
4514 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4515 return &wce_stmt->cleanup;
4519 /* Return the cleanup sequence for cleanup statement GS. */
4521 inline gimple_seq
4522 gimple_wce_cleanup (gimple *gs)
4524 return *gimple_wce_cleanup_ptr (gs);
4528 /* Set CLEANUP to be the cleanup sequence for GS. */
4530 inline void
4531 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4533 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4534 wce_stmt->cleanup = cleanup;
4538 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4540 inline bool
4541 gimple_wce_cleanup_eh_only (const gimple *gs)
4543 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4544 return gs->subcode != 0;
4548 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4550 inline void
4551 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4553 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4554 gs->subcode = (unsigned int) eh_only_p;
4558 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4560 inline unsigned
4561 gimple_phi_capacity (const gimple *gs)
4563 const gphi *phi_stmt = as_a <const gphi *> (gs);
4564 return phi_stmt->capacity;
4568 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4569 be exactly the number of incoming edges for the basic block holding
4570 GS. */
4572 inline unsigned
4573 gimple_phi_num_args (const gimple *gs)
4575 const gphi *phi_stmt = as_a <const gphi *> (gs);
4576 return phi_stmt->nargs;
4580 /* Return the SSA name created by GIMPLE_PHI GS. */
4582 inline tree
4583 gimple_phi_result (const gphi *gs)
4585 return gs->result;
4588 inline tree
4589 gimple_phi_result (const gimple *gs)
4591 const gphi *phi_stmt = as_a <const gphi *> (gs);
4592 return gimple_phi_result (phi_stmt);
4595 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4597 inline tree *
4598 gimple_phi_result_ptr (gphi *gs)
4600 return &gs->result;
4603 inline tree *
4604 gimple_phi_result_ptr (gimple *gs)
4606 gphi *phi_stmt = as_a <gphi *> (gs);
4607 return gimple_phi_result_ptr (phi_stmt);
4610 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4612 inline void
4613 gimple_phi_set_result (gphi *phi, tree result)
4615 phi->result = result;
4616 if (result && TREE_CODE (result) == SSA_NAME)
4617 SSA_NAME_DEF_STMT (result) = phi;
4621 /* Return the PHI argument corresponding to incoming edge INDEX for
4622 GIMPLE_PHI GS. */
4624 inline struct phi_arg_d *
4625 gimple_phi_arg (gphi *gs, unsigned index)
4627 gcc_gimple_checking_assert (index < gs->nargs);
4628 return &(gs->args[index]);
4631 inline const phi_arg_d *
4632 gimple_phi_arg (const gphi *gs, unsigned index)
4634 gcc_gimple_checking_assert (index < gs->nargs);
4635 return &(gs->args[index]);
4638 inline const phi_arg_d *
4639 gimple_phi_arg (const gimple *gs, unsigned index)
4641 const gphi *phi_stmt = as_a <const gphi *> (gs);
4642 return gimple_phi_arg (phi_stmt, index);
4645 inline struct phi_arg_d *
4646 gimple_phi_arg (gimple *gs, unsigned index)
4648 gphi *phi_stmt = as_a <gphi *> (gs);
4649 return gimple_phi_arg (phi_stmt, index);
4652 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4653 for GIMPLE_PHI PHI. */
4655 inline void
4656 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4658 gcc_gimple_checking_assert (index < phi->nargs);
4659 phi->args[index] = *phiarg;
4662 /* Return the PHI nodes for basic block BB, or NULL if there are no
4663 PHI nodes. */
4665 inline gimple_seq
4666 phi_nodes (const_basic_block bb)
4668 gcc_checking_assert (!(bb->flags & BB_RTL));
4669 return bb->il.gimple.phi_nodes;
4672 /* Return a pointer to the PHI nodes for basic block BB. */
4674 inline gimple_seq *
4675 phi_nodes_ptr (basic_block bb)
4677 gcc_checking_assert (!(bb->flags & BB_RTL));
4678 return &bb->il.gimple.phi_nodes;
4681 /* Return the tree operand for argument I of PHI node GS. */
4683 inline tree
4684 gimple_phi_arg_def (const gphi *gs, size_t index)
4686 return gimple_phi_arg (gs, index)->def;
4689 inline tree
4690 gimple_phi_arg_def (const gimple *gs, size_t index)
4692 return gimple_phi_arg (gs, index)->def;
4695 /* Return the tree operand for the argument associated with
4696 edge E of PHI node GS. */
4698 inline tree
4699 gimple_phi_arg_def_from_edge (const gphi *gs, const_edge e)
4701 gcc_checking_assert (e->dest == gimple_bb (gs));
4702 return gimple_phi_arg (gs, e->dest_idx)->def;
4705 inline tree
4706 gimple_phi_arg_def_from_edge (const gimple *gs, const_edge e)
4708 gcc_checking_assert (e->dest == gimple_bb (gs));
4709 return gimple_phi_arg (gs, e->dest_idx)->def;
4712 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4714 inline tree *
4715 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4717 return &gimple_phi_arg (phi, index)->def;
4720 /* Return the edge associated with argument I of phi node PHI. */
4722 inline edge
4723 gimple_phi_arg_edge (const gphi *phi, size_t i)
4725 return EDGE_PRED (gimple_bb (phi), i);
4728 /* Return the source location of gimple argument I of phi node PHI. */
4730 inline location_t
4731 gimple_phi_arg_location (const gphi *phi, size_t i)
4733 return gimple_phi_arg (phi, i)->locus;
4736 /* Return the source location of the argument on edge E of phi node PHI. */
4738 inline location_t
4739 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4741 return gimple_phi_arg (phi, e->dest_idx)->locus;
4744 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4746 inline void
4747 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4749 gimple_phi_arg (phi, i)->locus = loc;
4752 /* Return address of source location of gimple argument I of phi node PHI. */
4754 inline location_t *
4755 gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4757 return &gimple_phi_arg (phi, i)->locus;
4760 /* Return TRUE if argument I of phi node PHI has a location record. */
4762 inline bool
4763 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4765 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4768 /* Return the number of arguments that can be accessed by gimple_arg. */
4770 inline unsigned
4771 gimple_num_args (const gimple *gs)
4773 if (auto phi = dyn_cast<const gphi *> (gs))
4774 return gimple_phi_num_args (phi);
4775 if (auto call = dyn_cast<const gcall *> (gs))
4776 return gimple_call_num_args (call);
4777 return gimple_num_ops (as_a <const gassign *> (gs)) - 1;
4780 /* GS must be an assignment, a call, or a PHI.
4781 If it's an assignment, return rhs operand I.
4782 If it's a call, return function argument I.
4783 If it's a PHI, return the value of PHI argument I. */
4785 inline tree
4786 gimple_arg (const gimple *gs, unsigned int i)
4788 if (auto phi = dyn_cast<const gphi *> (gs))
4789 return gimple_phi_arg_def (phi, i);
4790 if (auto call = dyn_cast<const gcall *> (gs))
4791 return gimple_call_arg (call, i);
4792 return gimple_op (as_a <const gassign *> (gs), i + 1);
4795 /* Return a pointer to gimple_arg (GS, I). */
4797 inline tree *
4798 gimple_arg_ptr (gimple *gs, unsigned int i)
4800 if (auto phi = dyn_cast<gphi *> (gs))
4801 return gimple_phi_arg_def_ptr (phi, i);
4802 if (auto call = dyn_cast<gcall *> (gs))
4803 return gimple_call_arg_ptr (call, i);
4804 return gimple_op_ptr (as_a <gassign *> (gs), i + 1);
4807 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4809 inline int
4810 gimple_resx_region (const gresx *resx_stmt)
4812 return resx_stmt->region;
4815 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4817 inline void
4818 gimple_resx_set_region (gresx *resx_stmt, int region)
4820 resx_stmt->region = region;
4823 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4825 inline int
4826 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4828 return eh_dispatch_stmt->region;
4831 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4832 EH_DISPATCH_STMT. */
4834 inline void
4835 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4837 eh_dispatch_stmt->region = region;
4840 /* Return the number of labels associated with the switch statement GS. */
4842 inline unsigned
4843 gimple_switch_num_labels (const gswitch *gs)
4845 unsigned num_ops;
4846 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4847 num_ops = gimple_num_ops (gs);
4848 gcc_gimple_checking_assert (num_ops > 1);
4849 return num_ops - 1;
4853 /* Set NLABELS to be the number of labels for the switch statement GS. */
4855 inline void
4856 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4858 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4859 gimple_set_num_ops (g, nlabels + 1);
4863 /* Return the index variable used by the switch statement GS. */
4865 inline tree
4866 gimple_switch_index (const gswitch *gs)
4868 return gs->op[0];
4872 /* Return a pointer to the index variable for the switch statement GS. */
4874 inline tree *
4875 gimple_switch_index_ptr (gswitch *gs)
4877 return &gs->op[0];
4881 /* Set INDEX to be the index variable for switch statement GS. */
4883 inline void
4884 gimple_switch_set_index (gswitch *gs, tree index)
4886 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4887 gs->op[0] = index;
4891 /* Return the label numbered INDEX. The default label is 0, followed by any
4892 labels in a switch statement. */
4894 inline tree
4895 gimple_switch_label (const gswitch *gs, unsigned index)
4897 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4898 return gs->op[index + 1];
4901 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4903 inline void
4904 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4906 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4907 && (label == NULL_TREE
4908 || TREE_CODE (label) == CASE_LABEL_EXPR));
4909 gs->op[index + 1] = label;
4912 /* Return the default label for a switch statement. */
4914 inline tree
4915 gimple_switch_default_label (const gswitch *gs)
4917 tree label = gimple_switch_label (gs, 0);
4918 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4919 return label;
4922 /* Set the default label for a switch statement. */
4924 inline void
4925 gimple_switch_set_default_label (gswitch *gs, tree label)
4927 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4928 gimple_switch_set_label (gs, 0, label);
4931 /* Return true if GS is a GIMPLE_DEBUG statement. */
4933 inline bool
4934 is_gimple_debug (const gimple *gs)
4936 return gimple_code (gs) == GIMPLE_DEBUG;
4940 /* Return the first nondebug statement in GIMPLE sequence S. */
4942 inline gimple *
4943 gimple_seq_first_nondebug_stmt (gimple_seq s)
4945 gimple_seq_node n = gimple_seq_first (s);
4946 while (n && is_gimple_debug (n))
4947 n = n->next;
4948 return n;
4952 /* Return the last nondebug statement in GIMPLE sequence S. */
4954 inline gimple *
4955 gimple_seq_last_nondebug_stmt (gimple_seq s)
4957 gimple_seq_node n;
4958 for (n = gimple_seq_last (s);
4959 n && is_gimple_debug (n);
4960 n = n->prev)
4961 if (n == s)
4962 return NULL;
4963 return n;
4967 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4969 inline bool
4970 gimple_debug_bind_p (const gimple *s)
4972 if (is_gimple_debug (s))
4973 return s->subcode == GIMPLE_DEBUG_BIND;
4975 return false;
4978 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4980 inline tree
4981 gimple_debug_bind_get_var (const gimple *dbg)
4983 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4984 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4985 return gimple_op (dbg, 0);
4988 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4989 statement. */
4991 inline tree
4992 gimple_debug_bind_get_value (const gimple *dbg)
4994 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4995 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4996 return gimple_op (dbg, 1);
4999 /* Return a pointer to the value bound to the variable in a
5000 GIMPLE_DEBUG bind statement. */
5002 inline tree *
5003 gimple_debug_bind_get_value_ptr (gimple *dbg)
5005 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5006 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5007 return gimple_op_ptr (dbg, 1);
5010 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
5012 inline void
5013 gimple_debug_bind_set_var (gimple *dbg, tree var)
5015 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5016 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5017 gimple_set_op (dbg, 0, var);
5020 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
5021 statement. */
5023 inline void
5024 gimple_debug_bind_set_value (gimple *dbg, tree value)
5026 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5027 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5028 gimple_set_op (dbg, 1, value);
5031 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
5032 optimized away. */
5033 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
5035 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
5036 statement. */
5038 inline void
5039 gimple_debug_bind_reset_value (gimple *dbg)
5041 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5042 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5043 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
5046 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
5047 value. */
5049 inline bool
5050 gimple_debug_bind_has_value_p (gimple *dbg)
5052 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5053 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5054 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
5057 #undef GIMPLE_DEBUG_BIND_NOVALUE
5059 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
5061 inline bool
5062 gimple_debug_source_bind_p (const gimple *s)
5064 if (is_gimple_debug (s))
5065 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
5067 return false;
5070 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
5072 inline tree
5073 gimple_debug_source_bind_get_var (const gimple *dbg)
5075 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5076 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5077 return gimple_op (dbg, 0);
5080 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
5081 statement. */
5083 inline tree
5084 gimple_debug_source_bind_get_value (const gimple *dbg)
5086 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5087 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5088 return gimple_op (dbg, 1);
5091 /* Return a pointer to the value bound to the variable in a
5092 GIMPLE_DEBUG source bind statement. */
5094 inline tree *
5095 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
5097 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5098 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5099 return gimple_op_ptr (dbg, 1);
5102 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
5104 inline void
5105 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
5107 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5108 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5109 gimple_set_op (dbg, 0, var);
5112 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5113 statement. */
5115 inline void
5116 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
5118 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5119 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5120 gimple_set_op (dbg, 1, value);
5123 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5125 inline bool
5126 gimple_debug_begin_stmt_p (const gimple *s)
5128 if (is_gimple_debug (s))
5129 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
5131 return false;
5134 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5136 inline bool
5137 gimple_debug_inline_entry_p (const gimple *s)
5139 if (is_gimple_debug (s))
5140 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5142 return false;
5145 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5147 inline bool
5148 gimple_debug_nonbind_marker_p (const gimple *s)
5150 if (is_gimple_debug (s))
5151 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5152 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5154 return false;
5157 /* Return the line number for EXPR, or return -1 if we have no line
5158 number information for it. */
5159 inline int
5160 get_lineno (const gimple *stmt)
5162 location_t loc;
5164 if (!stmt)
5165 return -1;
5167 loc = gimple_location (stmt);
5168 if (loc == UNKNOWN_LOCATION)
5169 return -1;
5171 return LOCATION_LINE (loc);
5174 /* Return a pointer to the body for the OMP statement GS. */
5176 inline gimple_seq *
5177 gimple_omp_body_ptr (gimple *gs)
5179 return &static_cast <gimple_statement_omp *> (gs)->body;
5182 /* Return the body for the OMP statement GS. */
5184 inline gimple_seq
5185 gimple_omp_body (const gimple *gs)
5187 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
5190 /* Set BODY to be the body for the OMP statement GS. */
5192 inline void
5193 gimple_omp_set_body (gimple *gs, gimple_seq body)
5195 static_cast <gimple_statement_omp *> (gs)->body = body;
5199 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5201 inline tree
5202 gimple_omp_critical_name (const gomp_critical *crit_stmt)
5204 return crit_stmt->name;
5208 /* Return a pointer to the name associated with OMP critical statement
5209 CRIT_STMT. */
5211 inline tree *
5212 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5214 return &crit_stmt->name;
5218 /* Set NAME to be the name associated with OMP critical statement
5219 CRIT_STMT. */
5221 inline void
5222 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5224 crit_stmt->name = name;
5228 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5230 inline tree
5231 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5233 return crit_stmt->clauses;
5237 /* Return a pointer to the clauses associated with OMP critical statement
5238 CRIT_STMT. */
5240 inline tree *
5241 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5243 return &crit_stmt->clauses;
5247 /* Set CLAUSES to be the clauses associated with OMP critical statement
5248 CRIT_STMT. */
5250 inline void
5251 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5253 crit_stmt->clauses = clauses;
5257 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5259 inline tree
5260 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5262 return ord_stmt->clauses;
5266 /* Return a pointer to the clauses associated with OMP ordered statement
5267 ORD_STMT. */
5269 inline tree *
5270 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5272 return &ord_stmt->clauses;
5276 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5277 ORD_STMT. */
5279 inline void
5280 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5282 ord_stmt->clauses = clauses;
5286 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5288 inline tree
5289 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5291 return scan_stmt->clauses;
5295 /* Return a pointer to the clauses associated with OMP scan statement
5296 ORD_STMT. */
5298 inline tree *
5299 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5301 return &scan_stmt->clauses;
5305 /* Set CLAUSES to be the clauses associated with OMP scan statement
5306 ORD_STMT. */
5308 inline void
5309 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5311 scan_stmt->clauses = clauses;
5315 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5317 inline tree
5318 gimple_omp_taskgroup_clauses (const gimple *gs)
5320 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5321 return
5322 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5326 /* Return a pointer to the clauses associated with OMP taskgroup statement
5327 GS. */
5329 inline tree *
5330 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5332 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5333 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5337 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5338 GS. */
5340 inline void
5341 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5343 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5344 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5345 = clauses;
5349 /* Return the clauses associated with OMP_MASKED statement GS. */
5351 inline tree
5352 gimple_omp_masked_clauses (const gimple *gs)
5354 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5355 return
5356 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5360 /* Return a pointer to the clauses associated with OMP masked statement
5361 GS. */
5363 inline tree *
5364 gimple_omp_masked_clauses_ptr (gimple *gs)
5366 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5367 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5371 /* Set CLAUSES to be the clauses associated with OMP masked statement
5372 GS. */
5374 inline void
5375 gimple_omp_masked_set_clauses (gimple *gs, tree clauses)
5377 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5378 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5379 = clauses;
5383 /* Return the clauses associated with OMP_SCOPE statement GS. */
5385 inline tree
5386 gimple_omp_scope_clauses (const gimple *gs)
5388 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5389 return
5390 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5394 /* Return a pointer to the clauses associated with OMP scope statement
5395 GS. */
5397 inline tree *
5398 gimple_omp_scope_clauses_ptr (gimple *gs)
5400 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5401 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5405 /* Set CLAUSES to be the clauses associated with OMP scope statement
5406 GS. */
5408 inline void
5409 gimple_omp_scope_set_clauses (gimple *gs, tree clauses)
5411 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5412 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5413 = clauses;
5417 /* Return the kind of the OMP_FOR statemement G. */
5419 inline int
5420 gimple_omp_for_kind (const gimple *g)
5422 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5423 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5427 /* Set the kind of the OMP_FOR statement G. */
5429 inline void
5430 gimple_omp_for_set_kind (gomp_for *g, int kind)
5432 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5433 | (kind & GF_OMP_FOR_KIND_MASK);
5437 /* Return true if OMP_FOR statement G has the
5438 GF_OMP_FOR_COMBINED flag set. */
5440 inline bool
5441 gimple_omp_for_combined_p (const gimple *g)
5443 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5444 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5448 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5449 the boolean value of COMBINED_P. */
5451 inline void
5452 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5454 if (combined_p)
5455 g->subcode |= GF_OMP_FOR_COMBINED;
5456 else
5457 g->subcode &= ~GF_OMP_FOR_COMBINED;
5461 /* Return true if the OMP_FOR statement G has the
5462 GF_OMP_FOR_COMBINED_INTO flag set. */
5464 inline bool
5465 gimple_omp_for_combined_into_p (const gimple *g)
5467 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5468 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5472 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5473 on the boolean value of COMBINED_P. */
5475 inline void
5476 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5478 if (combined_p)
5479 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5480 else
5481 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5485 /* Return the clauses associated with the OMP_FOR statement GS. */
5487 inline tree
5488 gimple_omp_for_clauses (const gimple *gs)
5490 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5491 return omp_for_stmt->clauses;
5495 /* Return a pointer to the clauses associated with the OMP_FOR statement
5496 GS. */
5498 inline tree *
5499 gimple_omp_for_clauses_ptr (gimple *gs)
5501 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5502 return &omp_for_stmt->clauses;
5506 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5507 GS. */
5509 inline void
5510 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5512 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5513 omp_for_stmt->clauses = clauses;
5517 /* Get the collapse count of the OMP_FOR statement GS. */
5519 inline size_t
5520 gimple_omp_for_collapse (const gimple *gs)
5522 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5523 return omp_for_stmt->collapse;
5527 /* Return the condition code associated with the OMP_FOR statement GS. */
5529 inline enum tree_code
5530 gimple_omp_for_cond (const gimple *gs, size_t i)
5532 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5533 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5534 return omp_for_stmt->iter[i].cond;
5538 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5540 inline void
5541 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5543 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5544 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5545 && i < omp_for_stmt->collapse);
5546 omp_for_stmt->iter[i].cond = cond;
5550 /* Return the index variable for the OMP_FOR statement GS. */
5552 inline tree
5553 gimple_omp_for_index (const gimple *gs, size_t i)
5555 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5556 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5557 return omp_for_stmt->iter[i].index;
5561 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5563 inline tree *
5564 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5566 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5567 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5568 return &omp_for_stmt->iter[i].index;
5572 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5574 inline void
5575 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5577 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5578 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5579 omp_for_stmt->iter[i].index = index;
5583 /* Return the initial value for the OMP_FOR statement GS. */
5585 inline tree
5586 gimple_omp_for_initial (const gimple *gs, size_t i)
5588 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5589 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5590 return omp_for_stmt->iter[i].initial;
5594 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5596 inline tree *
5597 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5599 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5600 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5601 return &omp_for_stmt->iter[i].initial;
5605 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5607 inline void
5608 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5610 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5611 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5612 omp_for_stmt->iter[i].initial = initial;
5616 /* Return the final value for the OMP_FOR statement GS. */
5618 inline tree
5619 gimple_omp_for_final (const gimple *gs, size_t i)
5621 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5622 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5623 return omp_for_stmt->iter[i].final;
5627 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5629 inline tree *
5630 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5632 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5633 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5634 return &omp_for_stmt->iter[i].final;
5638 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5640 inline void
5641 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5643 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5644 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5645 omp_for_stmt->iter[i].final = final;
5649 /* Return the increment value for the OMP_FOR statement GS. */
5651 inline tree
5652 gimple_omp_for_incr (const gimple *gs, size_t i)
5654 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5655 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5656 return omp_for_stmt->iter[i].incr;
5660 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5662 inline tree *
5663 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5665 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5666 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5667 return &omp_for_stmt->iter[i].incr;
5671 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5673 inline void
5674 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5676 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5677 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5678 omp_for_stmt->iter[i].incr = incr;
5682 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5683 statement GS starts. */
5685 inline gimple_seq *
5686 gimple_omp_for_pre_body_ptr (gimple *gs)
5688 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5689 return &omp_for_stmt->pre_body;
5693 /* Return the sequence of statements to execute before the OMP_FOR
5694 statement GS starts. */
5696 inline gimple_seq
5697 gimple_omp_for_pre_body (const gimple *gs)
5699 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5703 /* Set PRE_BODY to be the sequence of statements to execute before the
5704 OMP_FOR statement GS starts. */
5706 inline void
5707 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5709 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5710 omp_for_stmt->pre_body = pre_body;
5713 /* Return the clauses associated with OMP_PARALLEL GS. */
5715 inline tree
5716 gimple_omp_parallel_clauses (const gimple *gs)
5718 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5719 return omp_parallel_stmt->clauses;
5723 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5725 inline tree *
5726 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5728 return &omp_parallel_stmt->clauses;
5732 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5734 inline void
5735 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5736 tree clauses)
5738 omp_parallel_stmt->clauses = clauses;
5742 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5744 inline tree
5745 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5747 return omp_parallel_stmt->child_fn;
5750 /* Return a pointer to the child function used to hold the body of
5751 OMP_PARALLEL_STMT. */
5753 inline tree *
5754 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5756 return &omp_parallel_stmt->child_fn;
5760 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5762 inline void
5763 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5764 tree child_fn)
5766 omp_parallel_stmt->child_fn = child_fn;
5770 /* Return the artificial argument used to send variables and values
5771 from the parent to the children threads in OMP_PARALLEL_STMT. */
5773 inline tree
5774 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5776 return omp_parallel_stmt->data_arg;
5780 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5782 inline tree *
5783 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5785 return &omp_parallel_stmt->data_arg;
5789 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5791 inline void
5792 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5793 tree data_arg)
5795 omp_parallel_stmt->data_arg = data_arg;
5798 /* Return the clauses associated with OMP_TASK GS. */
5800 inline tree
5801 gimple_omp_task_clauses (const gimple *gs)
5803 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5804 return omp_task_stmt->clauses;
5808 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5810 inline tree *
5811 gimple_omp_task_clauses_ptr (gimple *gs)
5813 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5814 return &omp_task_stmt->clauses;
5818 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5819 GS. */
5821 inline void
5822 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5824 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5825 omp_task_stmt->clauses = clauses;
5829 /* Return true if OMP task statement G has the
5830 GF_OMP_TASK_TASKLOOP flag set. */
5832 inline bool
5833 gimple_omp_task_taskloop_p (const gimple *g)
5835 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5836 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5840 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5841 value of TASKLOOP_P. */
5843 inline void
5844 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5846 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5847 if (taskloop_p)
5848 g->subcode |= GF_OMP_TASK_TASKLOOP;
5849 else
5850 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5854 /* Return true if OMP task statement G has the
5855 GF_OMP_TASK_TASKWAIT flag set. */
5857 inline bool
5858 gimple_omp_task_taskwait_p (const gimple *g)
5860 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5861 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5865 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5866 value of TASKWAIT_P. */
5868 inline void
5869 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5871 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5872 if (taskwait_p)
5873 g->subcode |= GF_OMP_TASK_TASKWAIT;
5874 else
5875 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5879 /* Return the child function used to hold the body of OMP_TASK GS. */
5881 inline tree
5882 gimple_omp_task_child_fn (const gimple *gs)
5884 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5885 return omp_task_stmt->child_fn;
5888 /* Return a pointer to the child function used to hold the body of
5889 OMP_TASK GS. */
5891 inline tree *
5892 gimple_omp_task_child_fn_ptr (gimple *gs)
5894 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5895 return &omp_task_stmt->child_fn;
5899 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5901 inline void
5902 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5904 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5905 omp_task_stmt->child_fn = child_fn;
5909 /* Return the artificial argument used to send variables and values
5910 from the parent to the children threads in OMP_TASK GS. */
5912 inline tree
5913 gimple_omp_task_data_arg (const gimple *gs)
5915 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5916 return omp_task_stmt->data_arg;
5920 /* Return a pointer to the data argument for OMP_TASK GS. */
5922 inline tree *
5923 gimple_omp_task_data_arg_ptr (gimple *gs)
5925 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5926 return &omp_task_stmt->data_arg;
5930 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5932 inline void
5933 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5935 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5936 omp_task_stmt->data_arg = data_arg;
5940 /* Return the clauses associated with OMP_TASK GS. */
5942 inline tree
5943 gimple_omp_taskreg_clauses (const gimple *gs)
5945 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5946 = as_a <const gimple_statement_omp_taskreg *> (gs);
5947 return omp_taskreg_stmt->clauses;
5951 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5953 inline tree *
5954 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5956 gimple_statement_omp_taskreg *omp_taskreg_stmt
5957 = as_a <gimple_statement_omp_taskreg *> (gs);
5958 return &omp_taskreg_stmt->clauses;
5962 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5963 GS. */
5965 inline void
5966 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5968 gimple_statement_omp_taskreg *omp_taskreg_stmt
5969 = as_a <gimple_statement_omp_taskreg *> (gs);
5970 omp_taskreg_stmt->clauses = clauses;
5974 /* Return the child function used to hold the body of OMP_TASK GS. */
5976 inline tree
5977 gimple_omp_taskreg_child_fn (const gimple *gs)
5979 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5980 = as_a <const gimple_statement_omp_taskreg *> (gs);
5981 return omp_taskreg_stmt->child_fn;
5984 /* Return a pointer to the child function used to hold the body of
5985 OMP_TASK GS. */
5987 inline tree *
5988 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5990 gimple_statement_omp_taskreg *omp_taskreg_stmt
5991 = as_a <gimple_statement_omp_taskreg *> (gs);
5992 return &omp_taskreg_stmt->child_fn;
5996 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5998 inline void
5999 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
6001 gimple_statement_omp_taskreg *omp_taskreg_stmt
6002 = as_a <gimple_statement_omp_taskreg *> (gs);
6003 omp_taskreg_stmt->child_fn = child_fn;
6007 /* Return the artificial argument used to send variables and values
6008 from the parent to the children threads in OMP_TASK GS. */
6010 inline tree
6011 gimple_omp_taskreg_data_arg (const gimple *gs)
6013 const gimple_statement_omp_taskreg *omp_taskreg_stmt
6014 = as_a <const gimple_statement_omp_taskreg *> (gs);
6015 return omp_taskreg_stmt->data_arg;
6019 /* Return a pointer to the data argument for OMP_TASK GS. */
6021 inline tree *
6022 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
6024 gimple_statement_omp_taskreg *omp_taskreg_stmt
6025 = as_a <gimple_statement_omp_taskreg *> (gs);
6026 return &omp_taskreg_stmt->data_arg;
6030 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
6032 inline void
6033 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
6035 gimple_statement_omp_taskreg *omp_taskreg_stmt
6036 = as_a <gimple_statement_omp_taskreg *> (gs);
6037 omp_taskreg_stmt->data_arg = data_arg;
6041 /* Return the copy function used to hold the body of OMP_TASK GS. */
6043 inline tree
6044 gimple_omp_task_copy_fn (const gimple *gs)
6046 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6047 return omp_task_stmt->copy_fn;
6050 /* Return a pointer to the copy function used to hold the body of
6051 OMP_TASK GS. */
6053 inline tree *
6054 gimple_omp_task_copy_fn_ptr (gimple *gs)
6056 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6057 return &omp_task_stmt->copy_fn;
6061 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
6063 inline void
6064 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
6066 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6067 omp_task_stmt->copy_fn = copy_fn;
6071 /* Return size of the data block in bytes in OMP_TASK GS. */
6073 inline tree
6074 gimple_omp_task_arg_size (const gimple *gs)
6076 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6077 return omp_task_stmt->arg_size;
6081 /* Return a pointer to the data block size for OMP_TASK GS. */
6083 inline tree *
6084 gimple_omp_task_arg_size_ptr (gimple *gs)
6086 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6087 return &omp_task_stmt->arg_size;
6091 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
6093 inline void
6094 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
6096 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6097 omp_task_stmt->arg_size = arg_size;
6101 /* Return align of the data block in bytes in OMP_TASK GS. */
6103 inline tree
6104 gimple_omp_task_arg_align (const gimple *gs)
6106 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6107 return omp_task_stmt->arg_align;
6111 /* Return a pointer to the data block align for OMP_TASK GS. */
6113 inline tree *
6114 gimple_omp_task_arg_align_ptr (gimple *gs)
6116 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6117 return &omp_task_stmt->arg_align;
6121 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
6123 inline void
6124 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
6126 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6127 omp_task_stmt->arg_align = arg_align;
6131 /* Return the clauses associated with OMP_SINGLE GS. */
6133 inline tree
6134 gimple_omp_single_clauses (const gimple *gs)
6136 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
6137 return omp_single_stmt->clauses;
6141 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
6143 inline tree *
6144 gimple_omp_single_clauses_ptr (gimple *gs)
6146 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
6147 return &omp_single_stmt->clauses;
6151 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
6153 inline void
6154 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
6156 omp_single_stmt->clauses = clauses;
6160 /* Return the clauses associated with OMP_TARGET GS. */
6162 inline tree
6163 gimple_omp_target_clauses (const gimple *gs)
6165 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
6166 return omp_target_stmt->clauses;
6170 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
6172 inline tree *
6173 gimple_omp_target_clauses_ptr (gimple *gs)
6175 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
6176 return &omp_target_stmt->clauses;
6180 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6182 inline void
6183 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
6184 tree clauses)
6186 omp_target_stmt->clauses = clauses;
6190 /* Return the kind of the OMP_TARGET G. */
6192 inline int
6193 gimple_omp_target_kind (const gimple *g)
6195 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
6196 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
6200 /* Set the kind of the OMP_TARGET G. */
6202 inline void
6203 gimple_omp_target_set_kind (gomp_target *g, int kind)
6205 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6206 | (kind & GF_OMP_TARGET_KIND_MASK);
6210 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6212 inline tree
6213 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6215 return omp_target_stmt->child_fn;
6218 /* Return a pointer to the child function used to hold the body of
6219 OMP_TARGET_STMT. */
6221 inline tree *
6222 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6224 return &omp_target_stmt->child_fn;
6228 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6230 inline void
6231 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6232 tree child_fn)
6234 omp_target_stmt->child_fn = child_fn;
6238 /* Return the artificial argument used to send variables and values
6239 from the parent to the children threads in OMP_TARGET_STMT. */
6241 inline tree
6242 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6244 return omp_target_stmt->data_arg;
6248 /* Return a pointer to the data argument for OMP_TARGET GS. */
6250 inline tree *
6251 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6253 return &omp_target_stmt->data_arg;
6257 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6259 inline void
6260 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6261 tree data_arg)
6263 omp_target_stmt->data_arg = data_arg;
6267 /* Return the clauses associated with OMP_TEAMS GS. */
6269 inline tree
6270 gimple_omp_teams_clauses (const gimple *gs)
6272 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6273 return omp_teams_stmt->clauses;
6277 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6279 inline tree *
6280 gimple_omp_teams_clauses_ptr (gimple *gs)
6282 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6283 return &omp_teams_stmt->clauses;
6287 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6289 inline void
6290 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6292 omp_teams_stmt->clauses = clauses;
6295 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6297 inline tree
6298 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6300 return omp_teams_stmt->child_fn;
6303 /* Return a pointer to the child function used to hold the body of
6304 OMP_TEAMS_STMT. */
6306 inline tree *
6307 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6309 return &omp_teams_stmt->child_fn;
6313 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6315 inline void
6316 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6318 omp_teams_stmt->child_fn = child_fn;
6322 /* Return the artificial argument used to send variables and values
6323 from the parent to the children threads in OMP_TEAMS_STMT. */
6325 inline tree
6326 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6328 return omp_teams_stmt->data_arg;
6332 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6334 inline tree *
6335 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6337 return &omp_teams_stmt->data_arg;
6341 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6343 inline void
6344 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6346 omp_teams_stmt->data_arg = data_arg;
6349 /* Return the host flag of an OMP_TEAMS_STMT. */
6351 inline bool
6352 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6354 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6357 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6359 inline void
6360 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6362 if (value)
6363 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6364 else
6365 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6368 /* Return the clauses associated with OMP_SECTIONS GS. */
6370 inline tree
6371 gimple_omp_sections_clauses (const gimple *gs)
6373 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6374 return omp_sections_stmt->clauses;
6378 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6380 inline tree *
6381 gimple_omp_sections_clauses_ptr (gimple *gs)
6383 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6384 return &omp_sections_stmt->clauses;
6388 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6389 GS. */
6391 inline void
6392 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6394 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6395 omp_sections_stmt->clauses = clauses;
6399 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6400 in GS. */
6402 inline tree
6403 gimple_omp_sections_control (const gimple *gs)
6405 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6406 return omp_sections_stmt->control;
6410 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6411 GS. */
6413 inline tree *
6414 gimple_omp_sections_control_ptr (gimple *gs)
6416 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6417 return &omp_sections_stmt->control;
6421 /* Set CONTROL to be the set of clauses associated with the
6422 GIMPLE_OMP_SECTIONS in GS. */
6424 inline void
6425 gimple_omp_sections_set_control (gimple *gs, tree control)
6427 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6428 omp_sections_stmt->control = control;
6432 /* Set the value being stored in an atomic store. */
6434 inline void
6435 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6437 store_stmt->val = val;
6441 /* Return the value being stored in an atomic store. */
6443 inline tree
6444 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6446 return store_stmt->val;
6450 /* Return a pointer to the value being stored in an atomic store. */
6452 inline tree *
6453 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6455 return &store_stmt->val;
6459 /* Set the LHS of an atomic load. */
6461 inline void
6462 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6464 load_stmt->lhs = lhs;
6468 /* Get the LHS of an atomic load. */
6470 inline tree
6471 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6473 return load_stmt->lhs;
6477 /* Return a pointer to the LHS of an atomic load. */
6479 inline tree *
6480 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6482 return &load_stmt->lhs;
6486 /* Set the RHS of an atomic load. */
6488 inline void
6489 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6491 load_stmt->rhs = rhs;
6495 /* Get the RHS of an atomic load. */
6497 inline tree
6498 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6500 return load_stmt->rhs;
6504 /* Return a pointer to the RHS of an atomic load. */
6506 inline tree *
6507 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6509 return &load_stmt->rhs;
6513 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6515 inline tree
6516 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6518 return cont_stmt->control_def;
6521 /* The same as above, but return the address. */
6523 inline tree *
6524 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6526 return &cont_stmt->control_def;
6529 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6531 inline void
6532 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6534 cont_stmt->control_def = def;
6538 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6540 inline tree
6541 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6543 return cont_stmt->control_use;
6547 /* The same as above, but return the address. */
6549 inline tree *
6550 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6552 return &cont_stmt->control_use;
6556 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6558 inline void
6559 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6561 cont_stmt->control_use = use;
6564 /* Return the guard associated with the GIMPLE_ASSUME statement GS. */
6566 inline tree
6567 gimple_assume_guard (const gimple *gs)
6569 const gimple_statement_assume *assume_stmt
6570 = as_a <const gimple_statement_assume *> (gs);
6571 return assume_stmt->guard;
6574 /* Set the guard associated with the GIMPLE_ASSUME statement GS. */
6576 inline void
6577 gimple_assume_set_guard (gimple *gs, tree guard)
6579 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (gs);
6580 assume_stmt->guard = guard;
6583 inline tree *
6584 gimple_assume_guard_ptr (gimple *gs)
6586 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (gs);
6587 return &assume_stmt->guard;
6590 /* Return the address of the GIMPLE sequence contained in the GIMPLE_ASSUME
6591 statement GS. */
6593 inline gimple_seq *
6594 gimple_assume_body_ptr (gimple *gs)
6596 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (gs);
6597 return &assume_stmt->body;
6600 /* Return the GIMPLE sequence contained in the GIMPLE_ASSUME statement GS. */
6602 inline gimple_seq
6603 gimple_assume_body (const gimple *gs)
6605 const gimple_statement_assume *assume_stmt
6606 = as_a <const gimple_statement_assume *> (gs);
6607 return assume_stmt->body;
6610 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6611 TRANSACTION_STMT. */
6613 inline gimple_seq *
6614 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6616 return &transaction_stmt->body;
6619 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6621 inline gimple_seq
6622 gimple_transaction_body (const gtransaction *transaction_stmt)
6624 return transaction_stmt->body;
6627 /* Return the label associated with a GIMPLE_TRANSACTION. */
6629 inline tree
6630 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6632 return transaction_stmt->label_norm;
6635 inline tree *
6636 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6638 return &transaction_stmt->label_norm;
6641 inline tree
6642 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6644 return transaction_stmt->label_uninst;
6647 inline tree *
6648 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6650 return &transaction_stmt->label_uninst;
6653 inline tree
6654 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6656 return transaction_stmt->label_over;
6659 inline tree *
6660 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6662 return &transaction_stmt->label_over;
6665 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6667 inline unsigned int
6668 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6670 return transaction_stmt->subcode;
6673 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6674 TRANSACTION_STMT. */
6676 inline void
6677 gimple_transaction_set_body (gtransaction *transaction_stmt,
6678 gimple_seq body)
6680 transaction_stmt->body = body;
6683 /* Set the label associated with a GIMPLE_TRANSACTION. */
6685 inline void
6686 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6688 transaction_stmt->label_norm = label;
6691 inline void
6692 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6694 transaction_stmt->label_uninst = label;
6697 inline void
6698 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6700 transaction_stmt->label_over = label;
6703 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6705 inline void
6706 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6707 unsigned int subcode)
6709 transaction_stmt->subcode = subcode;
6712 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6714 inline tree *
6715 gimple_return_retval_ptr (greturn *gs)
6717 return &gs->op[0];
6720 /* Return the return value for GIMPLE_RETURN GS. */
6722 inline tree
6723 gimple_return_retval (const greturn *gs)
6725 return gs->op[0];
6729 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6731 inline void
6732 gimple_return_set_retval (greturn *gs, tree retval)
6734 gs->op[0] = retval;
6738 /* Returns true when the gimple statement STMT is any of the OMP types. */
6740 #define CASE_GIMPLE_OMP \
6741 case GIMPLE_OMP_PARALLEL: \
6742 case GIMPLE_OMP_TASK: \
6743 case GIMPLE_OMP_FOR: \
6744 case GIMPLE_OMP_SECTIONS: \
6745 case GIMPLE_OMP_SECTIONS_SWITCH: \
6746 case GIMPLE_OMP_SINGLE: \
6747 case GIMPLE_OMP_TARGET: \
6748 case GIMPLE_OMP_TEAMS: \
6749 case GIMPLE_OMP_SCOPE: \
6750 case GIMPLE_OMP_SECTION: \
6751 case GIMPLE_OMP_STRUCTURED_BLOCK: \
6752 case GIMPLE_OMP_MASTER: \
6753 case GIMPLE_OMP_MASKED: \
6754 case GIMPLE_OMP_TASKGROUP: \
6755 case GIMPLE_OMP_ORDERED: \
6756 case GIMPLE_OMP_CRITICAL: \
6757 case GIMPLE_OMP_SCAN: \
6758 case GIMPLE_OMP_RETURN: \
6759 case GIMPLE_OMP_ATOMIC_LOAD: \
6760 case GIMPLE_OMP_ATOMIC_STORE: \
6761 case GIMPLE_OMP_CONTINUE
6763 inline bool
6764 is_gimple_omp (const gimple *stmt)
6766 switch (gimple_code (stmt))
6768 CASE_GIMPLE_OMP:
6769 return true;
6770 default:
6771 return false;
6775 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6776 specifically. */
6778 inline bool
6779 is_gimple_omp_oacc (const gimple *stmt)
6781 gcc_assert (is_gimple_omp (stmt));
6782 switch (gimple_code (stmt))
6784 case GIMPLE_OMP_ATOMIC_LOAD:
6785 case GIMPLE_OMP_ATOMIC_STORE:
6786 case GIMPLE_OMP_CONTINUE:
6787 case GIMPLE_OMP_RETURN:
6788 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6789 the two. */
6790 gcc_unreachable ();
6792 case GIMPLE_OMP_FOR:
6793 switch (gimple_omp_for_kind (stmt))
6795 case GF_OMP_FOR_KIND_OACC_LOOP:
6796 return true;
6797 default:
6798 return false;
6800 case GIMPLE_OMP_TARGET:
6801 switch (gimple_omp_target_kind (stmt))
6803 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6804 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6805 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6806 case GF_OMP_TARGET_KIND_OACC_DATA:
6807 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6808 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
6809 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
6810 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6811 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6812 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6813 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6814 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS:
6815 return true;
6816 default:
6817 return false;
6819 default:
6820 return false;
6825 /* Return true if the OMP gimple statement STMT is offloaded. */
6827 inline bool
6828 is_gimple_omp_offloaded (const gimple *stmt)
6830 gcc_assert (is_gimple_omp (stmt));
6831 switch (gimple_code (stmt))
6833 case GIMPLE_OMP_TARGET:
6834 switch (gimple_omp_target_kind (stmt))
6836 case GF_OMP_TARGET_KIND_REGION:
6837 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6838 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6839 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6840 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6841 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6842 return true;
6843 default:
6844 return false;
6846 default:
6847 return false;
6852 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6854 inline bool
6855 gimple_nop_p (const gimple *g)
6857 return gimple_code (g) == GIMPLE_NOP;
6861 /* Return true if GS is a GIMPLE_RESX. */
6863 inline bool
6864 is_gimple_resx (const gimple *gs)
6866 return gimple_code (gs) == GIMPLE_RESX;
6870 /* Enum and arrays used for allocation stats. Keep in sync with
6871 gimple.cc:gimple_alloc_kind_names. */
6872 enum gimple_alloc_kind
6874 gimple_alloc_kind_assign, /* Assignments. */
6875 gimple_alloc_kind_phi, /* PHI nodes. */
6876 gimple_alloc_kind_cond, /* Conditionals. */
6877 gimple_alloc_kind_rest, /* Everything else. */
6878 gimple_alloc_kind_all
6881 extern uint64_t gimple_alloc_counts[];
6882 extern uint64_t gimple_alloc_sizes[];
6884 /* Return the allocation kind for a given stmt CODE. */
6885 inline enum gimple_alloc_kind
6886 gimple_alloc_kind (enum gimple_code code)
6888 switch (code)
6890 case GIMPLE_ASSIGN:
6891 return gimple_alloc_kind_assign;
6892 case GIMPLE_PHI:
6893 return gimple_alloc_kind_phi;
6894 case GIMPLE_COND:
6895 return gimple_alloc_kind_cond;
6896 default:
6897 return gimple_alloc_kind_rest;
6901 /* Return true if a location should not be emitted for this statement
6902 by annotate_all_with_location. */
6904 inline bool
6905 gimple_do_not_emit_location_p (gimple *g)
6907 return gimple_plf (g, GF_PLF_1);
6910 /* Mark statement G so a location will not be emitted by
6911 annotate_one_with_location. */
6913 inline void
6914 gimple_set_do_not_emit_location (gimple *g)
6916 /* The PLF flags are initialized to 0 when a new tuple is created,
6917 so no need to initialize it anywhere. */
6918 gimple_set_plf (g, GF_PLF_1, true);
6921 #endif /* GCC_GIMPLE_H */