re PR fortran/68318 (ICE on duplicate entry declarations)
[official-gcc.git] / gcc / gimple.h
blobe45162d24e00e85de54338e46f8f3a025036b756
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2015 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;
51 #define GIMPLE_CHECK(GS, CODE) \
52 do { \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
57 } while (0)
58 template <typename T>
59 static inline T
60 GIMPLE_CHECK2(const gimple *gs,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file = __builtin_FILE (),
63 int line = __builtin_LINE (),
64 const char *fun = __builtin_FUNCTION ())
65 #else
66 const char *file = __FILE__,
67 int line = __LINE__,
68 const char *fun = NULL)
69 #endif
71 T ret = dyn_cast <T> (gs);
72 if (!ret)
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
75 return ret;
77 template <typename T>
78 static inline T
79 GIMPLE_CHECK2(gimple *gs,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file = __builtin_FILE (),
82 int line = __builtin_LINE (),
83 const char *fun = __builtin_FUNCTION ())
84 #else
85 const char *file = __FILE__,
86 int line = __LINE__,
87 const char *fun = NULL)
88 #endif
90 T ret = dyn_cast <T> (gs);
91 if (!ret)
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
94 return ret;
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
99 template <typename T>
100 static inline T
101 GIMPLE_CHECK2(gimple *gs)
103 return as_a <T> (gs);
105 template <typename T>
106 static inline T
107 GIMPLE_CHECK2(const gimple *gs)
109 return as_a <T> (gs);
111 #endif
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_OMP_PARALLEL_COMBINED = 1 << 0,
149 GF_OMP_TASK_TASKLOOP = 1 << 0,
150 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
151 GF_OMP_FOR_KIND_FOR = 0,
152 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
153 GF_OMP_FOR_KIND_TASKLOOP = 2,
154 GF_OMP_FOR_KIND_CILKFOR = 3,
155 GF_OMP_FOR_KIND_OACC_LOOP = 4,
156 /* Flag for SIMD variants of OMP_FOR kinds. */
157 GF_OMP_FOR_SIMD = 1 << 3,
158 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
159 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
160 GF_OMP_FOR_COMBINED = 1 << 4,
161 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
162 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
163 GF_OMP_TARGET_KIND_REGION = 0,
164 GF_OMP_TARGET_KIND_DATA = 1,
165 GF_OMP_TARGET_KIND_UPDATE = 2,
166 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
167 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
168 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
169 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
170 GF_OMP_TARGET_KIND_OACC_DATA = 7,
171 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
172 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
173 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
175 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
176 a thread synchronization via some sort of barrier. The exact barrier
177 that would otherwise be emitted is dependent on the OMP statement with
178 which this return is associated. */
179 GF_OMP_RETURN_NOWAIT = 1 << 0,
181 GF_OMP_SECTION_LAST = 1 << 0,
182 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
183 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
184 GF_PREDICT_TAKEN = 1 << 15
187 /* Currently, there are only two types of gimple debug stmt. Others are
188 envisioned, for example, to enable the generation of is_stmt notes
189 in line number information, to mark sequence points, etc. This
190 subcode is to be used to tell them apart. */
191 enum gimple_debug_subcode {
192 GIMPLE_DEBUG_BIND = 0,
193 GIMPLE_DEBUG_SOURCE_BIND = 1
196 /* Masks for selecting a pass local flag (PLF) to work on. These
197 masks are used by gimple_set_plf and gimple_plf. */
198 enum plf_mask {
199 GF_PLF_1 = 1 << 0,
200 GF_PLF_2 = 1 << 1
203 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
204 are for 64 bit hosts. */
206 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
207 chain_next ("%h.next"), variable_size))
208 gimple
210 /* [ WORD 1 ]
211 Main identifying code for a tuple. */
212 ENUM_BITFIELD(gimple_code) code : 8;
214 /* Nonzero if a warning should not be emitted on this tuple. */
215 unsigned int no_warning : 1;
217 /* Nonzero if this tuple has been visited. Passes are responsible
218 for clearing this bit before using it. */
219 unsigned int visited : 1;
221 /* Nonzero if this tuple represents a non-temporal move. */
222 unsigned int nontemporal_move : 1;
224 /* Pass local flags. These flags are free for any pass to use as
225 they see fit. Passes should not assume that these flags contain
226 any useful value when the pass starts. Any initial state that
227 the pass requires should be set on entry to the pass. See
228 gimple_set_plf and gimple_plf for usage. */
229 unsigned int plf : 2;
231 /* Nonzero if this statement has been modified and needs to have its
232 operands rescanned. */
233 unsigned modified : 1;
235 /* Nonzero if this statement contains volatile operands. */
236 unsigned has_volatile_ops : 1;
238 /* Padding to get subcode to 16 bit alignment. */
239 unsigned pad : 1;
241 /* The SUBCODE field can be used for tuple-specific flags for tuples
242 that do not require subcodes. Note that SUBCODE should be at
243 least as wide as tree codes, as several tuples store tree codes
244 in there. */
245 unsigned int subcode : 16;
247 /* UID of this statement. This is used by passes that want to
248 assign IDs to statements. It must be assigned and used by each
249 pass. By default it should be assumed to contain garbage. */
250 unsigned uid;
252 /* [ WORD 2 ]
253 Locus information for debug info. */
254 location_t location;
256 /* Number of operands in this tuple. */
257 unsigned num_ops;
259 /* [ WORD 3 ]
260 Basic block holding this statement. */
261 basic_block bb;
263 /* [ WORD 4-5 ]
264 Linked lists of gimple statements. The next pointers form
265 a NULL terminated list, the prev pointers are a cyclic list.
266 A gimple statement is hence also a double-ended list of
267 statements, with the pointer itself being the first element,
268 and the prev pointer being the last. */
269 gimple *next;
270 gimple *GTY((skip)) prev;
274 /* Base structure for tuples with operands. */
276 /* This gimple subclass has no tag value. */
277 struct GTY(())
278 gimple_statement_with_ops_base : public gimple
280 /* [ WORD 1-6 ] : base class */
282 /* [ WORD 7 ]
283 SSA operand vectors. NOTE: It should be possible to
284 amalgamate these vectors with the operand vector OP. However,
285 the SSA operand vectors are organized differently and contain
286 more information (like immediate use chaining). */
287 struct use_optype_d GTY((skip (""))) *use_ops;
291 /* Statements that take register operands. */
293 struct GTY((tag("GSS_WITH_OPS")))
294 gimple_statement_with_ops : public gimple_statement_with_ops_base
296 /* [ WORD 1-7 ] : base class */
298 /* [ WORD 8 ]
299 Operand vector. NOTE! This must always be the last field
300 of this structure. In particular, this means that this
301 structure cannot be embedded inside another one. */
302 tree GTY((length ("%h.num_ops"))) op[1];
306 /* Base for statements that take both memory and register operands. */
308 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
309 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
311 /* [ WORD 1-7 ] : base class */
313 /* [ WORD 8-9 ]
314 Virtual operands for this statement. The GC will pick them
315 up via the ssa_names array. */
316 tree GTY((skip (""))) vdef;
317 tree GTY((skip (""))) vuse;
321 /* Statements that take both memory and register operands. */
323 struct GTY((tag("GSS_WITH_MEM_OPS")))
324 gimple_statement_with_memory_ops :
325 public gimple_statement_with_memory_ops_base
327 /* [ WORD 1-9 ] : base class */
329 /* [ WORD 10 ]
330 Operand vector. NOTE! This must always be the last field
331 of this structure. In particular, this means that this
332 structure cannot be embedded inside another one. */
333 tree GTY((length ("%h.num_ops"))) op[1];
337 /* Call statements that take both memory and register operands. */
339 struct GTY((tag("GSS_CALL")))
340 gcall : public gimple_statement_with_memory_ops_base
342 /* [ WORD 1-9 ] : base class */
344 /* [ WORD 10-13 ] */
345 struct pt_solution call_used;
346 struct pt_solution call_clobbered;
348 /* [ WORD 14 ] */
349 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
350 tree GTY ((tag ("0"))) fntype;
351 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
352 } u;
354 /* [ WORD 15 ]
355 Operand vector. NOTE! This must always be the last field
356 of this structure. In particular, this means that this
357 structure cannot be embedded inside another one. */
358 tree GTY((length ("%h.num_ops"))) op[1];
360 static const enum gimple_code code_ = GIMPLE_CALL;
364 /* OMP statements. */
366 struct GTY((tag("GSS_OMP")))
367 gimple_statement_omp : public gimple
369 /* [ WORD 1-6 ] : base class */
371 /* [ WORD 7 ] */
372 gimple_seq body;
376 /* GIMPLE_BIND */
378 struct GTY((tag("GSS_BIND")))
379 gbind : public gimple
381 /* [ WORD 1-6 ] : base class */
383 /* [ WORD 7 ]
384 Variables declared in this scope. */
385 tree vars;
387 /* [ WORD 8 ]
388 This is different than the BLOCK field in gimple,
389 which is analogous to TREE_BLOCK (i.e., the lexical block holding
390 this statement). This field is the equivalent of BIND_EXPR_BLOCK
391 in tree land (i.e., the lexical scope defined by this bind). See
392 gimple-low.c. */
393 tree block;
395 /* [ WORD 9 ] */
396 gimple_seq body;
400 /* GIMPLE_CATCH */
402 struct GTY((tag("GSS_CATCH")))
403 gcatch : public gimple
405 /* [ WORD 1-6 ] : base class */
407 /* [ WORD 7 ] */
408 tree types;
410 /* [ WORD 8 ] */
411 gimple_seq handler;
415 /* GIMPLE_EH_FILTER */
417 struct GTY((tag("GSS_EH_FILTER")))
418 geh_filter : public gimple
420 /* [ WORD 1-6 ] : base class */
422 /* [ WORD 7 ]
423 Filter types. */
424 tree types;
426 /* [ WORD 8 ]
427 Failure actions. */
428 gimple_seq failure;
431 /* GIMPLE_EH_ELSE */
433 struct GTY((tag("GSS_EH_ELSE")))
434 geh_else : public gimple
436 /* [ WORD 1-6 ] : base class */
438 /* [ WORD 7,8 ] */
439 gimple_seq n_body, e_body;
442 /* GIMPLE_EH_MUST_NOT_THROW */
444 struct GTY((tag("GSS_EH_MNT")))
445 geh_mnt : public gimple
447 /* [ WORD 1-6 ] : base class */
449 /* [ WORD 7 ] Abort function decl. */
450 tree fndecl;
453 /* GIMPLE_PHI */
455 struct GTY((tag("GSS_PHI")))
456 gphi : public gimple
458 /* [ WORD 1-6 ] : base class */
460 /* [ WORD 7 ] */
461 unsigned capacity;
462 unsigned nargs;
464 /* [ WORD 8 ] */
465 tree result;
467 /* [ WORD 9 ] */
468 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
472 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
474 struct GTY((tag("GSS_EH_CTRL")))
475 gimple_statement_eh_ctrl : public gimple
477 /* [ WORD 1-6 ] : base class */
479 /* [ WORD 7 ]
480 Exception region number. */
481 int region;
484 struct GTY((tag("GSS_EH_CTRL")))
485 gresx : public gimple_statement_eh_ctrl
487 /* No extra fields; adds invariant:
488 stmt->code == GIMPLE_RESX. */
491 struct GTY((tag("GSS_EH_CTRL")))
492 geh_dispatch : public gimple_statement_eh_ctrl
494 /* No extra fields; adds invariant:
495 stmt->code == GIMPLE_EH_DISPATH. */
499 /* GIMPLE_TRY */
501 struct GTY((tag("GSS_TRY")))
502 gtry : public gimple
504 /* [ WORD 1-6 ] : base class */
506 /* [ WORD 7 ]
507 Expression to evaluate. */
508 gimple_seq eval;
510 /* [ WORD 8 ]
511 Cleanup expression. */
512 gimple_seq cleanup;
515 /* Kind of GIMPLE_TRY statements. */
516 enum gimple_try_flags
518 /* A try/catch. */
519 GIMPLE_TRY_CATCH = 1 << 0,
521 /* A try/finally. */
522 GIMPLE_TRY_FINALLY = 1 << 1,
523 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
525 /* Analogous to TRY_CATCH_IS_CLEANUP. */
526 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
529 /* GIMPLE_WITH_CLEANUP_EXPR */
531 struct GTY((tag("GSS_WCE")))
532 gimple_statement_wce : public gimple
534 /* [ WORD 1-6 ] : base class */
536 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
537 executed if an exception is thrown, not on normal exit of its
538 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
539 in TARGET_EXPRs. */
541 /* [ WORD 7 ]
542 Cleanup expression. */
543 gimple_seq cleanup;
547 /* GIMPLE_ASM */
549 struct GTY((tag("GSS_ASM")))
550 gasm : public gimple_statement_with_memory_ops_base
552 /* [ WORD 1-9 ] : base class */
554 /* [ WORD 10 ]
555 __asm__ statement. */
556 const char *string;
558 /* [ WORD 11 ]
559 Number of inputs, outputs, clobbers, labels. */
560 unsigned char ni;
561 unsigned char no;
562 unsigned char nc;
563 unsigned char nl;
565 /* [ WORD 12 ]
566 Operand vector. NOTE! This must always be the last field
567 of this structure. In particular, this means that this
568 structure cannot be embedded inside another one. */
569 tree GTY((length ("%h.num_ops"))) op[1];
572 /* GIMPLE_OMP_CRITICAL */
574 struct GTY((tag("GSS_OMP_CRITICAL")))
575 gomp_critical : public gimple_statement_omp
577 /* [ WORD 1-7 ] : base class */
579 /* [ WORD 8 ] */
580 tree clauses;
582 /* [ WORD 9 ]
583 Critical section name. */
584 tree name;
588 struct GTY(()) gimple_omp_for_iter {
589 /* Condition code. */
590 enum tree_code cond;
592 /* Index variable. */
593 tree index;
595 /* Initial value. */
596 tree initial;
598 /* Final value. */
599 tree final;
601 /* Increment. */
602 tree incr;
605 /* GIMPLE_OMP_FOR */
607 struct GTY((tag("GSS_OMP_FOR")))
608 gomp_for : public gimple_statement_omp
610 /* [ WORD 1-7 ] : base class */
612 /* [ WORD 8 ] */
613 tree clauses;
615 /* [ WORD 9 ]
616 Number of elements in iter array. */
617 size_t collapse;
619 /* [ WORD 10 ] */
620 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
622 /* [ WORD 11 ]
623 Pre-body evaluated before the loop body begins. */
624 gimple_seq pre_body;
628 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
630 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
631 gimple_statement_omp_parallel_layout : public gimple_statement_omp
633 /* [ WORD 1-7 ] : base class */
635 /* [ WORD 8 ]
636 Clauses. */
637 tree clauses;
639 /* [ WORD 9 ]
640 Child function holding the body of the parallel region. */
641 tree child_fn;
643 /* [ WORD 10 ]
644 Shared data argument. */
645 tree data_arg;
648 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
649 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
650 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
652 /* No extra fields; adds invariant:
653 stmt->code == GIMPLE_OMP_PARALLEL
654 || stmt->code == GIMPLE_OMP_TASK. */
657 /* GIMPLE_OMP_PARALLEL */
658 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
659 gomp_parallel : public gimple_statement_omp_taskreg
661 /* No extra fields; adds invariant:
662 stmt->code == GIMPLE_OMP_PARALLEL. */
665 /* GIMPLE_OMP_TARGET */
666 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
667 gomp_target : public gimple_statement_omp_parallel_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_TARGET. */
673 /* GIMPLE_OMP_TASK */
675 struct GTY((tag("GSS_OMP_TASK")))
676 gomp_task : public gimple_statement_omp_taskreg
678 /* [ WORD 1-10 ] : base class */
680 /* [ WORD 11 ]
681 Child function holding firstprivate initialization if needed. */
682 tree copy_fn;
684 /* [ WORD 12-13 ]
685 Size and alignment in bytes of the argument data block. */
686 tree arg_size;
687 tree arg_align;
691 /* GIMPLE_OMP_SECTION */
692 /* Uses struct gimple_statement_omp. */
695 /* GIMPLE_OMP_SECTIONS */
697 struct GTY((tag("GSS_OMP_SECTIONS")))
698 gomp_sections : public gimple_statement_omp
700 /* [ WORD 1-7 ] : base class */
702 /* [ WORD 8 ] */
703 tree clauses;
705 /* [ WORD 9 ]
706 The control variable used for deciding which of the sections to
707 execute. */
708 tree control;
711 /* GIMPLE_OMP_CONTINUE.
713 Note: This does not inherit from gimple_statement_omp, because we
714 do not need the body field. */
716 struct GTY((tag("GSS_OMP_CONTINUE")))
717 gomp_continue : public gimple
719 /* [ WORD 1-6 ] : base class */
721 /* [ WORD 7 ] */
722 tree control_def;
724 /* [ WORD 8 ] */
725 tree control_use;
728 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
730 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
731 gimple_statement_omp_single_layout : public gimple_statement_omp
733 /* [ WORD 1-7 ] : base class */
735 /* [ WORD 7 ] */
736 tree clauses;
739 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
740 gomp_single : public gimple_statement_omp_single_layout
742 /* No extra fields; adds invariant:
743 stmt->code == GIMPLE_OMP_SINGLE. */
746 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
747 gomp_teams : public gimple_statement_omp_single_layout
749 /* No extra fields; adds invariant:
750 stmt->code == GIMPLE_OMP_TEAMS. */
753 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
754 gomp_ordered : public gimple_statement_omp_single_layout
756 /* No extra fields; adds invariant:
757 stmt->code == GIMPLE_OMP_ORDERED. */
761 /* GIMPLE_OMP_ATOMIC_LOAD.
762 Note: This is based on gimple, not g_s_omp, because g_s_omp
763 contains a sequence, which we don't need here. */
765 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
766 gomp_atomic_load : public gimple
768 /* [ WORD 1-6 ] : base class */
770 /* [ WORD 7-8 ] */
771 tree rhs, lhs;
774 /* GIMPLE_OMP_ATOMIC_STORE.
775 See note on GIMPLE_OMP_ATOMIC_LOAD. */
777 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
778 gimple_statement_omp_atomic_store_layout : public gimple
780 /* [ WORD 1-6 ] : base class */
782 /* [ WORD 7 ] */
783 tree val;
786 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
787 gomp_atomic_store :
788 public gimple_statement_omp_atomic_store_layout
790 /* No extra fields; adds invariant:
791 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
794 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
795 gimple_statement_omp_return :
796 public gimple_statement_omp_atomic_store_layout
798 /* No extra fields; adds invariant:
799 stmt->code == GIMPLE_OMP_RETURN. */
802 /* GIMPLE_TRANSACTION. */
804 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
806 /* The __transaction_atomic was declared [[outer]] or it is
807 __transaction_relaxed. */
808 #define GTMA_IS_OUTER (1u << 0)
809 #define GTMA_IS_RELAXED (1u << 1)
810 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
812 /* The transaction is seen to not have an abort. */
813 #define GTMA_HAVE_ABORT (1u << 2)
814 /* The transaction is seen to have loads or stores. */
815 #define GTMA_HAVE_LOAD (1u << 3)
816 #define GTMA_HAVE_STORE (1u << 4)
817 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
818 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
819 /* The transaction WILL enter serial irrevocable mode.
820 An irrevocable block post-dominates the entire transaction, such
821 that all invocations of the transaction will go serial-irrevocable.
822 In such case, we don't bother instrumenting the transaction, and
823 tell the runtime that it should begin the transaction in
824 serial-irrevocable mode. */
825 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
826 /* The transaction contains no instrumentation code whatsover, most
827 likely because it is guaranteed to go irrevocable upon entry. */
828 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
830 struct GTY((tag("GSS_TRANSACTION")))
831 gtransaction : public gimple_statement_with_memory_ops_base
833 /* [ WORD 1-9 ] : base class */
835 /* [ WORD 10 ] */
836 gimple_seq body;
838 /* [ WORD 11 ] */
839 tree label;
842 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
843 enum gimple_statement_structure_enum {
844 #include "gsstruct.def"
845 LAST_GSS_ENUM
847 #undef DEFGSSTRUCT
849 /* A statement with the invariant that
850 stmt->code == GIMPLE_COND
851 i.e. a conditional jump statement. */
853 struct GTY((tag("GSS_WITH_OPS")))
854 gcond : public gimple_statement_with_ops
856 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
857 static const enum gimple_code code_ = GIMPLE_COND;
860 /* A statement with the invariant that
861 stmt->code == GIMPLE_DEBUG
862 i.e. a debug statement. */
864 struct GTY((tag("GSS_WITH_OPS")))
865 gdebug : public gimple_statement_with_ops
867 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
870 /* A statement with the invariant that
871 stmt->code == GIMPLE_GOTO
872 i.e. a goto statement. */
874 struct GTY((tag("GSS_WITH_OPS")))
875 ggoto : public gimple_statement_with_ops
877 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
880 /* A statement with the invariant that
881 stmt->code == GIMPLE_LABEL
882 i.e. a label statement. */
884 struct GTY((tag("GSS_WITH_OPS")))
885 glabel : public gimple_statement_with_ops
887 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
890 /* A statement with the invariant that
891 stmt->code == GIMPLE_SWITCH
892 i.e. a switch statement. */
894 struct GTY((tag("GSS_WITH_OPS")))
895 gswitch : public gimple_statement_with_ops
897 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
900 /* A statement with the invariant that
901 stmt->code == GIMPLE_ASSIGN
902 i.e. an assignment statement. */
904 struct GTY((tag("GSS_WITH_MEM_OPS")))
905 gassign : public gimple_statement_with_memory_ops
907 static const enum gimple_code code_ = GIMPLE_ASSIGN;
908 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
911 /* A statement with the invariant that
912 stmt->code == GIMPLE_RETURN
913 i.e. a return statement. */
915 struct GTY((tag("GSS_WITH_MEM_OPS")))
916 greturn : public gimple_statement_with_memory_ops
918 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
921 template <>
922 template <>
923 inline bool
924 is_a_helper <gasm *>::test (gimple *gs)
926 return gs->code == GIMPLE_ASM;
929 template <>
930 template <>
931 inline bool
932 is_a_helper <gassign *>::test (gimple *gs)
934 return gs->code == GIMPLE_ASSIGN;
937 template <>
938 template <>
939 inline bool
940 is_a_helper <const gassign *>::test (const gimple *gs)
942 return gs->code == GIMPLE_ASSIGN;
945 template <>
946 template <>
947 inline bool
948 is_a_helper <gbind *>::test (gimple *gs)
950 return gs->code == GIMPLE_BIND;
953 template <>
954 template <>
955 inline bool
956 is_a_helper <gcall *>::test (gimple *gs)
958 return gs->code == GIMPLE_CALL;
961 template <>
962 template <>
963 inline bool
964 is_a_helper <gcatch *>::test (gimple *gs)
966 return gs->code == GIMPLE_CATCH;
969 template <>
970 template <>
971 inline bool
972 is_a_helper <gcond *>::test (gimple *gs)
974 return gs->code == GIMPLE_COND;
977 template <>
978 template <>
979 inline bool
980 is_a_helper <const gcond *>::test (const gimple *gs)
982 return gs->code == GIMPLE_COND;
985 template <>
986 template <>
987 inline bool
988 is_a_helper <gdebug *>::test (gimple *gs)
990 return gs->code == GIMPLE_DEBUG;
993 template <>
994 template <>
995 inline bool
996 is_a_helper <ggoto *>::test (gimple *gs)
998 return gs->code == GIMPLE_GOTO;
1001 template <>
1002 template <>
1003 inline bool
1004 is_a_helper <glabel *>::test (gimple *gs)
1006 return gs->code == GIMPLE_LABEL;
1009 template <>
1010 template <>
1011 inline bool
1012 is_a_helper <gresx *>::test (gimple *gs)
1014 return gs->code == GIMPLE_RESX;
1017 template <>
1018 template <>
1019 inline bool
1020 is_a_helper <geh_dispatch *>::test (gimple *gs)
1022 return gs->code == GIMPLE_EH_DISPATCH;
1025 template <>
1026 template <>
1027 inline bool
1028 is_a_helper <geh_else *>::test (gimple *gs)
1030 return gs->code == GIMPLE_EH_ELSE;
1033 template <>
1034 template <>
1035 inline bool
1036 is_a_helper <geh_filter *>::test (gimple *gs)
1038 return gs->code == GIMPLE_EH_FILTER;
1041 template <>
1042 template <>
1043 inline bool
1044 is_a_helper <geh_mnt *>::test (gimple *gs)
1046 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1049 template <>
1050 template <>
1051 inline bool
1052 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1054 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1057 template <>
1058 template <>
1059 inline bool
1060 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1062 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1065 template <>
1066 template <>
1067 inline bool
1068 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1070 return gs->code == GIMPLE_OMP_RETURN;
1073 template <>
1074 template <>
1075 inline bool
1076 is_a_helper <gomp_continue *>::test (gimple *gs)
1078 return gs->code == GIMPLE_OMP_CONTINUE;
1081 template <>
1082 template <>
1083 inline bool
1084 is_a_helper <gomp_critical *>::test (gimple *gs)
1086 return gs->code == GIMPLE_OMP_CRITICAL;
1089 template <>
1090 template <>
1091 inline bool
1092 is_a_helper <gomp_ordered *>::test (gimple *gs)
1094 return gs->code == GIMPLE_OMP_ORDERED;
1097 template <>
1098 template <>
1099 inline bool
1100 is_a_helper <gomp_for *>::test (gimple *gs)
1102 return gs->code == GIMPLE_OMP_FOR;
1105 template <>
1106 template <>
1107 inline bool
1108 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1110 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1113 template <>
1114 template <>
1115 inline bool
1116 is_a_helper <gomp_parallel *>::test (gimple *gs)
1118 return gs->code == GIMPLE_OMP_PARALLEL;
1121 template <>
1122 template <>
1123 inline bool
1124 is_a_helper <gomp_target *>::test (gimple *gs)
1126 return gs->code == GIMPLE_OMP_TARGET;
1129 template <>
1130 template <>
1131 inline bool
1132 is_a_helper <gomp_sections *>::test (gimple *gs)
1134 return gs->code == GIMPLE_OMP_SECTIONS;
1137 template <>
1138 template <>
1139 inline bool
1140 is_a_helper <gomp_single *>::test (gimple *gs)
1142 return gs->code == GIMPLE_OMP_SINGLE;
1145 template <>
1146 template <>
1147 inline bool
1148 is_a_helper <gomp_teams *>::test (gimple *gs)
1150 return gs->code == GIMPLE_OMP_TEAMS;
1153 template <>
1154 template <>
1155 inline bool
1156 is_a_helper <gomp_task *>::test (gimple *gs)
1158 return gs->code == GIMPLE_OMP_TASK;
1161 template <>
1162 template <>
1163 inline bool
1164 is_a_helper <gphi *>::test (gimple *gs)
1166 return gs->code == GIMPLE_PHI;
1169 template <>
1170 template <>
1171 inline bool
1172 is_a_helper <greturn *>::test (gimple *gs)
1174 return gs->code == GIMPLE_RETURN;
1177 template <>
1178 template <>
1179 inline bool
1180 is_a_helper <gswitch *>::test (gimple *gs)
1182 return gs->code == GIMPLE_SWITCH;
1185 template <>
1186 template <>
1187 inline bool
1188 is_a_helper <gtransaction *>::test (gimple *gs)
1190 return gs->code == GIMPLE_TRANSACTION;
1193 template <>
1194 template <>
1195 inline bool
1196 is_a_helper <gtry *>::test (gimple *gs)
1198 return gs->code == GIMPLE_TRY;
1201 template <>
1202 template <>
1203 inline bool
1204 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1206 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1209 template <>
1210 template <>
1211 inline bool
1212 is_a_helper <const gasm *>::test (const gimple *gs)
1214 return gs->code == GIMPLE_ASM;
1217 template <>
1218 template <>
1219 inline bool
1220 is_a_helper <const gbind *>::test (const gimple *gs)
1222 return gs->code == GIMPLE_BIND;
1225 template <>
1226 template <>
1227 inline bool
1228 is_a_helper <const gcall *>::test (const gimple *gs)
1230 return gs->code == GIMPLE_CALL;
1233 template <>
1234 template <>
1235 inline bool
1236 is_a_helper <const gcatch *>::test (const gimple *gs)
1238 return gs->code == GIMPLE_CATCH;
1241 template <>
1242 template <>
1243 inline bool
1244 is_a_helper <const gresx *>::test (const gimple *gs)
1246 return gs->code == GIMPLE_RESX;
1249 template <>
1250 template <>
1251 inline bool
1252 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1254 return gs->code == GIMPLE_EH_DISPATCH;
1257 template <>
1258 template <>
1259 inline bool
1260 is_a_helper <const geh_filter *>::test (const gimple *gs)
1262 return gs->code == GIMPLE_EH_FILTER;
1265 template <>
1266 template <>
1267 inline bool
1268 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1270 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1273 template <>
1274 template <>
1275 inline bool
1276 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1278 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1281 template <>
1282 template <>
1283 inline bool
1284 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1286 return gs->code == GIMPLE_OMP_RETURN;
1289 template <>
1290 template <>
1291 inline bool
1292 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1294 return gs->code == GIMPLE_OMP_CONTINUE;
1297 template <>
1298 template <>
1299 inline bool
1300 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1302 return gs->code == GIMPLE_OMP_CRITICAL;
1305 template <>
1306 template <>
1307 inline bool
1308 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1310 return gs->code == GIMPLE_OMP_ORDERED;
1313 template <>
1314 template <>
1315 inline bool
1316 is_a_helper <const gomp_for *>::test (const gimple *gs)
1318 return gs->code == GIMPLE_OMP_FOR;
1321 template <>
1322 template <>
1323 inline bool
1324 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1326 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1329 template <>
1330 template <>
1331 inline bool
1332 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1334 return gs->code == GIMPLE_OMP_PARALLEL;
1337 template <>
1338 template <>
1339 inline bool
1340 is_a_helper <const gomp_target *>::test (const gimple *gs)
1342 return gs->code == GIMPLE_OMP_TARGET;
1345 template <>
1346 template <>
1347 inline bool
1348 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1350 return gs->code == GIMPLE_OMP_SECTIONS;
1353 template <>
1354 template <>
1355 inline bool
1356 is_a_helper <const gomp_single *>::test (const gimple *gs)
1358 return gs->code == GIMPLE_OMP_SINGLE;
1361 template <>
1362 template <>
1363 inline bool
1364 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1366 return gs->code == GIMPLE_OMP_TEAMS;
1369 template <>
1370 template <>
1371 inline bool
1372 is_a_helper <const gomp_task *>::test (const gimple *gs)
1374 return gs->code == GIMPLE_OMP_TASK;
1377 template <>
1378 template <>
1379 inline bool
1380 is_a_helper <const gphi *>::test (const gimple *gs)
1382 return gs->code == GIMPLE_PHI;
1385 template <>
1386 template <>
1387 inline bool
1388 is_a_helper <const gtransaction *>::test (const gimple *gs)
1390 return gs->code == GIMPLE_TRANSACTION;
1393 /* Offset in bytes to the location of the operand vector.
1394 Zero if there is no operand vector for this tuple structure. */
1395 extern size_t const gimple_ops_offset_[];
1397 /* Map GIMPLE codes to GSS codes. */
1398 extern enum gimple_statement_structure_enum const gss_for_code_[];
1400 /* This variable holds the currently expanded gimple statement for purposes
1401 of comminucating the profile info to the builtin expanders. */
1402 extern gimple *currently_expanding_gimple_stmt;
1404 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1405 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1406 greturn *gimple_build_return (tree);
1407 void gimple_call_reset_alias_info (gcall *);
1408 gcall *gimple_build_call_vec (tree, vec<tree> );
1409 gcall *gimple_build_call (tree, unsigned, ...);
1410 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1411 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1412 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1413 gcall *gimple_build_call_from_tree (tree);
1414 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1415 gassign *gimple_build_assign (tree, enum tree_code,
1416 tree, tree, tree CXX_MEM_STAT_INFO);
1417 gassign *gimple_build_assign (tree, enum tree_code,
1418 tree, tree CXX_MEM_STAT_INFO);
1419 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1420 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1421 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1422 void gimple_cond_set_condition_from_tree (gcond *, tree);
1423 glabel *gimple_build_label (tree label);
1424 ggoto *gimple_build_goto (tree dest);
1425 gimple *gimple_build_nop (void);
1426 gbind *gimple_build_bind (tree, gimple_seq, tree);
1427 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1428 vec<tree, va_gc> *, vec<tree, va_gc> *,
1429 vec<tree, va_gc> *);
1430 gcatch *gimple_build_catch (tree, gimple_seq);
1431 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1432 geh_mnt *gimple_build_eh_must_not_throw (tree);
1433 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1434 gtry *gimple_build_try (gimple_seq, gimple_seq,
1435 enum gimple_try_flags);
1436 gimple *gimple_build_wce (gimple_seq);
1437 gresx *gimple_build_resx (int);
1438 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1439 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1440 geh_dispatch *gimple_build_eh_dispatch (int);
1441 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1442 #define gimple_build_debug_bind(var,val,stmt) \
1443 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1444 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1445 #define gimple_build_debug_source_bind(var,val,stmt) \
1446 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1447 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1448 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1449 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1450 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1451 tree, tree);
1452 gimple *gimple_build_omp_section (gimple_seq);
1453 gimple *gimple_build_omp_master (gimple_seq);
1454 gimple *gimple_build_omp_taskgroup (gimple_seq);
1455 gomp_continue *gimple_build_omp_continue (tree, tree);
1456 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1457 gimple *gimple_build_omp_return (bool);
1458 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1459 gimple *gimple_build_omp_sections_switch (void);
1460 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1461 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1462 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1463 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1464 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1465 gtransaction *gimple_build_transaction (gimple_seq, tree);
1466 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1467 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1468 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1469 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1470 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1471 location_t);
1472 extern void annotate_all_with_location (gimple_seq, location_t);
1473 bool empty_body_p (gimple_seq);
1474 gimple_seq gimple_seq_copy (gimple_seq);
1475 bool gimple_call_same_target_p (const gimple *, const gimple *);
1476 int gimple_call_flags (const gimple *);
1477 int gimple_call_arg_flags (const gcall *, unsigned);
1478 int gimple_call_return_flags (const gcall *);
1479 bool gimple_assign_copy_p (gimple *);
1480 bool gimple_assign_ssa_name_copy_p (gimple *);
1481 bool gimple_assign_unary_nop_p (gimple *);
1482 void gimple_set_bb (gimple *, basic_block);
1483 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1484 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1485 tree, tree, tree);
1486 tree gimple_get_lhs (const gimple *);
1487 void gimple_set_lhs (gimple *, tree);
1488 gimple *gimple_copy (gimple *);
1489 bool gimple_has_side_effects (const gimple *);
1490 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1491 bool gimple_could_trap_p (gimple *);
1492 bool gimple_assign_rhs_could_trap_p (gimple *);
1493 extern void dump_gimple_statistics (void);
1494 unsigned get_gimple_rhs_num_ops (enum tree_code);
1495 extern tree canonicalize_cond_expr_cond (tree);
1496 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1497 extern bool gimple_compare_field_offset (tree, tree);
1498 extern tree gimple_unsigned_type (tree);
1499 extern tree gimple_signed_type (tree);
1500 extern alias_set_type gimple_get_alias_set (tree);
1501 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1502 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1503 extern bool gimple_call_builtin_p (const gimple *);
1504 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1505 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1506 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1507 extern void dump_decl_set (FILE *, bitmap);
1508 extern bool nonfreeing_call_p (gimple *);
1509 extern bool infer_nonnull_range (gimple *, tree);
1510 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1511 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1512 extern void sort_case_labels (vec<tree>);
1513 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1514 extern void gimple_seq_set_location (gimple_seq, location_t);
1515 extern void gimple_seq_discard (gimple_seq);
1516 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1518 /* Formal (expression) temporary table handling: multiple occurrences of
1519 the same scalar expression are evaluated into the same temporary. */
1521 typedef struct gimple_temp_hash_elt
1523 tree val; /* Key */
1524 tree temp; /* Value */
1525 } elt_t;
1527 /* Get the number of the next statement uid to be allocated. */
1528 static inline unsigned int
1529 gimple_stmt_max_uid (struct function *fn)
1531 return fn->last_stmt_uid;
1534 /* Set the number of the next statement uid to be allocated. */
1535 static inline void
1536 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1538 fn->last_stmt_uid = maxid;
1541 /* Set the number of the next statement uid to be allocated. */
1542 static inline unsigned int
1543 inc_gimple_stmt_max_uid (struct function *fn)
1545 return fn->last_stmt_uid++;
1548 /* Return the first node in GIMPLE sequence S. */
1550 static inline gimple_seq_node
1551 gimple_seq_first (gimple_seq s)
1553 return s;
1557 /* Return the first statement in GIMPLE sequence S. */
1559 static inline gimple *
1560 gimple_seq_first_stmt (gimple_seq s)
1562 gimple_seq_node n = gimple_seq_first (s);
1563 return n;
1566 /* Return the first statement in GIMPLE sequence S as a gbind *,
1567 verifying that it has code GIMPLE_BIND in a checked build. */
1569 static inline gbind *
1570 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1572 gimple_seq_node n = gimple_seq_first (s);
1573 return as_a <gbind *> (n);
1577 /* Return the last node in GIMPLE sequence S. */
1579 static inline gimple_seq_node
1580 gimple_seq_last (gimple_seq s)
1582 return s ? s->prev : NULL;
1586 /* Return the last statement in GIMPLE sequence S. */
1588 static inline gimple *
1589 gimple_seq_last_stmt (gimple_seq s)
1591 gimple_seq_node n = gimple_seq_last (s);
1592 return n;
1596 /* Set the last node in GIMPLE sequence *PS to LAST. */
1598 static inline void
1599 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1601 (*ps)->prev = last;
1605 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1607 static inline void
1608 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1610 *ps = first;
1614 /* Return true if GIMPLE sequence S is empty. */
1616 static inline bool
1617 gimple_seq_empty_p (gimple_seq s)
1619 return s == NULL;
1622 /* Allocate a new sequence and initialize its first element with STMT. */
1624 static inline gimple_seq
1625 gimple_seq_alloc_with_stmt (gimple *stmt)
1627 gimple_seq seq = NULL;
1628 gimple_seq_add_stmt (&seq, stmt);
1629 return seq;
1633 /* Returns the sequence of statements in BB. */
1635 static inline gimple_seq
1636 bb_seq (const_basic_block bb)
1638 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1641 static inline gimple_seq *
1642 bb_seq_addr (basic_block bb)
1644 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1647 /* Sets the sequence of statements in BB to SEQ. */
1649 static inline void
1650 set_bb_seq (basic_block bb, gimple_seq seq)
1652 gcc_checking_assert (!(bb->flags & BB_RTL));
1653 bb->il.gimple.seq = seq;
1657 /* Return the code for GIMPLE statement G. */
1659 static inline enum gimple_code
1660 gimple_code (const gimple *g)
1662 return g->code;
1666 /* Return the GSS code used by a GIMPLE code. */
1668 static inline enum gimple_statement_structure_enum
1669 gss_for_code (enum gimple_code code)
1671 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1672 return gss_for_code_[code];
1676 /* Return which GSS code is used by GS. */
1678 static inline enum gimple_statement_structure_enum
1679 gimple_statement_structure (gimple *gs)
1681 return gss_for_code (gimple_code (gs));
1685 /* Return true if statement G has sub-statements. This is only true for
1686 High GIMPLE statements. */
1688 static inline bool
1689 gimple_has_substatements (gimple *g)
1691 switch (gimple_code (g))
1693 case GIMPLE_BIND:
1694 case GIMPLE_CATCH:
1695 case GIMPLE_EH_FILTER:
1696 case GIMPLE_EH_ELSE:
1697 case GIMPLE_TRY:
1698 case GIMPLE_OMP_FOR:
1699 case GIMPLE_OMP_MASTER:
1700 case GIMPLE_OMP_TASKGROUP:
1701 case GIMPLE_OMP_ORDERED:
1702 case GIMPLE_OMP_SECTION:
1703 case GIMPLE_OMP_PARALLEL:
1704 case GIMPLE_OMP_TASK:
1705 case GIMPLE_OMP_SECTIONS:
1706 case GIMPLE_OMP_SINGLE:
1707 case GIMPLE_OMP_TARGET:
1708 case GIMPLE_OMP_TEAMS:
1709 case GIMPLE_OMP_CRITICAL:
1710 case GIMPLE_WITH_CLEANUP_EXPR:
1711 case GIMPLE_TRANSACTION:
1712 return true;
1714 default:
1715 return false;
1720 /* Return the basic block holding statement G. */
1722 static inline basic_block
1723 gimple_bb (const gimple *g)
1725 return g->bb;
1729 /* Return the lexical scope block holding statement G. */
1731 static inline tree
1732 gimple_block (const gimple *g)
1734 return LOCATION_BLOCK (g->location);
1738 /* Set BLOCK to be the lexical scope block holding statement G. */
1740 static inline void
1741 gimple_set_block (gimple *g, tree block)
1743 if (block)
1744 g->location =
1745 COMBINE_LOCATION_DATA (line_table, g->location, block);
1746 else
1747 g->location = LOCATION_LOCUS (g->location);
1751 /* Return location information for statement G. */
1753 static inline location_t
1754 gimple_location (const gimple *g)
1756 return g->location;
1759 /* Return location information for statement G if g is not NULL.
1760 Otherwise, UNKNOWN_LOCATION is returned. */
1762 static inline location_t
1763 gimple_location_safe (const gimple *g)
1765 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1768 /* Set location information for statement G. */
1770 static inline void
1771 gimple_set_location (gimple *g, location_t location)
1773 g->location = location;
1777 /* Return true if G contains location information. */
1779 static inline bool
1780 gimple_has_location (const gimple *g)
1782 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1786 /* Return the file name of the location of STMT. */
1788 static inline const char *
1789 gimple_filename (const gimple *stmt)
1791 return LOCATION_FILE (gimple_location (stmt));
1795 /* Return the line number of the location of STMT. */
1797 static inline int
1798 gimple_lineno (const gimple *stmt)
1800 return LOCATION_LINE (gimple_location (stmt));
1804 /* Determine whether SEQ is a singleton. */
1806 static inline bool
1807 gimple_seq_singleton_p (gimple_seq seq)
1809 return ((gimple_seq_first (seq) != NULL)
1810 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1813 /* Return true if no warnings should be emitted for statement STMT. */
1815 static inline bool
1816 gimple_no_warning_p (const gimple *stmt)
1818 return stmt->no_warning;
1821 /* Set the no_warning flag of STMT to NO_WARNING. */
1823 static inline void
1824 gimple_set_no_warning (gimple *stmt, bool no_warning)
1826 stmt->no_warning = (unsigned) no_warning;
1829 /* Set the visited status on statement STMT to VISITED_P.
1831 Please note that this 'visited' property of the gimple statement is
1832 supposed to be undefined at pass boundaries. This means that a
1833 given pass should not assume it contains any useful value when the
1834 pass starts and thus can set it to any value it sees fit.
1836 You can learn more about the visited property of the gimple
1837 statement by reading the comments of the 'visited' data member of
1838 struct gimple.
1841 static inline void
1842 gimple_set_visited (gimple *stmt, bool visited_p)
1844 stmt->visited = (unsigned) visited_p;
1848 /* Return the visited status for statement STMT.
1850 Please note that this 'visited' property of the gimple statement is
1851 supposed to be undefined at pass boundaries. This means that a
1852 given pass should not assume it contains any useful value when the
1853 pass starts and thus can set it to any value it sees fit.
1855 You can learn more about the visited property of the gimple
1856 statement by reading the comments of the 'visited' data member of
1857 struct gimple. */
1859 static inline bool
1860 gimple_visited_p (gimple *stmt)
1862 return stmt->visited;
1866 /* Set pass local flag PLF on statement STMT to VAL_P.
1868 Please note that this PLF property of the gimple statement is
1869 supposed to be undefined at pass boundaries. This means that a
1870 given pass should not assume it contains any useful value when the
1871 pass starts and thus can set it to any value it sees fit.
1873 You can learn more about the PLF property by reading the comment of
1874 the 'plf' data member of struct gimple_statement_structure. */
1876 static inline void
1877 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1879 if (val_p)
1880 stmt->plf |= (unsigned int) plf;
1881 else
1882 stmt->plf &= ~((unsigned int) plf);
1886 /* Return the value of pass local flag PLF on statement STMT.
1888 Please note that this 'plf' property of the gimple statement is
1889 supposed to be undefined at pass boundaries. This means that a
1890 given pass should not assume it contains any useful value when the
1891 pass starts and thus can set it to any value it sees fit.
1893 You can learn more about the plf property by reading the comment of
1894 the 'plf' data member of struct gimple_statement_structure. */
1896 static inline unsigned int
1897 gimple_plf (gimple *stmt, enum plf_mask plf)
1899 return stmt->plf & ((unsigned int) plf);
1903 /* Set the UID of statement.
1905 Please note that this UID property is supposed to be undefined at
1906 pass boundaries. This means that a given pass should not assume it
1907 contains any useful value when the pass starts and thus can set it
1908 to any value it sees fit. */
1910 static inline void
1911 gimple_set_uid (gimple *g, unsigned uid)
1913 g->uid = uid;
1917 /* Return the UID of statement.
1919 Please note that this UID property is supposed to be undefined at
1920 pass boundaries. This means that a given pass should not assume it
1921 contains any useful value when the pass starts and thus can set it
1922 to any value it sees fit. */
1924 static inline unsigned
1925 gimple_uid (const gimple *g)
1927 return g->uid;
1931 /* Make statement G a singleton sequence. */
1933 static inline void
1934 gimple_init_singleton (gimple *g)
1936 g->next = NULL;
1937 g->prev = g;
1941 /* Return true if GIMPLE statement G has register or memory operands. */
1943 static inline bool
1944 gimple_has_ops (const gimple *g)
1946 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1949 template <>
1950 template <>
1951 inline bool
1952 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1954 return gimple_has_ops (gs);
1957 template <>
1958 template <>
1959 inline bool
1960 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1962 return gimple_has_ops (gs);
1965 /* Return true if GIMPLE statement G has memory operands. */
1967 static inline bool
1968 gimple_has_mem_ops (const gimple *g)
1970 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1973 template <>
1974 template <>
1975 inline bool
1976 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1978 return gimple_has_mem_ops (gs);
1981 template <>
1982 template <>
1983 inline bool
1984 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1986 return gimple_has_mem_ops (gs);
1989 /* Return the set of USE operands for statement G. */
1991 static inline struct use_optype_d *
1992 gimple_use_ops (const gimple *g)
1994 const gimple_statement_with_ops *ops_stmt =
1995 dyn_cast <const gimple_statement_with_ops *> (g);
1996 if (!ops_stmt)
1997 return NULL;
1998 return ops_stmt->use_ops;
2002 /* Set USE to be the set of USE operands for statement G. */
2004 static inline void
2005 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2007 gimple_statement_with_ops *ops_stmt =
2008 as_a <gimple_statement_with_ops *> (g);
2009 ops_stmt->use_ops = use;
2013 /* Return the single VUSE operand of the statement G. */
2015 static inline tree
2016 gimple_vuse (const gimple *g)
2018 const gimple_statement_with_memory_ops *mem_ops_stmt =
2019 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2020 if (!mem_ops_stmt)
2021 return NULL_TREE;
2022 return mem_ops_stmt->vuse;
2025 /* Return the single VDEF operand of the statement G. */
2027 static inline tree
2028 gimple_vdef (const gimple *g)
2030 const gimple_statement_with_memory_ops *mem_ops_stmt =
2031 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2032 if (!mem_ops_stmt)
2033 return NULL_TREE;
2034 return mem_ops_stmt->vdef;
2037 /* Return the single VUSE operand of the statement G. */
2039 static inline tree *
2040 gimple_vuse_ptr (gimple *g)
2042 gimple_statement_with_memory_ops *mem_ops_stmt =
2043 dyn_cast <gimple_statement_with_memory_ops *> (g);
2044 if (!mem_ops_stmt)
2045 return NULL;
2046 return &mem_ops_stmt->vuse;
2049 /* Return the single VDEF operand of the statement G. */
2051 static inline tree *
2052 gimple_vdef_ptr (gimple *g)
2054 gimple_statement_with_memory_ops *mem_ops_stmt =
2055 dyn_cast <gimple_statement_with_memory_ops *> (g);
2056 if (!mem_ops_stmt)
2057 return NULL;
2058 return &mem_ops_stmt->vdef;
2061 /* Set the single VUSE operand of the statement G. */
2063 static inline void
2064 gimple_set_vuse (gimple *g, tree vuse)
2066 gimple_statement_with_memory_ops *mem_ops_stmt =
2067 as_a <gimple_statement_with_memory_ops *> (g);
2068 mem_ops_stmt->vuse = vuse;
2071 /* Set the single VDEF operand of the statement G. */
2073 static inline void
2074 gimple_set_vdef (gimple *g, tree vdef)
2076 gimple_statement_with_memory_ops *mem_ops_stmt =
2077 as_a <gimple_statement_with_memory_ops *> (g);
2078 mem_ops_stmt->vdef = vdef;
2082 /* Return true if statement G has operands and the modified field has
2083 been set. */
2085 static inline bool
2086 gimple_modified_p (const gimple *g)
2088 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2092 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2093 a MODIFIED field. */
2095 static inline void
2096 gimple_set_modified (gimple *s, bool modifiedp)
2098 if (gimple_has_ops (s))
2099 s->modified = (unsigned) modifiedp;
2103 /* Return the tree code for the expression computed by STMT. This is
2104 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2105 GIMPLE_CALL, return CALL_EXPR as the expression code for
2106 consistency. This is useful when the caller needs to deal with the
2107 three kinds of computation that GIMPLE supports. */
2109 static inline enum tree_code
2110 gimple_expr_code (const gimple *stmt)
2112 enum gimple_code code = gimple_code (stmt);
2113 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2114 return (enum tree_code) stmt->subcode;
2115 else
2117 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2118 return CALL_EXPR;
2123 /* Return true if statement STMT contains volatile operands. */
2125 static inline bool
2126 gimple_has_volatile_ops (const gimple *stmt)
2128 if (gimple_has_mem_ops (stmt))
2129 return stmt->has_volatile_ops;
2130 else
2131 return false;
2135 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2137 static inline void
2138 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2140 if (gimple_has_mem_ops (stmt))
2141 stmt->has_volatile_ops = (unsigned) volatilep;
2144 /* Return true if STMT is in a transaction. */
2146 static inline bool
2147 gimple_in_transaction (const gimple *stmt)
2149 return bb_in_transaction (gimple_bb (stmt));
2152 /* Return true if statement STMT may access memory. */
2154 static inline bool
2155 gimple_references_memory_p (gimple *stmt)
2157 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2161 /* Return the subcode for OMP statement S. */
2163 static inline unsigned
2164 gimple_omp_subcode (const gimple *s)
2166 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2167 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2168 return s->subcode;
2171 /* Set the subcode for OMP statement S to SUBCODE. */
2173 static inline void
2174 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2176 /* We only have 16 bits for the subcode. Assert that we are not
2177 overflowing it. */
2178 gcc_gimple_checking_assert (subcode < (1 << 16));
2179 s->subcode = subcode;
2182 /* Set the nowait flag on OMP_RETURN statement S. */
2184 static inline void
2185 gimple_omp_return_set_nowait (gimple *s)
2187 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2188 s->subcode |= GF_OMP_RETURN_NOWAIT;
2192 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2193 flag set. */
2195 static inline bool
2196 gimple_omp_return_nowait_p (const gimple *g)
2198 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2199 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2203 /* Set the LHS of OMP return. */
2205 static inline void
2206 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2208 gimple_statement_omp_return *omp_return_stmt =
2209 as_a <gimple_statement_omp_return *> (g);
2210 omp_return_stmt->val = lhs;
2214 /* Get the LHS of OMP return. */
2216 static inline tree
2217 gimple_omp_return_lhs (const gimple *g)
2219 const gimple_statement_omp_return *omp_return_stmt =
2220 as_a <const gimple_statement_omp_return *> (g);
2221 return omp_return_stmt->val;
2225 /* Return a pointer to the LHS of OMP return. */
2227 static inline tree *
2228 gimple_omp_return_lhs_ptr (gimple *g)
2230 gimple_statement_omp_return *omp_return_stmt =
2231 as_a <gimple_statement_omp_return *> (g);
2232 return &omp_return_stmt->val;
2236 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2237 flag set. */
2239 static inline bool
2240 gimple_omp_section_last_p (const gimple *g)
2242 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2243 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2247 /* Set the GF_OMP_SECTION_LAST flag on G. */
2249 static inline void
2250 gimple_omp_section_set_last (gimple *g)
2252 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2253 g->subcode |= GF_OMP_SECTION_LAST;
2257 /* Return true if OMP parallel statement G has the
2258 GF_OMP_PARALLEL_COMBINED flag set. */
2260 static inline bool
2261 gimple_omp_parallel_combined_p (const gimple *g)
2263 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2264 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2268 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2269 value of COMBINED_P. */
2271 static inline void
2272 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2274 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2275 if (combined_p)
2276 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2277 else
2278 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2282 /* Return true if OMP atomic load/store statement G has the
2283 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2285 static inline bool
2286 gimple_omp_atomic_need_value_p (const gimple *g)
2288 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2289 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2290 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2294 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2296 static inline void
2297 gimple_omp_atomic_set_need_value (gimple *g)
2299 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2300 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2301 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2305 /* Return true if OMP atomic load/store statement G has the
2306 GF_OMP_ATOMIC_SEQ_CST flag set. */
2308 static inline bool
2309 gimple_omp_atomic_seq_cst_p (const gimple *g)
2311 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2312 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2313 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2317 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2319 static inline void
2320 gimple_omp_atomic_set_seq_cst (gimple *g)
2322 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2323 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2324 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2328 /* Return the number of operands for statement GS. */
2330 static inline unsigned
2331 gimple_num_ops (const gimple *gs)
2333 return gs->num_ops;
2337 /* Set the number of operands for statement GS. */
2339 static inline void
2340 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2342 gs->num_ops = num_ops;
2346 /* Return the array of operands for statement GS. */
2348 static inline tree *
2349 gimple_ops (gimple *gs)
2351 size_t off;
2353 /* All the tuples have their operand vector at the very bottom
2354 of the structure. Note that those structures that do not
2355 have an operand vector have a zero offset. */
2356 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2357 gcc_gimple_checking_assert (off != 0);
2359 return (tree *) ((char *) gs + off);
2363 /* Return operand I for statement GS. */
2365 static inline tree
2366 gimple_op (const gimple *gs, unsigned i)
2368 if (gimple_has_ops (gs))
2370 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2371 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2373 else
2374 return NULL_TREE;
2377 /* Return a pointer to operand I for statement GS. */
2379 static inline tree *
2380 gimple_op_ptr (gimple *gs, unsigned i)
2382 if (gimple_has_ops (gs))
2384 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2385 return gimple_ops (gs) + i;
2387 else
2388 return NULL;
2391 /* Set operand I of statement GS to OP. */
2393 static inline void
2394 gimple_set_op (gimple *gs, unsigned i, tree op)
2396 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2398 /* Note. It may be tempting to assert that OP matches
2399 is_gimple_operand, but that would be wrong. Different tuples
2400 accept slightly different sets of tree operands. Each caller
2401 should perform its own validation. */
2402 gimple_ops (gs)[i] = op;
2405 /* Return true if GS is a GIMPLE_ASSIGN. */
2407 static inline bool
2408 is_gimple_assign (const gimple *gs)
2410 return gimple_code (gs) == GIMPLE_ASSIGN;
2413 /* Determine if expression CODE is one of the valid expressions that can
2414 be used on the RHS of GIMPLE assignments. */
2416 static inline enum gimple_rhs_class
2417 get_gimple_rhs_class (enum tree_code code)
2419 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2422 /* Return the LHS of assignment statement GS. */
2424 static inline tree
2425 gimple_assign_lhs (const gassign *gs)
2427 return gs->op[0];
2430 static inline tree
2431 gimple_assign_lhs (const gimple *gs)
2433 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2434 return gimple_assign_lhs (ass);
2438 /* Return a pointer to the LHS of assignment statement GS. */
2440 static inline tree *
2441 gimple_assign_lhs_ptr (gassign *gs)
2443 return &gs->op[0];
2446 static inline tree *
2447 gimple_assign_lhs_ptr (gimple *gs)
2449 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2450 return gimple_assign_lhs_ptr (ass);
2454 /* Set LHS to be the LHS operand of assignment statement GS. */
2456 static inline void
2457 gimple_assign_set_lhs (gassign *gs, tree lhs)
2459 gs->op[0] = lhs;
2461 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2462 SSA_NAME_DEF_STMT (lhs) = gs;
2465 static inline void
2466 gimple_assign_set_lhs (gimple *gs, tree lhs)
2468 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2469 gimple_assign_set_lhs (ass, lhs);
2473 /* Return the first operand on the RHS of assignment statement GS. */
2475 static inline tree
2476 gimple_assign_rhs1 (const gassign *gs)
2478 return gs->op[1];
2481 static inline tree
2482 gimple_assign_rhs1 (const gimple *gs)
2484 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2485 return gimple_assign_rhs1 (ass);
2489 /* Return a pointer to the first operand on the RHS of assignment
2490 statement GS. */
2492 static inline tree *
2493 gimple_assign_rhs1_ptr (gassign *gs)
2495 return &gs->op[1];
2498 static inline tree *
2499 gimple_assign_rhs1_ptr (gimple *gs)
2501 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2502 return gimple_assign_rhs1_ptr (ass);
2505 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2507 static inline void
2508 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2510 gs->op[1] = rhs;
2513 static inline void
2514 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2516 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2517 gimple_assign_set_rhs1 (ass, rhs);
2521 /* Return the second operand on the RHS of assignment statement GS.
2522 If GS does not have two operands, NULL is returned instead. */
2524 static inline tree
2525 gimple_assign_rhs2 (const gassign *gs)
2527 if (gimple_num_ops (gs) >= 3)
2528 return gs->op[2];
2529 else
2530 return NULL_TREE;
2533 static inline tree
2534 gimple_assign_rhs2 (const gimple *gs)
2536 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2537 return gimple_assign_rhs2 (ass);
2541 /* Return a pointer to the second operand on the RHS of assignment
2542 statement GS. */
2544 static inline tree *
2545 gimple_assign_rhs2_ptr (gassign *gs)
2547 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2548 return &gs->op[2];
2551 static inline tree *
2552 gimple_assign_rhs2_ptr (gimple *gs)
2554 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2555 return gimple_assign_rhs2_ptr (ass);
2559 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2561 static inline void
2562 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2564 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2565 gs->op[2] = rhs;
2568 static inline void
2569 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2571 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2572 return gimple_assign_set_rhs2 (ass, rhs);
2575 /* Return the third operand on the RHS of assignment statement GS.
2576 If GS does not have two operands, NULL is returned instead. */
2578 static inline tree
2579 gimple_assign_rhs3 (const gassign *gs)
2581 if (gimple_num_ops (gs) >= 4)
2582 return gs->op[3];
2583 else
2584 return NULL_TREE;
2587 static inline tree
2588 gimple_assign_rhs3 (const gimple *gs)
2590 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2591 return gimple_assign_rhs3 (ass);
2594 /* Return a pointer to the third operand on the RHS of assignment
2595 statement GS. */
2597 static inline tree *
2598 gimple_assign_rhs3_ptr (gimple *gs)
2600 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2601 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2602 return &ass->op[3];
2606 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2608 static inline void
2609 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2611 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2612 gs->op[3] = rhs;
2615 static inline void
2616 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2618 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2619 gimple_assign_set_rhs3 (ass, rhs);
2623 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2624 which expect to see only two operands. */
2626 static inline void
2627 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2628 tree op1, tree op2)
2630 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2633 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2634 which expect to see only one operands. */
2636 static inline void
2637 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2638 tree op1)
2640 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2643 /* Returns true if GS is a nontemporal move. */
2645 static inline bool
2646 gimple_assign_nontemporal_move_p (const gassign *gs)
2648 return gs->nontemporal_move;
2651 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2653 static inline void
2654 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2656 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2657 gs->nontemporal_move = nontemporal;
2661 /* Return the code of the expression computed on the rhs of assignment
2662 statement GS. In case that the RHS is a single object, returns the
2663 tree code of the object. */
2665 static inline enum tree_code
2666 gimple_assign_rhs_code (const gassign *gs)
2668 enum tree_code code = (enum tree_code) gs->subcode;
2669 /* While we initially set subcode to the TREE_CODE of the rhs for
2670 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2671 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2672 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2673 code = TREE_CODE (gs->op[1]);
2675 return code;
2678 static inline enum tree_code
2679 gimple_assign_rhs_code (const gimple *gs)
2681 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2682 return gimple_assign_rhs_code (ass);
2686 /* Set CODE to be the code for the expression computed on the RHS of
2687 assignment S. */
2689 static inline void
2690 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2692 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2693 s->subcode = code;
2697 /* Return the gimple rhs class of the code of the expression computed on
2698 the rhs of assignment statement GS.
2699 This will never return GIMPLE_INVALID_RHS. */
2701 static inline enum gimple_rhs_class
2702 gimple_assign_rhs_class (const gimple *gs)
2704 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2707 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2708 there is no operator associated with the assignment itself.
2709 Unlike gimple_assign_copy_p, this predicate returns true for
2710 any RHS operand, including those that perform an operation
2711 and do not have the semantics of a copy, such as COND_EXPR. */
2713 static inline bool
2714 gimple_assign_single_p (const gimple *gs)
2716 return (is_gimple_assign (gs)
2717 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2720 /* Return true if GS performs a store to its lhs. */
2722 static inline bool
2723 gimple_store_p (const gimple *gs)
2725 tree lhs = gimple_get_lhs (gs);
2726 return lhs && !is_gimple_reg (lhs);
2729 /* Return true if GS is an assignment that loads from its rhs1. */
2731 static inline bool
2732 gimple_assign_load_p (const gimple *gs)
2734 tree rhs;
2735 if (!gimple_assign_single_p (gs))
2736 return false;
2737 rhs = gimple_assign_rhs1 (gs);
2738 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2739 return true;
2740 rhs = get_base_address (rhs);
2741 return (DECL_P (rhs)
2742 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2746 /* Return true if S is a type-cast assignment. */
2748 static inline bool
2749 gimple_assign_cast_p (const gimple *s)
2751 if (is_gimple_assign (s))
2753 enum tree_code sc = gimple_assign_rhs_code (s);
2754 return CONVERT_EXPR_CODE_P (sc)
2755 || sc == VIEW_CONVERT_EXPR
2756 || sc == FIX_TRUNC_EXPR;
2759 return false;
2762 /* Return true if S is a clobber statement. */
2764 static inline bool
2765 gimple_clobber_p (const gimple *s)
2767 return gimple_assign_single_p (s)
2768 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2771 /* Return true if GS is a GIMPLE_CALL. */
2773 static inline bool
2774 is_gimple_call (const gimple *gs)
2776 return gimple_code (gs) == GIMPLE_CALL;
2779 /* Return the LHS of call statement GS. */
2781 static inline tree
2782 gimple_call_lhs (const gcall *gs)
2784 return gs->op[0];
2787 static inline tree
2788 gimple_call_lhs (const gimple *gs)
2790 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2791 return gimple_call_lhs (gc);
2795 /* Return a pointer to the LHS of call statement GS. */
2797 static inline tree *
2798 gimple_call_lhs_ptr (gcall *gs)
2800 return &gs->op[0];
2803 static inline tree *
2804 gimple_call_lhs_ptr (gimple *gs)
2806 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2807 return gimple_call_lhs_ptr (gc);
2811 /* Set LHS to be the LHS operand of call statement GS. */
2813 static inline void
2814 gimple_call_set_lhs (gcall *gs, tree lhs)
2816 gs->op[0] = lhs;
2817 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2818 SSA_NAME_DEF_STMT (lhs) = gs;
2821 static inline void
2822 gimple_call_set_lhs (gimple *gs, tree lhs)
2824 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2825 gimple_call_set_lhs (gc, lhs);
2829 /* Return true if call GS calls an internal-only function, as enumerated
2830 by internal_fn. */
2832 static inline bool
2833 gimple_call_internal_p (const gcall *gs)
2835 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2838 static inline bool
2839 gimple_call_internal_p (const gimple *gs)
2841 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2842 return gimple_call_internal_p (gc);
2846 /* Return true if call GS is marked as instrumented by
2847 Pointer Bounds Checker. */
2849 static inline bool
2850 gimple_call_with_bounds_p (const gcall *gs)
2852 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2855 static inline bool
2856 gimple_call_with_bounds_p (const gimple *gs)
2858 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2859 return gimple_call_with_bounds_p (gc);
2863 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2864 Pointer Bounds Checker. */
2866 static inline void
2867 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2869 if (with_bounds)
2870 gs->subcode |= GF_CALL_WITH_BOUNDS;
2871 else
2872 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2875 static inline void
2876 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2878 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2879 gimple_call_set_with_bounds (gc, with_bounds);
2883 /* Return the target of internal call GS. */
2885 static inline enum internal_fn
2886 gimple_call_internal_fn (const gcall *gs)
2888 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2889 return gs->u.internal_fn;
2892 static inline enum internal_fn
2893 gimple_call_internal_fn (const gimple *gs)
2895 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2896 return gimple_call_internal_fn (gc);
2899 /* Return true, if this internal gimple call is unique. */
2901 static inline bool
2902 gimple_call_internal_unique_p (const gcall *gs)
2904 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2907 static inline bool
2908 gimple_call_internal_unique_p (const gimple *gs)
2910 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2911 return gimple_call_internal_unique_p (gc);
2914 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2915 that could alter control flow. */
2917 static inline void
2918 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2920 if (ctrl_altering_p)
2921 s->subcode |= GF_CALL_CTRL_ALTERING;
2922 else
2923 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2926 static inline void
2927 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2929 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2930 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2933 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2934 flag is set. Such call could not be a stmt in the middle of a bb. */
2936 static inline bool
2937 gimple_call_ctrl_altering_p (const gcall *gs)
2939 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2942 static inline bool
2943 gimple_call_ctrl_altering_p (const gimple *gs)
2945 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2946 return gimple_call_ctrl_altering_p (gc);
2950 /* Return the function type of the function called by GS. */
2952 static inline tree
2953 gimple_call_fntype (const gcall *gs)
2955 if (gimple_call_internal_p (gs))
2956 return NULL_TREE;
2957 return gs->u.fntype;
2960 static inline tree
2961 gimple_call_fntype (const gimple *gs)
2963 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2964 return gimple_call_fntype (call_stmt);
2967 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2969 static inline void
2970 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2972 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2973 call_stmt->u.fntype = fntype;
2977 /* Return the tree node representing the function called by call
2978 statement GS. */
2980 static inline tree
2981 gimple_call_fn (const gcall *gs)
2983 return gs->op[1];
2986 static inline tree
2987 gimple_call_fn (const gimple *gs)
2989 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2990 return gimple_call_fn (gc);
2993 /* Return a pointer to the tree node representing the function called by call
2994 statement GS. */
2996 static inline tree *
2997 gimple_call_fn_ptr (gcall *gs)
2999 return &gs->op[1];
3002 static inline tree *
3003 gimple_call_fn_ptr (gimple *gs)
3005 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3006 return gimple_call_fn_ptr (gc);
3010 /* Set FN to be the function called by call statement GS. */
3012 static inline void
3013 gimple_call_set_fn (gcall *gs, tree fn)
3015 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3016 gs->op[1] = fn;
3020 /* Set FNDECL to be the function called by call statement GS. */
3022 static inline void
3023 gimple_call_set_fndecl (gcall *gs, tree decl)
3025 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3026 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3027 build_pointer_type (TREE_TYPE (decl)), decl);
3030 static inline void
3031 gimple_call_set_fndecl (gimple *gs, tree decl)
3033 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3034 gimple_call_set_fndecl (gc, decl);
3038 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3040 static inline void
3041 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3043 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3044 call_stmt->u.internal_fn = fn;
3048 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3049 Otherwise return NULL. This function is analogous to
3050 get_callee_fndecl in tree land. */
3052 static inline tree
3053 gimple_call_fndecl (const gcall *gs)
3055 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3058 static inline tree
3059 gimple_call_fndecl (const gimple *gs)
3061 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3062 return gimple_call_fndecl (gc);
3066 /* Return the type returned by call statement GS. */
3068 static inline tree
3069 gimple_call_return_type (const gcall *gs)
3071 tree type = gimple_call_fntype (gs);
3073 if (type == NULL_TREE)
3074 return TREE_TYPE (gimple_call_lhs (gs));
3076 /* The type returned by a function is the type of its
3077 function type. */
3078 return TREE_TYPE (type);
3082 /* Return the static chain for call statement GS. */
3084 static inline tree
3085 gimple_call_chain (const gcall *gs)
3087 return gs->op[2];
3090 static inline tree
3091 gimple_call_chain (const gimple *gs)
3093 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3094 return gimple_call_chain (gc);
3098 /* Return a pointer to the static chain for call statement CALL_STMT. */
3100 static inline tree *
3101 gimple_call_chain_ptr (gcall *call_stmt)
3103 return &call_stmt->op[2];
3106 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3108 static inline void
3109 gimple_call_set_chain (gcall *call_stmt, tree chain)
3111 call_stmt->op[2] = chain;
3115 /* Return the number of arguments used by call statement GS. */
3117 static inline unsigned
3118 gimple_call_num_args (const gcall *gs)
3120 return gimple_num_ops (gs) - 3;
3123 static inline unsigned
3124 gimple_call_num_args (const gimple *gs)
3126 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3127 return gimple_call_num_args (gc);
3131 /* Return the argument at position INDEX for call statement GS. */
3133 static inline tree
3134 gimple_call_arg (const gcall *gs, unsigned index)
3136 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3137 return gs->op[index + 3];
3140 static inline tree
3141 gimple_call_arg (const gimple *gs, unsigned index)
3143 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3144 return gimple_call_arg (gc, index);
3148 /* Return a pointer to the argument at position INDEX for call
3149 statement GS. */
3151 static inline tree *
3152 gimple_call_arg_ptr (gcall *gs, unsigned index)
3154 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3155 return &gs->op[index + 3];
3158 static inline tree *
3159 gimple_call_arg_ptr (gimple *gs, unsigned index)
3161 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3162 return gimple_call_arg_ptr (gc, index);
3166 /* Set ARG to be the argument at position INDEX for call statement GS. */
3168 static inline void
3169 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3171 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3172 gs->op[index + 3] = arg;
3175 static inline void
3176 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3178 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3179 gimple_call_set_arg (gc, index, arg);
3183 /* If TAIL_P is true, mark call statement S as being a tail call
3184 (i.e., a call just before the exit of a function). These calls are
3185 candidate for tail call optimization. */
3187 static inline void
3188 gimple_call_set_tail (gcall *s, bool tail_p)
3190 if (tail_p)
3191 s->subcode |= GF_CALL_TAILCALL;
3192 else
3193 s->subcode &= ~GF_CALL_TAILCALL;
3197 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3199 static inline bool
3200 gimple_call_tail_p (gcall *s)
3202 return (s->subcode & GF_CALL_TAILCALL) != 0;
3206 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3207 slot optimization. This transformation uses the target of the call
3208 expansion as the return slot for calls that return in memory. */
3210 static inline void
3211 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3213 if (return_slot_opt_p)
3214 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3215 else
3216 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3220 /* Return true if S is marked for return slot optimization. */
3222 static inline bool
3223 gimple_call_return_slot_opt_p (gcall *s)
3225 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3229 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3230 thunk to the thunked-to function. */
3232 static inline void
3233 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3235 if (from_thunk_p)
3236 s->subcode |= GF_CALL_FROM_THUNK;
3237 else
3238 s->subcode &= ~GF_CALL_FROM_THUNK;
3242 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3244 static inline bool
3245 gimple_call_from_thunk_p (gcall *s)
3247 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3251 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3252 argument pack in its argument list. */
3254 static inline void
3255 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3257 if (pass_arg_pack_p)
3258 s->subcode |= GF_CALL_VA_ARG_PACK;
3259 else
3260 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3264 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3265 argument pack in its argument list. */
3267 static inline bool
3268 gimple_call_va_arg_pack_p (gcall *s)
3270 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3274 /* Return true if S is a noreturn call. */
3276 static inline bool
3277 gimple_call_noreturn_p (const gcall *s)
3279 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3282 static inline bool
3283 gimple_call_noreturn_p (const gimple *s)
3285 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3286 return gimple_call_noreturn_p (gc);
3290 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3291 even if the called function can throw in other cases. */
3293 static inline void
3294 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3296 if (nothrow_p)
3297 s->subcode |= GF_CALL_NOTHROW;
3298 else
3299 s->subcode &= ~GF_CALL_NOTHROW;
3302 /* Return true if S is a nothrow call. */
3304 static inline bool
3305 gimple_call_nothrow_p (gcall *s)
3307 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3310 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3311 is known to be emitted for VLA objects. Those are wrapped by
3312 stack_save/stack_restore calls and hence can't lead to unbounded
3313 stack growth even when they occur in loops. */
3315 static inline void
3316 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3318 if (for_var)
3319 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3320 else
3321 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3324 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3326 static inline bool
3327 gimple_call_alloca_for_var_p (gcall *s)
3329 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3332 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3334 static inline void
3335 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3337 dest_call->subcode = orig_call->subcode;
3341 /* Return a pointer to the points-to solution for the set of call-used
3342 variables of the call CALL_STMT. */
3344 static inline struct pt_solution *
3345 gimple_call_use_set (gcall *call_stmt)
3347 return &call_stmt->call_used;
3351 /* Return a pointer to the points-to solution for the set of call-used
3352 variables of the call CALL_STMT. */
3354 static inline struct pt_solution *
3355 gimple_call_clobber_set (gcall *call_stmt)
3357 return &call_stmt->call_clobbered;
3361 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3362 non-NULL lhs. */
3364 static inline bool
3365 gimple_has_lhs (gimple *stmt)
3367 if (is_gimple_assign (stmt))
3368 return true;
3369 if (gcall *call = dyn_cast <gcall *> (stmt))
3370 return gimple_call_lhs (call) != NULL_TREE;
3371 return false;
3375 /* Return the code of the predicate computed by conditional statement GS. */
3377 static inline enum tree_code
3378 gimple_cond_code (const gcond *gs)
3380 return (enum tree_code) gs->subcode;
3383 static inline enum tree_code
3384 gimple_cond_code (const gimple *gs)
3386 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3387 return gimple_cond_code (gc);
3391 /* Set CODE to be the predicate code for the conditional statement GS. */
3393 static inline void
3394 gimple_cond_set_code (gcond *gs, enum tree_code code)
3396 gs->subcode = code;
3400 /* Return the LHS of the predicate computed by conditional statement GS. */
3402 static inline tree
3403 gimple_cond_lhs (const gcond *gs)
3405 return gs->op[0];
3408 static inline tree
3409 gimple_cond_lhs (const gimple *gs)
3411 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3412 return gimple_cond_lhs (gc);
3415 /* Return the pointer to the LHS of the predicate computed by conditional
3416 statement GS. */
3418 static inline tree *
3419 gimple_cond_lhs_ptr (gcond *gs)
3421 return &gs->op[0];
3424 /* Set LHS to be the LHS operand of the predicate computed by
3425 conditional statement GS. */
3427 static inline void
3428 gimple_cond_set_lhs (gcond *gs, tree lhs)
3430 gs->op[0] = lhs;
3434 /* Return the RHS operand of the predicate computed by conditional GS. */
3436 static inline tree
3437 gimple_cond_rhs (const gcond *gs)
3439 return gs->op[1];
3442 static inline tree
3443 gimple_cond_rhs (const gimple *gs)
3445 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3446 return gimple_cond_rhs (gc);
3449 /* Return the pointer to the RHS operand of the predicate computed by
3450 conditional GS. */
3452 static inline tree *
3453 gimple_cond_rhs_ptr (gcond *gs)
3455 return &gs->op[1];
3459 /* Set RHS to be the RHS operand of the predicate computed by
3460 conditional statement GS. */
3462 static inline void
3463 gimple_cond_set_rhs (gcond *gs, tree rhs)
3465 gs->op[1] = rhs;
3469 /* Return the label used by conditional statement GS when its
3470 predicate evaluates to true. */
3472 static inline tree
3473 gimple_cond_true_label (const gcond *gs)
3475 return gs->op[2];
3479 /* Set LABEL to be the label used by conditional statement GS when its
3480 predicate evaluates to true. */
3482 static inline void
3483 gimple_cond_set_true_label (gcond *gs, tree label)
3485 gs->op[2] = label;
3489 /* Set LABEL to be the label used by conditional statement GS when its
3490 predicate evaluates to false. */
3492 static inline void
3493 gimple_cond_set_false_label (gcond *gs, tree label)
3495 gs->op[3] = label;
3499 /* Return the label used by conditional statement GS when its
3500 predicate evaluates to false. */
3502 static inline tree
3503 gimple_cond_false_label (const gcond *gs)
3505 return gs->op[3];
3509 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3511 static inline void
3512 gimple_cond_make_false (gcond *gs)
3514 gimple_cond_set_lhs (gs, boolean_false_node);
3515 gimple_cond_set_rhs (gs, boolean_false_node);
3516 gs->subcode = NE_EXPR;
3520 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3522 static inline void
3523 gimple_cond_make_true (gcond *gs)
3525 gimple_cond_set_lhs (gs, boolean_true_node);
3526 gimple_cond_set_rhs (gs, boolean_false_node);
3527 gs->subcode = NE_EXPR;
3530 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3531 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3533 static inline bool
3534 gimple_cond_true_p (const gcond *gs)
3536 tree lhs = gimple_cond_lhs (gs);
3537 tree rhs = gimple_cond_rhs (gs);
3538 enum tree_code code = gimple_cond_code (gs);
3540 if (lhs != boolean_true_node && lhs != boolean_false_node)
3541 return false;
3543 if (rhs != boolean_true_node && rhs != boolean_false_node)
3544 return false;
3546 if (code == NE_EXPR && lhs != rhs)
3547 return true;
3549 if (code == EQ_EXPR && lhs == rhs)
3550 return true;
3552 return false;
3555 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3556 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3558 static inline bool
3559 gimple_cond_false_p (const gcond *gs)
3561 tree lhs = gimple_cond_lhs (gs);
3562 tree rhs = gimple_cond_rhs (gs);
3563 enum tree_code code = gimple_cond_code (gs);
3565 if (lhs != boolean_true_node && lhs != boolean_false_node)
3566 return false;
3568 if (rhs != boolean_true_node && rhs != boolean_false_node)
3569 return false;
3571 if (code == NE_EXPR && lhs == rhs)
3572 return true;
3574 if (code == EQ_EXPR && lhs != rhs)
3575 return true;
3577 return false;
3580 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3582 static inline void
3583 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3584 tree rhs)
3586 gimple_cond_set_code (stmt, code);
3587 gimple_cond_set_lhs (stmt, lhs);
3588 gimple_cond_set_rhs (stmt, rhs);
3591 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3593 static inline tree
3594 gimple_label_label (const glabel *gs)
3596 return gs->op[0];
3600 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3601 GS. */
3603 static inline void
3604 gimple_label_set_label (glabel *gs, tree label)
3606 gs->op[0] = label;
3610 /* Return the destination of the unconditional jump GS. */
3612 static inline tree
3613 gimple_goto_dest (const gimple *gs)
3615 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3616 return gimple_op (gs, 0);
3620 /* Set DEST to be the destination of the unconditonal jump GS. */
3622 static inline void
3623 gimple_goto_set_dest (ggoto *gs, tree dest)
3625 gs->op[0] = dest;
3629 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3631 static inline tree
3632 gimple_bind_vars (const gbind *bind_stmt)
3634 return bind_stmt->vars;
3638 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3639 statement GS. */
3641 static inline void
3642 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3644 bind_stmt->vars = vars;
3648 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3649 statement GS. */
3651 static inline void
3652 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3654 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3658 static inline gimple_seq *
3659 gimple_bind_body_ptr (gbind *bind_stmt)
3661 return &bind_stmt->body;
3664 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3666 static inline gimple_seq
3667 gimple_bind_body (gbind *gs)
3669 return *gimple_bind_body_ptr (gs);
3673 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3674 statement GS. */
3676 static inline void
3677 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3679 bind_stmt->body = seq;
3683 /* Append a statement to the end of a GIMPLE_BIND's body. */
3685 static inline void
3686 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3688 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3692 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3694 static inline void
3695 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3697 gimple_seq_add_seq (&bind_stmt->body, seq);
3701 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3702 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3704 static inline tree
3705 gimple_bind_block (const gbind *bind_stmt)
3707 return bind_stmt->block;
3711 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3712 statement GS. */
3714 static inline void
3715 gimple_bind_set_block (gbind *bind_stmt, tree block)
3717 gcc_gimple_checking_assert (block == NULL_TREE
3718 || TREE_CODE (block) == BLOCK);
3719 bind_stmt->block = block;
3723 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3725 static inline unsigned
3726 gimple_asm_ninputs (const gasm *asm_stmt)
3728 return asm_stmt->ni;
3732 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3734 static inline unsigned
3735 gimple_asm_noutputs (const gasm *asm_stmt)
3737 return asm_stmt->no;
3741 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3743 static inline unsigned
3744 gimple_asm_nclobbers (const gasm *asm_stmt)
3746 return asm_stmt->nc;
3749 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3751 static inline unsigned
3752 gimple_asm_nlabels (const gasm *asm_stmt)
3754 return asm_stmt->nl;
3757 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3759 static inline tree
3760 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3762 gcc_gimple_checking_assert (index < asm_stmt->ni);
3763 return asm_stmt->op[index + asm_stmt->no];
3766 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3768 static inline void
3769 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3771 gcc_gimple_checking_assert (index < asm_stmt->ni
3772 && TREE_CODE (in_op) == TREE_LIST);
3773 asm_stmt->op[index + asm_stmt->no] = in_op;
3777 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3779 static inline tree
3780 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3782 gcc_gimple_checking_assert (index < asm_stmt->no);
3783 return asm_stmt->op[index];
3786 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3788 static inline void
3789 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3791 gcc_gimple_checking_assert (index < asm_stmt->no
3792 && TREE_CODE (out_op) == TREE_LIST);
3793 asm_stmt->op[index] = out_op;
3797 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3799 static inline tree
3800 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3802 gcc_gimple_checking_assert (index < asm_stmt->nc);
3803 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3807 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3809 static inline void
3810 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3812 gcc_gimple_checking_assert (index < asm_stmt->nc
3813 && TREE_CODE (clobber_op) == TREE_LIST);
3814 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3817 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3819 static inline tree
3820 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3822 gcc_gimple_checking_assert (index < asm_stmt->nl);
3823 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3826 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3828 static inline void
3829 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3831 gcc_gimple_checking_assert (index < asm_stmt->nl
3832 && TREE_CODE (label_op) == TREE_LIST);
3833 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3836 /* Return the string representing the assembly instruction in
3837 GIMPLE_ASM ASM_STMT. */
3839 static inline const char *
3840 gimple_asm_string (const gasm *asm_stmt)
3842 return asm_stmt->string;
3846 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3848 static inline bool
3849 gimple_asm_volatile_p (const gasm *asm_stmt)
3851 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3855 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3857 static inline void
3858 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3860 if (volatile_p)
3861 asm_stmt->subcode |= GF_ASM_VOLATILE;
3862 else
3863 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3867 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3869 static inline void
3870 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3872 if (input_p)
3873 asm_stmt->subcode |= GF_ASM_INPUT;
3874 else
3875 asm_stmt->subcode &= ~GF_ASM_INPUT;
3879 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3881 static inline bool
3882 gimple_asm_input_p (const gasm *asm_stmt)
3884 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3888 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3890 static inline tree
3891 gimple_catch_types (const gcatch *catch_stmt)
3893 return catch_stmt->types;
3897 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3899 static inline tree *
3900 gimple_catch_types_ptr (gcatch *catch_stmt)
3902 return &catch_stmt->types;
3906 /* Return a pointer to the GIMPLE sequence representing the body of
3907 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3909 static inline gimple_seq *
3910 gimple_catch_handler_ptr (gcatch *catch_stmt)
3912 return &catch_stmt->handler;
3916 /* Return the GIMPLE sequence representing the body of the handler of
3917 GIMPLE_CATCH statement CATCH_STMT. */
3919 static inline gimple_seq
3920 gimple_catch_handler (gcatch *catch_stmt)
3922 return *gimple_catch_handler_ptr (catch_stmt);
3926 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3928 static inline void
3929 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3931 catch_stmt->types = t;
3935 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3937 static inline void
3938 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3940 catch_stmt->handler = handler;
3944 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3946 static inline tree
3947 gimple_eh_filter_types (const gimple *gs)
3949 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3950 return eh_filter_stmt->types;
3954 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3955 GS. */
3957 static inline tree *
3958 gimple_eh_filter_types_ptr (gimple *gs)
3960 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3961 return &eh_filter_stmt->types;
3965 /* Return a pointer to the sequence of statement to execute when
3966 GIMPLE_EH_FILTER statement fails. */
3968 static inline gimple_seq *
3969 gimple_eh_filter_failure_ptr (gimple *gs)
3971 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3972 return &eh_filter_stmt->failure;
3976 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3977 statement fails. */
3979 static inline gimple_seq
3980 gimple_eh_filter_failure (gimple *gs)
3982 return *gimple_eh_filter_failure_ptr (gs);
3986 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3987 EH_FILTER_STMT. */
3989 static inline void
3990 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3992 eh_filter_stmt->types = types;
3996 /* Set FAILURE to be the sequence of statements to execute on failure
3997 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3999 static inline void
4000 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4001 gimple_seq failure)
4003 eh_filter_stmt->failure = failure;
4006 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4008 static inline tree
4009 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4011 return eh_mnt_stmt->fndecl;
4014 /* Set the function decl to be called by GS to DECL. */
4016 static inline void
4017 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4018 tree decl)
4020 eh_mnt_stmt->fndecl = decl;
4023 /* GIMPLE_EH_ELSE accessors. */
4025 static inline gimple_seq *
4026 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4028 return &eh_else_stmt->n_body;
4031 static inline gimple_seq
4032 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4034 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4037 static inline gimple_seq *
4038 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4040 return &eh_else_stmt->e_body;
4043 static inline gimple_seq
4044 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4046 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4049 static inline void
4050 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4052 eh_else_stmt->n_body = seq;
4055 static inline void
4056 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4058 eh_else_stmt->e_body = seq;
4061 /* GIMPLE_TRY accessors. */
4063 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4064 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4066 static inline enum gimple_try_flags
4067 gimple_try_kind (const gimple *gs)
4069 GIMPLE_CHECK (gs, GIMPLE_TRY);
4070 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4074 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4076 static inline void
4077 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4079 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4080 || kind == GIMPLE_TRY_FINALLY);
4081 if (gimple_try_kind (gs) != kind)
4082 gs->subcode = (unsigned int) kind;
4086 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4088 static inline bool
4089 gimple_try_catch_is_cleanup (const gimple *gs)
4091 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4092 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4096 /* Return a pointer to the sequence of statements used as the
4097 body for GIMPLE_TRY GS. */
4099 static inline gimple_seq *
4100 gimple_try_eval_ptr (gimple *gs)
4102 gtry *try_stmt = as_a <gtry *> (gs);
4103 return &try_stmt->eval;
4107 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4109 static inline gimple_seq
4110 gimple_try_eval (gimple *gs)
4112 return *gimple_try_eval_ptr (gs);
4116 /* Return a pointer to the sequence of statements used as the cleanup body for
4117 GIMPLE_TRY GS. */
4119 static inline gimple_seq *
4120 gimple_try_cleanup_ptr (gimple *gs)
4122 gtry *try_stmt = as_a <gtry *> (gs);
4123 return &try_stmt->cleanup;
4127 /* Return the sequence of statements used as the cleanup body for
4128 GIMPLE_TRY GS. */
4130 static inline gimple_seq
4131 gimple_try_cleanup (gimple *gs)
4133 return *gimple_try_cleanup_ptr (gs);
4137 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4139 static inline void
4140 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4142 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4143 if (catch_is_cleanup)
4144 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4145 else
4146 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4150 /* Set EVAL to be the sequence of statements to use as the body for
4151 GIMPLE_TRY TRY_STMT. */
4153 static inline void
4154 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4156 try_stmt->eval = eval;
4160 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4161 body for GIMPLE_TRY TRY_STMT. */
4163 static inline void
4164 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4166 try_stmt->cleanup = cleanup;
4170 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4172 static inline gimple_seq *
4173 gimple_wce_cleanup_ptr (gimple *gs)
4175 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4176 return &wce_stmt->cleanup;
4180 /* Return the cleanup sequence for cleanup statement GS. */
4182 static inline gimple_seq
4183 gimple_wce_cleanup (gimple *gs)
4185 return *gimple_wce_cleanup_ptr (gs);
4189 /* Set CLEANUP to be the cleanup sequence for GS. */
4191 static inline void
4192 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4194 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4195 wce_stmt->cleanup = cleanup;
4199 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4201 static inline bool
4202 gimple_wce_cleanup_eh_only (const gimple *gs)
4204 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4205 return gs->subcode != 0;
4209 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4211 static inline void
4212 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4214 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4215 gs->subcode = (unsigned int) eh_only_p;
4219 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4221 static inline unsigned
4222 gimple_phi_capacity (const gimple *gs)
4224 const gphi *phi_stmt = as_a <const gphi *> (gs);
4225 return phi_stmt->capacity;
4229 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4230 be exactly the number of incoming edges for the basic block holding
4231 GS. */
4233 static inline unsigned
4234 gimple_phi_num_args (const gimple *gs)
4236 const gphi *phi_stmt = as_a <const gphi *> (gs);
4237 return phi_stmt->nargs;
4241 /* Return the SSA name created by GIMPLE_PHI GS. */
4243 static inline tree
4244 gimple_phi_result (const gimple *gs)
4246 const gphi *phi_stmt = as_a <const gphi *> (gs);
4247 return phi_stmt->result;
4250 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4252 static inline tree *
4253 gimple_phi_result_ptr (gimple *gs)
4255 gphi *phi_stmt = as_a <gphi *> (gs);
4256 return &phi_stmt->result;
4259 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4261 static inline void
4262 gimple_phi_set_result (gphi *phi, tree result)
4264 phi->result = result;
4265 if (result && TREE_CODE (result) == SSA_NAME)
4266 SSA_NAME_DEF_STMT (result) = phi;
4270 /* Return the PHI argument corresponding to incoming edge INDEX for
4271 GIMPLE_PHI GS. */
4273 static inline struct phi_arg_d *
4274 gimple_phi_arg (gimple *gs, unsigned index)
4276 gphi *phi_stmt = as_a <gphi *> (gs);
4277 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4278 return &(phi_stmt->args[index]);
4281 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4282 for GIMPLE_PHI PHI. */
4284 static inline void
4285 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4287 gcc_gimple_checking_assert (index <= phi->nargs);
4288 phi->args[index] = *phiarg;
4291 /* Return the PHI nodes for basic block BB, or NULL if there are no
4292 PHI nodes. */
4294 static inline gimple_seq
4295 phi_nodes (const_basic_block bb)
4297 gcc_checking_assert (!(bb->flags & BB_RTL));
4298 return bb->il.gimple.phi_nodes;
4301 /* Return a pointer to the PHI nodes for basic block BB. */
4303 static inline gimple_seq *
4304 phi_nodes_ptr (basic_block bb)
4306 gcc_checking_assert (!(bb->flags & BB_RTL));
4307 return &bb->il.gimple.phi_nodes;
4310 /* Return the tree operand for argument I of PHI node GS. */
4312 static inline tree
4313 gimple_phi_arg_def (gimple *gs, size_t index)
4315 return gimple_phi_arg (gs, index)->def;
4319 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4321 static inline tree *
4322 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4324 return &gimple_phi_arg (phi, index)->def;
4327 /* Return the edge associated with argument I of phi node PHI. */
4329 static inline edge
4330 gimple_phi_arg_edge (gphi *phi, size_t i)
4332 return EDGE_PRED (gimple_bb (phi), i);
4335 /* Return the source location of gimple argument I of phi node PHI. */
4337 static inline source_location
4338 gimple_phi_arg_location (gphi *phi, size_t i)
4340 return gimple_phi_arg (phi, i)->locus;
4343 /* Return the source location of the argument on edge E of phi node PHI. */
4345 static inline source_location
4346 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4348 return gimple_phi_arg (phi, e->dest_idx)->locus;
4351 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4353 static inline void
4354 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4356 gimple_phi_arg (phi, i)->locus = loc;
4359 /* Return TRUE if argument I of phi node PHI has a location record. */
4361 static inline bool
4362 gimple_phi_arg_has_location (gphi *phi, size_t i)
4364 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4368 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4370 static inline int
4371 gimple_resx_region (const gresx *resx_stmt)
4373 return resx_stmt->region;
4376 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4378 static inline void
4379 gimple_resx_set_region (gresx *resx_stmt, int region)
4381 resx_stmt->region = region;
4384 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4386 static inline int
4387 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4389 return eh_dispatch_stmt->region;
4392 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4393 EH_DISPATCH_STMT. */
4395 static inline void
4396 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4398 eh_dispatch_stmt->region = region;
4401 /* Return the number of labels associated with the switch statement GS. */
4403 static inline unsigned
4404 gimple_switch_num_labels (const gswitch *gs)
4406 unsigned num_ops;
4407 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4408 num_ops = gimple_num_ops (gs);
4409 gcc_gimple_checking_assert (num_ops > 1);
4410 return num_ops - 1;
4414 /* Set NLABELS to be the number of labels for the switch statement GS. */
4416 static inline void
4417 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4419 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4420 gimple_set_num_ops (g, nlabels + 1);
4424 /* Return the index variable used by the switch statement GS. */
4426 static inline tree
4427 gimple_switch_index (const gswitch *gs)
4429 return gs->op[0];
4433 /* Return a pointer to the index variable for the switch statement GS. */
4435 static inline tree *
4436 gimple_switch_index_ptr (gswitch *gs)
4438 return &gs->op[0];
4442 /* Set INDEX to be the index variable for switch statement GS. */
4444 static inline void
4445 gimple_switch_set_index (gswitch *gs, tree index)
4447 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4448 gs->op[0] = index;
4452 /* Return the label numbered INDEX. The default label is 0, followed by any
4453 labels in a switch statement. */
4455 static inline tree
4456 gimple_switch_label (const gswitch *gs, unsigned index)
4458 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4459 return gs->op[index + 1];
4462 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4464 static inline void
4465 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4467 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4468 && (label == NULL_TREE
4469 || TREE_CODE (label) == CASE_LABEL_EXPR));
4470 gs->op[index + 1] = label;
4473 /* Return the default label for a switch statement. */
4475 static inline tree
4476 gimple_switch_default_label (const gswitch *gs)
4478 tree label = gimple_switch_label (gs, 0);
4479 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4480 return label;
4483 /* Set the default label for a switch statement. */
4485 static inline void
4486 gimple_switch_set_default_label (gswitch *gs, tree label)
4488 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4489 gimple_switch_set_label (gs, 0, label);
4492 /* Return true if GS is a GIMPLE_DEBUG statement. */
4494 static inline bool
4495 is_gimple_debug (const gimple *gs)
4497 return gimple_code (gs) == GIMPLE_DEBUG;
4500 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4502 static inline bool
4503 gimple_debug_bind_p (const gimple *s)
4505 if (is_gimple_debug (s))
4506 return s->subcode == GIMPLE_DEBUG_BIND;
4508 return false;
4511 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4513 static inline tree
4514 gimple_debug_bind_get_var (gimple *dbg)
4516 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4517 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4518 return gimple_op (dbg, 0);
4521 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4522 statement. */
4524 static inline tree
4525 gimple_debug_bind_get_value (gimple *dbg)
4527 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4528 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4529 return gimple_op (dbg, 1);
4532 /* Return a pointer to the value bound to the variable in a
4533 GIMPLE_DEBUG bind statement. */
4535 static inline tree *
4536 gimple_debug_bind_get_value_ptr (gimple *dbg)
4538 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4539 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4540 return gimple_op_ptr (dbg, 1);
4543 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4545 static inline void
4546 gimple_debug_bind_set_var (gimple *dbg, tree var)
4548 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4549 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4550 gimple_set_op (dbg, 0, var);
4553 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4554 statement. */
4556 static inline void
4557 gimple_debug_bind_set_value (gimple *dbg, tree value)
4559 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4560 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4561 gimple_set_op (dbg, 1, value);
4564 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4565 optimized away. */
4566 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4568 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4569 statement. */
4571 static inline void
4572 gimple_debug_bind_reset_value (gimple *dbg)
4574 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4575 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4576 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4579 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4580 value. */
4582 static inline bool
4583 gimple_debug_bind_has_value_p (gimple *dbg)
4585 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4586 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4587 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4590 #undef GIMPLE_DEBUG_BIND_NOVALUE
4592 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4594 static inline bool
4595 gimple_debug_source_bind_p (const gimple *s)
4597 if (is_gimple_debug (s))
4598 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4600 return false;
4603 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4605 static inline tree
4606 gimple_debug_source_bind_get_var (gimple *dbg)
4608 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4609 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4610 return gimple_op (dbg, 0);
4613 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4614 statement. */
4616 static inline tree
4617 gimple_debug_source_bind_get_value (gimple *dbg)
4619 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4620 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4621 return gimple_op (dbg, 1);
4624 /* Return a pointer to the value bound to the variable in a
4625 GIMPLE_DEBUG source bind statement. */
4627 static inline tree *
4628 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4630 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4631 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4632 return gimple_op_ptr (dbg, 1);
4635 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4637 static inline void
4638 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4640 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4641 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4642 gimple_set_op (dbg, 0, var);
4645 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4646 statement. */
4648 static inline void
4649 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4651 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4652 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4653 gimple_set_op (dbg, 1, value);
4656 /* Return the line number for EXPR, or return -1 if we have no line
4657 number information for it. */
4658 static inline int
4659 get_lineno (const gimple *stmt)
4661 location_t loc;
4663 if (!stmt)
4664 return -1;
4666 loc = gimple_location (stmt);
4667 if (loc == UNKNOWN_LOCATION)
4668 return -1;
4670 return LOCATION_LINE (loc);
4673 /* Return a pointer to the body for the OMP statement GS. */
4675 static inline gimple_seq *
4676 gimple_omp_body_ptr (gimple *gs)
4678 return &static_cast <gimple_statement_omp *> (gs)->body;
4681 /* Return the body for the OMP statement GS. */
4683 static inline gimple_seq
4684 gimple_omp_body (gimple *gs)
4686 return *gimple_omp_body_ptr (gs);
4689 /* Set BODY to be the body for the OMP statement GS. */
4691 static inline void
4692 gimple_omp_set_body (gimple *gs, gimple_seq body)
4694 static_cast <gimple_statement_omp *> (gs)->body = body;
4698 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4700 static inline tree
4701 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4703 return crit_stmt->name;
4707 /* Return a pointer to the name associated with OMP critical statement
4708 CRIT_STMT. */
4710 static inline tree *
4711 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4713 return &crit_stmt->name;
4717 /* Set NAME to be the name associated with OMP critical statement
4718 CRIT_STMT. */
4720 static inline void
4721 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4723 crit_stmt->name = name;
4727 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4729 static inline tree
4730 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4732 return crit_stmt->clauses;
4736 /* Return a pointer to the clauses associated with OMP critical statement
4737 CRIT_STMT. */
4739 static inline tree *
4740 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4742 return &crit_stmt->clauses;
4746 /* Set CLAUSES to be the clauses associated with OMP critical statement
4747 CRIT_STMT. */
4749 static inline void
4750 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4752 crit_stmt->clauses = clauses;
4756 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4758 static inline tree
4759 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4761 return ord_stmt->clauses;
4765 /* Return a pointer to the clauses associated with OMP ordered statement
4766 ORD_STMT. */
4768 static inline tree *
4769 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4771 return &ord_stmt->clauses;
4775 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4776 ORD_STMT. */
4778 static inline void
4779 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4781 ord_stmt->clauses = clauses;
4785 /* Return the kind of the OMP_FOR statemement G. */
4787 static inline int
4788 gimple_omp_for_kind (const gimple *g)
4790 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4791 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4795 /* Set the kind of the OMP_FOR statement G. */
4797 static inline void
4798 gimple_omp_for_set_kind (gomp_for *g, int kind)
4800 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4801 | (kind & GF_OMP_FOR_KIND_MASK);
4805 /* Return true if OMP_FOR statement G has the
4806 GF_OMP_FOR_COMBINED flag set. */
4808 static inline bool
4809 gimple_omp_for_combined_p (const gimple *g)
4811 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4812 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4816 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4817 the boolean value of COMBINED_P. */
4819 static inline void
4820 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4822 if (combined_p)
4823 g->subcode |= GF_OMP_FOR_COMBINED;
4824 else
4825 g->subcode &= ~GF_OMP_FOR_COMBINED;
4829 /* Return true if the OMP_FOR statement G has the
4830 GF_OMP_FOR_COMBINED_INTO flag set. */
4832 static inline bool
4833 gimple_omp_for_combined_into_p (const gimple *g)
4835 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4836 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4840 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4841 on the boolean value of COMBINED_P. */
4843 static inline void
4844 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4846 if (combined_p)
4847 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4848 else
4849 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4853 /* Return the clauses associated with the OMP_FOR statement GS. */
4855 static inline tree
4856 gimple_omp_for_clauses (const gimple *gs)
4858 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4859 return omp_for_stmt->clauses;
4863 /* Return a pointer to the clauses associated with the OMP_FOR statement
4864 GS. */
4866 static inline tree *
4867 gimple_omp_for_clauses_ptr (gimple *gs)
4869 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4870 return &omp_for_stmt->clauses;
4874 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4875 GS. */
4877 static inline void
4878 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4880 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4881 omp_for_stmt->clauses = clauses;
4885 /* Get the collapse count of the OMP_FOR statement GS. */
4887 static inline size_t
4888 gimple_omp_for_collapse (gimple *gs)
4890 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4891 return omp_for_stmt->collapse;
4895 /* Return the condition code associated with the OMP_FOR statement GS. */
4897 static inline enum tree_code
4898 gimple_omp_for_cond (const gimple *gs, size_t i)
4900 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4901 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4902 return omp_for_stmt->iter[i].cond;
4906 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4908 static inline void
4909 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4911 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4912 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4913 && i < omp_for_stmt->collapse);
4914 omp_for_stmt->iter[i].cond = cond;
4918 /* Return the index variable for the OMP_FOR statement GS. */
4920 static inline tree
4921 gimple_omp_for_index (const gimple *gs, size_t i)
4923 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4924 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4925 return omp_for_stmt->iter[i].index;
4929 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4931 static inline tree *
4932 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4934 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4935 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4936 return &omp_for_stmt->iter[i].index;
4940 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4942 static inline void
4943 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4945 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4946 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4947 omp_for_stmt->iter[i].index = index;
4951 /* Return the initial value for the OMP_FOR statement GS. */
4953 static inline tree
4954 gimple_omp_for_initial (const gimple *gs, size_t i)
4956 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4957 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4958 return omp_for_stmt->iter[i].initial;
4962 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4964 static inline tree *
4965 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4967 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4968 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4969 return &omp_for_stmt->iter[i].initial;
4973 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4975 static inline void
4976 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
4978 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4979 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4980 omp_for_stmt->iter[i].initial = initial;
4984 /* Return the final value for the OMP_FOR statement GS. */
4986 static inline tree
4987 gimple_omp_for_final (const gimple *gs, size_t i)
4989 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4990 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4991 return omp_for_stmt->iter[i].final;
4995 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4997 static inline tree *
4998 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5000 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5001 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5002 return &omp_for_stmt->iter[i].final;
5006 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5008 static inline void
5009 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5011 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5012 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5013 omp_for_stmt->iter[i].final = final;
5017 /* Return the increment value for the OMP_FOR statement GS. */
5019 static inline tree
5020 gimple_omp_for_incr (const gimple *gs, size_t i)
5022 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5023 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5024 return omp_for_stmt->iter[i].incr;
5028 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5030 static inline tree *
5031 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5033 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5034 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5035 return &omp_for_stmt->iter[i].incr;
5039 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5041 static inline void
5042 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5044 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5045 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5046 omp_for_stmt->iter[i].incr = incr;
5050 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5051 statement GS starts. */
5053 static inline gimple_seq *
5054 gimple_omp_for_pre_body_ptr (gimple *gs)
5056 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5057 return &omp_for_stmt->pre_body;
5061 /* Return the sequence of statements to execute before the OMP_FOR
5062 statement GS starts. */
5064 static inline gimple_seq
5065 gimple_omp_for_pre_body (gimple *gs)
5067 return *gimple_omp_for_pre_body_ptr (gs);
5071 /* Set PRE_BODY to be the sequence of statements to execute before the
5072 OMP_FOR statement GS starts. */
5074 static inline void
5075 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5077 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5078 omp_for_stmt->pre_body = pre_body;
5082 /* Return the clauses associated with OMP_PARALLEL GS. */
5084 static inline tree
5085 gimple_omp_parallel_clauses (const gimple *gs)
5087 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5088 return omp_parallel_stmt->clauses;
5092 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5094 static inline tree *
5095 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5097 return &omp_parallel_stmt->clauses;
5101 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5103 static inline void
5104 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5105 tree clauses)
5107 omp_parallel_stmt->clauses = clauses;
5111 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5113 static inline tree
5114 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5116 return omp_parallel_stmt->child_fn;
5119 /* Return a pointer to the child function used to hold the body of
5120 OMP_PARALLEL_STMT. */
5122 static inline tree *
5123 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5125 return &omp_parallel_stmt->child_fn;
5129 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5131 static inline void
5132 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5133 tree child_fn)
5135 omp_parallel_stmt->child_fn = child_fn;
5139 /* Return the artificial argument used to send variables and values
5140 from the parent to the children threads in OMP_PARALLEL_STMT. */
5142 static inline tree
5143 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5145 return omp_parallel_stmt->data_arg;
5149 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5151 static inline tree *
5152 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5154 return &omp_parallel_stmt->data_arg;
5158 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5160 static inline void
5161 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5162 tree data_arg)
5164 omp_parallel_stmt->data_arg = data_arg;
5168 /* Return the clauses associated with OMP_TASK GS. */
5170 static inline tree
5171 gimple_omp_task_clauses (const gimple *gs)
5173 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5174 return omp_task_stmt->clauses;
5178 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5180 static inline tree *
5181 gimple_omp_task_clauses_ptr (gimple *gs)
5183 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5184 return &omp_task_stmt->clauses;
5188 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5189 GS. */
5191 static inline void
5192 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5194 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5195 omp_task_stmt->clauses = clauses;
5199 /* Return true if OMP task statement G has the
5200 GF_OMP_TASK_TASKLOOP flag set. */
5202 static inline bool
5203 gimple_omp_task_taskloop_p (const gimple *g)
5205 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5206 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5210 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5211 value of TASKLOOP_P. */
5213 static inline void
5214 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5216 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5217 if (taskloop_p)
5218 g->subcode |= GF_OMP_TASK_TASKLOOP;
5219 else
5220 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5224 /* Return the child function used to hold the body of OMP_TASK GS. */
5226 static inline tree
5227 gimple_omp_task_child_fn (const gimple *gs)
5229 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5230 return omp_task_stmt->child_fn;
5233 /* Return a pointer to the child function used to hold the body of
5234 OMP_TASK GS. */
5236 static inline tree *
5237 gimple_omp_task_child_fn_ptr (gimple *gs)
5239 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5240 return &omp_task_stmt->child_fn;
5244 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5246 static inline void
5247 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5249 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5250 omp_task_stmt->child_fn = child_fn;
5254 /* Return the artificial argument used to send variables and values
5255 from the parent to the children threads in OMP_TASK GS. */
5257 static inline tree
5258 gimple_omp_task_data_arg (const gimple *gs)
5260 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5261 return omp_task_stmt->data_arg;
5265 /* Return a pointer to the data argument for OMP_TASK GS. */
5267 static inline tree *
5268 gimple_omp_task_data_arg_ptr (gimple *gs)
5270 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5271 return &omp_task_stmt->data_arg;
5275 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5277 static inline void
5278 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5280 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5281 omp_task_stmt->data_arg = data_arg;
5285 /* Return the clauses associated with OMP_TASK GS. */
5287 static inline tree
5288 gimple_omp_taskreg_clauses (const gimple *gs)
5290 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5291 = as_a <const gimple_statement_omp_taskreg *> (gs);
5292 return omp_taskreg_stmt->clauses;
5296 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5298 static inline tree *
5299 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5301 gimple_statement_omp_taskreg *omp_taskreg_stmt
5302 = as_a <gimple_statement_omp_taskreg *> (gs);
5303 return &omp_taskreg_stmt->clauses;
5307 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5308 GS. */
5310 static inline void
5311 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5313 gimple_statement_omp_taskreg *omp_taskreg_stmt
5314 = as_a <gimple_statement_omp_taskreg *> (gs);
5315 omp_taskreg_stmt->clauses = clauses;
5319 /* Return the child function used to hold the body of OMP_TASK GS. */
5321 static inline tree
5322 gimple_omp_taskreg_child_fn (const gimple *gs)
5324 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5325 = as_a <const gimple_statement_omp_taskreg *> (gs);
5326 return omp_taskreg_stmt->child_fn;
5329 /* Return a pointer to the child function used to hold the body of
5330 OMP_TASK GS. */
5332 static inline tree *
5333 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5335 gimple_statement_omp_taskreg *omp_taskreg_stmt
5336 = as_a <gimple_statement_omp_taskreg *> (gs);
5337 return &omp_taskreg_stmt->child_fn;
5341 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5343 static inline void
5344 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5346 gimple_statement_omp_taskreg *omp_taskreg_stmt
5347 = as_a <gimple_statement_omp_taskreg *> (gs);
5348 omp_taskreg_stmt->child_fn = child_fn;
5352 /* Return the artificial argument used to send variables and values
5353 from the parent to the children threads in OMP_TASK GS. */
5355 static inline tree
5356 gimple_omp_taskreg_data_arg (const gimple *gs)
5358 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5359 = as_a <const gimple_statement_omp_taskreg *> (gs);
5360 return omp_taskreg_stmt->data_arg;
5364 /* Return a pointer to the data argument for OMP_TASK GS. */
5366 static inline tree *
5367 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5369 gimple_statement_omp_taskreg *omp_taskreg_stmt
5370 = as_a <gimple_statement_omp_taskreg *> (gs);
5371 return &omp_taskreg_stmt->data_arg;
5375 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5377 static inline void
5378 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5380 gimple_statement_omp_taskreg *omp_taskreg_stmt
5381 = as_a <gimple_statement_omp_taskreg *> (gs);
5382 omp_taskreg_stmt->data_arg = data_arg;
5386 /* Return the copy function used to hold the body of OMP_TASK GS. */
5388 static inline tree
5389 gimple_omp_task_copy_fn (const gimple *gs)
5391 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5392 return omp_task_stmt->copy_fn;
5395 /* Return a pointer to the copy function used to hold the body of
5396 OMP_TASK GS. */
5398 static inline tree *
5399 gimple_omp_task_copy_fn_ptr (gimple *gs)
5401 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5402 return &omp_task_stmt->copy_fn;
5406 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5408 static inline void
5409 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5411 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5412 omp_task_stmt->copy_fn = copy_fn;
5416 /* Return size of the data block in bytes in OMP_TASK GS. */
5418 static inline tree
5419 gimple_omp_task_arg_size (const gimple *gs)
5421 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5422 return omp_task_stmt->arg_size;
5426 /* Return a pointer to the data block size for OMP_TASK GS. */
5428 static inline tree *
5429 gimple_omp_task_arg_size_ptr (gimple *gs)
5431 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5432 return &omp_task_stmt->arg_size;
5436 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5438 static inline void
5439 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5441 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5442 omp_task_stmt->arg_size = arg_size;
5446 /* Return align of the data block in bytes in OMP_TASK GS. */
5448 static inline tree
5449 gimple_omp_task_arg_align (const gimple *gs)
5451 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5452 return omp_task_stmt->arg_align;
5456 /* Return a pointer to the data block align for OMP_TASK GS. */
5458 static inline tree *
5459 gimple_omp_task_arg_align_ptr (gimple *gs)
5461 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5462 return &omp_task_stmt->arg_align;
5466 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5468 static inline void
5469 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5471 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5472 omp_task_stmt->arg_align = arg_align;
5476 /* Return the clauses associated with OMP_SINGLE GS. */
5478 static inline tree
5479 gimple_omp_single_clauses (const gimple *gs)
5481 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5482 return omp_single_stmt->clauses;
5486 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5488 static inline tree *
5489 gimple_omp_single_clauses_ptr (gimple *gs)
5491 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5492 return &omp_single_stmt->clauses;
5496 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5498 static inline void
5499 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5501 omp_single_stmt->clauses = clauses;
5505 /* Return the clauses associated with OMP_TARGET GS. */
5507 static inline tree
5508 gimple_omp_target_clauses (const gimple *gs)
5510 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5511 return omp_target_stmt->clauses;
5515 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5517 static inline tree *
5518 gimple_omp_target_clauses_ptr (gimple *gs)
5520 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5521 return &omp_target_stmt->clauses;
5525 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5527 static inline void
5528 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5529 tree clauses)
5531 omp_target_stmt->clauses = clauses;
5535 /* Return the kind of the OMP_TARGET G. */
5537 static inline int
5538 gimple_omp_target_kind (const gimple *g)
5540 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5541 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5545 /* Set the kind of the OMP_TARGET G. */
5547 static inline void
5548 gimple_omp_target_set_kind (gomp_target *g, int kind)
5550 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5551 | (kind & GF_OMP_TARGET_KIND_MASK);
5555 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5557 static inline tree
5558 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5560 return omp_target_stmt->child_fn;
5563 /* Return a pointer to the child function used to hold the body of
5564 OMP_TARGET_STMT. */
5566 static inline tree *
5567 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5569 return &omp_target_stmt->child_fn;
5573 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5575 static inline void
5576 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5577 tree child_fn)
5579 omp_target_stmt->child_fn = child_fn;
5583 /* Return the artificial argument used to send variables and values
5584 from the parent to the children threads in OMP_TARGET_STMT. */
5586 static inline tree
5587 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5589 return omp_target_stmt->data_arg;
5593 /* Return a pointer to the data argument for OMP_TARGET GS. */
5595 static inline tree *
5596 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5598 return &omp_target_stmt->data_arg;
5602 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5604 static inline void
5605 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5606 tree data_arg)
5608 omp_target_stmt->data_arg = data_arg;
5612 /* Return the clauses associated with OMP_TEAMS GS. */
5614 static inline tree
5615 gimple_omp_teams_clauses (const gimple *gs)
5617 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5618 return omp_teams_stmt->clauses;
5622 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5624 static inline tree *
5625 gimple_omp_teams_clauses_ptr (gimple *gs)
5627 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5628 return &omp_teams_stmt->clauses;
5632 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5634 static inline void
5635 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5637 omp_teams_stmt->clauses = clauses;
5641 /* Return the clauses associated with OMP_SECTIONS GS. */
5643 static inline tree
5644 gimple_omp_sections_clauses (const gimple *gs)
5646 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5647 return omp_sections_stmt->clauses;
5651 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5653 static inline tree *
5654 gimple_omp_sections_clauses_ptr (gimple *gs)
5656 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5657 return &omp_sections_stmt->clauses;
5661 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5662 GS. */
5664 static inline void
5665 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5667 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5668 omp_sections_stmt->clauses = clauses;
5672 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5673 in GS. */
5675 static inline tree
5676 gimple_omp_sections_control (const gimple *gs)
5678 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5679 return omp_sections_stmt->control;
5683 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5684 GS. */
5686 static inline tree *
5687 gimple_omp_sections_control_ptr (gimple *gs)
5689 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5690 return &omp_sections_stmt->control;
5694 /* Set CONTROL to be the set of clauses associated with the
5695 GIMPLE_OMP_SECTIONS in GS. */
5697 static inline void
5698 gimple_omp_sections_set_control (gimple *gs, tree control)
5700 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5701 omp_sections_stmt->control = control;
5705 /* Set the value being stored in an atomic store. */
5707 static inline void
5708 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5710 store_stmt->val = val;
5714 /* Return the value being stored in an atomic store. */
5716 static inline tree
5717 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5719 return store_stmt->val;
5723 /* Return a pointer to the value being stored in an atomic store. */
5725 static inline tree *
5726 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5728 return &store_stmt->val;
5732 /* Set the LHS of an atomic load. */
5734 static inline void
5735 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5737 load_stmt->lhs = lhs;
5741 /* Get the LHS of an atomic load. */
5743 static inline tree
5744 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5746 return load_stmt->lhs;
5750 /* Return a pointer to the LHS of an atomic load. */
5752 static inline tree *
5753 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5755 return &load_stmt->lhs;
5759 /* Set the RHS of an atomic load. */
5761 static inline void
5762 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5764 load_stmt->rhs = rhs;
5768 /* Get the RHS of an atomic load. */
5770 static inline tree
5771 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5773 return load_stmt->rhs;
5777 /* Return a pointer to the RHS of an atomic load. */
5779 static inline tree *
5780 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5782 return &load_stmt->rhs;
5786 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5788 static inline tree
5789 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5791 return cont_stmt->control_def;
5794 /* The same as above, but return the address. */
5796 static inline tree *
5797 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5799 return &cont_stmt->control_def;
5802 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5804 static inline void
5805 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5807 cont_stmt->control_def = def;
5811 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5813 static inline tree
5814 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5816 return cont_stmt->control_use;
5820 /* The same as above, but return the address. */
5822 static inline tree *
5823 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5825 return &cont_stmt->control_use;
5829 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5831 static inline void
5832 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5834 cont_stmt->control_use = use;
5837 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5838 TRANSACTION_STMT. */
5840 static inline gimple_seq *
5841 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5843 return &transaction_stmt->body;
5846 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5848 static inline gimple_seq
5849 gimple_transaction_body (gtransaction *transaction_stmt)
5851 return *gimple_transaction_body_ptr (transaction_stmt);
5854 /* Return the label associated with a GIMPLE_TRANSACTION. */
5856 static inline tree
5857 gimple_transaction_label (const gtransaction *transaction_stmt)
5859 return transaction_stmt->label;
5862 static inline tree *
5863 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5865 return &transaction_stmt->label;
5868 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5870 static inline unsigned int
5871 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5873 return transaction_stmt->subcode;
5876 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5877 TRANSACTION_STMT. */
5879 static inline void
5880 gimple_transaction_set_body (gtransaction *transaction_stmt,
5881 gimple_seq body)
5883 transaction_stmt->body = body;
5886 /* Set the label associated with a GIMPLE_TRANSACTION. */
5888 static inline void
5889 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5891 transaction_stmt->label = label;
5894 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5896 static inline void
5897 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5898 unsigned int subcode)
5900 transaction_stmt->subcode = subcode;
5904 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5906 static inline tree *
5907 gimple_return_retval_ptr (greturn *gs)
5909 return &gs->op[0];
5912 /* Return the return value for GIMPLE_RETURN GS. */
5914 static inline tree
5915 gimple_return_retval (const greturn *gs)
5917 return gs->op[0];
5921 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5923 static inline void
5924 gimple_return_set_retval (greturn *gs, tree retval)
5926 gs->op[0] = retval;
5930 /* Return the return bounds for GIMPLE_RETURN GS. */
5932 static inline tree
5933 gimple_return_retbnd (const gimple *gs)
5935 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5936 return gimple_op (gs, 1);
5940 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5942 static inline void
5943 gimple_return_set_retbnd (gimple *gs, tree retval)
5945 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5946 gimple_set_op (gs, 1, retval);
5950 /* Returns true when the gimple statement STMT is any of the OMP types. */
5952 #define CASE_GIMPLE_OMP \
5953 case GIMPLE_OMP_PARALLEL: \
5954 case GIMPLE_OMP_TASK: \
5955 case GIMPLE_OMP_FOR: \
5956 case GIMPLE_OMP_SECTIONS: \
5957 case GIMPLE_OMP_SECTIONS_SWITCH: \
5958 case GIMPLE_OMP_SINGLE: \
5959 case GIMPLE_OMP_TARGET: \
5960 case GIMPLE_OMP_TEAMS: \
5961 case GIMPLE_OMP_SECTION: \
5962 case GIMPLE_OMP_MASTER: \
5963 case GIMPLE_OMP_TASKGROUP: \
5964 case GIMPLE_OMP_ORDERED: \
5965 case GIMPLE_OMP_CRITICAL: \
5966 case GIMPLE_OMP_RETURN: \
5967 case GIMPLE_OMP_ATOMIC_LOAD: \
5968 case GIMPLE_OMP_ATOMIC_STORE: \
5969 case GIMPLE_OMP_CONTINUE
5971 static inline bool
5972 is_gimple_omp (const gimple *stmt)
5974 switch (gimple_code (stmt))
5976 CASE_GIMPLE_OMP:
5977 return true;
5978 default:
5979 return false;
5983 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
5984 specifically. */
5986 static inline bool
5987 is_gimple_omp_oacc (const gimple *stmt)
5989 gcc_assert (is_gimple_omp (stmt));
5990 switch (gimple_code (stmt))
5992 case GIMPLE_OMP_FOR:
5993 switch (gimple_omp_for_kind (stmt))
5995 case GF_OMP_FOR_KIND_OACC_LOOP:
5996 return true;
5997 default:
5998 return false;
6000 case GIMPLE_OMP_TARGET:
6001 switch (gimple_omp_target_kind (stmt))
6003 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6004 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6005 case GF_OMP_TARGET_KIND_OACC_DATA:
6006 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6007 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6008 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6009 return true;
6010 default:
6011 return false;
6013 default:
6014 return false;
6019 /* Return true if the OMP gimple statement STMT is offloaded. */
6021 static inline bool
6022 is_gimple_omp_offloaded (const gimple *stmt)
6024 gcc_assert (is_gimple_omp (stmt));
6025 switch (gimple_code (stmt))
6027 case GIMPLE_OMP_TARGET:
6028 switch (gimple_omp_target_kind (stmt))
6030 case GF_OMP_TARGET_KIND_REGION:
6031 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6032 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6033 return true;
6034 default:
6035 return false;
6037 default:
6038 return false;
6043 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6045 static inline bool
6046 gimple_nop_p (const gimple *g)
6048 return gimple_code (g) == GIMPLE_NOP;
6052 /* Return true if GS is a GIMPLE_RESX. */
6054 static inline bool
6055 is_gimple_resx (const gimple *gs)
6057 return gimple_code (gs) == GIMPLE_RESX;
6060 /* Return the type of the main expression computed by STMT. Return
6061 void_type_node if the statement computes nothing. */
6063 static inline tree
6064 gimple_expr_type (const gimple *stmt)
6066 enum gimple_code code = gimple_code (stmt);
6067 /* In general we want to pass out a type that can be substituted
6068 for both the RHS and the LHS types if there is a possibly
6069 useless conversion involved. That means returning the
6070 original RHS type as far as we can reconstruct it. */
6071 if (code == GIMPLE_CALL)
6073 const gcall *call_stmt = as_a <const gcall *> (stmt);
6074 if (gimple_call_internal_p (call_stmt)
6075 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6076 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6077 else
6078 return gimple_call_return_type (call_stmt);
6080 else if (code == GIMPLE_ASSIGN)
6082 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6083 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6084 else
6085 /* As fallback use the type of the LHS. */
6086 return TREE_TYPE (gimple_get_lhs (stmt));
6088 else if (code == GIMPLE_COND)
6089 return boolean_type_node;
6090 else
6091 return void_type_node;
6094 /* Enum and arrays used for allocation stats. Keep in sync with
6095 gimple.c:gimple_alloc_kind_names. */
6096 enum gimple_alloc_kind
6098 gimple_alloc_kind_assign, /* Assignments. */
6099 gimple_alloc_kind_phi, /* PHI nodes. */
6100 gimple_alloc_kind_cond, /* Conditionals. */
6101 gimple_alloc_kind_rest, /* Everything else. */
6102 gimple_alloc_kind_all
6105 extern int gimple_alloc_counts[];
6106 extern int gimple_alloc_sizes[];
6108 /* Return the allocation kind for a given stmt CODE. */
6109 static inline enum gimple_alloc_kind
6110 gimple_alloc_kind (enum gimple_code code)
6112 switch (code)
6114 case GIMPLE_ASSIGN:
6115 return gimple_alloc_kind_assign;
6116 case GIMPLE_PHI:
6117 return gimple_alloc_kind_phi;
6118 case GIMPLE_COND:
6119 return gimple_alloc_kind_cond;
6120 default:
6121 return gimple_alloc_kind_rest;
6125 /* Return true if a location should not be emitted for this statement
6126 by annotate_all_with_location. */
6128 static inline bool
6129 gimple_do_not_emit_location_p (gimple *g)
6131 return gimple_plf (g, GF_PLF_1);
6134 /* Mark statement G so a location will not be emitted by
6135 annotate_one_with_location. */
6137 static inline void
6138 gimple_set_do_not_emit_location (gimple *g)
6140 /* The PLF flags are initialized to 0 when a new tuple is created,
6141 so no need to initialize it anywhere. */
6142 gimple_set_plf (g, GF_PLF_1, true);
6146 /* Macros for showing usage statistics. */
6147 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6148 ? (x) \
6149 : ((x) < 1024*1024*10 \
6150 ? (x) / 1024 \
6151 : (x) / (1024*1024))))
6153 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6155 #endif /* GCC_GIMPLE_H */