1 /* Gimple IR definitions.
3 Copyright (C) 2007-2020 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_OMP_PARALLEL_COMBINED
= 1 << 0,
153 GF_OMP_TASK_TASKLOOP
= 1 << 0,
154 GF_OMP_TASK_TASKWAIT
= 1 << 1,
155 GF_OMP_FOR_KIND_MASK
= (1 << 3) - 1,
156 GF_OMP_FOR_KIND_FOR
= 0,
157 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
158 GF_OMP_FOR_KIND_TASKLOOP
= 2,
159 GF_OMP_FOR_KIND_OACC_LOOP
= 4,
160 GF_OMP_FOR_KIND_SIMD
= 5,
161 GF_OMP_FOR_COMBINED
= 1 << 3,
162 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
163 GF_OMP_TARGET_KIND_MASK
= (1 << 4) - 1,
164 GF_OMP_TARGET_KIND_REGION
= 0,
165 GF_OMP_TARGET_KIND_DATA
= 1,
166 GF_OMP_TARGET_KIND_UPDATE
= 2,
167 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
168 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
169 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
170 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
171 GF_OMP_TARGET_KIND_OACC_SERIAL
= 7,
172 GF_OMP_TARGET_KIND_OACC_DATA
= 8,
173 GF_OMP_TARGET_KIND_OACC_UPDATE
= 9,
174 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
= 10,
175 GF_OMP_TARGET_KIND_OACC_DECLARE
= 11,
176 GF_OMP_TARGET_KIND_OACC_HOST_DATA
= 12,
177 GF_OMP_TEAMS_HOST
= 1 << 0,
179 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
180 a thread synchronization via some sort of barrier. The exact barrier
181 that would otherwise be emitted is dependent on the OMP statement with
182 which this return is associated. */
183 GF_OMP_RETURN_NOWAIT
= 1 << 0,
185 GF_OMP_SECTION_LAST
= 1 << 0,
186 GF_OMP_ATOMIC_MEMORY_ORDER
= (1 << 3) - 1,
187 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 3,
188 GF_PREDICT_TAKEN
= 1 << 15
191 /* This subcode tells apart different kinds of stmts that are not used
192 for codegen, but rather to retain debug information. */
193 enum gimple_debug_subcode
{
194 GIMPLE_DEBUG_BIND
= 0,
195 GIMPLE_DEBUG_SOURCE_BIND
= 1,
196 GIMPLE_DEBUG_BEGIN_STMT
= 2,
197 GIMPLE_DEBUG_INLINE_ENTRY
= 3
200 /* Masks for selecting a pass local flag (PLF) to work on. These
201 masks are used by gimple_set_plf and gimple_plf. */
207 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
208 are for 64 bit hosts. */
210 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
211 chain_next ("%h.next"), variable_size
))
215 Main identifying code for a tuple. */
216 ENUM_BITFIELD(gimple_code
) code
: 8;
218 /* Nonzero if a warning should not be emitted on this tuple. */
219 unsigned int no_warning
: 1;
221 /* Nonzero if this tuple has been visited. Passes are responsible
222 for clearing this bit before using it. */
223 unsigned int visited
: 1;
225 /* Nonzero if this tuple represents a non-temporal move. */
226 unsigned int nontemporal_move
: 1;
228 /* Pass local flags. These flags are free for any pass to use as
229 they see fit. Passes should not assume that these flags contain
230 any useful value when the pass starts. Any initial state that
231 the pass requires should be set on entry to the pass. See
232 gimple_set_plf and gimple_plf for usage. */
233 unsigned int plf
: 2;
235 /* Nonzero if this statement has been modified and needs to have its
236 operands rescanned. */
237 unsigned modified
: 1;
239 /* Nonzero if this statement contains volatile operands. */
240 unsigned has_volatile_ops
: 1;
242 /* Padding to get subcode to 16 bit alignment. */
245 /* The SUBCODE field can be used for tuple-specific flags for tuples
246 that do not require subcodes. Note that SUBCODE should be at
247 least as wide as tree codes, as several tuples store tree codes
249 unsigned int subcode
: 16;
251 /* UID of this statement. This is used by passes that want to
252 assign IDs to statements. It must be assigned and used by each
253 pass. By default it should be assumed to contain garbage. */
257 Locus information for debug info. */
260 /* Number of operands in this tuple. */
264 Basic block holding this statement. */
268 Linked lists of gimple statements. The next pointers form
269 a NULL terminated list, the prev pointers are a cyclic list.
270 A gimple statement is hence also a double-ended list of
271 statements, with the pointer itself being the first element,
272 and the prev pointer being the last. */
274 gimple
*GTY((skip
)) prev
;
278 /* Base structure for tuples with operands. */
280 /* This gimple subclass has no tag value. */
282 gimple_statement_with_ops_base
: public gimple
284 /* [ WORD 1-6 ] : base class */
287 SSA operand vectors. NOTE: It should be possible to
288 amalgamate these vectors with the operand vector OP. However,
289 the SSA operand vectors are organized differently and contain
290 more information (like immediate use chaining). */
291 struct use_optype_d
GTY((skip (""))) *use_ops
;
295 /* Statements that take register operands. */
297 struct GTY((tag("GSS_WITH_OPS")))
298 gimple_statement_with_ops
: public gimple_statement_with_ops_base
300 /* [ WORD 1-7 ] : base class */
303 Operand vector. NOTE! This must always be the last field
304 of this structure. In particular, this means that this
305 structure cannot be embedded inside another one. */
306 tree
GTY((length ("%h.num_ops"))) op
[1];
310 /* Base for statements that take both memory and register operands. */
312 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
313 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
315 /* [ WORD 1-7 ] : base class */
318 Virtual operands for this statement. The GC will pick them
319 up via the ssa_names array. */
320 tree
GTY((skip (""))) vdef
;
321 tree
GTY((skip (""))) vuse
;
325 /* Statements that take both memory and register operands. */
327 struct GTY((tag("GSS_WITH_MEM_OPS")))
328 gimple_statement_with_memory_ops
:
329 public gimple_statement_with_memory_ops_base
331 /* [ WORD 1-9 ] : base class */
334 Operand vector. NOTE! This must always be the last field
335 of this structure. In particular, this means that this
336 structure cannot be embedded inside another one. */
337 tree
GTY((length ("%h.num_ops"))) op
[1];
341 /* Call statements that take both memory and register operands. */
343 struct GTY((tag("GSS_CALL")))
344 gcall
: public gimple_statement_with_memory_ops_base
346 /* [ WORD 1-9 ] : base class */
349 struct pt_solution call_used
;
350 struct pt_solution call_clobbered
;
353 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
354 tree
GTY ((tag ("0"))) fntype
;
355 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
359 Operand vector. NOTE! This must always be the last field
360 of this structure. In particular, this means that this
361 structure cannot be embedded inside another one. */
362 tree
GTY((length ("%h.num_ops"))) op
[1];
364 static const enum gimple_code code_
= GIMPLE_CALL
;
368 /* OMP statements. */
370 struct GTY((tag("GSS_OMP")))
371 gimple_statement_omp
: public gimple
373 /* [ WORD 1-6 ] : base class */
382 struct GTY((tag("GSS_BIND")))
383 gbind
: public gimple
385 /* [ WORD 1-6 ] : base class */
388 Variables declared in this scope. */
392 This is different than the BLOCK field in gimple,
393 which is analogous to TREE_BLOCK (i.e., the lexical block holding
394 this statement). This field is the equivalent of BIND_EXPR_BLOCK
395 in tree land (i.e., the lexical scope defined by this bind). See
406 struct GTY((tag("GSS_CATCH")))
407 gcatch
: public gimple
409 /* [ WORD 1-6 ] : base class */
419 /* GIMPLE_EH_FILTER */
421 struct GTY((tag("GSS_EH_FILTER")))
422 geh_filter
: public gimple
424 /* [ WORD 1-6 ] : base class */
437 struct GTY((tag("GSS_EH_ELSE")))
438 geh_else
: public gimple
440 /* [ WORD 1-6 ] : base class */
443 gimple_seq n_body
, e_body
;
446 /* GIMPLE_EH_MUST_NOT_THROW */
448 struct GTY((tag("GSS_EH_MNT")))
449 geh_mnt
: public gimple
451 /* [ WORD 1-6 ] : base class */
453 /* [ WORD 7 ] Abort function decl. */
459 struct GTY((tag("GSS_PHI")))
462 /* [ WORD 1-6 ] : base class */
472 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
476 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
478 struct GTY((tag("GSS_EH_CTRL")))
479 gimple_statement_eh_ctrl
: public gimple
481 /* [ WORD 1-6 ] : base class */
484 Exception region number. */
488 struct GTY((tag("GSS_EH_CTRL")))
489 gresx
: public gimple_statement_eh_ctrl
491 /* No extra fields; adds invariant:
492 stmt->code == GIMPLE_RESX. */
495 struct GTY((tag("GSS_EH_CTRL")))
496 geh_dispatch
: public gimple_statement_eh_ctrl
498 /* No extra fields; adds invariant:
499 stmt->code == GIMPLE_EH_DISPATH. */
505 struct GTY((tag("GSS_TRY")))
508 /* [ WORD 1-6 ] : base class */
511 Expression to evaluate. */
515 Cleanup expression. */
519 /* Kind of GIMPLE_TRY statements. */
520 enum gimple_try_flags
523 GIMPLE_TRY_CATCH
= 1 << 0,
526 GIMPLE_TRY_FINALLY
= 1 << 1,
527 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
529 /* Analogous to TRY_CATCH_IS_CLEANUP. */
530 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
533 /* GIMPLE_WITH_CLEANUP_EXPR */
535 struct GTY((tag("GSS_WCE")))
536 gimple_statement_wce
: public gimple
538 /* [ WORD 1-6 ] : base class */
540 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
541 executed if an exception is thrown, not on normal exit of its
542 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
546 Cleanup expression. */
553 struct GTY((tag("GSS_ASM")))
554 gasm
: public gimple_statement_with_memory_ops_base
556 /* [ WORD 1-9 ] : base class */
559 __asm__ statement. */
563 Number of inputs, outputs, clobbers, labels. */
570 Operand vector. NOTE! This must always be the last field
571 of this structure. In particular, this means that this
572 structure cannot be embedded inside another one. */
573 tree
GTY((length ("%h.num_ops"))) op
[1];
576 /* GIMPLE_OMP_CRITICAL */
578 struct GTY((tag("GSS_OMP_CRITICAL")))
579 gomp_critical
: public gimple_statement_omp
581 /* [ WORD 1-7 ] : base class */
587 Critical section name. */
592 struct GTY(()) gimple_omp_for_iter
{
593 /* Condition code. */
596 /* Index variable. */
611 struct GTY((tag("GSS_OMP_FOR")))
612 gomp_for
: public gimple_statement_omp
614 /* [ WORD 1-7 ] : base class */
620 Number of elements in iter array. */
624 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
627 Pre-body evaluated before the loop body begins. */
632 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
634 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
635 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
637 /* [ WORD 1-7 ] : base class */
644 Child function holding the body of the parallel region. */
648 Shared data argument. */
652 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
653 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
654 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
656 /* No extra fields; adds invariant:
657 stmt->code == GIMPLE_OMP_PARALLEL
658 || stmt->code == GIMPLE_OMP_TASK
659 || stmt->code == GIMPLE_OMP_TEAMS. */
662 /* GIMPLE_OMP_PARALLEL */
663 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
664 gomp_parallel
: public gimple_statement_omp_taskreg
666 /* No extra fields; adds invariant:
667 stmt->code == GIMPLE_OMP_PARALLEL. */
670 /* GIMPLE_OMP_TARGET */
671 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
672 gomp_target
: public gimple_statement_omp_parallel_layout
674 /* No extra fields; adds invariant:
675 stmt->code == GIMPLE_OMP_TARGET. */
678 /* GIMPLE_OMP_TASK */
680 struct GTY((tag("GSS_OMP_TASK")))
681 gomp_task
: public gimple_statement_omp_taskreg
683 /* [ WORD 1-10 ] : base class */
686 Child function holding firstprivate initialization if needed. */
690 Size and alignment in bytes of the argument data block. */
696 /* GIMPLE_OMP_SECTION */
697 /* Uses struct gimple_statement_omp. */
700 /* GIMPLE_OMP_SECTIONS */
702 struct GTY((tag("GSS_OMP_SECTIONS")))
703 gomp_sections
: public gimple_statement_omp
705 /* [ WORD 1-7 ] : base class */
711 The control variable used for deciding which of the sections to
716 /* GIMPLE_OMP_CONTINUE.
718 Note: This does not inherit from gimple_statement_omp, because we
719 do not need the body field. */
721 struct GTY((tag("GSS_OMP_CONTINUE")))
722 gomp_continue
: public gimple
724 /* [ WORD 1-6 ] : base class */
733 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
736 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
737 gimple_statement_omp_single_layout
: public gimple_statement_omp
739 /* [ WORD 1-7 ] : base class */
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gomp_single
: public gimple_statement_omp_single_layout
748 /* No extra fields; adds invariant:
749 stmt->code == GIMPLE_OMP_SINGLE. */
752 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
753 gomp_teams
: public gimple_statement_omp_taskreg
755 /* No extra fields; adds invariant:
756 stmt->code == GIMPLE_OMP_TEAMS. */
759 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
760 gomp_ordered
: public gimple_statement_omp_single_layout
762 /* No extra fields; adds invariant:
763 stmt->code == GIMPLE_OMP_ORDERED. */
766 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
767 gomp_scan
: public gimple_statement_omp_single_layout
769 /* No extra fields; adds invariant:
770 stmt->code == GIMPLE_OMP_SCAN. */
774 /* GIMPLE_OMP_ATOMIC_LOAD.
775 Note: This is based on gimple, not g_s_omp, because g_s_omp
776 contains a sequence, which we don't need here. */
778 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
779 gomp_atomic_load
: public gimple
781 /* [ WORD 1-6 ] : base class */
787 /* GIMPLE_OMP_ATOMIC_STORE.
788 See note on GIMPLE_OMP_ATOMIC_LOAD. */
790 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
791 gimple_statement_omp_atomic_store_layout
: public gimple
793 /* [ WORD 1-6 ] : base class */
799 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 public gimple_statement_omp_atomic_store_layout
803 /* No extra fields; adds invariant:
804 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
807 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
808 gimple_statement_omp_return
:
809 public gimple_statement_omp_atomic_store_layout
811 /* No extra fields; adds invariant:
812 stmt->code == GIMPLE_OMP_RETURN. */
815 /* GIMPLE_TRANSACTION. */
817 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
819 /* The __transaction_atomic was declared [[outer]] or it is
820 __transaction_relaxed. */
821 #define GTMA_IS_OUTER (1u << 0)
822 #define GTMA_IS_RELAXED (1u << 1)
823 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
825 /* The transaction is seen to not have an abort. */
826 #define GTMA_HAVE_ABORT (1u << 2)
827 /* The transaction is seen to have loads or stores. */
828 #define GTMA_HAVE_LOAD (1u << 3)
829 #define GTMA_HAVE_STORE (1u << 4)
830 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
831 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
832 /* The transaction WILL enter serial irrevocable mode.
833 An irrevocable block post-dominates the entire transaction, such
834 that all invocations of the transaction will go serial-irrevocable.
835 In such case, we don't bother instrumenting the transaction, and
836 tell the runtime that it should begin the transaction in
837 serial-irrevocable mode. */
838 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
839 /* The transaction contains no instrumentation code whatsover, most
840 likely because it is guaranteed to go irrevocable upon entry. */
841 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
843 struct GTY((tag("GSS_TRANSACTION")))
844 gtransaction
: public gimple_statement_with_memory_ops_base
846 /* [ WORD 1-9 ] : base class */
857 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
858 enum gimple_statement_structure_enum
{
859 #include "gsstruct.def"
864 /* A statement with the invariant that
865 stmt->code == GIMPLE_COND
866 i.e. a conditional jump statement. */
868 struct GTY((tag("GSS_WITH_OPS")))
869 gcond
: public gimple_statement_with_ops
871 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
872 static const enum gimple_code code_
= GIMPLE_COND
;
875 /* A statement with the invariant that
876 stmt->code == GIMPLE_DEBUG
877 i.e. a debug statement. */
879 struct GTY((tag("GSS_WITH_OPS")))
880 gdebug
: public gimple_statement_with_ops
882 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
885 /* A statement with the invariant that
886 stmt->code == GIMPLE_GOTO
887 i.e. a goto statement. */
889 struct GTY((tag("GSS_WITH_OPS")))
890 ggoto
: public gimple_statement_with_ops
892 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
895 /* A statement with the invariant that
896 stmt->code == GIMPLE_LABEL
897 i.e. a label statement. */
899 struct GTY((tag("GSS_WITH_OPS")))
900 glabel
: public gimple_statement_with_ops
902 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
905 /* A statement with the invariant that
906 stmt->code == GIMPLE_SWITCH
907 i.e. a switch statement. */
909 struct GTY((tag("GSS_WITH_OPS")))
910 gswitch
: public gimple_statement_with_ops
912 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
915 /* A statement with the invariant that
916 stmt->code == GIMPLE_ASSIGN
917 i.e. an assignment statement. */
919 struct GTY((tag("GSS_WITH_MEM_OPS")))
920 gassign
: public gimple_statement_with_memory_ops
922 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
923 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
926 /* A statement with the invariant that
927 stmt->code == GIMPLE_RETURN
928 i.e. a return statement. */
930 struct GTY((tag("GSS_WITH_MEM_OPS")))
931 greturn
: public gimple_statement_with_memory_ops
933 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
939 is_a_helper
<gasm
*>::test (gimple
*gs
)
941 return gs
->code
== GIMPLE_ASM
;
947 is_a_helper
<gassign
*>::test (gimple
*gs
)
949 return gs
->code
== GIMPLE_ASSIGN
;
955 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
957 return gs
->code
== GIMPLE_ASSIGN
;
963 is_a_helper
<gbind
*>::test (gimple
*gs
)
965 return gs
->code
== GIMPLE_BIND
;
971 is_a_helper
<gcall
*>::test (gimple
*gs
)
973 return gs
->code
== GIMPLE_CALL
;
979 is_a_helper
<gcatch
*>::test (gimple
*gs
)
981 return gs
->code
== GIMPLE_CATCH
;
987 is_a_helper
<gcond
*>::test (gimple
*gs
)
989 return gs
->code
== GIMPLE_COND
;
995 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
997 return gs
->code
== GIMPLE_COND
;
1003 is_a_helper
<gdebug
*>::test (gimple
*gs
)
1005 return gs
->code
== GIMPLE_DEBUG
;
1011 is_a_helper
<const gdebug
*>::test (const gimple
*gs
)
1013 return gs
->code
== GIMPLE_DEBUG
;
1019 is_a_helper
<ggoto
*>::test (gimple
*gs
)
1021 return gs
->code
== GIMPLE_GOTO
;
1027 is_a_helper
<const ggoto
*>::test (const gimple
*gs
)
1029 return gs
->code
== GIMPLE_GOTO
;
1035 is_a_helper
<glabel
*>::test (gimple
*gs
)
1037 return gs
->code
== GIMPLE_LABEL
;
1043 is_a_helper
<const glabel
*>::test (const gimple
*gs
)
1045 return gs
->code
== GIMPLE_LABEL
;
1051 is_a_helper
<gresx
*>::test (gimple
*gs
)
1053 return gs
->code
== GIMPLE_RESX
;
1059 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1061 return gs
->code
== GIMPLE_EH_DISPATCH
;
1067 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1069 return gs
->code
== GIMPLE_EH_ELSE
;
1075 is_a_helper
<const geh_else
*>::test (const gimple
*gs
)
1077 return gs
->code
== GIMPLE_EH_ELSE
;
1083 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1085 return gs
->code
== GIMPLE_EH_FILTER
;
1091 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1093 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1099 is_a_helper
<const geh_mnt
*>::test (const gimple
*gs
)
1101 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1107 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1109 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1115 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1117 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1123 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1125 return gs
->code
== GIMPLE_OMP_RETURN
;
1131 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1133 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1139 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1141 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1147 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1149 return gs
->code
== GIMPLE_OMP_ORDERED
;
1155 is_a_helper
<gomp_scan
*>::test (gimple
*gs
)
1157 return gs
->code
== GIMPLE_OMP_SCAN
;
1163 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1165 return gs
->code
== GIMPLE_OMP_FOR
;
1171 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1173 return (gs
->code
== GIMPLE_OMP_PARALLEL
1174 || gs
->code
== GIMPLE_OMP_TASK
1175 || gs
->code
== GIMPLE_OMP_TEAMS
);
1181 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1183 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1189 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1191 return gs
->code
== GIMPLE_OMP_TARGET
;
1197 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1199 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1205 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1207 return gs
->code
== GIMPLE_OMP_SINGLE
;
1213 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1215 return gs
->code
== GIMPLE_OMP_TEAMS
;
1221 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1223 return gs
->code
== GIMPLE_OMP_TASK
;
1229 is_a_helper
<gphi
*>::test (gimple
*gs
)
1231 return gs
->code
== GIMPLE_PHI
;
1237 is_a_helper
<greturn
*>::test (gimple
*gs
)
1239 return gs
->code
== GIMPLE_RETURN
;
1245 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1247 return gs
->code
== GIMPLE_SWITCH
;
1253 is_a_helper
<const gswitch
*>::test (const gimple
*gs
)
1255 return gs
->code
== GIMPLE_SWITCH
;
1261 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1263 return gs
->code
== GIMPLE_TRANSACTION
;
1269 is_a_helper
<gtry
*>::test (gimple
*gs
)
1271 return gs
->code
== GIMPLE_TRY
;
1277 is_a_helper
<const gtry
*>::test (const gimple
*gs
)
1279 return gs
->code
== GIMPLE_TRY
;
1285 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1287 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1293 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1295 return gs
->code
== GIMPLE_ASM
;
1301 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1303 return gs
->code
== GIMPLE_BIND
;
1309 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1311 return gs
->code
== GIMPLE_CALL
;
1317 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1319 return gs
->code
== GIMPLE_CATCH
;
1325 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1327 return gs
->code
== GIMPLE_RESX
;
1333 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1335 return gs
->code
== GIMPLE_EH_DISPATCH
;
1341 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1343 return gs
->code
== GIMPLE_EH_FILTER
;
1349 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1351 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1357 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1359 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1365 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1367 return gs
->code
== GIMPLE_OMP_RETURN
;
1373 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1375 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1381 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1383 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1389 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1391 return gs
->code
== GIMPLE_OMP_ORDERED
;
1397 is_a_helper
<const gomp_scan
*>::test (const gimple
*gs
)
1399 return gs
->code
== GIMPLE_OMP_SCAN
;
1405 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1407 return gs
->code
== GIMPLE_OMP_FOR
;
1413 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1415 return (gs
->code
== GIMPLE_OMP_PARALLEL
1416 || gs
->code
== GIMPLE_OMP_TASK
1417 || gs
->code
== GIMPLE_OMP_TEAMS
);
1423 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1425 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1431 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1433 return gs
->code
== GIMPLE_OMP_TARGET
;
1439 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1441 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1447 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1449 return gs
->code
== GIMPLE_OMP_SINGLE
;
1455 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1457 return gs
->code
== GIMPLE_OMP_TEAMS
;
1463 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1465 return gs
->code
== GIMPLE_OMP_TASK
;
1471 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1473 return gs
->code
== GIMPLE_PHI
;
1479 is_a_helper
<const greturn
*>::test (const gimple
*gs
)
1481 return gs
->code
== GIMPLE_RETURN
;
1487 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1489 return gs
->code
== GIMPLE_TRANSACTION
;
1492 /* Offset in bytes to the location of the operand vector.
1493 Zero if there is no operand vector for this tuple structure. */
1494 extern size_t const gimple_ops_offset_
[];
1496 /* Map GIMPLE codes to GSS codes. */
1497 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1499 /* This variable holds the currently expanded gimple statement for purposes
1500 of comminucating the profile info to the builtin expanders. */
1501 extern gimple
*currently_expanding_gimple_stmt
;
1503 size_t gimple_size (enum gimple_code code
, unsigned num_ops
= 0);
1504 void gimple_init (gimple
*g
, enum gimple_code code
, unsigned num_ops
);
1505 gimple
*gimple_alloc (enum gimple_code
, unsigned CXX_MEM_STAT_INFO
);
1506 greturn
*gimple_build_return (tree
);
1507 void gimple_call_reset_alias_info (gcall
*);
1508 gcall
*gimple_build_call_vec (tree
, vec
<tree
> );
1509 gcall
*gimple_build_call (tree
, unsigned, ...);
1510 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1511 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1512 gcall
*gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1513 gcall
*gimple_build_call_from_tree (tree
, tree
);
1514 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1515 gassign
*gimple_build_assign (tree
, enum tree_code
,
1516 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1517 gassign
*gimple_build_assign (tree
, enum tree_code
,
1518 tree
, tree CXX_MEM_STAT_INFO
);
1519 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1520 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1521 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1522 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1523 glabel
*gimple_build_label (tree label
);
1524 ggoto
*gimple_build_goto (tree dest
);
1525 gimple
*gimple_build_nop (void);
1526 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1527 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1528 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1529 vec
<tree
, va_gc
> *);
1530 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1531 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1532 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1533 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1534 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1535 enum gimple_try_flags
);
1536 gimple
*gimple_build_wce (gimple_seq
);
1537 gresx
*gimple_build_resx (int);
1538 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1539 gswitch
*gimple_build_switch (tree
, tree
, vec
<tree
> );
1540 geh_dispatch
*gimple_build_eh_dispatch (int);
1541 gdebug
*gimple_build_debug_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1542 gdebug
*gimple_build_debug_source_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1543 gdebug
*gimple_build_debug_begin_stmt (tree
, location_t CXX_MEM_STAT_INFO
);
1544 gdebug
*gimple_build_debug_inline_entry (tree
, location_t CXX_MEM_STAT_INFO
);
1545 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1546 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1547 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1548 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1550 gimple
*gimple_build_omp_section (gimple_seq
);
1551 gimple
*gimple_build_omp_master (gimple_seq
);
1552 gimple
*gimple_build_omp_taskgroup (gimple_seq
, tree
);
1553 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1554 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1555 gimple
*gimple_build_omp_return (bool);
1556 gomp_scan
*gimple_build_omp_scan (gimple_seq
, tree
);
1557 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1558 gimple
*gimple_build_omp_sections_switch (void);
1559 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1560 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1561 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1562 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
,
1563 enum omp_memory_order
);
1564 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
, enum omp_memory_order
);
1565 gtransaction
*gimple_build_transaction (gimple_seq
);
1566 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1567 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1568 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1569 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1570 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1572 extern void annotate_all_with_location (gimple_seq
, location_t
);
1573 bool empty_body_p (gimple_seq
);
1574 gimple_seq
gimple_seq_copy (gimple_seq
);
1575 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1576 int gimple_call_flags (const gimple
*);
1577 int gimple_call_arg_flags (const gcall
*, unsigned);
1578 int gimple_call_return_flags (const gcall
*);
1579 bool gimple_call_nonnull_result_p (gcall
*);
1580 tree
gimple_call_nonnull_arg (gcall
*);
1581 bool gimple_assign_copy_p (gimple
*);
1582 bool gimple_assign_ssa_name_copy_p (gimple
*);
1583 bool gimple_assign_unary_nop_p (gimple
*);
1584 void gimple_set_bb (gimple
*, basic_block
);
1585 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1586 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1588 tree
gimple_get_lhs (const gimple
*);
1589 void gimple_set_lhs (gimple
*, tree
);
1590 gimple
*gimple_copy (gimple
*);
1591 void gimple_move_vops (gimple
*, gimple
*);
1592 bool gimple_has_side_effects (const gimple
*);
1593 bool gimple_could_trap_p_1 (gimple
*, bool, bool);
1594 bool gimple_could_trap_p (gimple
*);
1595 bool gimple_assign_rhs_could_trap_p (gimple
*);
1596 extern void dump_gimple_statistics (void);
1597 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1598 extern tree
canonicalize_cond_expr_cond (tree
);
1599 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1600 extern bool gimple_compare_field_offset (tree
, tree
);
1601 extern tree
gimple_unsigned_type (tree
);
1602 extern tree
gimple_signed_type (tree
);
1603 extern alias_set_type
gimple_get_alias_set (tree
);
1604 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1605 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1606 extern combined_fn
gimple_call_combined_fn (const gimple
*);
1607 extern bool gimple_call_replaceable_operator_delete_p (const gcall
*);
1608 extern bool gimple_call_builtin_p (const gimple
*);
1609 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1610 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1611 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1612 extern void dump_decl_set (FILE *, bitmap
);
1613 extern bool nonfreeing_call_p (gimple
*);
1614 extern bool nonbarrier_call_p (gimple
*);
1615 extern bool infer_nonnull_range (gimple
*, tree
);
1616 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1617 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1618 extern void sort_case_labels (vec
<tree
>);
1619 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1620 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1621 extern void gimple_seq_discard (gimple_seq
);
1622 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1623 extern bool gimple_inexpensive_call_p (gcall
*);
1624 extern bool stmt_can_terminate_bb_p (gimple
*);
1625 extern location_t
gimple_or_expr_nonartificial_location (gimple
*, tree
);
1628 /* Formal (expression) temporary table handling: multiple occurrences of
1629 the same scalar expression are evaluated into the same temporary. */
1631 typedef struct gimple_temp_hash_elt
1634 tree temp
; /* Value */
1637 /* Get the number of the next statement uid to be allocated. */
1638 static inline unsigned int
1639 gimple_stmt_max_uid (struct function
*fn
)
1641 return fn
->last_stmt_uid
;
1644 /* Set the number of the next statement uid to be allocated. */
1646 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1648 fn
->last_stmt_uid
= maxid
;
1651 /* Set the number of the next statement uid to be allocated. */
1652 static inline unsigned int
1653 inc_gimple_stmt_max_uid (struct function
*fn
)
1655 return fn
->last_stmt_uid
++;
1658 /* Return the first node in GIMPLE sequence S. */
1660 static inline gimple_seq_node
1661 gimple_seq_first (gimple_seq s
)
1667 /* Return the first statement in GIMPLE sequence S. */
1669 static inline gimple
*
1670 gimple_seq_first_stmt (gimple_seq s
)
1672 gimple_seq_node n
= gimple_seq_first (s
);
1676 /* Return the first statement in GIMPLE sequence S as a gbind *,
1677 verifying that it has code GIMPLE_BIND in a checked build. */
1679 static inline gbind
*
1680 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1682 gimple_seq_node n
= gimple_seq_first (s
);
1683 return as_a
<gbind
*> (n
);
1687 /* Return the last node in GIMPLE sequence S. */
1689 static inline gimple_seq_node
1690 gimple_seq_last (gimple_seq s
)
1692 return s
? s
->prev
: NULL
;
1696 /* Return the last statement in GIMPLE sequence S. */
1698 static inline gimple
*
1699 gimple_seq_last_stmt (gimple_seq s
)
1701 gimple_seq_node n
= gimple_seq_last (s
);
1706 /* Set the last node in GIMPLE sequence *PS to LAST. */
1709 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1715 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1718 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1724 /* Return true if GIMPLE sequence S is empty. */
1727 gimple_seq_empty_p (gimple_seq s
)
1732 /* Allocate a new sequence and initialize its first element with STMT. */
1734 static inline gimple_seq
1735 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1737 gimple_seq seq
= NULL
;
1738 gimple_seq_add_stmt (&seq
, stmt
);
1743 /* Returns the sequence of statements in BB. */
1745 static inline gimple_seq
1746 bb_seq (const_basic_block bb
)
1748 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1751 static inline gimple_seq
*
1752 bb_seq_addr (basic_block bb
)
1754 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1757 /* Sets the sequence of statements in BB to SEQ. */
1760 set_bb_seq (basic_block bb
, gimple_seq seq
)
1762 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1763 bb
->il
.gimple
.seq
= seq
;
1767 /* Return the code for GIMPLE statement G. */
1769 static inline enum gimple_code
1770 gimple_code (const gimple
*g
)
1776 /* Return the GSS code used by a GIMPLE code. */
1778 static inline enum gimple_statement_structure_enum
1779 gss_for_code (enum gimple_code code
)
1781 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1782 return gss_for_code_
[code
];
1786 /* Return which GSS code is used by GS. */
1788 static inline enum gimple_statement_structure_enum
1789 gimple_statement_structure (gimple
*gs
)
1791 return gss_for_code (gimple_code (gs
));
1795 /* Return true if statement G has sub-statements. This is only true for
1796 High GIMPLE statements. */
1799 gimple_has_substatements (gimple
*g
)
1801 switch (gimple_code (g
))
1805 case GIMPLE_EH_FILTER
:
1806 case GIMPLE_EH_ELSE
:
1808 case GIMPLE_OMP_FOR
:
1809 case GIMPLE_OMP_MASTER
:
1810 case GIMPLE_OMP_TASKGROUP
:
1811 case GIMPLE_OMP_ORDERED
:
1812 case GIMPLE_OMP_SECTION
:
1813 case GIMPLE_OMP_PARALLEL
:
1814 case GIMPLE_OMP_TASK
:
1815 case GIMPLE_OMP_SECTIONS
:
1816 case GIMPLE_OMP_SINGLE
:
1817 case GIMPLE_OMP_TARGET
:
1818 case GIMPLE_OMP_TEAMS
:
1819 case GIMPLE_OMP_CRITICAL
:
1820 case GIMPLE_WITH_CLEANUP_EXPR
:
1821 case GIMPLE_TRANSACTION
:
1830 /* Return the basic block holding statement G. */
1832 static inline basic_block
1833 gimple_bb (const gimple
*g
)
1839 /* Return the lexical scope block holding statement G. */
1842 gimple_block (const gimple
*g
)
1844 return LOCATION_BLOCK (g
->location
);
1848 /* Set BLOCK to be the lexical scope block holding statement G. */
1851 gimple_set_block (gimple
*g
, tree block
)
1853 g
->location
= set_block (g
->location
, block
);
1857 /* Return location information for statement G. */
1859 static inline location_t
1860 gimple_location (const gimple
*g
)
1865 /* Return location information for statement G if g is not NULL.
1866 Otherwise, UNKNOWN_LOCATION is returned. */
1868 static inline location_t
1869 gimple_location_safe (const gimple
*g
)
1871 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1874 /* Set location information for statement G. */
1877 gimple_set_location (gimple
*g
, location_t location
)
1879 g
->location
= location
;
1883 /* Return true if G contains location information. */
1886 gimple_has_location (const gimple
*g
)
1888 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1892 /* Return non-artificial location information for statement G. */
1894 static inline location_t
1895 gimple_nonartificial_location (const gimple
*g
)
1897 location_t
*ploc
= NULL
;
1899 if (tree block
= gimple_block (g
))
1900 ploc
= block_nonartificial_location (block
);
1902 return ploc
? *ploc
: gimple_location (g
);
1906 /* Return the file name of the location of STMT. */
1908 static inline const char *
1909 gimple_filename (const gimple
*stmt
)
1911 return LOCATION_FILE (gimple_location (stmt
));
1915 /* Return the line number of the location of STMT. */
1918 gimple_lineno (const gimple
*stmt
)
1920 return LOCATION_LINE (gimple_location (stmt
));
1924 /* Determine whether SEQ is a singleton. */
1927 gimple_seq_singleton_p (gimple_seq seq
)
1929 return ((gimple_seq_first (seq
) != NULL
)
1930 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1933 /* Return true if no warnings should be emitted for statement STMT. */
1936 gimple_no_warning_p (const gimple
*stmt
)
1938 return stmt
->no_warning
;
1941 /* Set the no_warning flag of STMT to NO_WARNING. */
1944 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1946 stmt
->no_warning
= (unsigned) no_warning
;
1949 /* Set the visited status on statement STMT to VISITED_P.
1951 Please note that this 'visited' property of the gimple statement is
1952 supposed to be undefined at pass boundaries. This means that a
1953 given pass should not assume it contains any useful value when the
1954 pass starts and thus can set it to any value it sees fit.
1956 You can learn more about the visited property of the gimple
1957 statement by reading the comments of the 'visited' data member of
1962 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1964 stmt
->visited
= (unsigned) visited_p
;
1968 /* Return the visited status for statement STMT.
1970 Please note that this 'visited' property of the gimple statement is
1971 supposed to be undefined at pass boundaries. This means that a
1972 given pass should not assume it contains any useful value when the
1973 pass starts and thus can set it to any value it sees fit.
1975 You can learn more about the visited property of the gimple
1976 statement by reading the comments of the 'visited' data member of
1980 gimple_visited_p (gimple
*stmt
)
1982 return stmt
->visited
;
1986 /* Set pass local flag PLF on statement STMT to VAL_P.
1988 Please note that this PLF property of the gimple statement is
1989 supposed to be undefined at pass boundaries. This means that a
1990 given pass should not assume it contains any useful value when the
1991 pass starts and thus can set it to any value it sees fit.
1993 You can learn more about the PLF property by reading the comment of
1994 the 'plf' data member of struct gimple_statement_structure. */
1997 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
2000 stmt
->plf
|= (unsigned int) plf
;
2002 stmt
->plf
&= ~((unsigned int) plf
);
2006 /* Return the value of pass local flag PLF on statement STMT.
2008 Please note that this 'plf' property of the gimple statement is
2009 supposed to be undefined at pass boundaries. This means that a
2010 given pass should not assume it contains any useful value when the
2011 pass starts and thus can set it to any value it sees fit.
2013 You can learn more about the plf property by reading the comment of
2014 the 'plf' data member of struct gimple_statement_structure. */
2016 static inline unsigned int
2017 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
2019 return stmt
->plf
& ((unsigned int) plf
);
2023 /* Set the UID of statement.
2025 Please note that this UID property is supposed to be undefined at
2026 pass boundaries. This means that a given pass should not assume it
2027 contains any useful value when the pass starts and thus can set it
2028 to any value it sees fit. */
2031 gimple_set_uid (gimple
*g
, unsigned uid
)
2037 /* Return the UID of statement.
2039 Please note that this UID property is supposed to be undefined at
2040 pass boundaries. This means that a given pass should not assume it
2041 contains any useful value when the pass starts and thus can set it
2042 to any value it sees fit. */
2044 static inline unsigned
2045 gimple_uid (const gimple
*g
)
2051 /* Make statement G a singleton sequence. */
2054 gimple_init_singleton (gimple
*g
)
2061 /* Return true if GIMPLE statement G has register or memory operands. */
2064 gimple_has_ops (const gimple
*g
)
2066 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
2072 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
2074 return gimple_has_ops (gs
);
2080 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
2082 return gimple_has_ops (gs
);
2085 /* Return true if GIMPLE statement G has memory operands. */
2088 gimple_has_mem_ops (const gimple
*g
)
2090 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
2096 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
2098 return gimple_has_mem_ops (gs
);
2104 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
2106 return gimple_has_mem_ops (gs
);
2109 /* Return the set of USE operands for statement G. */
2111 static inline struct use_optype_d
*
2112 gimple_use_ops (const gimple
*g
)
2114 const gimple_statement_with_ops
*ops_stmt
=
2115 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2118 return ops_stmt
->use_ops
;
2122 /* Set USE to be the set of USE operands for statement G. */
2125 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2127 gimple_statement_with_ops
*ops_stmt
=
2128 as_a
<gimple_statement_with_ops
*> (g
);
2129 ops_stmt
->use_ops
= use
;
2133 /* Return the single VUSE operand of the statement G. */
2136 gimple_vuse (const gimple
*g
)
2138 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2139 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2142 return mem_ops_stmt
->vuse
;
2145 /* Return the single VDEF operand of the statement G. */
2148 gimple_vdef (const gimple
*g
)
2150 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2151 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2154 return mem_ops_stmt
->vdef
;
2157 /* Return the single VUSE operand of the statement G. */
2159 static inline tree
*
2160 gimple_vuse_ptr (gimple
*g
)
2162 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2163 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2166 return &mem_ops_stmt
->vuse
;
2169 /* Return the single VDEF operand of the statement G. */
2171 static inline tree
*
2172 gimple_vdef_ptr (gimple
*g
)
2174 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2175 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2178 return &mem_ops_stmt
->vdef
;
2181 /* Set the single VUSE operand of the statement G. */
2184 gimple_set_vuse (gimple
*g
, tree vuse
)
2186 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2187 as_a
<gimple_statement_with_memory_ops
*> (g
);
2188 mem_ops_stmt
->vuse
= vuse
;
2191 /* Set the single VDEF operand of the statement G. */
2194 gimple_set_vdef (gimple
*g
, tree vdef
)
2196 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2197 as_a
<gimple_statement_with_memory_ops
*> (g
);
2198 mem_ops_stmt
->vdef
= vdef
;
2202 /* Return true if statement G has operands and the modified field has
2206 gimple_modified_p (const gimple
*g
)
2208 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2212 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2213 a MODIFIED field. */
2216 gimple_set_modified (gimple
*s
, bool modifiedp
)
2218 if (gimple_has_ops (s
))
2219 s
->modified
= (unsigned) modifiedp
;
2223 /* Return the tree code for the expression computed by STMT. This is
2224 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2225 GIMPLE_CALL, return CALL_EXPR as the expression code for
2226 consistency. This is useful when the caller needs to deal with the
2227 three kinds of computation that GIMPLE supports. */
2229 static inline enum tree_code
2230 gimple_expr_code (const gimple
*stmt
)
2232 enum gimple_code code
= gimple_code (stmt
);
2233 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
2234 return (enum tree_code
) stmt
->subcode
;
2237 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
2243 /* Return true if statement STMT contains volatile operands. */
2246 gimple_has_volatile_ops (const gimple
*stmt
)
2248 if (gimple_has_mem_ops (stmt
))
2249 return stmt
->has_volatile_ops
;
2255 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2258 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2260 if (gimple_has_mem_ops (stmt
))
2261 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2264 /* Return true if STMT is in a transaction. */
2267 gimple_in_transaction (const gimple
*stmt
)
2269 return bb_in_transaction (gimple_bb (stmt
));
2272 /* Return true if statement STMT may access memory. */
2275 gimple_references_memory_p (gimple
*stmt
)
2277 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2281 /* Return the subcode for OMP statement S. */
2283 static inline unsigned
2284 gimple_omp_subcode (const gimple
*s
)
2286 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2287 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2291 /* Set the subcode for OMP statement S to SUBCODE. */
2294 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2296 /* We only have 16 bits for the subcode. Assert that we are not
2298 gcc_gimple_checking_assert (subcode
< (1 << 16));
2299 s
->subcode
= subcode
;
2302 /* Set the nowait flag on OMP_RETURN statement S. */
2305 gimple_omp_return_set_nowait (gimple
*s
)
2307 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2308 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2312 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2316 gimple_omp_return_nowait_p (const gimple
*g
)
2318 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2319 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2323 /* Set the LHS of OMP return. */
2326 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2328 gimple_statement_omp_return
*omp_return_stmt
=
2329 as_a
<gimple_statement_omp_return
*> (g
);
2330 omp_return_stmt
->val
= lhs
;
2334 /* Get the LHS of OMP return. */
2337 gimple_omp_return_lhs (const gimple
*g
)
2339 const gimple_statement_omp_return
*omp_return_stmt
=
2340 as_a
<const gimple_statement_omp_return
*> (g
);
2341 return omp_return_stmt
->val
;
2345 /* Return a pointer to the LHS of OMP return. */
2347 static inline tree
*
2348 gimple_omp_return_lhs_ptr (gimple
*g
)
2350 gimple_statement_omp_return
*omp_return_stmt
=
2351 as_a
<gimple_statement_omp_return
*> (g
);
2352 return &omp_return_stmt
->val
;
2356 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2360 gimple_omp_section_last_p (const gimple
*g
)
2362 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2363 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2367 /* Set the GF_OMP_SECTION_LAST flag on G. */
2370 gimple_omp_section_set_last (gimple
*g
)
2372 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2373 g
->subcode
|= GF_OMP_SECTION_LAST
;
2377 /* Return true if OMP parallel statement G has the
2378 GF_OMP_PARALLEL_COMBINED flag set. */
2381 gimple_omp_parallel_combined_p (const gimple
*g
)
2383 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2384 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2388 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2389 value of COMBINED_P. */
2392 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2394 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2396 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2398 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2402 /* Return true if OMP atomic load/store statement G has the
2403 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2406 gimple_omp_atomic_need_value_p (const gimple
*g
)
2408 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2409 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2410 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2414 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2417 gimple_omp_atomic_set_need_value (gimple
*g
)
2419 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2420 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2421 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2425 /* Return the memory order of the OMP atomic load/store statement G. */
2427 static inline enum omp_memory_order
2428 gimple_omp_atomic_memory_order (const gimple
*g
)
2430 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2431 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2432 return (enum omp_memory_order
)
2433 (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_MEMORY_ORDER
);
2437 /* Set the memory order on G. */
2440 gimple_omp_atomic_set_memory_order (gimple
*g
, enum omp_memory_order mo
)
2442 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2443 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2444 g
->subcode
= ((g
->subcode
& ~GF_OMP_ATOMIC_MEMORY_ORDER
)
2445 | (mo
& GF_OMP_ATOMIC_MEMORY_ORDER
));
2449 /* Return the number of operands for statement GS. */
2451 static inline unsigned
2452 gimple_num_ops (const gimple
*gs
)
2458 /* Set the number of operands for statement GS. */
2461 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2463 gs
->num_ops
= num_ops
;
2467 /* Return the array of operands for statement GS. */
2469 static inline tree
*
2470 gimple_ops (gimple
*gs
)
2474 /* All the tuples have their operand vector at the very bottom
2475 of the structure. Note that those structures that do not
2476 have an operand vector have a zero offset. */
2477 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2478 gcc_gimple_checking_assert (off
!= 0);
2480 return (tree
*) ((char *) gs
+ off
);
2484 /* Return operand I for statement GS. */
2487 gimple_op (const gimple
*gs
, unsigned i
)
2489 if (gimple_has_ops (gs
))
2491 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2492 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2498 /* Return a pointer to operand I for statement GS. */
2500 static inline tree
*
2501 gimple_op_ptr (gimple
*gs
, unsigned i
)
2503 if (gimple_has_ops (gs
))
2505 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2506 return gimple_ops (gs
) + i
;
2512 /* Set operand I of statement GS to OP. */
2515 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2517 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2519 /* Note. It may be tempting to assert that OP matches
2520 is_gimple_operand, but that would be wrong. Different tuples
2521 accept slightly different sets of tree operands. Each caller
2522 should perform its own validation. */
2523 gimple_ops (gs
)[i
] = op
;
2526 /* Return true if GS is a GIMPLE_ASSIGN. */
2529 is_gimple_assign (const gimple
*gs
)
2531 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2534 /* Determine if expression CODE is one of the valid expressions that can
2535 be used on the RHS of GIMPLE assignments. */
2537 static inline enum gimple_rhs_class
2538 get_gimple_rhs_class (enum tree_code code
)
2540 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2543 /* Return the LHS of assignment statement GS. */
2546 gimple_assign_lhs (const gassign
*gs
)
2552 gimple_assign_lhs (const gimple
*gs
)
2554 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2555 return gimple_assign_lhs (ass
);
2559 /* Return a pointer to the LHS of assignment statement GS. */
2561 static inline tree
*
2562 gimple_assign_lhs_ptr (gassign
*gs
)
2567 static inline tree
*
2568 gimple_assign_lhs_ptr (gimple
*gs
)
2570 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2571 return gimple_assign_lhs_ptr (ass
);
2575 /* Set LHS to be the LHS operand of assignment statement GS. */
2578 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2582 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2583 SSA_NAME_DEF_STMT (lhs
) = gs
;
2587 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2589 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2590 gimple_assign_set_lhs (ass
, lhs
);
2594 /* Return the first operand on the RHS of assignment statement GS. */
2597 gimple_assign_rhs1 (const gassign
*gs
)
2603 gimple_assign_rhs1 (const gimple
*gs
)
2605 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2606 return gimple_assign_rhs1 (ass
);
2610 /* Return a pointer to the first operand on the RHS of assignment
2613 static inline tree
*
2614 gimple_assign_rhs1_ptr (gassign
*gs
)
2619 static inline tree
*
2620 gimple_assign_rhs1_ptr (gimple
*gs
)
2622 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2623 return gimple_assign_rhs1_ptr (ass
);
2626 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2629 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2635 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2637 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2638 gimple_assign_set_rhs1 (ass
, rhs
);
2642 /* Return the second operand on the RHS of assignment statement GS.
2643 If GS does not have two operands, NULL is returned instead. */
2646 gimple_assign_rhs2 (const gassign
*gs
)
2648 if (gimple_num_ops (gs
) >= 3)
2655 gimple_assign_rhs2 (const gimple
*gs
)
2657 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2658 return gimple_assign_rhs2 (ass
);
2662 /* Return a pointer to the second operand on the RHS of assignment
2665 static inline tree
*
2666 gimple_assign_rhs2_ptr (gassign
*gs
)
2668 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2672 static inline tree
*
2673 gimple_assign_rhs2_ptr (gimple
*gs
)
2675 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2676 return gimple_assign_rhs2_ptr (ass
);
2680 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2683 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2685 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2690 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2692 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2693 return gimple_assign_set_rhs2 (ass
, rhs
);
2696 /* Return the third operand on the RHS of assignment statement GS.
2697 If GS does not have two operands, NULL is returned instead. */
2700 gimple_assign_rhs3 (const gassign
*gs
)
2702 if (gimple_num_ops (gs
) >= 4)
2709 gimple_assign_rhs3 (const gimple
*gs
)
2711 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2712 return gimple_assign_rhs3 (ass
);
2715 /* Return a pointer to the third operand on the RHS of assignment
2718 static inline tree
*
2719 gimple_assign_rhs3_ptr (gimple
*gs
)
2721 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2722 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2727 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2730 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2732 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2737 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2739 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2740 gimple_assign_set_rhs3 (ass
, rhs
);
2744 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2745 which expect to see only two operands. */
2748 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2751 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2754 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2755 which expect to see only one operands. */
2758 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2761 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2764 /* Returns true if GS is a nontemporal move. */
2767 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2769 return gs
->nontemporal_move
;
2772 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2775 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2777 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2778 gs
->nontemporal_move
= nontemporal
;
2782 /* Return the code of the expression computed on the rhs of assignment
2783 statement GS. In case that the RHS is a single object, returns the
2784 tree code of the object. */
2786 static inline enum tree_code
2787 gimple_assign_rhs_code (const gassign
*gs
)
2789 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2790 /* While we initially set subcode to the TREE_CODE of the rhs for
2791 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2792 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2793 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2794 code
= TREE_CODE (gs
->op
[1]);
2799 static inline enum tree_code
2800 gimple_assign_rhs_code (const gimple
*gs
)
2802 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2803 return gimple_assign_rhs_code (ass
);
2807 /* Set CODE to be the code for the expression computed on the RHS of
2811 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2813 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2818 /* Return the gimple rhs class of the code of the expression computed on
2819 the rhs of assignment statement GS.
2820 This will never return GIMPLE_INVALID_RHS. */
2822 static inline enum gimple_rhs_class
2823 gimple_assign_rhs_class (const gimple
*gs
)
2825 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2828 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2829 there is no operator associated with the assignment itself.
2830 Unlike gimple_assign_copy_p, this predicate returns true for
2831 any RHS operand, including those that perform an operation
2832 and do not have the semantics of a copy, such as COND_EXPR. */
2835 gimple_assign_single_p (const gimple
*gs
)
2837 return (is_gimple_assign (gs
)
2838 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2841 /* Return true if GS performs a store to its lhs. */
2844 gimple_store_p (const gimple
*gs
)
2846 tree lhs
= gimple_get_lhs (gs
);
2847 return lhs
&& !is_gimple_reg (lhs
);
2850 /* Return true if GS is an assignment that loads from its rhs1. */
2853 gimple_assign_load_p (const gimple
*gs
)
2856 if (!gimple_assign_single_p (gs
))
2858 rhs
= gimple_assign_rhs1 (gs
);
2859 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2861 rhs
= get_base_address (rhs
);
2862 return (DECL_P (rhs
)
2863 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2867 /* Return true if S is a type-cast assignment. */
2870 gimple_assign_cast_p (const gimple
*s
)
2872 if (is_gimple_assign (s
))
2874 enum tree_code sc
= gimple_assign_rhs_code (s
);
2875 return CONVERT_EXPR_CODE_P (sc
)
2876 || sc
== VIEW_CONVERT_EXPR
2877 || sc
== FIX_TRUNC_EXPR
;
2883 /* Return true if S is a clobber statement. */
2886 gimple_clobber_p (const gimple
*s
)
2888 return gimple_assign_single_p (s
)
2889 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2892 /* Return true if GS is a GIMPLE_CALL. */
2895 is_gimple_call (const gimple
*gs
)
2897 return gimple_code (gs
) == GIMPLE_CALL
;
2900 /* Return the LHS of call statement GS. */
2903 gimple_call_lhs (const gcall
*gs
)
2909 gimple_call_lhs (const gimple
*gs
)
2911 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2912 return gimple_call_lhs (gc
);
2916 /* Return a pointer to the LHS of call statement GS. */
2918 static inline tree
*
2919 gimple_call_lhs_ptr (gcall
*gs
)
2924 static inline tree
*
2925 gimple_call_lhs_ptr (gimple
*gs
)
2927 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2928 return gimple_call_lhs_ptr (gc
);
2932 /* Set LHS to be the LHS operand of call statement GS. */
2935 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2938 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2939 SSA_NAME_DEF_STMT (lhs
) = gs
;
2943 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2945 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2946 gimple_call_set_lhs (gc
, lhs
);
2950 /* Return true if call GS calls an internal-only function, as enumerated
2954 gimple_call_internal_p (const gcall
*gs
)
2956 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2960 gimple_call_internal_p (const gimple
*gs
)
2962 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2963 return gimple_call_internal_p (gc
);
2966 /* Return true if call GS is marked as nocf_check. */
2969 gimple_call_nocf_check_p (const gcall
*gs
)
2971 return (gs
->subcode
& GF_CALL_NOCF_CHECK
) != 0;
2974 /* Mark statement GS as nocf_check call. */
2977 gimple_call_set_nocf_check (gcall
*gs
, bool nocf_check
)
2980 gs
->subcode
|= GF_CALL_NOCF_CHECK
;
2982 gs
->subcode
&= ~GF_CALL_NOCF_CHECK
;
2985 /* Return the target of internal call GS. */
2987 static inline enum internal_fn
2988 gimple_call_internal_fn (const gcall
*gs
)
2990 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2991 return gs
->u
.internal_fn
;
2994 static inline enum internal_fn
2995 gimple_call_internal_fn (const gimple
*gs
)
2997 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2998 return gimple_call_internal_fn (gc
);
3001 /* Return true, if this internal gimple call is unique. */
3004 gimple_call_internal_unique_p (const gcall
*gs
)
3006 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
3010 gimple_call_internal_unique_p (const gimple
*gs
)
3012 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3013 return gimple_call_internal_unique_p (gc
);
3016 /* Return true if GS is an internal function FN. */
3019 gimple_call_internal_p (const gimple
*gs
, internal_fn fn
)
3021 return (is_gimple_call (gs
)
3022 && gimple_call_internal_p (gs
)
3023 && gimple_call_internal_fn (gs
) == fn
);
3026 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3027 that could alter control flow. */
3030 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
3032 if (ctrl_altering_p
)
3033 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
3035 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
3039 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
3041 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
3042 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
3045 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3046 flag is set. Such call could not be a stmt in the middle of a bb. */
3049 gimple_call_ctrl_altering_p (const gcall
*gs
)
3051 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
3055 gimple_call_ctrl_altering_p (const gimple
*gs
)
3057 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3058 return gimple_call_ctrl_altering_p (gc
);
3062 /* Return the function type of the function called by GS. */
3065 gimple_call_fntype (const gcall
*gs
)
3067 if (gimple_call_internal_p (gs
))
3069 return gs
->u
.fntype
;
3073 gimple_call_fntype (const gimple
*gs
)
3075 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3076 return gimple_call_fntype (call_stmt
);
3079 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3082 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
3084 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
3085 call_stmt
->u
.fntype
= fntype
;
3089 /* Return the tree node representing the function called by call
3093 gimple_call_fn (const gcall
*gs
)
3099 gimple_call_fn (const gimple
*gs
)
3101 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3102 return gimple_call_fn (gc
);
3105 /* Return a pointer to the tree node representing the function called by call
3108 static inline tree
*
3109 gimple_call_fn_ptr (gcall
*gs
)
3114 static inline tree
*
3115 gimple_call_fn_ptr (gimple
*gs
)
3117 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3118 return gimple_call_fn_ptr (gc
);
3122 /* Set FN to be the function called by call statement GS. */
3125 gimple_call_set_fn (gcall
*gs
, tree fn
)
3127 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3132 /* Set FNDECL to be the function called by call statement GS. */
3135 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3137 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3138 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3139 build_pointer_type (TREE_TYPE (decl
)), decl
);
3143 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3145 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3146 gimple_call_set_fndecl (gc
, decl
);
3150 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3153 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3155 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3156 call_stmt
->u
.internal_fn
= fn
;
3160 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3161 Otherwise return NULL. This function is analogous to
3162 get_callee_fndecl in tree land. */
3165 gimple_call_fndecl (const gcall
*gs
)
3167 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3171 gimple_call_fndecl (const gimple
*gs
)
3173 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3174 return gimple_call_fndecl (gc
);
3178 /* Return the type returned by call statement GS. */
3181 gimple_call_return_type (const gcall
*gs
)
3183 tree type
= gimple_call_fntype (gs
);
3185 if (type
== NULL_TREE
)
3186 return TREE_TYPE (gimple_call_lhs (gs
));
3188 /* The type returned by a function is the type of its
3190 return TREE_TYPE (type
);
3194 /* Return the static chain for call statement GS. */
3197 gimple_call_chain (const gcall
*gs
)
3203 gimple_call_chain (const gimple
*gs
)
3205 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3206 return gimple_call_chain (gc
);
3210 /* Return a pointer to the static chain for call statement CALL_STMT. */
3212 static inline tree
*
3213 gimple_call_chain_ptr (gcall
*call_stmt
)
3215 return &call_stmt
->op
[2];
3218 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3221 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3223 call_stmt
->op
[2] = chain
;
3227 /* Return the number of arguments used by call statement GS. */
3229 static inline unsigned
3230 gimple_call_num_args (const gcall
*gs
)
3232 return gimple_num_ops (gs
) - 3;
3235 static inline unsigned
3236 gimple_call_num_args (const gimple
*gs
)
3238 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3239 return gimple_call_num_args (gc
);
3243 /* Return the argument at position INDEX for call statement GS. */
3246 gimple_call_arg (const gcall
*gs
, unsigned index
)
3248 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3249 return gs
->op
[index
+ 3];
3253 gimple_call_arg (const gimple
*gs
, unsigned index
)
3255 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3256 return gimple_call_arg (gc
, index
);
3260 /* Return a pointer to the argument at position INDEX for call
3263 static inline tree
*
3264 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3266 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3267 return &gs
->op
[index
+ 3];
3270 static inline tree
*
3271 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3273 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3274 return gimple_call_arg_ptr (gc
, index
);
3278 /* Set ARG to be the argument at position INDEX for call statement GS. */
3281 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3283 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3284 gs
->op
[index
+ 3] = arg
;
3288 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3290 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3291 gimple_call_set_arg (gc
, index
, arg
);
3295 /* If TAIL_P is true, mark call statement S as being a tail call
3296 (i.e., a call just before the exit of a function). These calls are
3297 candidate for tail call optimization. */
3300 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3303 s
->subcode
|= GF_CALL_TAILCALL
;
3305 s
->subcode
&= ~GF_CALL_TAILCALL
;
3309 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3312 gimple_call_tail_p (const gcall
*s
)
3314 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3317 /* Mark (or clear) call statement S as requiring tail call optimization. */
3320 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3323 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3325 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3328 /* Return true if call statement has been marked as requiring
3329 tail call optimization. */
3332 gimple_call_must_tail_p (const gcall
*s
)
3334 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3337 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3338 slot optimization. This transformation uses the target of the call
3339 expansion as the return slot for calls that return in memory. */
3342 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3344 if (return_slot_opt_p
)
3345 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3347 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3351 /* Return true if S is marked for return slot optimization. */
3354 gimple_call_return_slot_opt_p (const gcall
*s
)
3356 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3360 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3361 thunk to the thunked-to function. */
3364 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3367 s
->subcode
|= GF_CALL_FROM_THUNK
;
3369 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3373 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3376 gimple_call_from_thunk_p (gcall
*s
)
3378 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3382 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3383 argument pack in its argument list. */
3386 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3388 if (pass_arg_pack_p
)
3389 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3391 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3395 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3396 argument pack in its argument list. */
3399 gimple_call_va_arg_pack_p (const gcall
*s
)
3401 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3405 /* Return true if S is a noreturn call. */
3408 gimple_call_noreturn_p (const gcall
*s
)
3410 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3414 gimple_call_noreturn_p (const gimple
*s
)
3416 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3417 return gimple_call_noreturn_p (gc
);
3421 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3422 even if the called function can throw in other cases. */
3425 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3428 s
->subcode
|= GF_CALL_NOTHROW
;
3430 s
->subcode
&= ~GF_CALL_NOTHROW
;
3433 /* Return true if S is a nothrow call. */
3436 gimple_call_nothrow_p (gcall
*s
)
3438 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3441 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3442 is known to be emitted for VLA objects. Those are wrapped by
3443 stack_save/stack_restore calls and hence can't lead to unbounded
3444 stack growth even when they occur in loops. */
3447 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3450 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3452 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3455 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3458 gimple_call_alloca_for_var_p (gcall
*s
)
3460 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3464 gimple_call_alloca_for_var_p (gimple
*s
)
3466 const gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
3467 return (gc
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3470 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3471 pointers to nested function are descriptors instead of trampolines. */
3474 gimple_call_set_by_descriptor (gcall
*s
, bool by_descriptor_p
)
3476 if (by_descriptor_p
)
3477 s
->subcode
|= GF_CALL_BY_DESCRIPTOR
;
3479 s
->subcode
&= ~GF_CALL_BY_DESCRIPTOR
;
3482 /* Return true if S is a by-descriptor call. */
3485 gimple_call_by_descriptor_p (gcall
*s
)
3487 return (s
->subcode
& GF_CALL_BY_DESCRIPTOR
) != 0;
3490 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3493 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3495 dest_call
->subcode
= orig_call
->subcode
;
3499 /* Return a pointer to the points-to solution for the set of call-used
3500 variables of the call CALL_STMT. */
3502 static inline struct pt_solution
*
3503 gimple_call_use_set (gcall
*call_stmt
)
3505 return &call_stmt
->call_used
;
3508 /* As above, but const. */
3510 static inline const pt_solution
*
3511 gimple_call_use_set (const gcall
*call_stmt
)
3513 return &call_stmt
->call_used
;
3516 /* Return a pointer to the points-to solution for the set of call-used
3517 variables of the call CALL_STMT. */
3519 static inline struct pt_solution
*
3520 gimple_call_clobber_set (gcall
*call_stmt
)
3522 return &call_stmt
->call_clobbered
;
3525 /* As above, but const. */
3527 static inline const pt_solution
*
3528 gimple_call_clobber_set (const gcall
*call_stmt
)
3530 return &call_stmt
->call_clobbered
;
3534 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3538 gimple_has_lhs (const gimple
*stmt
)
3540 if (is_gimple_assign (stmt
))
3542 if (const gcall
*call
= dyn_cast
<const gcall
*> (stmt
))
3543 return gimple_call_lhs (call
) != NULL_TREE
;
3548 /* Return the code of the predicate computed by conditional statement GS. */
3550 static inline enum tree_code
3551 gimple_cond_code (const gcond
*gs
)
3553 return (enum tree_code
) gs
->subcode
;
3556 static inline enum tree_code
3557 gimple_cond_code (const gimple
*gs
)
3559 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3560 return gimple_cond_code (gc
);
3564 /* Set CODE to be the predicate code for the conditional statement GS. */
3567 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3573 /* Return the LHS of the predicate computed by conditional statement GS. */
3576 gimple_cond_lhs (const gcond
*gs
)
3582 gimple_cond_lhs (const gimple
*gs
)
3584 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3585 return gimple_cond_lhs (gc
);
3588 /* Return the pointer to the LHS of the predicate computed by conditional
3591 static inline tree
*
3592 gimple_cond_lhs_ptr (gcond
*gs
)
3597 /* Set LHS to be the LHS operand of the predicate computed by
3598 conditional statement GS. */
3601 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3607 /* Return the RHS operand of the predicate computed by conditional GS. */
3610 gimple_cond_rhs (const gcond
*gs
)
3616 gimple_cond_rhs (const gimple
*gs
)
3618 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3619 return gimple_cond_rhs (gc
);
3622 /* Return the pointer to the RHS operand of the predicate computed by
3625 static inline tree
*
3626 gimple_cond_rhs_ptr (gcond
*gs
)
3632 /* Set RHS to be the RHS operand of the predicate computed by
3633 conditional statement GS. */
3636 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3642 /* Return the label used by conditional statement GS when its
3643 predicate evaluates to true. */
3646 gimple_cond_true_label (const gcond
*gs
)
3652 /* Set LABEL to be the label used by conditional statement GS when its
3653 predicate evaluates to true. */
3656 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3662 /* Set LABEL to be the label used by conditional statement GS when its
3663 predicate evaluates to false. */
3666 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3672 /* Return the label used by conditional statement GS when its
3673 predicate evaluates to false. */
3676 gimple_cond_false_label (const gcond
*gs
)
3682 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3685 gimple_cond_make_false (gcond
*gs
)
3687 gimple_cond_set_lhs (gs
, boolean_false_node
);
3688 gimple_cond_set_rhs (gs
, boolean_false_node
);
3689 gs
->subcode
= NE_EXPR
;
3693 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3696 gimple_cond_make_true (gcond
*gs
)
3698 gimple_cond_set_lhs (gs
, boolean_true_node
);
3699 gimple_cond_set_rhs (gs
, boolean_false_node
);
3700 gs
->subcode
= NE_EXPR
;
3703 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3704 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3707 gimple_cond_true_p (const gcond
*gs
)
3709 tree lhs
= gimple_cond_lhs (gs
);
3710 tree rhs
= gimple_cond_rhs (gs
);
3711 enum tree_code code
= gimple_cond_code (gs
);
3713 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3716 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3719 if (code
== NE_EXPR
&& lhs
!= rhs
)
3722 if (code
== EQ_EXPR
&& lhs
== rhs
)
3728 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3729 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3732 gimple_cond_false_p (const gcond
*gs
)
3734 tree lhs
= gimple_cond_lhs (gs
);
3735 tree rhs
= gimple_cond_rhs (gs
);
3736 enum tree_code code
= gimple_cond_code (gs
);
3738 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3741 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3744 if (code
== NE_EXPR
&& lhs
== rhs
)
3747 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3753 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3756 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3759 gimple_cond_set_code (stmt
, code
);
3760 gimple_cond_set_lhs (stmt
, lhs
);
3761 gimple_cond_set_rhs (stmt
, rhs
);
3764 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3767 gimple_label_label (const glabel
*gs
)
3773 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3777 gimple_label_set_label (glabel
*gs
, tree label
)
3783 /* Return the destination of the unconditional jump GS. */
3786 gimple_goto_dest (const gimple
*gs
)
3788 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3789 return gimple_op (gs
, 0);
3793 /* Set DEST to be the destination of the unconditonal jump GS. */
3796 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3802 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3805 gimple_bind_vars (const gbind
*bind_stmt
)
3807 return bind_stmt
->vars
;
3811 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3815 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3817 bind_stmt
->vars
= vars
;
3821 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3825 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3827 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3831 static inline gimple_seq
*
3832 gimple_bind_body_ptr (gbind
*bind_stmt
)
3834 return &bind_stmt
->body
;
3837 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3839 static inline gimple_seq
3840 gimple_bind_body (const gbind
*gs
)
3842 return *gimple_bind_body_ptr (const_cast <gbind
*> (gs
));
3846 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3850 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3852 bind_stmt
->body
= seq
;
3856 /* Append a statement to the end of a GIMPLE_BIND's body. */
3859 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3861 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3865 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3868 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3870 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3874 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3875 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3878 gimple_bind_block (const gbind
*bind_stmt
)
3880 return bind_stmt
->block
;
3884 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3888 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3890 gcc_gimple_checking_assert (block
== NULL_TREE
3891 || TREE_CODE (block
) == BLOCK
);
3892 bind_stmt
->block
= block
;
3896 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3898 static inline unsigned
3899 gimple_asm_ninputs (const gasm
*asm_stmt
)
3901 return asm_stmt
->ni
;
3905 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3907 static inline unsigned
3908 gimple_asm_noutputs (const gasm
*asm_stmt
)
3910 return asm_stmt
->no
;
3914 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3916 static inline unsigned
3917 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3919 return asm_stmt
->nc
;
3922 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3924 static inline unsigned
3925 gimple_asm_nlabels (const gasm
*asm_stmt
)
3927 return asm_stmt
->nl
;
3930 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3933 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3935 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3936 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3939 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3942 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3944 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3945 && TREE_CODE (in_op
) == TREE_LIST
);
3946 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3950 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3953 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3955 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3956 return asm_stmt
->op
[index
];
3959 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3962 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
3964 gcc_gimple_checking_assert (index
< asm_stmt
->no
3965 && TREE_CODE (out_op
) == TREE_LIST
);
3966 asm_stmt
->op
[index
] = out_op
;
3970 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3973 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
3975 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3976 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
3980 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3983 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
3985 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3986 && TREE_CODE (clobber_op
) == TREE_LIST
);
3987 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
3990 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3993 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
3995 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3996 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
];
3999 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4002 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
4004 gcc_gimple_checking_assert (index
< asm_stmt
->nl
4005 && TREE_CODE (label_op
) == TREE_LIST
);
4006 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
4009 /* Return the string representing the assembly instruction in
4010 GIMPLE_ASM ASM_STMT. */
4012 static inline const char *
4013 gimple_asm_string (const gasm
*asm_stmt
)
4015 return asm_stmt
->string
;
4019 /* Return true if ASM_STMT is marked volatile. */
4022 gimple_asm_volatile_p (const gasm
*asm_stmt
)
4024 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
4028 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4031 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
4034 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
4036 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
4040 /* Return true if ASM_STMT is marked inline. */
4043 gimple_asm_inline_p (const gasm
*asm_stmt
)
4045 return (asm_stmt
->subcode
& GF_ASM_INLINE
) != 0;
4049 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4052 gimple_asm_set_inline (gasm
*asm_stmt
, bool inline_p
)
4055 asm_stmt
->subcode
|= GF_ASM_INLINE
;
4057 asm_stmt
->subcode
&= ~GF_ASM_INLINE
;
4061 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4064 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
4067 asm_stmt
->subcode
|= GF_ASM_INPUT
;
4069 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
4073 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4076 gimple_asm_input_p (const gasm
*asm_stmt
)
4078 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
4082 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4085 gimple_catch_types (const gcatch
*catch_stmt
)
4087 return catch_stmt
->types
;
4091 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4093 static inline tree
*
4094 gimple_catch_types_ptr (gcatch
*catch_stmt
)
4096 return &catch_stmt
->types
;
4100 /* Return a pointer to the GIMPLE sequence representing the body of
4101 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4103 static inline gimple_seq
*
4104 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
4106 return &catch_stmt
->handler
;
4110 /* Return the GIMPLE sequence representing the body of the handler of
4111 GIMPLE_CATCH statement CATCH_STMT. */
4113 static inline gimple_seq
4114 gimple_catch_handler (const gcatch
*catch_stmt
)
4116 return *gimple_catch_handler_ptr (const_cast <gcatch
*> (catch_stmt
));
4120 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4123 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
4125 catch_stmt
->types
= t
;
4129 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4132 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
4134 catch_stmt
->handler
= handler
;
4138 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4141 gimple_eh_filter_types (const gimple
*gs
)
4143 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
4144 return eh_filter_stmt
->types
;
4148 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4151 static inline tree
*
4152 gimple_eh_filter_types_ptr (gimple
*gs
)
4154 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4155 return &eh_filter_stmt
->types
;
4159 /* Return a pointer to the sequence of statement to execute when
4160 GIMPLE_EH_FILTER statement fails. */
4162 static inline gimple_seq
*
4163 gimple_eh_filter_failure_ptr (gimple
*gs
)
4165 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4166 return &eh_filter_stmt
->failure
;
4170 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4173 static inline gimple_seq
4174 gimple_eh_filter_failure (const gimple
*gs
)
4176 return *gimple_eh_filter_failure_ptr (const_cast <gimple
*> (gs
));
4180 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4184 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4186 eh_filter_stmt
->types
= types
;
4190 /* Set FAILURE to be the sequence of statements to execute on failure
4191 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4194 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4197 eh_filter_stmt
->failure
= failure
;
4200 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4203 gimple_eh_must_not_throw_fndecl (const geh_mnt
*eh_mnt_stmt
)
4205 return eh_mnt_stmt
->fndecl
;
4208 /* Set the function decl to be called by GS to DECL. */
4211 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4214 eh_mnt_stmt
->fndecl
= decl
;
4217 /* GIMPLE_EH_ELSE accessors. */
4219 static inline gimple_seq
*
4220 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4222 return &eh_else_stmt
->n_body
;
4225 static inline gimple_seq
4226 gimple_eh_else_n_body (const geh_else
*eh_else_stmt
)
4228 return *gimple_eh_else_n_body_ptr (const_cast <geh_else
*> (eh_else_stmt
));
4231 static inline gimple_seq
*
4232 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4234 return &eh_else_stmt
->e_body
;
4237 static inline gimple_seq
4238 gimple_eh_else_e_body (const geh_else
*eh_else_stmt
)
4240 return *gimple_eh_else_e_body_ptr (const_cast <geh_else
*> (eh_else_stmt
));
4244 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4246 eh_else_stmt
->n_body
= seq
;
4250 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4252 eh_else_stmt
->e_body
= seq
;
4255 /* GIMPLE_TRY accessors. */
4257 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4258 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4260 static inline enum gimple_try_flags
4261 gimple_try_kind (const gimple
*gs
)
4263 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4264 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4268 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4271 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4273 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4274 || kind
== GIMPLE_TRY_FINALLY
);
4275 if (gimple_try_kind (gs
) != kind
)
4276 gs
->subcode
= (unsigned int) kind
;
4280 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4283 gimple_try_catch_is_cleanup (const gimple
*gs
)
4285 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4286 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4290 /* Return a pointer to the sequence of statements used as the
4291 body for GIMPLE_TRY GS. */
4293 static inline gimple_seq
*
4294 gimple_try_eval_ptr (gimple
*gs
)
4296 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4297 return &try_stmt
->eval
;
4301 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4303 static inline gimple_seq
4304 gimple_try_eval (const gimple
*gs
)
4306 return *gimple_try_eval_ptr (const_cast <gimple
*> (gs
));
4310 /* Return a pointer to the sequence of statements used as the cleanup body for
4313 static inline gimple_seq
*
4314 gimple_try_cleanup_ptr (gimple
*gs
)
4316 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4317 return &try_stmt
->cleanup
;
4321 /* Return the sequence of statements used as the cleanup body for
4324 static inline gimple_seq
4325 gimple_try_cleanup (const gimple
*gs
)
4327 return *gimple_try_cleanup_ptr (const_cast <gimple
*> (gs
));
4331 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4334 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4336 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4337 if (catch_is_cleanup
)
4338 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4340 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4344 /* Set EVAL to be the sequence of statements to use as the body for
4345 GIMPLE_TRY TRY_STMT. */
4348 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4350 try_stmt
->eval
= eval
;
4354 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4355 body for GIMPLE_TRY TRY_STMT. */
4358 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4360 try_stmt
->cleanup
= cleanup
;
4364 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4366 static inline gimple_seq
*
4367 gimple_wce_cleanup_ptr (gimple
*gs
)
4369 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4370 return &wce_stmt
->cleanup
;
4374 /* Return the cleanup sequence for cleanup statement GS. */
4376 static inline gimple_seq
4377 gimple_wce_cleanup (gimple
*gs
)
4379 return *gimple_wce_cleanup_ptr (gs
);
4383 /* Set CLEANUP to be the cleanup sequence for GS. */
4386 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4388 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4389 wce_stmt
->cleanup
= cleanup
;
4393 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4396 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4398 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4399 return gs
->subcode
!= 0;
4403 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4406 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4408 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4409 gs
->subcode
= (unsigned int) eh_only_p
;
4413 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4415 static inline unsigned
4416 gimple_phi_capacity (const gimple
*gs
)
4418 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4419 return phi_stmt
->capacity
;
4423 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4424 be exactly the number of incoming edges for the basic block holding
4427 static inline unsigned
4428 gimple_phi_num_args (const gimple
*gs
)
4430 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4431 return phi_stmt
->nargs
;
4435 /* Return the SSA name created by GIMPLE_PHI GS. */
4438 gimple_phi_result (const gphi
*gs
)
4444 gimple_phi_result (const gimple
*gs
)
4446 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4447 return gimple_phi_result (phi_stmt
);
4450 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4452 static inline tree
*
4453 gimple_phi_result_ptr (gphi
*gs
)
4458 static inline tree
*
4459 gimple_phi_result_ptr (gimple
*gs
)
4461 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4462 return gimple_phi_result_ptr (phi_stmt
);
4465 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4468 gimple_phi_set_result (gphi
*phi
, tree result
)
4470 phi
->result
= result
;
4471 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4472 SSA_NAME_DEF_STMT (result
) = phi
;
4476 /* Return the PHI argument corresponding to incoming edge INDEX for
4479 static inline struct phi_arg_d
*
4480 gimple_phi_arg (gphi
*gs
, unsigned index
)
4482 gcc_gimple_checking_assert (index
< gs
->nargs
);
4483 return &(gs
->args
[index
]);
4486 static inline const phi_arg_d
*
4487 gimple_phi_arg (const gphi
*gs
, unsigned index
)
4489 gcc_gimple_checking_assert (index
< gs
->nargs
);
4490 return &(gs
->args
[index
]);
4493 static inline struct phi_arg_d
*
4494 gimple_phi_arg (gimple
*gs
, unsigned index
)
4496 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4497 return gimple_phi_arg (phi_stmt
, index
);
4500 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4501 for GIMPLE_PHI PHI. */
4504 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4506 gcc_gimple_checking_assert (index
< phi
->nargs
);
4507 phi
->args
[index
] = *phiarg
;
4510 /* Return the PHI nodes for basic block BB, or NULL if there are no
4513 static inline gimple_seq
4514 phi_nodes (const_basic_block bb
)
4516 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4517 return bb
->il
.gimple
.phi_nodes
;
4520 /* Return a pointer to the PHI nodes for basic block BB. */
4522 static inline gimple_seq
*
4523 phi_nodes_ptr (basic_block bb
)
4525 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4526 return &bb
->il
.gimple
.phi_nodes
;
4529 /* Return the tree operand for argument I of PHI node GS. */
4532 gimple_phi_arg_def (const gphi
*gs
, size_t index
)
4534 return gimple_phi_arg (gs
, index
)->def
;
4538 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4540 return gimple_phi_arg (gs
, index
)->def
;
4544 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4546 static inline tree
*
4547 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4549 return &gimple_phi_arg (phi
, index
)->def
;
4552 /* Return the edge associated with argument I of phi node PHI. */
4555 gimple_phi_arg_edge (const gphi
*phi
, size_t i
)
4557 return EDGE_PRED (gimple_bb (phi
), i
);
4560 /* Return the source location of gimple argument I of phi node PHI. */
4562 static inline location_t
4563 gimple_phi_arg_location (const gphi
*phi
, size_t i
)
4565 return gimple_phi_arg (phi
, i
)->locus
;
4568 /* Return the source location of the argument on edge E of phi node PHI. */
4570 static inline location_t
4571 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4573 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4576 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4579 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, location_t loc
)
4581 gimple_phi_arg (phi
, i
)->locus
= loc
;
4584 /* Return TRUE if argument I of phi node PHI has a location record. */
4587 gimple_phi_arg_has_location (const gphi
*phi
, size_t i
)
4589 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4593 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4596 gimple_resx_region (const gresx
*resx_stmt
)
4598 return resx_stmt
->region
;
4601 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4604 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4606 resx_stmt
->region
= region
;
4609 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4612 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4614 return eh_dispatch_stmt
->region
;
4617 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4618 EH_DISPATCH_STMT. */
4621 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4623 eh_dispatch_stmt
->region
= region
;
4626 /* Return the number of labels associated with the switch statement GS. */
4628 static inline unsigned
4629 gimple_switch_num_labels (const gswitch
*gs
)
4632 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4633 num_ops
= gimple_num_ops (gs
);
4634 gcc_gimple_checking_assert (num_ops
> 1);
4639 /* Set NLABELS to be the number of labels for the switch statement GS. */
4642 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4644 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4645 gimple_set_num_ops (g
, nlabels
+ 1);
4649 /* Return the index variable used by the switch statement GS. */
4652 gimple_switch_index (const gswitch
*gs
)
4658 /* Return a pointer to the index variable for the switch statement GS. */
4660 static inline tree
*
4661 gimple_switch_index_ptr (gswitch
*gs
)
4667 /* Set INDEX to be the index variable for switch statement GS. */
4670 gimple_switch_set_index (gswitch
*gs
, tree index
)
4672 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4677 /* Return the label numbered INDEX. The default label is 0, followed by any
4678 labels in a switch statement. */
4681 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4683 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4684 return gs
->op
[index
+ 1];
4687 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4690 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4692 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4693 && (label
== NULL_TREE
4694 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4695 gs
->op
[index
+ 1] = label
;
4698 /* Return the default label for a switch statement. */
4701 gimple_switch_default_label (const gswitch
*gs
)
4703 tree label
= gimple_switch_label (gs
, 0);
4704 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4708 /* Set the default label for a switch statement. */
4711 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4713 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4714 gimple_switch_set_label (gs
, 0, label
);
4717 /* Return true if GS is a GIMPLE_DEBUG statement. */
4720 is_gimple_debug (const gimple
*gs
)
4722 return gimple_code (gs
) == GIMPLE_DEBUG
;
4726 /* Return the first nondebug statement in GIMPLE sequence S. */
4728 static inline gimple
*
4729 gimple_seq_first_nondebug_stmt (gimple_seq s
)
4731 gimple_seq_node n
= gimple_seq_first (s
);
4732 while (n
&& is_gimple_debug (n
))
4738 /* Return the last nondebug statement in GIMPLE sequence S. */
4740 static inline gimple
*
4741 gimple_seq_last_nondebug_stmt (gimple_seq s
)
4744 for (n
= gimple_seq_last (s
);
4745 n
&& is_gimple_debug (n
);
4753 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4756 gimple_debug_bind_p (const gimple
*s
)
4758 if (is_gimple_debug (s
))
4759 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4764 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4767 gimple_debug_bind_get_var (const gimple
*dbg
)
4769 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4770 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4771 return gimple_op (dbg
, 0);
4774 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4778 gimple_debug_bind_get_value (const gimple
*dbg
)
4780 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4781 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4782 return gimple_op (dbg
, 1);
4785 /* Return a pointer to the value bound to the variable in a
4786 GIMPLE_DEBUG bind statement. */
4788 static inline tree
*
4789 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4791 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4792 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4793 return gimple_op_ptr (dbg
, 1);
4796 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4799 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4801 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4802 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4803 gimple_set_op (dbg
, 0, var
);
4806 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4810 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4812 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4813 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4814 gimple_set_op (dbg
, 1, value
);
4817 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4819 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4821 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4825 gimple_debug_bind_reset_value (gimple
*dbg
)
4827 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4828 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4829 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4832 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4836 gimple_debug_bind_has_value_p (gimple
*dbg
)
4838 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4839 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4840 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4843 #undef GIMPLE_DEBUG_BIND_NOVALUE
4845 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4848 gimple_debug_source_bind_p (const gimple
*s
)
4850 if (is_gimple_debug (s
))
4851 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4856 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4859 gimple_debug_source_bind_get_var (const gimple
*dbg
)
4861 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4862 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4863 return gimple_op (dbg
, 0);
4866 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4870 gimple_debug_source_bind_get_value (const gimple
*dbg
)
4872 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4873 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4874 return gimple_op (dbg
, 1);
4877 /* Return a pointer to the value bound to the variable in a
4878 GIMPLE_DEBUG source bind statement. */
4880 static inline tree
*
4881 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4883 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4884 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4885 return gimple_op_ptr (dbg
, 1);
4888 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4891 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4893 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4894 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4895 gimple_set_op (dbg
, 0, var
);
4898 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4902 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4904 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4905 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4906 gimple_set_op (dbg
, 1, value
);
4909 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4912 gimple_debug_begin_stmt_p (const gimple
*s
)
4914 if (is_gimple_debug (s
))
4915 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
;
4920 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4923 gimple_debug_inline_entry_p (const gimple
*s
)
4925 if (is_gimple_debug (s
))
4926 return s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4931 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4934 gimple_debug_nonbind_marker_p (const gimple
*s
)
4936 if (is_gimple_debug (s
))
4937 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
4938 || s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4943 /* Return the line number for EXPR, or return -1 if we have no line
4944 number information for it. */
4946 get_lineno (const gimple
*stmt
)
4953 loc
= gimple_location (stmt
);
4954 if (loc
== UNKNOWN_LOCATION
)
4957 return LOCATION_LINE (loc
);
4960 /* Return a pointer to the body for the OMP statement GS. */
4962 static inline gimple_seq
*
4963 gimple_omp_body_ptr (gimple
*gs
)
4965 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4968 /* Return the body for the OMP statement GS. */
4970 static inline gimple_seq
4971 gimple_omp_body (const gimple
*gs
)
4973 return *gimple_omp_body_ptr (const_cast <gimple
*> (gs
));
4976 /* Set BODY to be the body for the OMP statement GS. */
4979 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
4981 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4985 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4988 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
4990 return crit_stmt
->name
;
4994 /* Return a pointer to the name associated with OMP critical statement
4997 static inline tree
*
4998 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
5000 return &crit_stmt
->name
;
5004 /* Set NAME to be the name associated with OMP critical statement
5008 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
5010 crit_stmt
->name
= name
;
5014 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5017 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
5019 return crit_stmt
->clauses
;
5023 /* Return a pointer to the clauses associated with OMP critical statement
5026 static inline tree
*
5027 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
5029 return &crit_stmt
->clauses
;
5033 /* Set CLAUSES to be the clauses associated with OMP critical statement
5037 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
5039 crit_stmt
->clauses
= clauses
;
5043 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5046 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
5048 return ord_stmt
->clauses
;
5052 /* Return a pointer to the clauses associated with OMP ordered statement
5055 static inline tree
*
5056 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
5058 return &ord_stmt
->clauses
;
5062 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5066 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
5068 ord_stmt
->clauses
= clauses
;
5072 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5075 gimple_omp_scan_clauses (const gomp_scan
*scan_stmt
)
5077 return scan_stmt
->clauses
;
5081 /* Return a pointer to the clauses associated with OMP scan statement
5084 static inline tree
*
5085 gimple_omp_scan_clauses_ptr (gomp_scan
*scan_stmt
)
5087 return &scan_stmt
->clauses
;
5091 /* Set CLAUSES to be the clauses associated with OMP scan statement
5095 gimple_omp_scan_set_clauses (gomp_scan
*scan_stmt
, tree clauses
)
5097 scan_stmt
->clauses
= clauses
;
5101 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5104 gimple_omp_taskgroup_clauses (const gimple
*gs
)
5106 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5108 static_cast <const gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5112 /* Return a pointer to the clauses associated with OMP taskgroup statement
5115 static inline tree
*
5116 gimple_omp_taskgroup_clauses_ptr (gimple
*gs
)
5118 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5119 return &static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5123 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5127 gimple_omp_taskgroup_set_clauses (gimple
*gs
, tree clauses
)
5129 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5130 static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
5135 /* Return the kind of the OMP_FOR statemement G. */
5138 gimple_omp_for_kind (const gimple
*g
)
5140 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5141 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
5145 /* Set the kind of the OMP_FOR statement G. */
5148 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
5150 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
5151 | (kind
& GF_OMP_FOR_KIND_MASK
);
5155 /* Return true if OMP_FOR statement G has the
5156 GF_OMP_FOR_COMBINED flag set. */
5159 gimple_omp_for_combined_p (const gimple
*g
)
5161 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5162 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
5166 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5167 the boolean value of COMBINED_P. */
5170 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
5173 g
->subcode
|= GF_OMP_FOR_COMBINED
;
5175 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
5179 /* Return true if the OMP_FOR statement G has the
5180 GF_OMP_FOR_COMBINED_INTO flag set. */
5183 gimple_omp_for_combined_into_p (const gimple
*g
)
5185 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5186 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
5190 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5191 on the boolean value of COMBINED_P. */
5194 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
5197 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
5199 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
5203 /* Return the clauses associated with the OMP_FOR statement GS. */
5206 gimple_omp_for_clauses (const gimple
*gs
)
5208 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5209 return omp_for_stmt
->clauses
;
5213 /* Return a pointer to the clauses associated with the OMP_FOR statement
5216 static inline tree
*
5217 gimple_omp_for_clauses_ptr (gimple
*gs
)
5219 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5220 return &omp_for_stmt
->clauses
;
5224 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5228 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
5230 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5231 omp_for_stmt
->clauses
= clauses
;
5235 /* Get the collapse count of the OMP_FOR statement GS. */
5237 static inline size_t
5238 gimple_omp_for_collapse (const gimple
*gs
)
5240 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5241 return omp_for_stmt
->collapse
;
5245 /* Return the condition code associated with the OMP_FOR statement GS. */
5247 static inline enum tree_code
5248 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
5250 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5251 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5252 return omp_for_stmt
->iter
[i
].cond
;
5256 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5259 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
5261 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5262 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5263 && i
< omp_for_stmt
->collapse
);
5264 omp_for_stmt
->iter
[i
].cond
= cond
;
5268 /* Return the index variable for the OMP_FOR statement GS. */
5271 gimple_omp_for_index (const gimple
*gs
, size_t i
)
5273 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5274 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5275 return omp_for_stmt
->iter
[i
].index
;
5279 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5281 static inline tree
*
5282 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
5284 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5285 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5286 return &omp_for_stmt
->iter
[i
].index
;
5290 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5293 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
5295 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5296 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5297 omp_for_stmt
->iter
[i
].index
= index
;
5301 /* Return the initial value for the OMP_FOR statement GS. */
5304 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
5306 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5307 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5308 return omp_for_stmt
->iter
[i
].initial
;
5312 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5314 static inline tree
*
5315 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
5317 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5318 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5319 return &omp_for_stmt
->iter
[i
].initial
;
5323 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5326 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5328 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5329 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5330 omp_for_stmt
->iter
[i
].initial
= initial
;
5334 /* Return the final value for the OMP_FOR statement GS. */
5337 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5339 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5340 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5341 return omp_for_stmt
->iter
[i
].final
;
5345 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5347 static inline tree
*
5348 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5350 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5351 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5352 return &omp_for_stmt
->iter
[i
].final
;
5356 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5359 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5361 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5362 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5363 omp_for_stmt
->iter
[i
].final
= final
;
5367 /* Return the increment value for the OMP_FOR statement GS. */
5370 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5372 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5373 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5374 return omp_for_stmt
->iter
[i
].incr
;
5378 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5380 static inline tree
*
5381 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5383 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5384 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5385 return &omp_for_stmt
->iter
[i
].incr
;
5389 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5392 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5394 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5395 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5396 omp_for_stmt
->iter
[i
].incr
= incr
;
5400 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5401 statement GS starts. */
5403 static inline gimple_seq
*
5404 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5406 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5407 return &omp_for_stmt
->pre_body
;
5411 /* Return the sequence of statements to execute before the OMP_FOR
5412 statement GS starts. */
5414 static inline gimple_seq
5415 gimple_omp_for_pre_body (const gimple
*gs
)
5417 return *gimple_omp_for_pre_body_ptr (const_cast <gimple
*> (gs
));
5421 /* Set PRE_BODY to be the sequence of statements to execute before the
5422 OMP_FOR statement GS starts. */
5425 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5427 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5428 omp_for_stmt
->pre_body
= pre_body
;
5431 /* Return the clauses associated with OMP_PARALLEL GS. */
5434 gimple_omp_parallel_clauses (const gimple
*gs
)
5436 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5437 return omp_parallel_stmt
->clauses
;
5441 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5443 static inline tree
*
5444 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5446 return &omp_parallel_stmt
->clauses
;
5450 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5453 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5456 omp_parallel_stmt
->clauses
= clauses
;
5460 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5463 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5465 return omp_parallel_stmt
->child_fn
;
5468 /* Return a pointer to the child function used to hold the body of
5469 OMP_PARALLEL_STMT. */
5471 static inline tree
*
5472 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5474 return &omp_parallel_stmt
->child_fn
;
5478 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5481 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5484 omp_parallel_stmt
->child_fn
= child_fn
;
5488 /* Return the artificial argument used to send variables and values
5489 from the parent to the children threads in OMP_PARALLEL_STMT. */
5492 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5494 return omp_parallel_stmt
->data_arg
;
5498 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5500 static inline tree
*
5501 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5503 return &omp_parallel_stmt
->data_arg
;
5507 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5510 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5513 omp_parallel_stmt
->data_arg
= data_arg
;
5516 /* Return the clauses associated with OMP_TASK GS. */
5519 gimple_omp_task_clauses (const gimple
*gs
)
5521 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5522 return omp_task_stmt
->clauses
;
5526 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5528 static inline tree
*
5529 gimple_omp_task_clauses_ptr (gimple
*gs
)
5531 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5532 return &omp_task_stmt
->clauses
;
5536 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5540 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5542 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5543 omp_task_stmt
->clauses
= clauses
;
5547 /* Return true if OMP task statement G has the
5548 GF_OMP_TASK_TASKLOOP flag set. */
5551 gimple_omp_task_taskloop_p (const gimple
*g
)
5553 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5554 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5558 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5559 value of TASKLOOP_P. */
5562 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5564 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5566 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5568 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5572 /* Return true if OMP task statement G has the
5573 GF_OMP_TASK_TASKWAIT flag set. */
5576 gimple_omp_task_taskwait_p (const gimple
*g
)
5578 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5579 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKWAIT
) != 0;
5583 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5584 value of TASKWAIT_P. */
5587 gimple_omp_task_set_taskwait_p (gimple
*g
, bool taskwait_p
)
5589 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5591 g
->subcode
|= GF_OMP_TASK_TASKWAIT
;
5593 g
->subcode
&= ~GF_OMP_TASK_TASKWAIT
;
5597 /* Return the child function used to hold the body of OMP_TASK GS. */
5600 gimple_omp_task_child_fn (const gimple
*gs
)
5602 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5603 return omp_task_stmt
->child_fn
;
5606 /* Return a pointer to the child function used to hold the body of
5609 static inline tree
*
5610 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5612 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5613 return &omp_task_stmt
->child_fn
;
5617 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5620 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5622 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5623 omp_task_stmt
->child_fn
= child_fn
;
5627 /* Return the artificial argument used to send variables and values
5628 from the parent to the children threads in OMP_TASK GS. */
5631 gimple_omp_task_data_arg (const gimple
*gs
)
5633 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5634 return omp_task_stmt
->data_arg
;
5638 /* Return a pointer to the data argument for OMP_TASK GS. */
5640 static inline tree
*
5641 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5643 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5644 return &omp_task_stmt
->data_arg
;
5648 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5651 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5653 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5654 omp_task_stmt
->data_arg
= data_arg
;
5658 /* Return the clauses associated with OMP_TASK GS. */
5661 gimple_omp_taskreg_clauses (const gimple
*gs
)
5663 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5664 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5665 return omp_taskreg_stmt
->clauses
;
5669 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5671 static inline tree
*
5672 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5674 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5675 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5676 return &omp_taskreg_stmt
->clauses
;
5680 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5684 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5686 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5687 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5688 omp_taskreg_stmt
->clauses
= clauses
;
5692 /* Return the child function used to hold the body of OMP_TASK GS. */
5695 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5697 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5698 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5699 return omp_taskreg_stmt
->child_fn
;
5702 /* Return a pointer to the child function used to hold the body of
5705 static inline tree
*
5706 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5708 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5709 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5710 return &omp_taskreg_stmt
->child_fn
;
5714 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5717 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5719 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5720 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5721 omp_taskreg_stmt
->child_fn
= child_fn
;
5725 /* Return the artificial argument used to send variables and values
5726 from the parent to the children threads in OMP_TASK GS. */
5729 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5731 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5732 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5733 return omp_taskreg_stmt
->data_arg
;
5737 /* Return a pointer to the data argument for OMP_TASK GS. */
5739 static inline tree
*
5740 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5742 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5743 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5744 return &omp_taskreg_stmt
->data_arg
;
5748 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5751 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5753 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5754 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5755 omp_taskreg_stmt
->data_arg
= data_arg
;
5759 /* Return the copy function used to hold the body of OMP_TASK GS. */
5762 gimple_omp_task_copy_fn (const gimple
*gs
)
5764 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5765 return omp_task_stmt
->copy_fn
;
5768 /* Return a pointer to the copy function used to hold the body of
5771 static inline tree
*
5772 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5774 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5775 return &omp_task_stmt
->copy_fn
;
5779 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5782 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5784 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5785 omp_task_stmt
->copy_fn
= copy_fn
;
5789 /* Return size of the data block in bytes in OMP_TASK GS. */
5792 gimple_omp_task_arg_size (const gimple
*gs
)
5794 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5795 return omp_task_stmt
->arg_size
;
5799 /* Return a pointer to the data block size for OMP_TASK GS. */
5801 static inline tree
*
5802 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5804 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5805 return &omp_task_stmt
->arg_size
;
5809 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5812 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5814 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5815 omp_task_stmt
->arg_size
= arg_size
;
5819 /* Return align of the data block in bytes in OMP_TASK GS. */
5822 gimple_omp_task_arg_align (const gimple
*gs
)
5824 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5825 return omp_task_stmt
->arg_align
;
5829 /* Return a pointer to the data block align for OMP_TASK GS. */
5831 static inline tree
*
5832 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5834 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5835 return &omp_task_stmt
->arg_align
;
5839 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5842 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5844 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5845 omp_task_stmt
->arg_align
= arg_align
;
5849 /* Return the clauses associated with OMP_SINGLE GS. */
5852 gimple_omp_single_clauses (const gimple
*gs
)
5854 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5855 return omp_single_stmt
->clauses
;
5859 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5861 static inline tree
*
5862 gimple_omp_single_clauses_ptr (gimple
*gs
)
5864 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5865 return &omp_single_stmt
->clauses
;
5869 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5872 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5874 omp_single_stmt
->clauses
= clauses
;
5878 /* Return the clauses associated with OMP_TARGET GS. */
5881 gimple_omp_target_clauses (const gimple
*gs
)
5883 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5884 return omp_target_stmt
->clauses
;
5888 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5890 static inline tree
*
5891 gimple_omp_target_clauses_ptr (gimple
*gs
)
5893 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5894 return &omp_target_stmt
->clauses
;
5898 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5901 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5904 omp_target_stmt
->clauses
= clauses
;
5908 /* Return the kind of the OMP_TARGET G. */
5911 gimple_omp_target_kind (const gimple
*g
)
5913 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5914 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5918 /* Set the kind of the OMP_TARGET G. */
5921 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5923 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5924 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5928 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5931 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5933 return omp_target_stmt
->child_fn
;
5936 /* Return a pointer to the child function used to hold the body of
5939 static inline tree
*
5940 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5942 return &omp_target_stmt
->child_fn
;
5946 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5949 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
5952 omp_target_stmt
->child_fn
= child_fn
;
5956 /* Return the artificial argument used to send variables and values
5957 from the parent to the children threads in OMP_TARGET_STMT. */
5960 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
5962 return omp_target_stmt
->data_arg
;
5966 /* Return a pointer to the data argument for OMP_TARGET GS. */
5968 static inline tree
*
5969 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
5971 return &omp_target_stmt
->data_arg
;
5975 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5978 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
5981 omp_target_stmt
->data_arg
= data_arg
;
5985 /* Return the clauses associated with OMP_TEAMS GS. */
5988 gimple_omp_teams_clauses (const gimple
*gs
)
5990 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
5991 return omp_teams_stmt
->clauses
;
5995 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5997 static inline tree
*
5998 gimple_omp_teams_clauses_ptr (gimple
*gs
)
6000 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
6001 return &omp_teams_stmt
->clauses
;
6005 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6008 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
6010 omp_teams_stmt
->clauses
= clauses
;
6013 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6016 gimple_omp_teams_child_fn (const gomp_teams
*omp_teams_stmt
)
6018 return omp_teams_stmt
->child_fn
;
6021 /* Return a pointer to the child function used to hold the body of
6024 static inline tree
*
6025 gimple_omp_teams_child_fn_ptr (gomp_teams
*omp_teams_stmt
)
6027 return &omp_teams_stmt
->child_fn
;
6031 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6034 gimple_omp_teams_set_child_fn (gomp_teams
*omp_teams_stmt
, tree child_fn
)
6036 omp_teams_stmt
->child_fn
= child_fn
;
6040 /* Return the artificial argument used to send variables and values
6041 from the parent to the children threads in OMP_TEAMS_STMT. */
6044 gimple_omp_teams_data_arg (const gomp_teams
*omp_teams_stmt
)
6046 return omp_teams_stmt
->data_arg
;
6050 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6052 static inline tree
*
6053 gimple_omp_teams_data_arg_ptr (gomp_teams
*omp_teams_stmt
)
6055 return &omp_teams_stmt
->data_arg
;
6059 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6062 gimple_omp_teams_set_data_arg (gomp_teams
*omp_teams_stmt
, tree data_arg
)
6064 omp_teams_stmt
->data_arg
= data_arg
;
6067 /* Return the host flag of an OMP_TEAMS_STMT. */
6070 gimple_omp_teams_host (const gomp_teams
*omp_teams_stmt
)
6072 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_HOST
) != 0;
6075 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6078 gimple_omp_teams_set_host (gomp_teams
*omp_teams_stmt
, bool value
)
6081 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_HOST
;
6083 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_HOST
;
6086 /* Return the clauses associated with OMP_SECTIONS GS. */
6089 gimple_omp_sections_clauses (const gimple
*gs
)
6091 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6092 return omp_sections_stmt
->clauses
;
6096 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6098 static inline tree
*
6099 gimple_omp_sections_clauses_ptr (gimple
*gs
)
6101 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6102 return &omp_sections_stmt
->clauses
;
6106 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6110 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
6112 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6113 omp_sections_stmt
->clauses
= clauses
;
6117 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6121 gimple_omp_sections_control (const gimple
*gs
)
6123 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6124 return omp_sections_stmt
->control
;
6128 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6131 static inline tree
*
6132 gimple_omp_sections_control_ptr (gimple
*gs
)
6134 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6135 return &omp_sections_stmt
->control
;
6139 /* Set CONTROL to be the set of clauses associated with the
6140 GIMPLE_OMP_SECTIONS in GS. */
6143 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
6145 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6146 omp_sections_stmt
->control
= control
;
6150 /* Set the value being stored in an atomic store. */
6153 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
6155 store_stmt
->val
= val
;
6159 /* Return the value being stored in an atomic store. */
6162 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
6164 return store_stmt
->val
;
6168 /* Return a pointer to the value being stored in an atomic store. */
6170 static inline tree
*
6171 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
6173 return &store_stmt
->val
;
6177 /* Set the LHS of an atomic load. */
6180 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
6182 load_stmt
->lhs
= lhs
;
6186 /* Get the LHS of an atomic load. */
6189 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
6191 return load_stmt
->lhs
;
6195 /* Return a pointer to the LHS of an atomic load. */
6197 static inline tree
*
6198 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
6200 return &load_stmt
->lhs
;
6204 /* Set the RHS of an atomic load. */
6207 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
6209 load_stmt
->rhs
= rhs
;
6213 /* Get the RHS of an atomic load. */
6216 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
6218 return load_stmt
->rhs
;
6222 /* Return a pointer to the RHS of an atomic load. */
6224 static inline tree
*
6225 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
6227 return &load_stmt
->rhs
;
6231 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6234 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
6236 return cont_stmt
->control_def
;
6239 /* The same as above, but return the address. */
6241 static inline tree
*
6242 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
6244 return &cont_stmt
->control_def
;
6247 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6250 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
6252 cont_stmt
->control_def
= def
;
6256 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6259 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
6261 return cont_stmt
->control_use
;
6265 /* The same as above, but return the address. */
6267 static inline tree
*
6268 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
6270 return &cont_stmt
->control_use
;
6274 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6277 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
6279 cont_stmt
->control_use
= use
;
6282 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6283 TRANSACTION_STMT. */
6285 static inline gimple_seq
*
6286 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
6288 return &transaction_stmt
->body
;
6291 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6293 static inline gimple_seq
6294 gimple_transaction_body (const gtransaction
*transaction_stmt
)
6296 return transaction_stmt
->body
;
6299 /* Return the label associated with a GIMPLE_TRANSACTION. */
6302 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
6304 return transaction_stmt
->label_norm
;
6307 static inline tree
*
6308 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
6310 return &transaction_stmt
->label_norm
;
6314 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
6316 return transaction_stmt
->label_uninst
;
6319 static inline tree
*
6320 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
6322 return &transaction_stmt
->label_uninst
;
6326 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
6328 return transaction_stmt
->label_over
;
6331 static inline tree
*
6332 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
6334 return &transaction_stmt
->label_over
;
6337 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6339 static inline unsigned int
6340 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
6342 return transaction_stmt
->subcode
;
6345 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6346 TRANSACTION_STMT. */
6349 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
6352 transaction_stmt
->body
= body
;
6355 /* Set the label associated with a GIMPLE_TRANSACTION. */
6358 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
6360 transaction_stmt
->label_norm
= label
;
6364 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6366 transaction_stmt
->label_uninst
= label
;
6370 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6372 transaction_stmt
->label_over
= label
;
6375 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6378 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6379 unsigned int subcode
)
6381 transaction_stmt
->subcode
= subcode
;
6384 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6386 static inline tree
*
6387 gimple_return_retval_ptr (greturn
*gs
)
6392 /* Return the return value for GIMPLE_RETURN GS. */
6395 gimple_return_retval (const greturn
*gs
)
6401 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6404 gimple_return_set_retval (greturn
*gs
, tree retval
)
6410 /* Returns true when the gimple statement STMT is any of the OMP types. */
6412 #define CASE_GIMPLE_OMP \
6413 case GIMPLE_OMP_PARALLEL: \
6414 case GIMPLE_OMP_TASK: \
6415 case GIMPLE_OMP_FOR: \
6416 case GIMPLE_OMP_SECTIONS: \
6417 case GIMPLE_OMP_SECTIONS_SWITCH: \
6418 case GIMPLE_OMP_SINGLE: \
6419 case GIMPLE_OMP_TARGET: \
6420 case GIMPLE_OMP_TEAMS: \
6421 case GIMPLE_OMP_SECTION: \
6422 case GIMPLE_OMP_MASTER: \
6423 case GIMPLE_OMP_TASKGROUP: \
6424 case GIMPLE_OMP_ORDERED: \
6425 case GIMPLE_OMP_CRITICAL: \
6426 case GIMPLE_OMP_SCAN: \
6427 case GIMPLE_OMP_RETURN: \
6428 case GIMPLE_OMP_ATOMIC_LOAD: \
6429 case GIMPLE_OMP_ATOMIC_STORE: \
6430 case GIMPLE_OMP_CONTINUE
6433 is_gimple_omp (const gimple
*stmt
)
6435 switch (gimple_code (stmt
))
6444 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6448 is_gimple_omp_oacc (const gimple
*stmt
)
6450 gcc_assert (is_gimple_omp (stmt
));
6451 switch (gimple_code (stmt
))
6453 case GIMPLE_OMP_FOR
:
6454 switch (gimple_omp_for_kind (stmt
))
6456 case GF_OMP_FOR_KIND_OACC_LOOP
:
6461 case GIMPLE_OMP_TARGET
:
6462 switch (gimple_omp_target_kind (stmt
))
6464 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6465 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6466 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
6467 case GF_OMP_TARGET_KIND_OACC_DATA
:
6468 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6469 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
6470 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6471 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6482 /* Return true if the OMP gimple statement STMT is offloaded. */
6485 is_gimple_omp_offloaded (const gimple
*stmt
)
6487 gcc_assert (is_gimple_omp (stmt
));
6488 switch (gimple_code (stmt
))
6490 case GIMPLE_OMP_TARGET
:
6491 switch (gimple_omp_target_kind (stmt
))
6493 case GF_OMP_TARGET_KIND_REGION
:
6494 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6495 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6496 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
6507 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6510 gimple_nop_p (const gimple
*g
)
6512 return gimple_code (g
) == GIMPLE_NOP
;
6516 /* Return true if GS is a GIMPLE_RESX. */
6519 is_gimple_resx (const gimple
*gs
)
6521 return gimple_code (gs
) == GIMPLE_RESX
;
6524 /* Return the type of the main expression computed by STMT. Return
6525 void_type_node if the statement computes nothing. */
6528 gimple_expr_type (const gimple
*stmt
)
6530 enum gimple_code code
= gimple_code (stmt
);
6531 /* In general we want to pass out a type that can be substituted
6532 for both the RHS and the LHS types if there is a possibly
6533 useless conversion involved. That means returning the
6534 original RHS type as far as we can reconstruct it. */
6535 if (code
== GIMPLE_CALL
)
6537 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6538 if (gimple_call_internal_p (call_stmt
))
6539 switch (gimple_call_internal_fn (call_stmt
))
6541 case IFN_MASK_STORE
:
6542 case IFN_SCATTER_STORE
:
6543 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6544 case IFN_MASK_SCATTER_STORE
:
6545 return TREE_TYPE (gimple_call_arg (call_stmt
, 4));
6549 return gimple_call_return_type (call_stmt
);
6551 else if (code
== GIMPLE_ASSIGN
)
6553 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6554 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6556 /* As fallback use the type of the LHS. */
6557 return TREE_TYPE (gimple_get_lhs (stmt
));
6559 else if (code
== GIMPLE_COND
)
6560 return boolean_type_node
;
6562 return void_type_node
;
6565 /* Enum and arrays used for allocation stats. Keep in sync with
6566 gimple.c:gimple_alloc_kind_names. */
6567 enum gimple_alloc_kind
6569 gimple_alloc_kind_assign
, /* Assignments. */
6570 gimple_alloc_kind_phi
, /* PHI nodes. */
6571 gimple_alloc_kind_cond
, /* Conditionals. */
6572 gimple_alloc_kind_rest
, /* Everything else. */
6573 gimple_alloc_kind_all
6576 extern uint64_t gimple_alloc_counts
[];
6577 extern uint64_t gimple_alloc_sizes
[];
6579 /* Return the allocation kind for a given stmt CODE. */
6580 static inline enum gimple_alloc_kind
6581 gimple_alloc_kind (enum gimple_code code
)
6586 return gimple_alloc_kind_assign
;
6588 return gimple_alloc_kind_phi
;
6590 return gimple_alloc_kind_cond
;
6592 return gimple_alloc_kind_rest
;
6596 /* Return true if a location should not be emitted for this statement
6597 by annotate_all_with_location. */
6600 gimple_do_not_emit_location_p (gimple
*g
)
6602 return gimple_plf (g
, GF_PLF_1
);
6605 /* Mark statement G so a location will not be emitted by
6606 annotate_one_with_location. */
6609 gimple_set_do_not_emit_location (gimple
*g
)
6611 /* The PLF flags are initialized to 0 when a new tuple is created,
6612 so no need to initialize it anywhere. */
6613 gimple_set_plf (g
, GF_PLF_1
, true);
6616 #endif /* GCC_GIMPLE_H */