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
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
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/>. */
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
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) \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
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 ())
66 const char *file = __FILE__,
68 const char *fun = NULL)
71 T ret = dyn_cast <T> (gs);
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
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 ())
85 const char *file = __FILE__,
87 const char *fun = NULL)
90 T ret = dyn_cast <T> (gs);
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
101 GIMPLE_CHECK2(gimple *gs)
103 return as_a <T> (gs);
105 template <typename T>
107 GIMPLE_CHECK2(const gimple *gs)
109 return as_a <T> (gs);
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. */
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. */
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))
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. */
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
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. */
253 Locus information for debug info. */
256 /* Number of operands in this tuple. */
260 Basic block holding this statement. */
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. */
270 gimple *GTY((skip)) prev;
274 /* Base structure for tuples with operands. */
276 /* This gimple subclass has no tag value. */
278 gimple_statement_with_ops_base : public gimple
280 /* [ WORD 1-6 ] : base class */
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 */
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 */
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 */
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 */
345 struct pt_solution call_used;
346 struct pt_solution call_clobbered;
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;
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 */
378 struct GTY((tag("GSS_BIND")))
379 gbind : public gimple
381 /* [ WORD 1-6 ] : base class */
384 Variables declared in this scope. */
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
402 struct GTY((tag("GSS_CATCH")))
403 gcatch : public gimple
405 /* [ WORD 1-6 ] : base class */
415 /* GIMPLE_EH_FILTER */
417 struct GTY((tag("GSS_EH_FILTER")))
418 geh_filter : public gimple
420 /* [ WORD 1-6 ] : base class */
433 struct GTY((tag("GSS_EH_ELSE")))
434 geh_else : public gimple
436 /* [ WORD 1-6 ] : base class */
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. */
455 struct GTY((tag("GSS_PHI")))
458 /* [ WORD 1-6 ] : base class */
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 */
480 Exception region number. */
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. */
501 struct GTY((tag("GSS_TRY")))
504 /* [ WORD 1-6 ] : base class */
507 Expression to evaluate. */
511 Cleanup expression. */
515 /* Kind of GIMPLE_TRY statements. */
516 enum gimple_try_flags
519 GIMPLE_TRY_CATCH = 1 << 0,
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
542 Cleanup expression. */
549 struct GTY((tag("GSS_ASM")))
550 gasm : public gimple_statement_with_memory_ops_base
552 /* [ WORD 1-9 ] : base class */
555 __asm__ statement. */
559 Number of inputs, outputs, clobbers, labels. */
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 */
583 Critical section name. */
588 struct GTY(()) gimple_omp_for_iter {
589 /* Condition code. */
592 /* Index variable. */
607 struct GTY((tag("GSS_OMP_FOR")))
608 gomp_for : public gimple_statement_omp
610 /* [ WORD 1-7 ] : base class */
616 Number of elements in iter array. */
620 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
623 Pre-body evaluated before the loop body begins. */
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 */
640 Child function holding the body of the parallel region. */
644 Shared data argument. */
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 */
681 Child function holding firstprivate initialization if needed. */
685 Size and alignment in bytes of the argument data block. */
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 */
706 The control variable used for deciding which of the sections to
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 */
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 */
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 */
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 */
786 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
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 */
842 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
843 enum gimple_statement_structure_enum {
844 #include "gsstruct.def"
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. */
924 is_a_helper <gasm *>::test (gimple *gs)
926 return gs->code == GIMPLE_ASM;
932 is_a_helper <gassign *>::test (gimple *gs)
934 return gs->code == GIMPLE_ASSIGN;
940 is_a_helper <const gassign *>::test (const gimple *gs)
942 return gs->code == GIMPLE_ASSIGN;
948 is_a_helper <gbind *>::test (gimple *gs)
950 return gs->code == GIMPLE_BIND;
956 is_a_helper <gcall *>::test (gimple *gs)
958 return gs->code == GIMPLE_CALL;
964 is_a_helper <gcatch *>::test (gimple *gs)
966 return gs->code == GIMPLE_CATCH;
972 is_a_helper <gcond *>::test (gimple *gs)
974 return gs->code == GIMPLE_COND;
980 is_a_helper <const gcond *>::test (const gimple *gs)
982 return gs->code == GIMPLE_COND;
988 is_a_helper <gdebug *>::test (gimple *gs)
990 return gs->code == GIMPLE_DEBUG;
996 is_a_helper <ggoto *>::test (gimple *gs)
998 return gs->code == GIMPLE_GOTO;
1004 is_a_helper <glabel *>::test (gimple *gs)
1006 return gs->code == GIMPLE_LABEL;
1012 is_a_helper <gresx *>::test (gimple *gs)
1014 return gs->code == GIMPLE_RESX;
1020 is_a_helper <geh_dispatch *>::test (gimple *gs)
1022 return gs->code == GIMPLE_EH_DISPATCH;
1028 is_a_helper <geh_else *>::test (gimple *gs)
1030 return gs->code == GIMPLE_EH_ELSE;
1036 is_a_helper <geh_filter *>::test (gimple *gs)
1038 return gs->code == GIMPLE_EH_FILTER;
1044 is_a_helper <geh_mnt *>::test (gimple *gs)
1046 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1052 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1054 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1060 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1062 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1068 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1070 return gs->code == GIMPLE_OMP_RETURN;
1076 is_a_helper <gomp_continue *>::test (gimple *gs)
1078 return gs->code == GIMPLE_OMP_CONTINUE;
1084 is_a_helper <gomp_critical *>::test (gimple *gs)
1086 return gs->code == GIMPLE_OMP_CRITICAL;
1092 is_a_helper <gomp_ordered *>::test (gimple *gs)
1094 return gs->code == GIMPLE_OMP_ORDERED;
1100 is_a_helper <gomp_for *>::test (gimple *gs)
1102 return gs->code == GIMPLE_OMP_FOR;
1108 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1110 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1116 is_a_helper <gomp_parallel *>::test (gimple *gs)
1118 return gs->code == GIMPLE_OMP_PARALLEL;
1124 is_a_helper <gomp_target *>::test (gimple *gs)
1126 return gs->code == GIMPLE_OMP_TARGET;
1132 is_a_helper <gomp_sections *>::test (gimple *gs)
1134 return gs->code == GIMPLE_OMP_SECTIONS;
1140 is_a_helper <gomp_single *>::test (gimple *gs)
1142 return gs->code == GIMPLE_OMP_SINGLE;
1148 is_a_helper <gomp_teams *>::test (gimple *gs)
1150 return gs->code == GIMPLE_OMP_TEAMS;
1156 is_a_helper <gomp_task *>::test (gimple *gs)
1158 return gs->code == GIMPLE_OMP_TASK;
1164 is_a_helper <gphi *>::test (gimple *gs)
1166 return gs->code == GIMPLE_PHI;
1172 is_a_helper <greturn *>::test (gimple *gs)
1174 return gs->code == GIMPLE_RETURN;
1180 is_a_helper <gswitch *>::test (gimple *gs)
1182 return gs->code == GIMPLE_SWITCH;
1188 is_a_helper <gtransaction *>::test (gimple *gs)
1190 return gs->code == GIMPLE_TRANSACTION;
1196 is_a_helper <gtry *>::test (gimple *gs)
1198 return gs->code == GIMPLE_TRY;
1204 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1206 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1212 is_a_helper <const gasm *>::test (const gimple *gs)
1214 return gs->code == GIMPLE_ASM;
1220 is_a_helper <const gbind *>::test (const gimple *gs)
1222 return gs->code == GIMPLE_BIND;
1228 is_a_helper <const gcall *>::test (const gimple *gs)
1230 return gs->code == GIMPLE_CALL;
1236 is_a_helper <const gcatch *>::test (const gimple *gs)
1238 return gs->code == GIMPLE_CATCH;
1244 is_a_helper <const gresx *>::test (const gimple *gs)
1246 return gs->code == GIMPLE_RESX;
1252 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1254 return gs->code == GIMPLE_EH_DISPATCH;
1260 is_a_helper <const geh_filter *>::test (const gimple *gs)
1262 return gs->code == GIMPLE_EH_FILTER;
1268 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1270 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1276 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1278 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1284 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1286 return gs->code == GIMPLE_OMP_RETURN;
1292 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1294 return gs->code == GIMPLE_OMP_CONTINUE;
1300 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1302 return gs->code == GIMPLE_OMP_CRITICAL;
1308 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1310 return gs->code == GIMPLE_OMP_ORDERED;
1316 is_a_helper <const gomp_for *>::test (const gimple *gs)
1318 return gs->code == GIMPLE_OMP_FOR;
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;
1332 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1334 return gs->code == GIMPLE_OMP_PARALLEL;
1340 is_a_helper <const gomp_target *>::test (const gimple *gs)
1342 return gs->code == GIMPLE_OMP_TARGET;
1348 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1350 return gs->code == GIMPLE_OMP_SECTIONS;
1356 is_a_helper <const gomp_single *>::test (const gimple *gs)
1358 return gs->code == GIMPLE_OMP_SINGLE;
1364 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1366 return gs->code == GIMPLE_OMP_TEAMS;
1372 is_a_helper <const gomp_task *>::test (const gimple *gs)
1374 return gs->code == GIMPLE_OMP_TASK;
1380 is_a_helper <const gphi *>::test (const gimple *gs)
1382 return gs->code == GIMPLE_PHI;
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,
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,
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,
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 combined_fn gimple_call_combined_fn (const gimple *);
1504 extern bool gimple_call_builtin_p (const gimple *);
1505 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1506 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1507 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1508 extern void dump_decl_set (FILE *, bitmap);
1509 extern bool nonfreeing_call_p (gimple *);
1510 extern bool nonbarrier_call_p (gimple *);
1511 extern bool infer_nonnull_range (gimple *, tree);
1512 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1513 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1514 extern void sort_case_labels (vec<tree>);
1515 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1516 extern void gimple_seq_set_location (gimple_seq, location_t);
1517 extern void gimple_seq_discard (gimple_seq);
1518 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1520 /* Formal (expression) temporary table handling: multiple occurrences of
1521 the same scalar expression are evaluated into the same temporary. */
1523 typedef struct gimple_temp_hash_elt
1526 tree temp; /* Value */
1529 /* Get the number of the next statement uid to be allocated. */
1530 static inline unsigned int
1531 gimple_stmt_max_uid (struct function *fn)
1533 return fn->last_stmt_uid;
1536 /* Set the number of the next statement uid to be allocated. */
1538 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1540 fn->last_stmt_uid = maxid;
1543 /* Set the number of the next statement uid to be allocated. */
1544 static inline unsigned int
1545 inc_gimple_stmt_max_uid (struct function *fn)
1547 return fn->last_stmt_uid++;
1550 /* Return the first node in GIMPLE sequence S. */
1552 static inline gimple_seq_node
1553 gimple_seq_first (gimple_seq s)
1559 /* Return the first statement in GIMPLE sequence S. */
1561 static inline gimple *
1562 gimple_seq_first_stmt (gimple_seq s)
1564 gimple_seq_node n = gimple_seq_first (s);
1568 /* Return the first statement in GIMPLE sequence S as a gbind *,
1569 verifying that it has code GIMPLE_BIND in a checked build. */
1571 static inline gbind *
1572 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1574 gimple_seq_node n = gimple_seq_first (s);
1575 return as_a <gbind *> (n);
1579 /* Return the last node in GIMPLE sequence S. */
1581 static inline gimple_seq_node
1582 gimple_seq_last (gimple_seq s)
1584 return s ? s->prev : NULL;
1588 /* Return the last statement in GIMPLE sequence S. */
1590 static inline gimple *
1591 gimple_seq_last_stmt (gimple_seq s)
1593 gimple_seq_node n = gimple_seq_last (s);
1598 /* Set the last node in GIMPLE sequence *PS to LAST. */
1601 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1607 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1610 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1616 /* Return true if GIMPLE sequence S is empty. */
1619 gimple_seq_empty_p (gimple_seq s)
1624 /* Allocate a new sequence and initialize its first element with STMT. */
1626 static inline gimple_seq
1627 gimple_seq_alloc_with_stmt (gimple *stmt)
1629 gimple_seq seq = NULL;
1630 gimple_seq_add_stmt (&seq, stmt);
1635 /* Returns the sequence of statements in BB. */
1637 static inline gimple_seq
1638 bb_seq (const_basic_block bb)
1640 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1643 static inline gimple_seq *
1644 bb_seq_addr (basic_block bb)
1646 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1649 /* Sets the sequence of statements in BB to SEQ. */
1652 set_bb_seq (basic_block bb, gimple_seq seq)
1654 gcc_checking_assert (!(bb->flags & BB_RTL));
1655 bb->il.gimple.seq = seq;
1659 /* Return the code for GIMPLE statement G. */
1661 static inline enum gimple_code
1662 gimple_code (const gimple *g)
1668 /* Return the GSS code used by a GIMPLE code. */
1670 static inline enum gimple_statement_structure_enum
1671 gss_for_code (enum gimple_code code)
1673 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1674 return gss_for_code_[code];
1678 /* Return which GSS code is used by GS. */
1680 static inline enum gimple_statement_structure_enum
1681 gimple_statement_structure (gimple *gs)
1683 return gss_for_code (gimple_code (gs));
1687 /* Return true if statement G has sub-statements. This is only true for
1688 High GIMPLE statements. */
1691 gimple_has_substatements (gimple *g)
1693 switch (gimple_code (g))
1697 case GIMPLE_EH_FILTER:
1698 case GIMPLE_EH_ELSE:
1700 case GIMPLE_OMP_FOR:
1701 case GIMPLE_OMP_MASTER:
1702 case GIMPLE_OMP_TASKGROUP:
1703 case GIMPLE_OMP_ORDERED:
1704 case GIMPLE_OMP_SECTION:
1705 case GIMPLE_OMP_PARALLEL:
1706 case GIMPLE_OMP_TASK:
1707 case GIMPLE_OMP_SECTIONS:
1708 case GIMPLE_OMP_SINGLE:
1709 case GIMPLE_OMP_TARGET:
1710 case GIMPLE_OMP_TEAMS:
1711 case GIMPLE_OMP_CRITICAL:
1712 case GIMPLE_WITH_CLEANUP_EXPR:
1713 case GIMPLE_TRANSACTION:
1722 /* Return the basic block holding statement G. */
1724 static inline basic_block
1725 gimple_bb (const gimple *g)
1731 /* Return the lexical scope block holding statement G. */
1734 gimple_block (const gimple *g)
1736 return LOCATION_BLOCK (g->location);
1740 /* Set BLOCK to be the lexical scope block holding statement G. */
1743 gimple_set_block (gimple *g, tree block)
1745 g->location = set_block (g->location, block);
1749 /* Return location information for statement G. */
1751 static inline location_t
1752 gimple_location (const gimple *g)
1757 /* Return location information for statement G if g is not NULL.
1758 Otherwise, UNKNOWN_LOCATION is returned. */
1760 static inline location_t
1761 gimple_location_safe (const gimple *g)
1763 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1766 /* Set location information for statement G. */
1769 gimple_set_location (gimple *g, location_t location)
1771 g->location = location;
1775 /* Return true if G contains location information. */
1778 gimple_has_location (const gimple *g)
1780 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1784 /* Return the file name of the location of STMT. */
1786 static inline const char *
1787 gimple_filename (const gimple *stmt)
1789 return LOCATION_FILE (gimple_location (stmt));
1793 /* Return the line number of the location of STMT. */
1796 gimple_lineno (const gimple *stmt)
1798 return LOCATION_LINE (gimple_location (stmt));
1802 /* Determine whether SEQ is a singleton. */
1805 gimple_seq_singleton_p (gimple_seq seq)
1807 return ((gimple_seq_first (seq) != NULL)
1808 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1811 /* Return true if no warnings should be emitted for statement STMT. */
1814 gimple_no_warning_p (const gimple *stmt)
1816 return stmt->no_warning;
1819 /* Set the no_warning flag of STMT to NO_WARNING. */
1822 gimple_set_no_warning (gimple *stmt, bool no_warning)
1824 stmt->no_warning = (unsigned) no_warning;
1827 /* Set the visited status on statement STMT to VISITED_P.
1829 Please note that this 'visited' property of the gimple statement is
1830 supposed to be undefined at pass boundaries. This means that a
1831 given pass should not assume it contains any useful value when the
1832 pass starts and thus can set it to any value it sees fit.
1834 You can learn more about the visited property of the gimple
1835 statement by reading the comments of the 'visited' data member of
1840 gimple_set_visited (gimple *stmt, bool visited_p)
1842 stmt->visited = (unsigned) visited_p;
1846 /* Return the visited status for statement STMT.
1848 Please note that this 'visited' property of the gimple statement is
1849 supposed to be undefined at pass boundaries. This means that a
1850 given pass should not assume it contains any useful value when the
1851 pass starts and thus can set it to any value it sees fit.
1853 You can learn more about the visited property of the gimple
1854 statement by reading the comments of the 'visited' data member of
1858 gimple_visited_p (gimple *stmt)
1860 return stmt->visited;
1864 /* Set pass local flag PLF on statement STMT to VAL_P.
1866 Please note that this PLF property of the gimple statement is
1867 supposed to be undefined at pass boundaries. This means that a
1868 given pass should not assume it contains any useful value when the
1869 pass starts and thus can set it to any value it sees fit.
1871 You can learn more about the PLF property by reading the comment of
1872 the 'plf' data member of struct gimple_statement_structure. */
1875 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1878 stmt->plf |= (unsigned int) plf;
1880 stmt->plf &= ~((unsigned int) plf);
1884 /* Return the value of pass local flag PLF on statement STMT.
1886 Please note that this 'plf' property of the gimple statement is
1887 supposed to be undefined at pass boundaries. This means that a
1888 given pass should not assume it contains any useful value when the
1889 pass starts and thus can set it to any value it sees fit.
1891 You can learn more about the plf property by reading the comment of
1892 the 'plf' data member of struct gimple_statement_structure. */
1894 static inline unsigned int
1895 gimple_plf (gimple *stmt, enum plf_mask plf)
1897 return stmt->plf & ((unsigned int) plf);
1901 /* Set the UID of statement.
1903 Please note that this UID property is supposed to be undefined at
1904 pass boundaries. This means that a given pass should not assume it
1905 contains any useful value when the pass starts and thus can set it
1906 to any value it sees fit. */
1909 gimple_set_uid (gimple *g, unsigned uid)
1915 /* Return the UID of statement.
1917 Please note that this UID property is supposed to be undefined at
1918 pass boundaries. This means that a given pass should not assume it
1919 contains any useful value when the pass starts and thus can set it
1920 to any value it sees fit. */
1922 static inline unsigned
1923 gimple_uid (const gimple *g)
1929 /* Make statement G a singleton sequence. */
1932 gimple_init_singleton (gimple *g)
1939 /* Return true if GIMPLE statement G has register or memory operands. */
1942 gimple_has_ops (const gimple *g)
1944 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1950 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1952 return gimple_has_ops (gs);
1958 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1960 return gimple_has_ops (gs);
1963 /* Return true if GIMPLE statement G has memory operands. */
1966 gimple_has_mem_ops (const gimple *g)
1968 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1974 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1976 return gimple_has_mem_ops (gs);
1982 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1984 return gimple_has_mem_ops (gs);
1987 /* Return the set of USE operands for statement G. */
1989 static inline struct use_optype_d *
1990 gimple_use_ops (const gimple *g)
1992 const gimple_statement_with_ops *ops_stmt =
1993 dyn_cast <const gimple_statement_with_ops *> (g);
1996 return ops_stmt->use_ops;
2000 /* Set USE to be the set of USE operands for statement G. */
2003 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2005 gimple_statement_with_ops *ops_stmt =
2006 as_a <gimple_statement_with_ops *> (g);
2007 ops_stmt->use_ops = use;
2011 /* Return the single VUSE operand of the statement G. */
2014 gimple_vuse (const gimple *g)
2016 const gimple_statement_with_memory_ops *mem_ops_stmt =
2017 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2020 return mem_ops_stmt->vuse;
2023 /* Return the single VDEF operand of the statement G. */
2026 gimple_vdef (const gimple *g)
2028 const gimple_statement_with_memory_ops *mem_ops_stmt =
2029 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2032 return mem_ops_stmt->vdef;
2035 /* Return the single VUSE operand of the statement G. */
2037 static inline tree *
2038 gimple_vuse_ptr (gimple *g)
2040 gimple_statement_with_memory_ops *mem_ops_stmt =
2041 dyn_cast <gimple_statement_with_memory_ops *> (g);
2044 return &mem_ops_stmt->vuse;
2047 /* Return the single VDEF operand of the statement G. */
2049 static inline tree *
2050 gimple_vdef_ptr (gimple *g)
2052 gimple_statement_with_memory_ops *mem_ops_stmt =
2053 dyn_cast <gimple_statement_with_memory_ops *> (g);
2056 return &mem_ops_stmt->vdef;
2059 /* Set the single VUSE operand of the statement G. */
2062 gimple_set_vuse (gimple *g, tree vuse)
2064 gimple_statement_with_memory_ops *mem_ops_stmt =
2065 as_a <gimple_statement_with_memory_ops *> (g);
2066 mem_ops_stmt->vuse = vuse;
2069 /* Set the single VDEF operand of the statement G. */
2072 gimple_set_vdef (gimple *g, tree vdef)
2074 gimple_statement_with_memory_ops *mem_ops_stmt =
2075 as_a <gimple_statement_with_memory_ops *> (g);
2076 mem_ops_stmt->vdef = vdef;
2080 /* Return true if statement G has operands and the modified field has
2084 gimple_modified_p (const gimple *g)
2086 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2090 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2091 a MODIFIED field. */
2094 gimple_set_modified (gimple *s, bool modifiedp)
2096 if (gimple_has_ops (s))
2097 s->modified = (unsigned) modifiedp;
2101 /* Return the tree code for the expression computed by STMT. This is
2102 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2103 GIMPLE_CALL, return CALL_EXPR as the expression code for
2104 consistency. This is useful when the caller needs to deal with the
2105 three kinds of computation that GIMPLE supports. */
2107 static inline enum tree_code
2108 gimple_expr_code (const gimple *stmt)
2110 enum gimple_code code = gimple_code (stmt);
2111 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2112 return (enum tree_code) stmt->subcode;
2115 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2121 /* Return true if statement STMT contains volatile operands. */
2124 gimple_has_volatile_ops (const gimple *stmt)
2126 if (gimple_has_mem_ops (stmt))
2127 return stmt->has_volatile_ops;
2133 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2136 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2138 if (gimple_has_mem_ops (stmt))
2139 stmt->has_volatile_ops = (unsigned) volatilep;
2142 /* Return true if STMT is in a transaction. */
2145 gimple_in_transaction (const gimple *stmt)
2147 return bb_in_transaction (gimple_bb (stmt));
2150 /* Return true if statement STMT may access memory. */
2153 gimple_references_memory_p (gimple *stmt)
2155 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2159 /* Return the subcode for OMP statement S. */
2161 static inline unsigned
2162 gimple_omp_subcode (const gimple *s)
2164 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2165 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2169 /* Set the subcode for OMP statement S to SUBCODE. */
2172 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2174 /* We only have 16 bits for the subcode. Assert that we are not
2176 gcc_gimple_checking_assert (subcode < (1 << 16));
2177 s->subcode = subcode;
2180 /* Set the nowait flag on OMP_RETURN statement S. */
2183 gimple_omp_return_set_nowait (gimple *s)
2185 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2186 s->subcode |= GF_OMP_RETURN_NOWAIT;
2190 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2194 gimple_omp_return_nowait_p (const gimple *g)
2196 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2197 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2201 /* Set the LHS of OMP return. */
2204 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2206 gimple_statement_omp_return *omp_return_stmt =
2207 as_a <gimple_statement_omp_return *> (g);
2208 omp_return_stmt->val = lhs;
2212 /* Get the LHS of OMP return. */
2215 gimple_omp_return_lhs (const gimple *g)
2217 const gimple_statement_omp_return *omp_return_stmt =
2218 as_a <const gimple_statement_omp_return *> (g);
2219 return omp_return_stmt->val;
2223 /* Return a pointer to the LHS of OMP return. */
2225 static inline tree *
2226 gimple_omp_return_lhs_ptr (gimple *g)
2228 gimple_statement_omp_return *omp_return_stmt =
2229 as_a <gimple_statement_omp_return *> (g);
2230 return &omp_return_stmt->val;
2234 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2238 gimple_omp_section_last_p (const gimple *g)
2240 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2241 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2245 /* Set the GF_OMP_SECTION_LAST flag on G. */
2248 gimple_omp_section_set_last (gimple *g)
2250 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2251 g->subcode |= GF_OMP_SECTION_LAST;
2255 /* Return true if OMP parallel statement G has the
2256 GF_OMP_PARALLEL_COMBINED flag set. */
2259 gimple_omp_parallel_combined_p (const gimple *g)
2261 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2262 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2266 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2267 value of COMBINED_P. */
2270 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2272 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2274 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2276 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2280 /* Return true if OMP atomic load/store statement G has the
2281 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2284 gimple_omp_atomic_need_value_p (const gimple *g)
2286 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2287 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2288 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2292 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2295 gimple_omp_atomic_set_need_value (gimple *g)
2297 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2298 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2299 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2303 /* Return true if OMP atomic load/store statement G has the
2304 GF_OMP_ATOMIC_SEQ_CST flag set. */
2307 gimple_omp_atomic_seq_cst_p (const gimple *g)
2309 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2310 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2311 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2315 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2318 gimple_omp_atomic_set_seq_cst (gimple *g)
2320 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2321 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2322 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2326 /* Return the number of operands for statement GS. */
2328 static inline unsigned
2329 gimple_num_ops (const gimple *gs)
2335 /* Set the number of operands for statement GS. */
2338 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2340 gs->num_ops = num_ops;
2344 /* Return the array of operands for statement GS. */
2346 static inline tree *
2347 gimple_ops (gimple *gs)
2351 /* All the tuples have their operand vector at the very bottom
2352 of the structure. Note that those structures that do not
2353 have an operand vector have a zero offset. */
2354 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2355 gcc_gimple_checking_assert (off != 0);
2357 return (tree *) ((char *) gs + off);
2361 /* Return operand I for statement GS. */
2364 gimple_op (const gimple *gs, unsigned i)
2366 if (gimple_has_ops (gs))
2368 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2369 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2375 /* Return a pointer to operand I for statement GS. */
2377 static inline tree *
2378 gimple_op_ptr (gimple *gs, unsigned i)
2380 if (gimple_has_ops (gs))
2382 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2383 return gimple_ops (gs) + i;
2389 /* Set operand I of statement GS to OP. */
2392 gimple_set_op (gimple *gs, unsigned i, tree op)
2394 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2396 /* Note. It may be tempting to assert that OP matches
2397 is_gimple_operand, but that would be wrong. Different tuples
2398 accept slightly different sets of tree operands. Each caller
2399 should perform its own validation. */
2400 gimple_ops (gs)[i] = op;
2403 /* Return true if GS is a GIMPLE_ASSIGN. */
2406 is_gimple_assign (const gimple *gs)
2408 return gimple_code (gs) == GIMPLE_ASSIGN;
2411 /* Determine if expression CODE is one of the valid expressions that can
2412 be used on the RHS of GIMPLE assignments. */
2414 static inline enum gimple_rhs_class
2415 get_gimple_rhs_class (enum tree_code code)
2417 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2420 /* Return the LHS of assignment statement GS. */
2423 gimple_assign_lhs (const gassign *gs)
2429 gimple_assign_lhs (const gimple *gs)
2431 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2432 return gimple_assign_lhs (ass);
2436 /* Return a pointer to the LHS of assignment statement GS. */
2438 static inline tree *
2439 gimple_assign_lhs_ptr (gassign *gs)
2444 static inline tree *
2445 gimple_assign_lhs_ptr (gimple *gs)
2447 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2448 return gimple_assign_lhs_ptr (ass);
2452 /* Set LHS to be the LHS operand of assignment statement GS. */
2455 gimple_assign_set_lhs (gassign *gs, tree lhs)
2459 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2460 SSA_NAME_DEF_STMT (lhs) = gs;
2464 gimple_assign_set_lhs (gimple *gs, tree lhs)
2466 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2467 gimple_assign_set_lhs (ass, lhs);
2471 /* Return the first operand on the RHS of assignment statement GS. */
2474 gimple_assign_rhs1 (const gassign *gs)
2480 gimple_assign_rhs1 (const gimple *gs)
2482 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2483 return gimple_assign_rhs1 (ass);
2487 /* Return a pointer to the first operand on the RHS of assignment
2490 static inline tree *
2491 gimple_assign_rhs1_ptr (gassign *gs)
2496 static inline tree *
2497 gimple_assign_rhs1_ptr (gimple *gs)
2499 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2500 return gimple_assign_rhs1_ptr (ass);
2503 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2506 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2512 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2514 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2515 gimple_assign_set_rhs1 (ass, rhs);
2519 /* Return the second operand on the RHS of assignment statement GS.
2520 If GS does not have two operands, NULL is returned instead. */
2523 gimple_assign_rhs2 (const gassign *gs)
2525 if (gimple_num_ops (gs) >= 3)
2532 gimple_assign_rhs2 (const gimple *gs)
2534 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2535 return gimple_assign_rhs2 (ass);
2539 /* Return a pointer to the second operand on the RHS of assignment
2542 static inline tree *
2543 gimple_assign_rhs2_ptr (gassign *gs)
2545 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2549 static inline tree *
2550 gimple_assign_rhs2_ptr (gimple *gs)
2552 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2553 return gimple_assign_rhs2_ptr (ass);
2557 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2560 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2562 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2567 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2569 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2570 return gimple_assign_set_rhs2 (ass, rhs);
2573 /* Return the third operand on the RHS of assignment statement GS.
2574 If GS does not have two operands, NULL is returned instead. */
2577 gimple_assign_rhs3 (const gassign *gs)
2579 if (gimple_num_ops (gs) >= 4)
2586 gimple_assign_rhs3 (const gimple *gs)
2588 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2589 return gimple_assign_rhs3 (ass);
2592 /* Return a pointer to the third operand on the RHS of assignment
2595 static inline tree *
2596 gimple_assign_rhs3_ptr (gimple *gs)
2598 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2599 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2604 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2607 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2609 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2614 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2616 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2617 gimple_assign_set_rhs3 (ass, rhs);
2621 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2622 which expect to see only two operands. */
2625 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2628 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2631 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2632 which expect to see only one operands. */
2635 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2638 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2641 /* Returns true if GS is a nontemporal move. */
2644 gimple_assign_nontemporal_move_p (const gassign *gs)
2646 return gs->nontemporal_move;
2649 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2652 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2654 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2655 gs->nontemporal_move = nontemporal;
2659 /* Return the code of the expression computed on the rhs of assignment
2660 statement GS. In case that the RHS is a single object, returns the
2661 tree code of the object. */
2663 static inline enum tree_code
2664 gimple_assign_rhs_code (const gassign *gs)
2666 enum tree_code code = (enum tree_code) gs->subcode;
2667 /* While we initially set subcode to the TREE_CODE of the rhs for
2668 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2669 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2670 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2671 code = TREE_CODE (gs->op[1]);
2676 static inline enum tree_code
2677 gimple_assign_rhs_code (const gimple *gs)
2679 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2680 return gimple_assign_rhs_code (ass);
2684 /* Set CODE to be the code for the expression computed on the RHS of
2688 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2690 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2695 /* Return the gimple rhs class of the code of the expression computed on
2696 the rhs of assignment statement GS.
2697 This will never return GIMPLE_INVALID_RHS. */
2699 static inline enum gimple_rhs_class
2700 gimple_assign_rhs_class (const gimple *gs)
2702 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2705 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2706 there is no operator associated with the assignment itself.
2707 Unlike gimple_assign_copy_p, this predicate returns true for
2708 any RHS operand, including those that perform an operation
2709 and do not have the semantics of a copy, such as COND_EXPR. */
2712 gimple_assign_single_p (const gimple *gs)
2714 return (is_gimple_assign (gs)
2715 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2718 /* Return true if GS performs a store to its lhs. */
2721 gimple_store_p (const gimple *gs)
2723 tree lhs = gimple_get_lhs (gs);
2724 return lhs && !is_gimple_reg (lhs);
2727 /* Return true if GS is an assignment that loads from its rhs1. */
2730 gimple_assign_load_p (const gimple *gs)
2733 if (!gimple_assign_single_p (gs))
2735 rhs = gimple_assign_rhs1 (gs);
2736 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2738 rhs = get_base_address (rhs);
2739 return (DECL_P (rhs)
2740 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2744 /* Return true if S is a type-cast assignment. */
2747 gimple_assign_cast_p (const gimple *s)
2749 if (is_gimple_assign (s))
2751 enum tree_code sc = gimple_assign_rhs_code (s);
2752 return CONVERT_EXPR_CODE_P (sc)
2753 || sc == VIEW_CONVERT_EXPR
2754 || sc == FIX_TRUNC_EXPR;
2760 /* Return true if S is a clobber statement. */
2763 gimple_clobber_p (const gimple *s)
2765 return gimple_assign_single_p (s)
2766 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2769 /* Return true if GS is a GIMPLE_CALL. */
2772 is_gimple_call (const gimple *gs)
2774 return gimple_code (gs) == GIMPLE_CALL;
2777 /* Return the LHS of call statement GS. */
2780 gimple_call_lhs (const gcall *gs)
2786 gimple_call_lhs (const gimple *gs)
2788 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2789 return gimple_call_lhs (gc);
2793 /* Return a pointer to the LHS of call statement GS. */
2795 static inline tree *
2796 gimple_call_lhs_ptr (gcall *gs)
2801 static inline tree *
2802 gimple_call_lhs_ptr (gimple *gs)
2804 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2805 return gimple_call_lhs_ptr (gc);
2809 /* Set LHS to be the LHS operand of call statement GS. */
2812 gimple_call_set_lhs (gcall *gs, tree lhs)
2815 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2816 SSA_NAME_DEF_STMT (lhs) = gs;
2820 gimple_call_set_lhs (gimple *gs, tree lhs)
2822 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2823 gimple_call_set_lhs (gc, lhs);
2827 /* Return true if call GS calls an internal-only function, as enumerated
2831 gimple_call_internal_p (const gcall *gs)
2833 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2837 gimple_call_internal_p (const gimple *gs)
2839 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2840 return gimple_call_internal_p (gc);
2844 /* Return true if call GS is marked as instrumented by
2845 Pointer Bounds Checker. */
2848 gimple_call_with_bounds_p (const gcall *gs)
2850 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2854 gimple_call_with_bounds_p (const gimple *gs)
2856 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2857 return gimple_call_with_bounds_p (gc);
2861 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2862 Pointer Bounds Checker. */
2865 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2868 gs->subcode |= GF_CALL_WITH_BOUNDS;
2870 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2874 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2876 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2877 gimple_call_set_with_bounds (gc, with_bounds);
2881 /* Return the target of internal call GS. */
2883 static inline enum internal_fn
2884 gimple_call_internal_fn (const gcall *gs)
2886 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2887 return gs->u.internal_fn;
2890 static inline enum internal_fn
2891 gimple_call_internal_fn (const gimple *gs)
2893 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2894 return gimple_call_internal_fn (gc);
2897 /* Return true, if this internal gimple call is unique. */
2900 gimple_call_internal_unique_p (const gcall *gs)
2902 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2906 gimple_call_internal_unique_p (const gimple *gs)
2908 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2909 return gimple_call_internal_unique_p (gc);
2912 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2913 that could alter control flow. */
2916 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2918 if (ctrl_altering_p)
2919 s->subcode |= GF_CALL_CTRL_ALTERING;
2921 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2925 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2927 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2928 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2931 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2932 flag is set. Such call could not be a stmt in the middle of a bb. */
2935 gimple_call_ctrl_altering_p (const gcall *gs)
2937 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2941 gimple_call_ctrl_altering_p (const gimple *gs)
2943 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2944 return gimple_call_ctrl_altering_p (gc);
2948 /* Return the function type of the function called by GS. */
2951 gimple_call_fntype (const gcall *gs)
2953 if (gimple_call_internal_p (gs))
2955 return gs->u.fntype;
2959 gimple_call_fntype (const gimple *gs)
2961 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2962 return gimple_call_fntype (call_stmt);
2965 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2968 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2970 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2971 call_stmt->u.fntype = fntype;
2975 /* Return the tree node representing the function called by call
2979 gimple_call_fn (const gcall *gs)
2985 gimple_call_fn (const gimple *gs)
2987 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2988 return gimple_call_fn (gc);
2991 /* Return a pointer to the tree node representing the function called by call
2994 static inline tree *
2995 gimple_call_fn_ptr (gcall *gs)
3000 static inline tree *
3001 gimple_call_fn_ptr (gimple *gs)
3003 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3004 return gimple_call_fn_ptr (gc);
3008 /* Set FN to be the function called by call statement GS. */
3011 gimple_call_set_fn (gcall *gs, tree fn)
3013 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3018 /* Set FNDECL to be the function called by call statement GS. */
3021 gimple_call_set_fndecl (gcall *gs, tree decl)
3023 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3024 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3025 build_pointer_type (TREE_TYPE (decl)), decl);
3029 gimple_call_set_fndecl (gimple *gs, tree decl)
3031 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3032 gimple_call_set_fndecl (gc, decl);
3036 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3039 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3041 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3042 call_stmt->u.internal_fn = fn;
3046 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3047 Otherwise return NULL. This function is analogous to
3048 get_callee_fndecl in tree land. */
3051 gimple_call_fndecl (const gcall *gs)
3053 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3057 gimple_call_fndecl (const gimple *gs)
3059 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3060 return gimple_call_fndecl (gc);
3064 /* Return the type returned by call statement GS. */
3067 gimple_call_return_type (const gcall *gs)
3069 tree type = gimple_call_fntype (gs);
3071 if (type == NULL_TREE)
3072 return TREE_TYPE (gimple_call_lhs (gs));
3074 /* The type returned by a function is the type of its
3076 return TREE_TYPE (type);
3080 /* Return the static chain for call statement GS. */
3083 gimple_call_chain (const gcall *gs)
3089 gimple_call_chain (const gimple *gs)
3091 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3092 return gimple_call_chain (gc);
3096 /* Return a pointer to the static chain for call statement CALL_STMT. */
3098 static inline tree *
3099 gimple_call_chain_ptr (gcall *call_stmt)
3101 return &call_stmt->op[2];
3104 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3107 gimple_call_set_chain (gcall *call_stmt, tree chain)
3109 call_stmt->op[2] = chain;
3113 /* Return the number of arguments used by call statement GS. */
3115 static inline unsigned
3116 gimple_call_num_args (const gcall *gs)
3118 return gimple_num_ops (gs) - 3;
3121 static inline unsigned
3122 gimple_call_num_args (const gimple *gs)
3124 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3125 return gimple_call_num_args (gc);
3129 /* Return the argument at position INDEX for call statement GS. */
3132 gimple_call_arg (const gcall *gs, unsigned index)
3134 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3135 return gs->op[index + 3];
3139 gimple_call_arg (const gimple *gs, unsigned index)
3141 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3142 return gimple_call_arg (gc, index);
3146 /* Return a pointer to the argument at position INDEX for call
3149 static inline tree *
3150 gimple_call_arg_ptr (gcall *gs, unsigned index)
3152 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3153 return &gs->op[index + 3];
3156 static inline tree *
3157 gimple_call_arg_ptr (gimple *gs, unsigned index)
3159 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3160 return gimple_call_arg_ptr (gc, index);
3164 /* Set ARG to be the argument at position INDEX for call statement GS. */
3167 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3169 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3170 gs->op[index + 3] = arg;
3174 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3176 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3177 gimple_call_set_arg (gc, index, arg);
3181 /* If TAIL_P is true, mark call statement S as being a tail call
3182 (i.e., a call just before the exit of a function). These calls are
3183 candidate for tail call optimization. */
3186 gimple_call_set_tail (gcall *s, bool tail_p)
3189 s->subcode |= GF_CALL_TAILCALL;
3191 s->subcode &= ~GF_CALL_TAILCALL;
3195 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3198 gimple_call_tail_p (gcall *s)
3200 return (s->subcode & GF_CALL_TAILCALL) != 0;
3204 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3205 slot optimization. This transformation uses the target of the call
3206 expansion as the return slot for calls that return in memory. */
3209 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3211 if (return_slot_opt_p)
3212 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3214 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3218 /* Return true if S is marked for return slot optimization. */
3221 gimple_call_return_slot_opt_p (gcall *s)
3223 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3227 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3228 thunk to the thunked-to function. */
3231 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3234 s->subcode |= GF_CALL_FROM_THUNK;
3236 s->subcode &= ~GF_CALL_FROM_THUNK;
3240 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3243 gimple_call_from_thunk_p (gcall *s)
3245 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3249 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3250 argument pack in its argument list. */
3253 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3255 if (pass_arg_pack_p)
3256 s->subcode |= GF_CALL_VA_ARG_PACK;
3258 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3262 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3263 argument pack in its argument list. */
3266 gimple_call_va_arg_pack_p (gcall *s)
3268 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3272 /* Return true if S is a noreturn call. */
3275 gimple_call_noreturn_p (const gcall *s)
3277 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3281 gimple_call_noreturn_p (const gimple *s)
3283 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3284 return gimple_call_noreturn_p (gc);
3288 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3289 even if the called function can throw in other cases. */
3292 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3295 s->subcode |= GF_CALL_NOTHROW;
3297 s->subcode &= ~GF_CALL_NOTHROW;
3300 /* Return true if S is a nothrow call. */
3303 gimple_call_nothrow_p (gcall *s)
3305 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3308 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3309 is known to be emitted for VLA objects. Those are wrapped by
3310 stack_save/stack_restore calls and hence can't lead to unbounded
3311 stack growth even when they occur in loops. */
3314 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3317 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3319 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3322 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3325 gimple_call_alloca_for_var_p (gcall *s)
3327 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3330 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3333 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3335 dest_call->subcode = orig_call->subcode;
3339 /* Return a pointer to the points-to solution for the set of call-used
3340 variables of the call CALL_STMT. */
3342 static inline struct pt_solution *
3343 gimple_call_use_set (gcall *call_stmt)
3345 return &call_stmt->call_used;
3349 /* Return a pointer to the points-to solution for the set of call-used
3350 variables of the call CALL_STMT. */
3352 static inline struct pt_solution *
3353 gimple_call_clobber_set (gcall *call_stmt)
3355 return &call_stmt->call_clobbered;
3359 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3363 gimple_has_lhs (gimple *stmt)
3365 if (is_gimple_assign (stmt))
3367 if (gcall *call = dyn_cast <gcall *> (stmt))
3368 return gimple_call_lhs (call) != NULL_TREE;
3373 /* Return the code of the predicate computed by conditional statement GS. */
3375 static inline enum tree_code
3376 gimple_cond_code (const gcond *gs)
3378 return (enum tree_code) gs->subcode;
3381 static inline enum tree_code
3382 gimple_cond_code (const gimple *gs)
3384 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3385 return gimple_cond_code (gc);
3389 /* Set CODE to be the predicate code for the conditional statement GS. */
3392 gimple_cond_set_code (gcond *gs, enum tree_code code)
3398 /* Return the LHS of the predicate computed by conditional statement GS. */
3401 gimple_cond_lhs (const gcond *gs)
3407 gimple_cond_lhs (const gimple *gs)
3409 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3410 return gimple_cond_lhs (gc);
3413 /* Return the pointer to the LHS of the predicate computed by conditional
3416 static inline tree *
3417 gimple_cond_lhs_ptr (gcond *gs)
3422 /* Set LHS to be the LHS operand of the predicate computed by
3423 conditional statement GS. */
3426 gimple_cond_set_lhs (gcond *gs, tree lhs)
3432 /* Return the RHS operand of the predicate computed by conditional GS. */
3435 gimple_cond_rhs (const gcond *gs)
3441 gimple_cond_rhs (const gimple *gs)
3443 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3444 return gimple_cond_rhs (gc);
3447 /* Return the pointer to the RHS operand of the predicate computed by
3450 static inline tree *
3451 gimple_cond_rhs_ptr (gcond *gs)
3457 /* Set RHS to be the RHS operand of the predicate computed by
3458 conditional statement GS. */
3461 gimple_cond_set_rhs (gcond *gs, tree rhs)
3467 /* Return the label used by conditional statement GS when its
3468 predicate evaluates to true. */
3471 gimple_cond_true_label (const gcond *gs)
3477 /* Set LABEL to be the label used by conditional statement GS when its
3478 predicate evaluates to true. */
3481 gimple_cond_set_true_label (gcond *gs, tree label)
3487 /* Set LABEL to be the label used by conditional statement GS when its
3488 predicate evaluates to false. */
3491 gimple_cond_set_false_label (gcond *gs, tree label)
3497 /* Return the label used by conditional statement GS when its
3498 predicate evaluates to false. */
3501 gimple_cond_false_label (const gcond *gs)
3507 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3510 gimple_cond_make_false (gcond *gs)
3512 gimple_cond_set_lhs (gs, boolean_false_node);
3513 gimple_cond_set_rhs (gs, boolean_false_node);
3514 gs->subcode = NE_EXPR;
3518 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3521 gimple_cond_make_true (gcond *gs)
3523 gimple_cond_set_lhs (gs, boolean_true_node);
3524 gimple_cond_set_rhs (gs, boolean_false_node);
3525 gs->subcode = NE_EXPR;
3528 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3529 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3532 gimple_cond_true_p (const gcond *gs)
3534 tree lhs = gimple_cond_lhs (gs);
3535 tree rhs = gimple_cond_rhs (gs);
3536 enum tree_code code = gimple_cond_code (gs);
3538 if (lhs != boolean_true_node && lhs != boolean_false_node)
3541 if (rhs != boolean_true_node && rhs != boolean_false_node)
3544 if (code == NE_EXPR && lhs != rhs)
3547 if (code == EQ_EXPR && lhs == rhs)
3553 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3554 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3557 gimple_cond_false_p (const gcond *gs)
3559 tree lhs = gimple_cond_lhs (gs);
3560 tree rhs = gimple_cond_rhs (gs);
3561 enum tree_code code = gimple_cond_code (gs);
3563 if (lhs != boolean_true_node && lhs != boolean_false_node)
3566 if (rhs != boolean_true_node && rhs != boolean_false_node)
3569 if (code == NE_EXPR && lhs == rhs)
3572 if (code == EQ_EXPR && lhs != rhs)
3578 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3581 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3584 gimple_cond_set_code (stmt, code);
3585 gimple_cond_set_lhs (stmt, lhs);
3586 gimple_cond_set_rhs (stmt, rhs);
3589 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3592 gimple_label_label (const glabel *gs)
3598 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3602 gimple_label_set_label (glabel *gs, tree label)
3608 /* Return the destination of the unconditional jump GS. */
3611 gimple_goto_dest (const gimple *gs)
3613 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3614 return gimple_op (gs, 0);
3618 /* Set DEST to be the destination of the unconditonal jump GS. */
3621 gimple_goto_set_dest (ggoto *gs, tree dest)
3627 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3630 gimple_bind_vars (const gbind *bind_stmt)
3632 return bind_stmt->vars;
3636 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3640 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3642 bind_stmt->vars = vars;
3646 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3650 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3652 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3656 static inline gimple_seq *
3657 gimple_bind_body_ptr (gbind *bind_stmt)
3659 return &bind_stmt->body;
3662 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3664 static inline gimple_seq
3665 gimple_bind_body (gbind *gs)
3667 return *gimple_bind_body_ptr (gs);
3671 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3675 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3677 bind_stmt->body = seq;
3681 /* Append a statement to the end of a GIMPLE_BIND's body. */
3684 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3686 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3690 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3693 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3695 gimple_seq_add_seq (&bind_stmt->body, seq);
3699 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3700 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3703 gimple_bind_block (const gbind *bind_stmt)
3705 return bind_stmt->block;
3709 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3713 gimple_bind_set_block (gbind *bind_stmt, tree block)
3715 gcc_gimple_checking_assert (block == NULL_TREE
3716 || TREE_CODE (block) == BLOCK);
3717 bind_stmt->block = block;
3721 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3723 static inline unsigned
3724 gimple_asm_ninputs (const gasm *asm_stmt)
3726 return asm_stmt->ni;
3730 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3732 static inline unsigned
3733 gimple_asm_noutputs (const gasm *asm_stmt)
3735 return asm_stmt->no;
3739 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3741 static inline unsigned
3742 gimple_asm_nclobbers (const gasm *asm_stmt)
3744 return asm_stmt->nc;
3747 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3749 static inline unsigned
3750 gimple_asm_nlabels (const gasm *asm_stmt)
3752 return asm_stmt->nl;
3755 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3758 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3760 gcc_gimple_checking_assert (index < asm_stmt->ni);
3761 return asm_stmt->op[index + asm_stmt->no];
3764 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3767 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3769 gcc_gimple_checking_assert (index < asm_stmt->ni
3770 && TREE_CODE (in_op) == TREE_LIST);
3771 asm_stmt->op[index + asm_stmt->no] = in_op;
3775 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3778 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3780 gcc_gimple_checking_assert (index < asm_stmt->no);
3781 return asm_stmt->op[index];
3784 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3787 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3789 gcc_gimple_checking_assert (index < asm_stmt->no
3790 && TREE_CODE (out_op) == TREE_LIST);
3791 asm_stmt->op[index] = out_op;
3795 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3798 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3800 gcc_gimple_checking_assert (index < asm_stmt->nc);
3801 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3805 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3808 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3810 gcc_gimple_checking_assert (index < asm_stmt->nc
3811 && TREE_CODE (clobber_op) == TREE_LIST);
3812 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3815 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3818 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3820 gcc_gimple_checking_assert (index < asm_stmt->nl);
3821 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3824 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3827 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3829 gcc_gimple_checking_assert (index < asm_stmt->nl
3830 && TREE_CODE (label_op) == TREE_LIST);
3831 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3834 /* Return the string representing the assembly instruction in
3835 GIMPLE_ASM ASM_STMT. */
3837 static inline const char *
3838 gimple_asm_string (const gasm *asm_stmt)
3840 return asm_stmt->string;
3844 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3847 gimple_asm_volatile_p (const gasm *asm_stmt)
3849 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3853 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3856 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3859 asm_stmt->subcode |= GF_ASM_VOLATILE;
3861 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3865 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3868 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3871 asm_stmt->subcode |= GF_ASM_INPUT;
3873 asm_stmt->subcode &= ~GF_ASM_INPUT;
3877 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3880 gimple_asm_input_p (const gasm *asm_stmt)
3882 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3886 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3889 gimple_catch_types (const gcatch *catch_stmt)
3891 return catch_stmt->types;
3895 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3897 static inline tree *
3898 gimple_catch_types_ptr (gcatch *catch_stmt)
3900 return &catch_stmt->types;
3904 /* Return a pointer to the GIMPLE sequence representing the body of
3905 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3907 static inline gimple_seq *
3908 gimple_catch_handler_ptr (gcatch *catch_stmt)
3910 return &catch_stmt->handler;
3914 /* Return the GIMPLE sequence representing the body of the handler of
3915 GIMPLE_CATCH statement CATCH_STMT. */
3917 static inline gimple_seq
3918 gimple_catch_handler (gcatch *catch_stmt)
3920 return *gimple_catch_handler_ptr (catch_stmt);
3924 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3927 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3929 catch_stmt->types = t;
3933 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3936 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3938 catch_stmt->handler = handler;
3942 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3945 gimple_eh_filter_types (const gimple *gs)
3947 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3948 return eh_filter_stmt->types;
3952 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3955 static inline tree *
3956 gimple_eh_filter_types_ptr (gimple *gs)
3958 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3959 return &eh_filter_stmt->types;
3963 /* Return a pointer to the sequence of statement to execute when
3964 GIMPLE_EH_FILTER statement fails. */
3966 static inline gimple_seq *
3967 gimple_eh_filter_failure_ptr (gimple *gs)
3969 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3970 return &eh_filter_stmt->failure;
3974 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3977 static inline gimple_seq
3978 gimple_eh_filter_failure (gimple *gs)
3980 return *gimple_eh_filter_failure_ptr (gs);
3984 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3988 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3990 eh_filter_stmt->types = types;
3994 /* Set FAILURE to be the sequence of statements to execute on failure
3995 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3998 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4001 eh_filter_stmt->failure = failure;
4004 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4007 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4009 return eh_mnt_stmt->fndecl;
4012 /* Set the function decl to be called by GS to DECL. */
4015 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4018 eh_mnt_stmt->fndecl = decl;
4021 /* GIMPLE_EH_ELSE accessors. */
4023 static inline gimple_seq *
4024 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4026 return &eh_else_stmt->n_body;
4029 static inline gimple_seq
4030 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4032 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4035 static inline gimple_seq *
4036 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4038 return &eh_else_stmt->e_body;
4041 static inline gimple_seq
4042 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4044 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4048 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4050 eh_else_stmt->n_body = seq;
4054 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4056 eh_else_stmt->e_body = seq;
4059 /* GIMPLE_TRY accessors. */
4061 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4062 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4064 static inline enum gimple_try_flags
4065 gimple_try_kind (const gimple *gs)
4067 GIMPLE_CHECK (gs, GIMPLE_TRY);
4068 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4072 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4075 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4077 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4078 || kind == GIMPLE_TRY_FINALLY);
4079 if (gimple_try_kind (gs) != kind)
4080 gs->subcode = (unsigned int) kind;
4084 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4087 gimple_try_catch_is_cleanup (const gimple *gs)
4089 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4090 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4094 /* Return a pointer to the sequence of statements used as the
4095 body for GIMPLE_TRY GS. */
4097 static inline gimple_seq *
4098 gimple_try_eval_ptr (gimple *gs)
4100 gtry *try_stmt = as_a <gtry *> (gs);
4101 return &try_stmt->eval;
4105 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4107 static inline gimple_seq
4108 gimple_try_eval (gimple *gs)
4110 return *gimple_try_eval_ptr (gs);
4114 /* Return a pointer to the sequence of statements used as the cleanup body for
4117 static inline gimple_seq *
4118 gimple_try_cleanup_ptr (gimple *gs)
4120 gtry *try_stmt = as_a <gtry *> (gs);
4121 return &try_stmt->cleanup;
4125 /* Return the sequence of statements used as the cleanup body for
4128 static inline gimple_seq
4129 gimple_try_cleanup (gimple *gs)
4131 return *gimple_try_cleanup_ptr (gs);
4135 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4138 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4140 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4141 if (catch_is_cleanup)
4142 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4144 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4148 /* Set EVAL to be the sequence of statements to use as the body for
4149 GIMPLE_TRY TRY_STMT. */
4152 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4154 try_stmt->eval = eval;
4158 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4159 body for GIMPLE_TRY TRY_STMT. */
4162 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4164 try_stmt->cleanup = cleanup;
4168 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4170 static inline gimple_seq *
4171 gimple_wce_cleanup_ptr (gimple *gs)
4173 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4174 return &wce_stmt->cleanup;
4178 /* Return the cleanup sequence for cleanup statement GS. */
4180 static inline gimple_seq
4181 gimple_wce_cleanup (gimple *gs)
4183 return *gimple_wce_cleanup_ptr (gs);
4187 /* Set CLEANUP to be the cleanup sequence for GS. */
4190 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4192 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4193 wce_stmt->cleanup = cleanup;
4197 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4200 gimple_wce_cleanup_eh_only (const gimple *gs)
4202 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4203 return gs->subcode != 0;
4207 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4210 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4212 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4213 gs->subcode = (unsigned int) eh_only_p;
4217 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4219 static inline unsigned
4220 gimple_phi_capacity (const gimple *gs)
4222 const gphi *phi_stmt = as_a <const gphi *> (gs);
4223 return phi_stmt->capacity;
4227 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4228 be exactly the number of incoming edges for the basic block holding
4231 static inline unsigned
4232 gimple_phi_num_args (const gimple *gs)
4234 const gphi *phi_stmt = as_a <const gphi *> (gs);
4235 return phi_stmt->nargs;
4239 /* Return the SSA name created by GIMPLE_PHI GS. */
4242 gimple_phi_result (const gimple *gs)
4244 const gphi *phi_stmt = as_a <const gphi *> (gs);
4245 return phi_stmt->result;
4248 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4250 static inline tree *
4251 gimple_phi_result_ptr (gimple *gs)
4253 gphi *phi_stmt = as_a <gphi *> (gs);
4254 return &phi_stmt->result;
4257 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4260 gimple_phi_set_result (gphi *phi, tree result)
4262 phi->result = result;
4263 if (result && TREE_CODE (result) == SSA_NAME)
4264 SSA_NAME_DEF_STMT (result) = phi;
4268 /* Return the PHI argument corresponding to incoming edge INDEX for
4271 static inline struct phi_arg_d *
4272 gimple_phi_arg (gimple *gs, unsigned index)
4274 gphi *phi_stmt = as_a <gphi *> (gs);
4275 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4276 return &(phi_stmt->args[index]);
4279 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4280 for GIMPLE_PHI PHI. */
4283 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4285 gcc_gimple_checking_assert (index <= phi->nargs);
4286 phi->args[index] = *phiarg;
4289 /* Return the PHI nodes for basic block BB, or NULL if there are no
4292 static inline gimple_seq
4293 phi_nodes (const_basic_block bb)
4295 gcc_checking_assert (!(bb->flags & BB_RTL));
4296 return bb->il.gimple.phi_nodes;
4299 /* Return a pointer to the PHI nodes for basic block BB. */
4301 static inline gimple_seq *
4302 phi_nodes_ptr (basic_block bb)
4304 gcc_checking_assert (!(bb->flags & BB_RTL));
4305 return &bb->il.gimple.phi_nodes;
4308 /* Return the tree operand for argument I of PHI node GS. */
4311 gimple_phi_arg_def (gimple *gs, size_t index)
4313 return gimple_phi_arg (gs, index)->def;
4317 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4319 static inline tree *
4320 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4322 return &gimple_phi_arg (phi, index)->def;
4325 /* Return the edge associated with argument I of phi node PHI. */
4328 gimple_phi_arg_edge (gphi *phi, size_t i)
4330 return EDGE_PRED (gimple_bb (phi), i);
4333 /* Return the source location of gimple argument I of phi node PHI. */
4335 static inline source_location
4336 gimple_phi_arg_location (gphi *phi, size_t i)
4338 return gimple_phi_arg (phi, i)->locus;
4341 /* Return the source location of the argument on edge E of phi node PHI. */
4343 static inline source_location
4344 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4346 return gimple_phi_arg (phi, e->dest_idx)->locus;
4349 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4352 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4354 gimple_phi_arg (phi, i)->locus = loc;
4357 /* Return TRUE if argument I of phi node PHI has a location record. */
4360 gimple_phi_arg_has_location (gphi *phi, size_t i)
4362 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4366 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4369 gimple_resx_region (const gresx *resx_stmt)
4371 return resx_stmt->region;
4374 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4377 gimple_resx_set_region (gresx *resx_stmt, int region)
4379 resx_stmt->region = region;
4382 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4385 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4387 return eh_dispatch_stmt->region;
4390 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4391 EH_DISPATCH_STMT. */
4394 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4396 eh_dispatch_stmt->region = region;
4399 /* Return the number of labels associated with the switch statement GS. */
4401 static inline unsigned
4402 gimple_switch_num_labels (const gswitch *gs)
4405 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4406 num_ops = gimple_num_ops (gs);
4407 gcc_gimple_checking_assert (num_ops > 1);
4412 /* Set NLABELS to be the number of labels for the switch statement GS. */
4415 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4417 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4418 gimple_set_num_ops (g, nlabels + 1);
4422 /* Return the index variable used by the switch statement GS. */
4425 gimple_switch_index (const gswitch *gs)
4431 /* Return a pointer to the index variable for the switch statement GS. */
4433 static inline tree *
4434 gimple_switch_index_ptr (gswitch *gs)
4440 /* Set INDEX to be the index variable for switch statement GS. */
4443 gimple_switch_set_index (gswitch *gs, tree index)
4445 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4450 /* Return the label numbered INDEX. The default label is 0, followed by any
4451 labels in a switch statement. */
4454 gimple_switch_label (const gswitch *gs, unsigned index)
4456 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4457 return gs->op[index + 1];
4460 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4463 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4465 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4466 && (label == NULL_TREE
4467 || TREE_CODE (label) == CASE_LABEL_EXPR));
4468 gs->op[index + 1] = label;
4471 /* Return the default label for a switch statement. */
4474 gimple_switch_default_label (const gswitch *gs)
4476 tree label = gimple_switch_label (gs, 0);
4477 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4481 /* Set the default label for a switch statement. */
4484 gimple_switch_set_default_label (gswitch *gs, tree label)
4486 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4487 gimple_switch_set_label (gs, 0, label);
4490 /* Return true if GS is a GIMPLE_DEBUG statement. */
4493 is_gimple_debug (const gimple *gs)
4495 return gimple_code (gs) == GIMPLE_DEBUG;
4498 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4501 gimple_debug_bind_p (const gimple *s)
4503 if (is_gimple_debug (s))
4504 return s->subcode == GIMPLE_DEBUG_BIND;
4509 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4512 gimple_debug_bind_get_var (gimple *dbg)
4514 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4515 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4516 return gimple_op (dbg, 0);
4519 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4523 gimple_debug_bind_get_value (gimple *dbg)
4525 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4526 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4527 return gimple_op (dbg, 1);
4530 /* Return a pointer to the value bound to the variable in a
4531 GIMPLE_DEBUG bind statement. */
4533 static inline tree *
4534 gimple_debug_bind_get_value_ptr (gimple *dbg)
4536 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4537 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4538 return gimple_op_ptr (dbg, 1);
4541 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4544 gimple_debug_bind_set_var (gimple *dbg, tree var)
4546 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4547 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4548 gimple_set_op (dbg, 0, var);
4551 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4555 gimple_debug_bind_set_value (gimple *dbg, tree value)
4557 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4558 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4559 gimple_set_op (dbg, 1, value);
4562 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4564 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4566 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4570 gimple_debug_bind_reset_value (gimple *dbg)
4572 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4573 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4574 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4577 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4581 gimple_debug_bind_has_value_p (gimple *dbg)
4583 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4584 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4585 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4588 #undef GIMPLE_DEBUG_BIND_NOVALUE
4590 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4593 gimple_debug_source_bind_p (const gimple *s)
4595 if (is_gimple_debug (s))
4596 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4601 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4604 gimple_debug_source_bind_get_var (gimple *dbg)
4606 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4607 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4608 return gimple_op (dbg, 0);
4611 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4615 gimple_debug_source_bind_get_value (gimple *dbg)
4617 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4618 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4619 return gimple_op (dbg, 1);
4622 /* Return a pointer to the value bound to the variable in a
4623 GIMPLE_DEBUG source bind statement. */
4625 static inline tree *
4626 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4628 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4629 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4630 return gimple_op_ptr (dbg, 1);
4633 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4636 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4638 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4639 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4640 gimple_set_op (dbg, 0, var);
4643 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4647 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4649 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4650 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4651 gimple_set_op (dbg, 1, value);
4654 /* Return the line number for EXPR, or return -1 if we have no line
4655 number information for it. */
4657 get_lineno (const gimple *stmt)
4664 loc = gimple_location (stmt);
4665 if (loc == UNKNOWN_LOCATION)
4668 return LOCATION_LINE (loc);
4671 /* Return a pointer to the body for the OMP statement GS. */
4673 static inline gimple_seq *
4674 gimple_omp_body_ptr (gimple *gs)
4676 return &static_cast <gimple_statement_omp *> (gs)->body;
4679 /* Return the body for the OMP statement GS. */
4681 static inline gimple_seq
4682 gimple_omp_body (gimple *gs)
4684 return *gimple_omp_body_ptr (gs);
4687 /* Set BODY to be the body for the OMP statement GS. */
4690 gimple_omp_set_body (gimple *gs, gimple_seq body)
4692 static_cast <gimple_statement_omp *> (gs)->body = body;
4696 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4699 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4701 return crit_stmt->name;
4705 /* Return a pointer to the name associated with OMP critical statement
4708 static inline tree *
4709 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4711 return &crit_stmt->name;
4715 /* Set NAME to be the name associated with OMP critical statement
4719 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4721 crit_stmt->name = name;
4725 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4728 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4730 return crit_stmt->clauses;
4734 /* Return a pointer to the clauses associated with OMP critical statement
4737 static inline tree *
4738 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4740 return &crit_stmt->clauses;
4744 /* Set CLAUSES to be the clauses associated with OMP critical statement
4748 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4750 crit_stmt->clauses = clauses;
4754 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4757 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4759 return ord_stmt->clauses;
4763 /* Return a pointer to the clauses associated with OMP ordered statement
4766 static inline tree *
4767 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4769 return &ord_stmt->clauses;
4773 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4777 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4779 ord_stmt->clauses = clauses;
4783 /* Return the kind of the OMP_FOR statemement G. */
4786 gimple_omp_for_kind (const gimple *g)
4788 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4789 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4793 /* Set the kind of the OMP_FOR statement G. */
4796 gimple_omp_for_set_kind (gomp_for *g, int kind)
4798 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4799 | (kind & GF_OMP_FOR_KIND_MASK);
4803 /* Return true if OMP_FOR statement G has the
4804 GF_OMP_FOR_COMBINED flag set. */
4807 gimple_omp_for_combined_p (const gimple *g)
4809 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4810 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4814 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4815 the boolean value of COMBINED_P. */
4818 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4821 g->subcode |= GF_OMP_FOR_COMBINED;
4823 g->subcode &= ~GF_OMP_FOR_COMBINED;
4827 /* Return true if the OMP_FOR statement G has the
4828 GF_OMP_FOR_COMBINED_INTO flag set. */
4831 gimple_omp_for_combined_into_p (const gimple *g)
4833 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4834 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4838 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4839 on the boolean value of COMBINED_P. */
4842 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4845 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4847 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4851 /* Return the clauses associated with the OMP_FOR statement GS. */
4854 gimple_omp_for_clauses (const gimple *gs)
4856 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4857 return omp_for_stmt->clauses;
4861 /* Return a pointer to the clauses associated with the OMP_FOR statement
4864 static inline tree *
4865 gimple_omp_for_clauses_ptr (gimple *gs)
4867 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4868 return &omp_for_stmt->clauses;
4872 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4876 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4878 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4879 omp_for_stmt->clauses = clauses;
4883 /* Get the collapse count of the OMP_FOR statement GS. */
4885 static inline size_t
4886 gimple_omp_for_collapse (gimple *gs)
4888 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4889 return omp_for_stmt->collapse;
4893 /* Return the condition code associated with the OMP_FOR statement GS. */
4895 static inline enum tree_code
4896 gimple_omp_for_cond (const gimple *gs, size_t i)
4898 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4899 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4900 return omp_for_stmt->iter[i].cond;
4904 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4907 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4909 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4910 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4911 && i < omp_for_stmt->collapse);
4912 omp_for_stmt->iter[i].cond = cond;
4916 /* Return the index variable for the OMP_FOR statement GS. */
4919 gimple_omp_for_index (const gimple *gs, size_t i)
4921 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4922 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4923 return omp_for_stmt->iter[i].index;
4927 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4929 static inline tree *
4930 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4932 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4933 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4934 return &omp_for_stmt->iter[i].index;
4938 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4941 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4943 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4944 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4945 omp_for_stmt->iter[i].index = index;
4949 /* Return the initial value for the OMP_FOR statement GS. */
4952 gimple_omp_for_initial (const gimple *gs, size_t i)
4954 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4955 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4956 return omp_for_stmt->iter[i].initial;
4960 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4962 static inline tree *
4963 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4965 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4966 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4967 return &omp_for_stmt->iter[i].initial;
4971 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4974 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
4976 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4977 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4978 omp_for_stmt->iter[i].initial = initial;
4982 /* Return the final value for the OMP_FOR statement GS. */
4985 gimple_omp_for_final (const gimple *gs, size_t i)
4987 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4988 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4989 return omp_for_stmt->iter[i].final;
4993 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4995 static inline tree *
4996 gimple_omp_for_final_ptr (gimple *gs, size_t i)
4998 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4999 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5000 return &omp_for_stmt->iter[i].final;
5004 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5007 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5009 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5010 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5011 omp_for_stmt->iter[i].final = final;
5015 /* Return the increment value for the OMP_FOR statement GS. */
5018 gimple_omp_for_incr (const gimple *gs, size_t i)
5020 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5021 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5022 return omp_for_stmt->iter[i].incr;
5026 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5028 static inline tree *
5029 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5031 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5032 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5033 return &omp_for_stmt->iter[i].incr;
5037 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5040 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5042 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5043 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5044 omp_for_stmt->iter[i].incr = incr;
5048 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5049 statement GS starts. */
5051 static inline gimple_seq *
5052 gimple_omp_for_pre_body_ptr (gimple *gs)
5054 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5055 return &omp_for_stmt->pre_body;
5059 /* Return the sequence of statements to execute before the OMP_FOR
5060 statement GS starts. */
5062 static inline gimple_seq
5063 gimple_omp_for_pre_body (gimple *gs)
5065 return *gimple_omp_for_pre_body_ptr (gs);
5069 /* Set PRE_BODY to be the sequence of statements to execute before the
5070 OMP_FOR statement GS starts. */
5073 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5075 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5076 omp_for_stmt->pre_body = pre_body;
5080 /* Return the clauses associated with OMP_PARALLEL GS. */
5083 gimple_omp_parallel_clauses (const gimple *gs)
5085 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5086 return omp_parallel_stmt->clauses;
5090 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5092 static inline tree *
5093 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5095 return &omp_parallel_stmt->clauses;
5099 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5102 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5105 omp_parallel_stmt->clauses = clauses;
5109 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5112 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5114 return omp_parallel_stmt->child_fn;
5117 /* Return a pointer to the child function used to hold the body of
5118 OMP_PARALLEL_STMT. */
5120 static inline tree *
5121 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5123 return &omp_parallel_stmt->child_fn;
5127 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5130 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5133 omp_parallel_stmt->child_fn = child_fn;
5137 /* Return the artificial argument used to send variables and values
5138 from the parent to the children threads in OMP_PARALLEL_STMT. */
5141 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5143 return omp_parallel_stmt->data_arg;
5147 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5149 static inline tree *
5150 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5152 return &omp_parallel_stmt->data_arg;
5156 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5159 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5162 omp_parallel_stmt->data_arg = data_arg;
5166 /* Return the clauses associated with OMP_TASK GS. */
5169 gimple_omp_task_clauses (const gimple *gs)
5171 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5172 return omp_task_stmt->clauses;
5176 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5178 static inline tree *
5179 gimple_omp_task_clauses_ptr (gimple *gs)
5181 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5182 return &omp_task_stmt->clauses;
5186 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5190 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5192 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5193 omp_task_stmt->clauses = clauses;
5197 /* Return true if OMP task statement G has the
5198 GF_OMP_TASK_TASKLOOP flag set. */
5201 gimple_omp_task_taskloop_p (const gimple *g)
5203 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5204 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5208 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5209 value of TASKLOOP_P. */
5212 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5214 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5216 g->subcode |= GF_OMP_TASK_TASKLOOP;
5218 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5222 /* Return the child function used to hold the body of OMP_TASK GS. */
5225 gimple_omp_task_child_fn (const gimple *gs)
5227 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5228 return omp_task_stmt->child_fn;
5231 /* Return a pointer to the child function used to hold the body of
5234 static inline tree *
5235 gimple_omp_task_child_fn_ptr (gimple *gs)
5237 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5238 return &omp_task_stmt->child_fn;
5242 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5245 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5247 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5248 omp_task_stmt->child_fn = child_fn;
5252 /* Return the artificial argument used to send variables and values
5253 from the parent to the children threads in OMP_TASK GS. */
5256 gimple_omp_task_data_arg (const gimple *gs)
5258 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5259 return omp_task_stmt->data_arg;
5263 /* Return a pointer to the data argument for OMP_TASK GS. */
5265 static inline tree *
5266 gimple_omp_task_data_arg_ptr (gimple *gs)
5268 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5269 return &omp_task_stmt->data_arg;
5273 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5276 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5278 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5279 omp_task_stmt->data_arg = data_arg;
5283 /* Return the clauses associated with OMP_TASK GS. */
5286 gimple_omp_taskreg_clauses (const gimple *gs)
5288 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5289 = as_a <const gimple_statement_omp_taskreg *> (gs);
5290 return omp_taskreg_stmt->clauses;
5294 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5296 static inline tree *
5297 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5299 gimple_statement_omp_taskreg *omp_taskreg_stmt
5300 = as_a <gimple_statement_omp_taskreg *> (gs);
5301 return &omp_taskreg_stmt->clauses;
5305 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5309 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5311 gimple_statement_omp_taskreg *omp_taskreg_stmt
5312 = as_a <gimple_statement_omp_taskreg *> (gs);
5313 omp_taskreg_stmt->clauses = clauses;
5317 /* Return the child function used to hold the body of OMP_TASK GS. */
5320 gimple_omp_taskreg_child_fn (const gimple *gs)
5322 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5323 = as_a <const gimple_statement_omp_taskreg *> (gs);
5324 return omp_taskreg_stmt->child_fn;
5327 /* Return a pointer to the child function used to hold the body of
5330 static inline tree *
5331 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5333 gimple_statement_omp_taskreg *omp_taskreg_stmt
5334 = as_a <gimple_statement_omp_taskreg *> (gs);
5335 return &omp_taskreg_stmt->child_fn;
5339 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5342 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5344 gimple_statement_omp_taskreg *omp_taskreg_stmt
5345 = as_a <gimple_statement_omp_taskreg *> (gs);
5346 omp_taskreg_stmt->child_fn = child_fn;
5350 /* Return the artificial argument used to send variables and values
5351 from the parent to the children threads in OMP_TASK GS. */
5354 gimple_omp_taskreg_data_arg (const gimple *gs)
5356 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5357 = as_a <const gimple_statement_omp_taskreg *> (gs);
5358 return omp_taskreg_stmt->data_arg;
5362 /* Return a pointer to the data argument for OMP_TASK GS. */
5364 static inline tree *
5365 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5367 gimple_statement_omp_taskreg *omp_taskreg_stmt
5368 = as_a <gimple_statement_omp_taskreg *> (gs);
5369 return &omp_taskreg_stmt->data_arg;
5373 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5376 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5378 gimple_statement_omp_taskreg *omp_taskreg_stmt
5379 = as_a <gimple_statement_omp_taskreg *> (gs);
5380 omp_taskreg_stmt->data_arg = data_arg;
5384 /* Return the copy function used to hold the body of OMP_TASK GS. */
5387 gimple_omp_task_copy_fn (const gimple *gs)
5389 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5390 return omp_task_stmt->copy_fn;
5393 /* Return a pointer to the copy function used to hold the body of
5396 static inline tree *
5397 gimple_omp_task_copy_fn_ptr (gimple *gs)
5399 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5400 return &omp_task_stmt->copy_fn;
5404 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5407 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5409 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5410 omp_task_stmt->copy_fn = copy_fn;
5414 /* Return size of the data block in bytes in OMP_TASK GS. */
5417 gimple_omp_task_arg_size (const gimple *gs)
5419 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5420 return omp_task_stmt->arg_size;
5424 /* Return a pointer to the data block size for OMP_TASK GS. */
5426 static inline tree *
5427 gimple_omp_task_arg_size_ptr (gimple *gs)
5429 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5430 return &omp_task_stmt->arg_size;
5434 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5437 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5439 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5440 omp_task_stmt->arg_size = arg_size;
5444 /* Return align of the data block in bytes in OMP_TASK GS. */
5447 gimple_omp_task_arg_align (const gimple *gs)
5449 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5450 return omp_task_stmt->arg_align;
5454 /* Return a pointer to the data block align for OMP_TASK GS. */
5456 static inline tree *
5457 gimple_omp_task_arg_align_ptr (gimple *gs)
5459 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5460 return &omp_task_stmt->arg_align;
5464 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5467 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5469 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5470 omp_task_stmt->arg_align = arg_align;
5474 /* Return the clauses associated with OMP_SINGLE GS. */
5477 gimple_omp_single_clauses (const gimple *gs)
5479 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5480 return omp_single_stmt->clauses;
5484 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5486 static inline tree *
5487 gimple_omp_single_clauses_ptr (gimple *gs)
5489 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5490 return &omp_single_stmt->clauses;
5494 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5497 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5499 omp_single_stmt->clauses = clauses;
5503 /* Return the clauses associated with OMP_TARGET GS. */
5506 gimple_omp_target_clauses (const gimple *gs)
5508 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5509 return omp_target_stmt->clauses;
5513 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5515 static inline tree *
5516 gimple_omp_target_clauses_ptr (gimple *gs)
5518 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5519 return &omp_target_stmt->clauses;
5523 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5526 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5529 omp_target_stmt->clauses = clauses;
5533 /* Return the kind of the OMP_TARGET G. */
5536 gimple_omp_target_kind (const gimple *g)
5538 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5539 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5543 /* Set the kind of the OMP_TARGET G. */
5546 gimple_omp_target_set_kind (gomp_target *g, int kind)
5548 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5549 | (kind & GF_OMP_TARGET_KIND_MASK);
5553 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5556 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5558 return omp_target_stmt->child_fn;
5561 /* Return a pointer to the child function used to hold the body of
5564 static inline tree *
5565 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5567 return &omp_target_stmt->child_fn;
5571 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5574 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5577 omp_target_stmt->child_fn = child_fn;
5581 /* Return the artificial argument used to send variables and values
5582 from the parent to the children threads in OMP_TARGET_STMT. */
5585 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5587 return omp_target_stmt->data_arg;
5591 /* Return a pointer to the data argument for OMP_TARGET GS. */
5593 static inline tree *
5594 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5596 return &omp_target_stmt->data_arg;
5600 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5603 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5606 omp_target_stmt->data_arg = data_arg;
5610 /* Return the clauses associated with OMP_TEAMS GS. */
5613 gimple_omp_teams_clauses (const gimple *gs)
5615 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5616 return omp_teams_stmt->clauses;
5620 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5622 static inline tree *
5623 gimple_omp_teams_clauses_ptr (gimple *gs)
5625 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5626 return &omp_teams_stmt->clauses;
5630 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5633 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5635 omp_teams_stmt->clauses = clauses;
5639 /* Return the clauses associated with OMP_SECTIONS GS. */
5642 gimple_omp_sections_clauses (const gimple *gs)
5644 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5645 return omp_sections_stmt->clauses;
5649 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5651 static inline tree *
5652 gimple_omp_sections_clauses_ptr (gimple *gs)
5654 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5655 return &omp_sections_stmt->clauses;
5659 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5663 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5665 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5666 omp_sections_stmt->clauses = clauses;
5670 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5674 gimple_omp_sections_control (const gimple *gs)
5676 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5677 return omp_sections_stmt->control;
5681 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5684 static inline tree *
5685 gimple_omp_sections_control_ptr (gimple *gs)
5687 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5688 return &omp_sections_stmt->control;
5692 /* Set CONTROL to be the set of clauses associated with the
5693 GIMPLE_OMP_SECTIONS in GS. */
5696 gimple_omp_sections_set_control (gimple *gs, tree control)
5698 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5699 omp_sections_stmt->control = control;
5703 /* Set the value being stored in an atomic store. */
5706 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5708 store_stmt->val = val;
5712 /* Return the value being stored in an atomic store. */
5715 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5717 return store_stmt->val;
5721 /* Return a pointer to the value being stored in an atomic store. */
5723 static inline tree *
5724 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5726 return &store_stmt->val;
5730 /* Set the LHS of an atomic load. */
5733 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5735 load_stmt->lhs = lhs;
5739 /* Get the LHS of an atomic load. */
5742 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5744 return load_stmt->lhs;
5748 /* Return a pointer to the LHS of an atomic load. */
5750 static inline tree *
5751 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5753 return &load_stmt->lhs;
5757 /* Set the RHS of an atomic load. */
5760 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5762 load_stmt->rhs = rhs;
5766 /* Get the RHS of an atomic load. */
5769 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5771 return load_stmt->rhs;
5775 /* Return a pointer to the RHS of an atomic load. */
5777 static inline tree *
5778 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5780 return &load_stmt->rhs;
5784 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5787 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5789 return cont_stmt->control_def;
5792 /* The same as above, but return the address. */
5794 static inline tree *
5795 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5797 return &cont_stmt->control_def;
5800 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5803 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5805 cont_stmt->control_def = def;
5809 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5812 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5814 return cont_stmt->control_use;
5818 /* The same as above, but return the address. */
5820 static inline tree *
5821 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5823 return &cont_stmt->control_use;
5827 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5830 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5832 cont_stmt->control_use = use;
5835 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5836 TRANSACTION_STMT. */
5838 static inline gimple_seq *
5839 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5841 return &transaction_stmt->body;
5844 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5846 static inline gimple_seq
5847 gimple_transaction_body (gtransaction *transaction_stmt)
5849 return *gimple_transaction_body_ptr (transaction_stmt);
5852 /* Return the label associated with a GIMPLE_TRANSACTION. */
5855 gimple_transaction_label (const gtransaction *transaction_stmt)
5857 return transaction_stmt->label;
5860 static inline tree *
5861 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5863 return &transaction_stmt->label;
5866 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5868 static inline unsigned int
5869 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5871 return transaction_stmt->subcode;
5874 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5875 TRANSACTION_STMT. */
5878 gimple_transaction_set_body (gtransaction *transaction_stmt,
5881 transaction_stmt->body = body;
5884 /* Set the label associated with a GIMPLE_TRANSACTION. */
5887 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5889 transaction_stmt->label = label;
5892 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5895 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5896 unsigned int subcode)
5898 transaction_stmt->subcode = subcode;
5902 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5904 static inline tree *
5905 gimple_return_retval_ptr (greturn *gs)
5910 /* Return the return value for GIMPLE_RETURN GS. */
5913 gimple_return_retval (const greturn *gs)
5919 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5922 gimple_return_set_retval (greturn *gs, tree retval)
5928 /* Return the return bounds for GIMPLE_RETURN GS. */
5931 gimple_return_retbnd (const gimple *gs)
5933 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5934 return gimple_op (gs, 1);
5938 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5941 gimple_return_set_retbnd (gimple *gs, tree retval)
5943 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5944 gimple_set_op (gs, 1, retval);
5948 /* Returns true when the gimple statement STMT is any of the OMP types. */
5950 #define CASE_GIMPLE_OMP \
5951 case GIMPLE_OMP_PARALLEL: \
5952 case GIMPLE_OMP_TASK: \
5953 case GIMPLE_OMP_FOR: \
5954 case GIMPLE_OMP_SECTIONS: \
5955 case GIMPLE_OMP_SECTIONS_SWITCH: \
5956 case GIMPLE_OMP_SINGLE: \
5957 case GIMPLE_OMP_TARGET: \
5958 case GIMPLE_OMP_TEAMS: \
5959 case GIMPLE_OMP_SECTION: \
5960 case GIMPLE_OMP_MASTER: \
5961 case GIMPLE_OMP_TASKGROUP: \
5962 case GIMPLE_OMP_ORDERED: \
5963 case GIMPLE_OMP_CRITICAL: \
5964 case GIMPLE_OMP_RETURN: \
5965 case GIMPLE_OMP_ATOMIC_LOAD: \
5966 case GIMPLE_OMP_ATOMIC_STORE: \
5967 case GIMPLE_OMP_CONTINUE
5970 is_gimple_omp (const gimple *stmt)
5972 switch (gimple_code (stmt))
5981 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
5985 is_gimple_omp_oacc (const gimple *stmt)
5987 gcc_assert (is_gimple_omp (stmt));
5988 switch (gimple_code (stmt))
5990 case GIMPLE_OMP_FOR:
5991 switch (gimple_omp_for_kind (stmt))
5993 case GF_OMP_FOR_KIND_OACC_LOOP:
5998 case GIMPLE_OMP_TARGET:
5999 switch (gimple_omp_target_kind (stmt))
6001 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6002 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6003 case GF_OMP_TARGET_KIND_OACC_DATA:
6004 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6005 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6006 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6017 /* Return true if the OMP gimple statement STMT is offloaded. */
6020 is_gimple_omp_offloaded (const gimple *stmt)
6022 gcc_assert (is_gimple_omp (stmt));
6023 switch (gimple_code (stmt))
6025 case GIMPLE_OMP_TARGET:
6026 switch (gimple_omp_target_kind (stmt))
6028 case GF_OMP_TARGET_KIND_REGION:
6029 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6030 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6041 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6044 gimple_nop_p (const gimple *g)
6046 return gimple_code (g) == GIMPLE_NOP;
6050 /* Return true if GS is a GIMPLE_RESX. */
6053 is_gimple_resx (const gimple *gs)
6055 return gimple_code (gs) == GIMPLE_RESX;
6058 /* Return the type of the main expression computed by STMT. Return
6059 void_type_node if the statement computes nothing. */
6062 gimple_expr_type (const gimple *stmt)
6064 enum gimple_code code = gimple_code (stmt);
6065 /* In general we want to pass out a type that can be substituted
6066 for both the RHS and the LHS types if there is a possibly
6067 useless conversion involved. That means returning the
6068 original RHS type as far as we can reconstruct it. */
6069 if (code == GIMPLE_CALL)
6071 const gcall *call_stmt = as_a <const gcall *> (stmt);
6072 if (gimple_call_internal_p (call_stmt)
6073 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6074 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6076 return gimple_call_return_type (call_stmt);
6078 else if (code == GIMPLE_ASSIGN)
6080 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6081 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6083 /* As fallback use the type of the LHS. */
6084 return TREE_TYPE (gimple_get_lhs (stmt));
6086 else if (code == GIMPLE_COND)
6087 return boolean_type_node;
6089 return void_type_node;
6092 /* Enum and arrays used for allocation stats. Keep in sync with
6093 gimple.c:gimple_alloc_kind_names. */
6094 enum gimple_alloc_kind
6096 gimple_alloc_kind_assign, /* Assignments. */
6097 gimple_alloc_kind_phi, /* PHI nodes. */
6098 gimple_alloc_kind_cond, /* Conditionals. */
6099 gimple_alloc_kind_rest, /* Everything else. */
6100 gimple_alloc_kind_all
6103 extern int gimple_alloc_counts[];
6104 extern int gimple_alloc_sizes[];
6106 /* Return the allocation kind for a given stmt CODE. */
6107 static inline enum gimple_alloc_kind
6108 gimple_alloc_kind (enum gimple_code code)
6113 return gimple_alloc_kind_assign;
6115 return gimple_alloc_kind_phi;
6117 return gimple_alloc_kind_cond;
6119 return gimple_alloc_kind_rest;
6123 /* Return true if a location should not be emitted for this statement
6124 by annotate_all_with_location. */
6127 gimple_do_not_emit_location_p (gimple *g)
6129 return gimple_plf (g, GF_PLF_1);
6132 /* Mark statement G so a location will not be emitted by
6133 annotate_one_with_location. */
6136 gimple_set_do_not_emit_location (gimple *g)
6138 /* The PLF flags are initialized to 0 when a new tuple is created,
6139 so no need to initialize it anywhere. */
6140 gimple_set_plf (g, GF_PLF_1, true);
6144 /* Macros for showing usage statistics. */
6145 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6147 : ((x) < 1024*1024*10 \
6149 : (x) / (1024*1024))))
6151 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6153 #endif /* GCC_GIMPLE_H */