1 /* Gimple IR definitions.
3 Copyright (C) 2007-2023 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
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 \
52 #define GIMPLE_CHECK(GS, CODE) \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
61 GIMPLE_CHECK2(const gimple
*gs
,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file
= __builtin_FILE (),
64 int line
= __builtin_LINE (),
65 const char *fun
= __builtin_FUNCTION ())
67 const char *file
= __FILE__
,
69 const char *fun
= NULL
)
72 T ret
= dyn_cast
<T
> (gs
);
74 gimple_check_failed (gs
, file
, line
, fun
,
75 remove_pointer
<T
>::type::code_
, ERROR_MARK
);
80 GIMPLE_CHECK2(gimple
*gs
,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file
= __builtin_FILE (),
83 int line
= __builtin_LINE (),
84 const char *fun
= __builtin_FUNCTION ())
86 const char *file
= __FILE__
,
88 const char *fun
= NULL
)
91 T ret
= dyn_cast
<T
> (gs
);
93 gimple_check_failed (gs
, file
, line
, fun
,
94 remove_pointer
<T
>::type::code_
, ERROR_MARK
);
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T
>
102 GIMPLE_CHECK2(gimple
*gs
)
104 return as_a
<T
> (gs
);
106 template <typename T
>
108 GIMPLE_CHECK2(const gimple
*gs
)
110 return as_a
<T
> (gs
);
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
138 GF_ASM_INPUT
= 1 << 0,
139 GF_ASM_VOLATILE
= 1 << 1,
140 GF_ASM_INLINE
= 1 << 2,
141 GF_CALL_FROM_THUNK
= 1 << 0,
142 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
143 GF_CALL_TAILCALL
= 1 << 2,
144 GF_CALL_VA_ARG_PACK
= 1 << 3,
145 GF_CALL_NOTHROW
= 1 << 4,
146 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
147 GF_CALL_INTERNAL
= 1 << 6,
148 GF_CALL_CTRL_ALTERING
= 1 << 7,
149 GF_CALL_MUST_TAIL_CALL
= 1 << 9,
150 GF_CALL_BY_DESCRIPTOR
= 1 << 10,
151 GF_CALL_NOCF_CHECK
= 1 << 11,
152 GF_CALL_FROM_NEW_OR_DELETE
= 1 << 12,
153 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
154 GF_OMP_TASK_TASKLOOP
= 1 << 0,
155 GF_OMP_TASK_TASKWAIT
= 1 << 1,
156 GF_OMP_FOR_KIND_MASK
= (1 << 3) - 1,
157 GF_OMP_FOR_KIND_FOR
= 0,
158 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
159 GF_OMP_FOR_KIND_TASKLOOP
= 2,
160 GF_OMP_FOR_KIND_OACC_LOOP
= 4,
161 GF_OMP_FOR_KIND_SIMD
= 5,
162 GF_OMP_FOR_COMBINED
= 1 << 3,
163 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
164 GF_OMP_TARGET_KIND_MASK
= (1 << 5) - 1,
165 GF_OMP_TARGET_KIND_REGION
= 0,
166 GF_OMP_TARGET_KIND_DATA
= 1,
167 GF_OMP_TARGET_KIND_UPDATE
= 2,
168 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
169 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
170 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
171 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
172 GF_OMP_TARGET_KIND_OACC_SERIAL
= 7,
173 GF_OMP_TARGET_KIND_OACC_DATA
= 8,
174 GF_OMP_TARGET_KIND_OACC_UPDATE
= 9,
175 GF_OMP_TARGET_KIND_OACC_ENTER_DATA
= 10,
176 GF_OMP_TARGET_KIND_OACC_EXIT_DATA
= 11,
177 GF_OMP_TARGET_KIND_OACC_DECLARE
= 12,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA
= 13,
179 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
180 decomposed part, parallelized. */
181 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
= 14,
182 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
183 decomposed part, "gang-single". */
184 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
= 15,
185 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
186 decomposed parts' 'data' construct. */
187 GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
= 16,
188 GF_OMP_TEAMS_HOST
= 1 << 0,
190 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
191 a thread synchronization via some sort of barrier. The exact barrier
192 that would otherwise be emitted is dependent on the OMP statement with
193 which this return is associated. */
194 GF_OMP_RETURN_NOWAIT
= 1 << 0,
196 GF_OMP_SECTION_LAST
= 1 << 0,
197 GF_OMP_ORDERED_STANDALONE
= 1 << 0,
198 GF_OMP_ATOMIC_MEMORY_ORDER
= (1 << 6) - 1,
199 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 6,
200 GF_OMP_ATOMIC_WEAK
= 1 << 7,
201 GF_PREDICT_TAKEN
= 1 << 15
204 /* This subcode tells apart different kinds of stmts that are not used
205 for codegen, but rather to retain debug information. */
206 enum gimple_debug_subcode
{
207 GIMPLE_DEBUG_BIND
= 0,
208 GIMPLE_DEBUG_SOURCE_BIND
= 1,
209 GIMPLE_DEBUG_BEGIN_STMT
= 2,
210 GIMPLE_DEBUG_INLINE_ENTRY
= 3
213 /* Masks for selecting a pass local flag (PLF) to work on. These
214 masks are used by gimple_set_plf and gimple_plf. */
220 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
221 are for 64 bit hosts. */
223 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
224 chain_next ("%h.next"), variable_size
))
228 Main identifying code for a tuple. */
229 ENUM_BITFIELD(gimple_code
) code
: 8;
231 /* Nonzero if a warning should not be emitted on this tuple. */
232 unsigned int no_warning
: 1;
234 /* Nonzero if this tuple has been visited. Passes are responsible
235 for clearing this bit before using it. */
236 unsigned int visited
: 1;
238 /* Nonzero if this tuple represents a non-temporal move. */
239 unsigned int nontemporal_move
: 1;
241 /* Pass local flags. These flags are free for any pass to use as
242 they see fit. Passes should not assume that these flags contain
243 any useful value when the pass starts. Any initial state that
244 the pass requires should be set on entry to the pass. See
245 gimple_set_plf and gimple_plf for usage. */
246 unsigned int plf
: 2;
248 /* Nonzero if this statement has been modified and needs to have its
249 operands rescanned. */
250 unsigned modified
: 1;
252 /* Nonzero if this statement contains volatile operands. */
253 unsigned has_volatile_ops
: 1;
255 /* Padding to get subcode to 16 bit alignment. */
258 /* The SUBCODE field can be used for tuple-specific flags for tuples
259 that do not require subcodes. Note that SUBCODE should be at
260 least as wide as tree codes, as several tuples store tree codes
262 unsigned int subcode
: 16;
264 /* UID of this statement. This is used by passes that want to
265 assign IDs to statements. It must be assigned and used by each
266 pass. By default it should be assumed to contain garbage. */
270 Locus information for debug info. */
273 /* Number of operands in this tuple. */
277 Basic block holding this statement. */
281 Linked lists of gimple statements. The next pointers form
282 a NULL terminated list, the prev pointers are a cyclic list.
283 A gimple statement is hence also a double-ended list of
284 statements, with the pointer itself being the first element,
285 and the prev pointer being the last. */
287 gimple
*GTY((skip
)) prev
;
291 /* Base structure for tuples with operands. */
293 /* This gimple subclass has no tag value. */
295 gimple_statement_with_ops_base
: public gimple
297 /* [ WORD 1-6 ] : base class */
300 SSA operand vectors. NOTE: It should be possible to
301 amalgamate these vectors with the operand vector OP. However,
302 the SSA operand vectors are organized differently and contain
303 more information (like immediate use chaining). */
304 struct use_optype_d
GTY((skip (""))) *use_ops
;
308 /* Statements that take register operands. */
310 struct GTY((tag("GSS_WITH_OPS")))
311 gimple_statement_with_ops
: public gimple_statement_with_ops_base
313 /* [ WORD 1-7 ] : base class */
316 Operand vector. NOTE! This must always be the last field
317 of this structure. In particular, this means that this
318 structure cannot be embedded inside another one. */
319 tree
GTY((length ("%h.num_ops"))) op
[1];
323 /* Base for statements that take both memory and register operands. */
325 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
326 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
328 /* [ WORD 1-7 ] : base class */
331 Virtual operands for this statement. The GC will pick them
332 up via the ssa_names array. */
333 tree
GTY((skip (""))) vdef
;
334 tree
GTY((skip (""))) vuse
;
338 /* Statements that take both memory and register operands. */
340 struct GTY((tag("GSS_WITH_MEM_OPS")))
341 gimple_statement_with_memory_ops
:
342 public gimple_statement_with_memory_ops_base
344 /* [ WORD 1-9 ] : base class */
347 Operand vector. NOTE! This must always be the last field
348 of this structure. In particular, this means that this
349 structure cannot be embedded inside another one. */
350 tree
GTY((length ("%h.num_ops"))) op
[1];
354 /* Call statements that take both memory and register operands. */
356 struct GTY((tag("GSS_CALL")))
357 gcall
: public gimple_statement_with_memory_ops_base
359 /* [ WORD 1-9 ] : base class */
362 struct pt_solution call_used
;
363 struct pt_solution call_clobbered
;
366 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
367 tree
GTY ((tag ("0"))) fntype
;
368 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
372 Operand vector. NOTE! This must always be the last field
373 of this structure. In particular, this means that this
374 structure cannot be embedded inside another one. */
375 tree
GTY((length ("%h.num_ops"))) op
[1];
377 static const enum gimple_code code_
= GIMPLE_CALL
;
381 /* OMP statements. */
383 struct GTY((tag("GSS_OMP")))
384 gimple_statement_omp
: public gimple
386 /* [ WORD 1-6 ] : base class */
395 struct GTY((tag("GSS_BIND")))
396 gbind
: public gimple
398 /* [ WORD 1-6 ] : base class */
401 Variables declared in this scope. */
405 This is different than the BLOCK field in gimple,
406 which is analogous to TREE_BLOCK (i.e., the lexical block holding
407 this statement). This field is the equivalent of BIND_EXPR_BLOCK
408 in tree land (i.e., the lexical scope defined by this bind). See
419 struct GTY((tag("GSS_CATCH")))
420 gcatch
: public gimple
422 /* [ WORD 1-6 ] : base class */
432 /* GIMPLE_EH_FILTER */
434 struct GTY((tag("GSS_EH_FILTER")))
435 geh_filter
: public gimple
437 /* [ WORD 1-6 ] : base class */
450 struct GTY((tag("GSS_EH_ELSE")))
451 geh_else
: public gimple
453 /* [ WORD 1-6 ] : base class */
456 gimple_seq n_body
, e_body
;
459 /* GIMPLE_EH_MUST_NOT_THROW */
461 struct GTY((tag("GSS_EH_MNT")))
462 geh_mnt
: public gimple
464 /* [ WORD 1-6 ] : base class */
466 /* [ WORD 7 ] Abort function decl. */
472 struct GTY((tag("GSS_PHI")))
475 /* [ WORD 1-6 ] : base class */
485 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
489 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
491 struct GTY((tag("GSS_EH_CTRL")))
492 gimple_statement_eh_ctrl
: public gimple
494 /* [ WORD 1-6 ] : base class */
497 Exception region number. */
501 struct GTY((tag("GSS_EH_CTRL")))
502 gresx
: public gimple_statement_eh_ctrl
504 /* No extra fields; adds invariant:
505 stmt->code == GIMPLE_RESX. */
508 struct GTY((tag("GSS_EH_CTRL")))
509 geh_dispatch
: public gimple_statement_eh_ctrl
511 /* No extra fields; adds invariant:
512 stmt->code == GIMPLE_EH_DISPATH. */
518 struct GTY((tag("GSS_TRY")))
521 /* [ WORD 1-6 ] : base class */
524 Expression to evaluate. */
528 Cleanup expression. */
532 /* Kind of GIMPLE_TRY statements. */
533 enum gimple_try_flags
536 GIMPLE_TRY_CATCH
= 1 << 0,
539 GIMPLE_TRY_FINALLY
= 1 << 1,
540 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
542 /* Analogous to TRY_CATCH_IS_CLEANUP. */
543 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
546 /* GIMPLE_WITH_CLEANUP_EXPR */
548 struct GTY((tag("GSS_WCE")))
549 gimple_statement_wce
: public gimple
551 /* [ WORD 1-6 ] : base class */
553 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
554 executed if an exception is thrown, not on normal exit of its
555 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
559 Cleanup expression. */
566 struct GTY((tag("GSS_ASM")))
567 gasm
: public gimple_statement_with_memory_ops_base
569 /* [ WORD 1-9 ] : base class */
572 __asm__ statement. */
576 Number of inputs, outputs, clobbers, labels. */
583 Operand vector. NOTE! This must always be the last field
584 of this structure. In particular, this means that this
585 structure cannot be embedded inside another one. */
586 tree
GTY((length ("%h.num_ops"))) op
[1];
589 /* GIMPLE_OMP_CRITICAL */
591 struct GTY((tag("GSS_OMP_CRITICAL")))
592 gomp_critical
: public gimple_statement_omp
594 /* [ WORD 1-7 ] : base class */
600 Critical section name. */
605 struct GTY(()) gimple_omp_for_iter
{
606 /* Condition code. */
609 /* Index variable. */
624 struct GTY((tag("GSS_OMP_FOR")))
625 gomp_for
: public gimple_statement_omp
627 /* [ WORD 1-7 ] : base class */
633 Number of elements in iter array. */
637 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
640 Pre-body evaluated before the loop body begins. */
645 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
647 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
648 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
650 /* [ WORD 1-7 ] : base class */
657 Child function holding the body of the parallel region. */
661 Shared data argument. */
665 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
666 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
667 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_PARALLEL
671 || stmt->code == GIMPLE_OMP_TASK
672 || stmt->code == GIMPLE_OMP_TEAMS. */
675 /* GIMPLE_OMP_PARALLEL */
676 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
677 gomp_parallel
: public gimple_statement_omp_taskreg
679 /* No extra fields; adds invariant:
680 stmt->code == GIMPLE_OMP_PARALLEL. */
683 /* GIMPLE_OMP_TARGET */
684 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
685 gomp_target
: public gimple_statement_omp_parallel_layout
687 /* No extra fields; adds invariant:
688 stmt->code == GIMPLE_OMP_TARGET. */
691 /* GIMPLE_OMP_TASK */
693 struct GTY((tag("GSS_OMP_TASK")))
694 gomp_task
: public gimple_statement_omp_taskreg
696 /* [ WORD 1-10 ] : base class */
699 Child function holding firstprivate initialization if needed. */
703 Size and alignment in bytes of the argument data block. */
709 /* GIMPLE_OMP_SECTION */
710 /* Uses struct gimple_statement_omp. */
713 /* GIMPLE_OMP_SECTIONS */
715 struct GTY((tag("GSS_OMP_SECTIONS")))
716 gomp_sections
: public gimple_statement_omp
718 /* [ WORD 1-7 ] : base class */
724 The control variable used for deciding which of the sections to
729 /* GIMPLE_OMP_CONTINUE.
731 Note: This does not inherit from gimple_statement_omp, because we
732 do not need the body field. */
734 struct GTY((tag("GSS_OMP_CONTINUE")))
735 gomp_continue
: public gimple
737 /* [ WORD 1-6 ] : base class */
746 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
747 GIMPLE_OMP_SCAN, GIMPLE_OMP_MASKED, GIMPLE_OMP_SCOPE. */
749 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
750 gimple_statement_omp_single_layout
: public gimple_statement_omp
752 /* [ WORD 1-7 ] : base class */
758 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
759 gomp_single
: public gimple_statement_omp_single_layout
761 /* No extra fields; adds invariant:
762 stmt->code == GIMPLE_OMP_SINGLE. */
765 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
766 gomp_teams
: public gimple_statement_omp_taskreg
768 /* No extra fields; adds invariant:
769 stmt->code == GIMPLE_OMP_TEAMS. */
772 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
773 gomp_ordered
: public gimple_statement_omp_single_layout
775 /* No extra fields; adds invariant:
776 stmt->code == GIMPLE_OMP_ORDERED. */
779 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
780 gomp_scan
: public gimple_statement_omp_single_layout
782 /* No extra fields; adds invariant:
783 stmt->code == GIMPLE_OMP_SCAN. */
787 /* GIMPLE_OMP_ATOMIC_LOAD.
788 Note: This is based on gimple, not g_s_omp, because g_s_omp
789 contains a sequence, which we don't need here. */
791 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
792 gomp_atomic_load
: public gimple
794 /* [ WORD 1-6 ] : base class */
800 /* GIMPLE_OMP_ATOMIC_STORE.
801 See note on GIMPLE_OMP_ATOMIC_LOAD. */
803 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
804 gimple_statement_omp_atomic_store_layout
: public gimple
806 /* [ WORD 1-6 ] : base class */
812 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
814 public gimple_statement_omp_atomic_store_layout
816 /* No extra fields; adds invariant:
817 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
820 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
821 gimple_statement_omp_return
:
822 public gimple_statement_omp_atomic_store_layout
824 /* No extra fields; adds invariant:
825 stmt->code == GIMPLE_OMP_RETURN. */
830 struct GTY((tag("GSS_ASSUME")))
831 gimple_statement_assume
: public gimple
833 /* [ WORD 1-6 ] : base class */
842 /* GIMPLE_TRANSACTION. */
844 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
846 /* The __transaction_atomic was declared [[outer]] or it is
847 __transaction_relaxed. */
848 #define GTMA_IS_OUTER (1u << 0)
849 #define GTMA_IS_RELAXED (1u << 1)
850 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
852 /* The transaction is seen to not have an abort. */
853 #define GTMA_HAVE_ABORT (1u << 2)
854 /* The transaction is seen to have loads or stores. */
855 #define GTMA_HAVE_LOAD (1u << 3)
856 #define GTMA_HAVE_STORE (1u << 4)
857 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
858 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
859 /* The transaction WILL enter serial irrevocable mode.
860 An irrevocable block post-dominates the entire transaction, such
861 that all invocations of the transaction will go serial-irrevocable.
862 In such case, we don't bother instrumenting the transaction, and
863 tell the runtime that it should begin the transaction in
864 serial-irrevocable mode. */
865 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
866 /* The transaction contains no instrumentation code whatsover, most
867 likely because it is guaranteed to go irrevocable upon entry. */
868 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
870 struct GTY((tag("GSS_TRANSACTION")))
871 gtransaction
: public gimple_statement_with_memory_ops_base
873 /* [ WORD 1-9 ] : base class */
884 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
885 enum gimple_statement_structure_enum
{
886 #include "gsstruct.def"
891 /* A statement with the invariant that
892 stmt->code == GIMPLE_COND
893 i.e. a conditional jump statement. */
895 struct GTY((tag("GSS_WITH_OPS")))
896 gcond
: public gimple_statement_with_ops
898 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
899 static const enum gimple_code code_
= GIMPLE_COND
;
902 /* A statement with the invariant that
903 stmt->code == GIMPLE_DEBUG
904 i.e. a debug statement. */
906 struct GTY((tag("GSS_WITH_OPS")))
907 gdebug
: public gimple_statement_with_ops
909 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
912 /* A statement with the invariant that
913 stmt->code == GIMPLE_GOTO
914 i.e. a goto statement. */
916 struct GTY((tag("GSS_WITH_OPS")))
917 ggoto
: public gimple_statement_with_ops
919 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
922 /* A statement with the invariant that
923 stmt->code == GIMPLE_LABEL
924 i.e. a label statement. */
926 struct GTY((tag("GSS_WITH_OPS")))
927 glabel
: public gimple_statement_with_ops
929 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
932 /* A statement with the invariant that
933 stmt->code == GIMPLE_SWITCH
934 i.e. a switch statement. */
936 struct GTY((tag("GSS_WITH_OPS")))
937 gswitch
: public gimple_statement_with_ops
939 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
942 /* A statement with the invariant that
943 stmt->code == GIMPLE_ASSIGN
944 i.e. an assignment statement. */
946 struct GTY((tag("GSS_WITH_MEM_OPS")))
947 gassign
: public gimple_statement_with_memory_ops
949 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
950 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
953 /* A statement with the invariant that
954 stmt->code == GIMPLE_RETURN
955 i.e. a return statement. */
957 struct GTY((tag("GSS_WITH_MEM_OPS")))
958 greturn
: public gimple_statement_with_memory_ops
960 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
966 is_a_helper
<gasm
*>::test (gimple
*gs
)
968 return gs
->code
== GIMPLE_ASM
;
974 is_a_helper
<gassign
*>::test (gimple
*gs
)
976 return gs
->code
== GIMPLE_ASSIGN
;
982 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
984 return gs
->code
== GIMPLE_ASSIGN
;
990 is_a_helper
<gbind
*>::test (gimple
*gs
)
992 return gs
->code
== GIMPLE_BIND
;
998 is_a_helper
<gcall
*>::test (gimple
*gs
)
1000 return gs
->code
== GIMPLE_CALL
;
1006 is_a_helper
<gcatch
*>::test (gimple
*gs
)
1008 return gs
->code
== GIMPLE_CATCH
;
1014 is_a_helper
<gcond
*>::test (gimple
*gs
)
1016 return gs
->code
== GIMPLE_COND
;
1022 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
1024 return gs
->code
== GIMPLE_COND
;
1030 is_a_helper
<gdebug
*>::test (gimple
*gs
)
1032 return gs
->code
== GIMPLE_DEBUG
;
1038 is_a_helper
<const gdebug
*>::test (const gimple
*gs
)
1040 return gs
->code
== GIMPLE_DEBUG
;
1046 is_a_helper
<ggoto
*>::test (gimple
*gs
)
1048 return gs
->code
== GIMPLE_GOTO
;
1054 is_a_helper
<const ggoto
*>::test (const gimple
*gs
)
1056 return gs
->code
== GIMPLE_GOTO
;
1062 is_a_helper
<glabel
*>::test (gimple
*gs
)
1064 return gs
->code
== GIMPLE_LABEL
;
1070 is_a_helper
<const glabel
*>::test (const gimple
*gs
)
1072 return gs
->code
== GIMPLE_LABEL
;
1078 is_a_helper
<gresx
*>::test (gimple
*gs
)
1080 return gs
->code
== GIMPLE_RESX
;
1086 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1088 return gs
->code
== GIMPLE_EH_DISPATCH
;
1094 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1096 return gs
->code
== GIMPLE_EH_ELSE
;
1102 is_a_helper
<const geh_else
*>::test (const gimple
*gs
)
1104 return gs
->code
== GIMPLE_EH_ELSE
;
1110 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1112 return gs
->code
== GIMPLE_EH_FILTER
;
1118 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1120 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1126 is_a_helper
<const geh_mnt
*>::test (const gimple
*gs
)
1128 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1134 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1136 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1142 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1144 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1150 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1152 return gs
->code
== GIMPLE_OMP_RETURN
;
1158 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1160 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1166 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1168 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1174 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1176 return gs
->code
== GIMPLE_OMP_ORDERED
;
1182 is_a_helper
<gomp_scan
*>::test (gimple
*gs
)
1184 return gs
->code
== GIMPLE_OMP_SCAN
;
1190 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1192 return gs
->code
== GIMPLE_OMP_FOR
;
1198 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1200 return (gs
->code
== GIMPLE_OMP_PARALLEL
1201 || gs
->code
== GIMPLE_OMP_TASK
1202 || gs
->code
== GIMPLE_OMP_TEAMS
);
1208 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1210 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1216 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1218 return gs
->code
== GIMPLE_OMP_TARGET
;
1224 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1226 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1232 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1234 return gs
->code
== GIMPLE_OMP_SINGLE
;
1240 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1242 return gs
->code
== GIMPLE_OMP_TEAMS
;
1248 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1250 return gs
->code
== GIMPLE_OMP_TASK
;
1256 is_a_helper
<gphi
*>::test (gimple
*gs
)
1258 return gs
->code
== GIMPLE_PHI
;
1264 is_a_helper
<greturn
*>::test (gimple
*gs
)
1266 return gs
->code
== GIMPLE_RETURN
;
1272 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1274 return gs
->code
== GIMPLE_SWITCH
;
1280 is_a_helper
<const gswitch
*>::test (const gimple
*gs
)
1282 return gs
->code
== GIMPLE_SWITCH
;
1288 is_a_helper
<gimple_statement_assume
*>::test (gimple
*gs
)
1290 return gs
->code
== GIMPLE_ASSUME
;
1296 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1298 return gs
->code
== GIMPLE_TRANSACTION
;
1304 is_a_helper
<gtry
*>::test (gimple
*gs
)
1306 return gs
->code
== GIMPLE_TRY
;
1312 is_a_helper
<const gtry
*>::test (const gimple
*gs
)
1314 return gs
->code
== GIMPLE_TRY
;
1320 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1322 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1328 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1330 return gs
->code
== GIMPLE_ASM
;
1336 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1338 return gs
->code
== GIMPLE_BIND
;
1344 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1346 return gs
->code
== GIMPLE_CALL
;
1352 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1354 return gs
->code
== GIMPLE_CATCH
;
1360 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1362 return gs
->code
== GIMPLE_RESX
;
1368 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1370 return gs
->code
== GIMPLE_EH_DISPATCH
;
1376 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1378 return gs
->code
== GIMPLE_EH_FILTER
;
1384 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1386 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1392 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1394 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1400 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1402 return gs
->code
== GIMPLE_OMP_RETURN
;
1408 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1410 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1416 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1418 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1424 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1426 return gs
->code
== GIMPLE_OMP_ORDERED
;
1432 is_a_helper
<const gomp_scan
*>::test (const gimple
*gs
)
1434 return gs
->code
== GIMPLE_OMP_SCAN
;
1440 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1442 return gs
->code
== GIMPLE_OMP_FOR
;
1448 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1450 return (gs
->code
== GIMPLE_OMP_PARALLEL
1451 || gs
->code
== GIMPLE_OMP_TASK
1452 || gs
->code
== GIMPLE_OMP_TEAMS
);
1458 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1460 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1466 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1468 return gs
->code
== GIMPLE_OMP_TARGET
;
1474 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1476 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1482 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1484 return gs
->code
== GIMPLE_OMP_SINGLE
;
1490 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1492 return gs
->code
== GIMPLE_OMP_TEAMS
;
1498 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1500 return gs
->code
== GIMPLE_OMP_TASK
;
1506 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1508 return gs
->code
== GIMPLE_PHI
;
1514 is_a_helper
<const greturn
*>::test (const gimple
*gs
)
1516 return gs
->code
== GIMPLE_RETURN
;
1522 is_a_helper
<const gimple_statement_assume
*>::test (const gimple
*gs
)
1524 return gs
->code
== GIMPLE_ASSUME
;
1530 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1532 return gs
->code
== GIMPLE_TRANSACTION
;
1535 /* Offset in bytes to the location of the operand vector.
1536 Zero if there is no operand vector for this tuple structure. */
1537 extern size_t const gimple_ops_offset_
[];
1539 /* Map GIMPLE codes to GSS codes. */
1540 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1542 /* This variable holds the currently expanded gimple statement for purposes
1543 of comminucating the profile info to the builtin expanders. */
1544 extern gimple
*currently_expanding_gimple_stmt
;
1546 size_t gimple_size (enum gimple_code code
, unsigned num_ops
= 0);
1547 void gimple_init (gimple
*g
, enum gimple_code code
, unsigned num_ops
);
1548 gimple
*gimple_alloc (enum gimple_code
, unsigned CXX_MEM_STAT_INFO
);
1549 greturn
*gimple_build_return (tree
);
1550 void gimple_call_reset_alias_info (gcall
*);
1551 gcall
*gimple_build_call_vec (tree
, const vec
<tree
> &);
1552 gcall
*gimple_build_call (tree
, unsigned, ...);
1553 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1554 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1555 gcall
*gimple_build_call_internal_vec (enum internal_fn
, const vec
<tree
> &);
1556 gcall
*gimple_build_call_from_tree (tree
, tree
);
1557 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1558 gassign
*gimple_build_assign (tree
, enum tree_code
,
1559 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1560 gassign
*gimple_build_assign (tree
, enum tree_code
,
1561 tree
, tree CXX_MEM_STAT_INFO
);
1562 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1563 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1564 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1565 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1566 glabel
*gimple_build_label (tree label
);
1567 ggoto
*gimple_build_goto (tree dest
);
1568 gimple
*gimple_build_nop (void);
1569 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1570 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1571 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1572 vec
<tree
, va_gc
> *);
1573 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1574 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1575 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1576 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1577 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1578 enum gimple_try_flags
);
1579 gimple
*gimple_build_wce (gimple_seq
);
1580 gresx
*gimple_build_resx (int);
1581 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1582 gswitch
*gimple_build_switch (tree
, tree
, const vec
<tree
> &);
1583 geh_dispatch
*gimple_build_eh_dispatch (int);
1584 gdebug
*gimple_build_debug_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1585 gdebug
*gimple_build_debug_source_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1586 gdebug
*gimple_build_debug_begin_stmt (tree
, location_t CXX_MEM_STAT_INFO
);
1587 gdebug
*gimple_build_debug_inline_entry (tree
, location_t CXX_MEM_STAT_INFO
);
1588 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1589 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1590 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1591 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1593 gimple
*gimple_build_omp_section (gimple_seq
);
1594 gimple
*gimple_build_omp_scope (gimple_seq
, tree
);
1595 gimple
*gimple_build_omp_master (gimple_seq
);
1596 gimple
*gimple_build_omp_masked (gimple_seq
, tree
);
1597 gimple
*gimple_build_omp_taskgroup (gimple_seq
, tree
);
1598 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1599 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1600 gimple
*gimple_build_omp_return (bool);
1601 gomp_scan
*gimple_build_omp_scan (gimple_seq
, tree
);
1602 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1603 gimple
*gimple_build_omp_sections_switch (void);
1604 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1605 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1606 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1607 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
,
1608 enum omp_memory_order
);
1609 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
, enum omp_memory_order
);
1610 gimple
*gimple_build_assume (tree
, gimple_seq
);
1611 gtransaction
*gimple_build_transaction (gimple_seq
);
1612 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1613 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1614 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1615 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1616 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1618 extern void annotate_all_with_location (gimple_seq
, location_t
);
1619 bool empty_body_p (gimple_seq
);
1620 gimple_seq
gimple_seq_copy (gimple_seq
);
1621 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1622 int gimple_call_flags (const gimple
*);
1623 int gimple_call_arg_flags (const gcall
*, unsigned);
1624 int gimple_call_retslot_flags (const gcall
*);
1625 int gimple_call_static_chain_flags (const gcall
*);
1626 int gimple_call_return_flags (const gcall
*);
1627 bool gimple_call_nonnull_result_p (gcall
*);
1628 tree
gimple_call_nonnull_arg (gcall
*);
1629 bool gimple_assign_copy_p (gimple
*);
1630 bool gimple_assign_ssa_name_copy_p (gimple
*);
1631 bool gimple_assign_unary_nop_p (gimple
*);
1632 bool gimple_assign_load_p (const gimple
*);
1633 void gimple_set_bb (gimple
*, basic_block
);
1634 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1635 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1637 tree
gimple_get_lhs (const gimple
*);
1638 void gimple_set_lhs (gimple
*, tree
);
1639 gimple
*gimple_copy (gimple
*);
1640 void gimple_move_vops (gimple
*, gimple
*);
1641 bool gimple_has_side_effects (const gimple
*);
1642 bool gimple_could_trap_p_1 (const gimple
*, bool, bool);
1643 bool gimple_could_trap_p (const gimple
*);
1644 bool gimple_assign_rhs_could_trap_p (gimple
*);
1645 extern void dump_gimple_statistics (void);
1646 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1647 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1648 extern bool gimple_compare_field_offset (tree
, tree
);
1649 extern tree
gimple_unsigned_type (tree
);
1650 extern tree
gimple_signed_type (tree
);
1651 extern alias_set_type
gimple_get_alias_set (tree
);
1652 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1653 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1654 extern combined_fn
gimple_call_combined_fn (const gimple
*);
1655 extern bool gimple_call_operator_delete_p (const gcall
*);
1656 extern bool gimple_call_builtin_p (const gimple
*);
1657 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1658 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1659 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1660 extern void dump_decl_set (FILE *, bitmap
);
1661 extern bool nonfreeing_call_p (gimple
*);
1662 extern bool nonbarrier_call_p (gimple
*);
1663 extern bool infer_nonnull_range (gimple
*, tree
);
1664 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1665 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1666 extern void sort_case_labels (vec
<tree
> &);
1667 extern void preprocess_case_label_vec_for_gimple (vec
<tree
> &, tree
, tree
*);
1668 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1669 extern void gimple_seq_discard (gimple_seq
);
1670 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1671 extern bool gimple_inexpensive_call_p (gcall
*);
1672 extern bool stmt_can_terminate_bb_p (gimple
*);
1673 extern location_t
gimple_or_expr_nonartificial_location (gimple
*, tree
);
1674 gcall
*gimple_build_builtin_unreachable (location_t
);
1676 /* Return the disposition for a warning (or all warnings by default)
1678 extern bool warning_suppressed_p (const gimple
*, opt_code
= all_warnings
)
1679 ATTRIBUTE_NONNULL (1);
1680 /* Set the disposition for a warning (or all warnings by default)
1681 at a location to enabled by default. */
1682 extern void suppress_warning (gimple
*, opt_code
= all_warnings
,
1683 bool = true) ATTRIBUTE_NONNULL (1);
1685 /* Copy the warning disposition mapping from one statement to another. */
1686 extern void copy_warning (gimple
*, const gimple
*)
1687 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1688 /* Copy the warning disposition mapping from an expression to a statement. */
1689 extern void copy_warning (gimple
*, const_tree
)
1690 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1691 /* Copy the warning disposition mapping from a statement to an expression. */
1692 extern void copy_warning (tree
, const gimple
*)
1693 ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
1695 /* Formal (expression) temporary table handling: multiple occurrences of
1696 the same scalar expression are evaluated into the same temporary. */
1698 typedef struct gimple_temp_hash_elt
1701 tree temp
; /* Value */
1704 /* Get the number of the next statement uid to be allocated. */
1706 gimple_stmt_max_uid (struct function
*fn
)
1708 return fn
->last_stmt_uid
;
1711 /* Set the number of the next statement uid to be allocated. */
1713 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1715 fn
->last_stmt_uid
= maxid
;
1718 /* Set the number of the next statement uid to be allocated. */
1720 inc_gimple_stmt_max_uid (struct function
*fn
)
1722 return fn
->last_stmt_uid
++;
1725 /* Return the first node in GIMPLE sequence S. */
1727 inline gimple_seq_node
1728 gimple_seq_first (gimple_seq s
)
1734 /* Return the first statement in GIMPLE sequence S. */
1737 gimple_seq_first_stmt (gimple_seq s
)
1739 gimple_seq_node n
= gimple_seq_first (s
);
1743 /* Return the first statement in GIMPLE sequence S as a gbind *,
1744 verifying that it has code GIMPLE_BIND in a checked build. */
1747 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1749 gimple_seq_node n
= gimple_seq_first (s
);
1750 return as_a
<gbind
*> (n
);
1754 /* Return the last node in GIMPLE sequence S. */
1756 inline gimple_seq_node
1757 gimple_seq_last (gimple_seq s
)
1759 return s
? s
->prev
: NULL
;
1763 /* Return the last statement in GIMPLE sequence S. */
1766 gimple_seq_last_stmt (gimple_seq s
)
1768 gimple_seq_node n
= gimple_seq_last (s
);
1773 /* Set the last node in GIMPLE sequence *PS to LAST. */
1776 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1782 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1785 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1791 /* Return true if GIMPLE sequence S is empty. */
1794 gimple_seq_empty_p (gimple_seq s
)
1799 /* Allocate a new sequence and initialize its first element with STMT. */
1802 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1804 gimple_seq seq
= NULL
;
1805 gimple_seq_add_stmt (&seq
, stmt
);
1810 /* Returns the sequence of statements in BB. */
1813 bb_seq (const_basic_block bb
)
1815 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1819 bb_seq_addr (basic_block bb
)
1821 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1824 /* Sets the sequence of statements in BB to SEQ. */
1827 set_bb_seq (basic_block bb
, gimple_seq seq
)
1829 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1830 bb
->il
.gimple
.seq
= seq
;
1834 /* Return the code for GIMPLE statement G. */
1836 inline enum gimple_code
1837 gimple_code (const gimple
*g
)
1843 /* Return the GSS code used by a GIMPLE code. */
1845 inline enum gimple_statement_structure_enum
1846 gss_for_code (enum gimple_code code
)
1848 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1849 return gss_for_code_
[code
];
1853 /* Return which GSS code is used by GS. */
1855 inline enum gimple_statement_structure_enum
1856 gimple_statement_structure (gimple
*gs
)
1858 return gss_for_code (gimple_code (gs
));
1862 /* Return true if statement G has sub-statements. This is only true for
1863 High GIMPLE statements. */
1866 gimple_has_substatements (gimple
*g
)
1868 switch (gimple_code (g
))
1873 case GIMPLE_EH_FILTER
:
1874 case GIMPLE_EH_ELSE
:
1876 case GIMPLE_OMP_FOR
:
1877 case GIMPLE_OMP_MASTER
:
1878 case GIMPLE_OMP_MASKED
:
1879 case GIMPLE_OMP_TASKGROUP
:
1880 case GIMPLE_OMP_ORDERED
:
1881 case GIMPLE_OMP_SECTION
:
1882 case GIMPLE_OMP_PARALLEL
:
1883 case GIMPLE_OMP_TASK
:
1884 case GIMPLE_OMP_SCOPE
:
1885 case GIMPLE_OMP_SECTIONS
:
1886 case GIMPLE_OMP_SINGLE
:
1887 case GIMPLE_OMP_TARGET
:
1888 case GIMPLE_OMP_TEAMS
:
1889 case GIMPLE_OMP_CRITICAL
:
1890 case GIMPLE_WITH_CLEANUP_EXPR
:
1891 case GIMPLE_TRANSACTION
:
1900 /* Return the basic block holding statement G. */
1903 gimple_bb (const gimple
*g
)
1909 /* Return the lexical scope block holding statement G. */
1912 gimple_block (const gimple
*g
)
1914 return LOCATION_BLOCK (g
->location
);
1917 /* Forward declare. */
1918 inline void gimple_set_location (gimple
*, location_t
);
1920 /* Set BLOCK to be the lexical scope block holding statement G. */
1923 gimple_set_block (gimple
*g
, tree block
)
1925 gimple_set_location (g
, set_block (g
->location
, block
));
1928 /* Return location information for statement G. */
1931 gimple_location (const gimple
*g
)
1936 /* Return location information for statement G if g is not NULL.
1937 Otherwise, UNKNOWN_LOCATION is returned. */
1940 gimple_location_safe (const gimple
*g
)
1942 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1945 /* Set location information for statement G. */
1948 gimple_set_location (gimple
*g
, location_t location
)
1950 /* Copy the no-warning data to the statement location. */
1951 if (g
->location
!= UNKNOWN_LOCATION
)
1952 copy_warning (location
, g
->location
);
1953 g
->location
= location
;
1956 /* Return address of the location information for statement G. */
1959 gimple_location_ptr (gimple
*g
)
1961 return &g
->location
;
1965 /* Return true if G contains location information. */
1968 gimple_has_location (const gimple
*g
)
1970 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1974 /* Return non-artificial location information for statement G. */
1977 gimple_nonartificial_location (const gimple
*g
)
1979 location_t
*ploc
= NULL
;
1981 if (tree block
= gimple_block (g
))
1982 ploc
= block_nonartificial_location (block
);
1984 return ploc
? *ploc
: gimple_location (g
);
1988 /* Return the file name of the location of STMT. */
1991 gimple_filename (const gimple
*stmt
)
1993 return LOCATION_FILE (gimple_location (stmt
));
1997 /* Return the line number of the location of STMT. */
2000 gimple_lineno (const gimple
*stmt
)
2002 return LOCATION_LINE (gimple_location (stmt
));
2006 /* Determine whether SEQ is a singleton. */
2009 gimple_seq_singleton_p (gimple_seq seq
)
2011 return ((gimple_seq_first (seq
) != NULL
)
2012 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
2015 /* Return true if no warnings should be emitted for statement STMT. */
2018 gimple_no_warning_p (const gimple
*stmt
)
2020 return stmt
->no_warning
;
2023 /* Set the no_warning flag of STMT to NO_WARNING. */
2026 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
2028 stmt
->no_warning
= (unsigned) no_warning
;
2031 /* Set the visited status on statement STMT to VISITED_P.
2033 Please note that this 'visited' property of the gimple statement is
2034 supposed to be undefined at pass boundaries. This means that a
2035 given pass should not assume it contains any useful value when the
2036 pass starts and thus can set it to any value it sees fit.
2038 You can learn more about the visited property of the gimple
2039 statement by reading the comments of the 'visited' data member of
2044 gimple_set_visited (gimple
*stmt
, bool visited_p
)
2046 stmt
->visited
= (unsigned) visited_p
;
2050 /* Return the visited status for statement STMT.
2052 Please note that this 'visited' property of the gimple statement is
2053 supposed to be undefined at pass boundaries. This means that a
2054 given pass should not assume it contains any useful value when the
2055 pass starts and thus can set it to any value it sees fit.
2057 You can learn more about the visited property of the gimple
2058 statement by reading the comments of the 'visited' data member of
2062 gimple_visited_p (gimple
*stmt
)
2064 return stmt
->visited
;
2068 /* Set pass local flag PLF on statement STMT to VAL_P.
2070 Please note that this PLF property of the gimple statement is
2071 supposed to be undefined at pass boundaries. This means that a
2072 given pass should not assume it contains any useful value when the
2073 pass starts and thus can set it to any value it sees fit.
2075 You can learn more about the PLF property by reading the comment of
2076 the 'plf' data member of struct gimple_statement_structure. */
2079 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
2082 stmt
->plf
|= (unsigned int) plf
;
2084 stmt
->plf
&= ~((unsigned int) plf
);
2088 /* Return the value of pass local flag PLF on statement STMT.
2090 Please note that this 'plf' property of the gimple statement is
2091 supposed to be undefined at pass boundaries. This means that a
2092 given pass should not assume it contains any useful value when the
2093 pass starts and thus can set it to any value it sees fit.
2095 You can learn more about the plf property by reading the comment of
2096 the 'plf' data member of struct gimple_statement_structure. */
2099 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
2101 return stmt
->plf
& ((unsigned int) plf
);
2105 /* Set the UID of statement.
2107 Please note that this UID property is supposed to be undefined at
2108 pass boundaries. This means that a given pass should not assume it
2109 contains any useful value when the pass starts and thus can set it
2110 to any value it sees fit. */
2113 gimple_set_uid (gimple
*g
, unsigned uid
)
2119 /* Return the UID of statement.
2121 Please note that this UID property is supposed to be undefined at
2122 pass boundaries. This means that a given pass should not assume it
2123 contains any useful value when the pass starts and thus can set it
2124 to any value it sees fit. */
2127 gimple_uid (const gimple
*g
)
2133 /* Make statement G a singleton sequence. */
2136 gimple_init_singleton (gimple
*g
)
2143 /* Return true if GIMPLE statement G has register or memory operands. */
2146 gimple_has_ops (const gimple
*g
)
2148 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
2154 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
2156 return gimple_has_ops (gs
);
2162 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
2164 return gimple_has_ops (gs
);
2167 /* Return true if GIMPLE statement G has memory operands. */
2170 gimple_has_mem_ops (const gimple
*g
)
2172 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
2178 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
2180 return gimple_has_mem_ops (gs
);
2186 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
2188 return gimple_has_mem_ops (gs
);
2191 /* Return the set of USE operands for statement G. */
2193 inline struct use_optype_d
*
2194 gimple_use_ops (const gimple
*g
)
2196 const gimple_statement_with_ops
*ops_stmt
=
2197 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2200 return ops_stmt
->use_ops
;
2204 /* Set USE to be the set of USE operands for statement G. */
2207 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2209 gimple_statement_with_ops
*ops_stmt
=
2210 as_a
<gimple_statement_with_ops
*> (g
);
2211 ops_stmt
->use_ops
= use
;
2215 /* Return the single VUSE operand of the statement G. */
2218 gimple_vuse (const gimple
*g
)
2220 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2221 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2224 return mem_ops_stmt
->vuse
;
2227 /* Return the single VDEF operand of the statement G. */
2230 gimple_vdef (const gimple
*g
)
2232 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2233 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2236 return mem_ops_stmt
->vdef
;
2239 /* Return the single VUSE operand of the statement G. */
2242 gimple_vuse_ptr (gimple
*g
)
2244 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2245 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2248 return &mem_ops_stmt
->vuse
;
2251 /* Return the single VDEF operand of the statement G. */
2254 gimple_vdef_ptr (gimple
*g
)
2256 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2257 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2260 return &mem_ops_stmt
->vdef
;
2263 /* Set the single VUSE operand of the statement G. */
2266 gimple_set_vuse (gimple
*g
, tree vuse
)
2268 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2269 as_a
<gimple_statement_with_memory_ops
*> (g
);
2270 mem_ops_stmt
->vuse
= vuse
;
2273 /* Set the single VDEF operand of the statement G. */
2276 gimple_set_vdef (gimple
*g
, tree vdef
)
2278 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2279 as_a
<gimple_statement_with_memory_ops
*> (g
);
2280 mem_ops_stmt
->vdef
= vdef
;
2284 /* Return true if statement G has operands and the modified field has
2288 gimple_modified_p (const gimple
*g
)
2290 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2294 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2295 a MODIFIED field. */
2298 gimple_set_modified (gimple
*s
, bool modifiedp
)
2300 if (gimple_has_ops (s
))
2301 s
->modified
= (unsigned) modifiedp
;
2305 /* Return true if statement STMT contains volatile operands. */
2308 gimple_has_volatile_ops (const gimple
*stmt
)
2310 if (gimple_has_mem_ops (stmt
))
2311 return stmt
->has_volatile_ops
;
2317 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2320 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2322 if (gimple_has_mem_ops (stmt
))
2323 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2326 /* Return true if STMT is in a transaction. */
2329 gimple_in_transaction (const gimple
*stmt
)
2331 return bb_in_transaction (gimple_bb (stmt
));
2334 /* Return true if statement STMT may access memory. */
2337 gimple_references_memory_p (gimple
*stmt
)
2339 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2343 /* Return the subcode for OMP statement S. */
2346 gimple_omp_subcode (const gimple
*s
)
2348 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2349 && gimple_code (s
) <= GIMPLE_OMP_ORDERED
);
2353 /* Set the subcode for OMP statement S to SUBCODE. */
2356 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2358 /* We only have 16 bits for the subcode. Assert that we are not
2360 gcc_gimple_checking_assert (subcode
< (1 << 16));
2361 s
->subcode
= subcode
;
2364 /* Set the nowait flag on OMP_RETURN statement S. */
2367 gimple_omp_return_set_nowait (gimple
*s
)
2369 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2370 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2374 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2378 gimple_omp_return_nowait_p (const gimple
*g
)
2380 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2381 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2385 /* Set the LHS of OMP return. */
2388 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2390 gimple_statement_omp_return
*omp_return_stmt
=
2391 as_a
<gimple_statement_omp_return
*> (g
);
2392 omp_return_stmt
->val
= lhs
;
2396 /* Get the LHS of OMP return. */
2399 gimple_omp_return_lhs (const gimple
*g
)
2401 const gimple_statement_omp_return
*omp_return_stmt
=
2402 as_a
<const gimple_statement_omp_return
*> (g
);
2403 return omp_return_stmt
->val
;
2407 /* Return a pointer to the LHS of OMP return. */
2410 gimple_omp_return_lhs_ptr (gimple
*g
)
2412 gimple_statement_omp_return
*omp_return_stmt
=
2413 as_a
<gimple_statement_omp_return
*> (g
);
2414 return &omp_return_stmt
->val
;
2418 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2422 gimple_omp_section_last_p (const gimple
*g
)
2424 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2425 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2429 /* Set the GF_OMP_SECTION_LAST flag on G. */
2432 gimple_omp_section_set_last (gimple
*g
)
2434 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2435 g
->subcode
|= GF_OMP_SECTION_LAST
;
2439 /* Return true if OMP ordered construct is stand-alone
2440 (G has the GF_OMP_ORDERED_STANDALONE flag set). */
2443 gimple_omp_ordered_standalone_p (const gimple
*g
)
2445 GIMPLE_CHECK (g
, GIMPLE_OMP_ORDERED
);
2446 return (gimple_omp_subcode (g
) & GF_OMP_ORDERED_STANDALONE
) != 0;
2450 /* Set the GF_OMP_ORDERED_STANDALONE flag on G. */
2453 gimple_omp_ordered_standalone (gimple
*g
)
2455 GIMPLE_CHECK (g
, GIMPLE_OMP_ORDERED
);
2456 g
->subcode
|= GF_OMP_ORDERED_STANDALONE
;
2460 /* Return true if OMP parallel statement G has the
2461 GF_OMP_PARALLEL_COMBINED flag set. */
2464 gimple_omp_parallel_combined_p (const gimple
*g
)
2466 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2467 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2471 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2472 value of COMBINED_P. */
2475 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2477 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2479 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2481 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2485 /* Return true if OMP atomic load/store statement G has the
2486 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2489 gimple_omp_atomic_need_value_p (const gimple
*g
)
2491 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2492 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2493 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2497 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2500 gimple_omp_atomic_set_need_value (gimple
*g
)
2502 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2503 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2504 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2508 /* Return true if OMP atomic load/store statement G has the
2509 GF_OMP_ATOMIC_WEAK flag set. */
2512 gimple_omp_atomic_weak_p (const gimple
*g
)
2514 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2515 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2516 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_WEAK
) != 0;
2520 /* Set the GF_OMP_ATOMIC_WEAK flag on G. */
2523 gimple_omp_atomic_set_weak (gimple
*g
)
2525 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2526 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2527 g
->subcode
|= GF_OMP_ATOMIC_WEAK
;
2531 /* Return the memory order of the OMP atomic load/store statement G. */
2533 inline enum omp_memory_order
2534 gimple_omp_atomic_memory_order (const gimple
*g
)
2536 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2537 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2538 return (enum omp_memory_order
)
2539 (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_MEMORY_ORDER
);
2543 /* Set the memory order on G. */
2546 gimple_omp_atomic_set_memory_order (gimple
*g
, enum omp_memory_order mo
)
2548 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2549 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2550 g
->subcode
= ((g
->subcode
& ~GF_OMP_ATOMIC_MEMORY_ORDER
)
2551 | (mo
& GF_OMP_ATOMIC_MEMORY_ORDER
));
2555 /* Return the number of operands for statement GS. */
2558 gimple_num_ops (const gimple
*gs
)
2564 /* Set the number of operands for statement GS. */
2567 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2569 gs
->num_ops
= num_ops
;
2573 /* Return the array of operands for statement GS. */
2576 gimple_ops (gimple
*gs
)
2580 /* All the tuples have their operand vector at the very bottom
2581 of the structure. Note that those structures that do not
2582 have an operand vector have a zero offset. */
2583 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2584 gcc_gimple_checking_assert (off
!= 0);
2586 return (tree
*) ((char *) gs
+ off
);
2590 /* Return operand I for statement GS. */
2593 gimple_op (const gimple
*gs
, unsigned i
)
2595 if (gimple_has_ops (gs
))
2597 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2598 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2604 /* Return a pointer to operand I for statement GS. */
2607 gimple_op_ptr (gimple
*gs
, unsigned i
)
2609 if (gimple_has_ops (gs
))
2611 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2612 return gimple_ops (gs
) + i
;
2618 /* Set operand I of statement GS to OP. */
2621 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2623 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2625 /* Note. It may be tempting to assert that OP matches
2626 is_gimple_operand, but that would be wrong. Different tuples
2627 accept slightly different sets of tree operands. Each caller
2628 should perform its own validation. */
2629 gimple_ops (gs
)[i
] = op
;
2632 /* Return true if GS is a GIMPLE_ASSIGN. */
2635 is_gimple_assign (const gimple
*gs
)
2637 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2640 /* Determine if expression CODE is one of the valid expressions that can
2641 be used on the RHS of GIMPLE assignments. */
2643 inline enum gimple_rhs_class
2644 get_gimple_rhs_class (enum tree_code code
)
2646 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2649 /* Return the LHS of assignment statement GS. */
2652 gimple_assign_lhs (const gassign
*gs
)
2658 gimple_assign_lhs (const gimple
*gs
)
2660 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2661 return gimple_assign_lhs (ass
);
2665 /* Return a pointer to the LHS of assignment statement GS. */
2668 gimple_assign_lhs_ptr (gassign
*gs
)
2674 gimple_assign_lhs_ptr (gimple
*gs
)
2676 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2677 return gimple_assign_lhs_ptr (ass
);
2681 /* Set LHS to be the LHS operand of assignment statement GS. */
2684 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2688 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2689 SSA_NAME_DEF_STMT (lhs
) = gs
;
2693 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2695 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2696 gimple_assign_set_lhs (ass
, lhs
);
2700 /* Return the first operand on the RHS of assignment statement GS. */
2703 gimple_assign_rhs1 (const gassign
*gs
)
2709 gimple_assign_rhs1 (const gimple
*gs
)
2711 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2712 return gimple_assign_rhs1 (ass
);
2716 /* Return a pointer to the first operand on the RHS of assignment
2720 gimple_assign_rhs1_ptr (gassign
*gs
)
2726 gimple_assign_rhs1_ptr (gimple
*gs
)
2728 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2729 return gimple_assign_rhs1_ptr (ass
);
2732 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2735 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2741 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2743 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2744 gimple_assign_set_rhs1 (ass
, rhs
);
2748 /* Return the second operand on the RHS of assignment statement GS.
2749 If GS does not have two operands, NULL is returned instead. */
2752 gimple_assign_rhs2 (const gassign
*gs
)
2754 if (gimple_num_ops (gs
) >= 3)
2761 gimple_assign_rhs2 (const gimple
*gs
)
2763 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2764 return gimple_assign_rhs2 (ass
);
2768 /* Return a pointer to the second operand on the RHS of assignment
2772 gimple_assign_rhs2_ptr (gassign
*gs
)
2774 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2779 gimple_assign_rhs2_ptr (gimple
*gs
)
2781 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2782 return gimple_assign_rhs2_ptr (ass
);
2786 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2789 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2791 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2796 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2798 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2799 return gimple_assign_set_rhs2 (ass
, rhs
);
2802 /* Return the third operand on the RHS of assignment statement GS.
2803 If GS does not have two operands, NULL is returned instead. */
2806 gimple_assign_rhs3 (const gassign
*gs
)
2808 if (gimple_num_ops (gs
) >= 4)
2815 gimple_assign_rhs3 (const gimple
*gs
)
2817 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2818 return gimple_assign_rhs3 (ass
);
2821 /* Return a pointer to the third operand on the RHS of assignment
2825 gimple_assign_rhs3_ptr (gimple
*gs
)
2827 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2828 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2833 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2836 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2838 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2843 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2845 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2846 gimple_assign_set_rhs3 (ass
, rhs
);
2850 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2851 which expect to see only two operands. */
2854 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2857 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2860 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2861 which expect to see only one operands. */
2864 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2867 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2870 /* Returns true if GS is a nontemporal move. */
2873 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2875 return gs
->nontemporal_move
;
2878 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2881 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2883 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2884 gs
->nontemporal_move
= nontemporal
;
2888 /* Return the code of the expression computed on the rhs of assignment
2889 statement GS. In case that the RHS is a single object, returns the
2890 tree code of the object. */
2892 inline enum tree_code
2893 gimple_assign_rhs_code (const gassign
*gs
)
2895 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2896 /* While we initially set subcode to the TREE_CODE of the rhs for
2897 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2898 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2899 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2900 code
= TREE_CODE (gs
->op
[1]);
2905 inline enum tree_code
2906 gimple_assign_rhs_code (const gimple
*gs
)
2908 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2909 return gimple_assign_rhs_code (ass
);
2913 /* Set CODE to be the code for the expression computed on the RHS of
2917 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2919 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2924 /* Return the gimple rhs class of the code of the expression computed on
2925 the rhs of assignment statement GS.
2926 This will never return GIMPLE_INVALID_RHS. */
2928 inline enum gimple_rhs_class
2929 gimple_assign_rhs_class (const gimple
*gs
)
2931 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2934 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2935 there is no operator associated with the assignment itself.
2936 Unlike gimple_assign_copy_p, this predicate returns true for
2937 any RHS operand, including those that perform an operation
2938 and do not have the semantics of a copy, such as COND_EXPR. */
2941 gimple_assign_single_p (const gimple
*gs
)
2943 return (is_gimple_assign (gs
)
2944 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2947 /* Return true if GS performs a store to its lhs. */
2950 gimple_store_p (const gimple
*gs
)
2952 tree lhs
= gimple_get_lhs (gs
);
2953 return lhs
&& !is_gimple_reg (lhs
);
2956 /* Return true if S is a type-cast assignment. */
2959 gimple_assign_cast_p (const gimple
*s
)
2961 if (is_gimple_assign (s
))
2963 enum tree_code sc
= gimple_assign_rhs_code (s
);
2964 return CONVERT_EXPR_CODE_P (sc
)
2965 || sc
== VIEW_CONVERT_EXPR
2966 || sc
== FIX_TRUNC_EXPR
;
2972 /* Return true if S is a clobber statement. */
2975 gimple_clobber_p (const gimple
*s
)
2977 return gimple_assign_single_p (s
)
2978 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2981 /* Return true if S is a clobber statement. */
2984 gimple_clobber_p (const gimple
*s
, enum clobber_kind kind
)
2986 return gimple_clobber_p (s
)
2987 && CLOBBER_KIND (gimple_assign_rhs1 (s
)) == kind
;
2990 /* Return true if GS is a GIMPLE_CALL. */
2993 is_gimple_call (const gimple
*gs
)
2995 return gimple_code (gs
) == GIMPLE_CALL
;
2998 /* Return the LHS of call statement GS. */
3001 gimple_call_lhs (const gcall
*gs
)
3007 gimple_call_lhs (const gimple
*gs
)
3009 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3010 return gimple_call_lhs (gc
);
3014 /* Return a pointer to the LHS of call statement GS. */
3017 gimple_call_lhs_ptr (gcall
*gs
)
3023 gimple_call_lhs_ptr (gimple
*gs
)
3025 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3026 return gimple_call_lhs_ptr (gc
);
3030 /* Set LHS to be the LHS operand of call statement GS. */
3033 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
3036 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
3037 SSA_NAME_DEF_STMT (lhs
) = gs
;
3041 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
3043 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3044 gimple_call_set_lhs (gc
, lhs
);
3048 /* Return true if call GS calls an internal-only function, as enumerated
3052 gimple_call_internal_p (const gcall
*gs
)
3054 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
3058 gimple_call_internal_p (const gimple
*gs
)
3060 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3061 return gimple_call_internal_p (gc
);
3064 /* Return true if call GS is marked as nocf_check. */
3067 gimple_call_nocf_check_p (const gcall
*gs
)
3069 return (gs
->subcode
& GF_CALL_NOCF_CHECK
) != 0;
3072 /* Mark statement GS as nocf_check call. */
3075 gimple_call_set_nocf_check (gcall
*gs
, bool nocf_check
)
3078 gs
->subcode
|= GF_CALL_NOCF_CHECK
;
3080 gs
->subcode
&= ~GF_CALL_NOCF_CHECK
;
3083 /* Return the target of internal call GS. */
3085 inline enum internal_fn
3086 gimple_call_internal_fn (const gcall
*gs
)
3088 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
3089 return gs
->u
.internal_fn
;
3092 inline enum internal_fn
3093 gimple_call_internal_fn (const gimple
*gs
)
3095 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3096 return gimple_call_internal_fn (gc
);
3099 /* Return true, if this internal gimple call is unique. */
3102 gimple_call_internal_unique_p (const gcall
*gs
)
3104 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
3108 gimple_call_internal_unique_p (const gimple
*gs
)
3110 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3111 return gimple_call_internal_unique_p (gc
);
3114 /* Return true if GS is an internal function FN. */
3117 gimple_call_internal_p (const gimple
*gs
, internal_fn fn
)
3119 return (is_gimple_call (gs
)
3120 && gimple_call_internal_p (gs
)
3121 && gimple_call_internal_fn (gs
) == fn
);
3124 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3125 that could alter control flow. */
3128 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
3130 if (ctrl_altering_p
)
3131 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
3133 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
3137 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
3139 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
3140 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
3143 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3144 flag is set. Such call could not be a stmt in the middle of a bb. */
3147 gimple_call_ctrl_altering_p (const gcall
*gs
)
3149 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
3153 gimple_call_ctrl_altering_p (const gimple
*gs
)
3155 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3156 return gimple_call_ctrl_altering_p (gc
);
3160 /* Return the function type of the function called by GS. */
3163 gimple_call_fntype (const gcall
*gs
)
3165 if (gimple_call_internal_p (gs
))
3167 return gs
->u
.fntype
;
3171 gimple_call_fntype (const gimple
*gs
)
3173 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3174 return gimple_call_fntype (call_stmt
);
3177 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3180 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
3182 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
3183 call_stmt
->u
.fntype
= fntype
;
3187 /* Return the tree node representing the function called by call
3191 gimple_call_fn (const gcall
*gs
)
3197 gimple_call_fn (const gimple
*gs
)
3199 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3200 return gimple_call_fn (gc
);
3203 /* Return a pointer to the tree node representing the function called by call
3207 gimple_call_fn_ptr (gcall
*gs
)
3213 gimple_call_fn_ptr (gimple
*gs
)
3215 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3216 return gimple_call_fn_ptr (gc
);
3220 /* Set FN to be the function called by call statement GS. */
3223 gimple_call_set_fn (gcall
*gs
, tree fn
)
3225 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3230 /* Set FNDECL to be the function called by call statement GS. */
3233 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3235 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3236 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3237 build_pointer_type (TREE_TYPE (decl
)), decl
);
3241 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3243 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3244 gimple_call_set_fndecl (gc
, decl
);
3248 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3251 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3253 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3254 call_stmt
->u
.internal_fn
= fn
;
3258 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3259 Otherwise return NULL. This function is analogous to
3260 get_callee_fndecl in tree land. */
3263 gimple_call_fndecl (const gcall
*gs
)
3265 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3269 gimple_call_fndecl (const gimple
*gs
)
3271 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3272 return gimple_call_fndecl (gc
);
3276 /* Return the type returned by call statement GS. */
3279 gimple_call_return_type (const gcall
*gs
)
3281 tree type
= gimple_call_fntype (gs
);
3283 if (type
== NULL_TREE
)
3284 return TREE_TYPE (gimple_call_lhs (gs
));
3286 /* The type returned by a function is the type of its
3288 return TREE_TYPE (type
);
3292 /* Return the static chain for call statement GS. */
3295 gimple_call_chain (const gcall
*gs
)
3301 gimple_call_chain (const gimple
*gs
)
3303 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3304 return gimple_call_chain (gc
);
3308 /* Return a pointer to the static chain for call statement CALL_STMT. */
3311 gimple_call_chain_ptr (gcall
*call_stmt
)
3313 return &call_stmt
->op
[2];
3316 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3319 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3321 call_stmt
->op
[2] = chain
;
3325 /* Return the number of arguments used by call statement GS. */
3328 gimple_call_num_args (const gcall
*gs
)
3330 return gimple_num_ops (gs
) - 3;
3334 gimple_call_num_args (const gimple
*gs
)
3336 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3337 return gimple_call_num_args (gc
);
3341 /* Return the argument at position INDEX for call statement GS. */
3344 gimple_call_arg (const gcall
*gs
, unsigned index
)
3346 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3347 return gs
->op
[index
+ 3];
3351 gimple_call_arg (const gimple
*gs
, unsigned index
)
3353 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3354 return gimple_call_arg (gc
, index
);
3358 /* Return a pointer to the argument at position INDEX for call
3362 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3364 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3365 return &gs
->op
[index
+ 3];
3369 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3371 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3372 return gimple_call_arg_ptr (gc
, index
);
3376 /* Set ARG to be the argument at position INDEX for call statement GS. */
3379 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3381 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3382 gs
->op
[index
+ 3] = arg
;
3386 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3388 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3389 gimple_call_set_arg (gc
, index
, arg
);
3393 /* If TAIL_P is true, mark call statement S as being a tail call
3394 (i.e., a call just before the exit of a function). These calls are
3395 candidate for tail call optimization. */
3398 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3401 s
->subcode
|= GF_CALL_TAILCALL
;
3403 s
->subcode
&= ~GF_CALL_TAILCALL
;
3407 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3410 gimple_call_tail_p (const gcall
*s
)
3412 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3415 /* Mark (or clear) call statement S as requiring tail call optimization. */
3418 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3421 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3423 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3426 /* Return true if call statement has been marked as requiring
3427 tail call optimization. */
3430 gimple_call_must_tail_p (const gcall
*s
)
3432 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3435 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3436 slot optimization. This transformation uses the target of the call
3437 expansion as the return slot for calls that return in memory. */
3440 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3442 if (return_slot_opt_p
)
3443 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3445 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3449 /* Return true if S is marked for return slot optimization. */
3452 gimple_call_return_slot_opt_p (const gcall
*s
)
3454 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3458 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3459 thunk to the thunked-to function. */
3462 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3465 s
->subcode
|= GF_CALL_FROM_THUNK
;
3467 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3471 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3474 gimple_call_from_thunk_p (gcall
*s
)
3476 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3480 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3481 to operator new or delete created from a new or delete expression. */
3484 gimple_call_set_from_new_or_delete (gcall
*s
, bool from_new_or_delete_p
)
3486 if (from_new_or_delete_p
)
3487 s
->subcode
|= GF_CALL_FROM_NEW_OR_DELETE
;
3489 s
->subcode
&= ~GF_CALL_FROM_NEW_OR_DELETE
;
3493 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3494 from a new or delete expression. */
3497 gimple_call_from_new_or_delete (const gcall
*s
)
3499 return (s
->subcode
& GF_CALL_FROM_NEW_OR_DELETE
) != 0;
3503 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3504 argument pack in its argument list. */
3507 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3509 if (pass_arg_pack_p
)
3510 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3512 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3516 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3517 argument pack in its argument list. */
3520 gimple_call_va_arg_pack_p (const gcall
*s
)
3522 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3526 /* Return true if S is a noreturn call. */
3529 gimple_call_noreturn_p (const gcall
*s
)
3531 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3535 gimple_call_noreturn_p (const gimple
*s
)
3537 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3538 return gimple_call_noreturn_p (gc
);
3542 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3543 even if the called function can throw in other cases. */
3546 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3549 s
->subcode
|= GF_CALL_NOTHROW
;
3551 s
->subcode
&= ~GF_CALL_NOTHROW
;
3554 /* Return true if S is a nothrow call. */
3557 gimple_call_nothrow_p (gcall
*s
)
3559 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3562 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3563 is known to be emitted for VLA objects. Those are wrapped by
3564 stack_save/stack_restore calls and hence can't lead to unbounded
3565 stack growth even when they occur in loops. */
3568 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3571 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3573 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3576 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3579 gimple_call_alloca_for_var_p (gcall
*s
)
3581 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3585 gimple_call_alloca_for_var_p (gimple
*s
)
3587 const gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
3588 return (gc
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3591 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3592 pointers to nested function are descriptors instead of trampolines. */
3595 gimple_call_set_by_descriptor (gcall
*s
, bool by_descriptor_p
)
3597 if (by_descriptor_p
)
3598 s
->subcode
|= GF_CALL_BY_DESCRIPTOR
;
3600 s
->subcode
&= ~GF_CALL_BY_DESCRIPTOR
;
3603 /* Return true if S is a by-descriptor call. */
3606 gimple_call_by_descriptor_p (gcall
*s
)
3608 return (s
->subcode
& GF_CALL_BY_DESCRIPTOR
) != 0;
3611 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3614 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3616 dest_call
->subcode
= orig_call
->subcode
;
3620 /* Return a pointer to the points-to solution for the set of call-used
3621 variables of the call CALL_STMT. */
3623 inline struct pt_solution
*
3624 gimple_call_use_set (gcall
*call_stmt
)
3626 return &call_stmt
->call_used
;
3629 /* As above, but const. */
3631 inline const pt_solution
*
3632 gimple_call_use_set (const gcall
*call_stmt
)
3634 return &call_stmt
->call_used
;
3637 /* Return a pointer to the points-to solution for the set of call-used
3638 variables of the call CALL_STMT. */
3640 inline struct pt_solution
*
3641 gimple_call_clobber_set (gcall
*call_stmt
)
3643 return &call_stmt
->call_clobbered
;
3646 /* As above, but const. */
3648 inline const pt_solution
*
3649 gimple_call_clobber_set (const gcall
*call_stmt
)
3651 return &call_stmt
->call_clobbered
;
3655 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3659 gimple_has_lhs (const gimple
*stmt
)
3661 if (is_gimple_assign (stmt
))
3663 if (const gcall
*call
= dyn_cast
<const gcall
*> (stmt
))
3664 return gimple_call_lhs (call
) != NULL_TREE
;
3669 /* Return the code of the predicate computed by conditional statement GS. */
3671 inline enum tree_code
3672 gimple_cond_code (const gcond
*gs
)
3674 return (enum tree_code
) gs
->subcode
;
3677 inline enum tree_code
3678 gimple_cond_code (const gimple
*gs
)
3680 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3681 return gimple_cond_code (gc
);
3685 /* Set CODE to be the predicate code for the conditional statement GS. */
3688 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3694 /* Return the LHS of the predicate computed by conditional statement GS. */
3697 gimple_cond_lhs (const gcond
*gs
)
3703 gimple_cond_lhs (const gimple
*gs
)
3705 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3706 return gimple_cond_lhs (gc
);
3709 /* Return the pointer to the LHS of the predicate computed by conditional
3713 gimple_cond_lhs_ptr (gcond
*gs
)
3718 /* Set LHS to be the LHS operand of the predicate computed by
3719 conditional statement GS. */
3722 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3728 /* Return the RHS operand of the predicate computed by conditional GS. */
3731 gimple_cond_rhs (const gcond
*gs
)
3737 gimple_cond_rhs (const gimple
*gs
)
3739 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3740 return gimple_cond_rhs (gc
);
3743 /* Return the pointer to the RHS operand of the predicate computed by
3747 gimple_cond_rhs_ptr (gcond
*gs
)
3753 /* Set RHS to be the RHS operand of the predicate computed by
3754 conditional statement GS. */
3757 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3763 /* Return the label used by conditional statement GS when its
3764 predicate evaluates to true. */
3767 gimple_cond_true_label (const gcond
*gs
)
3773 /* Set LABEL to be the label used by conditional statement GS when its
3774 predicate evaluates to true. */
3777 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3783 /* Set LABEL to be the label used by conditional statement GS when its
3784 predicate evaluates to false. */
3787 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3793 /* Return the label used by conditional statement GS when its
3794 predicate evaluates to false. */
3797 gimple_cond_false_label (const gcond
*gs
)
3803 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3806 gimple_cond_make_false (gcond
*gs
)
3808 gimple_cond_set_lhs (gs
, boolean_false_node
);
3809 gimple_cond_set_rhs (gs
, boolean_false_node
);
3810 gs
->subcode
= NE_EXPR
;
3814 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3817 gimple_cond_make_true (gcond
*gs
)
3819 gimple_cond_set_lhs (gs
, boolean_true_node
);
3820 gimple_cond_set_rhs (gs
, boolean_false_node
);
3821 gs
->subcode
= NE_EXPR
;
3824 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3825 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3828 gimple_cond_true_p (const gcond
*gs
)
3830 tree lhs
= gimple_cond_lhs (gs
);
3831 tree rhs
= gimple_cond_rhs (gs
);
3832 enum tree_code code
= gimple_cond_code (gs
);
3834 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3837 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3840 if (code
== NE_EXPR
&& lhs
!= rhs
)
3843 if (code
== EQ_EXPR
&& lhs
== rhs
)
3849 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3850 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3853 gimple_cond_false_p (const gcond
*gs
)
3855 tree lhs
= gimple_cond_lhs (gs
);
3856 tree rhs
= gimple_cond_rhs (gs
);
3857 enum tree_code code
= gimple_cond_code (gs
);
3859 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3862 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3865 if (code
== NE_EXPR
&& lhs
== rhs
)
3868 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3874 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3877 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3880 gimple_cond_set_code (stmt
, code
);
3881 gimple_cond_set_lhs (stmt
, lhs
);
3882 gimple_cond_set_rhs (stmt
, rhs
);
3886 /* Return the tree code for the expression computed by STMT. This is
3887 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3888 GIMPLE_CALL, return CALL_EXPR as the expression code for
3889 consistency. This is useful when the caller needs to deal with the
3890 three kinds of computation that GIMPLE supports. */
3892 inline enum tree_code
3893 gimple_expr_code (const gimple
*stmt
)
3895 if (const gassign
*ass
= dyn_cast
<const gassign
*> (stmt
))
3896 return gimple_assign_rhs_code (ass
);
3897 if (const gcond
*cond
= dyn_cast
<const gcond
*> (stmt
))
3898 return gimple_cond_code (cond
);
3901 gcc_gimple_checking_assert (gimple_code (stmt
) == GIMPLE_CALL
);
3907 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3910 gimple_label_label (const glabel
*gs
)
3916 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3920 gimple_label_set_label (glabel
*gs
, tree label
)
3926 /* Return the destination of the unconditional jump GS. */
3929 gimple_goto_dest (const gimple
*gs
)
3931 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3932 return gimple_op (gs
, 0);
3936 /* Set DEST to be the destination of the unconditonal jump GS. */
3939 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3945 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3948 gimple_bind_vars (const gbind
*bind_stmt
)
3950 return bind_stmt
->vars
;
3954 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3958 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3960 bind_stmt
->vars
= vars
;
3964 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3968 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3970 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3975 gimple_bind_body_ptr (gbind
*bind_stmt
)
3977 return &bind_stmt
->body
;
3980 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3983 gimple_bind_body (const gbind
*gs
)
3985 return *gimple_bind_body_ptr (const_cast <gbind
*> (gs
));
3989 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3993 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3995 bind_stmt
->body
= seq
;
3999 /* Append a statement to the end of a GIMPLE_BIND's body. */
4002 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
4004 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
4008 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
4011 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
4013 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
4017 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
4018 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
4021 gimple_bind_block (const gbind
*bind_stmt
)
4023 return bind_stmt
->block
;
4027 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
4031 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
4033 gcc_gimple_checking_assert (block
== NULL_TREE
4034 || TREE_CODE (block
) == BLOCK
);
4035 bind_stmt
->block
= block
;
4039 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
4042 gimple_asm_ninputs (const gasm
*asm_stmt
)
4044 return asm_stmt
->ni
;
4048 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
4051 gimple_asm_noutputs (const gasm
*asm_stmt
)
4053 return asm_stmt
->no
;
4057 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
4060 gimple_asm_nclobbers (const gasm
*asm_stmt
)
4062 return asm_stmt
->nc
;
4065 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
4068 gimple_asm_nlabels (const gasm
*asm_stmt
)
4070 return asm_stmt
->nl
;
4073 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
4076 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
4078 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
4079 return asm_stmt
->op
[index
+ asm_stmt
->no
];
4082 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
4085 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
4087 gcc_gimple_checking_assert (index
< asm_stmt
->ni
4088 && TREE_CODE (in_op
) == TREE_LIST
);
4089 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
4093 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
4096 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
4098 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
4099 return asm_stmt
->op
[index
];
4102 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4105 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
4107 gcc_gimple_checking_assert (index
< asm_stmt
->no
4108 && TREE_CODE (out_op
) == TREE_LIST
);
4109 asm_stmt
->op
[index
] = out_op
;
4113 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4116 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
4118 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
4119 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
4123 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4126 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
4128 gcc_gimple_checking_assert (index
< asm_stmt
->nc
4129 && TREE_CODE (clobber_op
) == TREE_LIST
);
4130 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
4133 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4136 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
4138 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
4139 return asm_stmt
->op
[index
+ asm_stmt
->no
+ asm_stmt
->ni
+ asm_stmt
->nc
];
4142 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4145 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
4147 gcc_gimple_checking_assert (index
< asm_stmt
->nl
4148 && TREE_CODE (label_op
) == TREE_LIST
);
4149 asm_stmt
->op
[index
+ asm_stmt
->no
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
4152 /* Return the string representing the assembly instruction in
4153 GIMPLE_ASM ASM_STMT. */
4156 gimple_asm_string (const gasm
*asm_stmt
)
4158 return asm_stmt
->string
;
4162 /* Return true if ASM_STMT is marked volatile. */
4165 gimple_asm_volatile_p (const gasm
*asm_stmt
)
4167 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
4171 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4174 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
4177 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
4179 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
4183 /* Return true if ASM_STMT is marked inline. */
4186 gimple_asm_inline_p (const gasm
*asm_stmt
)
4188 return (asm_stmt
->subcode
& GF_ASM_INLINE
) != 0;
4192 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4195 gimple_asm_set_inline (gasm
*asm_stmt
, bool inline_p
)
4198 asm_stmt
->subcode
|= GF_ASM_INLINE
;
4200 asm_stmt
->subcode
&= ~GF_ASM_INLINE
;
4204 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4207 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
4210 asm_stmt
->subcode
|= GF_ASM_INPUT
;
4212 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
4216 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4219 gimple_asm_input_p (const gasm
*asm_stmt
)
4221 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
4225 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4228 gimple_catch_types (const gcatch
*catch_stmt
)
4230 return catch_stmt
->types
;
4234 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4237 gimple_catch_types_ptr (gcatch
*catch_stmt
)
4239 return &catch_stmt
->types
;
4243 /* Return a pointer to the GIMPLE sequence representing the body of
4244 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4247 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
4249 return &catch_stmt
->handler
;
4253 /* Return the GIMPLE sequence representing the body of the handler of
4254 GIMPLE_CATCH statement CATCH_STMT. */
4257 gimple_catch_handler (const gcatch
*catch_stmt
)
4259 return *gimple_catch_handler_ptr (const_cast <gcatch
*> (catch_stmt
));
4263 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4266 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
4268 catch_stmt
->types
= t
;
4272 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4275 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
4277 catch_stmt
->handler
= handler
;
4281 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4284 gimple_eh_filter_types (const gimple
*gs
)
4286 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
4287 return eh_filter_stmt
->types
;
4291 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4295 gimple_eh_filter_types_ptr (gimple
*gs
)
4297 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4298 return &eh_filter_stmt
->types
;
4302 /* Return a pointer to the sequence of statement to execute when
4303 GIMPLE_EH_FILTER statement fails. */
4306 gimple_eh_filter_failure_ptr (gimple
*gs
)
4308 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4309 return &eh_filter_stmt
->failure
;
4313 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4317 gimple_eh_filter_failure (const gimple
*gs
)
4319 return *gimple_eh_filter_failure_ptr (const_cast <gimple
*> (gs
));
4323 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4327 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4329 eh_filter_stmt
->types
= types
;
4333 /* Set FAILURE to be the sequence of statements to execute on failure
4334 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4337 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4340 eh_filter_stmt
->failure
= failure
;
4343 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4346 gimple_eh_must_not_throw_fndecl (const geh_mnt
*eh_mnt_stmt
)
4348 return eh_mnt_stmt
->fndecl
;
4351 /* Set the function decl to be called by GS to DECL. */
4354 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4357 eh_mnt_stmt
->fndecl
= decl
;
4360 /* GIMPLE_EH_ELSE accessors. */
4363 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4365 return &eh_else_stmt
->n_body
;
4369 gimple_eh_else_n_body (const geh_else
*eh_else_stmt
)
4371 return *gimple_eh_else_n_body_ptr (const_cast <geh_else
*> (eh_else_stmt
));
4375 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4377 return &eh_else_stmt
->e_body
;
4381 gimple_eh_else_e_body (const geh_else
*eh_else_stmt
)
4383 return *gimple_eh_else_e_body_ptr (const_cast <geh_else
*> (eh_else_stmt
));
4387 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4389 eh_else_stmt
->n_body
= seq
;
4393 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4395 eh_else_stmt
->e_body
= seq
;
4398 /* GIMPLE_TRY accessors. */
4400 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4401 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4403 inline enum gimple_try_flags
4404 gimple_try_kind (const gimple
*gs
)
4406 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4407 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4411 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4414 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4416 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4417 || kind
== GIMPLE_TRY_FINALLY
);
4418 if (gimple_try_kind (gs
) != kind
)
4419 gs
->subcode
= (unsigned int) kind
;
4423 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4426 gimple_try_catch_is_cleanup (const gimple
*gs
)
4428 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4429 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4433 /* Return a pointer to the sequence of statements used as the
4434 body for GIMPLE_TRY GS. */
4437 gimple_try_eval_ptr (gimple
*gs
)
4439 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4440 return &try_stmt
->eval
;
4444 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4447 gimple_try_eval (const gimple
*gs
)
4449 return *gimple_try_eval_ptr (const_cast <gimple
*> (gs
));
4453 /* Return a pointer to the sequence of statements used as the cleanup body for
4457 gimple_try_cleanup_ptr (gimple
*gs
)
4459 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4460 return &try_stmt
->cleanup
;
4464 /* Return the sequence of statements used as the cleanup body for
4468 gimple_try_cleanup (const gimple
*gs
)
4470 return *gimple_try_cleanup_ptr (const_cast <gimple
*> (gs
));
4474 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4477 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4479 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4480 if (catch_is_cleanup
)
4481 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4483 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4487 /* Set EVAL to be the sequence of statements to use as the body for
4488 GIMPLE_TRY TRY_STMT. */
4491 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4493 try_stmt
->eval
= eval
;
4497 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4498 body for GIMPLE_TRY TRY_STMT. */
4501 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4503 try_stmt
->cleanup
= cleanup
;
4507 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4510 gimple_wce_cleanup_ptr (gimple
*gs
)
4512 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4513 return &wce_stmt
->cleanup
;
4517 /* Return the cleanup sequence for cleanup statement GS. */
4520 gimple_wce_cleanup (gimple
*gs
)
4522 return *gimple_wce_cleanup_ptr (gs
);
4526 /* Set CLEANUP to be the cleanup sequence for GS. */
4529 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4531 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4532 wce_stmt
->cleanup
= cleanup
;
4536 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4539 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4541 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4542 return gs
->subcode
!= 0;
4546 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4549 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4551 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4552 gs
->subcode
= (unsigned int) eh_only_p
;
4556 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4559 gimple_phi_capacity (const gimple
*gs
)
4561 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4562 return phi_stmt
->capacity
;
4566 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4567 be exactly the number of incoming edges for the basic block holding
4571 gimple_phi_num_args (const gimple
*gs
)
4573 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4574 return phi_stmt
->nargs
;
4578 /* Return the SSA name created by GIMPLE_PHI GS. */
4581 gimple_phi_result (const gphi
*gs
)
4587 gimple_phi_result (const gimple
*gs
)
4589 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4590 return gimple_phi_result (phi_stmt
);
4593 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4596 gimple_phi_result_ptr (gphi
*gs
)
4602 gimple_phi_result_ptr (gimple
*gs
)
4604 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4605 return gimple_phi_result_ptr (phi_stmt
);
4608 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4611 gimple_phi_set_result (gphi
*phi
, tree result
)
4613 phi
->result
= result
;
4614 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4615 SSA_NAME_DEF_STMT (result
) = phi
;
4619 /* Return the PHI argument corresponding to incoming edge INDEX for
4622 inline struct phi_arg_d
*
4623 gimple_phi_arg (gphi
*gs
, unsigned index
)
4625 gcc_gimple_checking_assert (index
< gs
->nargs
);
4626 return &(gs
->args
[index
]);
4629 inline const phi_arg_d
*
4630 gimple_phi_arg (const gphi
*gs
, unsigned index
)
4632 gcc_gimple_checking_assert (index
< gs
->nargs
);
4633 return &(gs
->args
[index
]);
4636 inline struct phi_arg_d
*
4637 gimple_phi_arg (gimple
*gs
, unsigned index
)
4639 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4640 return gimple_phi_arg (phi_stmt
, index
);
4643 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4644 for GIMPLE_PHI PHI. */
4647 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4649 gcc_gimple_checking_assert (index
< phi
->nargs
);
4650 phi
->args
[index
] = *phiarg
;
4653 /* Return the PHI nodes for basic block BB, or NULL if there are no
4657 phi_nodes (const_basic_block bb
)
4659 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4660 return bb
->il
.gimple
.phi_nodes
;
4663 /* Return a pointer to the PHI nodes for basic block BB. */
4666 phi_nodes_ptr (basic_block bb
)
4668 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4669 return &bb
->il
.gimple
.phi_nodes
;
4672 /* Return the tree operand for argument I of PHI node GS. */
4675 gimple_phi_arg_def (const gphi
*gs
, size_t index
)
4677 return gimple_phi_arg (gs
, index
)->def
;
4681 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4683 return gimple_phi_arg (gs
, index
)->def
;
4687 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4690 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4692 return &gimple_phi_arg (phi
, index
)->def
;
4695 /* Return the edge associated with argument I of phi node PHI. */
4698 gimple_phi_arg_edge (const gphi
*phi
, size_t i
)
4700 return EDGE_PRED (gimple_bb (phi
), i
);
4703 /* Return the source location of gimple argument I of phi node PHI. */
4706 gimple_phi_arg_location (const gphi
*phi
, size_t i
)
4708 return gimple_phi_arg (phi
, i
)->locus
;
4711 /* Return the source location of the argument on edge E of phi node PHI. */
4714 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4716 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4719 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4722 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, location_t loc
)
4724 gimple_phi_arg (phi
, i
)->locus
= loc
;
4727 /* Return address of source location of gimple argument I of phi node PHI. */
4730 gimple_phi_arg_location_ptr (gphi
*phi
, size_t i
)
4732 return &gimple_phi_arg (phi
, i
)->locus
;
4735 /* Return TRUE if argument I of phi node PHI has a location record. */
4738 gimple_phi_arg_has_location (const gphi
*phi
, size_t i
)
4740 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4743 /* Return the number of arguments that can be accessed by gimple_arg. */
4746 gimple_num_args (const gimple
*gs
)
4748 if (auto phi
= dyn_cast
<const gphi
*> (gs
))
4749 return gimple_phi_num_args (phi
);
4750 if (auto call
= dyn_cast
<const gcall
*> (gs
))
4751 return gimple_call_num_args (call
);
4752 return gimple_num_ops (as_a
<const gassign
*> (gs
)) - 1;
4755 /* GS must be an assignment, a call, or a PHI.
4756 If it's an assignment, return rhs operand I.
4757 If it's a call, return function argument I.
4758 If it's a PHI, return the value of PHI argument I. */
4761 gimple_arg (const gimple
*gs
, unsigned int i
)
4763 if (auto phi
= dyn_cast
<const gphi
*> (gs
))
4764 return gimple_phi_arg_def (phi
, i
);
4765 if (auto call
= dyn_cast
<const gcall
*> (gs
))
4766 return gimple_call_arg (call
, i
);
4767 return gimple_op (as_a
<const gassign
*> (gs
), i
+ 1);
4770 /* Return a pointer to gimple_arg (GS, I). */
4773 gimple_arg_ptr (gimple
*gs
, unsigned int i
)
4775 if (auto phi
= dyn_cast
<gphi
*> (gs
))
4776 return gimple_phi_arg_def_ptr (phi
, i
);
4777 if (auto call
= dyn_cast
<gcall
*> (gs
))
4778 return gimple_call_arg_ptr (call
, i
);
4779 return gimple_op_ptr (as_a
<gassign
*> (gs
), i
+ 1);
4782 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4785 gimple_resx_region (const gresx
*resx_stmt
)
4787 return resx_stmt
->region
;
4790 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4793 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4795 resx_stmt
->region
= region
;
4798 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4801 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4803 return eh_dispatch_stmt
->region
;
4806 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4807 EH_DISPATCH_STMT. */
4810 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4812 eh_dispatch_stmt
->region
= region
;
4815 /* Return the number of labels associated with the switch statement GS. */
4818 gimple_switch_num_labels (const gswitch
*gs
)
4821 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4822 num_ops
= gimple_num_ops (gs
);
4823 gcc_gimple_checking_assert (num_ops
> 1);
4828 /* Set NLABELS to be the number of labels for the switch statement GS. */
4831 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4833 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4834 gimple_set_num_ops (g
, nlabels
+ 1);
4838 /* Return the index variable used by the switch statement GS. */
4841 gimple_switch_index (const gswitch
*gs
)
4847 /* Return a pointer to the index variable for the switch statement GS. */
4850 gimple_switch_index_ptr (gswitch
*gs
)
4856 /* Set INDEX to be the index variable for switch statement GS. */
4859 gimple_switch_set_index (gswitch
*gs
, tree index
)
4861 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4866 /* Return the label numbered INDEX. The default label is 0, followed by any
4867 labels in a switch statement. */
4870 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4872 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4873 return gs
->op
[index
+ 1];
4876 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4879 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4881 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4882 && (label
== NULL_TREE
4883 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4884 gs
->op
[index
+ 1] = label
;
4887 /* Return the default label for a switch statement. */
4890 gimple_switch_default_label (const gswitch
*gs
)
4892 tree label
= gimple_switch_label (gs
, 0);
4893 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4897 /* Set the default label for a switch statement. */
4900 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4902 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4903 gimple_switch_set_label (gs
, 0, label
);
4906 /* Return true if GS is a GIMPLE_DEBUG statement. */
4909 is_gimple_debug (const gimple
*gs
)
4911 return gimple_code (gs
) == GIMPLE_DEBUG
;
4915 /* Return the first nondebug statement in GIMPLE sequence S. */
4918 gimple_seq_first_nondebug_stmt (gimple_seq s
)
4920 gimple_seq_node n
= gimple_seq_first (s
);
4921 while (n
&& is_gimple_debug (n
))
4927 /* Return the last nondebug statement in GIMPLE sequence S. */
4930 gimple_seq_last_nondebug_stmt (gimple_seq s
)
4933 for (n
= gimple_seq_last (s
);
4934 n
&& is_gimple_debug (n
);
4942 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4945 gimple_debug_bind_p (const gimple
*s
)
4947 if (is_gimple_debug (s
))
4948 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4953 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4956 gimple_debug_bind_get_var (const gimple
*dbg
)
4958 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4959 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4960 return gimple_op (dbg
, 0);
4963 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4967 gimple_debug_bind_get_value (const gimple
*dbg
)
4969 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4970 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4971 return gimple_op (dbg
, 1);
4974 /* Return a pointer to the value bound to the variable in a
4975 GIMPLE_DEBUG bind statement. */
4978 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4980 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4981 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4982 return gimple_op_ptr (dbg
, 1);
4985 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4988 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4990 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4991 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4992 gimple_set_op (dbg
, 0, var
);
4995 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4999 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
5001 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5002 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
5003 gimple_set_op (dbg
, 1, value
);
5006 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
5008 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
5010 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
5014 gimple_debug_bind_reset_value (gimple
*dbg
)
5016 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5017 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
5018 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
5021 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
5025 gimple_debug_bind_has_value_p (gimple
*dbg
)
5027 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5028 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
5029 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
5032 #undef GIMPLE_DEBUG_BIND_NOVALUE
5034 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
5037 gimple_debug_source_bind_p (const gimple
*s
)
5039 if (is_gimple_debug (s
))
5040 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
5045 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
5048 gimple_debug_source_bind_get_var (const gimple
*dbg
)
5050 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5051 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
5052 return gimple_op (dbg
, 0);
5055 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
5059 gimple_debug_source_bind_get_value (const gimple
*dbg
)
5061 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5062 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
5063 return gimple_op (dbg
, 1);
5066 /* Return a pointer to the value bound to the variable in a
5067 GIMPLE_DEBUG source bind statement. */
5070 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
5072 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5073 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
5074 return gimple_op_ptr (dbg
, 1);
5077 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
5080 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
5082 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5083 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
5084 gimple_set_op (dbg
, 0, var
);
5087 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
5091 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
5093 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
5094 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
5095 gimple_set_op (dbg
, 1, value
);
5098 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
5101 gimple_debug_begin_stmt_p (const gimple
*s
)
5103 if (is_gimple_debug (s
))
5104 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
;
5109 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
5112 gimple_debug_inline_entry_p (const gimple
*s
)
5114 if (is_gimple_debug (s
))
5115 return s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
5120 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
5123 gimple_debug_nonbind_marker_p (const gimple
*s
)
5125 if (is_gimple_debug (s
))
5126 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
5127 || s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
5132 /* Return the line number for EXPR, or return -1 if we have no line
5133 number information for it. */
5135 get_lineno (const gimple
*stmt
)
5142 loc
= gimple_location (stmt
);
5143 if (loc
== UNKNOWN_LOCATION
)
5146 return LOCATION_LINE (loc
);
5149 /* Return a pointer to the body for the OMP statement GS. */
5152 gimple_omp_body_ptr (gimple
*gs
)
5154 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
5157 /* Return the body for the OMP statement GS. */
5160 gimple_omp_body (const gimple
*gs
)
5162 return *gimple_omp_body_ptr (const_cast <gimple
*> (gs
));
5165 /* Set BODY to be the body for the OMP statement GS. */
5168 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
5170 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
5174 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5177 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
5179 return crit_stmt
->name
;
5183 /* Return a pointer to the name associated with OMP critical statement
5187 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
5189 return &crit_stmt
->name
;
5193 /* Set NAME to be the name associated with OMP critical statement
5197 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
5199 crit_stmt
->name
= name
;
5203 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5206 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
5208 return crit_stmt
->clauses
;
5212 /* Return a pointer to the clauses associated with OMP critical statement
5216 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
5218 return &crit_stmt
->clauses
;
5222 /* Set CLAUSES to be the clauses associated with OMP critical statement
5226 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
5228 crit_stmt
->clauses
= clauses
;
5232 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5235 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
5237 return ord_stmt
->clauses
;
5241 /* Return a pointer to the clauses associated with OMP ordered statement
5245 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
5247 return &ord_stmt
->clauses
;
5251 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5255 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
5257 ord_stmt
->clauses
= clauses
;
5261 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5264 gimple_omp_scan_clauses (const gomp_scan
*scan_stmt
)
5266 return scan_stmt
->clauses
;
5270 /* Return a pointer to the clauses associated with OMP scan statement
5274 gimple_omp_scan_clauses_ptr (gomp_scan
*scan_stmt
)
5276 return &scan_stmt
->clauses
;
5280 /* Set CLAUSES to be the clauses associated with OMP scan statement
5284 gimple_omp_scan_set_clauses (gomp_scan
*scan_stmt
, tree clauses
)
5286 scan_stmt
->clauses
= clauses
;
5290 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5293 gimple_omp_taskgroup_clauses (const gimple
*gs
)
5295 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5297 static_cast <const gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5301 /* Return a pointer to the clauses associated with OMP taskgroup statement
5305 gimple_omp_taskgroup_clauses_ptr (gimple
*gs
)
5307 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5308 return &static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5312 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5316 gimple_omp_taskgroup_set_clauses (gimple
*gs
, tree clauses
)
5318 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5319 static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
5324 /* Return the clauses associated with OMP_MASKED statement GS. */
5327 gimple_omp_masked_clauses (const gimple
*gs
)
5329 GIMPLE_CHECK (gs
, GIMPLE_OMP_MASKED
);
5331 static_cast <const gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5335 /* Return a pointer to the clauses associated with OMP masked statement
5339 gimple_omp_masked_clauses_ptr (gimple
*gs
)
5341 GIMPLE_CHECK (gs
, GIMPLE_OMP_MASKED
);
5342 return &static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5346 /* Set CLAUSES to be the clauses associated with OMP masked statement
5350 gimple_omp_masked_set_clauses (gimple
*gs
, tree clauses
)
5352 GIMPLE_CHECK (gs
, GIMPLE_OMP_MASKED
);
5353 static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
5358 /* Return the clauses associated with OMP_SCOPE statement GS. */
5361 gimple_omp_scope_clauses (const gimple
*gs
)
5363 GIMPLE_CHECK (gs
, GIMPLE_OMP_SCOPE
);
5365 static_cast <const gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5369 /* Return a pointer to the clauses associated with OMP scope statement
5373 gimple_omp_scope_clauses_ptr (gimple
*gs
)
5375 GIMPLE_CHECK (gs
, GIMPLE_OMP_SCOPE
);
5376 return &static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5380 /* Set CLAUSES to be the clauses associated with OMP scope statement
5384 gimple_omp_scope_set_clauses (gimple
*gs
, tree clauses
)
5386 GIMPLE_CHECK (gs
, GIMPLE_OMP_SCOPE
);
5387 static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
5392 /* Return the kind of the OMP_FOR statemement G. */
5395 gimple_omp_for_kind (const gimple
*g
)
5397 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5398 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
5402 /* Set the kind of the OMP_FOR statement G. */
5405 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
5407 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
5408 | (kind
& GF_OMP_FOR_KIND_MASK
);
5412 /* Return true if OMP_FOR statement G has the
5413 GF_OMP_FOR_COMBINED flag set. */
5416 gimple_omp_for_combined_p (const gimple
*g
)
5418 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5419 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
5423 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5424 the boolean value of COMBINED_P. */
5427 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
5430 g
->subcode
|= GF_OMP_FOR_COMBINED
;
5432 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
5436 /* Return true if the OMP_FOR statement G has the
5437 GF_OMP_FOR_COMBINED_INTO flag set. */
5440 gimple_omp_for_combined_into_p (const gimple
*g
)
5442 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5443 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
5447 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5448 on the boolean value of COMBINED_P. */
5451 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
5454 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
5456 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
5460 /* Return the clauses associated with the OMP_FOR statement GS. */
5463 gimple_omp_for_clauses (const gimple
*gs
)
5465 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5466 return omp_for_stmt
->clauses
;
5470 /* Return a pointer to the clauses associated with the OMP_FOR statement
5474 gimple_omp_for_clauses_ptr (gimple
*gs
)
5476 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5477 return &omp_for_stmt
->clauses
;
5481 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5485 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
5487 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5488 omp_for_stmt
->clauses
= clauses
;
5492 /* Get the collapse count of the OMP_FOR statement GS. */
5495 gimple_omp_for_collapse (const gimple
*gs
)
5497 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5498 return omp_for_stmt
->collapse
;
5502 /* Return the condition code associated with the OMP_FOR statement GS. */
5504 inline enum tree_code
5505 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
5507 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5508 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5509 return omp_for_stmt
->iter
[i
].cond
;
5513 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5516 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
5518 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5519 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5520 && i
< omp_for_stmt
->collapse
);
5521 omp_for_stmt
->iter
[i
].cond
= cond
;
5525 /* Return the index variable for the OMP_FOR statement GS. */
5528 gimple_omp_for_index (const gimple
*gs
, size_t i
)
5530 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5531 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5532 return omp_for_stmt
->iter
[i
].index
;
5536 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5539 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
5541 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5542 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5543 return &omp_for_stmt
->iter
[i
].index
;
5547 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5550 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
5552 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5553 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5554 omp_for_stmt
->iter
[i
].index
= index
;
5558 /* Return the initial value for the OMP_FOR statement GS. */
5561 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
5563 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5564 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5565 return omp_for_stmt
->iter
[i
].initial
;
5569 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5572 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
5574 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5575 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5576 return &omp_for_stmt
->iter
[i
].initial
;
5580 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5583 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5585 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5586 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5587 omp_for_stmt
->iter
[i
].initial
= initial
;
5591 /* Return the final value for the OMP_FOR statement GS. */
5594 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5596 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5597 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5598 return omp_for_stmt
->iter
[i
].final
;
5602 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5605 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5607 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5608 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5609 return &omp_for_stmt
->iter
[i
].final
;
5613 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5616 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5618 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5619 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5620 omp_for_stmt
->iter
[i
].final
= final
;
5624 /* Return the increment value for the OMP_FOR statement GS. */
5627 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5629 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5630 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5631 return omp_for_stmt
->iter
[i
].incr
;
5635 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5638 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5640 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5641 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5642 return &omp_for_stmt
->iter
[i
].incr
;
5646 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5649 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5651 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5652 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5653 omp_for_stmt
->iter
[i
].incr
= incr
;
5657 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5658 statement GS starts. */
5661 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5663 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5664 return &omp_for_stmt
->pre_body
;
5668 /* Return the sequence of statements to execute before the OMP_FOR
5669 statement GS starts. */
5672 gimple_omp_for_pre_body (const gimple
*gs
)
5674 return *gimple_omp_for_pre_body_ptr (const_cast <gimple
*> (gs
));
5678 /* Set PRE_BODY to be the sequence of statements to execute before the
5679 OMP_FOR statement GS starts. */
5682 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5684 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5685 omp_for_stmt
->pre_body
= pre_body
;
5688 /* Return the clauses associated with OMP_PARALLEL GS. */
5691 gimple_omp_parallel_clauses (const gimple
*gs
)
5693 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5694 return omp_parallel_stmt
->clauses
;
5698 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5701 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5703 return &omp_parallel_stmt
->clauses
;
5707 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5710 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5713 omp_parallel_stmt
->clauses
= clauses
;
5717 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5720 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5722 return omp_parallel_stmt
->child_fn
;
5725 /* Return a pointer to the child function used to hold the body of
5726 OMP_PARALLEL_STMT. */
5729 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5731 return &omp_parallel_stmt
->child_fn
;
5735 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5738 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5741 omp_parallel_stmt
->child_fn
= child_fn
;
5745 /* Return the artificial argument used to send variables and values
5746 from the parent to the children threads in OMP_PARALLEL_STMT. */
5749 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5751 return omp_parallel_stmt
->data_arg
;
5755 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5758 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5760 return &omp_parallel_stmt
->data_arg
;
5764 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5767 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5770 omp_parallel_stmt
->data_arg
= data_arg
;
5773 /* Return the clauses associated with OMP_TASK GS. */
5776 gimple_omp_task_clauses (const gimple
*gs
)
5778 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5779 return omp_task_stmt
->clauses
;
5783 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5786 gimple_omp_task_clauses_ptr (gimple
*gs
)
5788 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5789 return &omp_task_stmt
->clauses
;
5793 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5797 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5799 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5800 omp_task_stmt
->clauses
= clauses
;
5804 /* Return true if OMP task statement G has the
5805 GF_OMP_TASK_TASKLOOP flag set. */
5808 gimple_omp_task_taskloop_p (const gimple
*g
)
5810 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5811 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5815 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5816 value of TASKLOOP_P. */
5819 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5821 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5823 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5825 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5829 /* Return true if OMP task statement G has the
5830 GF_OMP_TASK_TASKWAIT flag set. */
5833 gimple_omp_task_taskwait_p (const gimple
*g
)
5835 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5836 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKWAIT
) != 0;
5840 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5841 value of TASKWAIT_P. */
5844 gimple_omp_task_set_taskwait_p (gimple
*g
, bool taskwait_p
)
5846 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5848 g
->subcode
|= GF_OMP_TASK_TASKWAIT
;
5850 g
->subcode
&= ~GF_OMP_TASK_TASKWAIT
;
5854 /* Return the child function used to hold the body of OMP_TASK GS. */
5857 gimple_omp_task_child_fn (const gimple
*gs
)
5859 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5860 return omp_task_stmt
->child_fn
;
5863 /* Return a pointer to the child function used to hold the body of
5867 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5869 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5870 return &omp_task_stmt
->child_fn
;
5874 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5877 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5879 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5880 omp_task_stmt
->child_fn
= child_fn
;
5884 /* Return the artificial argument used to send variables and values
5885 from the parent to the children threads in OMP_TASK GS. */
5888 gimple_omp_task_data_arg (const gimple
*gs
)
5890 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5891 return omp_task_stmt
->data_arg
;
5895 /* Return a pointer to the data argument for OMP_TASK GS. */
5898 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5900 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5901 return &omp_task_stmt
->data_arg
;
5905 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5908 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5910 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5911 omp_task_stmt
->data_arg
= data_arg
;
5915 /* Return the clauses associated with OMP_TASK GS. */
5918 gimple_omp_taskreg_clauses (const gimple
*gs
)
5920 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5921 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5922 return omp_taskreg_stmt
->clauses
;
5926 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5929 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5931 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5932 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5933 return &omp_taskreg_stmt
->clauses
;
5937 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5941 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5943 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5944 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5945 omp_taskreg_stmt
->clauses
= clauses
;
5949 /* Return the child function used to hold the body of OMP_TASK GS. */
5952 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5954 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5955 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5956 return omp_taskreg_stmt
->child_fn
;
5959 /* Return a pointer to the child function used to hold the body of
5963 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5965 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5966 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5967 return &omp_taskreg_stmt
->child_fn
;
5971 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5974 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5976 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5977 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5978 omp_taskreg_stmt
->child_fn
= child_fn
;
5982 /* Return the artificial argument used to send variables and values
5983 from the parent to the children threads in OMP_TASK GS. */
5986 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5988 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5989 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5990 return omp_taskreg_stmt
->data_arg
;
5994 /* Return a pointer to the data argument for OMP_TASK GS. */
5997 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5999 gimple_statement_omp_taskreg
*omp_taskreg_stmt
6000 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
6001 return &omp_taskreg_stmt
->data_arg
;
6005 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
6008 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
6010 gimple_statement_omp_taskreg
*omp_taskreg_stmt
6011 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
6012 omp_taskreg_stmt
->data_arg
= data_arg
;
6016 /* Return the copy function used to hold the body of OMP_TASK GS. */
6019 gimple_omp_task_copy_fn (const gimple
*gs
)
6021 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
6022 return omp_task_stmt
->copy_fn
;
6025 /* Return a pointer to the copy function used to hold the body of
6029 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
6031 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
6032 return &omp_task_stmt
->copy_fn
;
6036 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
6039 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
6041 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
6042 omp_task_stmt
->copy_fn
= copy_fn
;
6046 /* Return size of the data block in bytes in OMP_TASK GS. */
6049 gimple_omp_task_arg_size (const gimple
*gs
)
6051 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
6052 return omp_task_stmt
->arg_size
;
6056 /* Return a pointer to the data block size for OMP_TASK GS. */
6059 gimple_omp_task_arg_size_ptr (gimple
*gs
)
6061 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
6062 return &omp_task_stmt
->arg_size
;
6066 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
6069 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
6071 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
6072 omp_task_stmt
->arg_size
= arg_size
;
6076 /* Return align of the data block in bytes in OMP_TASK GS. */
6079 gimple_omp_task_arg_align (const gimple
*gs
)
6081 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
6082 return omp_task_stmt
->arg_align
;
6086 /* Return a pointer to the data block align for OMP_TASK GS. */
6089 gimple_omp_task_arg_align_ptr (gimple
*gs
)
6091 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
6092 return &omp_task_stmt
->arg_align
;
6096 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
6099 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
6101 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
6102 omp_task_stmt
->arg_align
= arg_align
;
6106 /* Return the clauses associated with OMP_SINGLE GS. */
6109 gimple_omp_single_clauses (const gimple
*gs
)
6111 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
6112 return omp_single_stmt
->clauses
;
6116 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
6119 gimple_omp_single_clauses_ptr (gimple
*gs
)
6121 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
6122 return &omp_single_stmt
->clauses
;
6126 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
6129 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
6131 omp_single_stmt
->clauses
= clauses
;
6135 /* Return the clauses associated with OMP_TARGET GS. */
6138 gimple_omp_target_clauses (const gimple
*gs
)
6140 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
6141 return omp_target_stmt
->clauses
;
6145 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
6148 gimple_omp_target_clauses_ptr (gimple
*gs
)
6150 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
6151 return &omp_target_stmt
->clauses
;
6155 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
6158 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
6161 omp_target_stmt
->clauses
= clauses
;
6165 /* Return the kind of the OMP_TARGET G. */
6168 gimple_omp_target_kind (const gimple
*g
)
6170 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
6171 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
6175 /* Set the kind of the OMP_TARGET G. */
6178 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
6180 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
6181 | (kind
& GF_OMP_TARGET_KIND_MASK
);
6185 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
6188 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
6190 return omp_target_stmt
->child_fn
;
6193 /* Return a pointer to the child function used to hold the body of
6197 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
6199 return &omp_target_stmt
->child_fn
;
6203 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6206 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
6209 omp_target_stmt
->child_fn
= child_fn
;
6213 /* Return the artificial argument used to send variables and values
6214 from the parent to the children threads in OMP_TARGET_STMT. */
6217 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
6219 return omp_target_stmt
->data_arg
;
6223 /* Return a pointer to the data argument for OMP_TARGET GS. */
6226 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
6228 return &omp_target_stmt
->data_arg
;
6232 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6235 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
6238 omp_target_stmt
->data_arg
= data_arg
;
6242 /* Return the clauses associated with OMP_TEAMS GS. */
6245 gimple_omp_teams_clauses (const gimple
*gs
)
6247 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
6248 return omp_teams_stmt
->clauses
;
6252 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6255 gimple_omp_teams_clauses_ptr (gimple
*gs
)
6257 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
6258 return &omp_teams_stmt
->clauses
;
6262 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6265 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
6267 omp_teams_stmt
->clauses
= clauses
;
6270 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6273 gimple_omp_teams_child_fn (const gomp_teams
*omp_teams_stmt
)
6275 return omp_teams_stmt
->child_fn
;
6278 /* Return a pointer to the child function used to hold the body of
6282 gimple_omp_teams_child_fn_ptr (gomp_teams
*omp_teams_stmt
)
6284 return &omp_teams_stmt
->child_fn
;
6288 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6291 gimple_omp_teams_set_child_fn (gomp_teams
*omp_teams_stmt
, tree child_fn
)
6293 omp_teams_stmt
->child_fn
= child_fn
;
6297 /* Return the artificial argument used to send variables and values
6298 from the parent to the children threads in OMP_TEAMS_STMT. */
6301 gimple_omp_teams_data_arg (const gomp_teams
*omp_teams_stmt
)
6303 return omp_teams_stmt
->data_arg
;
6307 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6310 gimple_omp_teams_data_arg_ptr (gomp_teams
*omp_teams_stmt
)
6312 return &omp_teams_stmt
->data_arg
;
6316 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6319 gimple_omp_teams_set_data_arg (gomp_teams
*omp_teams_stmt
, tree data_arg
)
6321 omp_teams_stmt
->data_arg
= data_arg
;
6324 /* Return the host flag of an OMP_TEAMS_STMT. */
6327 gimple_omp_teams_host (const gomp_teams
*omp_teams_stmt
)
6329 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_HOST
) != 0;
6332 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6335 gimple_omp_teams_set_host (gomp_teams
*omp_teams_stmt
, bool value
)
6338 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_HOST
;
6340 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_HOST
;
6343 /* Return the clauses associated with OMP_SECTIONS GS. */
6346 gimple_omp_sections_clauses (const gimple
*gs
)
6348 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6349 return omp_sections_stmt
->clauses
;
6353 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6356 gimple_omp_sections_clauses_ptr (gimple
*gs
)
6358 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6359 return &omp_sections_stmt
->clauses
;
6363 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6367 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
6369 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6370 omp_sections_stmt
->clauses
= clauses
;
6374 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6378 gimple_omp_sections_control (const gimple
*gs
)
6380 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6381 return omp_sections_stmt
->control
;
6385 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6389 gimple_omp_sections_control_ptr (gimple
*gs
)
6391 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6392 return &omp_sections_stmt
->control
;
6396 /* Set CONTROL to be the set of clauses associated with the
6397 GIMPLE_OMP_SECTIONS in GS. */
6400 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
6402 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6403 omp_sections_stmt
->control
= control
;
6407 /* Set the value being stored in an atomic store. */
6410 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
6412 store_stmt
->val
= val
;
6416 /* Return the value being stored in an atomic store. */
6419 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
6421 return store_stmt
->val
;
6425 /* Return a pointer to the value being stored in an atomic store. */
6428 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
6430 return &store_stmt
->val
;
6434 /* Set the LHS of an atomic load. */
6437 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
6439 load_stmt
->lhs
= lhs
;
6443 /* Get the LHS of an atomic load. */
6446 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
6448 return load_stmt
->lhs
;
6452 /* Return a pointer to the LHS of an atomic load. */
6455 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
6457 return &load_stmt
->lhs
;
6461 /* Set the RHS of an atomic load. */
6464 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
6466 load_stmt
->rhs
= rhs
;
6470 /* Get the RHS of an atomic load. */
6473 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
6475 return load_stmt
->rhs
;
6479 /* Return a pointer to the RHS of an atomic load. */
6482 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
6484 return &load_stmt
->rhs
;
6488 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6491 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
6493 return cont_stmt
->control_def
;
6496 /* The same as above, but return the address. */
6499 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
6501 return &cont_stmt
->control_def
;
6504 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6507 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
6509 cont_stmt
->control_def
= def
;
6513 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6516 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
6518 return cont_stmt
->control_use
;
6522 /* The same as above, but return the address. */
6525 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
6527 return &cont_stmt
->control_use
;
6531 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6534 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
6536 cont_stmt
->control_use
= use
;
6539 /* Return the guard associated with the GIMPLE_ASSUME statement GS. */
6542 gimple_assume_guard (const gimple
*gs
)
6544 const gimple_statement_assume
*assume_stmt
6545 = as_a
<const gimple_statement_assume
*> (gs
);
6546 return assume_stmt
->guard
;
6549 /* Set the guard associated with the GIMPLE_ASSUME statement GS. */
6552 gimple_assume_set_guard (gimple
*gs
, tree guard
)
6554 gimple_statement_assume
*assume_stmt
= as_a
<gimple_statement_assume
*> (gs
);
6555 assume_stmt
->guard
= guard
;
6559 gimple_assume_guard_ptr (gimple
*gs
)
6561 gimple_statement_assume
*assume_stmt
= as_a
<gimple_statement_assume
*> (gs
);
6562 return &assume_stmt
->guard
;
6565 /* Return the address of the GIMPLE sequence contained in the GIMPLE_ASSUME
6569 gimple_assume_body_ptr (gimple
*gs
)
6571 gimple_statement_assume
*assume_stmt
= as_a
<gimple_statement_assume
*> (gs
);
6572 return &assume_stmt
->body
;
6575 /* Return the GIMPLE sequence contained in the GIMPLE_ASSUME statement GS. */
6578 gimple_assume_body (const gimple
*gs
)
6580 const gimple_statement_assume
*assume_stmt
6581 = as_a
<const gimple_statement_assume
*> (gs
);
6582 return assume_stmt
->body
;
6585 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6586 TRANSACTION_STMT. */
6589 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
6591 return &transaction_stmt
->body
;
6594 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6597 gimple_transaction_body (const gtransaction
*transaction_stmt
)
6599 return transaction_stmt
->body
;
6602 /* Return the label associated with a GIMPLE_TRANSACTION. */
6605 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
6607 return transaction_stmt
->label_norm
;
6611 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
6613 return &transaction_stmt
->label_norm
;
6617 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
6619 return transaction_stmt
->label_uninst
;
6623 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
6625 return &transaction_stmt
->label_uninst
;
6629 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
6631 return transaction_stmt
->label_over
;
6635 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
6637 return &transaction_stmt
->label_over
;
6640 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6643 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
6645 return transaction_stmt
->subcode
;
6648 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6649 TRANSACTION_STMT. */
6652 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
6655 transaction_stmt
->body
= body
;
6658 /* Set the label associated with a GIMPLE_TRANSACTION. */
6661 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
6663 transaction_stmt
->label_norm
= label
;
6667 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6669 transaction_stmt
->label_uninst
= label
;
6673 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6675 transaction_stmt
->label_over
= label
;
6678 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6681 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6682 unsigned int subcode
)
6684 transaction_stmt
->subcode
= subcode
;
6687 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6690 gimple_return_retval_ptr (greturn
*gs
)
6695 /* Return the return value for GIMPLE_RETURN GS. */
6698 gimple_return_retval (const greturn
*gs
)
6704 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6707 gimple_return_set_retval (greturn
*gs
, tree retval
)
6713 /* Returns true when the gimple statement STMT is any of the OMP types. */
6715 #define CASE_GIMPLE_OMP \
6716 case GIMPLE_OMP_PARALLEL: \
6717 case GIMPLE_OMP_TASK: \
6718 case GIMPLE_OMP_FOR: \
6719 case GIMPLE_OMP_SECTIONS: \
6720 case GIMPLE_OMP_SECTIONS_SWITCH: \
6721 case GIMPLE_OMP_SINGLE: \
6722 case GIMPLE_OMP_TARGET: \
6723 case GIMPLE_OMP_TEAMS: \
6724 case GIMPLE_OMP_SCOPE: \
6725 case GIMPLE_OMP_SECTION: \
6726 case GIMPLE_OMP_MASTER: \
6727 case GIMPLE_OMP_MASKED: \
6728 case GIMPLE_OMP_TASKGROUP: \
6729 case GIMPLE_OMP_ORDERED: \
6730 case GIMPLE_OMP_CRITICAL: \
6731 case GIMPLE_OMP_SCAN: \
6732 case GIMPLE_OMP_RETURN: \
6733 case GIMPLE_OMP_ATOMIC_LOAD: \
6734 case GIMPLE_OMP_ATOMIC_STORE: \
6735 case GIMPLE_OMP_CONTINUE
6738 is_gimple_omp (const gimple
*stmt
)
6740 switch (gimple_code (stmt
))
6749 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6753 is_gimple_omp_oacc (const gimple
*stmt
)
6755 gcc_assert (is_gimple_omp (stmt
));
6756 switch (gimple_code (stmt
))
6758 case GIMPLE_OMP_ATOMIC_LOAD
:
6759 case GIMPLE_OMP_ATOMIC_STORE
:
6760 case GIMPLE_OMP_CONTINUE
:
6761 case GIMPLE_OMP_RETURN
:
6762 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6766 case GIMPLE_OMP_FOR
:
6767 switch (gimple_omp_for_kind (stmt
))
6769 case GF_OMP_FOR_KIND_OACC_LOOP
:
6774 case GIMPLE_OMP_TARGET
:
6775 switch (gimple_omp_target_kind (stmt
))
6777 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6778 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6779 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
6780 case GF_OMP_TARGET_KIND_OACC_DATA
:
6781 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6782 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
6783 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
6784 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6785 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6786 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
6787 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
6788 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
6799 /* Return true if the OMP gimple statement STMT is offloaded. */
6802 is_gimple_omp_offloaded (const gimple
*stmt
)
6804 gcc_assert (is_gimple_omp (stmt
));
6805 switch (gimple_code (stmt
))
6807 case GIMPLE_OMP_TARGET
:
6808 switch (gimple_omp_target_kind (stmt
))
6810 case GF_OMP_TARGET_KIND_REGION
:
6811 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6812 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6813 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
6814 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
6815 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
6826 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6829 gimple_nop_p (const gimple
*g
)
6831 return gimple_code (g
) == GIMPLE_NOP
;
6835 /* Return true if GS is a GIMPLE_RESX. */
6838 is_gimple_resx (const gimple
*gs
)
6840 return gimple_code (gs
) == GIMPLE_RESX
;
6844 /* Enum and arrays used for allocation stats. Keep in sync with
6845 gimple.cc:gimple_alloc_kind_names. */
6846 enum gimple_alloc_kind
6848 gimple_alloc_kind_assign
, /* Assignments. */
6849 gimple_alloc_kind_phi
, /* PHI nodes. */
6850 gimple_alloc_kind_cond
, /* Conditionals. */
6851 gimple_alloc_kind_rest
, /* Everything else. */
6852 gimple_alloc_kind_all
6855 extern uint64_t gimple_alloc_counts
[];
6856 extern uint64_t gimple_alloc_sizes
[];
6858 /* Return the allocation kind for a given stmt CODE. */
6859 inline enum gimple_alloc_kind
6860 gimple_alloc_kind (enum gimple_code code
)
6865 return gimple_alloc_kind_assign
;
6867 return gimple_alloc_kind_phi
;
6869 return gimple_alloc_kind_cond
;
6871 return gimple_alloc_kind_rest
;
6875 /* Return true if a location should not be emitted for this statement
6876 by annotate_all_with_location. */
6879 gimple_do_not_emit_location_p (gimple
*g
)
6881 return gimple_plf (g
, GF_PLF_1
);
6884 /* Mark statement G so a location will not be emitted by
6885 annotate_one_with_location. */
6888 gimple_set_do_not_emit_location (gimple
*g
)
6890 /* The PLF flags are initialized to 0 when a new tuple is created,
6891 so no need to initialize it anywhere. */
6892 gimple_set_plf (g
, GF_PLF_1
, true);
6895 #endif /* GCC_GIMPLE_H */