1 /* Gimple IR definitions.
3 Copyright (C) 2007-2019 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_PARALLEL_GRID_PHONY
= 1 << 1,
154 GF_OMP_TASK_TASKLOOP
= 1 << 0,
155 GF_OMP_TASK_TASKWAIT
= 1 << 1,
156 GF_OMP_FOR_KIND_MASK
= (1 << 3) - 1,
157 GF_OMP_FOR_KIND_FOR
= 0,
158 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
159 GF_OMP_FOR_KIND_TASKLOOP
= 2,
160 GF_OMP_FOR_KIND_OACC_LOOP
= 4,
161 GF_OMP_FOR_KIND_GRID_LOOP
= 5,
162 GF_OMP_FOR_KIND_SIMD
= 6,
163 GF_OMP_FOR_COMBINED
= 1 << 3,
164 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
165 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
167 GF_OMP_FOR_GRID_PHONY
= 1 << 5,
168 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
170 GF_OMP_FOR_GRID_INTRA_GROUP
= 1 << 5,
171 GF_OMP_FOR_GRID_GROUP_ITER
= 1 << 6,
172 GF_OMP_TARGET_KIND_MASK
= (1 << 4) - 1,
173 GF_OMP_TARGET_KIND_REGION
= 0,
174 GF_OMP_TARGET_KIND_DATA
= 1,
175 GF_OMP_TARGET_KIND_UPDATE
= 2,
176 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
177 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
178 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
179 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
180 GF_OMP_TARGET_KIND_OACC_DATA
= 7,
181 GF_OMP_TARGET_KIND_OACC_UPDATE
= 8,
182 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
= 9,
183 GF_OMP_TARGET_KIND_OACC_DECLARE
= 10,
184 GF_OMP_TARGET_KIND_OACC_HOST_DATA
= 11,
185 GF_OMP_TEAMS_GRID_PHONY
= 1 << 0,
186 GF_OMP_TEAMS_HOST
= 1 << 1,
188 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
189 a thread synchronization via some sort of barrier. The exact barrier
190 that would otherwise be emitted is dependent on the OMP statement with
191 which this return is associated. */
192 GF_OMP_RETURN_NOWAIT
= 1 << 0,
194 GF_OMP_SECTION_LAST
= 1 << 0,
195 GF_OMP_ATOMIC_MEMORY_ORDER
= (1 << 3) - 1,
196 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 3,
197 GF_PREDICT_TAKEN
= 1 << 15
200 /* This subcode tells apart different kinds of stmts that are not used
201 for codegen, but rather to retain debug information. */
202 enum gimple_debug_subcode
{
203 GIMPLE_DEBUG_BIND
= 0,
204 GIMPLE_DEBUG_SOURCE_BIND
= 1,
205 GIMPLE_DEBUG_BEGIN_STMT
= 2,
206 GIMPLE_DEBUG_INLINE_ENTRY
= 3
209 /* Masks for selecting a pass local flag (PLF) to work on. These
210 masks are used by gimple_set_plf and gimple_plf. */
216 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
217 are for 64 bit hosts. */
219 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
220 chain_next ("%h.next"), variable_size
))
224 Main identifying code for a tuple. */
225 ENUM_BITFIELD(gimple_code
) code
: 8;
227 /* Nonzero if a warning should not be emitted on this tuple. */
228 unsigned int no_warning
: 1;
230 /* Nonzero if this tuple has been visited. Passes are responsible
231 for clearing this bit before using it. */
232 unsigned int visited
: 1;
234 /* Nonzero if this tuple represents a non-temporal move. */
235 unsigned int nontemporal_move
: 1;
237 /* Pass local flags. These flags are free for any pass to use as
238 they see fit. Passes should not assume that these flags contain
239 any useful value when the pass starts. Any initial state that
240 the pass requires should be set on entry to the pass. See
241 gimple_set_plf and gimple_plf for usage. */
242 unsigned int plf
: 2;
244 /* Nonzero if this statement has been modified and needs to have its
245 operands rescanned. */
246 unsigned modified
: 1;
248 /* Nonzero if this statement contains volatile operands. */
249 unsigned has_volatile_ops
: 1;
251 /* Padding to get subcode to 16 bit alignment. */
254 /* The SUBCODE field can be used for tuple-specific flags for tuples
255 that do not require subcodes. Note that SUBCODE should be at
256 least as wide as tree codes, as several tuples store tree codes
258 unsigned int subcode
: 16;
260 /* UID of this statement. This is used by passes that want to
261 assign IDs to statements. It must be assigned and used by each
262 pass. By default it should be assumed to contain garbage. */
266 Locus information for debug info. */
269 /* Number of operands in this tuple. */
273 Basic block holding this statement. */
277 Linked lists of gimple statements. The next pointers form
278 a NULL terminated list, the prev pointers are a cyclic list.
279 A gimple statement is hence also a double-ended list of
280 statements, with the pointer itself being the first element,
281 and the prev pointer being the last. */
283 gimple
*GTY((skip
)) prev
;
287 /* Base structure for tuples with operands. */
289 /* This gimple subclass has no tag value. */
291 gimple_statement_with_ops_base
: public gimple
293 /* [ WORD 1-6 ] : base class */
296 SSA operand vectors. NOTE: It should be possible to
297 amalgamate these vectors with the operand vector OP. However,
298 the SSA operand vectors are organized differently and contain
299 more information (like immediate use chaining). */
300 struct use_optype_d
GTY((skip (""))) *use_ops
;
304 /* Statements that take register operands. */
306 struct GTY((tag("GSS_WITH_OPS")))
307 gimple_statement_with_ops
: public gimple_statement_with_ops_base
309 /* [ WORD 1-7 ] : base class */
312 Operand vector. NOTE! This must always be the last field
313 of this structure. In particular, this means that this
314 structure cannot be embedded inside another one. */
315 tree
GTY((length ("%h.num_ops"))) op
[1];
319 /* Base for statements that take both memory and register operands. */
321 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
322 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
324 /* [ WORD 1-7 ] : base class */
327 Virtual operands for this statement. The GC will pick them
328 up via the ssa_names array. */
329 tree
GTY((skip (""))) vdef
;
330 tree
GTY((skip (""))) vuse
;
334 /* Statements that take both memory and register operands. */
336 struct GTY((tag("GSS_WITH_MEM_OPS")))
337 gimple_statement_with_memory_ops
:
338 public gimple_statement_with_memory_ops_base
340 /* [ WORD 1-9 ] : base class */
343 Operand vector. NOTE! This must always be the last field
344 of this structure. In particular, this means that this
345 structure cannot be embedded inside another one. */
346 tree
GTY((length ("%h.num_ops"))) op
[1];
350 /* Call statements that take both memory and register operands. */
352 struct GTY((tag("GSS_CALL")))
353 gcall
: public gimple_statement_with_memory_ops_base
355 /* [ WORD 1-9 ] : base class */
358 struct pt_solution call_used
;
359 struct pt_solution call_clobbered
;
362 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
363 tree
GTY ((tag ("0"))) fntype
;
364 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
368 Operand vector. NOTE! This must always be the last field
369 of this structure. In particular, this means that this
370 structure cannot be embedded inside another one. */
371 tree
GTY((length ("%h.num_ops"))) op
[1];
373 static const enum gimple_code code_
= GIMPLE_CALL
;
377 /* OMP statements. */
379 struct GTY((tag("GSS_OMP")))
380 gimple_statement_omp
: public gimple
382 /* [ WORD 1-6 ] : base class */
391 struct GTY((tag("GSS_BIND")))
392 gbind
: public gimple
394 /* [ WORD 1-6 ] : base class */
397 Variables declared in this scope. */
401 This is different than the BLOCK field in gimple,
402 which is analogous to TREE_BLOCK (i.e., the lexical block holding
403 this statement). This field is the equivalent of BIND_EXPR_BLOCK
404 in tree land (i.e., the lexical scope defined by this bind). See
415 struct GTY((tag("GSS_CATCH")))
416 gcatch
: public gimple
418 /* [ WORD 1-6 ] : base class */
428 /* GIMPLE_EH_FILTER */
430 struct GTY((tag("GSS_EH_FILTER")))
431 geh_filter
: public gimple
433 /* [ WORD 1-6 ] : base class */
446 struct GTY((tag("GSS_EH_ELSE")))
447 geh_else
: public gimple
449 /* [ WORD 1-6 ] : base class */
452 gimple_seq n_body
, e_body
;
455 /* GIMPLE_EH_MUST_NOT_THROW */
457 struct GTY((tag("GSS_EH_MNT")))
458 geh_mnt
: public gimple
460 /* [ WORD 1-6 ] : base class */
462 /* [ WORD 7 ] Abort function decl. */
468 struct GTY((tag("GSS_PHI")))
471 /* [ WORD 1-6 ] : base class */
481 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
485 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
487 struct GTY((tag("GSS_EH_CTRL")))
488 gimple_statement_eh_ctrl
: public gimple
490 /* [ WORD 1-6 ] : base class */
493 Exception region number. */
497 struct GTY((tag("GSS_EH_CTRL")))
498 gresx
: public gimple_statement_eh_ctrl
500 /* No extra fields; adds invariant:
501 stmt->code == GIMPLE_RESX. */
504 struct GTY((tag("GSS_EH_CTRL")))
505 geh_dispatch
: public gimple_statement_eh_ctrl
507 /* No extra fields; adds invariant:
508 stmt->code == GIMPLE_EH_DISPATH. */
514 struct GTY((tag("GSS_TRY")))
517 /* [ WORD 1-6 ] : base class */
520 Expression to evaluate. */
524 Cleanup expression. */
528 /* Kind of GIMPLE_TRY statements. */
529 enum gimple_try_flags
532 GIMPLE_TRY_CATCH
= 1 << 0,
535 GIMPLE_TRY_FINALLY
= 1 << 1,
536 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
538 /* Analogous to TRY_CATCH_IS_CLEANUP. */
539 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
542 /* GIMPLE_WITH_CLEANUP_EXPR */
544 struct GTY((tag("GSS_WCE")))
545 gimple_statement_wce
: public gimple
547 /* [ WORD 1-6 ] : base class */
549 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
550 executed if an exception is thrown, not on normal exit of its
551 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
555 Cleanup expression. */
562 struct GTY((tag("GSS_ASM")))
563 gasm
: public gimple_statement_with_memory_ops_base
565 /* [ WORD 1-9 ] : base class */
568 __asm__ statement. */
572 Number of inputs, outputs, clobbers, labels. */
579 Operand vector. NOTE! This must always be the last field
580 of this structure. In particular, this means that this
581 structure cannot be embedded inside another one. */
582 tree
GTY((length ("%h.num_ops"))) op
[1];
585 /* GIMPLE_OMP_CRITICAL */
587 struct GTY((tag("GSS_OMP_CRITICAL")))
588 gomp_critical
: public gimple_statement_omp
590 /* [ WORD 1-7 ] : base class */
596 Critical section name. */
601 struct GTY(()) gimple_omp_for_iter
{
602 /* Condition code. */
605 /* Index variable. */
620 struct GTY((tag("GSS_OMP_FOR")))
621 gomp_for
: public gimple_statement_omp
623 /* [ WORD 1-7 ] : base class */
629 Number of elements in iter array. */
633 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
636 Pre-body evaluated before the loop body begins. */
641 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
643 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
644 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
646 /* [ WORD 1-7 ] : base class */
653 Child function holding the body of the parallel region. */
657 Shared data argument. */
661 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
662 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
663 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
665 /* No extra fields; adds invariant:
666 stmt->code == GIMPLE_OMP_PARALLEL
667 || stmt->code == GIMPLE_OMP_TASK
668 || stmt->code == GIMPLE_OMP_TEAMS. */
671 /* GIMPLE_OMP_PARALLEL */
672 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
673 gomp_parallel
: public gimple_statement_omp_taskreg
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_PARALLEL. */
679 /* GIMPLE_OMP_TARGET */
680 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
681 gomp_target
: public gimple_statement_omp_parallel_layout
683 /* No extra fields; adds invariant:
684 stmt->code == GIMPLE_OMP_TARGET. */
687 /* GIMPLE_OMP_TASK */
689 struct GTY((tag("GSS_OMP_TASK")))
690 gomp_task
: public gimple_statement_omp_taskreg
692 /* [ WORD 1-10 ] : base class */
695 Child function holding firstprivate initialization if needed. */
699 Size and alignment in bytes of the argument data block. */
705 /* GIMPLE_OMP_SECTION */
706 /* Uses struct gimple_statement_omp. */
709 /* GIMPLE_OMP_SECTIONS */
711 struct GTY((tag("GSS_OMP_SECTIONS")))
712 gomp_sections
: public gimple_statement_omp
714 /* [ WORD 1-7 ] : base class */
720 The control variable used for deciding which of the sections to
725 /* GIMPLE_OMP_CONTINUE.
727 Note: This does not inherit from gimple_statement_omp, because we
728 do not need the body field. */
730 struct GTY((tag("GSS_OMP_CONTINUE")))
731 gomp_continue
: public gimple
733 /* [ WORD 1-6 ] : base class */
742 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gimple_statement_omp_single_layout
: public gimple_statement_omp
748 /* [ WORD 1-7 ] : base class */
754 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
755 gomp_single
: public gimple_statement_omp_single_layout
757 /* No extra fields; adds invariant:
758 stmt->code == GIMPLE_OMP_SINGLE. */
761 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
762 gomp_teams
: public gimple_statement_omp_taskreg
764 /* No extra fields; adds invariant:
765 stmt->code == GIMPLE_OMP_TEAMS. */
768 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
769 gomp_ordered
: public gimple_statement_omp_single_layout
771 /* No extra fields; adds invariant:
772 stmt->code == GIMPLE_OMP_ORDERED. */
775 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
776 gomp_scan
: public gimple_statement_omp_single_layout
778 /* No extra fields; adds invariant:
779 stmt->code == GIMPLE_OMP_SCAN. */
783 /* GIMPLE_OMP_ATOMIC_LOAD.
784 Note: This is based on gimple, not g_s_omp, because g_s_omp
785 contains a sequence, which we don't need here. */
787 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
788 gomp_atomic_load
: public gimple
790 /* [ WORD 1-6 ] : base class */
796 /* GIMPLE_OMP_ATOMIC_STORE.
797 See note on GIMPLE_OMP_ATOMIC_LOAD. */
799 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
800 gimple_statement_omp_atomic_store_layout
: public gimple
802 /* [ WORD 1-6 ] : base class */
808 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
810 public gimple_statement_omp_atomic_store_layout
812 /* No extra fields; adds invariant:
813 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
816 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
817 gimple_statement_omp_return
:
818 public gimple_statement_omp_atomic_store_layout
820 /* No extra fields; adds invariant:
821 stmt->code == GIMPLE_OMP_RETURN. */
824 /* GIMPLE_TRANSACTION. */
826 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
828 /* The __transaction_atomic was declared [[outer]] or it is
829 __transaction_relaxed. */
830 #define GTMA_IS_OUTER (1u << 0)
831 #define GTMA_IS_RELAXED (1u << 1)
832 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
834 /* The transaction is seen to not have an abort. */
835 #define GTMA_HAVE_ABORT (1u << 2)
836 /* The transaction is seen to have loads or stores. */
837 #define GTMA_HAVE_LOAD (1u << 3)
838 #define GTMA_HAVE_STORE (1u << 4)
839 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
840 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
841 /* The transaction WILL enter serial irrevocable mode.
842 An irrevocable block post-dominates the entire transaction, such
843 that all invocations of the transaction will go serial-irrevocable.
844 In such case, we don't bother instrumenting the transaction, and
845 tell the runtime that it should begin the transaction in
846 serial-irrevocable mode. */
847 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
848 /* The transaction contains no instrumentation code whatsover, most
849 likely because it is guaranteed to go irrevocable upon entry. */
850 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
852 struct GTY((tag("GSS_TRANSACTION")))
853 gtransaction
: public gimple_statement_with_memory_ops_base
855 /* [ WORD 1-9 ] : base class */
866 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
867 enum gimple_statement_structure_enum
{
868 #include "gsstruct.def"
873 /* A statement with the invariant that
874 stmt->code == GIMPLE_COND
875 i.e. a conditional jump statement. */
877 struct GTY((tag("GSS_WITH_OPS")))
878 gcond
: public gimple_statement_with_ops
880 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
881 static const enum gimple_code code_
= GIMPLE_COND
;
884 /* A statement with the invariant that
885 stmt->code == GIMPLE_DEBUG
886 i.e. a debug statement. */
888 struct GTY((tag("GSS_WITH_OPS")))
889 gdebug
: public gimple_statement_with_ops
891 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
894 /* A statement with the invariant that
895 stmt->code == GIMPLE_GOTO
896 i.e. a goto statement. */
898 struct GTY((tag("GSS_WITH_OPS")))
899 ggoto
: public gimple_statement_with_ops
901 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
904 /* A statement with the invariant that
905 stmt->code == GIMPLE_LABEL
906 i.e. a label statement. */
908 struct GTY((tag("GSS_WITH_OPS")))
909 glabel
: public gimple_statement_with_ops
911 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
914 /* A statement with the invariant that
915 stmt->code == GIMPLE_SWITCH
916 i.e. a switch statement. */
918 struct GTY((tag("GSS_WITH_OPS")))
919 gswitch
: public gimple_statement_with_ops
921 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
924 /* A statement with the invariant that
925 stmt->code == GIMPLE_ASSIGN
926 i.e. an assignment statement. */
928 struct GTY((tag("GSS_WITH_MEM_OPS")))
929 gassign
: public gimple_statement_with_memory_ops
931 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
932 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
935 /* A statement with the invariant that
936 stmt->code == GIMPLE_RETURN
937 i.e. a return statement. */
939 struct GTY((tag("GSS_WITH_MEM_OPS")))
940 greturn
: public gimple_statement_with_memory_ops
942 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
948 is_a_helper
<gasm
*>::test (gimple
*gs
)
950 return gs
->code
== GIMPLE_ASM
;
956 is_a_helper
<gassign
*>::test (gimple
*gs
)
958 return gs
->code
== GIMPLE_ASSIGN
;
964 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
966 return gs
->code
== GIMPLE_ASSIGN
;
972 is_a_helper
<gbind
*>::test (gimple
*gs
)
974 return gs
->code
== GIMPLE_BIND
;
980 is_a_helper
<gcall
*>::test (gimple
*gs
)
982 return gs
->code
== GIMPLE_CALL
;
988 is_a_helper
<gcatch
*>::test (gimple
*gs
)
990 return gs
->code
== GIMPLE_CATCH
;
996 is_a_helper
<gcond
*>::test (gimple
*gs
)
998 return gs
->code
== GIMPLE_COND
;
1004 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
1006 return gs
->code
== GIMPLE_COND
;
1012 is_a_helper
<gdebug
*>::test (gimple
*gs
)
1014 return gs
->code
== GIMPLE_DEBUG
;
1020 is_a_helper
<ggoto
*>::test (gimple
*gs
)
1022 return gs
->code
== GIMPLE_GOTO
;
1028 is_a_helper
<glabel
*>::test (gimple
*gs
)
1030 return gs
->code
== GIMPLE_LABEL
;
1036 is_a_helper
<gresx
*>::test (gimple
*gs
)
1038 return gs
->code
== GIMPLE_RESX
;
1044 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1046 return gs
->code
== GIMPLE_EH_DISPATCH
;
1052 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1054 return gs
->code
== GIMPLE_EH_ELSE
;
1060 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1062 return gs
->code
== GIMPLE_EH_FILTER
;
1068 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1070 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1076 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1078 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1084 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1086 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1092 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1094 return gs
->code
== GIMPLE_OMP_RETURN
;
1100 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1102 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1108 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1110 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1116 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1118 return gs
->code
== GIMPLE_OMP_ORDERED
;
1124 is_a_helper
<gomp_scan
*>::test (gimple
*gs
)
1126 return gs
->code
== GIMPLE_OMP_SCAN
;
1132 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1134 return gs
->code
== GIMPLE_OMP_FOR
;
1140 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1142 return (gs
->code
== GIMPLE_OMP_PARALLEL
1143 || gs
->code
== GIMPLE_OMP_TASK
1144 || gs
->code
== GIMPLE_OMP_TEAMS
);
1150 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1152 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1158 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1160 return gs
->code
== GIMPLE_OMP_TARGET
;
1166 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1168 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1174 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1176 return gs
->code
== GIMPLE_OMP_SINGLE
;
1182 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1184 return gs
->code
== GIMPLE_OMP_TEAMS
;
1190 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1192 return gs
->code
== GIMPLE_OMP_TASK
;
1198 is_a_helper
<gphi
*>::test (gimple
*gs
)
1200 return gs
->code
== GIMPLE_PHI
;
1206 is_a_helper
<greturn
*>::test (gimple
*gs
)
1208 return gs
->code
== GIMPLE_RETURN
;
1214 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1216 return gs
->code
== GIMPLE_SWITCH
;
1222 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1224 return gs
->code
== GIMPLE_TRANSACTION
;
1230 is_a_helper
<gtry
*>::test (gimple
*gs
)
1232 return gs
->code
== GIMPLE_TRY
;
1238 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1240 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1246 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1248 return gs
->code
== GIMPLE_ASM
;
1254 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1256 return gs
->code
== GIMPLE_BIND
;
1262 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1264 return gs
->code
== GIMPLE_CALL
;
1270 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1272 return gs
->code
== GIMPLE_CATCH
;
1278 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1280 return gs
->code
== GIMPLE_RESX
;
1286 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1288 return gs
->code
== GIMPLE_EH_DISPATCH
;
1294 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1296 return gs
->code
== GIMPLE_EH_FILTER
;
1302 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1304 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1310 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1312 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1318 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1320 return gs
->code
== GIMPLE_OMP_RETURN
;
1326 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1328 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1334 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1336 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1342 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1344 return gs
->code
== GIMPLE_OMP_ORDERED
;
1350 is_a_helper
<const gomp_scan
*>::test (const gimple
*gs
)
1352 return gs
->code
== GIMPLE_OMP_SCAN
;
1358 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1360 return gs
->code
== GIMPLE_OMP_FOR
;
1366 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1368 return (gs
->code
== GIMPLE_OMP_PARALLEL
1369 || gs
->code
== GIMPLE_OMP_TASK
1370 || gs
->code
== GIMPLE_OMP_TEAMS
);
1376 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1378 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1384 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1386 return gs
->code
== GIMPLE_OMP_TARGET
;
1392 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1394 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1400 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1402 return gs
->code
== GIMPLE_OMP_SINGLE
;
1408 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1410 return gs
->code
== GIMPLE_OMP_TEAMS
;
1416 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1418 return gs
->code
== GIMPLE_OMP_TASK
;
1424 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1426 return gs
->code
== GIMPLE_PHI
;
1432 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1434 return gs
->code
== GIMPLE_TRANSACTION
;
1437 /* Offset in bytes to the location of the operand vector.
1438 Zero if there is no operand vector for this tuple structure. */
1439 extern size_t const gimple_ops_offset_
[];
1441 /* Map GIMPLE codes to GSS codes. */
1442 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1444 /* This variable holds the currently expanded gimple statement for purposes
1445 of comminucating the profile info to the builtin expanders. */
1446 extern gimple
*currently_expanding_gimple_stmt
;
1448 size_t gimple_size (enum gimple_code code
, unsigned num_ops
= 0);
1449 void gimple_init (gimple
*g
, enum gimple_code code
, unsigned num_ops
);
1450 gimple
*gimple_alloc (enum gimple_code
, unsigned CXX_MEM_STAT_INFO
);
1451 greturn
*gimple_build_return (tree
);
1452 void gimple_call_reset_alias_info (gcall
*);
1453 gcall
*gimple_build_call_vec (tree
, vec
<tree
> );
1454 gcall
*gimple_build_call (tree
, unsigned, ...);
1455 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1456 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1457 gcall
*gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1458 gcall
*gimple_build_call_from_tree (tree
, tree
);
1459 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1460 gassign
*gimple_build_assign (tree
, enum tree_code
,
1461 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1462 gassign
*gimple_build_assign (tree
, enum tree_code
,
1463 tree
, tree CXX_MEM_STAT_INFO
);
1464 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1465 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1466 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1467 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1468 glabel
*gimple_build_label (tree label
);
1469 ggoto
*gimple_build_goto (tree dest
);
1470 gimple
*gimple_build_nop (void);
1471 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1472 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1473 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1474 vec
<tree
, va_gc
> *);
1475 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1476 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1477 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1478 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1479 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1480 enum gimple_try_flags
);
1481 gimple
*gimple_build_wce (gimple_seq
);
1482 gresx
*gimple_build_resx (int);
1483 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1484 gswitch
*gimple_build_switch (tree
, tree
, vec
<tree
> );
1485 geh_dispatch
*gimple_build_eh_dispatch (int);
1486 gdebug
*gimple_build_debug_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1487 gdebug
*gimple_build_debug_source_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1488 gdebug
*gimple_build_debug_begin_stmt (tree
, location_t CXX_MEM_STAT_INFO
);
1489 gdebug
*gimple_build_debug_inline_entry (tree
, location_t CXX_MEM_STAT_INFO
);
1490 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1491 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1492 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1493 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1495 gimple
*gimple_build_omp_section (gimple_seq
);
1496 gimple
*gimple_build_omp_master (gimple_seq
);
1497 gimple
*gimple_build_omp_grid_body (gimple_seq
);
1498 gimple
*gimple_build_omp_taskgroup (gimple_seq
, tree
);
1499 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1500 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1501 gimple
*gimple_build_omp_return (bool);
1502 gomp_scan
*gimple_build_omp_scan (gimple_seq
, tree
);
1503 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1504 gimple
*gimple_build_omp_sections_switch (void);
1505 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1506 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1507 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1508 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
,
1509 enum omp_memory_order
);
1510 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
, enum omp_memory_order
);
1511 gtransaction
*gimple_build_transaction (gimple_seq
);
1512 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1513 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1514 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1515 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1516 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1518 extern void annotate_all_with_location (gimple_seq
, location_t
);
1519 bool empty_body_p (gimple_seq
);
1520 gimple_seq
gimple_seq_copy (gimple_seq
);
1521 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1522 int gimple_call_flags (const gimple
*);
1523 int gimple_call_arg_flags (const gcall
*, unsigned);
1524 int gimple_call_return_flags (const gcall
*);
1525 bool gimple_call_nonnull_result_p (gcall
*);
1526 tree
gimple_call_nonnull_arg (gcall
*);
1527 bool gimple_assign_copy_p (gimple
*);
1528 bool gimple_assign_ssa_name_copy_p (gimple
*);
1529 bool gimple_assign_unary_nop_p (gimple
*);
1530 void gimple_set_bb (gimple
*, basic_block
);
1531 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1532 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1534 tree
gimple_get_lhs (const gimple
*);
1535 void gimple_set_lhs (gimple
*, tree
);
1536 gimple
*gimple_copy (gimple
*);
1537 void gimple_move_vops (gimple
*, gimple
*);
1538 bool gimple_has_side_effects (const gimple
*);
1539 bool gimple_could_trap_p_1 (gimple
*, bool, bool);
1540 bool gimple_could_trap_p (gimple
*);
1541 bool gimple_assign_rhs_could_trap_p (gimple
*);
1542 extern void dump_gimple_statistics (void);
1543 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1544 extern tree
canonicalize_cond_expr_cond (tree
);
1545 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1546 extern bool gimple_compare_field_offset (tree
, tree
);
1547 extern tree
gimple_unsigned_type (tree
);
1548 extern tree
gimple_signed_type (tree
);
1549 extern alias_set_type
gimple_get_alias_set (tree
);
1550 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1551 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1552 extern combined_fn
gimple_call_combined_fn (const gimple
*);
1553 extern bool gimple_call_operator_delete_p (const gcall
*);
1554 extern bool gimple_call_builtin_p (const gimple
*);
1555 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1556 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1557 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1558 extern void dump_decl_set (FILE *, bitmap
);
1559 extern bool nonfreeing_call_p (gimple
*);
1560 extern bool nonbarrier_call_p (gimple
*);
1561 extern bool infer_nonnull_range (gimple
*, tree
);
1562 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1563 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1564 extern void sort_case_labels (vec
<tree
>);
1565 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1566 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1567 extern void gimple_seq_discard (gimple_seq
);
1568 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1569 extern bool gimple_inexpensive_call_p (gcall
*);
1570 extern bool stmt_can_terminate_bb_p (gimple
*);
1572 /* Formal (expression) temporary table handling: multiple occurrences of
1573 the same scalar expression are evaluated into the same temporary. */
1575 typedef struct gimple_temp_hash_elt
1578 tree temp
; /* Value */
1581 /* Get the number of the next statement uid to be allocated. */
1582 static inline unsigned int
1583 gimple_stmt_max_uid (struct function
*fn
)
1585 return fn
->last_stmt_uid
;
1588 /* Set the number of the next statement uid to be allocated. */
1590 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1592 fn
->last_stmt_uid
= maxid
;
1595 /* Set the number of the next statement uid to be allocated. */
1596 static inline unsigned int
1597 inc_gimple_stmt_max_uid (struct function
*fn
)
1599 return fn
->last_stmt_uid
++;
1602 /* Return the first node in GIMPLE sequence S. */
1604 static inline gimple_seq_node
1605 gimple_seq_first (gimple_seq s
)
1611 /* Return the first statement in GIMPLE sequence S. */
1613 static inline gimple
*
1614 gimple_seq_first_stmt (gimple_seq s
)
1616 gimple_seq_node n
= gimple_seq_first (s
);
1620 /* Return the first statement in GIMPLE sequence S as a gbind *,
1621 verifying that it has code GIMPLE_BIND in a checked build. */
1623 static inline gbind
*
1624 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1626 gimple_seq_node n
= gimple_seq_first (s
);
1627 return as_a
<gbind
*> (n
);
1631 /* Return the last node in GIMPLE sequence S. */
1633 static inline gimple_seq_node
1634 gimple_seq_last (gimple_seq s
)
1636 return s
? s
->prev
: NULL
;
1640 /* Return the last statement in GIMPLE sequence S. */
1642 static inline gimple
*
1643 gimple_seq_last_stmt (gimple_seq s
)
1645 gimple_seq_node n
= gimple_seq_last (s
);
1650 /* Set the last node in GIMPLE sequence *PS to LAST. */
1653 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1659 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1662 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1668 /* Return true if GIMPLE sequence S is empty. */
1671 gimple_seq_empty_p (gimple_seq s
)
1676 /* Allocate a new sequence and initialize its first element with STMT. */
1678 static inline gimple_seq
1679 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1681 gimple_seq seq
= NULL
;
1682 gimple_seq_add_stmt (&seq
, stmt
);
1687 /* Returns the sequence of statements in BB. */
1689 static inline gimple_seq
1690 bb_seq (const_basic_block bb
)
1692 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1695 static inline gimple_seq
*
1696 bb_seq_addr (basic_block bb
)
1698 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1701 /* Sets the sequence of statements in BB to SEQ. */
1704 set_bb_seq (basic_block bb
, gimple_seq seq
)
1706 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1707 bb
->il
.gimple
.seq
= seq
;
1711 /* Return the code for GIMPLE statement G. */
1713 static inline enum gimple_code
1714 gimple_code (const gimple
*g
)
1720 /* Return the GSS code used by a GIMPLE code. */
1722 static inline enum gimple_statement_structure_enum
1723 gss_for_code (enum gimple_code code
)
1725 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1726 return gss_for_code_
[code
];
1730 /* Return which GSS code is used by GS. */
1732 static inline enum gimple_statement_structure_enum
1733 gimple_statement_structure (gimple
*gs
)
1735 return gss_for_code (gimple_code (gs
));
1739 /* Return true if statement G has sub-statements. This is only true for
1740 High GIMPLE statements. */
1743 gimple_has_substatements (gimple
*g
)
1745 switch (gimple_code (g
))
1749 case GIMPLE_EH_FILTER
:
1750 case GIMPLE_EH_ELSE
:
1752 case GIMPLE_OMP_FOR
:
1753 case GIMPLE_OMP_MASTER
:
1754 case GIMPLE_OMP_TASKGROUP
:
1755 case GIMPLE_OMP_ORDERED
:
1756 case GIMPLE_OMP_SECTION
:
1757 case GIMPLE_OMP_PARALLEL
:
1758 case GIMPLE_OMP_TASK
:
1759 case GIMPLE_OMP_SECTIONS
:
1760 case GIMPLE_OMP_SINGLE
:
1761 case GIMPLE_OMP_TARGET
:
1762 case GIMPLE_OMP_TEAMS
:
1763 case GIMPLE_OMP_CRITICAL
:
1764 case GIMPLE_WITH_CLEANUP_EXPR
:
1765 case GIMPLE_TRANSACTION
:
1766 case GIMPLE_OMP_GRID_BODY
:
1775 /* Return the basic block holding statement G. */
1777 static inline basic_block
1778 gimple_bb (const gimple
*g
)
1784 /* Return the lexical scope block holding statement G. */
1787 gimple_block (const gimple
*g
)
1789 return LOCATION_BLOCK (g
->location
);
1793 /* Set BLOCK to be the lexical scope block holding statement G. */
1796 gimple_set_block (gimple
*g
, tree block
)
1798 g
->location
= set_block (g
->location
, block
);
1802 /* Return location information for statement G. */
1804 static inline location_t
1805 gimple_location (const gimple
*g
)
1810 /* Return location information for statement G if g is not NULL.
1811 Otherwise, UNKNOWN_LOCATION is returned. */
1813 static inline location_t
1814 gimple_location_safe (const gimple
*g
)
1816 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1819 /* Set location information for statement G. */
1822 gimple_set_location (gimple
*g
, location_t location
)
1824 g
->location
= location
;
1828 /* Return true if G contains location information. */
1831 gimple_has_location (const gimple
*g
)
1833 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1837 /* Return non-artificial location information for statement G. */
1839 static inline location_t
1840 gimple_nonartificial_location (const gimple
*g
)
1842 location_t
*ploc
= NULL
;
1844 if (tree block
= gimple_block (g
))
1845 ploc
= block_nonartificial_location (block
);
1847 return ploc
? *ploc
: gimple_location (g
);
1851 /* Return the file name of the location of STMT. */
1853 static inline const char *
1854 gimple_filename (const gimple
*stmt
)
1856 return LOCATION_FILE (gimple_location (stmt
));
1860 /* Return the line number of the location of STMT. */
1863 gimple_lineno (const gimple
*stmt
)
1865 return LOCATION_LINE (gimple_location (stmt
));
1869 /* Determine whether SEQ is a singleton. */
1872 gimple_seq_singleton_p (gimple_seq seq
)
1874 return ((gimple_seq_first (seq
) != NULL
)
1875 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1878 /* Return true if no warnings should be emitted for statement STMT. */
1881 gimple_no_warning_p (const gimple
*stmt
)
1883 return stmt
->no_warning
;
1886 /* Set the no_warning flag of STMT to NO_WARNING. */
1889 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1891 stmt
->no_warning
= (unsigned) no_warning
;
1894 /* Set the visited status on statement STMT to VISITED_P.
1896 Please note that this 'visited' property of the gimple statement is
1897 supposed to be undefined at pass boundaries. This means that a
1898 given pass should not assume it contains any useful value when the
1899 pass starts and thus can set it to any value it sees fit.
1901 You can learn more about the visited property of the gimple
1902 statement by reading the comments of the 'visited' data member of
1907 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1909 stmt
->visited
= (unsigned) visited_p
;
1913 /* Return the visited status for statement STMT.
1915 Please note that this 'visited' property of the gimple statement is
1916 supposed to be undefined at pass boundaries. This means that a
1917 given pass should not assume it contains any useful value when the
1918 pass starts and thus can set it to any value it sees fit.
1920 You can learn more about the visited property of the gimple
1921 statement by reading the comments of the 'visited' data member of
1925 gimple_visited_p (gimple
*stmt
)
1927 return stmt
->visited
;
1931 /* Set pass local flag PLF on statement STMT to VAL_P.
1933 Please note that this PLF property of the gimple statement is
1934 supposed to be undefined at pass boundaries. This means that a
1935 given pass should not assume it contains any useful value when the
1936 pass starts and thus can set it to any value it sees fit.
1938 You can learn more about the PLF property by reading the comment of
1939 the 'plf' data member of struct gimple_statement_structure. */
1942 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
1945 stmt
->plf
|= (unsigned int) plf
;
1947 stmt
->plf
&= ~((unsigned int) plf
);
1951 /* Return the value of pass local flag PLF on statement STMT.
1953 Please note that this 'plf' property of the gimple statement is
1954 supposed to be undefined at pass boundaries. This means that a
1955 given pass should not assume it contains any useful value when the
1956 pass starts and thus can set it to any value it sees fit.
1958 You can learn more about the plf property by reading the comment of
1959 the 'plf' data member of struct gimple_statement_structure. */
1961 static inline unsigned int
1962 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
1964 return stmt
->plf
& ((unsigned int) plf
);
1968 /* Set the UID of statement.
1970 Please note that this UID property is supposed to be undefined at
1971 pass boundaries. This means that a given pass should not assume it
1972 contains any useful value when the pass starts and thus can set it
1973 to any value it sees fit. */
1976 gimple_set_uid (gimple
*g
, unsigned uid
)
1982 /* Return the UID of statement.
1984 Please note that this UID property is supposed to be undefined at
1985 pass boundaries. This means that a given pass should not assume it
1986 contains any useful value when the pass starts and thus can set it
1987 to any value it sees fit. */
1989 static inline unsigned
1990 gimple_uid (const gimple
*g
)
1996 /* Make statement G a singleton sequence. */
1999 gimple_init_singleton (gimple
*g
)
2006 /* Return true if GIMPLE statement G has register or memory operands. */
2009 gimple_has_ops (const gimple
*g
)
2011 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
2017 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
2019 return gimple_has_ops (gs
);
2025 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
2027 return gimple_has_ops (gs
);
2030 /* Return true if GIMPLE statement G has memory operands. */
2033 gimple_has_mem_ops (const gimple
*g
)
2035 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
2041 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
2043 return gimple_has_mem_ops (gs
);
2049 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
2051 return gimple_has_mem_ops (gs
);
2054 /* Return the set of USE operands for statement G. */
2056 static inline struct use_optype_d
*
2057 gimple_use_ops (const gimple
*g
)
2059 const gimple_statement_with_ops
*ops_stmt
=
2060 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2063 return ops_stmt
->use_ops
;
2067 /* Set USE to be the set of USE operands for statement G. */
2070 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2072 gimple_statement_with_ops
*ops_stmt
=
2073 as_a
<gimple_statement_with_ops
*> (g
);
2074 ops_stmt
->use_ops
= use
;
2078 /* Return the single VUSE operand of the statement G. */
2081 gimple_vuse (const gimple
*g
)
2083 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2084 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2087 return mem_ops_stmt
->vuse
;
2090 /* Return the single VDEF operand of the statement G. */
2093 gimple_vdef (const gimple
*g
)
2095 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2096 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2099 return mem_ops_stmt
->vdef
;
2102 /* Return the single VUSE operand of the statement G. */
2104 static inline tree
*
2105 gimple_vuse_ptr (gimple
*g
)
2107 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2108 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2111 return &mem_ops_stmt
->vuse
;
2114 /* Return the single VDEF operand of the statement G. */
2116 static inline tree
*
2117 gimple_vdef_ptr (gimple
*g
)
2119 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2120 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2123 return &mem_ops_stmt
->vdef
;
2126 /* Set the single VUSE operand of the statement G. */
2129 gimple_set_vuse (gimple
*g
, tree vuse
)
2131 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2132 as_a
<gimple_statement_with_memory_ops
*> (g
);
2133 mem_ops_stmt
->vuse
= vuse
;
2136 /* Set the single VDEF operand of the statement G. */
2139 gimple_set_vdef (gimple
*g
, tree vdef
)
2141 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2142 as_a
<gimple_statement_with_memory_ops
*> (g
);
2143 mem_ops_stmt
->vdef
= vdef
;
2147 /* Return true if statement G has operands and the modified field has
2151 gimple_modified_p (const gimple
*g
)
2153 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2157 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2158 a MODIFIED field. */
2161 gimple_set_modified (gimple
*s
, bool modifiedp
)
2163 if (gimple_has_ops (s
))
2164 s
->modified
= (unsigned) modifiedp
;
2168 /* Return the tree code for the expression computed by STMT. This is
2169 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2170 GIMPLE_CALL, return CALL_EXPR as the expression code for
2171 consistency. This is useful when the caller needs to deal with the
2172 three kinds of computation that GIMPLE supports. */
2174 static inline enum tree_code
2175 gimple_expr_code (const gimple
*stmt
)
2177 enum gimple_code code
= gimple_code (stmt
);
2178 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
2179 return (enum tree_code
) stmt
->subcode
;
2182 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
2188 /* Return true if statement STMT contains volatile operands. */
2191 gimple_has_volatile_ops (const gimple
*stmt
)
2193 if (gimple_has_mem_ops (stmt
))
2194 return stmt
->has_volatile_ops
;
2200 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2203 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2205 if (gimple_has_mem_ops (stmt
))
2206 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2209 /* Return true if STMT is in a transaction. */
2212 gimple_in_transaction (const gimple
*stmt
)
2214 return bb_in_transaction (gimple_bb (stmt
));
2217 /* Return true if statement STMT may access memory. */
2220 gimple_references_memory_p (gimple
*stmt
)
2222 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2226 /* Return the subcode for OMP statement S. */
2228 static inline unsigned
2229 gimple_omp_subcode (const gimple
*s
)
2231 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2232 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2236 /* Set the subcode for OMP statement S to SUBCODE. */
2239 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2241 /* We only have 16 bits for the subcode. Assert that we are not
2243 gcc_gimple_checking_assert (subcode
< (1 << 16));
2244 s
->subcode
= subcode
;
2247 /* Set the nowait flag on OMP_RETURN statement S. */
2250 gimple_omp_return_set_nowait (gimple
*s
)
2252 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2253 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2257 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2261 gimple_omp_return_nowait_p (const gimple
*g
)
2263 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2264 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2268 /* Set the LHS of OMP return. */
2271 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2273 gimple_statement_omp_return
*omp_return_stmt
=
2274 as_a
<gimple_statement_omp_return
*> (g
);
2275 omp_return_stmt
->val
= lhs
;
2279 /* Get the LHS of OMP return. */
2282 gimple_omp_return_lhs (const gimple
*g
)
2284 const gimple_statement_omp_return
*omp_return_stmt
=
2285 as_a
<const gimple_statement_omp_return
*> (g
);
2286 return omp_return_stmt
->val
;
2290 /* Return a pointer to the LHS of OMP return. */
2292 static inline tree
*
2293 gimple_omp_return_lhs_ptr (gimple
*g
)
2295 gimple_statement_omp_return
*omp_return_stmt
=
2296 as_a
<gimple_statement_omp_return
*> (g
);
2297 return &omp_return_stmt
->val
;
2301 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2305 gimple_omp_section_last_p (const gimple
*g
)
2307 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2308 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2312 /* Set the GF_OMP_SECTION_LAST flag on G. */
2315 gimple_omp_section_set_last (gimple
*g
)
2317 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2318 g
->subcode
|= GF_OMP_SECTION_LAST
;
2322 /* Return true if OMP parallel statement G has the
2323 GF_OMP_PARALLEL_COMBINED flag set. */
2326 gimple_omp_parallel_combined_p (const gimple
*g
)
2328 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2329 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2333 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2334 value of COMBINED_P. */
2337 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2339 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2341 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2343 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2347 /* Return true if OMP atomic load/store statement G has the
2348 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2351 gimple_omp_atomic_need_value_p (const gimple
*g
)
2353 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2354 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2355 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2359 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2362 gimple_omp_atomic_set_need_value (gimple
*g
)
2364 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2365 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2366 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2370 /* Return the memory order of the OMP atomic load/store statement G. */
2372 static inline enum omp_memory_order
2373 gimple_omp_atomic_memory_order (const gimple
*g
)
2375 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2376 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2377 return (enum omp_memory_order
)
2378 (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_MEMORY_ORDER
);
2382 /* Set the memory order on G. */
2385 gimple_omp_atomic_set_memory_order (gimple
*g
, enum omp_memory_order mo
)
2387 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2388 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2389 g
->subcode
= ((g
->subcode
& ~GF_OMP_ATOMIC_MEMORY_ORDER
)
2390 | (mo
& GF_OMP_ATOMIC_MEMORY_ORDER
));
2394 /* Return the number of operands for statement GS. */
2396 static inline unsigned
2397 gimple_num_ops (const gimple
*gs
)
2403 /* Set the number of operands for statement GS. */
2406 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2408 gs
->num_ops
= num_ops
;
2412 /* Return the array of operands for statement GS. */
2414 static inline tree
*
2415 gimple_ops (gimple
*gs
)
2419 /* All the tuples have their operand vector at the very bottom
2420 of the structure. Note that those structures that do not
2421 have an operand vector have a zero offset. */
2422 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2423 gcc_gimple_checking_assert (off
!= 0);
2425 return (tree
*) ((char *) gs
+ off
);
2429 /* Return operand I for statement GS. */
2432 gimple_op (const gimple
*gs
, unsigned i
)
2434 if (gimple_has_ops (gs
))
2436 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2437 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2443 /* Return a pointer to operand I for statement GS. */
2445 static inline tree
*
2446 gimple_op_ptr (gimple
*gs
, unsigned i
)
2448 if (gimple_has_ops (gs
))
2450 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2451 return gimple_ops (gs
) + i
;
2457 /* Set operand I of statement GS to OP. */
2460 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2462 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2464 /* Note. It may be tempting to assert that OP matches
2465 is_gimple_operand, but that would be wrong. Different tuples
2466 accept slightly different sets of tree operands. Each caller
2467 should perform its own validation. */
2468 gimple_ops (gs
)[i
] = op
;
2471 /* Return true if GS is a GIMPLE_ASSIGN. */
2474 is_gimple_assign (const gimple
*gs
)
2476 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2479 /* Determine if expression CODE is one of the valid expressions that can
2480 be used on the RHS of GIMPLE assignments. */
2482 static inline enum gimple_rhs_class
2483 get_gimple_rhs_class (enum tree_code code
)
2485 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2488 /* Return the LHS of assignment statement GS. */
2491 gimple_assign_lhs (const gassign
*gs
)
2497 gimple_assign_lhs (const gimple
*gs
)
2499 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2500 return gimple_assign_lhs (ass
);
2504 /* Return a pointer to the LHS of assignment statement GS. */
2506 static inline tree
*
2507 gimple_assign_lhs_ptr (gassign
*gs
)
2512 static inline tree
*
2513 gimple_assign_lhs_ptr (gimple
*gs
)
2515 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2516 return gimple_assign_lhs_ptr (ass
);
2520 /* Set LHS to be the LHS operand of assignment statement GS. */
2523 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2527 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2528 SSA_NAME_DEF_STMT (lhs
) = gs
;
2532 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2534 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2535 gimple_assign_set_lhs (ass
, lhs
);
2539 /* Return the first operand on the RHS of assignment statement GS. */
2542 gimple_assign_rhs1 (const gassign
*gs
)
2548 gimple_assign_rhs1 (const gimple
*gs
)
2550 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2551 return gimple_assign_rhs1 (ass
);
2555 /* Return a pointer to the first operand on the RHS of assignment
2558 static inline tree
*
2559 gimple_assign_rhs1_ptr (gassign
*gs
)
2564 static inline tree
*
2565 gimple_assign_rhs1_ptr (gimple
*gs
)
2567 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2568 return gimple_assign_rhs1_ptr (ass
);
2571 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2574 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2580 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2582 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2583 gimple_assign_set_rhs1 (ass
, rhs
);
2587 /* Return the second operand on the RHS of assignment statement GS.
2588 If GS does not have two operands, NULL is returned instead. */
2591 gimple_assign_rhs2 (const gassign
*gs
)
2593 if (gimple_num_ops (gs
) >= 3)
2600 gimple_assign_rhs2 (const gimple
*gs
)
2602 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2603 return gimple_assign_rhs2 (ass
);
2607 /* Return a pointer to the second operand on the RHS of assignment
2610 static inline tree
*
2611 gimple_assign_rhs2_ptr (gassign
*gs
)
2613 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2617 static inline tree
*
2618 gimple_assign_rhs2_ptr (gimple
*gs
)
2620 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2621 return gimple_assign_rhs2_ptr (ass
);
2625 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2628 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2630 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2635 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2637 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2638 return gimple_assign_set_rhs2 (ass
, rhs
);
2641 /* Return the third operand on the RHS of assignment statement GS.
2642 If GS does not have two operands, NULL is returned instead. */
2645 gimple_assign_rhs3 (const gassign
*gs
)
2647 if (gimple_num_ops (gs
) >= 4)
2654 gimple_assign_rhs3 (const gimple
*gs
)
2656 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2657 return gimple_assign_rhs3 (ass
);
2660 /* Return a pointer to the third operand on the RHS of assignment
2663 static inline tree
*
2664 gimple_assign_rhs3_ptr (gimple
*gs
)
2666 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2667 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2672 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2675 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2677 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2682 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2684 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2685 gimple_assign_set_rhs3 (ass
, rhs
);
2689 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2690 which expect to see only two operands. */
2693 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2696 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2699 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2700 which expect to see only one operands. */
2703 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2706 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2709 /* Returns true if GS is a nontemporal move. */
2712 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2714 return gs
->nontemporal_move
;
2717 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2720 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2722 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2723 gs
->nontemporal_move
= nontemporal
;
2727 /* Return the code of the expression computed on the rhs of assignment
2728 statement GS. In case that the RHS is a single object, returns the
2729 tree code of the object. */
2731 static inline enum tree_code
2732 gimple_assign_rhs_code (const gassign
*gs
)
2734 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2735 /* While we initially set subcode to the TREE_CODE of the rhs for
2736 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2737 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2738 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2739 code
= TREE_CODE (gs
->op
[1]);
2744 static inline enum tree_code
2745 gimple_assign_rhs_code (const gimple
*gs
)
2747 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2748 return gimple_assign_rhs_code (ass
);
2752 /* Set CODE to be the code for the expression computed on the RHS of
2756 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2758 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2763 /* Return the gimple rhs class of the code of the expression computed on
2764 the rhs of assignment statement GS.
2765 This will never return GIMPLE_INVALID_RHS. */
2767 static inline enum gimple_rhs_class
2768 gimple_assign_rhs_class (const gimple
*gs
)
2770 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2773 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2774 there is no operator associated with the assignment itself.
2775 Unlike gimple_assign_copy_p, this predicate returns true for
2776 any RHS operand, including those that perform an operation
2777 and do not have the semantics of a copy, such as COND_EXPR. */
2780 gimple_assign_single_p (const gimple
*gs
)
2782 return (is_gimple_assign (gs
)
2783 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2786 /* Return true if GS performs a store to its lhs. */
2789 gimple_store_p (const gimple
*gs
)
2791 tree lhs
= gimple_get_lhs (gs
);
2792 return lhs
&& !is_gimple_reg (lhs
);
2795 /* Return true if GS is an assignment that loads from its rhs1. */
2798 gimple_assign_load_p (const gimple
*gs
)
2801 if (!gimple_assign_single_p (gs
))
2803 rhs
= gimple_assign_rhs1 (gs
);
2804 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2806 rhs
= get_base_address (rhs
);
2807 return (DECL_P (rhs
)
2808 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2812 /* Return true if S is a type-cast assignment. */
2815 gimple_assign_cast_p (const gimple
*s
)
2817 if (is_gimple_assign (s
))
2819 enum tree_code sc
= gimple_assign_rhs_code (s
);
2820 return CONVERT_EXPR_CODE_P (sc
)
2821 || sc
== VIEW_CONVERT_EXPR
2822 || sc
== FIX_TRUNC_EXPR
;
2828 /* Return true if S is a clobber statement. */
2831 gimple_clobber_p (const gimple
*s
)
2833 return gimple_assign_single_p (s
)
2834 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2837 /* Return true if GS is a GIMPLE_CALL. */
2840 is_gimple_call (const gimple
*gs
)
2842 return gimple_code (gs
) == GIMPLE_CALL
;
2845 /* Return the LHS of call statement GS. */
2848 gimple_call_lhs (const gcall
*gs
)
2854 gimple_call_lhs (const gimple
*gs
)
2856 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2857 return gimple_call_lhs (gc
);
2861 /* Return a pointer to the LHS of call statement GS. */
2863 static inline tree
*
2864 gimple_call_lhs_ptr (gcall
*gs
)
2869 static inline tree
*
2870 gimple_call_lhs_ptr (gimple
*gs
)
2872 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2873 return gimple_call_lhs_ptr (gc
);
2877 /* Set LHS to be the LHS operand of call statement GS. */
2880 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2883 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2884 SSA_NAME_DEF_STMT (lhs
) = gs
;
2888 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2890 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2891 gimple_call_set_lhs (gc
, lhs
);
2895 /* Return true if call GS calls an internal-only function, as enumerated
2899 gimple_call_internal_p (const gcall
*gs
)
2901 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2905 gimple_call_internal_p (const gimple
*gs
)
2907 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2908 return gimple_call_internal_p (gc
);
2911 /* Return true if call GS is marked as nocf_check. */
2914 gimple_call_nocf_check_p (const gcall
*gs
)
2916 return (gs
->subcode
& GF_CALL_NOCF_CHECK
) != 0;
2919 /* Mark statement GS as nocf_check call. */
2922 gimple_call_set_nocf_check (gcall
*gs
, bool nocf_check
)
2925 gs
->subcode
|= GF_CALL_NOCF_CHECK
;
2927 gs
->subcode
&= ~GF_CALL_NOCF_CHECK
;
2930 /* Return the target of internal call GS. */
2932 static inline enum internal_fn
2933 gimple_call_internal_fn (const gcall
*gs
)
2935 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2936 return gs
->u
.internal_fn
;
2939 static inline enum internal_fn
2940 gimple_call_internal_fn (const gimple
*gs
)
2942 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2943 return gimple_call_internal_fn (gc
);
2946 /* Return true, if this internal gimple call is unique. */
2949 gimple_call_internal_unique_p (const gcall
*gs
)
2951 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
2955 gimple_call_internal_unique_p (const gimple
*gs
)
2957 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2958 return gimple_call_internal_unique_p (gc
);
2961 /* Return true if GS is an internal function FN. */
2964 gimple_call_internal_p (const gimple
*gs
, internal_fn fn
)
2966 return (is_gimple_call (gs
)
2967 && gimple_call_internal_p (gs
)
2968 && gimple_call_internal_fn (gs
) == fn
);
2971 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2972 that could alter control flow. */
2975 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
2977 if (ctrl_altering_p
)
2978 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2980 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2984 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
2986 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
2987 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
2990 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2991 flag is set. Such call could not be a stmt in the middle of a bb. */
2994 gimple_call_ctrl_altering_p (const gcall
*gs
)
2996 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
3000 gimple_call_ctrl_altering_p (const gimple
*gs
)
3002 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3003 return gimple_call_ctrl_altering_p (gc
);
3007 /* Return the function type of the function called by GS. */
3010 gimple_call_fntype (const gcall
*gs
)
3012 if (gimple_call_internal_p (gs
))
3014 return gs
->u
.fntype
;
3018 gimple_call_fntype (const gimple
*gs
)
3020 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3021 return gimple_call_fntype (call_stmt
);
3024 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3027 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
3029 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
3030 call_stmt
->u
.fntype
= fntype
;
3034 /* Return the tree node representing the function called by call
3038 gimple_call_fn (const gcall
*gs
)
3044 gimple_call_fn (const gimple
*gs
)
3046 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3047 return gimple_call_fn (gc
);
3050 /* Return a pointer to the tree node representing the function called by call
3053 static inline tree
*
3054 gimple_call_fn_ptr (gcall
*gs
)
3059 static inline tree
*
3060 gimple_call_fn_ptr (gimple
*gs
)
3062 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3063 return gimple_call_fn_ptr (gc
);
3067 /* Set FN to be the function called by call statement GS. */
3070 gimple_call_set_fn (gcall
*gs
, tree fn
)
3072 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3077 /* Set FNDECL to be the function called by call statement GS. */
3080 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3082 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3083 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3084 build_pointer_type (TREE_TYPE (decl
)), decl
);
3088 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3090 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3091 gimple_call_set_fndecl (gc
, decl
);
3095 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3098 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3100 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3101 call_stmt
->u
.internal_fn
= fn
;
3105 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3106 Otherwise return NULL. This function is analogous to
3107 get_callee_fndecl in tree land. */
3110 gimple_call_fndecl (const gcall
*gs
)
3112 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3116 gimple_call_fndecl (const gimple
*gs
)
3118 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3119 return gimple_call_fndecl (gc
);
3123 /* Return the type returned by call statement GS. */
3126 gimple_call_return_type (const gcall
*gs
)
3128 tree type
= gimple_call_fntype (gs
);
3130 if (type
== NULL_TREE
)
3131 return TREE_TYPE (gimple_call_lhs (gs
));
3133 /* The type returned by a function is the type of its
3135 return TREE_TYPE (type
);
3139 /* Return the static chain for call statement GS. */
3142 gimple_call_chain (const gcall
*gs
)
3148 gimple_call_chain (const gimple
*gs
)
3150 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3151 return gimple_call_chain (gc
);
3155 /* Return a pointer to the static chain for call statement CALL_STMT. */
3157 static inline tree
*
3158 gimple_call_chain_ptr (gcall
*call_stmt
)
3160 return &call_stmt
->op
[2];
3163 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3166 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3168 call_stmt
->op
[2] = chain
;
3172 /* Return the number of arguments used by call statement GS. */
3174 static inline unsigned
3175 gimple_call_num_args (const gcall
*gs
)
3177 return gimple_num_ops (gs
) - 3;
3180 static inline unsigned
3181 gimple_call_num_args (const gimple
*gs
)
3183 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3184 return gimple_call_num_args (gc
);
3188 /* Return the argument at position INDEX for call statement GS. */
3191 gimple_call_arg (const gcall
*gs
, unsigned index
)
3193 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3194 return gs
->op
[index
+ 3];
3198 gimple_call_arg (const gimple
*gs
, unsigned index
)
3200 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3201 return gimple_call_arg (gc
, index
);
3205 /* Return a pointer to the argument at position INDEX for call
3208 static inline tree
*
3209 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3211 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3212 return &gs
->op
[index
+ 3];
3215 static inline tree
*
3216 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3218 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3219 return gimple_call_arg_ptr (gc
, index
);
3223 /* Set ARG to be the argument at position INDEX for call statement GS. */
3226 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3228 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3229 gs
->op
[index
+ 3] = arg
;
3233 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3235 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3236 gimple_call_set_arg (gc
, index
, arg
);
3240 /* If TAIL_P is true, mark call statement S as being a tail call
3241 (i.e., a call just before the exit of a function). These calls are
3242 candidate for tail call optimization. */
3245 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3248 s
->subcode
|= GF_CALL_TAILCALL
;
3250 s
->subcode
&= ~GF_CALL_TAILCALL
;
3254 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3257 gimple_call_tail_p (gcall
*s
)
3259 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3262 /* Mark (or clear) call statement S as requiring tail call optimization. */
3265 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3268 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3270 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3273 /* Return true if call statement has been marked as requiring
3274 tail call optimization. */
3277 gimple_call_must_tail_p (const gcall
*s
)
3279 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3282 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3283 slot optimization. This transformation uses the target of the call
3284 expansion as the return slot for calls that return in memory. */
3287 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3289 if (return_slot_opt_p
)
3290 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3292 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3296 /* Return true if S is marked for return slot optimization. */
3299 gimple_call_return_slot_opt_p (gcall
*s
)
3301 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3305 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3306 thunk to the thunked-to function. */
3309 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3312 s
->subcode
|= GF_CALL_FROM_THUNK
;
3314 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3318 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3321 gimple_call_from_thunk_p (gcall
*s
)
3323 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3327 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3328 argument pack in its argument list. */
3331 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3333 if (pass_arg_pack_p
)
3334 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3336 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3340 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3341 argument pack in its argument list. */
3344 gimple_call_va_arg_pack_p (gcall
*s
)
3346 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3350 /* Return true if S is a noreturn call. */
3353 gimple_call_noreturn_p (const gcall
*s
)
3355 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3359 gimple_call_noreturn_p (const gimple
*s
)
3361 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3362 return gimple_call_noreturn_p (gc
);
3366 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3367 even if the called function can throw in other cases. */
3370 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3373 s
->subcode
|= GF_CALL_NOTHROW
;
3375 s
->subcode
&= ~GF_CALL_NOTHROW
;
3378 /* Return true if S is a nothrow call. */
3381 gimple_call_nothrow_p (gcall
*s
)
3383 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3386 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3387 is known to be emitted for VLA objects. Those are wrapped by
3388 stack_save/stack_restore calls and hence can't lead to unbounded
3389 stack growth even when they occur in loops. */
3392 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3395 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3397 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3400 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3403 gimple_call_alloca_for_var_p (gcall
*s
)
3405 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3408 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3409 pointers to nested function are descriptors instead of trampolines. */
3412 gimple_call_set_by_descriptor (gcall
*s
, bool by_descriptor_p
)
3414 if (by_descriptor_p
)
3415 s
->subcode
|= GF_CALL_BY_DESCRIPTOR
;
3417 s
->subcode
&= ~GF_CALL_BY_DESCRIPTOR
;
3420 /* Return true if S is a by-descriptor call. */
3423 gimple_call_by_descriptor_p (gcall
*s
)
3425 return (s
->subcode
& GF_CALL_BY_DESCRIPTOR
) != 0;
3428 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3431 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3433 dest_call
->subcode
= orig_call
->subcode
;
3437 /* Return a pointer to the points-to solution for the set of call-used
3438 variables of the call CALL_STMT. */
3440 static inline struct pt_solution
*
3441 gimple_call_use_set (gcall
*call_stmt
)
3443 return &call_stmt
->call_used
;
3447 /* Return a pointer to the points-to solution for the set of call-used
3448 variables of the call CALL_STMT. */
3450 static inline struct pt_solution
*
3451 gimple_call_clobber_set (gcall
*call_stmt
)
3453 return &call_stmt
->call_clobbered
;
3457 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3461 gimple_has_lhs (gimple
*stmt
)
3463 if (is_gimple_assign (stmt
))
3465 if (gcall
*call
= dyn_cast
<gcall
*> (stmt
))
3466 return gimple_call_lhs (call
) != NULL_TREE
;
3471 /* Return the code of the predicate computed by conditional statement GS. */
3473 static inline enum tree_code
3474 gimple_cond_code (const gcond
*gs
)
3476 return (enum tree_code
) gs
->subcode
;
3479 static inline enum tree_code
3480 gimple_cond_code (const gimple
*gs
)
3482 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3483 return gimple_cond_code (gc
);
3487 /* Set CODE to be the predicate code for the conditional statement GS. */
3490 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3496 /* Return the LHS of the predicate computed by conditional statement GS. */
3499 gimple_cond_lhs (const gcond
*gs
)
3505 gimple_cond_lhs (const gimple
*gs
)
3507 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3508 return gimple_cond_lhs (gc
);
3511 /* Return the pointer to the LHS of the predicate computed by conditional
3514 static inline tree
*
3515 gimple_cond_lhs_ptr (gcond
*gs
)
3520 /* Set LHS to be the LHS operand of the predicate computed by
3521 conditional statement GS. */
3524 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3530 /* Return the RHS operand of the predicate computed by conditional GS. */
3533 gimple_cond_rhs (const gcond
*gs
)
3539 gimple_cond_rhs (const gimple
*gs
)
3541 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3542 return gimple_cond_rhs (gc
);
3545 /* Return the pointer to the RHS operand of the predicate computed by
3548 static inline tree
*
3549 gimple_cond_rhs_ptr (gcond
*gs
)
3555 /* Set RHS to be the RHS operand of the predicate computed by
3556 conditional statement GS. */
3559 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3565 /* Return the label used by conditional statement GS when its
3566 predicate evaluates to true. */
3569 gimple_cond_true_label (const gcond
*gs
)
3575 /* Set LABEL to be the label used by conditional statement GS when its
3576 predicate evaluates to true. */
3579 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3585 /* Set LABEL to be the label used by conditional statement GS when its
3586 predicate evaluates to false. */
3589 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3595 /* Return the label used by conditional statement GS when its
3596 predicate evaluates to false. */
3599 gimple_cond_false_label (const gcond
*gs
)
3605 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3608 gimple_cond_make_false (gcond
*gs
)
3610 gimple_cond_set_lhs (gs
, boolean_false_node
);
3611 gimple_cond_set_rhs (gs
, boolean_false_node
);
3612 gs
->subcode
= NE_EXPR
;
3616 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3619 gimple_cond_make_true (gcond
*gs
)
3621 gimple_cond_set_lhs (gs
, boolean_true_node
);
3622 gimple_cond_set_rhs (gs
, boolean_false_node
);
3623 gs
->subcode
= NE_EXPR
;
3626 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3627 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3630 gimple_cond_true_p (const gcond
*gs
)
3632 tree lhs
= gimple_cond_lhs (gs
);
3633 tree rhs
= gimple_cond_rhs (gs
);
3634 enum tree_code code
= gimple_cond_code (gs
);
3636 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3639 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3642 if (code
== NE_EXPR
&& lhs
!= rhs
)
3645 if (code
== EQ_EXPR
&& lhs
== rhs
)
3651 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3652 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3655 gimple_cond_false_p (const gcond
*gs
)
3657 tree lhs
= gimple_cond_lhs (gs
);
3658 tree rhs
= gimple_cond_rhs (gs
);
3659 enum tree_code code
= gimple_cond_code (gs
);
3661 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3664 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3667 if (code
== NE_EXPR
&& lhs
== rhs
)
3670 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3676 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3679 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3682 gimple_cond_set_code (stmt
, code
);
3683 gimple_cond_set_lhs (stmt
, lhs
);
3684 gimple_cond_set_rhs (stmt
, rhs
);
3687 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3690 gimple_label_label (const glabel
*gs
)
3696 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3700 gimple_label_set_label (glabel
*gs
, tree label
)
3706 /* Return the destination of the unconditional jump GS. */
3709 gimple_goto_dest (const gimple
*gs
)
3711 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3712 return gimple_op (gs
, 0);
3716 /* Set DEST to be the destination of the unconditonal jump GS. */
3719 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3725 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3728 gimple_bind_vars (const gbind
*bind_stmt
)
3730 return bind_stmt
->vars
;
3734 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3738 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3740 bind_stmt
->vars
= vars
;
3744 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3748 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3750 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3754 static inline gimple_seq
*
3755 gimple_bind_body_ptr (gbind
*bind_stmt
)
3757 return &bind_stmt
->body
;
3760 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3762 static inline gimple_seq
3763 gimple_bind_body (gbind
*gs
)
3765 return *gimple_bind_body_ptr (gs
);
3769 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3773 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3775 bind_stmt
->body
= seq
;
3779 /* Append a statement to the end of a GIMPLE_BIND's body. */
3782 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3784 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3788 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3791 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3793 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3797 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3798 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3801 gimple_bind_block (const gbind
*bind_stmt
)
3803 return bind_stmt
->block
;
3807 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3811 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3813 gcc_gimple_checking_assert (block
== NULL_TREE
3814 || TREE_CODE (block
) == BLOCK
);
3815 bind_stmt
->block
= block
;
3819 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3821 static inline unsigned
3822 gimple_asm_ninputs (const gasm
*asm_stmt
)
3824 return asm_stmt
->ni
;
3828 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3830 static inline unsigned
3831 gimple_asm_noutputs (const gasm
*asm_stmt
)
3833 return asm_stmt
->no
;
3837 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3839 static inline unsigned
3840 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3842 return asm_stmt
->nc
;
3845 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3847 static inline unsigned
3848 gimple_asm_nlabels (const gasm
*asm_stmt
)
3850 return asm_stmt
->nl
;
3853 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3856 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3858 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3859 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3862 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3865 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3867 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3868 && TREE_CODE (in_op
) == TREE_LIST
);
3869 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3873 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3876 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3878 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3879 return asm_stmt
->op
[index
];
3882 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3885 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
3887 gcc_gimple_checking_assert (index
< asm_stmt
->no
3888 && TREE_CODE (out_op
) == TREE_LIST
);
3889 asm_stmt
->op
[index
] = out_op
;
3893 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3896 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
3898 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3899 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
3903 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3906 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
3908 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3909 && TREE_CODE (clobber_op
) == TREE_LIST
);
3910 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
3913 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3916 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
3918 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3919 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
];
3922 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3925 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
3927 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3928 && TREE_CODE (label_op
) == TREE_LIST
);
3929 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
3932 /* Return the string representing the assembly instruction in
3933 GIMPLE_ASM ASM_STMT. */
3935 static inline const char *
3936 gimple_asm_string (const gasm
*asm_stmt
)
3938 return asm_stmt
->string
;
3942 /* Return true if ASM_STMT is marked volatile. */
3945 gimple_asm_volatile_p (const gasm
*asm_stmt
)
3947 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
3951 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
3954 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
3957 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
3959 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
3963 /* Return true if ASM_STMT is marked inline. */
3966 gimple_asm_inline_p (const gasm
*asm_stmt
)
3968 return (asm_stmt
->subcode
& GF_ASM_INLINE
) != 0;
3972 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
3975 gimple_asm_set_inline (gasm
*asm_stmt
, bool inline_p
)
3978 asm_stmt
->subcode
|= GF_ASM_INLINE
;
3980 asm_stmt
->subcode
&= ~GF_ASM_INLINE
;
3984 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3987 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
3990 asm_stmt
->subcode
|= GF_ASM_INPUT
;
3992 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
3996 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3999 gimple_asm_input_p (const gasm
*asm_stmt
)
4001 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
4005 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4008 gimple_catch_types (const gcatch
*catch_stmt
)
4010 return catch_stmt
->types
;
4014 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4016 static inline tree
*
4017 gimple_catch_types_ptr (gcatch
*catch_stmt
)
4019 return &catch_stmt
->types
;
4023 /* Return a pointer to the GIMPLE sequence representing the body of
4024 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4026 static inline gimple_seq
*
4027 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
4029 return &catch_stmt
->handler
;
4033 /* Return the GIMPLE sequence representing the body of the handler of
4034 GIMPLE_CATCH statement CATCH_STMT. */
4036 static inline gimple_seq
4037 gimple_catch_handler (gcatch
*catch_stmt
)
4039 return *gimple_catch_handler_ptr (catch_stmt
);
4043 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4046 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
4048 catch_stmt
->types
= t
;
4052 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4055 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
4057 catch_stmt
->handler
= handler
;
4061 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4064 gimple_eh_filter_types (const gimple
*gs
)
4066 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
4067 return eh_filter_stmt
->types
;
4071 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4074 static inline tree
*
4075 gimple_eh_filter_types_ptr (gimple
*gs
)
4077 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4078 return &eh_filter_stmt
->types
;
4082 /* Return a pointer to the sequence of statement to execute when
4083 GIMPLE_EH_FILTER statement fails. */
4085 static inline gimple_seq
*
4086 gimple_eh_filter_failure_ptr (gimple
*gs
)
4088 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4089 return &eh_filter_stmt
->failure
;
4093 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4096 static inline gimple_seq
4097 gimple_eh_filter_failure (gimple
*gs
)
4099 return *gimple_eh_filter_failure_ptr (gs
);
4103 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4107 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4109 eh_filter_stmt
->types
= types
;
4113 /* Set FAILURE to be the sequence of statements to execute on failure
4114 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4117 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4120 eh_filter_stmt
->failure
= failure
;
4123 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4126 gimple_eh_must_not_throw_fndecl (geh_mnt
*eh_mnt_stmt
)
4128 return eh_mnt_stmt
->fndecl
;
4131 /* Set the function decl to be called by GS to DECL. */
4134 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4137 eh_mnt_stmt
->fndecl
= decl
;
4140 /* GIMPLE_EH_ELSE accessors. */
4142 static inline gimple_seq
*
4143 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4145 return &eh_else_stmt
->n_body
;
4148 static inline gimple_seq
4149 gimple_eh_else_n_body (geh_else
*eh_else_stmt
)
4151 return *gimple_eh_else_n_body_ptr (eh_else_stmt
);
4154 static inline gimple_seq
*
4155 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4157 return &eh_else_stmt
->e_body
;
4160 static inline gimple_seq
4161 gimple_eh_else_e_body (geh_else
*eh_else_stmt
)
4163 return *gimple_eh_else_e_body_ptr (eh_else_stmt
);
4167 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4169 eh_else_stmt
->n_body
= seq
;
4173 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4175 eh_else_stmt
->e_body
= seq
;
4178 /* GIMPLE_TRY accessors. */
4180 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4181 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4183 static inline enum gimple_try_flags
4184 gimple_try_kind (const gimple
*gs
)
4186 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4187 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4191 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4194 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4196 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4197 || kind
== GIMPLE_TRY_FINALLY
);
4198 if (gimple_try_kind (gs
) != kind
)
4199 gs
->subcode
= (unsigned int) kind
;
4203 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4206 gimple_try_catch_is_cleanup (const gimple
*gs
)
4208 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4209 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4213 /* Return a pointer to the sequence of statements used as the
4214 body for GIMPLE_TRY GS. */
4216 static inline gimple_seq
*
4217 gimple_try_eval_ptr (gimple
*gs
)
4219 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4220 return &try_stmt
->eval
;
4224 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4226 static inline gimple_seq
4227 gimple_try_eval (gimple
*gs
)
4229 return *gimple_try_eval_ptr (gs
);
4233 /* Return a pointer to the sequence of statements used as the cleanup body for
4236 static inline gimple_seq
*
4237 gimple_try_cleanup_ptr (gimple
*gs
)
4239 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4240 return &try_stmt
->cleanup
;
4244 /* Return the sequence of statements used as the cleanup body for
4247 static inline gimple_seq
4248 gimple_try_cleanup (gimple
*gs
)
4250 return *gimple_try_cleanup_ptr (gs
);
4254 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4257 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4259 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4260 if (catch_is_cleanup
)
4261 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4263 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4267 /* Set EVAL to be the sequence of statements to use as the body for
4268 GIMPLE_TRY TRY_STMT. */
4271 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4273 try_stmt
->eval
= eval
;
4277 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4278 body for GIMPLE_TRY TRY_STMT. */
4281 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4283 try_stmt
->cleanup
= cleanup
;
4287 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4289 static inline gimple_seq
*
4290 gimple_wce_cleanup_ptr (gimple
*gs
)
4292 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4293 return &wce_stmt
->cleanup
;
4297 /* Return the cleanup sequence for cleanup statement GS. */
4299 static inline gimple_seq
4300 gimple_wce_cleanup (gimple
*gs
)
4302 return *gimple_wce_cleanup_ptr (gs
);
4306 /* Set CLEANUP to be the cleanup sequence for GS. */
4309 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4311 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4312 wce_stmt
->cleanup
= cleanup
;
4316 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4319 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4321 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4322 return gs
->subcode
!= 0;
4326 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4329 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4331 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4332 gs
->subcode
= (unsigned int) eh_only_p
;
4336 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4338 static inline unsigned
4339 gimple_phi_capacity (const gimple
*gs
)
4341 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4342 return phi_stmt
->capacity
;
4346 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4347 be exactly the number of incoming edges for the basic block holding
4350 static inline unsigned
4351 gimple_phi_num_args (const gimple
*gs
)
4353 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4354 return phi_stmt
->nargs
;
4358 /* Return the SSA name created by GIMPLE_PHI GS. */
4361 gimple_phi_result (const gphi
*gs
)
4367 gimple_phi_result (const gimple
*gs
)
4369 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4370 return gimple_phi_result (phi_stmt
);
4373 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4375 static inline tree
*
4376 gimple_phi_result_ptr (gphi
*gs
)
4381 static inline tree
*
4382 gimple_phi_result_ptr (gimple
*gs
)
4384 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4385 return gimple_phi_result_ptr (phi_stmt
);
4388 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4391 gimple_phi_set_result (gphi
*phi
, tree result
)
4393 phi
->result
= result
;
4394 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4395 SSA_NAME_DEF_STMT (result
) = phi
;
4399 /* Return the PHI argument corresponding to incoming edge INDEX for
4402 static inline struct phi_arg_d
*
4403 gimple_phi_arg (gphi
*gs
, unsigned index
)
4405 gcc_gimple_checking_assert (index
< gs
->nargs
);
4406 return &(gs
->args
[index
]);
4409 static inline struct phi_arg_d
*
4410 gimple_phi_arg (gimple
*gs
, unsigned index
)
4412 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4413 return gimple_phi_arg (phi_stmt
, index
);
4416 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4417 for GIMPLE_PHI PHI. */
4420 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4422 gcc_gimple_checking_assert (index
< phi
->nargs
);
4423 phi
->args
[index
] = *phiarg
;
4426 /* Return the PHI nodes for basic block BB, or NULL if there are no
4429 static inline gimple_seq
4430 phi_nodes (const_basic_block bb
)
4432 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4433 return bb
->il
.gimple
.phi_nodes
;
4436 /* Return a pointer to the PHI nodes for basic block BB. */
4438 static inline gimple_seq
*
4439 phi_nodes_ptr (basic_block bb
)
4441 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4442 return &bb
->il
.gimple
.phi_nodes
;
4445 /* Return the tree operand for argument I of PHI node GS. */
4448 gimple_phi_arg_def (gphi
*gs
, size_t index
)
4450 return gimple_phi_arg (gs
, index
)->def
;
4454 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4456 return gimple_phi_arg (gs
, index
)->def
;
4460 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4462 static inline tree
*
4463 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4465 return &gimple_phi_arg (phi
, index
)->def
;
4468 /* Return the edge associated with argument I of phi node PHI. */
4471 gimple_phi_arg_edge (gphi
*phi
, size_t i
)
4473 return EDGE_PRED (gimple_bb (phi
), i
);
4476 /* Return the source location of gimple argument I of phi node PHI. */
4478 static inline location_t
4479 gimple_phi_arg_location (gphi
*phi
, size_t i
)
4481 return gimple_phi_arg (phi
, i
)->locus
;
4484 /* Return the source location of the argument on edge E of phi node PHI. */
4486 static inline location_t
4487 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4489 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4492 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4495 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, location_t loc
)
4497 gimple_phi_arg (phi
, i
)->locus
= loc
;
4500 /* Return TRUE if argument I of phi node PHI has a location record. */
4503 gimple_phi_arg_has_location (gphi
*phi
, size_t i
)
4505 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4509 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4512 gimple_resx_region (const gresx
*resx_stmt
)
4514 return resx_stmt
->region
;
4517 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4520 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4522 resx_stmt
->region
= region
;
4525 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4528 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4530 return eh_dispatch_stmt
->region
;
4533 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4534 EH_DISPATCH_STMT. */
4537 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4539 eh_dispatch_stmt
->region
= region
;
4542 /* Return the number of labels associated with the switch statement GS. */
4544 static inline unsigned
4545 gimple_switch_num_labels (const gswitch
*gs
)
4548 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4549 num_ops
= gimple_num_ops (gs
);
4550 gcc_gimple_checking_assert (num_ops
> 1);
4555 /* Set NLABELS to be the number of labels for the switch statement GS. */
4558 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4560 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4561 gimple_set_num_ops (g
, nlabels
+ 1);
4565 /* Return the index variable used by the switch statement GS. */
4568 gimple_switch_index (const gswitch
*gs
)
4574 /* Return a pointer to the index variable for the switch statement GS. */
4576 static inline tree
*
4577 gimple_switch_index_ptr (gswitch
*gs
)
4583 /* Set INDEX to be the index variable for switch statement GS. */
4586 gimple_switch_set_index (gswitch
*gs
, tree index
)
4588 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4593 /* Return the label numbered INDEX. The default label is 0, followed by any
4594 labels in a switch statement. */
4597 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4599 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4600 return gs
->op
[index
+ 1];
4603 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4606 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4608 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4609 && (label
== NULL_TREE
4610 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4611 gs
->op
[index
+ 1] = label
;
4614 /* Return the default label for a switch statement. */
4617 gimple_switch_default_label (const gswitch
*gs
)
4619 tree label
= gimple_switch_label (gs
, 0);
4620 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4624 /* Set the default label for a switch statement. */
4627 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4629 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4630 gimple_switch_set_label (gs
, 0, label
);
4633 /* Return true if GS is a GIMPLE_DEBUG statement. */
4636 is_gimple_debug (const gimple
*gs
)
4638 return gimple_code (gs
) == GIMPLE_DEBUG
;
4642 /* Return the last nondebug statement in GIMPLE sequence S. */
4644 static inline gimple
*
4645 gimple_seq_last_nondebug_stmt (gimple_seq s
)
4648 for (n
= gimple_seq_last (s
);
4649 n
&& is_gimple_debug (n
);
4657 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4660 gimple_debug_bind_p (const gimple
*s
)
4662 if (is_gimple_debug (s
))
4663 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4668 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4671 gimple_debug_bind_get_var (gimple
*dbg
)
4673 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4674 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4675 return gimple_op (dbg
, 0);
4678 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4682 gimple_debug_bind_get_value (gimple
*dbg
)
4684 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4685 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4686 return gimple_op (dbg
, 1);
4689 /* Return a pointer to the value bound to the variable in a
4690 GIMPLE_DEBUG bind statement. */
4692 static inline tree
*
4693 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4695 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4696 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4697 return gimple_op_ptr (dbg
, 1);
4700 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4703 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4705 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4706 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4707 gimple_set_op (dbg
, 0, var
);
4710 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4714 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4716 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4717 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4718 gimple_set_op (dbg
, 1, value
);
4721 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4723 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4725 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4729 gimple_debug_bind_reset_value (gimple
*dbg
)
4731 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4732 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4733 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4736 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4740 gimple_debug_bind_has_value_p (gimple
*dbg
)
4742 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4743 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4744 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4747 #undef GIMPLE_DEBUG_BIND_NOVALUE
4749 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4752 gimple_debug_source_bind_p (const gimple
*s
)
4754 if (is_gimple_debug (s
))
4755 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4760 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4763 gimple_debug_source_bind_get_var (gimple
*dbg
)
4765 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4766 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4767 return gimple_op (dbg
, 0);
4770 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4774 gimple_debug_source_bind_get_value (gimple
*dbg
)
4776 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4777 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4778 return gimple_op (dbg
, 1);
4781 /* Return a pointer to the value bound to the variable in a
4782 GIMPLE_DEBUG source bind statement. */
4784 static inline tree
*
4785 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4787 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4788 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4789 return gimple_op_ptr (dbg
, 1);
4792 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4795 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4797 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4798 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4799 gimple_set_op (dbg
, 0, var
);
4802 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4806 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4808 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4809 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4810 gimple_set_op (dbg
, 1, value
);
4813 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4816 gimple_debug_begin_stmt_p (const gimple
*s
)
4818 if (is_gimple_debug (s
))
4819 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
;
4824 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4827 gimple_debug_inline_entry_p (const gimple
*s
)
4829 if (is_gimple_debug (s
))
4830 return s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4835 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4838 gimple_debug_nonbind_marker_p (const gimple
*s
)
4840 if (is_gimple_debug (s
))
4841 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
4842 || s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4847 /* Return the line number for EXPR, or return -1 if we have no line
4848 number information for it. */
4850 get_lineno (const gimple
*stmt
)
4857 loc
= gimple_location (stmt
);
4858 if (loc
== UNKNOWN_LOCATION
)
4861 return LOCATION_LINE (loc
);
4864 /* Return a pointer to the body for the OMP statement GS. */
4866 static inline gimple_seq
*
4867 gimple_omp_body_ptr (gimple
*gs
)
4869 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4872 /* Return the body for the OMP statement GS. */
4874 static inline gimple_seq
4875 gimple_omp_body (gimple
*gs
)
4877 return *gimple_omp_body_ptr (gs
);
4880 /* Set BODY to be the body for the OMP statement GS. */
4883 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
4885 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4889 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4892 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
4894 return crit_stmt
->name
;
4898 /* Return a pointer to the name associated with OMP critical statement
4901 static inline tree
*
4902 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
4904 return &crit_stmt
->name
;
4908 /* Set NAME to be the name associated with OMP critical statement
4912 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
4914 crit_stmt
->name
= name
;
4918 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4921 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
4923 return crit_stmt
->clauses
;
4927 /* Return a pointer to the clauses associated with OMP critical statement
4930 static inline tree
*
4931 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
4933 return &crit_stmt
->clauses
;
4937 /* Set CLAUSES to be the clauses associated with OMP critical statement
4941 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
4943 crit_stmt
->clauses
= clauses
;
4947 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4950 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
4952 return ord_stmt
->clauses
;
4956 /* Return a pointer to the clauses associated with OMP ordered statement
4959 static inline tree
*
4960 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
4962 return &ord_stmt
->clauses
;
4966 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4970 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
4972 ord_stmt
->clauses
= clauses
;
4976 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
4979 gimple_omp_scan_clauses (const gomp_scan
*scan_stmt
)
4981 return scan_stmt
->clauses
;
4985 /* Return a pointer to the clauses associated with OMP scan statement
4988 static inline tree
*
4989 gimple_omp_scan_clauses_ptr (gomp_scan
*scan_stmt
)
4991 return &scan_stmt
->clauses
;
4995 /* Set CLAUSES to be the clauses associated with OMP scan statement
4999 gimple_omp_scan_set_clauses (gomp_scan
*scan_stmt
, tree clauses
)
5001 scan_stmt
->clauses
= clauses
;
5005 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5008 gimple_omp_taskgroup_clauses (const gimple
*gs
)
5010 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5012 static_cast <const gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5016 /* Return a pointer to the clauses associated with OMP taskgroup statement
5019 static inline tree
*
5020 gimple_omp_taskgroup_clauses_ptr (gimple
*gs
)
5022 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5023 return &static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5027 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5031 gimple_omp_taskgroup_set_clauses (gimple
*gs
, tree clauses
)
5033 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5034 static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
5039 /* Return the kind of the OMP_FOR statemement G. */
5042 gimple_omp_for_kind (const gimple
*g
)
5044 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5045 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
5049 /* Set the kind of the OMP_FOR statement G. */
5052 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
5054 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
5055 | (kind
& GF_OMP_FOR_KIND_MASK
);
5059 /* Return true if OMP_FOR statement G has the
5060 GF_OMP_FOR_COMBINED flag set. */
5063 gimple_omp_for_combined_p (const gimple
*g
)
5065 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5066 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
5070 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5071 the boolean value of COMBINED_P. */
5074 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
5077 g
->subcode
|= GF_OMP_FOR_COMBINED
;
5079 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
5083 /* Return true if the OMP_FOR statement G has the
5084 GF_OMP_FOR_COMBINED_INTO flag set. */
5087 gimple_omp_for_combined_into_p (const gimple
*g
)
5089 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5090 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
5094 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5095 on the boolean value of COMBINED_P. */
5098 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
5101 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
5103 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
5107 /* Return the clauses associated with the OMP_FOR statement GS. */
5110 gimple_omp_for_clauses (const gimple
*gs
)
5112 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5113 return omp_for_stmt
->clauses
;
5117 /* Return a pointer to the clauses associated with the OMP_FOR statement
5120 static inline tree
*
5121 gimple_omp_for_clauses_ptr (gimple
*gs
)
5123 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5124 return &omp_for_stmt
->clauses
;
5128 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5132 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
5134 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5135 omp_for_stmt
->clauses
= clauses
;
5139 /* Get the collapse count of the OMP_FOR statement GS. */
5141 static inline size_t
5142 gimple_omp_for_collapse (gimple
*gs
)
5144 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5145 return omp_for_stmt
->collapse
;
5149 /* Return the condition code associated with the OMP_FOR statement GS. */
5151 static inline enum tree_code
5152 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
5154 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5155 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5156 return omp_for_stmt
->iter
[i
].cond
;
5160 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5163 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
5165 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5166 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5167 && i
< omp_for_stmt
->collapse
);
5168 omp_for_stmt
->iter
[i
].cond
= cond
;
5172 /* Return the index variable for the OMP_FOR statement GS. */
5175 gimple_omp_for_index (const gimple
*gs
, size_t i
)
5177 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5178 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5179 return omp_for_stmt
->iter
[i
].index
;
5183 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5185 static inline tree
*
5186 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
5188 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5189 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5190 return &omp_for_stmt
->iter
[i
].index
;
5194 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5197 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
5199 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5200 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5201 omp_for_stmt
->iter
[i
].index
= index
;
5205 /* Return the initial value for the OMP_FOR statement GS. */
5208 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
5210 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5211 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5212 return omp_for_stmt
->iter
[i
].initial
;
5216 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5218 static inline tree
*
5219 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
5221 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5222 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5223 return &omp_for_stmt
->iter
[i
].initial
;
5227 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5230 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5232 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5233 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5234 omp_for_stmt
->iter
[i
].initial
= initial
;
5238 /* Return the final value for the OMP_FOR statement GS. */
5241 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5243 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5244 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5245 return omp_for_stmt
->iter
[i
].final
;
5249 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5251 static inline tree
*
5252 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5254 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5255 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5256 return &omp_for_stmt
->iter
[i
].final
;
5260 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5263 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5265 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5266 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5267 omp_for_stmt
->iter
[i
].final
= final
;
5271 /* Return the increment value for the OMP_FOR statement GS. */
5274 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5276 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5277 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5278 return omp_for_stmt
->iter
[i
].incr
;
5282 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5284 static inline tree
*
5285 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5287 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5288 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5289 return &omp_for_stmt
->iter
[i
].incr
;
5293 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5296 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5298 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5299 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5300 omp_for_stmt
->iter
[i
].incr
= incr
;
5304 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5305 statement GS starts. */
5307 static inline gimple_seq
*
5308 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5310 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5311 return &omp_for_stmt
->pre_body
;
5315 /* Return the sequence of statements to execute before the OMP_FOR
5316 statement GS starts. */
5318 static inline gimple_seq
5319 gimple_omp_for_pre_body (gimple
*gs
)
5321 return *gimple_omp_for_pre_body_ptr (gs
);
5325 /* Set PRE_BODY to be the sequence of statements to execute before the
5326 OMP_FOR statement GS starts. */
5329 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5331 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5332 omp_for_stmt
->pre_body
= pre_body
;
5335 /* Return the kernel_phony of OMP_FOR statement. */
5338 gimple_omp_for_grid_phony (const gomp_for
*omp_for
)
5340 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5341 != GF_OMP_FOR_KIND_GRID_LOOP
);
5342 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_PHONY
) != 0;
5345 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5348 gimple_omp_for_set_grid_phony (gomp_for
*omp_for
, bool value
)
5350 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5351 != GF_OMP_FOR_KIND_GRID_LOOP
);
5353 omp_for
->subcode
|= GF_OMP_FOR_GRID_PHONY
;
5355 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_PHONY
;
5358 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5361 gimple_omp_for_grid_intra_group (const gomp_for
*omp_for
)
5363 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5364 == GF_OMP_FOR_KIND_GRID_LOOP
);
5365 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_INTRA_GROUP
) != 0;
5368 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5371 gimple_omp_for_set_grid_intra_group (gomp_for
*omp_for
, bool value
)
5373 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5374 == GF_OMP_FOR_KIND_GRID_LOOP
);
5376 omp_for
->subcode
|= GF_OMP_FOR_GRID_INTRA_GROUP
;
5378 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_INTRA_GROUP
;
5381 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5385 gimple_omp_for_grid_group_iter (const gomp_for
*omp_for
)
5387 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5388 == GF_OMP_FOR_KIND_GRID_LOOP
);
5389 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_GROUP_ITER
) != 0;
5392 /* Set group_iter flag of OMP_FOR to VALUE. */
5395 gimple_omp_for_set_grid_group_iter (gomp_for
*omp_for
, bool value
)
5397 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5398 == GF_OMP_FOR_KIND_GRID_LOOP
);
5400 omp_for
->subcode
|= GF_OMP_FOR_GRID_GROUP_ITER
;
5402 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_GROUP_ITER
;
5405 /* Return the clauses associated with OMP_PARALLEL GS. */
5408 gimple_omp_parallel_clauses (const gimple
*gs
)
5410 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5411 return omp_parallel_stmt
->clauses
;
5415 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5417 static inline tree
*
5418 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5420 return &omp_parallel_stmt
->clauses
;
5424 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5427 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5430 omp_parallel_stmt
->clauses
= clauses
;
5434 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5437 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5439 return omp_parallel_stmt
->child_fn
;
5442 /* Return a pointer to the child function used to hold the body of
5443 OMP_PARALLEL_STMT. */
5445 static inline tree
*
5446 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5448 return &omp_parallel_stmt
->child_fn
;
5452 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5455 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5458 omp_parallel_stmt
->child_fn
= child_fn
;
5462 /* Return the artificial argument used to send variables and values
5463 from the parent to the children threads in OMP_PARALLEL_STMT. */
5466 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5468 return omp_parallel_stmt
->data_arg
;
5472 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5474 static inline tree
*
5475 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5477 return &omp_parallel_stmt
->data_arg
;
5481 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5484 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5487 omp_parallel_stmt
->data_arg
= data_arg
;
5490 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5493 gimple_omp_parallel_grid_phony (const gomp_parallel
*stmt
)
5495 return (gimple_omp_subcode (stmt
) & GF_OMP_PARALLEL_GRID_PHONY
) != 0;
5498 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5501 gimple_omp_parallel_set_grid_phony (gomp_parallel
*stmt
, bool value
)
5504 stmt
->subcode
|= GF_OMP_PARALLEL_GRID_PHONY
;
5506 stmt
->subcode
&= ~GF_OMP_PARALLEL_GRID_PHONY
;
5509 /* Return the clauses associated with OMP_TASK GS. */
5512 gimple_omp_task_clauses (const gimple
*gs
)
5514 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5515 return omp_task_stmt
->clauses
;
5519 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5521 static inline tree
*
5522 gimple_omp_task_clauses_ptr (gimple
*gs
)
5524 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5525 return &omp_task_stmt
->clauses
;
5529 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5533 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5535 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5536 omp_task_stmt
->clauses
= clauses
;
5540 /* Return true if OMP task statement G has the
5541 GF_OMP_TASK_TASKLOOP flag set. */
5544 gimple_omp_task_taskloop_p (const gimple
*g
)
5546 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5547 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5551 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5552 value of TASKLOOP_P. */
5555 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5557 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5559 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5561 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5565 /* Return true if OMP task statement G has the
5566 GF_OMP_TASK_TASKWAIT flag set. */
5569 gimple_omp_task_taskwait_p (const gimple
*g
)
5571 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5572 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKWAIT
) != 0;
5576 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5577 value of TASKWAIT_P. */
5580 gimple_omp_task_set_taskwait_p (gimple
*g
, bool taskwait_p
)
5582 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5584 g
->subcode
|= GF_OMP_TASK_TASKWAIT
;
5586 g
->subcode
&= ~GF_OMP_TASK_TASKWAIT
;
5590 /* Return the child function used to hold the body of OMP_TASK GS. */
5593 gimple_omp_task_child_fn (const gimple
*gs
)
5595 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5596 return omp_task_stmt
->child_fn
;
5599 /* Return a pointer to the child function used to hold the body of
5602 static inline tree
*
5603 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5605 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5606 return &omp_task_stmt
->child_fn
;
5610 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5613 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5615 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5616 omp_task_stmt
->child_fn
= child_fn
;
5620 /* Return the artificial argument used to send variables and values
5621 from the parent to the children threads in OMP_TASK GS. */
5624 gimple_omp_task_data_arg (const gimple
*gs
)
5626 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5627 return omp_task_stmt
->data_arg
;
5631 /* Return a pointer to the data argument for OMP_TASK GS. */
5633 static inline tree
*
5634 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5636 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5637 return &omp_task_stmt
->data_arg
;
5641 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5644 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5646 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5647 omp_task_stmt
->data_arg
= data_arg
;
5651 /* Return the clauses associated with OMP_TASK GS. */
5654 gimple_omp_taskreg_clauses (const gimple
*gs
)
5656 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5657 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5658 return omp_taskreg_stmt
->clauses
;
5662 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5664 static inline tree
*
5665 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5667 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5668 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5669 return &omp_taskreg_stmt
->clauses
;
5673 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5677 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5679 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5680 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5681 omp_taskreg_stmt
->clauses
= clauses
;
5685 /* Return the child function used to hold the body of OMP_TASK GS. */
5688 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5690 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5691 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5692 return omp_taskreg_stmt
->child_fn
;
5695 /* Return a pointer to the child function used to hold the body of
5698 static inline tree
*
5699 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5701 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5702 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5703 return &omp_taskreg_stmt
->child_fn
;
5707 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5710 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5712 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5713 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5714 omp_taskreg_stmt
->child_fn
= child_fn
;
5718 /* Return the artificial argument used to send variables and values
5719 from the parent to the children threads in OMP_TASK GS. */
5722 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5724 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5725 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5726 return omp_taskreg_stmt
->data_arg
;
5730 /* Return a pointer to the data argument for OMP_TASK GS. */
5732 static inline tree
*
5733 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5735 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5736 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5737 return &omp_taskreg_stmt
->data_arg
;
5741 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5744 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5746 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5747 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5748 omp_taskreg_stmt
->data_arg
= data_arg
;
5752 /* Return the copy function used to hold the body of OMP_TASK GS. */
5755 gimple_omp_task_copy_fn (const gimple
*gs
)
5757 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5758 return omp_task_stmt
->copy_fn
;
5761 /* Return a pointer to the copy function used to hold the body of
5764 static inline tree
*
5765 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5767 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5768 return &omp_task_stmt
->copy_fn
;
5772 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5775 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5777 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5778 omp_task_stmt
->copy_fn
= copy_fn
;
5782 /* Return size of the data block in bytes in OMP_TASK GS. */
5785 gimple_omp_task_arg_size (const gimple
*gs
)
5787 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5788 return omp_task_stmt
->arg_size
;
5792 /* Return a pointer to the data block size for OMP_TASK GS. */
5794 static inline tree
*
5795 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5797 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5798 return &omp_task_stmt
->arg_size
;
5802 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5805 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5807 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5808 omp_task_stmt
->arg_size
= arg_size
;
5812 /* Return align of the data block in bytes in OMP_TASK GS. */
5815 gimple_omp_task_arg_align (const gimple
*gs
)
5817 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5818 return omp_task_stmt
->arg_align
;
5822 /* Return a pointer to the data block align for OMP_TASK GS. */
5824 static inline tree
*
5825 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5827 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5828 return &omp_task_stmt
->arg_align
;
5832 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5835 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5837 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5838 omp_task_stmt
->arg_align
= arg_align
;
5842 /* Return the clauses associated with OMP_SINGLE GS. */
5845 gimple_omp_single_clauses (const gimple
*gs
)
5847 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5848 return omp_single_stmt
->clauses
;
5852 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5854 static inline tree
*
5855 gimple_omp_single_clauses_ptr (gimple
*gs
)
5857 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5858 return &omp_single_stmt
->clauses
;
5862 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5865 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5867 omp_single_stmt
->clauses
= clauses
;
5871 /* Return the clauses associated with OMP_TARGET GS. */
5874 gimple_omp_target_clauses (const gimple
*gs
)
5876 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5877 return omp_target_stmt
->clauses
;
5881 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5883 static inline tree
*
5884 gimple_omp_target_clauses_ptr (gimple
*gs
)
5886 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5887 return &omp_target_stmt
->clauses
;
5891 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5894 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5897 omp_target_stmt
->clauses
= clauses
;
5901 /* Return the kind of the OMP_TARGET G. */
5904 gimple_omp_target_kind (const gimple
*g
)
5906 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5907 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5911 /* Set the kind of the OMP_TARGET G. */
5914 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5916 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5917 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5921 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5924 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5926 return omp_target_stmt
->child_fn
;
5929 /* Return a pointer to the child function used to hold the body of
5932 static inline tree
*
5933 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5935 return &omp_target_stmt
->child_fn
;
5939 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5942 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
5945 omp_target_stmt
->child_fn
= child_fn
;
5949 /* Return the artificial argument used to send variables and values
5950 from the parent to the children threads in OMP_TARGET_STMT. */
5953 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
5955 return omp_target_stmt
->data_arg
;
5959 /* Return a pointer to the data argument for OMP_TARGET GS. */
5961 static inline tree
*
5962 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
5964 return &omp_target_stmt
->data_arg
;
5968 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5971 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
5974 omp_target_stmt
->data_arg
= data_arg
;
5978 /* Return the clauses associated with OMP_TEAMS GS. */
5981 gimple_omp_teams_clauses (const gimple
*gs
)
5983 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
5984 return omp_teams_stmt
->clauses
;
5988 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5990 static inline tree
*
5991 gimple_omp_teams_clauses_ptr (gimple
*gs
)
5993 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
5994 return &omp_teams_stmt
->clauses
;
5998 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6001 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
6003 omp_teams_stmt
->clauses
= clauses
;
6006 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6009 gimple_omp_teams_child_fn (const gomp_teams
*omp_teams_stmt
)
6011 return omp_teams_stmt
->child_fn
;
6014 /* Return a pointer to the child function used to hold the body of
6017 static inline tree
*
6018 gimple_omp_teams_child_fn_ptr (gomp_teams
*omp_teams_stmt
)
6020 return &omp_teams_stmt
->child_fn
;
6024 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6027 gimple_omp_teams_set_child_fn (gomp_teams
*omp_teams_stmt
, tree child_fn
)
6029 omp_teams_stmt
->child_fn
= child_fn
;
6033 /* Return the artificial argument used to send variables and values
6034 from the parent to the children threads in OMP_TEAMS_STMT. */
6037 gimple_omp_teams_data_arg (const gomp_teams
*omp_teams_stmt
)
6039 return omp_teams_stmt
->data_arg
;
6043 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6045 static inline tree
*
6046 gimple_omp_teams_data_arg_ptr (gomp_teams
*omp_teams_stmt
)
6048 return &omp_teams_stmt
->data_arg
;
6052 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6055 gimple_omp_teams_set_data_arg (gomp_teams
*omp_teams_stmt
, tree data_arg
)
6057 omp_teams_stmt
->data_arg
= data_arg
;
6060 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
6063 gimple_omp_teams_grid_phony (const gomp_teams
*omp_teams_stmt
)
6065 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_GRID_PHONY
) != 0;
6068 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
6071 gimple_omp_teams_set_grid_phony (gomp_teams
*omp_teams_stmt
, bool value
)
6074 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_GRID_PHONY
;
6076 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_GRID_PHONY
;
6079 /* Return the host flag of an OMP_TEAMS_STMT. */
6082 gimple_omp_teams_host (const gomp_teams
*omp_teams_stmt
)
6084 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_HOST
) != 0;
6087 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6090 gimple_omp_teams_set_host (gomp_teams
*omp_teams_stmt
, bool value
)
6093 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_HOST
;
6095 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_HOST
;
6098 /* Return the clauses associated with OMP_SECTIONS GS. */
6101 gimple_omp_sections_clauses (const gimple
*gs
)
6103 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6104 return omp_sections_stmt
->clauses
;
6108 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6110 static inline tree
*
6111 gimple_omp_sections_clauses_ptr (gimple
*gs
)
6113 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6114 return &omp_sections_stmt
->clauses
;
6118 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6122 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
6124 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6125 omp_sections_stmt
->clauses
= clauses
;
6129 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6133 gimple_omp_sections_control (const gimple
*gs
)
6135 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6136 return omp_sections_stmt
->control
;
6140 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6143 static inline tree
*
6144 gimple_omp_sections_control_ptr (gimple
*gs
)
6146 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6147 return &omp_sections_stmt
->control
;
6151 /* Set CONTROL to be the set of clauses associated with the
6152 GIMPLE_OMP_SECTIONS in GS. */
6155 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
6157 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6158 omp_sections_stmt
->control
= control
;
6162 /* Set the value being stored in an atomic store. */
6165 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
6167 store_stmt
->val
= val
;
6171 /* Return the value being stored in an atomic store. */
6174 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
6176 return store_stmt
->val
;
6180 /* Return a pointer to the value being stored in an atomic store. */
6182 static inline tree
*
6183 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
6185 return &store_stmt
->val
;
6189 /* Set the LHS of an atomic load. */
6192 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
6194 load_stmt
->lhs
= lhs
;
6198 /* Get the LHS of an atomic load. */
6201 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
6203 return load_stmt
->lhs
;
6207 /* Return a pointer to the LHS of an atomic load. */
6209 static inline tree
*
6210 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
6212 return &load_stmt
->lhs
;
6216 /* Set the RHS of an atomic load. */
6219 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
6221 load_stmt
->rhs
= rhs
;
6225 /* Get the RHS of an atomic load. */
6228 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
6230 return load_stmt
->rhs
;
6234 /* Return a pointer to the RHS of an atomic load. */
6236 static inline tree
*
6237 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
6239 return &load_stmt
->rhs
;
6243 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6246 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
6248 return cont_stmt
->control_def
;
6251 /* The same as above, but return the address. */
6253 static inline tree
*
6254 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
6256 return &cont_stmt
->control_def
;
6259 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6262 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
6264 cont_stmt
->control_def
= def
;
6268 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6271 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
6273 return cont_stmt
->control_use
;
6277 /* The same as above, but return the address. */
6279 static inline tree
*
6280 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
6282 return &cont_stmt
->control_use
;
6286 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6289 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
6291 cont_stmt
->control_use
= use
;
6294 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6295 TRANSACTION_STMT. */
6297 static inline gimple_seq
*
6298 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
6300 return &transaction_stmt
->body
;
6303 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6305 static inline gimple_seq
6306 gimple_transaction_body (gtransaction
*transaction_stmt
)
6308 return transaction_stmt
->body
;
6311 /* Return the label associated with a GIMPLE_TRANSACTION. */
6314 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
6316 return transaction_stmt
->label_norm
;
6319 static inline tree
*
6320 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
6322 return &transaction_stmt
->label_norm
;
6326 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
6328 return transaction_stmt
->label_uninst
;
6331 static inline tree
*
6332 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
6334 return &transaction_stmt
->label_uninst
;
6338 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
6340 return transaction_stmt
->label_over
;
6343 static inline tree
*
6344 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
6346 return &transaction_stmt
->label_over
;
6349 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6351 static inline unsigned int
6352 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
6354 return transaction_stmt
->subcode
;
6357 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6358 TRANSACTION_STMT. */
6361 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
6364 transaction_stmt
->body
= body
;
6367 /* Set the label associated with a GIMPLE_TRANSACTION. */
6370 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
6372 transaction_stmt
->label_norm
= label
;
6376 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6378 transaction_stmt
->label_uninst
= label
;
6382 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6384 transaction_stmt
->label_over
= label
;
6387 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6390 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6391 unsigned int subcode
)
6393 transaction_stmt
->subcode
= subcode
;
6396 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6398 static inline tree
*
6399 gimple_return_retval_ptr (greturn
*gs
)
6404 /* Return the return value for GIMPLE_RETURN GS. */
6407 gimple_return_retval (const greturn
*gs
)
6413 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6416 gimple_return_set_retval (greturn
*gs
, tree retval
)
6422 /* Returns true when the gimple statement STMT is any of the OMP types. */
6424 #define CASE_GIMPLE_OMP \
6425 case GIMPLE_OMP_PARALLEL: \
6426 case GIMPLE_OMP_TASK: \
6427 case GIMPLE_OMP_FOR: \
6428 case GIMPLE_OMP_SECTIONS: \
6429 case GIMPLE_OMP_SECTIONS_SWITCH: \
6430 case GIMPLE_OMP_SINGLE: \
6431 case GIMPLE_OMP_TARGET: \
6432 case GIMPLE_OMP_TEAMS: \
6433 case GIMPLE_OMP_SECTION: \
6434 case GIMPLE_OMP_MASTER: \
6435 case GIMPLE_OMP_TASKGROUP: \
6436 case GIMPLE_OMP_ORDERED: \
6437 case GIMPLE_OMP_CRITICAL: \
6438 case GIMPLE_OMP_SCAN: \
6439 case GIMPLE_OMP_RETURN: \
6440 case GIMPLE_OMP_ATOMIC_LOAD: \
6441 case GIMPLE_OMP_ATOMIC_STORE: \
6442 case GIMPLE_OMP_CONTINUE: \
6443 case GIMPLE_OMP_GRID_BODY
6446 is_gimple_omp (const gimple
*stmt
)
6448 switch (gimple_code (stmt
))
6457 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6461 is_gimple_omp_oacc (const gimple
*stmt
)
6463 gcc_assert (is_gimple_omp (stmt
));
6464 switch (gimple_code (stmt
))
6466 case GIMPLE_OMP_FOR
:
6467 switch (gimple_omp_for_kind (stmt
))
6469 case GF_OMP_FOR_KIND_OACC_LOOP
:
6474 case GIMPLE_OMP_TARGET
:
6475 switch (gimple_omp_target_kind (stmt
))
6477 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6478 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6479 case GF_OMP_TARGET_KIND_OACC_DATA
:
6480 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6481 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
6482 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6483 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6494 /* Return true if the OMP gimple statement STMT is offloaded. */
6497 is_gimple_omp_offloaded (const gimple
*stmt
)
6499 gcc_assert (is_gimple_omp (stmt
));
6500 switch (gimple_code (stmt
))
6502 case GIMPLE_OMP_TARGET
:
6503 switch (gimple_omp_target_kind (stmt
))
6505 case GF_OMP_TARGET_KIND_REGION
:
6506 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6507 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6518 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6521 gimple_nop_p (const gimple
*g
)
6523 return gimple_code (g
) == GIMPLE_NOP
;
6527 /* Return true if GS is a GIMPLE_RESX. */
6530 is_gimple_resx (const gimple
*gs
)
6532 return gimple_code (gs
) == GIMPLE_RESX
;
6535 /* Return the type of the main expression computed by STMT. Return
6536 void_type_node if the statement computes nothing. */
6539 gimple_expr_type (const gimple
*stmt
)
6541 enum gimple_code code
= gimple_code (stmt
);
6542 /* In general we want to pass out a type that can be substituted
6543 for both the RHS and the LHS types if there is a possibly
6544 useless conversion involved. That means returning the
6545 original RHS type as far as we can reconstruct it. */
6546 if (code
== GIMPLE_CALL
)
6548 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6549 if (gimple_call_internal_p (call_stmt
))
6550 switch (gimple_call_internal_fn (call_stmt
))
6552 case IFN_MASK_STORE
:
6553 case IFN_SCATTER_STORE
:
6554 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6555 case IFN_MASK_SCATTER_STORE
:
6556 return TREE_TYPE (gimple_call_arg (call_stmt
, 4));
6560 return gimple_call_return_type (call_stmt
);
6562 else if (code
== GIMPLE_ASSIGN
)
6564 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6565 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6567 /* As fallback use the type of the LHS. */
6568 return TREE_TYPE (gimple_get_lhs (stmt
));
6570 else if (code
== GIMPLE_COND
)
6571 return boolean_type_node
;
6573 return void_type_node
;
6576 /* Enum and arrays used for allocation stats. Keep in sync with
6577 gimple.c:gimple_alloc_kind_names. */
6578 enum gimple_alloc_kind
6580 gimple_alloc_kind_assign
, /* Assignments. */
6581 gimple_alloc_kind_phi
, /* PHI nodes. */
6582 gimple_alloc_kind_cond
, /* Conditionals. */
6583 gimple_alloc_kind_rest
, /* Everything else. */
6584 gimple_alloc_kind_all
6587 extern uint64_t gimple_alloc_counts
[];
6588 extern uint64_t gimple_alloc_sizes
[];
6590 /* Return the allocation kind for a given stmt CODE. */
6591 static inline enum gimple_alloc_kind
6592 gimple_alloc_kind (enum gimple_code code
)
6597 return gimple_alloc_kind_assign
;
6599 return gimple_alloc_kind_phi
;
6601 return gimple_alloc_kind_cond
;
6603 return gimple_alloc_kind_rest
;
6607 /* Return true if a location should not be emitted for this statement
6608 by annotate_all_with_location. */
6611 gimple_do_not_emit_location_p (gimple
*g
)
6613 return gimple_plf (g
, GF_PLF_1
);
6616 /* Mark statement G so a location will not be emitted by
6617 annotate_one_with_location. */
6620 gimple_set_do_not_emit_location (gimple
*g
)
6622 /* The PLF flags are initialized to 0 when a new tuple is created,
6623 so no need to initialize it anywhere. */
6624 gimple_set_plf (g
, GF_PLF_1
, true);
6627 #endif /* GCC_GIMPLE_H */