libstdc++: Simplify std::any to fix -Wdeprecated-declarations warning
[official-gcc.git] / gcc / gimple.h
blobee986eaf15397522efcd6ca0c73af0c02d97ff8f
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2024 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_BASIC = 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_CALL_XTHROW = 1 << 13,
154 GF_OMP_PARALLEL_COMBINED = 1 << 0,
155 GF_OMP_TASK_TASKLOOP = 1 << 0,
156 GF_OMP_TASK_TASKWAIT = 1 << 1,
157 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
158 GF_OMP_FOR_KIND_FOR = 0,
159 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
160 GF_OMP_FOR_KIND_TASKLOOP = 2,
161 GF_OMP_FOR_KIND_OACC_LOOP = 4,
162 GF_OMP_FOR_KIND_SIMD = 5,
163 GF_OMP_FOR_COMBINED = 1 << 3,
164 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
165 GF_OMP_TARGET_KIND_MASK = (1 << 5) - 1,
166 GF_OMP_TARGET_KIND_REGION = 0,
167 GF_OMP_TARGET_KIND_DATA = 1,
168 GF_OMP_TARGET_KIND_UPDATE = 2,
169 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
170 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
171 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
172 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
173 GF_OMP_TARGET_KIND_OACC_SERIAL = 7,
174 GF_OMP_TARGET_KIND_OACC_DATA = 8,
175 GF_OMP_TARGET_KIND_OACC_UPDATE = 9,
176 GF_OMP_TARGET_KIND_OACC_ENTER_DATA = 10,
177 GF_OMP_TARGET_KIND_OACC_EXIT_DATA = 11,
178 GF_OMP_TARGET_KIND_OACC_DECLARE = 12,
179 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 13,
180 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
181 decomposed part, parallelized. */
182 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED = 14,
183 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
184 decomposed part, "gang-single". */
185 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE = 15,
186 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
187 decomposed parts' 'data' construct. */
188 GF_OMP_TARGET_KIND_OACC_DATA_KERNELS = 16,
189 GF_OMP_TEAMS_HOST = 1 << 0,
191 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
192 a thread synchronization via some sort of barrier. The exact barrier
193 that would otherwise be emitted is dependent on the OMP statement with
194 which this return is associated. */
195 GF_OMP_RETURN_NOWAIT = 1 << 0,
197 GF_OMP_SECTION_LAST = 1 << 0,
198 GF_OMP_ORDERED_STANDALONE = 1 << 0,
199 GF_OMP_ATOMIC_MEMORY_ORDER = (1 << 6) - 1,
200 GF_OMP_ATOMIC_NEED_VALUE = 1 << 6,
201 GF_OMP_ATOMIC_WEAK = 1 << 7,
202 GF_PREDICT_TAKEN = 1 << 15
205 /* This subcode tells apart different kinds of stmts that are not used
206 for codegen, but rather to retain debug information. */
207 enum gimple_debug_subcode {
208 GIMPLE_DEBUG_BIND = 0,
209 GIMPLE_DEBUG_SOURCE_BIND = 1,
210 GIMPLE_DEBUG_BEGIN_STMT = 2,
211 GIMPLE_DEBUG_INLINE_ENTRY = 3
214 /* Masks for selecting a pass local flag (PLF) to work on. These
215 masks are used by gimple_set_plf and gimple_plf. */
216 enum plf_mask {
217 GF_PLF_1 = 1 << 0,
218 GF_PLF_2 = 1 << 1
221 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
222 are for 64 bit hosts. */
224 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
225 chain_next ("%h.next"), variable_size))
226 gimple
228 /* [ WORD 1 ]
229 Main identifying code for a tuple. */
230 ENUM_BITFIELD(gimple_code) code : 8;
232 /* Nonzero if a warning should not be emitted on this tuple. */
233 unsigned int no_warning : 1;
235 /* Nonzero if this tuple has been visited. Passes are responsible
236 for clearing this bit before using it. */
237 unsigned int visited : 1;
239 /* Nonzero if this tuple represents a non-temporal move; currently
240 only stores are supported. */
241 unsigned int nontemporal_move : 1;
243 /* Pass local flags. These flags are free for any pass to use as
244 they see fit. Passes should not assume that these flags contain
245 any useful value when the pass starts. Any initial state that
246 the pass requires should be set on entry to the pass. See
247 gimple_set_plf and gimple_plf for usage. */
248 unsigned int plf : 2;
250 /* Nonzero if this statement has been modified and needs to have its
251 operands rescanned. */
252 unsigned modified : 1;
254 /* Nonzero if this statement contains volatile operands. */
255 unsigned has_volatile_ops : 1;
257 /* Padding to get subcode to 16 bit alignment. */
258 unsigned pad : 1;
260 /* The SUBCODE field can be used for tuple-specific flags for tuples
261 that do not require subcodes. Note that SUBCODE should be at
262 least as wide as tree codes, as several tuples store tree codes
263 in there. */
264 unsigned int subcode : 16;
266 /* UID of this statement. This is used by passes that want to
267 assign IDs to statements. It must be assigned and used by each
268 pass. By default it should be assumed to contain garbage. */
269 unsigned uid;
271 /* [ WORD 2 ]
272 Locus information for debug info. */
273 location_t location;
275 /* Number of operands in this tuple. */
276 unsigned num_ops;
278 /* [ WORD 3 ]
279 Basic block holding this statement. */
280 basic_block bb;
282 /* [ WORD 4-5 ]
283 Linked lists of gimple statements. The next pointers form
284 a NULL terminated list, the prev pointers are a cyclic list.
285 A gimple statement is hence also a double-ended list of
286 statements, with the pointer itself being the first element,
287 and the prev pointer being the last. */
288 gimple *next;
289 gimple *GTY((skip)) prev;
293 /* Base structure for tuples with operands. */
295 /* This gimple subclass has no tag value. */
296 struct GTY(())
297 gimple_statement_with_ops_base : public gimple
299 /* [ WORD 1-6 ] : base class */
301 /* [ WORD 7 ]
302 SSA operand vectors. NOTE: It should be possible to
303 amalgamate these vectors with the operand vector OP. However,
304 the SSA operand vectors are organized differently and contain
305 more information (like immediate use chaining). */
306 struct use_optype_d GTY((skip (""))) *use_ops;
310 /* Statements that take register operands. */
312 struct GTY((tag("GSS_WITH_OPS")))
313 gimple_statement_with_ops : public gimple_statement_with_ops_base
315 /* [ WORD 1-7 ] : base class */
317 /* [ WORD 8 ]
318 Operand vector. NOTE! This must always be the last field
319 of this structure. In particular, this means that this
320 structure cannot be embedded inside another one. */
321 tree GTY((length ("%h.num_ops"))) op[1];
325 /* Base for statements that take both memory and register operands. */
327 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
328 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
330 /* [ WORD 1-7 ] : base class */
332 /* [ WORD 8-9 ]
333 Virtual operands for this statement. The GC will pick them
334 up via the ssa_names array. */
335 tree GTY((skip (""))) vdef;
336 tree GTY((skip (""))) vuse;
340 /* Statements that take both memory and register operands. */
342 struct GTY((tag("GSS_WITH_MEM_OPS")))
343 gimple_statement_with_memory_ops :
344 public gimple_statement_with_memory_ops_base
346 /* [ WORD 1-9 ] : base class */
348 /* [ WORD 10 ]
349 Operand vector. NOTE! This must always be the last field
350 of this structure. In particular, this means that this
351 structure cannot be embedded inside another one. */
352 tree GTY((length ("%h.num_ops"))) op[1];
356 /* Call statements that take both memory and register operands. */
358 struct GTY((tag("GSS_CALL")))
359 gcall : public gimple_statement_with_memory_ops_base
361 /* [ WORD 1-9 ] : base class */
363 /* [ WORD 10-13 ] */
364 struct pt_solution call_used;
365 struct pt_solution call_clobbered;
367 /* [ WORD 14 ] */
368 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
369 tree GTY ((tag ("0"))) fntype;
370 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
371 } u;
373 /* [ WORD 15 ]
374 Operand vector. NOTE! This must always be the last field
375 of this structure. In particular, this means that this
376 structure cannot be embedded inside another one. */
377 tree GTY((length ("%h.num_ops"))) op[1];
379 static const enum gimple_code code_ = GIMPLE_CALL;
383 /* OMP statements. */
385 struct GTY((tag("GSS_OMP")))
386 gimple_statement_omp : public gimple
388 /* [ WORD 1-6 ] : base class */
390 /* [ WORD 7 ] */
391 gimple_seq body;
395 /* GIMPLE_BIND */
397 struct GTY((tag("GSS_BIND")))
398 gbind : public gimple
400 /* [ WORD 1-6 ] : base class */
402 /* [ WORD 7 ]
403 Variables declared in this scope. */
404 tree vars;
406 /* [ WORD 8 ]
407 This is different than the BLOCK field in gimple,
408 which is analogous to TREE_BLOCK (i.e., the lexical block holding
409 this statement). This field is the equivalent of BIND_EXPR_BLOCK
410 in tree land (i.e., the lexical scope defined by this bind). See
411 gimple-low.cc. */
412 tree block;
414 /* [ WORD 9 ] */
415 gimple_seq body;
419 /* GIMPLE_CATCH */
421 struct GTY((tag("GSS_CATCH")))
422 gcatch : public gimple
424 /* [ WORD 1-6 ] : base class */
426 /* [ WORD 7 ] */
427 tree types;
429 /* [ WORD 8 ] */
430 gimple_seq handler;
434 /* GIMPLE_EH_FILTER */
436 struct GTY((tag("GSS_EH_FILTER")))
437 geh_filter : public gimple
439 /* [ WORD 1-6 ] : base class */
441 /* [ WORD 7 ]
442 Filter types. */
443 tree types;
445 /* [ WORD 8 ]
446 Failure actions. */
447 gimple_seq failure;
450 /* GIMPLE_EH_ELSE */
452 struct GTY((tag("GSS_EH_ELSE")))
453 geh_else : public gimple
455 /* [ WORD 1-6 ] : base class */
457 /* [ WORD 7,8 ] */
458 gimple_seq n_body, e_body;
461 /* GIMPLE_EH_MUST_NOT_THROW */
463 struct GTY((tag("GSS_EH_MNT")))
464 geh_mnt : public gimple
466 /* [ WORD 1-6 ] : base class */
468 /* [ WORD 7 ] Abort function decl. */
469 tree fndecl;
472 /* GIMPLE_PHI */
474 struct GTY((tag("GSS_PHI")))
475 gphi : public gimple
477 /* [ WORD 1-6 ] : base class */
479 /* [ WORD 7 ] */
480 unsigned capacity;
481 unsigned nargs;
483 /* [ WORD 8 ] */
484 tree result;
486 /* [ WORD 9 ] */
487 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
491 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
493 struct GTY((tag("GSS_EH_CTRL")))
494 gimple_statement_eh_ctrl : public gimple
496 /* [ WORD 1-6 ] : base class */
498 /* [ WORD 7 ]
499 Exception region number. */
500 int region;
503 struct GTY((tag("GSS_EH_CTRL")))
504 gresx : public gimple_statement_eh_ctrl
506 /* No extra fields; adds invariant:
507 stmt->code == GIMPLE_RESX. */
510 struct GTY((tag("GSS_EH_CTRL")))
511 geh_dispatch : public gimple_statement_eh_ctrl
513 /* No extra fields; adds invariant:
514 stmt->code == GIMPLE_EH_DISPATH. */
518 /* GIMPLE_TRY */
520 struct GTY((tag("GSS_TRY")))
521 gtry : public gimple
523 /* [ WORD 1-6 ] : base class */
525 /* [ WORD 7 ]
526 Expression to evaluate. */
527 gimple_seq eval;
529 /* [ WORD 8 ]
530 Cleanup expression. */
531 gimple_seq cleanup;
534 /* Kind of GIMPLE_TRY statements. */
535 enum gimple_try_flags
537 /* A try/catch. */
538 GIMPLE_TRY_CATCH = 1 << 0,
540 /* A try/finally. */
541 GIMPLE_TRY_FINALLY = 1 << 1,
542 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
544 /* Analogous to TRY_CATCH_IS_CLEANUP. */
545 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
548 /* GIMPLE_WITH_CLEANUP_EXPR */
550 struct GTY((tag("GSS_WCE")))
551 gimple_statement_wce : public gimple
553 /* [ WORD 1-6 ] : base class */
555 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
556 executed if an exception is thrown, not on normal exit of its
557 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
558 in TARGET_EXPRs. */
560 /* [ WORD 7 ]
561 Cleanup expression. */
562 gimple_seq cleanup;
566 /* GIMPLE_ASM */
568 struct GTY((tag("GSS_ASM")))
569 gasm : public gimple_statement_with_memory_ops_base
571 /* [ WORD 1-9 ] : base class */
573 /* [ WORD 10 ]
574 __asm__ statement. */
575 const char *string;
577 /* [ WORD 11 ]
578 Number of inputs, outputs, clobbers, labels. */
579 unsigned char ni;
580 unsigned char no;
581 unsigned char nc;
582 unsigned char nl;
584 /* [ WORD 12 ]
585 Operand vector. NOTE! This must always be the last field
586 of this structure. In particular, this means that this
587 structure cannot be embedded inside another one. */
588 tree GTY((length ("%h.num_ops"))) op[1];
591 /* GIMPLE_OMP_CRITICAL */
593 struct GTY((tag("GSS_OMP_CRITICAL")))
594 gomp_critical : public gimple_statement_omp
596 /* [ WORD 1-7 ] : base class */
598 /* [ WORD 8 ] */
599 tree clauses;
601 /* [ WORD 9 ]
602 Critical section name. */
603 tree name;
607 struct GTY(()) gimple_omp_for_iter {
608 /* Condition code. */
609 enum tree_code cond;
611 /* Index variable. */
612 tree index;
614 /* Initial value. */
615 tree initial;
617 /* Final value. */
618 tree final;
620 /* Increment. */
621 tree incr;
624 /* GIMPLE_OMP_FOR */
626 struct GTY((tag("GSS_OMP_FOR")))
627 gomp_for : public gimple_statement_omp
629 /* [ WORD 1-7 ] : base class */
631 /* [ WORD 8 ] */
632 tree clauses;
634 /* [ WORD 9 ]
635 Number of elements in iter array. */
636 size_t collapse;
638 /* [ WORD 10 ] */
639 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
641 /* [ WORD 11 ]
642 Pre-body evaluated before the loop body begins. */
643 gimple_seq pre_body;
647 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
649 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
650 gimple_statement_omp_parallel_layout : public gimple_statement_omp
652 /* [ WORD 1-7 ] : base class */
654 /* [ WORD 8 ]
655 Clauses. */
656 tree clauses;
658 /* [ WORD 9 ]
659 Child function holding the body of the parallel region. */
660 tree child_fn;
662 /* [ WORD 10 ]
663 Shared data argument. */
664 tree data_arg;
667 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
668 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
669 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
671 /* No extra fields; adds invariant:
672 stmt->code == GIMPLE_OMP_PARALLEL
673 || stmt->code == GIMPLE_OMP_TASK
674 || stmt->code == GIMPLE_OMP_TEAMS. */
677 /* GIMPLE_OMP_PARALLEL */
678 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
679 gomp_parallel : public gimple_statement_omp_taskreg
681 /* No extra fields; adds invariant:
682 stmt->code == GIMPLE_OMP_PARALLEL. */
685 /* GIMPLE_OMP_TARGET */
686 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
687 gomp_target : public gimple_statement_omp_parallel_layout
689 /* No extra fields; adds invariant:
690 stmt->code == GIMPLE_OMP_TARGET. */
693 /* GIMPLE_OMP_TASK */
695 struct GTY((tag("GSS_OMP_TASK")))
696 gomp_task : public gimple_statement_omp_taskreg
698 /* [ WORD 1-10 ] : base class */
700 /* [ WORD 11 ]
701 Child function holding firstprivate initialization if needed. */
702 tree copy_fn;
704 /* [ WORD 12-13 ]
705 Size and alignment in bytes of the argument data block. */
706 tree arg_size;
707 tree arg_align;
711 /* GIMPLE_OMP_SECTION */
712 /* Uses struct gimple_statement_omp. */
715 /* GIMPLE_OMP_SECTIONS */
717 struct GTY((tag("GSS_OMP_SECTIONS")))
718 gomp_sections : public gimple_statement_omp
720 /* [ WORD 1-7 ] : base class */
722 /* [ WORD 8 ] */
723 tree clauses;
725 /* [ WORD 9 ]
726 The control variable used for deciding which of the sections to
727 execute. */
728 tree control;
731 /* GIMPLE_OMP_CONTINUE.
733 Note: This does not inherit from gimple_statement_omp, because we
734 do not need the body field. */
736 struct GTY((tag("GSS_OMP_CONTINUE")))
737 gomp_continue : public gimple
739 /* [ WORD 1-6 ] : base class */
741 /* [ WORD 7 ] */
742 tree control_def;
744 /* [ WORD 8 ] */
745 tree control_use;
748 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
749 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
751 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
752 gimple_statement_omp_single_layout : public gimple_statement_omp
754 /* [ WORD 1-7 ] : base class */
756 /* [ WORD 8 ] */
757 tree clauses;
760 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
761 gomp_single : public gimple_statement_omp_single_layout
763 /* No extra fields; adds invariant:
764 stmt->code == GIMPLE_OMP_SINGLE. */
767 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
768 gomp_teams : public gimple_statement_omp_taskreg
770 /* No extra fields; adds invariant:
771 stmt->code == GIMPLE_OMP_TEAMS. */
774 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
775 gomp_ordered : public gimple_statement_omp_single_layout
777 /* No extra fields; adds invariant:
778 stmt->code == GIMPLE_OMP_ORDERED. */
781 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
782 gomp_scan : public gimple_statement_omp_single_layout
784 /* No extra fields; adds invariant:
785 stmt->code == GIMPLE_OMP_SCAN. */
789 /* GIMPLE_OMP_ATOMIC_LOAD.
790 Note: This is based on gimple, not g_s_omp, because g_s_omp
791 contains a sequence, which we don't need here. */
793 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
794 gomp_atomic_load : public gimple
796 /* [ WORD 1-6 ] : base class */
798 /* [ WORD 7-8 ] */
799 tree rhs, lhs;
802 /* GIMPLE_OMP_ATOMIC_STORE.
803 See note on GIMPLE_OMP_ATOMIC_LOAD. */
805 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
806 gimple_statement_omp_atomic_store_layout : public gimple
808 /* [ WORD 1-6 ] : base class */
810 /* [ WORD 7 ] */
811 tree val;
814 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
815 gomp_atomic_store :
816 public gimple_statement_omp_atomic_store_layout
818 /* No extra fields; adds invariant:
819 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
822 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
823 gimple_statement_omp_return :
824 public gimple_statement_omp_atomic_store_layout
826 /* No extra fields; adds invariant:
827 stmt->code == GIMPLE_OMP_RETURN. */
830 /* Assumptions. */
832 struct GTY((tag("GSS_ASSUME")))
833 gimple_statement_assume : public gimple
835 /* [ WORD 1-6 ] : base class */
837 /* [ WORD 7 ] */
838 tree guard;
840 /* [ WORD 8 ] */
841 gimple_seq body;
844 /* GIMPLE_TRANSACTION. */
846 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
848 /* The __transaction_atomic was declared [[outer]] or it is
849 __transaction_relaxed. */
850 #define GTMA_IS_OUTER (1u << 0)
851 #define GTMA_IS_RELAXED (1u << 1)
852 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
854 /* The transaction is seen to not have an abort. */
855 #define GTMA_HAVE_ABORT (1u << 2)
856 /* The transaction is seen to have loads or stores. */
857 #define GTMA_HAVE_LOAD (1u << 3)
858 #define GTMA_HAVE_STORE (1u << 4)
859 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
860 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
861 /* The transaction WILL enter serial irrevocable mode.
862 An irrevocable block post-dominates the entire transaction, such
863 that all invocations of the transaction will go serial-irrevocable.
864 In such case, we don't bother instrumenting the transaction, and
865 tell the runtime that it should begin the transaction in
866 serial-irrevocable mode. */
867 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
868 /* The transaction contains no instrumentation code whatsover, most
869 likely because it is guaranteed to go irrevocable upon entry. */
870 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
872 struct GTY((tag("GSS_TRANSACTION")))
873 gtransaction : public gimple_statement_with_memory_ops_base
875 /* [ WORD 1-9 ] : base class */
877 /* [ WORD 10 ] */
878 gimple_seq body;
880 /* [ WORD 11-13 ] */
881 tree label_norm;
882 tree label_uninst;
883 tree label_over;
886 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
887 enum gimple_statement_structure_enum {
888 #include "gsstruct.def"
889 LAST_GSS_ENUM
891 #undef DEFGSSTRUCT
893 /* A statement with the invariant that
894 stmt->code == GIMPLE_COND
895 i.e. a conditional jump statement. */
897 struct GTY((tag("GSS_WITH_OPS")))
898 gcond : public gimple_statement_with_ops
900 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
901 static const enum gimple_code code_ = GIMPLE_COND;
904 /* A statement with the invariant that
905 stmt->code == GIMPLE_DEBUG
906 i.e. a debug statement. */
908 struct GTY((tag("GSS_WITH_OPS")))
909 gdebug : public gimple_statement_with_ops
911 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
914 /* A statement with the invariant that
915 stmt->code == GIMPLE_GOTO
916 i.e. a goto statement. */
918 struct GTY((tag("GSS_WITH_OPS")))
919 ggoto : public gimple_statement_with_ops
921 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
924 /* A statement with the invariant that
925 stmt->code == GIMPLE_LABEL
926 i.e. a label statement. */
928 struct GTY((tag("GSS_WITH_OPS")))
929 glabel : public gimple_statement_with_ops
931 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
934 /* A statement with the invariant that
935 stmt->code == GIMPLE_SWITCH
936 i.e. a switch statement. */
938 struct GTY((tag("GSS_WITH_OPS")))
939 gswitch : public gimple_statement_with_ops
941 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
944 /* A statement with the invariant that
945 stmt->code == GIMPLE_ASSIGN
946 i.e. an assignment statement. */
948 struct GTY((tag("GSS_WITH_MEM_OPS")))
949 gassign : public gimple_statement_with_memory_ops
951 static const enum gimple_code code_ = GIMPLE_ASSIGN;
952 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
955 /* A statement with the invariant that
956 stmt->code == GIMPLE_RETURN
957 i.e. a return statement. */
959 struct GTY((tag("GSS_WITH_MEM_OPS")))
960 greturn : public gimple_statement_with_memory_ops
962 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
965 template <>
966 template <>
967 inline bool
968 is_a_helper <gasm *>::test (gimple *gs)
970 return gs->code == GIMPLE_ASM;
973 template <>
974 template <>
975 inline bool
976 is_a_helper <gassign *>::test (gimple *gs)
978 return gs->code == GIMPLE_ASSIGN;
981 template <>
982 template <>
983 inline bool
984 is_a_helper <const gassign *>::test (const gimple *gs)
986 return gs->code == GIMPLE_ASSIGN;
989 template <>
990 template <>
991 inline bool
992 is_a_helper <gbind *>::test (gimple *gs)
994 return gs->code == GIMPLE_BIND;
997 template <>
998 template <>
999 inline bool
1000 is_a_helper <gcall *>::test (gimple *gs)
1002 return gs->code == GIMPLE_CALL;
1005 template <>
1006 template <>
1007 inline bool
1008 is_a_helper <gcatch *>::test (gimple *gs)
1010 return gs->code == GIMPLE_CATCH;
1013 template <>
1014 template <>
1015 inline bool
1016 is_a_helper <gcond *>::test (gimple *gs)
1018 return gs->code == GIMPLE_COND;
1021 template <>
1022 template <>
1023 inline bool
1024 is_a_helper <const gcond *>::test (const gimple *gs)
1026 return gs->code == GIMPLE_COND;
1029 template <>
1030 template <>
1031 inline bool
1032 is_a_helper <gdebug *>::test (gimple *gs)
1034 return gs->code == GIMPLE_DEBUG;
1037 template <>
1038 template <>
1039 inline bool
1040 is_a_helper <const gdebug *>::test (const gimple *gs)
1042 return gs->code == GIMPLE_DEBUG;
1045 template <>
1046 template <>
1047 inline bool
1048 is_a_helper <ggoto *>::test (gimple *gs)
1050 return gs->code == GIMPLE_GOTO;
1053 template <>
1054 template <>
1055 inline bool
1056 is_a_helper <const ggoto *>::test (const gimple *gs)
1058 return gs->code == GIMPLE_GOTO;
1061 template <>
1062 template <>
1063 inline bool
1064 is_a_helper <glabel *>::test (gimple *gs)
1066 return gs->code == GIMPLE_LABEL;
1069 template <>
1070 template <>
1071 inline bool
1072 is_a_helper <const glabel *>::test (const gimple *gs)
1074 return gs->code == GIMPLE_LABEL;
1077 template <>
1078 template <>
1079 inline bool
1080 is_a_helper <gresx *>::test (gimple *gs)
1082 return gs->code == GIMPLE_RESX;
1085 template <>
1086 template <>
1087 inline bool
1088 is_a_helper <geh_dispatch *>::test (gimple *gs)
1090 return gs->code == GIMPLE_EH_DISPATCH;
1093 template <>
1094 template <>
1095 inline bool
1096 is_a_helper <geh_else *>::test (gimple *gs)
1098 return gs->code == GIMPLE_EH_ELSE;
1101 template <>
1102 template <>
1103 inline bool
1104 is_a_helper <const geh_else *>::test (const gimple *gs)
1106 return gs->code == GIMPLE_EH_ELSE;
1109 template <>
1110 template <>
1111 inline bool
1112 is_a_helper <geh_filter *>::test (gimple *gs)
1114 return gs->code == GIMPLE_EH_FILTER;
1117 template <>
1118 template <>
1119 inline bool
1120 is_a_helper <geh_mnt *>::test (gimple *gs)
1122 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1125 template <>
1126 template <>
1127 inline bool
1128 is_a_helper <const geh_mnt *>::test (const gimple *gs)
1130 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1133 template <>
1134 template <>
1135 inline bool
1136 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1138 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1141 template <>
1142 template <>
1143 inline bool
1144 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1146 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1149 template <>
1150 template <>
1151 inline bool
1152 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1154 return gs->code == GIMPLE_OMP_RETURN;
1157 template <>
1158 template <>
1159 inline bool
1160 is_a_helper <gomp_continue *>::test (gimple *gs)
1162 return gs->code == GIMPLE_OMP_CONTINUE;
1165 template <>
1166 template <>
1167 inline bool
1168 is_a_helper <gomp_critical *>::test (gimple *gs)
1170 return gs->code == GIMPLE_OMP_CRITICAL;
1173 template <>
1174 template <>
1175 inline bool
1176 is_a_helper <gomp_ordered *>::test (gimple *gs)
1178 return gs->code == GIMPLE_OMP_ORDERED;
1181 template <>
1182 template <>
1183 inline bool
1184 is_a_helper <gomp_scan *>::test (gimple *gs)
1186 return gs->code == GIMPLE_OMP_SCAN;
1189 template <>
1190 template <>
1191 inline bool
1192 is_a_helper <gomp_for *>::test (gimple *gs)
1194 return gs->code == GIMPLE_OMP_FOR;
1197 template <>
1198 template <>
1199 inline bool
1200 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1202 return (gs->code == GIMPLE_OMP_PARALLEL
1203 || gs->code == GIMPLE_OMP_TASK
1204 || gs->code == GIMPLE_OMP_TEAMS);
1207 template <>
1208 template <>
1209 inline bool
1210 is_a_helper <gomp_parallel *>::test (gimple *gs)
1212 return gs->code == GIMPLE_OMP_PARALLEL;
1215 template <>
1216 template <>
1217 inline bool
1218 is_a_helper <gomp_target *>::test (gimple *gs)
1220 return gs->code == GIMPLE_OMP_TARGET;
1223 template <>
1224 template <>
1225 inline bool
1226 is_a_helper <gomp_sections *>::test (gimple *gs)
1228 return gs->code == GIMPLE_OMP_SECTIONS;
1231 template <>
1232 template <>
1233 inline bool
1234 is_a_helper <gomp_single *>::test (gimple *gs)
1236 return gs->code == GIMPLE_OMP_SINGLE;
1239 template <>
1240 template <>
1241 inline bool
1242 is_a_helper <gomp_teams *>::test (gimple *gs)
1244 return gs->code == GIMPLE_OMP_TEAMS;
1247 template <>
1248 template <>
1249 inline bool
1250 is_a_helper <gomp_task *>::test (gimple *gs)
1252 return gs->code == GIMPLE_OMP_TASK;
1255 template <>
1256 template <>
1257 inline bool
1258 is_a_helper <gphi *>::test (gimple *gs)
1260 return gs->code == GIMPLE_PHI;
1263 template <>
1264 template <>
1265 inline bool
1266 is_a_helper <greturn *>::test (gimple *gs)
1268 return gs->code == GIMPLE_RETURN;
1271 template <>
1272 template <>
1273 inline bool
1274 is_a_helper <gswitch *>::test (gimple *gs)
1276 return gs->code == GIMPLE_SWITCH;
1279 template <>
1280 template <>
1281 inline bool
1282 is_a_helper <const gswitch *>::test (const gimple *gs)
1284 return gs->code == GIMPLE_SWITCH;
1287 template <>
1288 template <>
1289 inline bool
1290 is_a_helper <gimple_statement_assume *>::test (gimple *gs)
1292 return gs->code == GIMPLE_ASSUME;
1295 template <>
1296 template <>
1297 inline bool
1298 is_a_helper <gtransaction *>::test (gimple *gs)
1300 return gs->code == GIMPLE_TRANSACTION;
1303 template <>
1304 template <>
1305 inline bool
1306 is_a_helper <gtry *>::test (gimple *gs)
1308 return gs->code == GIMPLE_TRY;
1311 template <>
1312 template <>
1313 inline bool
1314 is_a_helper <const gtry *>::test (const gimple *gs)
1316 return gs->code == GIMPLE_TRY;
1319 template <>
1320 template <>
1321 inline bool
1322 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1324 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1327 template <>
1328 template <>
1329 inline bool
1330 is_a_helper <const gasm *>::test (const gimple *gs)
1332 return gs->code == GIMPLE_ASM;
1335 template <>
1336 template <>
1337 inline bool
1338 is_a_helper <const gbind *>::test (const gimple *gs)
1340 return gs->code == GIMPLE_BIND;
1343 template <>
1344 template <>
1345 inline bool
1346 is_a_helper <const gcall *>::test (const gimple *gs)
1348 return gs->code == GIMPLE_CALL;
1351 template <>
1352 template <>
1353 inline bool
1354 is_a_helper <const gcatch *>::test (const gimple *gs)
1356 return gs->code == GIMPLE_CATCH;
1359 template <>
1360 template <>
1361 inline bool
1362 is_a_helper <const gresx *>::test (const gimple *gs)
1364 return gs->code == GIMPLE_RESX;
1367 template <>
1368 template <>
1369 inline bool
1370 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1372 return gs->code == GIMPLE_EH_DISPATCH;
1375 template <>
1376 template <>
1377 inline bool
1378 is_a_helper <const geh_filter *>::test (const gimple *gs)
1380 return gs->code == GIMPLE_EH_FILTER;
1383 template <>
1384 template <>
1385 inline bool
1386 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1388 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1391 template <>
1392 template <>
1393 inline bool
1394 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1396 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1399 template <>
1400 template <>
1401 inline bool
1402 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1404 return gs->code == GIMPLE_OMP_RETURN;
1407 template <>
1408 template <>
1409 inline bool
1410 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1412 return gs->code == GIMPLE_OMP_CONTINUE;
1415 template <>
1416 template <>
1417 inline bool
1418 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1420 return gs->code == GIMPLE_OMP_CRITICAL;
1423 template <>
1424 template <>
1425 inline bool
1426 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1428 return gs->code == GIMPLE_OMP_ORDERED;
1431 template <>
1432 template <>
1433 inline bool
1434 is_a_helper <const gomp_scan *>::test (const gimple *gs)
1436 return gs->code == GIMPLE_OMP_SCAN;
1439 template <>
1440 template <>
1441 inline bool
1442 is_a_helper <const gomp_for *>::test (const gimple *gs)
1444 return gs->code == GIMPLE_OMP_FOR;
1447 template <>
1448 template <>
1449 inline bool
1450 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1452 return (gs->code == GIMPLE_OMP_PARALLEL
1453 || gs->code == GIMPLE_OMP_TASK
1454 || gs->code == GIMPLE_OMP_TEAMS);
1457 template <>
1458 template <>
1459 inline bool
1460 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1462 return gs->code == GIMPLE_OMP_PARALLEL;
1465 template <>
1466 template <>
1467 inline bool
1468 is_a_helper <const gomp_target *>::test (const gimple *gs)
1470 return gs->code == GIMPLE_OMP_TARGET;
1473 template <>
1474 template <>
1475 inline bool
1476 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1478 return gs->code == GIMPLE_OMP_SECTIONS;
1481 template <>
1482 template <>
1483 inline bool
1484 is_a_helper <const gomp_single *>::test (const gimple *gs)
1486 return gs->code == GIMPLE_OMP_SINGLE;
1489 template <>
1490 template <>
1491 inline bool
1492 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1494 return gs->code == GIMPLE_OMP_TEAMS;
1497 template <>
1498 template <>
1499 inline bool
1500 is_a_helper <const gomp_task *>::test (const gimple *gs)
1502 return gs->code == GIMPLE_OMP_TASK;
1505 template <>
1506 template <>
1507 inline bool
1508 is_a_helper <const gphi *>::test (const gimple *gs)
1510 return gs->code == GIMPLE_PHI;
1513 template <>
1514 template <>
1515 inline bool
1516 is_a_helper <const greturn *>::test (const gimple *gs)
1518 return gs->code == GIMPLE_RETURN;
1521 template <>
1522 template <>
1523 inline bool
1524 is_a_helper <const gimple_statement_assume *>::test (const gimple *gs)
1526 return gs->code == GIMPLE_ASSUME;
1529 template <>
1530 template <>
1531 inline bool
1532 is_a_helper <const gtransaction *>::test (const gimple *gs)
1534 return gs->code == GIMPLE_TRANSACTION;
1537 /* Offset in bytes to the location of the operand vector.
1538 Zero if there is no operand vector for this tuple structure. */
1539 extern size_t const gimple_ops_offset_[];
1541 /* Map GIMPLE codes to GSS codes. */
1542 extern enum gimple_statement_structure_enum const gss_for_code_[];
1544 /* This variable holds the currently expanded gimple statement for purposes
1545 of comminucating the profile info to the builtin expanders. */
1546 extern gimple *currently_expanding_gimple_stmt;
1548 size_t gimple_size (enum gimple_code code, unsigned num_ops = 0);
1549 void gimple_init (gimple *g, enum gimple_code code, unsigned num_ops);
1550 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1551 greturn *gimple_build_return (tree);
1552 void gimple_call_reset_alias_info (gcall *);
1553 gcall *gimple_build_call_vec (tree, const vec<tree> &);
1554 gcall *gimple_build_call (tree, unsigned, ...);
1555 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1556 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1557 gcall *gimple_build_call_internal_vec (enum internal_fn, const vec<tree> &);
1558 gcall *gimple_build_call_from_tree (tree, tree);
1559 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1560 gassign *gimple_build_assign (tree, enum tree_code,
1561 tree, tree, tree CXX_MEM_STAT_INFO);
1562 gassign *gimple_build_assign (tree, enum tree_code,
1563 tree, tree CXX_MEM_STAT_INFO);
1564 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1565 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1566 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1567 void gimple_cond_set_condition_from_tree (gcond *, tree);
1568 glabel *gimple_build_label (tree label);
1569 ggoto *gimple_build_goto (tree dest);
1570 gimple *gimple_build_nop (void);
1571 gbind *gimple_build_bind (tree, gimple_seq, tree);
1572 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1573 vec<tree, va_gc> *, vec<tree, va_gc> *,
1574 vec<tree, va_gc> *);
1575 gcatch *gimple_build_catch (tree, gimple_seq);
1576 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1577 geh_mnt *gimple_build_eh_must_not_throw (tree);
1578 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1579 gtry *gimple_build_try (gimple_seq, gimple_seq,
1580 enum gimple_try_flags);
1581 gimple *gimple_build_wce (gimple_seq);
1582 gresx *gimple_build_resx (int);
1583 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1584 gswitch *gimple_build_switch (tree, tree, const vec<tree> &);
1585 geh_dispatch *gimple_build_eh_dispatch (int);
1586 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1587 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1588 gdebug *gimple_build_debug_begin_stmt (tree, location_t CXX_MEM_STAT_INFO);
1589 gdebug *gimple_build_debug_inline_entry (tree, location_t CXX_MEM_STAT_INFO);
1590 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1591 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1592 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1593 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1594 tree, tree);
1595 gimple *gimple_build_omp_section (gimple_seq);
1596 gimple *gimple_build_omp_structured_block (gimple_seq);
1597 gimple *gimple_build_omp_scope (gimple_seq, tree);
1598 gimple *gimple_build_omp_master (gimple_seq);
1599 gimple *gimple_build_omp_masked (gimple_seq, tree);
1600 gimple *gimple_build_omp_taskgroup (gimple_seq, tree);
1601 gomp_continue *gimple_build_omp_continue (tree, tree);
1602 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1603 gimple *gimple_build_omp_return (bool);
1604 gomp_scan *gimple_build_omp_scan (gimple_seq, tree);
1605 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1606 gimple *gimple_build_omp_sections_switch (void);
1607 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1608 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1609 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1610 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree,
1611 enum omp_memory_order);
1612 gomp_atomic_store *gimple_build_omp_atomic_store (tree, enum omp_memory_order);
1613 gimple *gimple_build_assume (tree, gimple_seq);
1614 gtransaction *gimple_build_transaction (gimple_seq);
1615 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1616 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1617 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1618 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1619 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1620 location_t);
1621 extern void annotate_all_with_location (gimple_seq, location_t);
1622 bool empty_body_p (gimple_seq);
1623 gimple_seq gimple_seq_copy (gimple_seq);
1624 bool gimple_call_same_target_p (const gimple *, const gimple *);
1625 int gimple_call_flags (const gimple *);
1626 int gimple_call_arg_flags (const gcall *, unsigned);
1627 int gimple_call_retslot_flags (const gcall *);
1628 int gimple_call_static_chain_flags (const gcall *);
1629 int gimple_call_return_flags (const gcall *);
1630 bool gimple_call_nonnull_result_p (gcall *);
1631 tree gimple_call_nonnull_arg (gcall *);
1632 bool gimple_assign_copy_p (gimple *);
1633 bool gimple_assign_ssa_name_copy_p (gimple *);
1634 bool gimple_assign_unary_nop_p (gimple *);
1635 bool gimple_assign_load_p (const gimple *);
1636 void gimple_set_bb (gimple *, basic_block);
1637 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1638 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1639 tree, tree, tree);
1640 tree gimple_get_lhs (const gimple *);
1641 void gimple_set_lhs (gimple *, tree);
1642 gimple *gimple_copy (gimple *);
1643 void gimple_move_vops (gimple *, gimple *);
1644 bool gimple_has_side_effects (const gimple *);
1645 bool gimple_could_trap_p_1 (const gimple *, bool, bool);
1646 bool gimple_could_trap_p (const gimple *);
1647 bool gimple_assign_rhs_could_trap_p (gimple *);
1648 extern void dump_gimple_statistics (void);
1649 unsigned get_gimple_rhs_num_ops (enum tree_code);
1650 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1651 extern bool gimple_compare_field_offset (tree, tree);
1652 extern tree gimple_unsigned_type (tree);
1653 extern tree gimple_signed_type (tree);
1654 extern alias_set_type gimple_get_alias_set (tree);
1655 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1656 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1657 extern combined_fn gimple_call_combined_fn (const gimple *);
1658 extern bool gimple_call_operator_delete_p (const gcall *);
1659 extern bool gimple_call_builtin_p (const gimple *);
1660 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1661 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1662 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1663 extern void dump_decl_set (FILE *, bitmap);
1664 extern bool nonfreeing_call_p (gimple *);
1665 extern bool nonbarrier_call_p (gimple *);
1666 extern bool infer_nonnull_range (gimple *, tree);
1667 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1668 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1669 extern void sort_case_labels (vec<tree> &);
1670 extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
1671 extern void gimple_seq_set_location (gimple_seq, location_t);
1672 extern void gimple_seq_discard (gimple_seq);
1673 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1674 extern bool gimple_inexpensive_call_p (gcall *);
1675 extern bool stmt_can_terminate_bb_p (gimple *);
1676 extern location_t gimple_or_expr_nonartificial_location (gimple *, tree);
1677 gcall *gimple_build_builtin_unreachable (location_t);
1679 /* Return the disposition for a warning (or all warnings by default)
1680 for a statement. */
1681 extern bool warning_suppressed_p (const gimple *, opt_code = all_warnings)
1682 ATTRIBUTE_NONNULL (1);
1683 /* Set the disposition for a warning (or all warnings by default)
1684 at a location to enabled by default. */
1685 extern void suppress_warning (gimple *, opt_code = all_warnings,
1686 bool = true) ATTRIBUTE_NONNULL (1);
1688 /* Copy the warning disposition mapping from one statement to another. */
1689 extern void copy_warning (gimple *, const gimple *)
1690 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1691 /* Copy the warning disposition mapping from an expression to a statement. */
1692 extern void copy_warning (gimple *, const_tree)
1693 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1694 /* Copy the warning disposition mapping from a statement to an expression. */
1695 extern void copy_warning (tree, const gimple *)
1696 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1698 /* Formal (expression) temporary table handling: multiple occurrences of
1699 the same scalar expression are evaluated into the same temporary. */
1701 typedef struct gimple_temp_hash_elt
1703 tree val; /* Key */
1704 tree temp; /* Value */
1705 } elt_t;
1707 /* Get the number of the next statement uid to be allocated. */
1708 inline unsigned int
1709 gimple_stmt_max_uid (struct function *fn)
1711 return fn->last_stmt_uid;
1714 /* Set the number of the next statement uid to be allocated. */
1715 inline void
1716 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1718 fn->last_stmt_uid = maxid;
1721 /* Set the number of the next statement uid to be allocated. */
1722 inline unsigned int
1723 inc_gimple_stmt_max_uid (struct function *fn)
1725 return fn->last_stmt_uid++;
1728 /* Return the first node in GIMPLE sequence S. */
1730 inline gimple_seq_node
1731 gimple_seq_first (gimple_seq s)
1733 return s;
1737 /* Return the first statement in GIMPLE sequence S. */
1739 inline gimple *
1740 gimple_seq_first_stmt (gimple_seq s)
1742 gimple_seq_node n = gimple_seq_first (s);
1743 return n;
1746 /* Return the first statement in GIMPLE sequence S as a gbind *,
1747 verifying that it has code GIMPLE_BIND in a checked build. */
1749 inline gbind *
1750 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1752 gimple_seq_node n = gimple_seq_first (s);
1753 return as_a <gbind *> (n);
1757 /* Return the last node in GIMPLE sequence S. */
1759 inline gimple_seq_node
1760 gimple_seq_last (gimple_seq s)
1762 return s ? s->prev : NULL;
1766 /* Return the last statement in GIMPLE sequence S. */
1768 inline gimple *
1769 gimple_seq_last_stmt (gimple_seq s)
1771 gimple_seq_node n = gimple_seq_last (s);
1772 return n;
1776 /* Set the last node in GIMPLE sequence *PS to LAST. */
1778 inline void
1779 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1781 (*ps)->prev = last;
1785 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1787 inline void
1788 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1790 *ps = first;
1794 /* Return true if GIMPLE sequence S is empty. */
1796 inline bool
1797 gimple_seq_empty_p (gimple_seq s)
1799 return s == NULL;
1802 /* Allocate a new sequence and initialize its first element with STMT. */
1804 inline gimple_seq
1805 gimple_seq_alloc_with_stmt (gimple *stmt)
1807 gimple_seq seq = NULL;
1808 gimple_seq_add_stmt (&seq, stmt);
1809 return seq;
1813 /* Returns the sequence of statements in BB. */
1815 inline gimple_seq
1816 bb_seq (const_basic_block bb)
1818 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1821 inline gimple_seq *
1822 bb_seq_addr (basic_block bb)
1824 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1827 /* Sets the sequence of statements in BB to SEQ. */
1829 inline void
1830 set_bb_seq (basic_block bb, gimple_seq seq)
1832 gcc_checking_assert (!(bb->flags & BB_RTL));
1833 bb->il.gimple.seq = seq;
1837 /* Return the code for GIMPLE statement G. */
1839 inline enum gimple_code
1840 gimple_code (const gimple *g)
1842 return g->code;
1846 /* Return the GSS code used by a GIMPLE code. */
1848 inline enum gimple_statement_structure_enum
1849 gss_for_code (enum gimple_code code)
1851 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1852 return gss_for_code_[code];
1856 /* Return which GSS code is used by GS. */
1858 inline enum gimple_statement_structure_enum
1859 gimple_statement_structure (gimple *gs)
1861 return gss_for_code (gimple_code (gs));
1865 /* Return true if statement G has sub-statements. This is only true for
1866 High GIMPLE statements. */
1868 inline bool
1869 gimple_has_substatements (gimple *g)
1871 switch (gimple_code (g))
1873 case GIMPLE_ASSUME:
1874 case GIMPLE_BIND:
1875 case GIMPLE_CATCH:
1876 case GIMPLE_EH_FILTER:
1877 case GIMPLE_EH_ELSE:
1878 case GIMPLE_TRY:
1879 case GIMPLE_OMP_FOR:
1880 case GIMPLE_OMP_MASTER:
1881 case GIMPLE_OMP_MASKED:
1882 case GIMPLE_OMP_TASKGROUP:
1883 case GIMPLE_OMP_ORDERED:
1884 case GIMPLE_OMP_SECTION:
1885 case GIMPLE_OMP_STRUCTURED_BLOCK:
1886 case GIMPLE_OMP_PARALLEL:
1887 case GIMPLE_OMP_TASK:
1888 case GIMPLE_OMP_SCOPE:
1889 case GIMPLE_OMP_SECTIONS:
1890 case GIMPLE_OMP_SINGLE:
1891 case GIMPLE_OMP_TARGET:
1892 case GIMPLE_OMP_TEAMS:
1893 case GIMPLE_OMP_CRITICAL:
1894 case GIMPLE_WITH_CLEANUP_EXPR:
1895 case GIMPLE_TRANSACTION:
1896 return true;
1898 default:
1899 return false;
1904 /* Return the basic block holding statement G. */
1906 inline basic_block
1907 gimple_bb (const gimple *g)
1909 return g->bb;
1913 /* Return the lexical scope block holding statement G. */
1915 inline tree
1916 gimple_block (const gimple *g)
1918 return LOCATION_BLOCK (g->location);
1921 /* Forward declare. */
1922 inline void gimple_set_location (gimple *, location_t);
1924 /* Set BLOCK to be the lexical scope block holding statement G. */
1926 inline void
1927 gimple_set_block (gimple *g, tree block)
1929 gimple_set_location (g, set_block (g->location, block));
1932 /* Return location information for statement G. */
1934 inline location_t
1935 gimple_location (const gimple *g)
1937 return g->location;
1940 /* Return location information for statement G if g is not NULL.
1941 Otherwise, UNKNOWN_LOCATION is returned. */
1943 inline location_t
1944 gimple_location_safe (const gimple *g)
1946 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1949 /* Set location information for statement G. */
1951 inline void
1952 gimple_set_location (gimple *g, location_t location)
1954 /* Copy the no-warning data to the statement location. */
1955 if (g->location != UNKNOWN_LOCATION)
1956 copy_warning (location, g->location);
1957 g->location = location;
1960 /* Return address of the location information for statement G. */
1962 inline location_t *
1963 gimple_location_ptr (gimple *g)
1965 return &g->location;
1969 /* Return true if G contains location information. */
1971 inline bool
1972 gimple_has_location (const gimple *g)
1974 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1978 /* Return non-artificial location information for statement G. */
1980 inline location_t
1981 gimple_nonartificial_location (const gimple *g)
1983 location_t *ploc = NULL;
1985 if (tree block = gimple_block (g))
1986 ploc = block_nonartificial_location (block);
1988 return ploc ? *ploc : gimple_location (g);
1992 /* Return the file name of the location of STMT. */
1994 inline const char *
1995 gimple_filename (const gimple *stmt)
1997 return LOCATION_FILE (gimple_location (stmt));
2001 /* Return the line number of the location of STMT. */
2003 inline int
2004 gimple_lineno (const gimple *stmt)
2006 return LOCATION_LINE (gimple_location (stmt));
2010 /* Determine whether SEQ is a singleton. */
2012 inline bool
2013 gimple_seq_singleton_p (gimple_seq seq)
2015 return ((gimple_seq_first (seq) != NULL)
2016 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
2019 /* Return true if no warnings should be emitted for statement STMT. */
2021 inline bool
2022 gimple_no_warning_p (const gimple *stmt)
2024 return stmt->no_warning;
2027 /* Set the no_warning flag of STMT to NO_WARNING. */
2029 inline void
2030 gimple_set_no_warning (gimple *stmt, bool no_warning)
2032 stmt->no_warning = (unsigned) no_warning;
2035 /* Set the visited status on statement STMT to VISITED_P.
2037 Please note that this 'visited' property of the gimple statement is
2038 supposed to be undefined at pass boundaries. This means that a
2039 given pass should not assume it contains any useful value when the
2040 pass starts and thus can set it to any value it sees fit.
2042 You can learn more about the visited property of the gimple
2043 statement by reading the comments of the 'visited' data member of
2044 struct gimple.
2047 inline void
2048 gimple_set_visited (gimple *stmt, bool visited_p)
2050 stmt->visited = (unsigned) visited_p;
2054 /* Return the visited status for statement STMT.
2056 Please note that this 'visited' property of the gimple statement is
2057 supposed to be undefined at pass boundaries. This means that a
2058 given pass should not assume it contains any useful value when the
2059 pass starts and thus can set it to any value it sees fit.
2061 You can learn more about the visited property of the gimple
2062 statement by reading the comments of the 'visited' data member of
2063 struct gimple. */
2065 inline bool
2066 gimple_visited_p (gimple *stmt)
2068 return stmt->visited;
2072 /* Set pass local flag PLF on statement STMT to VAL_P.
2074 Please note that this PLF property of the gimple statement is
2075 supposed to be undefined at pass boundaries. This means that a
2076 given pass should not assume it contains any useful value when the
2077 pass starts and thus can set it to any value it sees fit.
2079 You can learn more about the PLF property by reading the comment of
2080 the 'plf' data member of struct gimple_statement_structure. */
2082 inline void
2083 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
2085 if (val_p)
2086 stmt->plf |= (unsigned int) plf;
2087 else
2088 stmt->plf &= ~((unsigned int) plf);
2092 /* Return the value of pass local flag PLF on statement STMT.
2094 Please note that this 'plf' property of the gimple statement is
2095 supposed to be undefined at pass boundaries. This means that a
2096 given pass should not assume it contains any useful value when the
2097 pass starts and thus can set it to any value it sees fit.
2099 You can learn more about the plf property by reading the comment of
2100 the 'plf' data member of struct gimple_statement_structure. */
2102 inline unsigned int
2103 gimple_plf (gimple *stmt, enum plf_mask plf)
2105 return stmt->plf & ((unsigned int) plf);
2109 /* Set the UID of statement.
2111 Please note that this UID property is supposed to be undefined at
2112 pass boundaries. This means that a given pass should not assume it
2113 contains any useful value when the pass starts and thus can set it
2114 to any value it sees fit. */
2116 inline void
2117 gimple_set_uid (gimple *g, unsigned uid)
2119 g->uid = uid;
2123 /* Return the UID of statement.
2125 Please note that this UID property is supposed to be undefined at
2126 pass boundaries. This means that a given pass should not assume it
2127 contains any useful value when the pass starts and thus can set it
2128 to any value it sees fit. */
2130 inline unsigned
2131 gimple_uid (const gimple *g)
2133 return g->uid;
2137 /* Make statement G a singleton sequence. */
2139 inline void
2140 gimple_init_singleton (gimple *g)
2142 g->next = NULL;
2143 g->prev = g;
2147 /* Return true if GIMPLE statement G has register or memory operands. */
2149 inline bool
2150 gimple_has_ops (const gimple *g)
2152 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
2155 template <>
2156 template <>
2157 inline bool
2158 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
2160 return gimple_has_ops (gs);
2163 template <>
2164 template <>
2165 inline bool
2166 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
2168 return gimple_has_ops (gs);
2171 /* Return true if GIMPLE statement G has memory operands. */
2173 inline bool
2174 gimple_has_mem_ops (const gimple *g)
2176 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
2179 template <>
2180 template <>
2181 inline bool
2182 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
2184 return gimple_has_mem_ops (gs);
2187 template <>
2188 template <>
2189 inline bool
2190 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2192 return gimple_has_mem_ops (gs);
2195 /* Return the set of USE operands for statement G. */
2197 inline struct use_optype_d *
2198 gimple_use_ops (const gimple *g)
2200 const gimple_statement_with_ops *ops_stmt =
2201 dyn_cast <const gimple_statement_with_ops *> (g);
2202 if (!ops_stmt)
2203 return NULL;
2204 return ops_stmt->use_ops;
2208 /* Set USE to be the set of USE operands for statement G. */
2210 inline void
2211 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2213 gimple_statement_with_ops *ops_stmt =
2214 as_a <gimple_statement_with_ops *> (g);
2215 ops_stmt->use_ops = use;
2219 /* Return the single VUSE operand of the statement G. */
2221 inline tree
2222 gimple_vuse (const gimple *g)
2224 const gimple_statement_with_memory_ops *mem_ops_stmt =
2225 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2226 if (!mem_ops_stmt)
2227 return NULL_TREE;
2228 return mem_ops_stmt->vuse;
2231 /* Return the single VDEF operand of the statement G. */
2233 inline tree
2234 gimple_vdef (const gimple *g)
2236 const gimple_statement_with_memory_ops *mem_ops_stmt =
2237 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2238 if (!mem_ops_stmt)
2239 return NULL_TREE;
2240 return mem_ops_stmt->vdef;
2243 /* Return the single VUSE operand of the statement G. */
2245 inline tree *
2246 gimple_vuse_ptr (gimple *g)
2248 gimple_statement_with_memory_ops *mem_ops_stmt =
2249 dyn_cast <gimple_statement_with_memory_ops *> (g);
2250 if (!mem_ops_stmt)
2251 return NULL;
2252 return &mem_ops_stmt->vuse;
2255 /* Return the single VDEF operand of the statement G. */
2257 inline tree *
2258 gimple_vdef_ptr (gimple *g)
2260 gimple_statement_with_memory_ops *mem_ops_stmt =
2261 dyn_cast <gimple_statement_with_memory_ops *> (g);
2262 if (!mem_ops_stmt)
2263 return NULL;
2264 return &mem_ops_stmt->vdef;
2267 /* Set the single VUSE operand of the statement G. */
2269 inline void
2270 gimple_set_vuse (gimple *g, tree vuse)
2272 gimple_statement_with_memory_ops *mem_ops_stmt =
2273 as_a <gimple_statement_with_memory_ops *> (g);
2274 mem_ops_stmt->vuse = vuse;
2277 /* Set the single VDEF operand of the statement G. */
2279 inline void
2280 gimple_set_vdef (gimple *g, tree vdef)
2282 gimple_statement_with_memory_ops *mem_ops_stmt =
2283 as_a <gimple_statement_with_memory_ops *> (g);
2284 mem_ops_stmt->vdef = vdef;
2288 /* Return true if statement G has operands and the modified field has
2289 been set. */
2291 inline bool
2292 gimple_modified_p (const gimple *g)
2294 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2298 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2299 a MODIFIED field. */
2301 inline void
2302 gimple_set_modified (gimple *s, bool modifiedp)
2304 if (gimple_has_ops (s))
2305 s->modified = (unsigned) modifiedp;
2309 /* Return true if statement STMT contains volatile operands. */
2311 inline bool
2312 gimple_has_volatile_ops (const gimple *stmt)
2314 if (gimple_has_mem_ops (stmt))
2315 return stmt->has_volatile_ops;
2316 else
2317 return false;
2321 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2323 inline void
2324 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2326 if (gimple_has_mem_ops (stmt))
2327 stmt->has_volatile_ops = (unsigned) volatilep;
2330 /* Return true if STMT is in a transaction. */
2332 inline bool
2333 gimple_in_transaction (const gimple *stmt)
2335 return bb_in_transaction (gimple_bb (stmt));
2338 /* Return true if statement STMT may access memory. */
2340 inline bool
2341 gimple_references_memory_p (gimple *stmt)
2343 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2347 /* Return the subcode for OMP statement S. */
2349 inline unsigned
2350 gimple_omp_subcode (const gimple *s)
2352 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2353 && gimple_code (s) <= GIMPLE_OMP_ORDERED);
2354 return s->subcode;
2357 /* Set the subcode for OMP statement S to SUBCODE. */
2359 inline void
2360 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2362 /* We only have 16 bits for the subcode. Assert that we are not
2363 overflowing it. */
2364 gcc_gimple_checking_assert (subcode < (1 << 16));
2365 s->subcode = subcode;
2368 /* Set the nowait flag on OMP_RETURN statement S. */
2370 inline void
2371 gimple_omp_return_set_nowait (gimple *s)
2373 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2374 s->subcode |= GF_OMP_RETURN_NOWAIT;
2378 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2379 flag set. */
2381 inline bool
2382 gimple_omp_return_nowait_p (const gimple *g)
2384 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2385 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2389 /* Set the LHS of OMP return. */
2391 inline void
2392 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2394 gimple_statement_omp_return *omp_return_stmt =
2395 as_a <gimple_statement_omp_return *> (g);
2396 omp_return_stmt->val = lhs;
2400 /* Get the LHS of OMP return. */
2402 inline tree
2403 gimple_omp_return_lhs (const gimple *g)
2405 const gimple_statement_omp_return *omp_return_stmt =
2406 as_a <const gimple_statement_omp_return *> (g);
2407 return omp_return_stmt->val;
2411 /* Return a pointer to the LHS of OMP return. */
2413 inline tree *
2414 gimple_omp_return_lhs_ptr (gimple *g)
2416 gimple_statement_omp_return *omp_return_stmt =
2417 as_a <gimple_statement_omp_return *> (g);
2418 return &omp_return_stmt->val;
2422 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2423 flag set. */
2425 inline bool
2426 gimple_omp_section_last_p (const gimple *g)
2428 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2429 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2433 /* Set the GF_OMP_SECTION_LAST flag on G. */
2435 inline void
2436 gimple_omp_section_set_last (gimple *g)
2438 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2439 g->subcode |= GF_OMP_SECTION_LAST;
2443 /* Return true if OMP ordered construct is stand-alone
2444 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2446 inline bool
2447 gimple_omp_ordered_standalone_p (const gimple *g)
2449 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2450 return (gimple_omp_subcode (g) & GF_OMP_ORDERED_STANDALONE) != 0;
2454 /* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2456 inline void
2457 gimple_omp_ordered_standalone (gimple *g)
2459 GIMPLE_CHECK (g, GIMPLE_OMP_ORDERED);
2460 g->subcode |= GF_OMP_ORDERED_STANDALONE;
2464 /* Return true if OMP parallel statement G has the
2465 GF_OMP_PARALLEL_COMBINED flag set. */
2467 inline bool
2468 gimple_omp_parallel_combined_p (const gimple *g)
2470 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2471 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2475 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2476 value of COMBINED_P. */
2478 inline void
2479 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2481 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2482 if (combined_p)
2483 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2484 else
2485 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2489 /* Return true if OMP atomic load/store statement G has the
2490 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2492 inline bool
2493 gimple_omp_atomic_need_value_p (const gimple *g)
2495 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2496 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2497 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2501 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2503 inline void
2504 gimple_omp_atomic_set_need_value (gimple *g)
2506 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2507 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2508 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2512 /* Return true if OMP atomic load/store statement G has the
2513 GF_OMP_ATOMIC_WEAK flag set. */
2515 inline bool
2516 gimple_omp_atomic_weak_p (const gimple *g)
2518 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2519 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2520 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_WEAK) != 0;
2524 /* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2526 inline void
2527 gimple_omp_atomic_set_weak (gimple *g)
2529 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2530 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2531 g->subcode |= GF_OMP_ATOMIC_WEAK;
2535 /* Return the memory order of the OMP atomic load/store statement G. */
2537 inline enum omp_memory_order
2538 gimple_omp_atomic_memory_order (const gimple *g)
2540 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2541 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2542 return (enum omp_memory_order)
2543 (gimple_omp_subcode (g) & GF_OMP_ATOMIC_MEMORY_ORDER);
2547 /* Set the memory order on G. */
2549 inline void
2550 gimple_omp_atomic_set_memory_order (gimple *g, enum omp_memory_order mo)
2552 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2553 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2554 g->subcode = ((g->subcode & ~GF_OMP_ATOMIC_MEMORY_ORDER)
2555 | (mo & GF_OMP_ATOMIC_MEMORY_ORDER));
2559 /* Return the number of operands for statement GS. */
2561 inline unsigned
2562 gimple_num_ops (const gimple *gs)
2564 return gs->num_ops;
2568 /* Set the number of operands for statement GS. */
2570 inline void
2571 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2573 gs->num_ops = num_ops;
2577 /* Return the array of operands for statement GS. */
2579 inline tree *
2580 gimple_ops (gimple *gs)
2582 size_t off;
2584 /* All the tuples have their operand vector at the very bottom
2585 of the structure. Note that those structures that do not
2586 have an operand vector have a zero offset. */
2587 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2588 gcc_gimple_checking_assert (off != 0);
2590 return (tree *) ((char *) gs + off);
2594 /* Return operand I for statement GS. */
2596 inline tree
2597 gimple_op (const gimple *gs, unsigned i)
2599 if (gimple_has_ops (gs))
2601 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2602 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2604 else
2605 return NULL_TREE;
2608 /* Return a pointer to operand I for statement GS. */
2610 inline tree *
2611 gimple_op_ptr (gimple *gs, unsigned i)
2613 if (gimple_has_ops (gs))
2615 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2616 return gimple_ops (gs) + i;
2618 else
2619 return NULL;
2622 /* Set operand I of statement GS to OP. */
2624 inline void
2625 gimple_set_op (gimple *gs, unsigned i, tree op)
2627 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2629 /* Note. It may be tempting to assert that OP matches
2630 is_gimple_operand, but that would be wrong. Different tuples
2631 accept slightly different sets of tree operands. Each caller
2632 should perform its own validation. */
2633 gimple_ops (gs)[i] = op;
2636 /* Return true if GS is a GIMPLE_ASSIGN. */
2638 inline bool
2639 is_gimple_assign (const gimple *gs)
2641 return gimple_code (gs) == GIMPLE_ASSIGN;
2644 /* Determine if expression CODE is one of the valid expressions that can
2645 be used on the RHS of GIMPLE assignments. */
2647 inline enum gimple_rhs_class
2648 get_gimple_rhs_class (enum tree_code code)
2650 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2653 /* Return the LHS of assignment statement GS. */
2655 inline tree
2656 gimple_assign_lhs (const gassign *gs)
2658 return gs->op[0];
2661 inline tree
2662 gimple_assign_lhs (const gimple *gs)
2664 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2665 return gimple_assign_lhs (ass);
2669 /* Return a pointer to the LHS of assignment statement GS. */
2671 inline tree *
2672 gimple_assign_lhs_ptr (gassign *gs)
2674 return &gs->op[0];
2677 inline tree *
2678 gimple_assign_lhs_ptr (gimple *gs)
2680 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2681 return gimple_assign_lhs_ptr (ass);
2685 /* Set LHS to be the LHS operand of assignment statement GS. */
2687 inline void
2688 gimple_assign_set_lhs (gassign *gs, tree lhs)
2690 gs->op[0] = lhs;
2692 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2693 SSA_NAME_DEF_STMT (lhs) = gs;
2696 inline void
2697 gimple_assign_set_lhs (gimple *gs, tree lhs)
2699 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2700 gimple_assign_set_lhs (ass, lhs);
2704 /* Return the first operand on the RHS of assignment statement GS. */
2706 inline tree
2707 gimple_assign_rhs1 (const gassign *gs)
2709 return gs->op[1];
2712 inline tree
2713 gimple_assign_rhs1 (const gimple *gs)
2715 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2716 return gimple_assign_rhs1 (ass);
2720 /* Return a pointer to the first operand on the RHS of assignment
2721 statement GS. */
2723 inline tree *
2724 gimple_assign_rhs1_ptr (gassign *gs)
2726 return &gs->op[1];
2729 inline tree *
2730 gimple_assign_rhs1_ptr (gimple *gs)
2732 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2733 return gimple_assign_rhs1_ptr (ass);
2736 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2738 inline void
2739 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2741 gs->op[1] = rhs;
2744 inline void
2745 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2747 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2748 gimple_assign_set_rhs1 (ass, rhs);
2752 /* Return the second operand on the RHS of assignment statement GS.
2753 If GS does not have two operands, NULL is returned instead. */
2755 inline tree
2756 gimple_assign_rhs2 (const gassign *gs)
2758 if (gimple_num_ops (gs) >= 3)
2759 return gs->op[2];
2760 else
2761 return NULL_TREE;
2764 inline tree
2765 gimple_assign_rhs2 (const gimple *gs)
2767 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2768 return gimple_assign_rhs2 (ass);
2772 /* Return a pointer to the second operand on the RHS of assignment
2773 statement GS. */
2775 inline tree *
2776 gimple_assign_rhs2_ptr (gassign *gs)
2778 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2779 return &gs->op[2];
2782 inline tree *
2783 gimple_assign_rhs2_ptr (gimple *gs)
2785 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2786 return gimple_assign_rhs2_ptr (ass);
2790 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2792 inline void
2793 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2795 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2796 gs->op[2] = rhs;
2799 inline void
2800 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2802 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2803 return gimple_assign_set_rhs2 (ass, rhs);
2806 /* Return the third operand on the RHS of assignment statement GS.
2807 If GS does not have two operands, NULL is returned instead. */
2809 inline tree
2810 gimple_assign_rhs3 (const gassign *gs)
2812 if (gimple_num_ops (gs) >= 4)
2813 return gs->op[3];
2814 else
2815 return NULL_TREE;
2818 inline tree
2819 gimple_assign_rhs3 (const gimple *gs)
2821 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2822 return gimple_assign_rhs3 (ass);
2825 /* Return a pointer to the third operand on the RHS of assignment
2826 statement GS. */
2828 inline tree *
2829 gimple_assign_rhs3_ptr (gimple *gs)
2831 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2832 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2833 return &ass->op[3];
2837 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2839 inline void
2840 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2842 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2843 gs->op[3] = rhs;
2846 inline void
2847 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2849 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2850 gimple_assign_set_rhs3 (ass, rhs);
2854 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2855 which expect to see only two operands. */
2857 inline void
2858 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2859 tree op1, tree op2)
2861 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2864 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2865 which expect to see only one operands. */
2867 inline void
2868 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2869 tree op1)
2871 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2874 /* Returns true if GS is a nontemporal move. */
2876 inline bool
2877 gimple_assign_nontemporal_move_p (const gassign *gs)
2879 return gs->nontemporal_move;
2882 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2884 inline void
2885 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2887 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2888 gs->nontemporal_move = nontemporal;
2892 /* Return the code of the expression computed on the rhs of assignment
2893 statement GS. In case that the RHS is a single object, returns the
2894 tree code of the object. */
2896 inline enum tree_code
2897 gimple_assign_rhs_code (const gassign *gs)
2899 enum tree_code code = (enum tree_code) gs->subcode;
2900 /* While we initially set subcode to the TREE_CODE of the rhs for
2901 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2902 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2903 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2904 code = TREE_CODE (gs->op[1]);
2906 return code;
2909 inline enum tree_code
2910 gimple_assign_rhs_code (const gimple *gs)
2912 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2913 return gimple_assign_rhs_code (ass);
2917 /* Set CODE to be the code for the expression computed on the RHS of
2918 assignment S. */
2920 inline void
2921 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2923 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2924 s->subcode = code;
2928 /* Return the gimple rhs class of the code of the expression computed on
2929 the rhs of assignment statement GS.
2930 This will never return GIMPLE_INVALID_RHS. */
2932 inline enum gimple_rhs_class
2933 gimple_assign_rhs_class (const gimple *gs)
2935 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2938 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2939 there is no operator associated with the assignment itself.
2940 Unlike gimple_assign_copy_p, this predicate returns true for
2941 any RHS operand, including those that perform an operation
2942 and do not have the semantics of a copy, such as COND_EXPR. */
2944 inline bool
2945 gimple_assign_single_p (const gimple *gs)
2947 return (is_gimple_assign (gs)
2948 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2951 /* Return true if GS performs a store to its lhs. */
2953 inline bool
2954 gimple_store_p (const gimple *gs)
2956 tree lhs = gimple_get_lhs (gs);
2957 return lhs && !is_gimple_reg (lhs);
2960 /* Return true if S is a type-cast assignment. */
2962 inline bool
2963 gimple_assign_cast_p (const gimple *s)
2965 if (is_gimple_assign (s))
2967 enum tree_code sc = gimple_assign_rhs_code (s);
2968 return CONVERT_EXPR_CODE_P (sc)
2969 || sc == VIEW_CONVERT_EXPR
2970 || sc == FIX_TRUNC_EXPR;
2973 return false;
2976 /* Return true if S is a clobber statement. */
2978 inline bool
2979 gimple_clobber_p (const gimple *s)
2981 return gimple_assign_single_p (s)
2982 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2985 /* Return true if S is a clobber statement. */
2987 inline bool
2988 gimple_clobber_p (const gimple *s, enum clobber_kind kind)
2990 return gimple_clobber_p (s)
2991 && CLOBBER_KIND (gimple_assign_rhs1 (s)) == kind;
2994 /* Return true if GS is a GIMPLE_CALL. */
2996 inline bool
2997 is_gimple_call (const gimple *gs)
2999 return gimple_code (gs) == GIMPLE_CALL;
3002 /* Return the LHS of call statement GS. */
3004 inline tree
3005 gimple_call_lhs (const gcall *gs)
3007 return gs->op[0];
3010 inline tree
3011 gimple_call_lhs (const gimple *gs)
3013 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3014 return gimple_call_lhs (gc);
3018 /* Return a pointer to the LHS of call statement GS. */
3020 inline tree *
3021 gimple_call_lhs_ptr (gcall *gs)
3023 return &gs->op[0];
3026 inline tree *
3027 gimple_call_lhs_ptr (gimple *gs)
3029 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3030 return gimple_call_lhs_ptr (gc);
3034 /* Set LHS to be the LHS operand of call statement GS. */
3036 inline void
3037 gimple_call_set_lhs (gcall *gs, tree lhs)
3039 gs->op[0] = lhs;
3040 if (lhs && TREE_CODE (lhs) == SSA_NAME)
3041 SSA_NAME_DEF_STMT (lhs) = gs;
3044 inline void
3045 gimple_call_set_lhs (gimple *gs, tree lhs)
3047 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3048 gimple_call_set_lhs (gc, lhs);
3052 /* Return true if call GS calls an internal-only function, as enumerated
3053 by internal_fn. */
3055 inline bool
3056 gimple_call_internal_p (const gcall *gs)
3058 return (gs->subcode & GF_CALL_INTERNAL) != 0;
3061 inline bool
3062 gimple_call_internal_p (const gimple *gs)
3064 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3065 return gimple_call_internal_p (gc);
3068 /* Return true if call GS is marked as nocf_check. */
3070 inline bool
3071 gimple_call_nocf_check_p (const gcall *gs)
3073 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
3076 /* Mark statement GS as nocf_check call. */
3078 inline void
3079 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
3081 if (nocf_check)
3082 gs->subcode |= GF_CALL_NOCF_CHECK;
3083 else
3084 gs->subcode &= ~GF_CALL_NOCF_CHECK;
3087 /* Return the target of internal call GS. */
3089 inline enum internal_fn
3090 gimple_call_internal_fn (const gcall *gs)
3092 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
3093 return gs->u.internal_fn;
3096 inline enum internal_fn
3097 gimple_call_internal_fn (const gimple *gs)
3099 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3100 return gimple_call_internal_fn (gc);
3103 /* Return true, if this internal gimple call is unique. */
3105 inline bool
3106 gimple_call_internal_unique_p (const gcall *gs)
3108 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
3111 inline bool
3112 gimple_call_internal_unique_p (const gimple *gs)
3114 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3115 return gimple_call_internal_unique_p (gc);
3118 /* Return true if GS is an internal function FN. */
3120 inline bool
3121 gimple_call_internal_p (const gimple *gs, internal_fn fn)
3123 return (is_gimple_call (gs)
3124 && gimple_call_internal_p (gs)
3125 && gimple_call_internal_fn (gs) == fn);
3128 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3129 that could alter control flow. */
3131 inline void
3132 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
3134 if (ctrl_altering_p)
3135 s->subcode |= GF_CALL_CTRL_ALTERING;
3136 else
3137 s->subcode &= ~GF_CALL_CTRL_ALTERING;
3140 inline void
3141 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
3143 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3144 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
3147 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3148 flag is set. Such call could not be a stmt in the middle of a bb. */
3150 inline bool
3151 gimple_call_ctrl_altering_p (const gcall *gs)
3153 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
3156 inline bool
3157 gimple_call_ctrl_altering_p (const gimple *gs)
3159 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3160 return gimple_call_ctrl_altering_p (gc);
3164 /* Return the function type of the function called by GS. */
3166 inline tree
3167 gimple_call_fntype (const gcall *gs)
3169 if (gimple_call_internal_p (gs))
3170 return NULL_TREE;
3171 return gs->u.fntype;
3174 inline tree
3175 gimple_call_fntype (const gimple *gs)
3177 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3178 return gimple_call_fntype (call_stmt);
3181 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3183 inline void
3184 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3186 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3187 call_stmt->u.fntype = fntype;
3191 /* Return the tree node representing the function called by call
3192 statement GS. */
3194 inline tree
3195 gimple_call_fn (const gcall *gs)
3197 return gs->op[1];
3200 inline tree
3201 gimple_call_fn (const gimple *gs)
3203 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3204 return gimple_call_fn (gc);
3207 /* Return a pointer to the tree node representing the function called by call
3208 statement GS. */
3210 inline tree *
3211 gimple_call_fn_ptr (gcall *gs)
3213 return &gs->op[1];
3216 inline tree *
3217 gimple_call_fn_ptr (gimple *gs)
3219 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3220 return gimple_call_fn_ptr (gc);
3224 /* Set FN to be the function called by call statement GS. */
3226 inline void
3227 gimple_call_set_fn (gcall *gs, tree fn)
3229 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3230 gs->op[1] = fn;
3234 /* Set FNDECL to be the function called by call statement GS. */
3236 inline void
3237 gimple_call_set_fndecl (gcall *gs, tree decl)
3239 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3240 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3241 build_pointer_type (TREE_TYPE (decl)), decl);
3244 inline void
3245 gimple_call_set_fndecl (gimple *gs, tree decl)
3247 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3248 gimple_call_set_fndecl (gc, decl);
3252 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3254 inline void
3255 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3257 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3258 call_stmt->u.internal_fn = fn;
3262 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3263 Otherwise return NULL. This function is analogous to
3264 get_callee_fndecl in tree land. */
3266 inline tree
3267 gimple_call_fndecl (const gcall *gs)
3269 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3272 inline tree
3273 gimple_call_fndecl (const gimple *gs)
3275 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3276 return gimple_call_fndecl (gc);
3280 /* Return the type returned by call statement GS. */
3282 inline tree
3283 gimple_call_return_type (const gcall *gs)
3285 tree type = gimple_call_fntype (gs);
3287 if (type == NULL_TREE)
3288 return TREE_TYPE (gimple_call_lhs (gs));
3290 /* The type returned by a function is the type of its
3291 function type. */
3292 return TREE_TYPE (type);
3296 /* Return the static chain for call statement GS. */
3298 inline tree
3299 gimple_call_chain (const gcall *gs)
3301 return gs->op[2];
3304 inline tree
3305 gimple_call_chain (const gimple *gs)
3307 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3308 return gimple_call_chain (gc);
3312 /* Return a pointer to the static chain for call statement CALL_STMT. */
3314 inline tree *
3315 gimple_call_chain_ptr (gcall *call_stmt)
3317 return &call_stmt->op[2];
3320 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3322 inline void
3323 gimple_call_set_chain (gcall *call_stmt, tree chain)
3325 call_stmt->op[2] = chain;
3329 /* Return the number of arguments used by call statement GS. */
3331 inline unsigned
3332 gimple_call_num_args (const gcall *gs)
3334 return gimple_num_ops (gs) - 3;
3337 inline unsigned
3338 gimple_call_num_args (const gimple *gs)
3340 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3341 return gimple_call_num_args (gc);
3345 /* Return the argument at position INDEX for call statement GS. */
3347 inline tree
3348 gimple_call_arg (const gcall *gs, unsigned index)
3350 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3351 return gs->op[index + 3];
3354 inline tree
3355 gimple_call_arg (const gimple *gs, unsigned index)
3357 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3358 return gimple_call_arg (gc, index);
3362 /* Return a pointer to the argument at position INDEX for call
3363 statement GS. */
3365 inline tree *
3366 gimple_call_arg_ptr (gcall *gs, unsigned index)
3368 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3369 return &gs->op[index + 3];
3372 inline tree *
3373 gimple_call_arg_ptr (gimple *gs, unsigned index)
3375 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3376 return gimple_call_arg_ptr (gc, index);
3380 /* Set ARG to be the argument at position INDEX for call statement GS. */
3382 inline void
3383 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3385 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3386 gs->op[index + 3] = arg;
3389 inline void
3390 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3392 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3393 gimple_call_set_arg (gc, index, arg);
3397 /* If TAIL_P is true, mark call statement S as being a tail call
3398 (i.e., a call just before the exit of a function). These calls are
3399 candidate for tail call optimization. */
3401 inline void
3402 gimple_call_set_tail (gcall *s, bool tail_p)
3404 if (tail_p)
3405 s->subcode |= GF_CALL_TAILCALL;
3406 else
3407 s->subcode &= ~GF_CALL_TAILCALL;
3411 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3413 inline bool
3414 gimple_call_tail_p (const gcall *s)
3416 return (s->subcode & GF_CALL_TAILCALL) != 0;
3419 /* Mark (or clear) call statement S as requiring tail call optimization. */
3421 inline void
3422 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3424 if (must_tail_p)
3425 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3426 else
3427 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3430 /* Return true if call statement has been marked as requiring
3431 tail call optimization. */
3433 inline bool
3434 gimple_call_must_tail_p (const gcall *s)
3436 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3439 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3440 slot optimization. This transformation uses the target of the call
3441 expansion as the return slot for calls that return in memory. */
3443 inline void
3444 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3446 if (return_slot_opt_p)
3447 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3448 else
3449 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3453 /* Return true if S is marked for return slot optimization. */
3455 inline bool
3456 gimple_call_return_slot_opt_p (const gcall *s)
3458 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3462 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3463 thunk to the thunked-to function. */
3465 inline void
3466 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3468 if (from_thunk_p)
3469 s->subcode |= GF_CALL_FROM_THUNK;
3470 else
3471 s->subcode &= ~GF_CALL_FROM_THUNK;
3475 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3477 inline bool
3478 gimple_call_from_thunk_p (gcall *s)
3480 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3484 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3485 to operator new or delete created from a new or delete expression. */
3487 inline void
3488 gimple_call_set_from_new_or_delete (gcall *s, bool from_new_or_delete_p)
3490 if (from_new_or_delete_p)
3491 s->subcode |= GF_CALL_FROM_NEW_OR_DELETE;
3492 else
3493 s->subcode &= ~GF_CALL_FROM_NEW_OR_DELETE;
3497 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3498 from a new or delete expression. */
3500 inline bool
3501 gimple_call_from_new_or_delete (const gcall *s)
3503 return (s->subcode & GF_CALL_FROM_NEW_OR_DELETE) != 0;
3507 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3508 argument pack in its argument list. */
3510 inline void
3511 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3513 if (pass_arg_pack_p)
3514 s->subcode |= GF_CALL_VA_ARG_PACK;
3515 else
3516 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3520 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3521 argument pack in its argument list. */
3523 inline bool
3524 gimple_call_va_arg_pack_p (const gcall *s)
3526 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3530 /* Return true if S is a noreturn call. */
3532 inline bool
3533 gimple_call_noreturn_p (const gcall *s)
3535 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3538 inline bool
3539 gimple_call_noreturn_p (const gimple *s)
3541 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3542 return gimple_call_noreturn_p (gc);
3546 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3547 even if the called function can throw in other cases. */
3549 inline void
3550 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3552 if (nothrow_p)
3553 s->subcode |= GF_CALL_NOTHROW;
3554 else
3555 s->subcode &= ~GF_CALL_NOTHROW;
3558 /* Return true if S is a nothrow call. */
3560 inline bool
3561 gimple_call_nothrow_p (gcall *s)
3563 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3566 /* If EXPECTED_THROW_P is true, GIMPLE_CALL S is a call that is known
3567 to be more likely to throw than to run forever, terminate the
3568 program or return by other means. */
3570 static inline void
3571 gimple_call_set_expected_throw (gcall *s, bool expected_throw_p)
3573 if (expected_throw_p)
3574 s->subcode |= GF_CALL_XTHROW;
3575 else
3576 s->subcode &= ~GF_CALL_XTHROW;
3579 /* Return true if S is a call that is more likely to end by
3580 propagating an exception than by other means. */
3582 static inline bool
3583 gimple_call_expected_throw_p (gcall *s)
3585 return (gimple_call_flags (s) & ECF_XTHROW) != 0;
3588 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3589 is known to be emitted for VLA objects. Those are wrapped by
3590 stack_save/stack_restore calls and hence can't lead to unbounded
3591 stack growth even when they occur in loops. */
3593 inline void
3594 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3596 if (for_var)
3597 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3598 else
3599 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3602 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3604 inline bool
3605 gimple_call_alloca_for_var_p (gcall *s)
3607 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3610 inline bool
3611 gimple_call_alloca_for_var_p (gimple *s)
3613 const gcall *gc = GIMPLE_CHECK2<gcall *> (s);
3614 return (gc->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3617 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3618 pointers to nested function are descriptors instead of trampolines. */
3620 inline void
3621 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3623 if (by_descriptor_p)
3624 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3625 else
3626 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3629 /* Return true if S is a by-descriptor call. */
3631 inline bool
3632 gimple_call_by_descriptor_p (gcall *s)
3634 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3637 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3639 inline void
3640 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3642 dest_call->subcode = orig_call->subcode;
3646 /* Return a pointer to the points-to solution for the set of call-used
3647 variables of the call CALL_STMT. */
3649 inline struct pt_solution *
3650 gimple_call_use_set (gcall *call_stmt)
3652 return &call_stmt->call_used;
3655 /* As above, but const. */
3657 inline const pt_solution *
3658 gimple_call_use_set (const gcall *call_stmt)
3660 return &call_stmt->call_used;
3663 /* Return a pointer to the points-to solution for the set of call-used
3664 variables of the call CALL_STMT. */
3666 inline struct pt_solution *
3667 gimple_call_clobber_set (gcall *call_stmt)
3669 return &call_stmt->call_clobbered;
3672 /* As above, but const. */
3674 inline const pt_solution *
3675 gimple_call_clobber_set (const gcall *call_stmt)
3677 return &call_stmt->call_clobbered;
3681 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3682 non-NULL lhs. */
3684 inline bool
3685 gimple_has_lhs (const gimple *stmt)
3687 if (is_gimple_assign (stmt))
3688 return true;
3689 if (const gcall *call = dyn_cast <const gcall *> (stmt))
3690 return gimple_call_lhs (call) != NULL_TREE;
3691 return false;
3695 /* Return the code of the predicate computed by conditional statement GS. */
3697 inline enum tree_code
3698 gimple_cond_code (const gcond *gs)
3700 return (enum tree_code) gs->subcode;
3703 inline enum tree_code
3704 gimple_cond_code (const gimple *gs)
3706 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3707 return gimple_cond_code (gc);
3711 /* Set CODE to be the predicate code for the conditional statement GS. */
3713 inline void
3714 gimple_cond_set_code (gcond *gs, enum tree_code code)
3716 gs->subcode = code;
3720 /* Return the LHS of the predicate computed by conditional statement GS. */
3722 inline tree
3723 gimple_cond_lhs (const gcond *gs)
3725 return gs->op[0];
3728 inline tree
3729 gimple_cond_lhs (const gimple *gs)
3731 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3732 return gimple_cond_lhs (gc);
3735 /* Return the pointer to the LHS of the predicate computed by conditional
3736 statement GS. */
3738 inline tree *
3739 gimple_cond_lhs_ptr (gcond *gs)
3741 return &gs->op[0];
3744 /* Set LHS to be the LHS operand of the predicate computed by
3745 conditional statement GS. */
3747 inline void
3748 gimple_cond_set_lhs (gcond *gs, tree lhs)
3750 gs->op[0] = lhs;
3754 /* Return the RHS operand of the predicate computed by conditional GS. */
3756 inline tree
3757 gimple_cond_rhs (const gcond *gs)
3759 return gs->op[1];
3762 inline tree
3763 gimple_cond_rhs (const gimple *gs)
3765 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3766 return gimple_cond_rhs (gc);
3769 /* Return the pointer to the RHS operand of the predicate computed by
3770 conditional GS. */
3772 inline tree *
3773 gimple_cond_rhs_ptr (gcond *gs)
3775 return &gs->op[1];
3779 /* Set RHS to be the RHS operand of the predicate computed by
3780 conditional statement GS. */
3782 inline void
3783 gimple_cond_set_rhs (gcond *gs, tree rhs)
3785 gs->op[1] = rhs;
3789 /* Return the label used by conditional statement GS when its
3790 predicate evaluates to true. */
3792 inline tree
3793 gimple_cond_true_label (const gcond *gs)
3795 return gs->op[2];
3799 /* Set LABEL to be the label used by conditional statement GS when its
3800 predicate evaluates to true. */
3802 inline void
3803 gimple_cond_set_true_label (gcond *gs, tree label)
3805 gs->op[2] = label;
3809 /* Set LABEL to be the label used by conditional statement GS when its
3810 predicate evaluates to false. */
3812 inline void
3813 gimple_cond_set_false_label (gcond *gs, tree label)
3815 gs->op[3] = label;
3819 /* Return the label used by conditional statement GS when its
3820 predicate evaluates to false. */
3822 inline tree
3823 gimple_cond_false_label (const gcond *gs)
3825 return gs->op[3];
3829 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3831 inline void
3832 gimple_cond_make_false (gcond *gs)
3834 gimple_cond_set_lhs (gs, boolean_false_node);
3835 gimple_cond_set_rhs (gs, boolean_false_node);
3836 gs->subcode = NE_EXPR;
3840 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3842 inline void
3843 gimple_cond_make_true (gcond *gs)
3845 gimple_cond_set_lhs (gs, boolean_true_node);
3846 gimple_cond_set_rhs (gs, boolean_false_node);
3847 gs->subcode = NE_EXPR;
3850 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3851 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3853 inline bool
3854 gimple_cond_true_p (const gcond *gs)
3856 tree lhs = gimple_cond_lhs (gs);
3857 tree rhs = gimple_cond_rhs (gs);
3858 enum tree_code code = gimple_cond_code (gs);
3860 if (lhs != boolean_true_node && lhs != boolean_false_node)
3861 return false;
3863 if (rhs != boolean_true_node && rhs != boolean_false_node)
3864 return false;
3866 if (code == NE_EXPR && lhs != rhs)
3867 return true;
3869 if (code == EQ_EXPR && lhs == rhs)
3870 return true;
3872 return false;
3875 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3876 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3878 inline bool
3879 gimple_cond_false_p (const gcond *gs)
3881 tree lhs = gimple_cond_lhs (gs);
3882 tree rhs = gimple_cond_rhs (gs);
3883 enum tree_code code = gimple_cond_code (gs);
3885 if (lhs != boolean_true_node && lhs != boolean_false_node)
3886 return false;
3888 if (rhs != boolean_true_node && rhs != boolean_false_node)
3889 return false;
3891 if (code == NE_EXPR && lhs == rhs)
3892 return true;
3894 if (code == EQ_EXPR && lhs != rhs)
3895 return true;
3897 return false;
3900 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3902 inline void
3903 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3904 tree rhs)
3906 gimple_cond_set_code (stmt, code);
3907 gimple_cond_set_lhs (stmt, lhs);
3908 gimple_cond_set_rhs (stmt, rhs);
3912 /* Return the tree code for the expression computed by STMT. This is
3913 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3914 GIMPLE_CALL, return CALL_EXPR as the expression code for
3915 consistency. This is useful when the caller needs to deal with the
3916 three kinds of computation that GIMPLE supports. */
3918 inline enum tree_code
3919 gimple_expr_code (const gimple *stmt)
3921 if (const gassign *ass = dyn_cast<const gassign *> (stmt))
3922 return gimple_assign_rhs_code (ass);
3923 if (const gcond *cond = dyn_cast<const gcond *> (stmt))
3924 return gimple_cond_code (cond);
3925 else
3927 gcc_gimple_checking_assert (gimple_code (stmt) == GIMPLE_CALL);
3928 return CALL_EXPR;
3933 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3935 inline tree
3936 gimple_label_label (const glabel *gs)
3938 return gs->op[0];
3942 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3943 GS. */
3945 inline void
3946 gimple_label_set_label (glabel *gs, tree label)
3948 gs->op[0] = label;
3952 /* Return the destination of the unconditional jump GS. */
3954 inline tree
3955 gimple_goto_dest (const gimple *gs)
3957 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3958 return gimple_op (gs, 0);
3962 /* Set DEST to be the destination of the unconditonal jump GS. */
3964 inline void
3965 gimple_goto_set_dest (ggoto *gs, tree dest)
3967 gs->op[0] = dest;
3971 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3973 inline tree
3974 gimple_bind_vars (const gbind *bind_stmt)
3976 return bind_stmt->vars;
3980 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3981 statement GS. */
3983 inline void
3984 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3986 bind_stmt->vars = vars;
3990 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3991 statement GS. */
3993 inline void
3994 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3996 bind_stmt->vars = chainon (bind_stmt->vars, vars);
4000 inline gimple_seq *
4001 gimple_bind_body_ptr (gbind *bind_stmt)
4003 return &bind_stmt->body;
4006 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
4008 inline gimple_seq
4009 gimple_bind_body (const gbind *gs)
4011 return *gimple_bind_body_ptr (const_cast <gbind *> (gs));
4015 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
4016 statement GS. */
4018 inline void
4019 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
4021 bind_stmt->body = seq;
4025 /* Append a statement to the end of a GIMPLE_BIND's body. */
4027 inline void
4028 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
4030 gimple_seq_add_stmt (&bind_stmt->body, stmt);
4034 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
4036 inline void
4037 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
4039 gimple_seq_add_seq (&bind_stmt->body, seq);
4043 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4044 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4046 inline tree
4047 gimple_bind_block (const gbind *bind_stmt)
4049 return bind_stmt->block;
4053 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4054 statement GS. */
4056 inline void
4057 gimple_bind_set_block (gbind *bind_stmt, tree block)
4059 gcc_gimple_checking_assert (block == NULL_TREE
4060 || TREE_CODE (block) == BLOCK);
4061 bind_stmt->block = block;
4065 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4067 inline unsigned
4068 gimple_asm_ninputs (const gasm *asm_stmt)
4070 return asm_stmt->ni;
4074 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4076 inline unsigned
4077 gimple_asm_noutputs (const gasm *asm_stmt)
4079 return asm_stmt->no;
4083 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4085 inline unsigned
4086 gimple_asm_nclobbers (const gasm *asm_stmt)
4088 return asm_stmt->nc;
4091 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4093 inline unsigned
4094 gimple_asm_nlabels (const gasm *asm_stmt)
4096 return asm_stmt->nl;
4099 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4101 inline tree
4102 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
4104 gcc_gimple_checking_assert (index < asm_stmt->ni);
4105 return asm_stmt->op[index + asm_stmt->no];
4108 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4110 inline void
4111 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
4113 gcc_gimple_checking_assert (index < asm_stmt->ni
4114 && TREE_CODE (in_op) == TREE_LIST);
4115 asm_stmt->op[index + asm_stmt->no] = in_op;
4119 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4121 inline tree
4122 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
4124 gcc_gimple_checking_assert (index < asm_stmt->no);
4125 return asm_stmt->op[index];
4128 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4130 inline void
4131 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
4133 gcc_gimple_checking_assert (index < asm_stmt->no
4134 && TREE_CODE (out_op) == TREE_LIST);
4135 asm_stmt->op[index] = out_op;
4139 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4141 inline tree
4142 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
4144 gcc_gimple_checking_assert (index < asm_stmt->nc);
4145 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
4149 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4151 inline void
4152 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
4154 gcc_gimple_checking_assert (index < asm_stmt->nc
4155 && TREE_CODE (clobber_op) == TREE_LIST);
4156 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
4159 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4161 inline tree
4162 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
4164 gcc_gimple_checking_assert (index < asm_stmt->nl);
4165 return asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc];
4168 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4170 inline void
4171 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
4173 gcc_gimple_checking_assert (index < asm_stmt->nl
4174 && TREE_CODE (label_op) == TREE_LIST);
4175 asm_stmt->op[index + asm_stmt->no + asm_stmt->ni + asm_stmt->nc] = label_op;
4178 /* Return the string representing the assembly instruction in
4179 GIMPLE_ASM ASM_STMT. */
4181 inline const char *
4182 gimple_asm_string (const gasm *asm_stmt)
4184 return asm_stmt->string;
4188 /* Return true if ASM_STMT is marked volatile. */
4190 inline bool
4191 gimple_asm_volatile_p (const gasm *asm_stmt)
4193 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
4197 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4199 inline void
4200 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
4202 if (volatile_p)
4203 asm_stmt->subcode |= GF_ASM_VOLATILE;
4204 else
4205 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
4209 /* Return true if ASM_STMT is marked inline. */
4211 inline bool
4212 gimple_asm_inline_p (const gasm *asm_stmt)
4214 return (asm_stmt->subcode & GF_ASM_INLINE) != 0;
4218 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4220 inline void
4221 gimple_asm_set_inline (gasm *asm_stmt, bool inline_p)
4223 if (inline_p)
4224 asm_stmt->subcode |= GF_ASM_INLINE;
4225 else
4226 asm_stmt->subcode &= ~GF_ASM_INLINE;
4230 /* Mark whether asm ASM_STMT is a basic asm or an extended asm, based on
4231 BASIC_P. */
4233 inline void
4234 gimple_asm_set_basic (gasm *asm_stmt, bool basic_p)
4236 if (basic_p)
4237 asm_stmt->subcode |= GF_ASM_BASIC;
4238 else
4239 asm_stmt->subcode &= ~GF_ASM_BASIC;
4243 /* Return true if asm ASM_STMT is a basic asm rather than an extended asm. */
4245 inline bool
4246 gimple_asm_basic_p (const gasm *asm_stmt)
4248 return (asm_stmt->subcode & GF_ASM_BASIC) != 0;
4252 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4254 inline tree
4255 gimple_catch_types (const gcatch *catch_stmt)
4257 return catch_stmt->types;
4261 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4263 inline tree *
4264 gimple_catch_types_ptr (gcatch *catch_stmt)
4266 return &catch_stmt->types;
4270 /* Return a pointer to the GIMPLE sequence representing the body of
4271 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4273 inline gimple_seq *
4274 gimple_catch_handler_ptr (gcatch *catch_stmt)
4276 return &catch_stmt->handler;
4280 /* Return the GIMPLE sequence representing the body of the handler of
4281 GIMPLE_CATCH statement CATCH_STMT. */
4283 inline gimple_seq
4284 gimple_catch_handler (const gcatch *catch_stmt)
4286 return *gimple_catch_handler_ptr (const_cast <gcatch *> (catch_stmt));
4290 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4292 inline void
4293 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4295 catch_stmt->types = t;
4299 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4301 inline void
4302 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4304 catch_stmt->handler = handler;
4308 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4310 inline tree
4311 gimple_eh_filter_types (const gimple *gs)
4313 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4314 return eh_filter_stmt->types;
4318 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4319 GS. */
4321 inline tree *
4322 gimple_eh_filter_types_ptr (gimple *gs)
4324 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4325 return &eh_filter_stmt->types;
4329 /* Return a pointer to the sequence of statement to execute when
4330 GIMPLE_EH_FILTER statement fails. */
4332 inline gimple_seq *
4333 gimple_eh_filter_failure_ptr (gimple *gs)
4335 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4336 return &eh_filter_stmt->failure;
4340 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4341 statement fails. */
4343 inline gimple_seq
4344 gimple_eh_filter_failure (const gimple *gs)
4346 return *gimple_eh_filter_failure_ptr (const_cast <gimple *> (gs));
4350 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4351 EH_FILTER_STMT. */
4353 inline void
4354 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4356 eh_filter_stmt->types = types;
4360 /* Set FAILURE to be the sequence of statements to execute on failure
4361 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4363 inline void
4364 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4365 gimple_seq failure)
4367 eh_filter_stmt->failure = failure;
4370 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4372 inline tree
4373 gimple_eh_must_not_throw_fndecl (const geh_mnt *eh_mnt_stmt)
4375 return eh_mnt_stmt->fndecl;
4378 /* Set the function decl to be called by GS to DECL. */
4380 inline void
4381 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4382 tree decl)
4384 eh_mnt_stmt->fndecl = decl;
4387 /* GIMPLE_EH_ELSE accessors. */
4389 inline gimple_seq *
4390 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4392 return &eh_else_stmt->n_body;
4395 inline gimple_seq
4396 gimple_eh_else_n_body (const geh_else *eh_else_stmt)
4398 return *gimple_eh_else_n_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4401 inline gimple_seq *
4402 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4404 return &eh_else_stmt->e_body;
4407 inline gimple_seq
4408 gimple_eh_else_e_body (const geh_else *eh_else_stmt)
4410 return *gimple_eh_else_e_body_ptr (const_cast <geh_else *> (eh_else_stmt));
4413 inline void
4414 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4416 eh_else_stmt->n_body = seq;
4419 inline void
4420 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4422 eh_else_stmt->e_body = seq;
4425 /* GIMPLE_TRY accessors. */
4427 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4428 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4430 inline enum gimple_try_flags
4431 gimple_try_kind (const gimple *gs)
4433 GIMPLE_CHECK (gs, GIMPLE_TRY);
4434 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4438 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4440 inline void
4441 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4443 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4444 || kind == GIMPLE_TRY_FINALLY);
4445 if (gimple_try_kind (gs) != kind)
4446 gs->subcode = (unsigned int) kind;
4450 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4452 inline bool
4453 gimple_try_catch_is_cleanup (const gimple *gs)
4455 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4456 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4460 /* Return a pointer to the sequence of statements used as the
4461 body for GIMPLE_TRY GS. */
4463 inline gimple_seq *
4464 gimple_try_eval_ptr (gimple *gs)
4466 gtry *try_stmt = as_a <gtry *> (gs);
4467 return &try_stmt->eval;
4471 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4473 inline gimple_seq
4474 gimple_try_eval (const gimple *gs)
4476 return *gimple_try_eval_ptr (const_cast <gimple *> (gs));
4480 /* Return a pointer to the sequence of statements used as the cleanup body for
4481 GIMPLE_TRY GS. */
4483 inline gimple_seq *
4484 gimple_try_cleanup_ptr (gimple *gs)
4486 gtry *try_stmt = as_a <gtry *> (gs);
4487 return &try_stmt->cleanup;
4491 /* Return the sequence of statements used as the cleanup body for
4492 GIMPLE_TRY GS. */
4494 inline gimple_seq
4495 gimple_try_cleanup (const gimple *gs)
4497 return *gimple_try_cleanup_ptr (const_cast <gimple *> (gs));
4501 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4503 inline void
4504 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4506 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4507 if (catch_is_cleanup)
4508 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4509 else
4510 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4514 /* Set EVAL to be the sequence of statements to use as the body for
4515 GIMPLE_TRY TRY_STMT. */
4517 inline void
4518 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4520 try_stmt->eval = eval;
4524 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4525 body for GIMPLE_TRY TRY_STMT. */
4527 inline void
4528 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4530 try_stmt->cleanup = cleanup;
4534 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4536 inline gimple_seq *
4537 gimple_wce_cleanup_ptr (gimple *gs)
4539 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4540 return &wce_stmt->cleanup;
4544 /* Return the cleanup sequence for cleanup statement GS. */
4546 inline gimple_seq
4547 gimple_wce_cleanup (gimple *gs)
4549 return *gimple_wce_cleanup_ptr (gs);
4553 /* Set CLEANUP to be the cleanup sequence for GS. */
4555 inline void
4556 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4558 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4559 wce_stmt->cleanup = cleanup;
4563 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4565 inline bool
4566 gimple_wce_cleanup_eh_only (const gimple *gs)
4568 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4569 return gs->subcode != 0;
4573 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4575 inline void
4576 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4578 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4579 gs->subcode = (unsigned int) eh_only_p;
4583 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4585 inline unsigned
4586 gimple_phi_capacity (const gimple *gs)
4588 const gphi *phi_stmt = as_a <const gphi *> (gs);
4589 return phi_stmt->capacity;
4593 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4594 be exactly the number of incoming edges for the basic block holding
4595 GS. */
4597 inline unsigned
4598 gimple_phi_num_args (const gimple *gs)
4600 const gphi *phi_stmt = as_a <const gphi *> (gs);
4601 return phi_stmt->nargs;
4605 /* Return the SSA name created by GIMPLE_PHI GS. */
4607 inline tree
4608 gimple_phi_result (const gphi *gs)
4610 return gs->result;
4613 inline tree
4614 gimple_phi_result (const gimple *gs)
4616 const gphi *phi_stmt = as_a <const gphi *> (gs);
4617 return gimple_phi_result (phi_stmt);
4620 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4622 inline tree *
4623 gimple_phi_result_ptr (gphi *gs)
4625 return &gs->result;
4628 inline tree *
4629 gimple_phi_result_ptr (gimple *gs)
4631 gphi *phi_stmt = as_a <gphi *> (gs);
4632 return gimple_phi_result_ptr (phi_stmt);
4635 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4637 inline void
4638 gimple_phi_set_result (gphi *phi, tree result)
4640 phi->result = result;
4641 if (result && TREE_CODE (result) == SSA_NAME)
4642 SSA_NAME_DEF_STMT (result) = phi;
4646 /* Return the PHI argument corresponding to incoming edge INDEX for
4647 GIMPLE_PHI GS. */
4649 inline struct phi_arg_d *
4650 gimple_phi_arg (gphi *gs, unsigned index)
4652 gcc_gimple_checking_assert (index < gs->nargs);
4653 return &(gs->args[index]);
4656 inline const phi_arg_d *
4657 gimple_phi_arg (const gphi *gs, unsigned index)
4659 gcc_gimple_checking_assert (index < gs->nargs);
4660 return &(gs->args[index]);
4663 inline const phi_arg_d *
4664 gimple_phi_arg (const gimple *gs, unsigned index)
4666 const gphi *phi_stmt = as_a <const gphi *> (gs);
4667 return gimple_phi_arg (phi_stmt, index);
4670 inline struct phi_arg_d *
4671 gimple_phi_arg (gimple *gs, unsigned index)
4673 gphi *phi_stmt = as_a <gphi *> (gs);
4674 return gimple_phi_arg (phi_stmt, index);
4677 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4678 for GIMPLE_PHI PHI. */
4680 inline void
4681 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4683 gcc_gimple_checking_assert (index < phi->nargs);
4684 phi->args[index] = *phiarg;
4687 /* Return the PHI nodes for basic block BB, or NULL if there are no
4688 PHI nodes. */
4690 inline gimple_seq
4691 phi_nodes (const_basic_block bb)
4693 gcc_checking_assert (!(bb->flags & BB_RTL));
4694 return bb->il.gimple.phi_nodes;
4697 /* Return a pointer to the PHI nodes for basic block BB. */
4699 inline gimple_seq *
4700 phi_nodes_ptr (basic_block bb)
4702 gcc_checking_assert (!(bb->flags & BB_RTL));
4703 return &bb->il.gimple.phi_nodes;
4706 /* Return the tree operand for argument I of PHI node GS. */
4708 inline tree
4709 gimple_phi_arg_def (const gphi *gs, size_t index)
4711 return gimple_phi_arg (gs, index)->def;
4714 inline tree
4715 gimple_phi_arg_def (const gimple *gs, size_t index)
4717 return gimple_phi_arg (gs, index)->def;
4720 /* Return the tree operand for the argument associated with
4721 edge E of PHI node GS. */
4723 inline tree
4724 gimple_phi_arg_def_from_edge (const gphi *gs, const_edge e)
4726 gcc_checking_assert (e->dest == gimple_bb (gs));
4727 return gimple_phi_arg (gs, e->dest_idx)->def;
4730 inline tree
4731 gimple_phi_arg_def_from_edge (const gimple *gs, const_edge e)
4733 gcc_checking_assert (e->dest == gimple_bb (gs));
4734 return gimple_phi_arg (gs, e->dest_idx)->def;
4737 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4739 inline tree *
4740 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4742 return &gimple_phi_arg (phi, index)->def;
4745 /* Return the edge associated with argument I of phi node PHI. */
4747 inline edge
4748 gimple_phi_arg_edge (const gphi *phi, size_t i)
4750 return EDGE_PRED (gimple_bb (phi), i);
4753 /* Return the source location of gimple argument I of phi node PHI. */
4755 inline location_t
4756 gimple_phi_arg_location (const gphi *phi, size_t i)
4758 return gimple_phi_arg (phi, i)->locus;
4761 /* Return the source location of the argument on edge E of phi node PHI. */
4763 inline location_t
4764 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4766 return gimple_phi_arg (phi, e->dest_idx)->locus;
4769 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4771 inline void
4772 gimple_phi_arg_set_location (gphi *phi, size_t i, location_t loc)
4774 gimple_phi_arg (phi, i)->locus = loc;
4777 /* Return address of source location of gimple argument I of phi node PHI. */
4779 inline location_t *
4780 gimple_phi_arg_location_ptr (gphi *phi, size_t i)
4782 return &gimple_phi_arg (phi, i)->locus;
4785 /* Return TRUE if argument I of phi node PHI has a location record. */
4787 inline bool
4788 gimple_phi_arg_has_location (const gphi *phi, size_t i)
4790 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4793 /* Return the number of arguments that can be accessed by gimple_arg. */
4795 inline unsigned
4796 gimple_num_args (const gimple *gs)
4798 if (auto phi = dyn_cast<const gphi *> (gs))
4799 return gimple_phi_num_args (phi);
4800 if (auto call = dyn_cast<const gcall *> (gs))
4801 return gimple_call_num_args (call);
4802 return gimple_num_ops (as_a <const gassign *> (gs)) - 1;
4805 /* GS must be an assignment, a call, or a PHI.
4806 If it's an assignment, return rhs operand I.
4807 If it's a call, return function argument I.
4808 If it's a PHI, return the value of PHI argument I. */
4810 inline tree
4811 gimple_arg (const gimple *gs, unsigned int i)
4813 if (auto phi = dyn_cast<const gphi *> (gs))
4814 return gimple_phi_arg_def (phi, i);
4815 if (auto call = dyn_cast<const gcall *> (gs))
4816 return gimple_call_arg (call, i);
4817 return gimple_op (as_a <const gassign *> (gs), i + 1);
4820 /* Return a pointer to gimple_arg (GS, I). */
4822 inline tree *
4823 gimple_arg_ptr (gimple *gs, unsigned int i)
4825 if (auto phi = dyn_cast<gphi *> (gs))
4826 return gimple_phi_arg_def_ptr (phi, i);
4827 if (auto call = dyn_cast<gcall *> (gs))
4828 return gimple_call_arg_ptr (call, i);
4829 return gimple_op_ptr (as_a <gassign *> (gs), i + 1);
4832 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4834 inline int
4835 gimple_resx_region (const gresx *resx_stmt)
4837 return resx_stmt->region;
4840 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4842 inline void
4843 gimple_resx_set_region (gresx *resx_stmt, int region)
4845 resx_stmt->region = region;
4848 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4850 inline int
4851 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4853 return eh_dispatch_stmt->region;
4856 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4857 EH_DISPATCH_STMT. */
4859 inline void
4860 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4862 eh_dispatch_stmt->region = region;
4865 /* Return the number of labels associated with the switch statement GS. */
4867 inline unsigned
4868 gimple_switch_num_labels (const gswitch *gs)
4870 unsigned num_ops;
4871 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4872 num_ops = gimple_num_ops (gs);
4873 gcc_gimple_checking_assert (num_ops > 1);
4874 return num_ops - 1;
4878 /* Set NLABELS to be the number of labels for the switch statement GS. */
4880 inline void
4881 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4883 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4884 gimple_set_num_ops (g, nlabels + 1);
4888 /* Return the index variable used by the switch statement GS. */
4890 inline tree
4891 gimple_switch_index (const gswitch *gs)
4893 return gs->op[0];
4897 /* Return a pointer to the index variable for the switch statement GS. */
4899 inline tree *
4900 gimple_switch_index_ptr (gswitch *gs)
4902 return &gs->op[0];
4906 /* Set INDEX to be the index variable for switch statement GS. */
4908 inline void
4909 gimple_switch_set_index (gswitch *gs, tree index)
4911 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4912 gs->op[0] = index;
4916 /* Return the label numbered INDEX. The default label is 0, followed by any
4917 labels in a switch statement. */
4919 inline tree
4920 gimple_switch_label (const gswitch *gs, unsigned index)
4922 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4923 return gs->op[index + 1];
4926 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4928 inline void
4929 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4931 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4932 && (label == NULL_TREE
4933 || TREE_CODE (label) == CASE_LABEL_EXPR));
4934 gs->op[index + 1] = label;
4937 /* Return the default label for a switch statement. */
4939 inline tree
4940 gimple_switch_default_label (const gswitch *gs)
4942 tree label = gimple_switch_label (gs, 0);
4943 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4944 return label;
4947 /* Set the default label for a switch statement. */
4949 inline void
4950 gimple_switch_set_default_label (gswitch *gs, tree label)
4952 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4953 gimple_switch_set_label (gs, 0, label);
4956 /* Return true if GS is a GIMPLE_DEBUG statement. */
4958 inline bool
4959 is_gimple_debug (const gimple *gs)
4961 return gimple_code (gs) == GIMPLE_DEBUG;
4965 /* Return the first nondebug statement in GIMPLE sequence S. */
4967 inline gimple *
4968 gimple_seq_first_nondebug_stmt (gimple_seq s)
4970 gimple_seq_node n = gimple_seq_first (s);
4971 while (n && is_gimple_debug (n))
4972 n = n->next;
4973 return n;
4977 /* Return the last nondebug statement in GIMPLE sequence S. */
4979 inline gimple *
4980 gimple_seq_last_nondebug_stmt (gimple_seq s)
4982 gimple_seq_node n;
4983 for (n = gimple_seq_last (s);
4984 n && is_gimple_debug (n);
4985 n = n->prev)
4986 if (n == s)
4987 return NULL;
4988 return n;
4992 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4994 inline bool
4995 gimple_debug_bind_p (const gimple *s)
4997 if (is_gimple_debug (s))
4998 return s->subcode == GIMPLE_DEBUG_BIND;
5000 return false;
5003 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
5005 inline tree
5006 gimple_debug_bind_get_var (const gimple *dbg)
5008 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5009 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5010 return gimple_op (dbg, 0);
5013 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
5014 statement. */
5016 inline tree
5017 gimple_debug_bind_get_value (const gimple *dbg)
5019 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5020 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5021 return gimple_op (dbg, 1);
5024 /* Return a pointer to the value bound to the variable in a
5025 GIMPLE_DEBUG bind statement. */
5027 inline tree *
5028 gimple_debug_bind_get_value_ptr (gimple *dbg)
5030 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5031 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5032 return gimple_op_ptr (dbg, 1);
5035 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
5037 inline void
5038 gimple_debug_bind_set_var (gimple *dbg, tree var)
5040 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5041 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5042 gimple_set_op (dbg, 0, var);
5045 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
5046 statement. */
5048 inline void
5049 gimple_debug_bind_set_value (gimple *dbg, tree value)
5051 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5052 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5053 gimple_set_op (dbg, 1, value);
5056 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
5057 optimized away. */
5058 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
5060 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
5061 statement. */
5063 inline void
5064 gimple_debug_bind_reset_value (gimple *dbg)
5066 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5067 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5068 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
5071 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
5072 value. */
5074 inline bool
5075 gimple_debug_bind_has_value_p (gimple *dbg)
5077 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5078 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
5079 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
5082 #undef GIMPLE_DEBUG_BIND_NOVALUE
5084 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
5086 inline bool
5087 gimple_debug_source_bind_p (const gimple *s)
5089 if (is_gimple_debug (s))
5090 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
5092 return false;
5095 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
5097 inline tree
5098 gimple_debug_source_bind_get_var (const gimple *dbg)
5100 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5101 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5102 return gimple_op (dbg, 0);
5105 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
5106 statement. */
5108 inline tree
5109 gimple_debug_source_bind_get_value (const gimple *dbg)
5111 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5112 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5113 return gimple_op (dbg, 1);
5116 /* Return a pointer to the value bound to the variable in a
5117 GIMPLE_DEBUG source bind statement. */
5119 inline tree *
5120 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
5122 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5123 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5124 return gimple_op_ptr (dbg, 1);
5127 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
5129 inline void
5130 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
5132 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5133 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5134 gimple_set_op (dbg, 0, var);
5137 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5138 statement. */
5140 inline void
5141 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
5143 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
5144 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
5145 gimple_set_op (dbg, 1, value);
5148 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5150 inline bool
5151 gimple_debug_begin_stmt_p (const gimple *s)
5153 if (is_gimple_debug (s))
5154 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT;
5156 return false;
5159 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5161 inline bool
5162 gimple_debug_inline_entry_p (const gimple *s)
5164 if (is_gimple_debug (s))
5165 return s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5167 return false;
5170 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5172 inline bool
5173 gimple_debug_nonbind_marker_p (const gimple *s)
5175 if (is_gimple_debug (s))
5176 return s->subcode == GIMPLE_DEBUG_BEGIN_STMT
5177 || s->subcode == GIMPLE_DEBUG_INLINE_ENTRY;
5179 return false;
5182 /* Return the line number for EXPR, or return -1 if we have no line
5183 number information for it. */
5184 inline int
5185 get_lineno (const gimple *stmt)
5187 location_t loc;
5189 if (!stmt)
5190 return -1;
5192 loc = gimple_location (stmt);
5193 if (loc == UNKNOWN_LOCATION)
5194 return -1;
5196 return LOCATION_LINE (loc);
5199 /* Return a pointer to the body for the OMP statement GS. */
5201 inline gimple_seq *
5202 gimple_omp_body_ptr (gimple *gs)
5204 return &static_cast <gimple_statement_omp *> (gs)->body;
5207 /* Return the body for the OMP statement GS. */
5209 inline gimple_seq
5210 gimple_omp_body (const gimple *gs)
5212 return *gimple_omp_body_ptr (const_cast <gimple *> (gs));
5215 /* Set BODY to be the body for the OMP statement GS. */
5217 inline void
5218 gimple_omp_set_body (gimple *gs, gimple_seq body)
5220 static_cast <gimple_statement_omp *> (gs)->body = body;
5224 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5226 inline tree
5227 gimple_omp_critical_name (const gomp_critical *crit_stmt)
5229 return crit_stmt->name;
5233 /* Return a pointer to the name associated with OMP critical statement
5234 CRIT_STMT. */
5236 inline tree *
5237 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
5239 return &crit_stmt->name;
5243 /* Set NAME to be the name associated with OMP critical statement
5244 CRIT_STMT. */
5246 inline void
5247 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
5249 crit_stmt->name = name;
5253 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5255 inline tree
5256 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
5258 return crit_stmt->clauses;
5262 /* Return a pointer to the clauses associated with OMP critical statement
5263 CRIT_STMT. */
5265 inline tree *
5266 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
5268 return &crit_stmt->clauses;
5272 /* Set CLAUSES to be the clauses associated with OMP critical statement
5273 CRIT_STMT. */
5275 inline void
5276 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
5278 crit_stmt->clauses = clauses;
5282 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5284 inline tree
5285 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
5287 return ord_stmt->clauses;
5291 /* Return a pointer to the clauses associated with OMP ordered statement
5292 ORD_STMT. */
5294 inline tree *
5295 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
5297 return &ord_stmt->clauses;
5301 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5302 ORD_STMT. */
5304 inline void
5305 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
5307 ord_stmt->clauses = clauses;
5311 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5313 inline tree
5314 gimple_omp_scan_clauses (const gomp_scan *scan_stmt)
5316 return scan_stmt->clauses;
5320 /* Return a pointer to the clauses associated with OMP scan statement
5321 ORD_STMT. */
5323 inline tree *
5324 gimple_omp_scan_clauses_ptr (gomp_scan *scan_stmt)
5326 return &scan_stmt->clauses;
5330 /* Set CLAUSES to be the clauses associated with OMP scan statement
5331 ORD_STMT. */
5333 inline void
5334 gimple_omp_scan_set_clauses (gomp_scan *scan_stmt, tree clauses)
5336 scan_stmt->clauses = clauses;
5340 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5342 inline tree
5343 gimple_omp_taskgroup_clauses (const gimple *gs)
5345 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5346 return
5347 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5351 /* Return a pointer to the clauses associated with OMP taskgroup statement
5352 GS. */
5354 inline tree *
5355 gimple_omp_taskgroup_clauses_ptr (gimple *gs)
5357 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5358 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5362 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5363 GS. */
5365 inline void
5366 gimple_omp_taskgroup_set_clauses (gimple *gs, tree clauses)
5368 GIMPLE_CHECK (gs, GIMPLE_OMP_TASKGROUP);
5369 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5370 = clauses;
5374 /* Return the clauses associated with OMP_MASKED statement GS. */
5376 inline tree
5377 gimple_omp_masked_clauses (const gimple *gs)
5379 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5380 return
5381 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5385 /* Return a pointer to the clauses associated with OMP masked statement
5386 GS. */
5388 inline tree *
5389 gimple_omp_masked_clauses_ptr (gimple *gs)
5391 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5392 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5396 /* Set CLAUSES to be the clauses associated with OMP masked statement
5397 GS. */
5399 inline void
5400 gimple_omp_masked_set_clauses (gimple *gs, tree clauses)
5402 GIMPLE_CHECK (gs, GIMPLE_OMP_MASKED);
5403 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5404 = clauses;
5408 /* Return the clauses associated with OMP_SCOPE statement GS. */
5410 inline tree
5411 gimple_omp_scope_clauses (const gimple *gs)
5413 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5414 return
5415 static_cast <const gimple_statement_omp_single_layout *> (gs)->clauses;
5419 /* Return a pointer to the clauses associated with OMP scope statement
5420 GS. */
5422 inline tree *
5423 gimple_omp_scope_clauses_ptr (gimple *gs)
5425 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5426 return &static_cast <gimple_statement_omp_single_layout *> (gs)->clauses;
5430 /* Set CLAUSES to be the clauses associated with OMP scope statement
5431 GS. */
5433 inline void
5434 gimple_omp_scope_set_clauses (gimple *gs, tree clauses)
5436 GIMPLE_CHECK (gs, GIMPLE_OMP_SCOPE);
5437 static_cast <gimple_statement_omp_single_layout *> (gs)->clauses
5438 = clauses;
5442 /* Return the kind of the OMP_FOR statemement G. */
5444 inline int
5445 gimple_omp_for_kind (const gimple *g)
5447 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5448 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
5452 /* Set the kind of the OMP_FOR statement G. */
5454 inline void
5455 gimple_omp_for_set_kind (gomp_for *g, int kind)
5457 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
5458 | (kind & GF_OMP_FOR_KIND_MASK);
5462 /* Return true if OMP_FOR statement G has the
5463 GF_OMP_FOR_COMBINED flag set. */
5465 inline bool
5466 gimple_omp_for_combined_p (const gimple *g)
5468 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5469 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
5473 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5474 the boolean value of COMBINED_P. */
5476 inline void
5477 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
5479 if (combined_p)
5480 g->subcode |= GF_OMP_FOR_COMBINED;
5481 else
5482 g->subcode &= ~GF_OMP_FOR_COMBINED;
5486 /* Return true if the OMP_FOR statement G has the
5487 GF_OMP_FOR_COMBINED_INTO flag set. */
5489 inline bool
5490 gimple_omp_for_combined_into_p (const gimple *g)
5492 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
5493 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
5497 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5498 on the boolean value of COMBINED_P. */
5500 inline void
5501 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
5503 if (combined_p)
5504 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
5505 else
5506 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
5510 /* Return the clauses associated with the OMP_FOR statement GS. */
5512 inline tree
5513 gimple_omp_for_clauses (const gimple *gs)
5515 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5516 return omp_for_stmt->clauses;
5520 /* Return a pointer to the clauses associated with the OMP_FOR statement
5521 GS. */
5523 inline tree *
5524 gimple_omp_for_clauses_ptr (gimple *gs)
5526 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5527 return &omp_for_stmt->clauses;
5531 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5532 GS. */
5534 inline void
5535 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
5537 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5538 omp_for_stmt->clauses = clauses;
5542 /* Get the collapse count of the OMP_FOR statement GS. */
5544 inline size_t
5545 gimple_omp_for_collapse (const gimple *gs)
5547 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5548 return omp_for_stmt->collapse;
5552 /* Return the condition code associated with the OMP_FOR statement GS. */
5554 inline enum tree_code
5555 gimple_omp_for_cond (const gimple *gs, size_t i)
5557 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5558 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5559 return omp_for_stmt->iter[i].cond;
5563 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5565 inline void
5566 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5568 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5569 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5570 && i < omp_for_stmt->collapse);
5571 omp_for_stmt->iter[i].cond = cond;
5575 /* Return the index variable for the OMP_FOR statement GS. */
5577 inline tree
5578 gimple_omp_for_index (const gimple *gs, size_t i)
5580 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5581 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5582 return omp_for_stmt->iter[i].index;
5586 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5588 inline tree *
5589 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5591 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5592 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5593 return &omp_for_stmt->iter[i].index;
5597 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5599 inline void
5600 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5602 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5603 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5604 omp_for_stmt->iter[i].index = index;
5608 /* Return the initial value for the OMP_FOR statement GS. */
5610 inline tree
5611 gimple_omp_for_initial (const gimple *gs, size_t i)
5613 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5614 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5615 return omp_for_stmt->iter[i].initial;
5619 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5621 inline tree *
5622 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5624 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5625 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5626 return &omp_for_stmt->iter[i].initial;
5630 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5632 inline void
5633 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5635 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5636 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5637 omp_for_stmt->iter[i].initial = initial;
5641 /* Return the final value for the OMP_FOR statement GS. */
5643 inline tree
5644 gimple_omp_for_final (const gimple *gs, size_t i)
5646 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5647 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5648 return omp_for_stmt->iter[i].final;
5652 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5654 inline tree *
5655 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5657 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5658 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5659 return &omp_for_stmt->iter[i].final;
5663 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5665 inline void
5666 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5668 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5669 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5670 omp_for_stmt->iter[i].final = final;
5674 /* Return the increment value for the OMP_FOR statement GS. */
5676 inline tree
5677 gimple_omp_for_incr (const gimple *gs, size_t i)
5679 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5680 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5681 return omp_for_stmt->iter[i].incr;
5685 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5687 inline tree *
5688 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5690 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5691 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5692 return &omp_for_stmt->iter[i].incr;
5696 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5698 inline void
5699 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5701 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5702 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5703 omp_for_stmt->iter[i].incr = incr;
5707 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5708 statement GS starts. */
5710 inline gimple_seq *
5711 gimple_omp_for_pre_body_ptr (gimple *gs)
5713 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5714 return &omp_for_stmt->pre_body;
5718 /* Return the sequence of statements to execute before the OMP_FOR
5719 statement GS starts. */
5721 inline gimple_seq
5722 gimple_omp_for_pre_body (const gimple *gs)
5724 return *gimple_omp_for_pre_body_ptr (const_cast <gimple *> (gs));
5728 /* Set PRE_BODY to be the sequence of statements to execute before the
5729 OMP_FOR statement GS starts. */
5731 inline void
5732 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5734 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5735 omp_for_stmt->pre_body = pre_body;
5738 /* Return the clauses associated with OMP_PARALLEL GS. */
5740 inline tree
5741 gimple_omp_parallel_clauses (const gimple *gs)
5743 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5744 return omp_parallel_stmt->clauses;
5748 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5750 inline tree *
5751 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5753 return &omp_parallel_stmt->clauses;
5757 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5759 inline void
5760 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5761 tree clauses)
5763 omp_parallel_stmt->clauses = clauses;
5767 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5769 inline tree
5770 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5772 return omp_parallel_stmt->child_fn;
5775 /* Return a pointer to the child function used to hold the body of
5776 OMP_PARALLEL_STMT. */
5778 inline tree *
5779 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5781 return &omp_parallel_stmt->child_fn;
5785 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5787 inline void
5788 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5789 tree child_fn)
5791 omp_parallel_stmt->child_fn = child_fn;
5795 /* Return the artificial argument used to send variables and values
5796 from the parent to the children threads in OMP_PARALLEL_STMT. */
5798 inline tree
5799 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5801 return omp_parallel_stmt->data_arg;
5805 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5807 inline tree *
5808 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5810 return &omp_parallel_stmt->data_arg;
5814 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5816 inline void
5817 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5818 tree data_arg)
5820 omp_parallel_stmt->data_arg = data_arg;
5823 /* Return the clauses associated with OMP_TASK GS. */
5825 inline tree
5826 gimple_omp_task_clauses (const gimple *gs)
5828 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5829 return omp_task_stmt->clauses;
5833 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5835 inline tree *
5836 gimple_omp_task_clauses_ptr (gimple *gs)
5838 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5839 return &omp_task_stmt->clauses;
5843 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5844 GS. */
5846 inline void
5847 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5849 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5850 omp_task_stmt->clauses = clauses;
5854 /* Return true if OMP task statement G has the
5855 GF_OMP_TASK_TASKLOOP flag set. */
5857 inline bool
5858 gimple_omp_task_taskloop_p (const gimple *g)
5860 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5861 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5865 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5866 value of TASKLOOP_P. */
5868 inline void
5869 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5871 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5872 if (taskloop_p)
5873 g->subcode |= GF_OMP_TASK_TASKLOOP;
5874 else
5875 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5879 /* Return true if OMP task statement G has the
5880 GF_OMP_TASK_TASKWAIT flag set. */
5882 inline bool
5883 gimple_omp_task_taskwait_p (const gimple *g)
5885 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5886 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKWAIT) != 0;
5890 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5891 value of TASKWAIT_P. */
5893 inline void
5894 gimple_omp_task_set_taskwait_p (gimple *g, bool taskwait_p)
5896 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5897 if (taskwait_p)
5898 g->subcode |= GF_OMP_TASK_TASKWAIT;
5899 else
5900 g->subcode &= ~GF_OMP_TASK_TASKWAIT;
5904 /* Return the child function used to hold the body of OMP_TASK GS. */
5906 inline tree
5907 gimple_omp_task_child_fn (const gimple *gs)
5909 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5910 return omp_task_stmt->child_fn;
5913 /* Return a pointer to the child function used to hold the body of
5914 OMP_TASK GS. */
5916 inline tree *
5917 gimple_omp_task_child_fn_ptr (gimple *gs)
5919 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5920 return &omp_task_stmt->child_fn;
5924 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5926 inline void
5927 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5929 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5930 omp_task_stmt->child_fn = child_fn;
5934 /* Return the artificial argument used to send variables and values
5935 from the parent to the children threads in OMP_TASK GS. */
5937 inline tree
5938 gimple_omp_task_data_arg (const gimple *gs)
5940 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5941 return omp_task_stmt->data_arg;
5945 /* Return a pointer to the data argument for OMP_TASK GS. */
5947 inline tree *
5948 gimple_omp_task_data_arg_ptr (gimple *gs)
5950 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5951 return &omp_task_stmt->data_arg;
5955 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5957 inline void
5958 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5960 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5961 omp_task_stmt->data_arg = data_arg;
5965 /* Return the clauses associated with OMP_TASK GS. */
5967 inline tree
5968 gimple_omp_taskreg_clauses (const gimple *gs)
5970 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5971 = as_a <const gimple_statement_omp_taskreg *> (gs);
5972 return omp_taskreg_stmt->clauses;
5976 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5978 inline tree *
5979 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5981 gimple_statement_omp_taskreg *omp_taskreg_stmt
5982 = as_a <gimple_statement_omp_taskreg *> (gs);
5983 return &omp_taskreg_stmt->clauses;
5987 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5988 GS. */
5990 inline void
5991 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5993 gimple_statement_omp_taskreg *omp_taskreg_stmt
5994 = as_a <gimple_statement_omp_taskreg *> (gs);
5995 omp_taskreg_stmt->clauses = clauses;
5999 /* Return the child function used to hold the body of OMP_TASK GS. */
6001 inline tree
6002 gimple_omp_taskreg_child_fn (const gimple *gs)
6004 const gimple_statement_omp_taskreg *omp_taskreg_stmt
6005 = as_a <const gimple_statement_omp_taskreg *> (gs);
6006 return omp_taskreg_stmt->child_fn;
6009 /* Return a pointer to the child function used to hold the body of
6010 OMP_TASK GS. */
6012 inline tree *
6013 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
6015 gimple_statement_omp_taskreg *omp_taskreg_stmt
6016 = as_a <gimple_statement_omp_taskreg *> (gs);
6017 return &omp_taskreg_stmt->child_fn;
6021 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
6023 inline void
6024 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
6026 gimple_statement_omp_taskreg *omp_taskreg_stmt
6027 = as_a <gimple_statement_omp_taskreg *> (gs);
6028 omp_taskreg_stmt->child_fn = child_fn;
6032 /* Return the artificial argument used to send variables and values
6033 from the parent to the children threads in OMP_TASK GS. */
6035 inline tree
6036 gimple_omp_taskreg_data_arg (const gimple *gs)
6038 const gimple_statement_omp_taskreg *omp_taskreg_stmt
6039 = as_a <const gimple_statement_omp_taskreg *> (gs);
6040 return omp_taskreg_stmt->data_arg;
6044 /* Return a pointer to the data argument for OMP_TASK GS. */
6046 inline tree *
6047 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
6049 gimple_statement_omp_taskreg *omp_taskreg_stmt
6050 = as_a <gimple_statement_omp_taskreg *> (gs);
6051 return &omp_taskreg_stmt->data_arg;
6055 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
6057 inline void
6058 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
6060 gimple_statement_omp_taskreg *omp_taskreg_stmt
6061 = as_a <gimple_statement_omp_taskreg *> (gs);
6062 omp_taskreg_stmt->data_arg = data_arg;
6066 /* Return the copy function used to hold the body of OMP_TASK GS. */
6068 inline tree
6069 gimple_omp_task_copy_fn (const gimple *gs)
6071 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6072 return omp_task_stmt->copy_fn;
6075 /* Return a pointer to the copy function used to hold the body of
6076 OMP_TASK GS. */
6078 inline tree *
6079 gimple_omp_task_copy_fn_ptr (gimple *gs)
6081 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6082 return &omp_task_stmt->copy_fn;
6086 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
6088 inline void
6089 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
6091 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6092 omp_task_stmt->copy_fn = copy_fn;
6096 /* Return size of the data block in bytes in OMP_TASK GS. */
6098 inline tree
6099 gimple_omp_task_arg_size (const gimple *gs)
6101 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6102 return omp_task_stmt->arg_size;
6106 /* Return a pointer to the data block size for OMP_TASK GS. */
6108 inline tree *
6109 gimple_omp_task_arg_size_ptr (gimple *gs)
6111 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6112 return &omp_task_stmt->arg_size;
6116 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
6118 inline void
6119 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
6121 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6122 omp_task_stmt->arg_size = arg_size;
6126 /* Return align of the data block in bytes in OMP_TASK GS. */
6128 inline tree
6129 gimple_omp_task_arg_align (const gimple *gs)
6131 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
6132 return omp_task_stmt->arg_align;
6136 /* Return a pointer to the data block align for OMP_TASK GS. */
6138 inline tree *
6139 gimple_omp_task_arg_align_ptr (gimple *gs)
6141 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6142 return &omp_task_stmt->arg_align;
6146 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
6148 inline void
6149 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
6151 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
6152 omp_task_stmt->arg_align = arg_align;
6156 /* Return the clauses associated with OMP_SINGLE GS. */
6158 inline tree
6159 gimple_omp_single_clauses (const gimple *gs)
6161 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
6162 return omp_single_stmt->clauses;
6166 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
6168 inline tree *
6169 gimple_omp_single_clauses_ptr (gimple *gs)
6171 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
6172 return &omp_single_stmt->clauses;
6176 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
6178 inline void
6179 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
6181 omp_single_stmt->clauses = clauses;
6185 /* Return the clauses associated with OMP_TARGET GS. */
6187 inline tree
6188 gimple_omp_target_clauses (const gimple *gs)
6190 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
6191 return omp_target_stmt->clauses;
6195 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
6197 inline tree *
6198 gimple_omp_target_clauses_ptr (gimple *gs)
6200 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
6201 return &omp_target_stmt->clauses;
6205 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6207 inline void
6208 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
6209 tree clauses)
6211 omp_target_stmt->clauses = clauses;
6215 /* Return the kind of the OMP_TARGET G. */
6217 inline int
6218 gimple_omp_target_kind (const gimple *g)
6220 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
6221 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
6225 /* Set the kind of the OMP_TARGET G. */
6227 inline void
6228 gimple_omp_target_set_kind (gomp_target *g, int kind)
6230 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
6231 | (kind & GF_OMP_TARGET_KIND_MASK);
6235 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6237 inline tree
6238 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
6240 return omp_target_stmt->child_fn;
6243 /* Return a pointer to the child function used to hold the body of
6244 OMP_TARGET_STMT. */
6246 inline tree *
6247 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
6249 return &omp_target_stmt->child_fn;
6253 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6255 inline void
6256 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
6257 tree child_fn)
6259 omp_target_stmt->child_fn = child_fn;
6263 /* Return the artificial argument used to send variables and values
6264 from the parent to the children threads in OMP_TARGET_STMT. */
6266 inline tree
6267 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
6269 return omp_target_stmt->data_arg;
6273 /* Return a pointer to the data argument for OMP_TARGET GS. */
6275 inline tree *
6276 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
6278 return &omp_target_stmt->data_arg;
6282 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6284 inline void
6285 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
6286 tree data_arg)
6288 omp_target_stmt->data_arg = data_arg;
6292 /* Return the clauses associated with OMP_TEAMS GS. */
6294 inline tree
6295 gimple_omp_teams_clauses (const gimple *gs)
6297 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
6298 return omp_teams_stmt->clauses;
6302 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6304 inline tree *
6305 gimple_omp_teams_clauses_ptr (gimple *gs)
6307 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
6308 return &omp_teams_stmt->clauses;
6312 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6314 inline void
6315 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
6317 omp_teams_stmt->clauses = clauses;
6320 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6322 inline tree
6323 gimple_omp_teams_child_fn (const gomp_teams *omp_teams_stmt)
6325 return omp_teams_stmt->child_fn;
6328 /* Return a pointer to the child function used to hold the body of
6329 OMP_TEAMS_STMT. */
6331 inline tree *
6332 gimple_omp_teams_child_fn_ptr (gomp_teams *omp_teams_stmt)
6334 return &omp_teams_stmt->child_fn;
6338 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6340 inline void
6341 gimple_omp_teams_set_child_fn (gomp_teams *omp_teams_stmt, tree child_fn)
6343 omp_teams_stmt->child_fn = child_fn;
6347 /* Return the artificial argument used to send variables and values
6348 from the parent to the children threads in OMP_TEAMS_STMT. */
6350 inline tree
6351 gimple_omp_teams_data_arg (const gomp_teams *omp_teams_stmt)
6353 return omp_teams_stmt->data_arg;
6357 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6359 inline tree *
6360 gimple_omp_teams_data_arg_ptr (gomp_teams *omp_teams_stmt)
6362 return &omp_teams_stmt->data_arg;
6366 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6368 inline void
6369 gimple_omp_teams_set_data_arg (gomp_teams *omp_teams_stmt, tree data_arg)
6371 omp_teams_stmt->data_arg = data_arg;
6374 /* Return the host flag of an OMP_TEAMS_STMT. */
6376 inline bool
6377 gimple_omp_teams_host (const gomp_teams *omp_teams_stmt)
6379 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_HOST) != 0;
6382 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6384 inline void
6385 gimple_omp_teams_set_host (gomp_teams *omp_teams_stmt, bool value)
6387 if (value)
6388 omp_teams_stmt->subcode |= GF_OMP_TEAMS_HOST;
6389 else
6390 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_HOST;
6393 /* Return the clauses associated with OMP_SECTIONS GS. */
6395 inline tree
6396 gimple_omp_sections_clauses (const gimple *gs)
6398 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6399 return omp_sections_stmt->clauses;
6403 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6405 inline tree *
6406 gimple_omp_sections_clauses_ptr (gimple *gs)
6408 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6409 return &omp_sections_stmt->clauses;
6413 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6414 GS. */
6416 inline void
6417 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
6419 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6420 omp_sections_stmt->clauses = clauses;
6424 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6425 in GS. */
6427 inline tree
6428 gimple_omp_sections_control (const gimple *gs)
6430 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
6431 return omp_sections_stmt->control;
6435 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6436 GS. */
6438 inline tree *
6439 gimple_omp_sections_control_ptr (gimple *gs)
6441 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6442 return &omp_sections_stmt->control;
6446 /* Set CONTROL to be the set of clauses associated with the
6447 GIMPLE_OMP_SECTIONS in GS. */
6449 inline void
6450 gimple_omp_sections_set_control (gimple *gs, tree control)
6452 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
6453 omp_sections_stmt->control = control;
6457 /* Set the value being stored in an atomic store. */
6459 inline void
6460 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
6462 store_stmt->val = val;
6466 /* Return the value being stored in an atomic store. */
6468 inline tree
6469 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
6471 return store_stmt->val;
6475 /* Return a pointer to the value being stored in an atomic store. */
6477 inline tree *
6478 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
6480 return &store_stmt->val;
6484 /* Set the LHS of an atomic load. */
6486 inline void
6487 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
6489 load_stmt->lhs = lhs;
6493 /* Get the LHS of an atomic load. */
6495 inline tree
6496 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
6498 return load_stmt->lhs;
6502 /* Return a pointer to the LHS of an atomic load. */
6504 inline tree *
6505 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
6507 return &load_stmt->lhs;
6511 /* Set the RHS of an atomic load. */
6513 inline void
6514 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
6516 load_stmt->rhs = rhs;
6520 /* Get the RHS of an atomic load. */
6522 inline tree
6523 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
6525 return load_stmt->rhs;
6529 /* Return a pointer to the RHS of an atomic load. */
6531 inline tree *
6532 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
6534 return &load_stmt->rhs;
6538 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6540 inline tree
6541 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6543 return cont_stmt->control_def;
6546 /* The same as above, but return the address. */
6548 inline tree *
6549 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6551 return &cont_stmt->control_def;
6554 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6556 inline void
6557 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6559 cont_stmt->control_def = def;
6563 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6565 inline tree
6566 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6568 return cont_stmt->control_use;
6572 /* The same as above, but return the address. */
6574 inline tree *
6575 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6577 return &cont_stmt->control_use;
6581 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6583 inline void
6584 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6586 cont_stmt->control_use = use;
6589 /* Return the guard associated with the GIMPLE_ASSUME statement GS. */
6591 inline tree
6592 gimple_assume_guard (const gimple *gs)
6594 const gimple_statement_assume *assume_stmt
6595 = as_a <const gimple_statement_assume *> (gs);
6596 return assume_stmt->guard;
6599 /* Set the guard associated with the GIMPLE_ASSUME statement GS. */
6601 inline void
6602 gimple_assume_set_guard (gimple *gs, tree guard)
6604 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (gs);
6605 assume_stmt->guard = guard;
6608 inline tree *
6609 gimple_assume_guard_ptr (gimple *gs)
6611 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (gs);
6612 return &assume_stmt->guard;
6615 /* Return the address of the GIMPLE sequence contained in the GIMPLE_ASSUME
6616 statement GS. */
6618 inline gimple_seq *
6619 gimple_assume_body_ptr (gimple *gs)
6621 gimple_statement_assume *assume_stmt = as_a <gimple_statement_assume *> (gs);
6622 return &assume_stmt->body;
6625 /* Return the GIMPLE sequence contained in the GIMPLE_ASSUME statement GS. */
6627 inline gimple_seq
6628 gimple_assume_body (const gimple *gs)
6630 const gimple_statement_assume *assume_stmt
6631 = as_a <const gimple_statement_assume *> (gs);
6632 return assume_stmt->body;
6635 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6636 TRANSACTION_STMT. */
6638 inline gimple_seq *
6639 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6641 return &transaction_stmt->body;
6644 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6646 inline gimple_seq
6647 gimple_transaction_body (const gtransaction *transaction_stmt)
6649 return transaction_stmt->body;
6652 /* Return the label associated with a GIMPLE_TRANSACTION. */
6654 inline tree
6655 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6657 return transaction_stmt->label_norm;
6660 inline tree *
6661 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6663 return &transaction_stmt->label_norm;
6666 inline tree
6667 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6669 return transaction_stmt->label_uninst;
6672 inline tree *
6673 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6675 return &transaction_stmt->label_uninst;
6678 inline tree
6679 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6681 return transaction_stmt->label_over;
6684 inline tree *
6685 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6687 return &transaction_stmt->label_over;
6690 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6692 inline unsigned int
6693 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6695 return transaction_stmt->subcode;
6698 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6699 TRANSACTION_STMT. */
6701 inline void
6702 gimple_transaction_set_body (gtransaction *transaction_stmt,
6703 gimple_seq body)
6705 transaction_stmt->body = body;
6708 /* Set the label associated with a GIMPLE_TRANSACTION. */
6710 inline void
6711 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6713 transaction_stmt->label_norm = label;
6716 inline void
6717 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6719 transaction_stmt->label_uninst = label;
6722 inline void
6723 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6725 transaction_stmt->label_over = label;
6728 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6730 inline void
6731 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6732 unsigned int subcode)
6734 transaction_stmt->subcode = subcode;
6737 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6739 inline tree *
6740 gimple_return_retval_ptr (greturn *gs)
6742 return &gs->op[0];
6745 /* Return the return value for GIMPLE_RETURN GS. */
6747 inline tree
6748 gimple_return_retval (const greturn *gs)
6750 return gs->op[0];
6754 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6756 inline void
6757 gimple_return_set_retval (greturn *gs, tree retval)
6759 gs->op[0] = retval;
6763 /* Returns true when the gimple statement STMT is any of the OMP types. */
6765 #define CASE_GIMPLE_OMP \
6766 case GIMPLE_OMP_PARALLEL: \
6767 case GIMPLE_OMP_TASK: \
6768 case GIMPLE_OMP_FOR: \
6769 case GIMPLE_OMP_SECTIONS: \
6770 case GIMPLE_OMP_SECTIONS_SWITCH: \
6771 case GIMPLE_OMP_SINGLE: \
6772 case GIMPLE_OMP_TARGET: \
6773 case GIMPLE_OMP_TEAMS: \
6774 case GIMPLE_OMP_SCOPE: \
6775 case GIMPLE_OMP_SECTION: \
6776 case GIMPLE_OMP_STRUCTURED_BLOCK: \
6777 case GIMPLE_OMP_MASTER: \
6778 case GIMPLE_OMP_MASKED: \
6779 case GIMPLE_OMP_TASKGROUP: \
6780 case GIMPLE_OMP_ORDERED: \
6781 case GIMPLE_OMP_CRITICAL: \
6782 case GIMPLE_OMP_SCAN: \
6783 case GIMPLE_OMP_RETURN: \
6784 case GIMPLE_OMP_ATOMIC_LOAD: \
6785 case GIMPLE_OMP_ATOMIC_STORE: \
6786 case GIMPLE_OMP_CONTINUE
6788 inline bool
6789 is_gimple_omp (const gimple *stmt)
6791 switch (gimple_code (stmt))
6793 CASE_GIMPLE_OMP:
6794 return true;
6795 default:
6796 return false;
6800 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6801 specifically. */
6803 inline bool
6804 is_gimple_omp_oacc (const gimple *stmt)
6806 gcc_assert (is_gimple_omp (stmt));
6807 switch (gimple_code (stmt))
6809 case GIMPLE_OMP_ATOMIC_LOAD:
6810 case GIMPLE_OMP_ATOMIC_STORE:
6811 case GIMPLE_OMP_CONTINUE:
6812 case GIMPLE_OMP_RETURN:
6813 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6814 the two. */
6815 gcc_unreachable ();
6817 case GIMPLE_OMP_FOR:
6818 switch (gimple_omp_for_kind (stmt))
6820 case GF_OMP_FOR_KIND_OACC_LOOP:
6821 return true;
6822 default:
6823 return false;
6825 case GIMPLE_OMP_TARGET:
6826 switch (gimple_omp_target_kind (stmt))
6828 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6829 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6830 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6831 case GF_OMP_TARGET_KIND_OACC_DATA:
6832 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6833 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
6834 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
6835 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6836 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6837 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6838 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6839 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS:
6840 return true;
6841 default:
6842 return false;
6844 default:
6845 return false;
6850 /* Return true if the OMP gimple statement STMT is offloaded. */
6852 inline bool
6853 is_gimple_omp_offloaded (const gimple *stmt)
6855 gcc_assert (is_gimple_omp (stmt));
6856 switch (gimple_code (stmt))
6858 case GIMPLE_OMP_TARGET:
6859 switch (gimple_omp_target_kind (stmt))
6861 case GF_OMP_TARGET_KIND_REGION:
6862 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6863 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6864 case GF_OMP_TARGET_KIND_OACC_SERIAL:
6865 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED:
6866 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE:
6867 return true;
6868 default:
6869 return false;
6871 default:
6872 return false;
6877 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6879 inline bool
6880 gimple_nop_p (const gimple *g)
6882 return gimple_code (g) == GIMPLE_NOP;
6886 /* Return true if GS is a GIMPLE_RESX. */
6888 inline bool
6889 is_gimple_resx (const gimple *gs)
6891 return gimple_code (gs) == GIMPLE_RESX;
6895 /* Enum and arrays used for allocation stats. Keep in sync with
6896 gimple.cc:gimple_alloc_kind_names. */
6897 enum gimple_alloc_kind
6899 gimple_alloc_kind_assign, /* Assignments. */
6900 gimple_alloc_kind_phi, /* PHI nodes. */
6901 gimple_alloc_kind_cond, /* Conditionals. */
6902 gimple_alloc_kind_rest, /* Everything else. */
6903 gimple_alloc_kind_all
6906 extern uint64_t gimple_alloc_counts[];
6907 extern uint64_t gimple_alloc_sizes[];
6909 /* Return the allocation kind for a given stmt CODE. */
6910 inline enum gimple_alloc_kind
6911 gimple_alloc_kind (enum gimple_code code)
6913 switch (code)
6915 case GIMPLE_ASSIGN:
6916 return gimple_alloc_kind_assign;
6917 case GIMPLE_PHI:
6918 return gimple_alloc_kind_phi;
6919 case GIMPLE_COND:
6920 return gimple_alloc_kind_cond;
6921 default:
6922 return gimple_alloc_kind_rest;
6926 /* Return true if a location should not be emitted for this statement
6927 by annotate_all_with_location. */
6929 inline bool
6930 gimple_do_not_emit_location_p (gimple *g)
6932 return gimple_plf (g, GF_PLF_1);
6935 /* Mark statement G so a location will not be emitted by
6936 annotate_one_with_location. */
6938 inline void
6939 gimple_set_do_not_emit_location (gimple *g)
6941 /* The PLF flags are initialized to 0 when a new tuple is created,
6942 so no need to initialize it anywhere. */
6943 gimple_set_plf (g, GF_PLF_1, true);
6946 #endif /* GCC_GIMPLE_H */