1 /* Gimple IR definitions.
3 Copyright (C) 2007-2018 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_WITH_BOUNDS
= 1 << 8,
150 GF_CALL_MUST_TAIL_CALL
= 1 << 9,
151 GF_CALL_BY_DESCRIPTOR
= 1 << 10,
152 GF_CALL_NOCF_CHECK
= 1 << 11,
153 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
154 GF_OMP_PARALLEL_GRID_PHONY
= 1 << 1,
155 GF_OMP_TASK_TASKLOOP
= 1 << 0,
156 GF_OMP_FOR_KIND_MASK
= (1 << 4) - 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 /* Flag for SIMD variants of OMP_FOR kinds. */
163 GF_OMP_FOR_SIMD
= 1 << 3,
164 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
165 GF_OMP_FOR_COMBINED
= 1 << 4,
166 GF_OMP_FOR_COMBINED_INTO
= 1 << 5,
167 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
169 GF_OMP_FOR_GRID_PHONY
= 1 << 6,
170 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
172 GF_OMP_FOR_GRID_INTRA_GROUP
= 1 << 6,
173 GF_OMP_FOR_GRID_GROUP_ITER
= 1 << 7,
174 GF_OMP_TARGET_KIND_MASK
= (1 << 4) - 1,
175 GF_OMP_TARGET_KIND_REGION
= 0,
176 GF_OMP_TARGET_KIND_DATA
= 1,
177 GF_OMP_TARGET_KIND_UPDATE
= 2,
178 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
179 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
180 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
181 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
182 GF_OMP_TARGET_KIND_OACC_DATA
= 7,
183 GF_OMP_TARGET_KIND_OACC_UPDATE
= 8,
184 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
= 9,
185 GF_OMP_TARGET_KIND_OACC_DECLARE
= 10,
186 GF_OMP_TARGET_KIND_OACC_HOST_DATA
= 11,
187 GF_OMP_TEAMS_GRID_PHONY
= 1 << 0,
189 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
190 a thread synchronization via some sort of barrier. The exact barrier
191 that would otherwise be emitted is dependent on the OMP statement with
192 which this return is associated. */
193 GF_OMP_RETURN_NOWAIT
= 1 << 0,
195 GF_OMP_SECTION_LAST
= 1 << 0,
196 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
197 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
198 GF_PREDICT_TAKEN
= 1 << 15
201 /* This subcode tells apart different kinds of stmts that are not used
202 for codegen, but rather to retain debug information. */
203 enum gimple_debug_subcode
{
204 GIMPLE_DEBUG_BIND
= 0,
205 GIMPLE_DEBUG_SOURCE_BIND
= 1,
206 GIMPLE_DEBUG_BEGIN_STMT
= 2,
207 GIMPLE_DEBUG_INLINE_ENTRY
= 3
210 /* Masks for selecting a pass local flag (PLF) to work on. These
211 masks are used by gimple_set_plf and gimple_plf. */
217 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
218 are for 64 bit hosts. */
220 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
221 chain_next ("%h.next"), variable_size
))
225 Main identifying code for a tuple. */
226 ENUM_BITFIELD(gimple_code
) code
: 8;
228 /* Nonzero if a warning should not be emitted on this tuple. */
229 unsigned int no_warning
: 1;
231 /* Nonzero if this tuple has been visited. Passes are responsible
232 for clearing this bit before using it. */
233 unsigned int visited
: 1;
235 /* Nonzero if this tuple represents a non-temporal move. */
236 unsigned int nontemporal_move
: 1;
238 /* Pass local flags. These flags are free for any pass to use as
239 they see fit. Passes should not assume that these flags contain
240 any useful value when the pass starts. Any initial state that
241 the pass requires should be set on entry to the pass. See
242 gimple_set_plf and gimple_plf for usage. */
243 unsigned int plf
: 2;
245 /* Nonzero if this statement has been modified and needs to have its
246 operands rescanned. */
247 unsigned modified
: 1;
249 /* Nonzero if this statement contains volatile operands. */
250 unsigned has_volatile_ops
: 1;
252 /* Padding to get subcode to 16 bit alignment. */
255 /* The SUBCODE field can be used for tuple-specific flags for tuples
256 that do not require subcodes. Note that SUBCODE should be at
257 least as wide as tree codes, as several tuples store tree codes
259 unsigned int subcode
: 16;
261 /* UID of this statement. This is used by passes that want to
262 assign IDs to statements. It must be assigned and used by each
263 pass. By default it should be assumed to contain garbage. */
267 Locus information for debug info. */
270 /* Number of operands in this tuple. */
274 Basic block holding this statement. */
278 Linked lists of gimple statements. The next pointers form
279 a NULL terminated list, the prev pointers are a cyclic list.
280 A gimple statement is hence also a double-ended list of
281 statements, with the pointer itself being the first element,
282 and the prev pointer being the last. */
284 gimple
*GTY((skip
)) prev
;
288 /* Base structure for tuples with operands. */
290 /* This gimple subclass has no tag value. */
292 gimple_statement_with_ops_base
: public gimple
294 /* [ WORD 1-6 ] : base class */
297 SSA operand vectors. NOTE: It should be possible to
298 amalgamate these vectors with the operand vector OP. However,
299 the SSA operand vectors are organized differently and contain
300 more information (like immediate use chaining). */
301 struct use_optype_d
GTY((skip (""))) *use_ops
;
305 /* Statements that take register operands. */
307 struct GTY((tag("GSS_WITH_OPS")))
308 gimple_statement_with_ops
: public gimple_statement_with_ops_base
310 /* [ WORD 1-7 ] : base class */
313 Operand vector. NOTE! This must always be the last field
314 of this structure. In particular, this means that this
315 structure cannot be embedded inside another one. */
316 tree
GTY((length ("%h.num_ops"))) op
[1];
320 /* Base for statements that take both memory and register operands. */
322 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
323 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
325 /* [ WORD 1-7 ] : base class */
328 Virtual operands for this statement. The GC will pick them
329 up via the ssa_names array. */
330 tree
GTY((skip (""))) vdef
;
331 tree
GTY((skip (""))) vuse
;
335 /* Statements that take both memory and register operands. */
337 struct GTY((tag("GSS_WITH_MEM_OPS")))
338 gimple_statement_with_memory_ops
:
339 public gimple_statement_with_memory_ops_base
341 /* [ WORD 1-9 ] : base class */
344 Operand vector. NOTE! This must always be the last field
345 of this structure. In particular, this means that this
346 structure cannot be embedded inside another one. */
347 tree
GTY((length ("%h.num_ops"))) op
[1];
351 /* Call statements that take both memory and register operands. */
353 struct GTY((tag("GSS_CALL")))
354 gcall
: public gimple_statement_with_memory_ops_base
356 /* [ WORD 1-9 ] : base class */
359 struct pt_solution call_used
;
360 struct pt_solution call_clobbered
;
363 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
364 tree
GTY ((tag ("0"))) fntype
;
365 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
369 Operand vector. NOTE! This must always be the last field
370 of this structure. In particular, this means that this
371 structure cannot be embedded inside another one. */
372 tree
GTY((length ("%h.num_ops"))) op
[1];
374 static const enum gimple_code code_
= GIMPLE_CALL
;
378 /* OMP statements. */
380 struct GTY((tag("GSS_OMP")))
381 gimple_statement_omp
: public gimple
383 /* [ WORD 1-6 ] : base class */
392 struct GTY((tag("GSS_BIND")))
393 gbind
: public gimple
395 /* [ WORD 1-6 ] : base class */
398 Variables declared in this scope. */
402 This is different than the BLOCK field in gimple,
403 which is analogous to TREE_BLOCK (i.e., the lexical block holding
404 this statement). This field is the equivalent of BIND_EXPR_BLOCK
405 in tree land (i.e., the lexical scope defined by this bind). See
416 struct GTY((tag("GSS_CATCH")))
417 gcatch
: public gimple
419 /* [ WORD 1-6 ] : base class */
429 /* GIMPLE_EH_FILTER */
431 struct GTY((tag("GSS_EH_FILTER")))
432 geh_filter
: public gimple
434 /* [ WORD 1-6 ] : base class */
447 struct GTY((tag("GSS_EH_ELSE")))
448 geh_else
: public gimple
450 /* [ WORD 1-6 ] : base class */
453 gimple_seq n_body
, e_body
;
456 /* GIMPLE_EH_MUST_NOT_THROW */
458 struct GTY((tag("GSS_EH_MNT")))
459 geh_mnt
: public gimple
461 /* [ WORD 1-6 ] : base class */
463 /* [ WORD 7 ] Abort function decl. */
469 struct GTY((tag("GSS_PHI")))
472 /* [ WORD 1-6 ] : base class */
482 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
486 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
488 struct GTY((tag("GSS_EH_CTRL")))
489 gimple_statement_eh_ctrl
: public gimple
491 /* [ WORD 1-6 ] : base class */
494 Exception region number. */
498 struct GTY((tag("GSS_EH_CTRL")))
499 gresx
: public gimple_statement_eh_ctrl
501 /* No extra fields; adds invariant:
502 stmt->code == GIMPLE_RESX. */
505 struct GTY((tag("GSS_EH_CTRL")))
506 geh_dispatch
: public gimple_statement_eh_ctrl
508 /* No extra fields; adds invariant:
509 stmt->code == GIMPLE_EH_DISPATH. */
515 struct GTY((tag("GSS_TRY")))
518 /* [ WORD 1-6 ] : base class */
521 Expression to evaluate. */
525 Cleanup expression. */
529 /* Kind of GIMPLE_TRY statements. */
530 enum gimple_try_flags
533 GIMPLE_TRY_CATCH
= 1 << 0,
536 GIMPLE_TRY_FINALLY
= 1 << 1,
537 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
539 /* Analogous to TRY_CATCH_IS_CLEANUP. */
540 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
543 /* GIMPLE_WITH_CLEANUP_EXPR */
545 struct GTY((tag("GSS_WCE")))
546 gimple_statement_wce
: public gimple
548 /* [ WORD 1-6 ] : base class */
550 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
551 executed if an exception is thrown, not on normal exit of its
552 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
556 Cleanup expression. */
563 struct GTY((tag("GSS_ASM")))
564 gasm
: public gimple_statement_with_memory_ops_base
566 /* [ WORD 1-9 ] : base class */
569 __asm__ statement. */
573 Number of inputs, outputs, clobbers, labels. */
580 Operand vector. NOTE! This must always be the last field
581 of this structure. In particular, this means that this
582 structure cannot be embedded inside another one. */
583 tree
GTY((length ("%h.num_ops"))) op
[1];
586 /* GIMPLE_OMP_CRITICAL */
588 struct GTY((tag("GSS_OMP_CRITICAL")))
589 gomp_critical
: public gimple_statement_omp
591 /* [ WORD 1-7 ] : base class */
597 Critical section name. */
602 struct GTY(()) gimple_omp_for_iter
{
603 /* Condition code. */
606 /* Index variable. */
621 struct GTY((tag("GSS_OMP_FOR")))
622 gomp_for
: public gimple_statement_omp
624 /* [ WORD 1-7 ] : base class */
630 Number of elements in iter array. */
634 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
637 Pre-body evaluated before the loop body begins. */
642 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
644 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
645 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
647 /* [ WORD 1-7 ] : base class */
654 Child function holding the body of the parallel region. */
658 Shared data argument. */
662 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
663 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
664 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
666 /* No extra fields; adds invariant:
667 stmt->code == GIMPLE_OMP_PARALLEL
668 || stmt->code == GIMPLE_OMP_TASK. */
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_TEAMS, GIMPLE_OMP_ORDERED */
744 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
745 gimple_statement_omp_single_layout
: public gimple_statement_omp
747 /* [ WORD 1-7 ] : base class */
753 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
754 gomp_single
: public gimple_statement_omp_single_layout
756 /* No extra fields; adds invariant:
757 stmt->code == GIMPLE_OMP_SINGLE. */
760 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
761 gomp_teams
: public gimple_statement_omp_single_layout
763 /* No extra fields; adds invariant:
764 stmt->code == GIMPLE_OMP_TEAMS. */
767 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
768 gomp_ordered
: public gimple_statement_omp_single_layout
770 /* No extra fields; adds invariant:
771 stmt->code == GIMPLE_OMP_ORDERED. */
775 /* GIMPLE_OMP_ATOMIC_LOAD.
776 Note: This is based on gimple, not g_s_omp, because g_s_omp
777 contains a sequence, which we don't need here. */
779 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
780 gomp_atomic_load
: public gimple
782 /* [ WORD 1-6 ] : base class */
788 /* GIMPLE_OMP_ATOMIC_STORE.
789 See note on GIMPLE_OMP_ATOMIC_LOAD. */
791 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
792 gimple_statement_omp_atomic_store_layout
: public gimple
794 /* [ WORD 1-6 ] : base class */
800 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
802 public gimple_statement_omp_atomic_store_layout
804 /* No extra fields; adds invariant:
805 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
808 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
809 gimple_statement_omp_return
:
810 public gimple_statement_omp_atomic_store_layout
812 /* No extra fields; adds invariant:
813 stmt->code == GIMPLE_OMP_RETURN. */
816 /* GIMPLE_TRANSACTION. */
818 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
820 /* The __transaction_atomic was declared [[outer]] or it is
821 __transaction_relaxed. */
822 #define GTMA_IS_OUTER (1u << 0)
823 #define GTMA_IS_RELAXED (1u << 1)
824 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
826 /* The transaction is seen to not have an abort. */
827 #define GTMA_HAVE_ABORT (1u << 2)
828 /* The transaction is seen to have loads or stores. */
829 #define GTMA_HAVE_LOAD (1u << 3)
830 #define GTMA_HAVE_STORE (1u << 4)
831 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
832 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
833 /* The transaction WILL enter serial irrevocable mode.
834 An irrevocable block post-dominates the entire transaction, such
835 that all invocations of the transaction will go serial-irrevocable.
836 In such case, we don't bother instrumenting the transaction, and
837 tell the runtime that it should begin the transaction in
838 serial-irrevocable mode. */
839 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
840 /* The transaction contains no instrumentation code whatsover, most
841 likely because it is guaranteed to go irrevocable upon entry. */
842 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
844 struct GTY((tag("GSS_TRANSACTION")))
845 gtransaction
: public gimple_statement_with_memory_ops_base
847 /* [ WORD 1-9 ] : base class */
858 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
859 enum gimple_statement_structure_enum
{
860 #include "gsstruct.def"
865 /* A statement with the invariant that
866 stmt->code == GIMPLE_COND
867 i.e. a conditional jump statement. */
869 struct GTY((tag("GSS_WITH_OPS")))
870 gcond
: public gimple_statement_with_ops
872 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
873 static const enum gimple_code code_
= GIMPLE_COND
;
876 /* A statement with the invariant that
877 stmt->code == GIMPLE_DEBUG
878 i.e. a debug statement. */
880 struct GTY((tag("GSS_WITH_OPS")))
881 gdebug
: public gimple_statement_with_ops
883 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
886 /* A statement with the invariant that
887 stmt->code == GIMPLE_GOTO
888 i.e. a goto statement. */
890 struct GTY((tag("GSS_WITH_OPS")))
891 ggoto
: public gimple_statement_with_ops
893 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
896 /* A statement with the invariant that
897 stmt->code == GIMPLE_LABEL
898 i.e. a label statement. */
900 struct GTY((tag("GSS_WITH_OPS")))
901 glabel
: public gimple_statement_with_ops
903 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
906 /* A statement with the invariant that
907 stmt->code == GIMPLE_SWITCH
908 i.e. a switch statement. */
910 struct GTY((tag("GSS_WITH_OPS")))
911 gswitch
: public gimple_statement_with_ops
913 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
916 /* A statement with the invariant that
917 stmt->code == GIMPLE_ASSIGN
918 i.e. an assignment statement. */
920 struct GTY((tag("GSS_WITH_MEM_OPS")))
921 gassign
: public gimple_statement_with_memory_ops
923 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
924 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
927 /* A statement with the invariant that
928 stmt->code == GIMPLE_RETURN
929 i.e. a return statement. */
931 struct GTY((tag("GSS_WITH_MEM_OPS")))
932 greturn
: public gimple_statement_with_memory_ops
934 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
940 is_a_helper
<gasm
*>::test (gimple
*gs
)
942 return gs
->code
== GIMPLE_ASM
;
948 is_a_helper
<gassign
*>::test (gimple
*gs
)
950 return gs
->code
== GIMPLE_ASSIGN
;
956 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
958 return gs
->code
== GIMPLE_ASSIGN
;
964 is_a_helper
<gbind
*>::test (gimple
*gs
)
966 return gs
->code
== GIMPLE_BIND
;
972 is_a_helper
<gcall
*>::test (gimple
*gs
)
974 return gs
->code
== GIMPLE_CALL
;
980 is_a_helper
<gcatch
*>::test (gimple
*gs
)
982 return gs
->code
== GIMPLE_CATCH
;
988 is_a_helper
<gcond
*>::test (gimple
*gs
)
990 return gs
->code
== GIMPLE_COND
;
996 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
998 return gs
->code
== GIMPLE_COND
;
1004 is_a_helper
<gdebug
*>::test (gimple
*gs
)
1006 return gs
->code
== GIMPLE_DEBUG
;
1012 is_a_helper
<ggoto
*>::test (gimple
*gs
)
1014 return gs
->code
== GIMPLE_GOTO
;
1020 is_a_helper
<glabel
*>::test (gimple
*gs
)
1022 return gs
->code
== GIMPLE_LABEL
;
1028 is_a_helper
<gresx
*>::test (gimple
*gs
)
1030 return gs
->code
== GIMPLE_RESX
;
1036 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1038 return gs
->code
== GIMPLE_EH_DISPATCH
;
1044 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1046 return gs
->code
== GIMPLE_EH_ELSE
;
1052 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1054 return gs
->code
== GIMPLE_EH_FILTER
;
1060 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1062 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1068 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1070 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1076 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1078 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1084 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1086 return gs
->code
== GIMPLE_OMP_RETURN
;
1092 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1094 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1100 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1102 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1108 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1110 return gs
->code
== GIMPLE_OMP_ORDERED
;
1116 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1118 return gs
->code
== GIMPLE_OMP_FOR
;
1124 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1126 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1132 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1134 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1140 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1142 return gs
->code
== GIMPLE_OMP_TARGET
;
1148 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1150 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1156 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1158 return gs
->code
== GIMPLE_OMP_SINGLE
;
1164 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1166 return gs
->code
== GIMPLE_OMP_TEAMS
;
1172 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1174 return gs
->code
== GIMPLE_OMP_TASK
;
1180 is_a_helper
<gphi
*>::test (gimple
*gs
)
1182 return gs
->code
== GIMPLE_PHI
;
1188 is_a_helper
<greturn
*>::test (gimple
*gs
)
1190 return gs
->code
== GIMPLE_RETURN
;
1196 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1198 return gs
->code
== GIMPLE_SWITCH
;
1204 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1206 return gs
->code
== GIMPLE_TRANSACTION
;
1212 is_a_helper
<gtry
*>::test (gimple
*gs
)
1214 return gs
->code
== GIMPLE_TRY
;
1220 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1222 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1228 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1230 return gs
->code
== GIMPLE_ASM
;
1236 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1238 return gs
->code
== GIMPLE_BIND
;
1244 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1246 return gs
->code
== GIMPLE_CALL
;
1252 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1254 return gs
->code
== GIMPLE_CATCH
;
1260 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1262 return gs
->code
== GIMPLE_RESX
;
1268 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1270 return gs
->code
== GIMPLE_EH_DISPATCH
;
1276 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1278 return gs
->code
== GIMPLE_EH_FILTER
;
1284 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1286 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1292 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1294 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1300 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1302 return gs
->code
== GIMPLE_OMP_RETURN
;
1308 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1310 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1316 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1318 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1324 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1326 return gs
->code
== GIMPLE_OMP_ORDERED
;
1332 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1334 return gs
->code
== GIMPLE_OMP_FOR
;
1340 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1342 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1348 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1350 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1356 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1358 return gs
->code
== GIMPLE_OMP_TARGET
;
1364 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1366 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1372 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1374 return gs
->code
== GIMPLE_OMP_SINGLE
;
1380 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1382 return gs
->code
== GIMPLE_OMP_TEAMS
;
1388 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1390 return gs
->code
== GIMPLE_OMP_TASK
;
1396 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1398 return gs
->code
== GIMPLE_PHI
;
1404 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1406 return gs
->code
== GIMPLE_TRANSACTION
;
1409 /* Offset in bytes to the location of the operand vector.
1410 Zero if there is no operand vector for this tuple structure. */
1411 extern size_t const gimple_ops_offset_
[];
1413 /* Map GIMPLE codes to GSS codes. */
1414 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1416 /* This variable holds the currently expanded gimple statement for purposes
1417 of comminucating the profile info to the builtin expanders. */
1418 extern gimple
*currently_expanding_gimple_stmt
;
1420 gimple
*gimple_alloc (enum gimple_code
, unsigned CXX_MEM_STAT_INFO
);
1421 greturn
*gimple_build_return (tree
);
1422 void gimple_call_reset_alias_info (gcall
*);
1423 gcall
*gimple_build_call_vec (tree
, vec
<tree
> );
1424 gcall
*gimple_build_call (tree
, unsigned, ...);
1425 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1426 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1427 gcall
*gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1428 gcall
*gimple_build_call_from_tree (tree
, tree
);
1429 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1430 gassign
*gimple_build_assign (tree
, enum tree_code
,
1431 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1432 gassign
*gimple_build_assign (tree
, enum tree_code
,
1433 tree
, tree CXX_MEM_STAT_INFO
);
1434 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1435 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1436 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1437 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1438 glabel
*gimple_build_label (tree label
);
1439 ggoto
*gimple_build_goto (tree dest
);
1440 gimple
*gimple_build_nop (void);
1441 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1442 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1443 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1444 vec
<tree
, va_gc
> *);
1445 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1446 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1447 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1448 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1449 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1450 enum gimple_try_flags
);
1451 gimple
*gimple_build_wce (gimple_seq
);
1452 gresx
*gimple_build_resx (int);
1453 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1454 gswitch
*gimple_build_switch (tree
, tree
, vec
<tree
> );
1455 geh_dispatch
*gimple_build_eh_dispatch (int);
1456 gdebug
*gimple_build_debug_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1457 gdebug
*gimple_build_debug_source_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1458 gdebug
*gimple_build_debug_begin_stmt (tree
, location_t CXX_MEM_STAT_INFO
);
1459 gdebug
*gimple_build_debug_inline_entry (tree
, location_t CXX_MEM_STAT_INFO
);
1460 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1461 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1462 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1463 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1465 gimple
*gimple_build_omp_section (gimple_seq
);
1466 gimple
*gimple_build_omp_master (gimple_seq
);
1467 gimple
*gimple_build_omp_grid_body (gimple_seq
);
1468 gimple
*gimple_build_omp_taskgroup (gimple_seq
);
1469 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1470 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1471 gimple
*gimple_build_omp_return (bool);
1472 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1473 gimple
*gimple_build_omp_sections_switch (void);
1474 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1475 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1476 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1477 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
);
1478 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
);
1479 gtransaction
*gimple_build_transaction (gimple_seq
);
1480 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1481 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1482 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1483 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1484 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1486 extern void annotate_all_with_location (gimple_seq
, location_t
);
1487 bool empty_body_p (gimple_seq
);
1488 gimple_seq
gimple_seq_copy (gimple_seq
);
1489 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1490 int gimple_call_flags (const gimple
*);
1491 int gimple_call_arg_flags (const gcall
*, unsigned);
1492 int gimple_call_return_flags (const gcall
*);
1493 bool gimple_assign_copy_p (gimple
*);
1494 bool gimple_assign_ssa_name_copy_p (gimple
*);
1495 bool gimple_assign_unary_nop_p (gimple
*);
1496 void gimple_set_bb (gimple
*, basic_block
);
1497 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1498 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1500 tree
gimple_get_lhs (const gimple
*);
1501 void gimple_set_lhs (gimple
*, tree
);
1502 gimple
*gimple_copy (gimple
*);
1503 bool gimple_has_side_effects (const gimple
*);
1504 bool gimple_could_trap_p_1 (gimple
*, bool, bool);
1505 bool gimple_could_trap_p (gimple
*);
1506 bool gimple_assign_rhs_could_trap_p (gimple
*);
1507 extern void dump_gimple_statistics (void);
1508 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1509 extern tree
canonicalize_cond_expr_cond (tree
);
1510 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1511 extern bool gimple_compare_field_offset (tree
, tree
);
1512 extern tree
gimple_unsigned_type (tree
);
1513 extern tree
gimple_signed_type (tree
);
1514 extern alias_set_type
gimple_get_alias_set (tree
);
1515 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1516 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1517 extern combined_fn
gimple_call_combined_fn (const gimple
*);
1518 extern bool gimple_call_builtin_p (const gimple
*);
1519 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1520 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1521 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1522 extern void dump_decl_set (FILE *, bitmap
);
1523 extern bool nonfreeing_call_p (gimple
*);
1524 extern bool nonbarrier_call_p (gimple
*);
1525 extern bool infer_nonnull_range (gimple
*, tree
);
1526 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1527 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1528 extern void sort_case_labels (vec
<tree
>);
1529 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1530 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1531 extern void gimple_seq_discard (gimple_seq
);
1532 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1533 extern bool gimple_inexpensive_call_p (gcall
*);
1534 extern bool stmt_can_terminate_bb_p (gimple
*);
1536 /* Formal (expression) temporary table handling: multiple occurrences of
1537 the same scalar expression are evaluated into the same temporary. */
1539 typedef struct gimple_temp_hash_elt
1542 tree temp
; /* Value */
1545 /* Get the number of the next statement uid to be allocated. */
1546 static inline unsigned int
1547 gimple_stmt_max_uid (struct function
*fn
)
1549 return fn
->last_stmt_uid
;
1552 /* Set the number of the next statement uid to be allocated. */
1554 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1556 fn
->last_stmt_uid
= maxid
;
1559 /* Set the number of the next statement uid to be allocated. */
1560 static inline unsigned int
1561 inc_gimple_stmt_max_uid (struct function
*fn
)
1563 return fn
->last_stmt_uid
++;
1566 /* Return the first node in GIMPLE sequence S. */
1568 static inline gimple_seq_node
1569 gimple_seq_first (gimple_seq s
)
1575 /* Return the first statement in GIMPLE sequence S. */
1577 static inline gimple
*
1578 gimple_seq_first_stmt (gimple_seq s
)
1580 gimple_seq_node n
= gimple_seq_first (s
);
1584 /* Return the first statement in GIMPLE sequence S as a gbind *,
1585 verifying that it has code GIMPLE_BIND in a checked build. */
1587 static inline gbind
*
1588 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1590 gimple_seq_node n
= gimple_seq_first (s
);
1591 return as_a
<gbind
*> (n
);
1595 /* Return the last node in GIMPLE sequence S. */
1597 static inline gimple_seq_node
1598 gimple_seq_last (gimple_seq s
)
1600 return s
? s
->prev
: NULL
;
1604 /* Return the last statement in GIMPLE sequence S. */
1606 static inline gimple
*
1607 gimple_seq_last_stmt (gimple_seq s
)
1609 gimple_seq_node n
= gimple_seq_last (s
);
1614 /* Set the last node in GIMPLE sequence *PS to LAST. */
1617 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1623 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1626 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1632 /* Return true if GIMPLE sequence S is empty. */
1635 gimple_seq_empty_p (gimple_seq s
)
1640 /* Allocate a new sequence and initialize its first element with STMT. */
1642 static inline gimple_seq
1643 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1645 gimple_seq seq
= NULL
;
1646 gimple_seq_add_stmt (&seq
, stmt
);
1651 /* Returns the sequence of statements in BB. */
1653 static inline gimple_seq
1654 bb_seq (const_basic_block bb
)
1656 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1659 static inline gimple_seq
*
1660 bb_seq_addr (basic_block bb
)
1662 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1665 /* Sets the sequence of statements in BB to SEQ. */
1668 set_bb_seq (basic_block bb
, gimple_seq seq
)
1670 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1671 bb
->il
.gimple
.seq
= seq
;
1675 /* Return the code for GIMPLE statement G. */
1677 static inline enum gimple_code
1678 gimple_code (const gimple
*g
)
1684 /* Return the GSS code used by a GIMPLE code. */
1686 static inline enum gimple_statement_structure_enum
1687 gss_for_code (enum gimple_code code
)
1689 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1690 return gss_for_code_
[code
];
1694 /* Return which GSS code is used by GS. */
1696 static inline enum gimple_statement_structure_enum
1697 gimple_statement_structure (gimple
*gs
)
1699 return gss_for_code (gimple_code (gs
));
1703 /* Return true if statement G has sub-statements. This is only true for
1704 High GIMPLE statements. */
1707 gimple_has_substatements (gimple
*g
)
1709 switch (gimple_code (g
))
1713 case GIMPLE_EH_FILTER
:
1714 case GIMPLE_EH_ELSE
:
1716 case GIMPLE_OMP_FOR
:
1717 case GIMPLE_OMP_MASTER
:
1718 case GIMPLE_OMP_TASKGROUP
:
1719 case GIMPLE_OMP_ORDERED
:
1720 case GIMPLE_OMP_SECTION
:
1721 case GIMPLE_OMP_PARALLEL
:
1722 case GIMPLE_OMP_TASK
:
1723 case GIMPLE_OMP_SECTIONS
:
1724 case GIMPLE_OMP_SINGLE
:
1725 case GIMPLE_OMP_TARGET
:
1726 case GIMPLE_OMP_TEAMS
:
1727 case GIMPLE_OMP_CRITICAL
:
1728 case GIMPLE_WITH_CLEANUP_EXPR
:
1729 case GIMPLE_TRANSACTION
:
1730 case GIMPLE_OMP_GRID_BODY
:
1739 /* Return the basic block holding statement G. */
1741 static inline basic_block
1742 gimple_bb (const gimple
*g
)
1748 /* Return the lexical scope block holding statement G. */
1751 gimple_block (const gimple
*g
)
1753 return LOCATION_BLOCK (g
->location
);
1757 /* Set BLOCK to be the lexical scope block holding statement G. */
1760 gimple_set_block (gimple
*g
, tree block
)
1762 g
->location
= set_block (g
->location
, block
);
1766 /* Return location information for statement G. */
1768 static inline location_t
1769 gimple_location (const gimple
*g
)
1774 /* Return location information for statement G if g is not NULL.
1775 Otherwise, UNKNOWN_LOCATION is returned. */
1777 static inline location_t
1778 gimple_location_safe (const gimple
*g
)
1780 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1783 /* Set location information for statement G. */
1786 gimple_set_location (gimple
*g
, location_t location
)
1788 g
->location
= location
;
1792 /* Return true if G contains location information. */
1795 gimple_has_location (const gimple
*g
)
1797 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1801 /* Return the file name of the location of STMT. */
1803 static inline const char *
1804 gimple_filename (const gimple
*stmt
)
1806 return LOCATION_FILE (gimple_location (stmt
));
1810 /* Return the line number of the location of STMT. */
1813 gimple_lineno (const gimple
*stmt
)
1815 return LOCATION_LINE (gimple_location (stmt
));
1819 /* Determine whether SEQ is a singleton. */
1822 gimple_seq_singleton_p (gimple_seq seq
)
1824 return ((gimple_seq_first (seq
) != NULL
)
1825 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1828 /* Return true if no warnings should be emitted for statement STMT. */
1831 gimple_no_warning_p (const gimple
*stmt
)
1833 return stmt
->no_warning
;
1836 /* Set the no_warning flag of STMT to NO_WARNING. */
1839 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1841 stmt
->no_warning
= (unsigned) no_warning
;
1844 /* Set the visited status on statement STMT to VISITED_P.
1846 Please note that this 'visited' property of the gimple statement is
1847 supposed to be undefined at pass boundaries. This means that a
1848 given pass should not assume it contains any useful value when the
1849 pass starts and thus can set it to any value it sees fit.
1851 You can learn more about the visited property of the gimple
1852 statement by reading the comments of the 'visited' data member of
1857 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1859 stmt
->visited
= (unsigned) visited_p
;
1863 /* Return the visited status for statement STMT.
1865 Please note that this 'visited' property of the gimple statement is
1866 supposed to be undefined at pass boundaries. This means that a
1867 given pass should not assume it contains any useful value when the
1868 pass starts and thus can set it to any value it sees fit.
1870 You can learn more about the visited property of the gimple
1871 statement by reading the comments of the 'visited' data member of
1875 gimple_visited_p (gimple
*stmt
)
1877 return stmt
->visited
;
1881 /* Set pass local flag PLF on statement STMT to VAL_P.
1883 Please note that this PLF property of the gimple statement is
1884 supposed to be undefined at pass boundaries. This means that a
1885 given pass should not assume it contains any useful value when the
1886 pass starts and thus can set it to any value it sees fit.
1888 You can learn more about the PLF property by reading the comment of
1889 the 'plf' data member of struct gimple_statement_structure. */
1892 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
1895 stmt
->plf
|= (unsigned int) plf
;
1897 stmt
->plf
&= ~((unsigned int) plf
);
1901 /* Return the value of pass local flag PLF on statement STMT.
1903 Please note that this 'plf' property of the gimple statement is
1904 supposed to be undefined at pass boundaries. This means that a
1905 given pass should not assume it contains any useful value when the
1906 pass starts and thus can set it to any value it sees fit.
1908 You can learn more about the plf property by reading the comment of
1909 the 'plf' data member of struct gimple_statement_structure. */
1911 static inline unsigned int
1912 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
1914 return stmt
->plf
& ((unsigned int) plf
);
1918 /* Set the UID of statement.
1920 Please note that this UID property is supposed to be undefined at
1921 pass boundaries. This means that a given pass should not assume it
1922 contains any useful value when the pass starts and thus can set it
1923 to any value it sees fit. */
1926 gimple_set_uid (gimple
*g
, unsigned uid
)
1932 /* Return the UID of statement.
1934 Please note that this UID property is supposed to be undefined at
1935 pass boundaries. This means that a given pass should not assume it
1936 contains any useful value when the pass starts and thus can set it
1937 to any value it sees fit. */
1939 static inline unsigned
1940 gimple_uid (const gimple
*g
)
1946 /* Make statement G a singleton sequence. */
1949 gimple_init_singleton (gimple
*g
)
1956 /* Return true if GIMPLE statement G has register or memory operands. */
1959 gimple_has_ops (const gimple
*g
)
1961 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1967 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
1969 return gimple_has_ops (gs
);
1975 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
1977 return gimple_has_ops (gs
);
1980 /* Return true if GIMPLE statement G has memory operands. */
1983 gimple_has_mem_ops (const gimple
*g
)
1985 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1991 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
1993 return gimple_has_mem_ops (gs
);
1999 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
2001 return gimple_has_mem_ops (gs
);
2004 /* Return the set of USE operands for statement G. */
2006 static inline struct use_optype_d
*
2007 gimple_use_ops (const gimple
*g
)
2009 const gimple_statement_with_ops
*ops_stmt
=
2010 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2013 return ops_stmt
->use_ops
;
2017 /* Set USE to be the set of USE operands for statement G. */
2020 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2022 gimple_statement_with_ops
*ops_stmt
=
2023 as_a
<gimple_statement_with_ops
*> (g
);
2024 ops_stmt
->use_ops
= use
;
2028 /* Return the single VUSE operand of the statement G. */
2031 gimple_vuse (const gimple
*g
)
2033 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2034 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2037 return mem_ops_stmt
->vuse
;
2040 /* Return the single VDEF operand of the statement G. */
2043 gimple_vdef (const gimple
*g
)
2045 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2046 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2049 return mem_ops_stmt
->vdef
;
2052 /* Return the single VUSE operand of the statement G. */
2054 static inline tree
*
2055 gimple_vuse_ptr (gimple
*g
)
2057 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2058 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2061 return &mem_ops_stmt
->vuse
;
2064 /* Return the single VDEF operand of the statement G. */
2066 static inline tree
*
2067 gimple_vdef_ptr (gimple
*g
)
2069 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2070 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2073 return &mem_ops_stmt
->vdef
;
2076 /* Set the single VUSE operand of the statement G. */
2079 gimple_set_vuse (gimple
*g
, tree vuse
)
2081 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2082 as_a
<gimple_statement_with_memory_ops
*> (g
);
2083 mem_ops_stmt
->vuse
= vuse
;
2086 /* Set the single VDEF operand of the statement G. */
2089 gimple_set_vdef (gimple
*g
, tree vdef
)
2091 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2092 as_a
<gimple_statement_with_memory_ops
*> (g
);
2093 mem_ops_stmt
->vdef
= vdef
;
2097 /* Return true if statement G has operands and the modified field has
2101 gimple_modified_p (const gimple
*g
)
2103 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2107 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2108 a MODIFIED field. */
2111 gimple_set_modified (gimple
*s
, bool modifiedp
)
2113 if (gimple_has_ops (s
))
2114 s
->modified
= (unsigned) modifiedp
;
2118 /* Return the tree code for the expression computed by STMT. This is
2119 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2120 GIMPLE_CALL, return CALL_EXPR as the expression code for
2121 consistency. This is useful when the caller needs to deal with the
2122 three kinds of computation that GIMPLE supports. */
2124 static inline enum tree_code
2125 gimple_expr_code (const gimple
*stmt
)
2127 enum gimple_code code
= gimple_code (stmt
);
2128 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
2129 return (enum tree_code
) stmt
->subcode
;
2132 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
2138 /* Return true if statement STMT contains volatile operands. */
2141 gimple_has_volatile_ops (const gimple
*stmt
)
2143 if (gimple_has_mem_ops (stmt
))
2144 return stmt
->has_volatile_ops
;
2150 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2153 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2155 if (gimple_has_mem_ops (stmt
))
2156 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2159 /* Return true if STMT is in a transaction. */
2162 gimple_in_transaction (const gimple
*stmt
)
2164 return bb_in_transaction (gimple_bb (stmt
));
2167 /* Return true if statement STMT may access memory. */
2170 gimple_references_memory_p (gimple
*stmt
)
2172 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2176 /* Return the subcode for OMP statement S. */
2178 static inline unsigned
2179 gimple_omp_subcode (const gimple
*s
)
2181 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2182 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2186 /* Set the subcode for OMP statement S to SUBCODE. */
2189 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2191 /* We only have 16 bits for the subcode. Assert that we are not
2193 gcc_gimple_checking_assert (subcode
< (1 << 16));
2194 s
->subcode
= subcode
;
2197 /* Set the nowait flag on OMP_RETURN statement S. */
2200 gimple_omp_return_set_nowait (gimple
*s
)
2202 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2203 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2207 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2211 gimple_omp_return_nowait_p (const gimple
*g
)
2213 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2214 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2218 /* Set the LHS of OMP return. */
2221 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2223 gimple_statement_omp_return
*omp_return_stmt
=
2224 as_a
<gimple_statement_omp_return
*> (g
);
2225 omp_return_stmt
->val
= lhs
;
2229 /* Get the LHS of OMP return. */
2232 gimple_omp_return_lhs (const gimple
*g
)
2234 const gimple_statement_omp_return
*omp_return_stmt
=
2235 as_a
<const gimple_statement_omp_return
*> (g
);
2236 return omp_return_stmt
->val
;
2240 /* Return a pointer to the LHS of OMP return. */
2242 static inline tree
*
2243 gimple_omp_return_lhs_ptr (gimple
*g
)
2245 gimple_statement_omp_return
*omp_return_stmt
=
2246 as_a
<gimple_statement_omp_return
*> (g
);
2247 return &omp_return_stmt
->val
;
2251 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2255 gimple_omp_section_last_p (const gimple
*g
)
2257 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2258 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2262 /* Set the GF_OMP_SECTION_LAST flag on G. */
2265 gimple_omp_section_set_last (gimple
*g
)
2267 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2268 g
->subcode
|= GF_OMP_SECTION_LAST
;
2272 /* Return true if OMP parallel statement G has the
2273 GF_OMP_PARALLEL_COMBINED flag set. */
2276 gimple_omp_parallel_combined_p (const gimple
*g
)
2278 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2279 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2283 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2284 value of COMBINED_P. */
2287 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2289 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2291 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2293 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2297 /* Return true if OMP atomic load/store statement G has the
2298 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2301 gimple_omp_atomic_need_value_p (const gimple
*g
)
2303 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2304 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2305 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2309 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2312 gimple_omp_atomic_set_need_value (gimple
*g
)
2314 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2315 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2316 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2320 /* Return true if OMP atomic load/store statement G has the
2321 GF_OMP_ATOMIC_SEQ_CST flag set. */
2324 gimple_omp_atomic_seq_cst_p (const gimple
*g
)
2326 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2327 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2328 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2332 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2335 gimple_omp_atomic_set_seq_cst (gimple
*g
)
2337 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2338 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2339 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2343 /* Return the number of operands for statement GS. */
2345 static inline unsigned
2346 gimple_num_ops (const gimple
*gs
)
2352 /* Set the number of operands for statement GS. */
2355 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2357 gs
->num_ops
= num_ops
;
2361 /* Return the array of operands for statement GS. */
2363 static inline tree
*
2364 gimple_ops (gimple
*gs
)
2368 /* All the tuples have their operand vector at the very bottom
2369 of the structure. Note that those structures that do not
2370 have an operand vector have a zero offset. */
2371 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2372 gcc_gimple_checking_assert (off
!= 0);
2374 return (tree
*) ((char *) gs
+ off
);
2378 /* Return operand I for statement GS. */
2381 gimple_op (const gimple
*gs
, unsigned i
)
2383 if (gimple_has_ops (gs
))
2385 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2386 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2392 /* Return a pointer to operand I for statement GS. */
2394 static inline tree
*
2395 gimple_op_ptr (gimple
*gs
, unsigned i
)
2397 if (gimple_has_ops (gs
))
2399 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2400 return gimple_ops (gs
) + i
;
2406 /* Set operand I of statement GS to OP. */
2409 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2411 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2413 /* Note. It may be tempting to assert that OP matches
2414 is_gimple_operand, but that would be wrong. Different tuples
2415 accept slightly different sets of tree operands. Each caller
2416 should perform its own validation. */
2417 gimple_ops (gs
)[i
] = op
;
2420 /* Return true if GS is a GIMPLE_ASSIGN. */
2423 is_gimple_assign (const gimple
*gs
)
2425 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2428 /* Determine if expression CODE is one of the valid expressions that can
2429 be used on the RHS of GIMPLE assignments. */
2431 static inline enum gimple_rhs_class
2432 get_gimple_rhs_class (enum tree_code code
)
2434 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2437 /* Return the LHS of assignment statement GS. */
2440 gimple_assign_lhs (const gassign
*gs
)
2446 gimple_assign_lhs (const gimple
*gs
)
2448 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2449 return gimple_assign_lhs (ass
);
2453 /* Return a pointer to the LHS of assignment statement GS. */
2455 static inline tree
*
2456 gimple_assign_lhs_ptr (gassign
*gs
)
2461 static inline tree
*
2462 gimple_assign_lhs_ptr (gimple
*gs
)
2464 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2465 return gimple_assign_lhs_ptr (ass
);
2469 /* Set LHS to be the LHS operand of assignment statement GS. */
2472 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2476 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2477 SSA_NAME_DEF_STMT (lhs
) = gs
;
2481 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2483 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2484 gimple_assign_set_lhs (ass
, lhs
);
2488 /* Return the first operand on the RHS of assignment statement GS. */
2491 gimple_assign_rhs1 (const gassign
*gs
)
2497 gimple_assign_rhs1 (const gimple
*gs
)
2499 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2500 return gimple_assign_rhs1 (ass
);
2504 /* Return a pointer to the first operand on the RHS of assignment
2507 static inline tree
*
2508 gimple_assign_rhs1_ptr (gassign
*gs
)
2513 static inline tree
*
2514 gimple_assign_rhs1_ptr (gimple
*gs
)
2516 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2517 return gimple_assign_rhs1_ptr (ass
);
2520 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2523 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2529 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2531 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2532 gimple_assign_set_rhs1 (ass
, rhs
);
2536 /* Return the second operand on the RHS of assignment statement GS.
2537 If GS does not have two operands, NULL is returned instead. */
2540 gimple_assign_rhs2 (const gassign
*gs
)
2542 if (gimple_num_ops (gs
) >= 3)
2549 gimple_assign_rhs2 (const gimple
*gs
)
2551 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2552 return gimple_assign_rhs2 (ass
);
2556 /* Return a pointer to the second operand on the RHS of assignment
2559 static inline tree
*
2560 gimple_assign_rhs2_ptr (gassign
*gs
)
2562 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2566 static inline tree
*
2567 gimple_assign_rhs2_ptr (gimple
*gs
)
2569 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2570 return gimple_assign_rhs2_ptr (ass
);
2574 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2577 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2579 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2584 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2586 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2587 return gimple_assign_set_rhs2 (ass
, rhs
);
2590 /* Return the third operand on the RHS of assignment statement GS.
2591 If GS does not have two operands, NULL is returned instead. */
2594 gimple_assign_rhs3 (const gassign
*gs
)
2596 if (gimple_num_ops (gs
) >= 4)
2603 gimple_assign_rhs3 (const gimple
*gs
)
2605 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2606 return gimple_assign_rhs3 (ass
);
2609 /* Return a pointer to the third operand on the RHS of assignment
2612 static inline tree
*
2613 gimple_assign_rhs3_ptr (gimple
*gs
)
2615 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2616 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2621 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2624 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2626 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2631 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2633 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2634 gimple_assign_set_rhs3 (ass
, rhs
);
2638 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2639 which expect to see only two operands. */
2642 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2645 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2648 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2649 which expect to see only one operands. */
2652 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2655 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2658 /* Returns true if GS is a nontemporal move. */
2661 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2663 return gs
->nontemporal_move
;
2666 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2669 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2671 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2672 gs
->nontemporal_move
= nontemporal
;
2676 /* Return the code of the expression computed on the rhs of assignment
2677 statement GS. In case that the RHS is a single object, returns the
2678 tree code of the object. */
2680 static inline enum tree_code
2681 gimple_assign_rhs_code (const gassign
*gs
)
2683 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2684 /* While we initially set subcode to the TREE_CODE of the rhs for
2685 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2686 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2687 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2688 code
= TREE_CODE (gs
->op
[1]);
2693 static inline enum tree_code
2694 gimple_assign_rhs_code (const gimple
*gs
)
2696 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2697 return gimple_assign_rhs_code (ass
);
2701 /* Set CODE to be the code for the expression computed on the RHS of
2705 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2707 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2712 /* Return the gimple rhs class of the code of the expression computed on
2713 the rhs of assignment statement GS.
2714 This will never return GIMPLE_INVALID_RHS. */
2716 static inline enum gimple_rhs_class
2717 gimple_assign_rhs_class (const gimple
*gs
)
2719 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2722 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2723 there is no operator associated with the assignment itself.
2724 Unlike gimple_assign_copy_p, this predicate returns true for
2725 any RHS operand, including those that perform an operation
2726 and do not have the semantics of a copy, such as COND_EXPR. */
2729 gimple_assign_single_p (const gimple
*gs
)
2731 return (is_gimple_assign (gs
)
2732 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2735 /* Return true if GS performs a store to its lhs. */
2738 gimple_store_p (const gimple
*gs
)
2740 tree lhs
= gimple_get_lhs (gs
);
2741 return lhs
&& !is_gimple_reg (lhs
);
2744 /* Return true if GS is an assignment that loads from its rhs1. */
2747 gimple_assign_load_p (const gimple
*gs
)
2750 if (!gimple_assign_single_p (gs
))
2752 rhs
= gimple_assign_rhs1 (gs
);
2753 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2755 rhs
= get_base_address (rhs
);
2756 return (DECL_P (rhs
)
2757 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2761 /* Return true if S is a type-cast assignment. */
2764 gimple_assign_cast_p (const gimple
*s
)
2766 if (is_gimple_assign (s
))
2768 enum tree_code sc
= gimple_assign_rhs_code (s
);
2769 return CONVERT_EXPR_CODE_P (sc
)
2770 || sc
== VIEW_CONVERT_EXPR
2771 || sc
== FIX_TRUNC_EXPR
;
2777 /* Return true if S is a clobber statement. */
2780 gimple_clobber_p (const gimple
*s
)
2782 return gimple_assign_single_p (s
)
2783 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2786 /* Return true if GS is a GIMPLE_CALL. */
2789 is_gimple_call (const gimple
*gs
)
2791 return gimple_code (gs
) == GIMPLE_CALL
;
2794 /* Return the LHS of call statement GS. */
2797 gimple_call_lhs (const gcall
*gs
)
2803 gimple_call_lhs (const gimple
*gs
)
2805 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2806 return gimple_call_lhs (gc
);
2810 /* Return a pointer to the LHS of call statement GS. */
2812 static inline tree
*
2813 gimple_call_lhs_ptr (gcall
*gs
)
2818 static inline tree
*
2819 gimple_call_lhs_ptr (gimple
*gs
)
2821 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2822 return gimple_call_lhs_ptr (gc
);
2826 /* Set LHS to be the LHS operand of call statement GS. */
2829 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2832 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2833 SSA_NAME_DEF_STMT (lhs
) = gs
;
2837 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2839 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2840 gimple_call_set_lhs (gc
, lhs
);
2844 /* Return true if call GS calls an internal-only function, as enumerated
2848 gimple_call_internal_p (const gcall
*gs
)
2850 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2854 gimple_call_internal_p (const gimple
*gs
)
2856 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2857 return gimple_call_internal_p (gc
);
2861 /* Return true if call GS is marked as instrumented by
2862 Pointer Bounds Checker. */
2865 gimple_call_with_bounds_p (const gcall
*gs
)
2867 return (gs
->subcode
& GF_CALL_WITH_BOUNDS
) != 0;
2871 gimple_call_with_bounds_p (const gimple
*gs
)
2873 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2874 return gimple_call_with_bounds_p (gc
);
2878 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2879 Pointer Bounds Checker. */
2882 gimple_call_set_with_bounds (gcall
*gs
, bool with_bounds
)
2885 gs
->subcode
|= GF_CALL_WITH_BOUNDS
;
2887 gs
->subcode
&= ~GF_CALL_WITH_BOUNDS
;
2891 gimple_call_set_with_bounds (gimple
*gs
, bool with_bounds
)
2893 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2894 gimple_call_set_with_bounds (gc
, with_bounds
);
2898 /* Return true if call GS is marked as nocf_check. */
2901 gimple_call_nocf_check_p (const gcall
*gs
)
2903 return (gs
->subcode
& GF_CALL_NOCF_CHECK
) != 0;
2906 /* Mark statement GS as nocf_check call. */
2909 gimple_call_set_nocf_check (gcall
*gs
, bool nocf_check
)
2912 gs
->subcode
|= GF_CALL_NOCF_CHECK
;
2914 gs
->subcode
&= ~GF_CALL_NOCF_CHECK
;
2917 /* Return the target of internal call GS. */
2919 static inline enum internal_fn
2920 gimple_call_internal_fn (const gcall
*gs
)
2922 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2923 return gs
->u
.internal_fn
;
2926 static inline enum internal_fn
2927 gimple_call_internal_fn (const gimple
*gs
)
2929 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2930 return gimple_call_internal_fn (gc
);
2933 /* Return true, if this internal gimple call is unique. */
2936 gimple_call_internal_unique_p (const gcall
*gs
)
2938 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
2942 gimple_call_internal_unique_p (const gimple
*gs
)
2944 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2945 return gimple_call_internal_unique_p (gc
);
2948 /* Return true if GS is an internal function FN. */
2951 gimple_call_internal_p (const gimple
*gs
, internal_fn fn
)
2953 return (is_gimple_call (gs
)
2954 && gimple_call_internal_p (gs
)
2955 && gimple_call_internal_fn (gs
) == fn
);
2958 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2959 that could alter control flow. */
2962 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
2964 if (ctrl_altering_p
)
2965 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2967 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2971 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
2973 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
2974 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
2977 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2978 flag is set. Such call could not be a stmt in the middle of a bb. */
2981 gimple_call_ctrl_altering_p (const gcall
*gs
)
2983 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2987 gimple_call_ctrl_altering_p (const gimple
*gs
)
2989 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2990 return gimple_call_ctrl_altering_p (gc
);
2994 /* Return the function type of the function called by GS. */
2997 gimple_call_fntype (const gcall
*gs
)
2999 if (gimple_call_internal_p (gs
))
3001 return gs
->u
.fntype
;
3005 gimple_call_fntype (const gimple
*gs
)
3007 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3008 return gimple_call_fntype (call_stmt
);
3011 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3014 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
3016 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
3017 call_stmt
->u
.fntype
= fntype
;
3021 /* Return the tree node representing the function called by call
3025 gimple_call_fn (const gcall
*gs
)
3031 gimple_call_fn (const gimple
*gs
)
3033 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3034 return gimple_call_fn (gc
);
3037 /* Return a pointer to the tree node representing the function called by call
3040 static inline tree
*
3041 gimple_call_fn_ptr (gcall
*gs
)
3046 static inline tree
*
3047 gimple_call_fn_ptr (gimple
*gs
)
3049 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3050 return gimple_call_fn_ptr (gc
);
3054 /* Set FN to be the function called by call statement GS. */
3057 gimple_call_set_fn (gcall
*gs
, tree fn
)
3059 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3064 /* Set FNDECL to be the function called by call statement GS. */
3067 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3069 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3070 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3071 build_pointer_type (TREE_TYPE (decl
)), decl
);
3075 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3077 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3078 gimple_call_set_fndecl (gc
, decl
);
3082 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3085 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3087 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3088 call_stmt
->u
.internal_fn
= fn
;
3092 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3093 Otherwise return NULL. This function is analogous to
3094 get_callee_fndecl in tree land. */
3097 gimple_call_fndecl (const gcall
*gs
)
3099 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3103 gimple_call_fndecl (const gimple
*gs
)
3105 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3106 return gimple_call_fndecl (gc
);
3110 /* Return the type returned by call statement GS. */
3113 gimple_call_return_type (const gcall
*gs
)
3115 tree type
= gimple_call_fntype (gs
);
3117 if (type
== NULL_TREE
)
3118 return TREE_TYPE (gimple_call_lhs (gs
));
3120 /* The type returned by a function is the type of its
3122 return TREE_TYPE (type
);
3126 /* Return the static chain for call statement GS. */
3129 gimple_call_chain (const gcall
*gs
)
3135 gimple_call_chain (const gimple
*gs
)
3137 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3138 return gimple_call_chain (gc
);
3142 /* Return a pointer to the static chain for call statement CALL_STMT. */
3144 static inline tree
*
3145 gimple_call_chain_ptr (gcall
*call_stmt
)
3147 return &call_stmt
->op
[2];
3150 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3153 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3155 call_stmt
->op
[2] = chain
;
3159 /* Return the number of arguments used by call statement GS. */
3161 static inline unsigned
3162 gimple_call_num_args (const gcall
*gs
)
3164 return gimple_num_ops (gs
) - 3;
3167 static inline unsigned
3168 gimple_call_num_args (const gimple
*gs
)
3170 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3171 return gimple_call_num_args (gc
);
3175 /* Return the argument at position INDEX for call statement GS. */
3178 gimple_call_arg (const gcall
*gs
, unsigned index
)
3180 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3181 return gs
->op
[index
+ 3];
3185 gimple_call_arg (const gimple
*gs
, unsigned index
)
3187 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3188 return gimple_call_arg (gc
, index
);
3192 /* Return a pointer to the argument at position INDEX for call
3195 static inline tree
*
3196 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3198 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3199 return &gs
->op
[index
+ 3];
3202 static inline tree
*
3203 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3205 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3206 return gimple_call_arg_ptr (gc
, index
);
3210 /* Set ARG to be the argument at position INDEX for call statement GS. */
3213 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3215 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3216 gs
->op
[index
+ 3] = arg
;
3220 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3222 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3223 gimple_call_set_arg (gc
, index
, arg
);
3227 /* If TAIL_P is true, mark call statement S as being a tail call
3228 (i.e., a call just before the exit of a function). These calls are
3229 candidate for tail call optimization. */
3232 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3235 s
->subcode
|= GF_CALL_TAILCALL
;
3237 s
->subcode
&= ~GF_CALL_TAILCALL
;
3241 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3244 gimple_call_tail_p (gcall
*s
)
3246 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3249 /* Mark (or clear) call statement S as requiring tail call optimization. */
3252 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3255 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3257 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3260 /* Return true if call statement has been marked as requiring
3261 tail call optimization. */
3264 gimple_call_must_tail_p (const gcall
*s
)
3266 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3269 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3270 slot optimization. This transformation uses the target of the call
3271 expansion as the return slot for calls that return in memory. */
3274 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3276 if (return_slot_opt_p
)
3277 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3279 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3283 /* Return true if S is marked for return slot optimization. */
3286 gimple_call_return_slot_opt_p (gcall
*s
)
3288 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3292 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3293 thunk to the thunked-to function. */
3296 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3299 s
->subcode
|= GF_CALL_FROM_THUNK
;
3301 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3305 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3308 gimple_call_from_thunk_p (gcall
*s
)
3310 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3314 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3315 argument pack in its argument list. */
3318 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3320 if (pass_arg_pack_p
)
3321 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3323 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3327 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3328 argument pack in its argument list. */
3331 gimple_call_va_arg_pack_p (gcall
*s
)
3333 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3337 /* Return true if S is a noreturn call. */
3340 gimple_call_noreturn_p (const gcall
*s
)
3342 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3346 gimple_call_noreturn_p (const gimple
*s
)
3348 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3349 return gimple_call_noreturn_p (gc
);
3353 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3354 even if the called function can throw in other cases. */
3357 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3360 s
->subcode
|= GF_CALL_NOTHROW
;
3362 s
->subcode
&= ~GF_CALL_NOTHROW
;
3365 /* Return true if S is a nothrow call. */
3368 gimple_call_nothrow_p (gcall
*s
)
3370 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3373 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3374 is known to be emitted for VLA objects. Those are wrapped by
3375 stack_save/stack_restore calls and hence can't lead to unbounded
3376 stack growth even when they occur in loops. */
3379 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3382 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3384 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3387 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3390 gimple_call_alloca_for_var_p (gcall
*s
)
3392 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3395 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3396 pointers to nested function are descriptors instead of trampolines. */
3399 gimple_call_set_by_descriptor (gcall
*s
, bool by_descriptor_p
)
3401 if (by_descriptor_p
)
3402 s
->subcode
|= GF_CALL_BY_DESCRIPTOR
;
3404 s
->subcode
&= ~GF_CALL_BY_DESCRIPTOR
;
3407 /* Return true if S is a by-descriptor call. */
3410 gimple_call_by_descriptor_p (gcall
*s
)
3412 return (s
->subcode
& GF_CALL_BY_DESCRIPTOR
) != 0;
3415 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3418 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3420 dest_call
->subcode
= orig_call
->subcode
;
3424 /* Return a pointer to the points-to solution for the set of call-used
3425 variables of the call CALL_STMT. */
3427 static inline struct pt_solution
*
3428 gimple_call_use_set (gcall
*call_stmt
)
3430 return &call_stmt
->call_used
;
3434 /* Return a pointer to the points-to solution for the set of call-used
3435 variables of the call CALL_STMT. */
3437 static inline struct pt_solution
*
3438 gimple_call_clobber_set (gcall
*call_stmt
)
3440 return &call_stmt
->call_clobbered
;
3444 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3448 gimple_has_lhs (gimple
*stmt
)
3450 if (is_gimple_assign (stmt
))
3452 if (gcall
*call
= dyn_cast
<gcall
*> (stmt
))
3453 return gimple_call_lhs (call
) != NULL_TREE
;
3458 /* Return the code of the predicate computed by conditional statement GS. */
3460 static inline enum tree_code
3461 gimple_cond_code (const gcond
*gs
)
3463 return (enum tree_code
) gs
->subcode
;
3466 static inline enum tree_code
3467 gimple_cond_code (const gimple
*gs
)
3469 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3470 return gimple_cond_code (gc
);
3474 /* Set CODE to be the predicate code for the conditional statement GS. */
3477 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3483 /* Return the LHS of the predicate computed by conditional statement GS. */
3486 gimple_cond_lhs (const gcond
*gs
)
3492 gimple_cond_lhs (const gimple
*gs
)
3494 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3495 return gimple_cond_lhs (gc
);
3498 /* Return the pointer to the LHS of the predicate computed by conditional
3501 static inline tree
*
3502 gimple_cond_lhs_ptr (gcond
*gs
)
3507 /* Set LHS to be the LHS operand of the predicate computed by
3508 conditional statement GS. */
3511 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3517 /* Return the RHS operand of the predicate computed by conditional GS. */
3520 gimple_cond_rhs (const gcond
*gs
)
3526 gimple_cond_rhs (const gimple
*gs
)
3528 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3529 return gimple_cond_rhs (gc
);
3532 /* Return the pointer to the RHS operand of the predicate computed by
3535 static inline tree
*
3536 gimple_cond_rhs_ptr (gcond
*gs
)
3542 /* Set RHS to be the RHS operand of the predicate computed by
3543 conditional statement GS. */
3546 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3552 /* Return the label used by conditional statement GS when its
3553 predicate evaluates to true. */
3556 gimple_cond_true_label (const gcond
*gs
)
3562 /* Set LABEL to be the label used by conditional statement GS when its
3563 predicate evaluates to true. */
3566 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3572 /* Set LABEL to be the label used by conditional statement GS when its
3573 predicate evaluates to false. */
3576 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3582 /* Return the label used by conditional statement GS when its
3583 predicate evaluates to false. */
3586 gimple_cond_false_label (const gcond
*gs
)
3592 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3595 gimple_cond_make_false (gcond
*gs
)
3597 gimple_cond_set_lhs (gs
, boolean_false_node
);
3598 gimple_cond_set_rhs (gs
, boolean_false_node
);
3599 gs
->subcode
= NE_EXPR
;
3603 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3606 gimple_cond_make_true (gcond
*gs
)
3608 gimple_cond_set_lhs (gs
, boolean_true_node
);
3609 gimple_cond_set_rhs (gs
, boolean_false_node
);
3610 gs
->subcode
= NE_EXPR
;
3613 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3614 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3617 gimple_cond_true_p (const gcond
*gs
)
3619 tree lhs
= gimple_cond_lhs (gs
);
3620 tree rhs
= gimple_cond_rhs (gs
);
3621 enum tree_code code
= gimple_cond_code (gs
);
3623 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3626 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3629 if (code
== NE_EXPR
&& lhs
!= rhs
)
3632 if (code
== EQ_EXPR
&& lhs
== rhs
)
3638 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3639 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3642 gimple_cond_false_p (const gcond
*gs
)
3644 tree lhs
= gimple_cond_lhs (gs
);
3645 tree rhs
= gimple_cond_rhs (gs
);
3646 enum tree_code code
= gimple_cond_code (gs
);
3648 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3651 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3654 if (code
== NE_EXPR
&& lhs
== rhs
)
3657 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3663 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3666 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3669 gimple_cond_set_code (stmt
, code
);
3670 gimple_cond_set_lhs (stmt
, lhs
);
3671 gimple_cond_set_rhs (stmt
, rhs
);
3674 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3677 gimple_label_label (const glabel
*gs
)
3683 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3687 gimple_label_set_label (glabel
*gs
, tree label
)
3693 /* Return the destination of the unconditional jump GS. */
3696 gimple_goto_dest (const gimple
*gs
)
3698 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3699 return gimple_op (gs
, 0);
3703 /* Set DEST to be the destination of the unconditonal jump GS. */
3706 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3712 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3715 gimple_bind_vars (const gbind
*bind_stmt
)
3717 return bind_stmt
->vars
;
3721 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3725 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3727 bind_stmt
->vars
= vars
;
3731 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3735 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3737 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3741 static inline gimple_seq
*
3742 gimple_bind_body_ptr (gbind
*bind_stmt
)
3744 return &bind_stmt
->body
;
3747 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3749 static inline gimple_seq
3750 gimple_bind_body (gbind
*gs
)
3752 return *gimple_bind_body_ptr (gs
);
3756 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3760 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3762 bind_stmt
->body
= seq
;
3766 /* Append a statement to the end of a GIMPLE_BIND's body. */
3769 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3771 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3775 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3778 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3780 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3784 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3785 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3788 gimple_bind_block (const gbind
*bind_stmt
)
3790 return bind_stmt
->block
;
3794 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3798 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3800 gcc_gimple_checking_assert (block
== NULL_TREE
3801 || TREE_CODE (block
) == BLOCK
);
3802 bind_stmt
->block
= block
;
3806 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3808 static inline unsigned
3809 gimple_asm_ninputs (const gasm
*asm_stmt
)
3811 return asm_stmt
->ni
;
3815 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3817 static inline unsigned
3818 gimple_asm_noutputs (const gasm
*asm_stmt
)
3820 return asm_stmt
->no
;
3824 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3826 static inline unsigned
3827 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3829 return asm_stmt
->nc
;
3832 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3834 static inline unsigned
3835 gimple_asm_nlabels (const gasm
*asm_stmt
)
3837 return asm_stmt
->nl
;
3840 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3843 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3845 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3846 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3849 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3852 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3854 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3855 && TREE_CODE (in_op
) == TREE_LIST
);
3856 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3860 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3863 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3865 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3866 return asm_stmt
->op
[index
];
3869 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3872 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
3874 gcc_gimple_checking_assert (index
< asm_stmt
->no
3875 && TREE_CODE (out_op
) == TREE_LIST
);
3876 asm_stmt
->op
[index
] = out_op
;
3880 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3883 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
3885 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3886 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
3890 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3893 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
3895 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3896 && TREE_CODE (clobber_op
) == TREE_LIST
);
3897 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
3900 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3903 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
3905 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3906 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
];
3909 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3912 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
3914 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3915 && TREE_CODE (label_op
) == TREE_LIST
);
3916 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
3919 /* Return the string representing the assembly instruction in
3920 GIMPLE_ASM ASM_STMT. */
3922 static inline const char *
3923 gimple_asm_string (const gasm
*asm_stmt
)
3925 return asm_stmt
->string
;
3929 /* Return true if ASM_STMT is marked volatile. */
3932 gimple_asm_volatile_p (const gasm
*asm_stmt
)
3934 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
3938 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
3941 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
3944 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
3946 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
3950 /* Return true if ASM_STMT is marked inline. */
3953 gimple_asm_inline_p (const gasm
*asm_stmt
)
3955 return (asm_stmt
->subcode
& GF_ASM_INLINE
) != 0;
3959 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
3962 gimple_asm_set_inline (gasm
*asm_stmt
, bool inline_p
)
3965 asm_stmt
->subcode
|= GF_ASM_INLINE
;
3967 asm_stmt
->subcode
&= ~GF_ASM_INLINE
;
3971 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3974 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
3977 asm_stmt
->subcode
|= GF_ASM_INPUT
;
3979 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
3983 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3986 gimple_asm_input_p (const gasm
*asm_stmt
)
3988 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
3992 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3995 gimple_catch_types (const gcatch
*catch_stmt
)
3997 return catch_stmt
->types
;
4001 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4003 static inline tree
*
4004 gimple_catch_types_ptr (gcatch
*catch_stmt
)
4006 return &catch_stmt
->types
;
4010 /* Return a pointer to the GIMPLE sequence representing the body of
4011 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4013 static inline gimple_seq
*
4014 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
4016 return &catch_stmt
->handler
;
4020 /* Return the GIMPLE sequence representing the body of the handler of
4021 GIMPLE_CATCH statement CATCH_STMT. */
4023 static inline gimple_seq
4024 gimple_catch_handler (gcatch
*catch_stmt
)
4026 return *gimple_catch_handler_ptr (catch_stmt
);
4030 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4033 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
4035 catch_stmt
->types
= t
;
4039 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4042 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
4044 catch_stmt
->handler
= handler
;
4048 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4051 gimple_eh_filter_types (const gimple
*gs
)
4053 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
4054 return eh_filter_stmt
->types
;
4058 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4061 static inline tree
*
4062 gimple_eh_filter_types_ptr (gimple
*gs
)
4064 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4065 return &eh_filter_stmt
->types
;
4069 /* Return a pointer to the sequence of statement to execute when
4070 GIMPLE_EH_FILTER statement fails. */
4072 static inline gimple_seq
*
4073 gimple_eh_filter_failure_ptr (gimple
*gs
)
4075 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4076 return &eh_filter_stmt
->failure
;
4080 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4083 static inline gimple_seq
4084 gimple_eh_filter_failure (gimple
*gs
)
4086 return *gimple_eh_filter_failure_ptr (gs
);
4090 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4094 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4096 eh_filter_stmt
->types
= types
;
4100 /* Set FAILURE to be the sequence of statements to execute on failure
4101 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4104 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4107 eh_filter_stmt
->failure
= failure
;
4110 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4113 gimple_eh_must_not_throw_fndecl (geh_mnt
*eh_mnt_stmt
)
4115 return eh_mnt_stmt
->fndecl
;
4118 /* Set the function decl to be called by GS to DECL. */
4121 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4124 eh_mnt_stmt
->fndecl
= decl
;
4127 /* GIMPLE_EH_ELSE accessors. */
4129 static inline gimple_seq
*
4130 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4132 return &eh_else_stmt
->n_body
;
4135 static inline gimple_seq
4136 gimple_eh_else_n_body (geh_else
*eh_else_stmt
)
4138 return *gimple_eh_else_n_body_ptr (eh_else_stmt
);
4141 static inline gimple_seq
*
4142 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4144 return &eh_else_stmt
->e_body
;
4147 static inline gimple_seq
4148 gimple_eh_else_e_body (geh_else
*eh_else_stmt
)
4150 return *gimple_eh_else_e_body_ptr (eh_else_stmt
);
4154 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4156 eh_else_stmt
->n_body
= seq
;
4160 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4162 eh_else_stmt
->e_body
= seq
;
4165 /* GIMPLE_TRY accessors. */
4167 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4168 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4170 static inline enum gimple_try_flags
4171 gimple_try_kind (const gimple
*gs
)
4173 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4174 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4178 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4181 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4183 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4184 || kind
== GIMPLE_TRY_FINALLY
);
4185 if (gimple_try_kind (gs
) != kind
)
4186 gs
->subcode
= (unsigned int) kind
;
4190 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4193 gimple_try_catch_is_cleanup (const gimple
*gs
)
4195 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4196 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4200 /* Return a pointer to the sequence of statements used as the
4201 body for GIMPLE_TRY GS. */
4203 static inline gimple_seq
*
4204 gimple_try_eval_ptr (gimple
*gs
)
4206 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4207 return &try_stmt
->eval
;
4211 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4213 static inline gimple_seq
4214 gimple_try_eval (gimple
*gs
)
4216 return *gimple_try_eval_ptr (gs
);
4220 /* Return a pointer to the sequence of statements used as the cleanup body for
4223 static inline gimple_seq
*
4224 gimple_try_cleanup_ptr (gimple
*gs
)
4226 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4227 return &try_stmt
->cleanup
;
4231 /* Return the sequence of statements used as the cleanup body for
4234 static inline gimple_seq
4235 gimple_try_cleanup (gimple
*gs
)
4237 return *gimple_try_cleanup_ptr (gs
);
4241 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4244 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4246 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4247 if (catch_is_cleanup
)
4248 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4250 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4254 /* Set EVAL to be the sequence of statements to use as the body for
4255 GIMPLE_TRY TRY_STMT. */
4258 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4260 try_stmt
->eval
= eval
;
4264 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4265 body for GIMPLE_TRY TRY_STMT. */
4268 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4270 try_stmt
->cleanup
= cleanup
;
4274 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4276 static inline gimple_seq
*
4277 gimple_wce_cleanup_ptr (gimple
*gs
)
4279 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4280 return &wce_stmt
->cleanup
;
4284 /* Return the cleanup sequence for cleanup statement GS. */
4286 static inline gimple_seq
4287 gimple_wce_cleanup (gimple
*gs
)
4289 return *gimple_wce_cleanup_ptr (gs
);
4293 /* Set CLEANUP to be the cleanup sequence for GS. */
4296 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4298 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4299 wce_stmt
->cleanup
= cleanup
;
4303 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4306 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4308 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4309 return gs
->subcode
!= 0;
4313 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4316 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4318 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4319 gs
->subcode
= (unsigned int) eh_only_p
;
4323 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4325 static inline unsigned
4326 gimple_phi_capacity (const gimple
*gs
)
4328 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4329 return phi_stmt
->capacity
;
4333 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4334 be exactly the number of incoming edges for the basic block holding
4337 static inline unsigned
4338 gimple_phi_num_args (const gimple
*gs
)
4340 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4341 return phi_stmt
->nargs
;
4345 /* Return the SSA name created by GIMPLE_PHI GS. */
4348 gimple_phi_result (const gphi
*gs
)
4354 gimple_phi_result (const gimple
*gs
)
4356 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4357 return gimple_phi_result (phi_stmt
);
4360 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4362 static inline tree
*
4363 gimple_phi_result_ptr (gphi
*gs
)
4368 static inline tree
*
4369 gimple_phi_result_ptr (gimple
*gs
)
4371 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4372 return gimple_phi_result_ptr (phi_stmt
);
4375 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4378 gimple_phi_set_result (gphi
*phi
, tree result
)
4380 phi
->result
= result
;
4381 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4382 SSA_NAME_DEF_STMT (result
) = phi
;
4386 /* Return the PHI argument corresponding to incoming edge INDEX for
4389 static inline struct phi_arg_d
*
4390 gimple_phi_arg (gphi
*gs
, unsigned index
)
4392 gcc_gimple_checking_assert (index
< gs
->nargs
);
4393 return &(gs
->args
[index
]);
4396 static inline struct phi_arg_d
*
4397 gimple_phi_arg (gimple
*gs
, unsigned index
)
4399 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4400 return gimple_phi_arg (phi_stmt
, index
);
4403 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4404 for GIMPLE_PHI PHI. */
4407 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4409 gcc_gimple_checking_assert (index
< phi
->nargs
);
4410 phi
->args
[index
] = *phiarg
;
4413 /* Return the PHI nodes for basic block BB, or NULL if there are no
4416 static inline gimple_seq
4417 phi_nodes (const_basic_block bb
)
4419 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4420 return bb
->il
.gimple
.phi_nodes
;
4423 /* Return a pointer to the PHI nodes for basic block BB. */
4425 static inline gimple_seq
*
4426 phi_nodes_ptr (basic_block bb
)
4428 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4429 return &bb
->il
.gimple
.phi_nodes
;
4432 /* Return the tree operand for argument I of PHI node GS. */
4435 gimple_phi_arg_def (gphi
*gs
, size_t index
)
4437 return gimple_phi_arg (gs
, index
)->def
;
4441 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4443 return gimple_phi_arg (gs
, index
)->def
;
4447 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4449 static inline tree
*
4450 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4452 return &gimple_phi_arg (phi
, index
)->def
;
4455 /* Return the edge associated with argument I of phi node PHI. */
4458 gimple_phi_arg_edge (gphi
*phi
, size_t i
)
4460 return EDGE_PRED (gimple_bb (phi
), i
);
4463 /* Return the source location of gimple argument I of phi node PHI. */
4465 static inline source_location
4466 gimple_phi_arg_location (gphi
*phi
, size_t i
)
4468 return gimple_phi_arg (phi
, i
)->locus
;
4471 /* Return the source location of the argument on edge E of phi node PHI. */
4473 static inline source_location
4474 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4476 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4479 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4482 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, source_location loc
)
4484 gimple_phi_arg (phi
, i
)->locus
= loc
;
4487 /* Return TRUE if argument I of phi node PHI has a location record. */
4490 gimple_phi_arg_has_location (gphi
*phi
, size_t i
)
4492 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4496 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4499 gimple_resx_region (const gresx
*resx_stmt
)
4501 return resx_stmt
->region
;
4504 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4507 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4509 resx_stmt
->region
= region
;
4512 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4515 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4517 return eh_dispatch_stmt
->region
;
4520 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4521 EH_DISPATCH_STMT. */
4524 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4526 eh_dispatch_stmt
->region
= region
;
4529 /* Return the number of labels associated with the switch statement GS. */
4531 static inline unsigned
4532 gimple_switch_num_labels (const gswitch
*gs
)
4535 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4536 num_ops
= gimple_num_ops (gs
);
4537 gcc_gimple_checking_assert (num_ops
> 1);
4542 /* Set NLABELS to be the number of labels for the switch statement GS. */
4545 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4547 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4548 gimple_set_num_ops (g
, nlabels
+ 1);
4552 /* Return the index variable used by the switch statement GS. */
4555 gimple_switch_index (const gswitch
*gs
)
4561 /* Return a pointer to the index variable for the switch statement GS. */
4563 static inline tree
*
4564 gimple_switch_index_ptr (gswitch
*gs
)
4570 /* Set INDEX to be the index variable for switch statement GS. */
4573 gimple_switch_set_index (gswitch
*gs
, tree index
)
4575 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4580 /* Return the label numbered INDEX. The default label is 0, followed by any
4581 labels in a switch statement. */
4584 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4586 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4587 return gs
->op
[index
+ 1];
4590 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4593 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4595 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4596 && (label
== NULL_TREE
4597 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4598 gs
->op
[index
+ 1] = label
;
4601 /* Return the default label for a switch statement. */
4604 gimple_switch_default_label (const gswitch
*gs
)
4606 tree label
= gimple_switch_label (gs
, 0);
4607 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4611 /* Set the default label for a switch statement. */
4614 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4616 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4617 gimple_switch_set_label (gs
, 0, label
);
4620 /* Return true if GS is a GIMPLE_DEBUG statement. */
4623 is_gimple_debug (const gimple
*gs
)
4625 return gimple_code (gs
) == GIMPLE_DEBUG
;
4629 /* Return the last nondebug statement in GIMPLE sequence S. */
4631 static inline gimple
*
4632 gimple_seq_last_nondebug_stmt (gimple_seq s
)
4635 for (n
= gimple_seq_last (s
);
4636 n
&& is_gimple_debug (n
);
4644 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4647 gimple_debug_bind_p (const gimple
*s
)
4649 if (is_gimple_debug (s
))
4650 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4655 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4658 gimple_debug_bind_get_var (gimple
*dbg
)
4660 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4661 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4662 return gimple_op (dbg
, 0);
4665 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4669 gimple_debug_bind_get_value (gimple
*dbg
)
4671 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4672 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4673 return gimple_op (dbg
, 1);
4676 /* Return a pointer to the value bound to the variable in a
4677 GIMPLE_DEBUG bind statement. */
4679 static inline tree
*
4680 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4682 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4683 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4684 return gimple_op_ptr (dbg
, 1);
4687 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4690 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4692 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4693 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4694 gimple_set_op (dbg
, 0, var
);
4697 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4701 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4703 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4704 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4705 gimple_set_op (dbg
, 1, value
);
4708 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4710 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4712 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4716 gimple_debug_bind_reset_value (gimple
*dbg
)
4718 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4719 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4720 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4723 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4727 gimple_debug_bind_has_value_p (gimple
*dbg
)
4729 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4730 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4731 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4734 #undef GIMPLE_DEBUG_BIND_NOVALUE
4736 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4739 gimple_debug_source_bind_p (const gimple
*s
)
4741 if (is_gimple_debug (s
))
4742 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4747 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4750 gimple_debug_source_bind_get_var (gimple
*dbg
)
4752 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4753 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4754 return gimple_op (dbg
, 0);
4757 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4761 gimple_debug_source_bind_get_value (gimple
*dbg
)
4763 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4764 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4765 return gimple_op (dbg
, 1);
4768 /* Return a pointer to the value bound to the variable in a
4769 GIMPLE_DEBUG source bind statement. */
4771 static inline tree
*
4772 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4774 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4775 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4776 return gimple_op_ptr (dbg
, 1);
4779 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4782 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4784 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4785 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4786 gimple_set_op (dbg
, 0, var
);
4789 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4793 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4795 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4796 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4797 gimple_set_op (dbg
, 1, value
);
4800 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4803 gimple_debug_begin_stmt_p (const gimple
*s
)
4805 if (is_gimple_debug (s
))
4806 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
;
4811 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4814 gimple_debug_inline_entry_p (const gimple
*s
)
4816 if (is_gimple_debug (s
))
4817 return s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4822 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4825 gimple_debug_nonbind_marker_p (const gimple
*s
)
4827 if (is_gimple_debug (s
))
4828 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
4829 || s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4834 /* Return the line number for EXPR, or return -1 if we have no line
4835 number information for it. */
4837 get_lineno (const gimple
*stmt
)
4844 loc
= gimple_location (stmt
);
4845 if (loc
== UNKNOWN_LOCATION
)
4848 return LOCATION_LINE (loc
);
4851 /* Return a pointer to the body for the OMP statement GS. */
4853 static inline gimple_seq
*
4854 gimple_omp_body_ptr (gimple
*gs
)
4856 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4859 /* Return the body for the OMP statement GS. */
4861 static inline gimple_seq
4862 gimple_omp_body (gimple
*gs
)
4864 return *gimple_omp_body_ptr (gs
);
4867 /* Set BODY to be the body for the OMP statement GS. */
4870 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
4872 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4876 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4879 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
4881 return crit_stmt
->name
;
4885 /* Return a pointer to the name associated with OMP critical statement
4888 static inline tree
*
4889 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
4891 return &crit_stmt
->name
;
4895 /* Set NAME to be the name associated with OMP critical statement
4899 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
4901 crit_stmt
->name
= name
;
4905 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4908 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
4910 return crit_stmt
->clauses
;
4914 /* Return a pointer to the clauses associated with OMP critical statement
4917 static inline tree
*
4918 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
4920 return &crit_stmt
->clauses
;
4924 /* Set CLAUSES to be the clauses associated with OMP critical statement
4928 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
4930 crit_stmt
->clauses
= clauses
;
4934 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4937 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
4939 return ord_stmt
->clauses
;
4943 /* Return a pointer to the clauses associated with OMP ordered statement
4946 static inline tree
*
4947 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
4949 return &ord_stmt
->clauses
;
4953 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4957 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
4959 ord_stmt
->clauses
= clauses
;
4963 /* Return the kind of the OMP_FOR statemement G. */
4966 gimple_omp_for_kind (const gimple
*g
)
4968 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4969 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4973 /* Set the kind of the OMP_FOR statement G. */
4976 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
4978 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4979 | (kind
& GF_OMP_FOR_KIND_MASK
);
4983 /* Return true if OMP_FOR statement G has the
4984 GF_OMP_FOR_COMBINED flag set. */
4987 gimple_omp_for_combined_p (const gimple
*g
)
4989 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4990 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4994 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4995 the boolean value of COMBINED_P. */
4998 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
5001 g
->subcode
|= GF_OMP_FOR_COMBINED
;
5003 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
5007 /* Return true if the OMP_FOR statement G has the
5008 GF_OMP_FOR_COMBINED_INTO flag set. */
5011 gimple_omp_for_combined_into_p (const gimple
*g
)
5013 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5014 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
5018 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5019 on the boolean value of COMBINED_P. */
5022 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
5025 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
5027 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
5031 /* Return the clauses associated with the OMP_FOR statement GS. */
5034 gimple_omp_for_clauses (const gimple
*gs
)
5036 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5037 return omp_for_stmt
->clauses
;
5041 /* Return a pointer to the clauses associated with the OMP_FOR statement
5044 static inline tree
*
5045 gimple_omp_for_clauses_ptr (gimple
*gs
)
5047 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5048 return &omp_for_stmt
->clauses
;
5052 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5056 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
5058 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5059 omp_for_stmt
->clauses
= clauses
;
5063 /* Get the collapse count of the OMP_FOR statement GS. */
5065 static inline size_t
5066 gimple_omp_for_collapse (gimple
*gs
)
5068 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5069 return omp_for_stmt
->collapse
;
5073 /* Return the condition code associated with the OMP_FOR statement GS. */
5075 static inline enum tree_code
5076 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
5078 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5079 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5080 return omp_for_stmt
->iter
[i
].cond
;
5084 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5087 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
5089 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5090 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5091 && i
< omp_for_stmt
->collapse
);
5092 omp_for_stmt
->iter
[i
].cond
= cond
;
5096 /* Return the index variable for the OMP_FOR statement GS. */
5099 gimple_omp_for_index (const gimple
*gs
, size_t i
)
5101 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5102 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5103 return omp_for_stmt
->iter
[i
].index
;
5107 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5109 static inline tree
*
5110 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
5112 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5113 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5114 return &omp_for_stmt
->iter
[i
].index
;
5118 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5121 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
5123 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5124 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5125 omp_for_stmt
->iter
[i
].index
= index
;
5129 /* Return the initial value for the OMP_FOR statement GS. */
5132 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
5134 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5135 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5136 return omp_for_stmt
->iter
[i
].initial
;
5140 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5142 static inline tree
*
5143 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
5145 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5146 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5147 return &omp_for_stmt
->iter
[i
].initial
;
5151 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5154 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5156 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5157 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5158 omp_for_stmt
->iter
[i
].initial
= initial
;
5162 /* Return the final value for the OMP_FOR statement GS. */
5165 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5167 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5168 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5169 return omp_for_stmt
->iter
[i
].final
;
5173 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5175 static inline tree
*
5176 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5178 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5179 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5180 return &omp_for_stmt
->iter
[i
].final
;
5184 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5187 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5189 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5190 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5191 omp_for_stmt
->iter
[i
].final
= final
;
5195 /* Return the increment value for the OMP_FOR statement GS. */
5198 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5200 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5201 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5202 return omp_for_stmt
->iter
[i
].incr
;
5206 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5208 static inline tree
*
5209 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5211 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5212 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5213 return &omp_for_stmt
->iter
[i
].incr
;
5217 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5220 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5222 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5223 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5224 omp_for_stmt
->iter
[i
].incr
= incr
;
5228 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5229 statement GS starts. */
5231 static inline gimple_seq
*
5232 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5234 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5235 return &omp_for_stmt
->pre_body
;
5239 /* Return the sequence of statements to execute before the OMP_FOR
5240 statement GS starts. */
5242 static inline gimple_seq
5243 gimple_omp_for_pre_body (gimple
*gs
)
5245 return *gimple_omp_for_pre_body_ptr (gs
);
5249 /* Set PRE_BODY to be the sequence of statements to execute before the
5250 OMP_FOR statement GS starts. */
5253 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5255 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5256 omp_for_stmt
->pre_body
= pre_body
;
5259 /* Return the kernel_phony of OMP_FOR statement. */
5262 gimple_omp_for_grid_phony (const gomp_for
*omp_for
)
5264 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5265 != GF_OMP_FOR_KIND_GRID_LOOP
);
5266 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_PHONY
) != 0;
5269 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5272 gimple_omp_for_set_grid_phony (gomp_for
*omp_for
, bool value
)
5274 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5275 != GF_OMP_FOR_KIND_GRID_LOOP
);
5277 omp_for
->subcode
|= GF_OMP_FOR_GRID_PHONY
;
5279 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_PHONY
;
5282 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5285 gimple_omp_for_grid_intra_group (const gomp_for
*omp_for
)
5287 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5288 == GF_OMP_FOR_KIND_GRID_LOOP
);
5289 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_INTRA_GROUP
) != 0;
5292 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5295 gimple_omp_for_set_grid_intra_group (gomp_for
*omp_for
, bool value
)
5297 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5298 == GF_OMP_FOR_KIND_GRID_LOOP
);
5300 omp_for
->subcode
|= GF_OMP_FOR_GRID_INTRA_GROUP
;
5302 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_INTRA_GROUP
;
5305 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5309 gimple_omp_for_grid_group_iter (const gomp_for
*omp_for
)
5311 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5312 == GF_OMP_FOR_KIND_GRID_LOOP
);
5313 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_GROUP_ITER
) != 0;
5316 /* Set group_iter flag of OMP_FOR to VALUE. */
5319 gimple_omp_for_set_grid_group_iter (gomp_for
*omp_for
, bool value
)
5321 gcc_checking_assert (gimple_omp_for_kind (omp_for
)
5322 == GF_OMP_FOR_KIND_GRID_LOOP
);
5324 omp_for
->subcode
|= GF_OMP_FOR_GRID_GROUP_ITER
;
5326 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_GROUP_ITER
;
5329 /* Return the clauses associated with OMP_PARALLEL GS. */
5332 gimple_omp_parallel_clauses (const gimple
*gs
)
5334 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5335 return omp_parallel_stmt
->clauses
;
5339 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5341 static inline tree
*
5342 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5344 return &omp_parallel_stmt
->clauses
;
5348 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5351 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5354 omp_parallel_stmt
->clauses
= clauses
;
5358 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5361 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5363 return omp_parallel_stmt
->child_fn
;
5366 /* Return a pointer to the child function used to hold the body of
5367 OMP_PARALLEL_STMT. */
5369 static inline tree
*
5370 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5372 return &omp_parallel_stmt
->child_fn
;
5376 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5379 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5382 omp_parallel_stmt
->child_fn
= child_fn
;
5386 /* Return the artificial argument used to send variables and values
5387 from the parent to the children threads in OMP_PARALLEL_STMT. */
5390 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5392 return omp_parallel_stmt
->data_arg
;
5396 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5398 static inline tree
*
5399 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5401 return &omp_parallel_stmt
->data_arg
;
5405 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5408 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5411 omp_parallel_stmt
->data_arg
= data_arg
;
5414 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5417 gimple_omp_parallel_grid_phony (const gomp_parallel
*stmt
)
5419 return (gimple_omp_subcode (stmt
) & GF_OMP_PARALLEL_GRID_PHONY
) != 0;
5422 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5425 gimple_omp_parallel_set_grid_phony (gomp_parallel
*stmt
, bool value
)
5428 stmt
->subcode
|= GF_OMP_PARALLEL_GRID_PHONY
;
5430 stmt
->subcode
&= ~GF_OMP_PARALLEL_GRID_PHONY
;
5433 /* Return the clauses associated with OMP_TASK GS. */
5436 gimple_omp_task_clauses (const gimple
*gs
)
5438 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5439 return omp_task_stmt
->clauses
;
5443 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5445 static inline tree
*
5446 gimple_omp_task_clauses_ptr (gimple
*gs
)
5448 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5449 return &omp_task_stmt
->clauses
;
5453 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5457 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5459 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5460 omp_task_stmt
->clauses
= clauses
;
5464 /* Return true if OMP task statement G has the
5465 GF_OMP_TASK_TASKLOOP flag set. */
5468 gimple_omp_task_taskloop_p (const gimple
*g
)
5470 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5471 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5475 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5476 value of TASKLOOP_P. */
5479 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5481 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5483 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5485 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5489 /* Return the child function used to hold the body of OMP_TASK GS. */
5492 gimple_omp_task_child_fn (const gimple
*gs
)
5494 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5495 return omp_task_stmt
->child_fn
;
5498 /* Return a pointer to the child function used to hold the body of
5501 static inline tree
*
5502 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5504 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5505 return &omp_task_stmt
->child_fn
;
5509 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5512 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5514 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5515 omp_task_stmt
->child_fn
= child_fn
;
5519 /* Return the artificial argument used to send variables and values
5520 from the parent to the children threads in OMP_TASK GS. */
5523 gimple_omp_task_data_arg (const gimple
*gs
)
5525 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5526 return omp_task_stmt
->data_arg
;
5530 /* Return a pointer to the data argument for OMP_TASK GS. */
5532 static inline tree
*
5533 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5535 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5536 return &omp_task_stmt
->data_arg
;
5540 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5543 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5545 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5546 omp_task_stmt
->data_arg
= data_arg
;
5550 /* Return the clauses associated with OMP_TASK GS. */
5553 gimple_omp_taskreg_clauses (const gimple
*gs
)
5555 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5556 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5557 return omp_taskreg_stmt
->clauses
;
5561 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5563 static inline tree
*
5564 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5566 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5567 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5568 return &omp_taskreg_stmt
->clauses
;
5572 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5576 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5578 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5579 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5580 omp_taskreg_stmt
->clauses
= clauses
;
5584 /* Return the child function used to hold the body of OMP_TASK GS. */
5587 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5589 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5590 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5591 return omp_taskreg_stmt
->child_fn
;
5594 /* Return a pointer to the child function used to hold the body of
5597 static inline tree
*
5598 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5600 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5601 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5602 return &omp_taskreg_stmt
->child_fn
;
5606 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5609 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5611 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5612 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5613 omp_taskreg_stmt
->child_fn
= child_fn
;
5617 /* Return the artificial argument used to send variables and values
5618 from the parent to the children threads in OMP_TASK GS. */
5621 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5623 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5624 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5625 return omp_taskreg_stmt
->data_arg
;
5629 /* Return a pointer to the data argument for OMP_TASK GS. */
5631 static inline tree
*
5632 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5634 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5635 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5636 return &omp_taskreg_stmt
->data_arg
;
5640 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5643 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5645 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5646 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5647 omp_taskreg_stmt
->data_arg
= data_arg
;
5651 /* Return the copy function used to hold the body of OMP_TASK GS. */
5654 gimple_omp_task_copy_fn (const gimple
*gs
)
5656 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5657 return omp_task_stmt
->copy_fn
;
5660 /* Return a pointer to the copy function used to hold the body of
5663 static inline tree
*
5664 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5666 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5667 return &omp_task_stmt
->copy_fn
;
5671 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5674 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5676 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5677 omp_task_stmt
->copy_fn
= copy_fn
;
5681 /* Return size of the data block in bytes in OMP_TASK GS. */
5684 gimple_omp_task_arg_size (const gimple
*gs
)
5686 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5687 return omp_task_stmt
->arg_size
;
5691 /* Return a pointer to the data block size for OMP_TASK GS. */
5693 static inline tree
*
5694 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5696 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5697 return &omp_task_stmt
->arg_size
;
5701 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5704 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5706 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5707 omp_task_stmt
->arg_size
= arg_size
;
5711 /* Return align of the data block in bytes in OMP_TASK GS. */
5714 gimple_omp_task_arg_align (const gimple
*gs
)
5716 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5717 return omp_task_stmt
->arg_align
;
5721 /* Return a pointer to the data block align for OMP_TASK GS. */
5723 static inline tree
*
5724 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5726 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5727 return &omp_task_stmt
->arg_align
;
5731 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5734 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5736 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5737 omp_task_stmt
->arg_align
= arg_align
;
5741 /* Return the clauses associated with OMP_SINGLE GS. */
5744 gimple_omp_single_clauses (const gimple
*gs
)
5746 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5747 return omp_single_stmt
->clauses
;
5751 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5753 static inline tree
*
5754 gimple_omp_single_clauses_ptr (gimple
*gs
)
5756 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5757 return &omp_single_stmt
->clauses
;
5761 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5764 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5766 omp_single_stmt
->clauses
= clauses
;
5770 /* Return the clauses associated with OMP_TARGET GS. */
5773 gimple_omp_target_clauses (const gimple
*gs
)
5775 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5776 return omp_target_stmt
->clauses
;
5780 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5782 static inline tree
*
5783 gimple_omp_target_clauses_ptr (gimple
*gs
)
5785 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5786 return &omp_target_stmt
->clauses
;
5790 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5793 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5796 omp_target_stmt
->clauses
= clauses
;
5800 /* Return the kind of the OMP_TARGET G. */
5803 gimple_omp_target_kind (const gimple
*g
)
5805 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5806 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5810 /* Set the kind of the OMP_TARGET G. */
5813 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5815 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5816 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5820 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5823 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5825 return omp_target_stmt
->child_fn
;
5828 /* Return a pointer to the child function used to hold the body of
5831 static inline tree
*
5832 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5834 return &omp_target_stmt
->child_fn
;
5838 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5841 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
5844 omp_target_stmt
->child_fn
= child_fn
;
5848 /* Return the artificial argument used to send variables and values
5849 from the parent to the children threads in OMP_TARGET_STMT. */
5852 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
5854 return omp_target_stmt
->data_arg
;
5858 /* Return a pointer to the data argument for OMP_TARGET GS. */
5860 static inline tree
*
5861 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
5863 return &omp_target_stmt
->data_arg
;
5867 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5870 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
5873 omp_target_stmt
->data_arg
= data_arg
;
5877 /* Return the clauses associated with OMP_TEAMS GS. */
5880 gimple_omp_teams_clauses (const gimple
*gs
)
5882 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
5883 return omp_teams_stmt
->clauses
;
5887 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5889 static inline tree
*
5890 gimple_omp_teams_clauses_ptr (gimple
*gs
)
5892 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
5893 return &omp_teams_stmt
->clauses
;
5897 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5900 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
5902 omp_teams_stmt
->clauses
= clauses
;
5905 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5908 gimple_omp_teams_grid_phony (const gomp_teams
*omp_teams_stmt
)
5910 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_GRID_PHONY
) != 0;
5913 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5916 gimple_omp_teams_set_grid_phony (gomp_teams
*omp_teams_stmt
, bool value
)
5919 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_GRID_PHONY
;
5921 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_GRID_PHONY
;
5924 /* Return the clauses associated with OMP_SECTIONS GS. */
5927 gimple_omp_sections_clauses (const gimple
*gs
)
5929 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5930 return omp_sections_stmt
->clauses
;
5934 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5936 static inline tree
*
5937 gimple_omp_sections_clauses_ptr (gimple
*gs
)
5939 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5940 return &omp_sections_stmt
->clauses
;
5944 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5948 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
5950 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5951 omp_sections_stmt
->clauses
= clauses
;
5955 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5959 gimple_omp_sections_control (const gimple
*gs
)
5961 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5962 return omp_sections_stmt
->control
;
5966 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5969 static inline tree
*
5970 gimple_omp_sections_control_ptr (gimple
*gs
)
5972 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5973 return &omp_sections_stmt
->control
;
5977 /* Set CONTROL to be the set of clauses associated with the
5978 GIMPLE_OMP_SECTIONS in GS. */
5981 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
5983 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5984 omp_sections_stmt
->control
= control
;
5988 /* Set the value being stored in an atomic store. */
5991 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
5993 store_stmt
->val
= val
;
5997 /* Return the value being stored in an atomic store. */
6000 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
6002 return store_stmt
->val
;
6006 /* Return a pointer to the value being stored in an atomic store. */
6008 static inline tree
*
6009 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
6011 return &store_stmt
->val
;
6015 /* Set the LHS of an atomic load. */
6018 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
6020 load_stmt
->lhs
= lhs
;
6024 /* Get the LHS of an atomic load. */
6027 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
6029 return load_stmt
->lhs
;
6033 /* Return a pointer to the LHS of an atomic load. */
6035 static inline tree
*
6036 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
6038 return &load_stmt
->lhs
;
6042 /* Set the RHS of an atomic load. */
6045 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
6047 load_stmt
->rhs
= rhs
;
6051 /* Get the RHS of an atomic load. */
6054 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
6056 return load_stmt
->rhs
;
6060 /* Return a pointer to the RHS of an atomic load. */
6062 static inline tree
*
6063 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
6065 return &load_stmt
->rhs
;
6069 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6072 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
6074 return cont_stmt
->control_def
;
6077 /* The same as above, but return the address. */
6079 static inline tree
*
6080 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
6082 return &cont_stmt
->control_def
;
6085 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6088 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
6090 cont_stmt
->control_def
= def
;
6094 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6097 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
6099 return cont_stmt
->control_use
;
6103 /* The same as above, but return the address. */
6105 static inline tree
*
6106 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
6108 return &cont_stmt
->control_use
;
6112 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6115 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
6117 cont_stmt
->control_use
= use
;
6120 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6121 TRANSACTION_STMT. */
6123 static inline gimple_seq
*
6124 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
6126 return &transaction_stmt
->body
;
6129 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6131 static inline gimple_seq
6132 gimple_transaction_body (gtransaction
*transaction_stmt
)
6134 return transaction_stmt
->body
;
6137 /* Return the label associated with a GIMPLE_TRANSACTION. */
6140 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
6142 return transaction_stmt
->label_norm
;
6145 static inline tree
*
6146 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
6148 return &transaction_stmt
->label_norm
;
6152 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
6154 return transaction_stmt
->label_uninst
;
6157 static inline tree
*
6158 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
6160 return &transaction_stmt
->label_uninst
;
6164 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
6166 return transaction_stmt
->label_over
;
6169 static inline tree
*
6170 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
6172 return &transaction_stmt
->label_over
;
6175 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6177 static inline unsigned int
6178 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
6180 return transaction_stmt
->subcode
;
6183 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6184 TRANSACTION_STMT. */
6187 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
6190 transaction_stmt
->body
= body
;
6193 /* Set the label associated with a GIMPLE_TRANSACTION. */
6196 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
6198 transaction_stmt
->label_norm
= label
;
6202 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6204 transaction_stmt
->label_uninst
= label
;
6208 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6210 transaction_stmt
->label_over
= label
;
6213 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6216 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6217 unsigned int subcode
)
6219 transaction_stmt
->subcode
= subcode
;
6222 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6224 static inline tree
*
6225 gimple_return_retval_ptr (greturn
*gs
)
6230 /* Return the return value for GIMPLE_RETURN GS. */
6233 gimple_return_retval (const greturn
*gs
)
6239 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6242 gimple_return_set_retval (greturn
*gs
, tree retval
)
6248 /* Return the return bounds for GIMPLE_RETURN GS. */
6251 gimple_return_retbnd (const gimple
*gs
)
6253 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
6254 return gimple_op (gs
, 1);
6258 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6261 gimple_return_set_retbnd (gimple
*gs
, tree retval
)
6263 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
6264 gimple_set_op (gs
, 1, retval
);
6268 /* Returns true when the gimple statement STMT is any of the OMP types. */
6270 #define CASE_GIMPLE_OMP \
6271 case GIMPLE_OMP_PARALLEL: \
6272 case GIMPLE_OMP_TASK: \
6273 case GIMPLE_OMP_FOR: \
6274 case GIMPLE_OMP_SECTIONS: \
6275 case GIMPLE_OMP_SECTIONS_SWITCH: \
6276 case GIMPLE_OMP_SINGLE: \
6277 case GIMPLE_OMP_TARGET: \
6278 case GIMPLE_OMP_TEAMS: \
6279 case GIMPLE_OMP_SECTION: \
6280 case GIMPLE_OMP_MASTER: \
6281 case GIMPLE_OMP_TASKGROUP: \
6282 case GIMPLE_OMP_ORDERED: \
6283 case GIMPLE_OMP_CRITICAL: \
6284 case GIMPLE_OMP_RETURN: \
6285 case GIMPLE_OMP_ATOMIC_LOAD: \
6286 case GIMPLE_OMP_ATOMIC_STORE: \
6287 case GIMPLE_OMP_CONTINUE: \
6288 case GIMPLE_OMP_GRID_BODY
6291 is_gimple_omp (const gimple
*stmt
)
6293 switch (gimple_code (stmt
))
6302 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6306 is_gimple_omp_oacc (const gimple
*stmt
)
6308 gcc_assert (is_gimple_omp (stmt
));
6309 switch (gimple_code (stmt
))
6311 case GIMPLE_OMP_FOR
:
6312 switch (gimple_omp_for_kind (stmt
))
6314 case GF_OMP_FOR_KIND_OACC_LOOP
:
6319 case GIMPLE_OMP_TARGET
:
6320 switch (gimple_omp_target_kind (stmt
))
6322 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6323 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6324 case GF_OMP_TARGET_KIND_OACC_DATA
:
6325 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6326 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
6327 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6328 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6339 /* Return true if the OMP gimple statement STMT is offloaded. */
6342 is_gimple_omp_offloaded (const gimple
*stmt
)
6344 gcc_assert (is_gimple_omp (stmt
));
6345 switch (gimple_code (stmt
))
6347 case GIMPLE_OMP_TARGET
:
6348 switch (gimple_omp_target_kind (stmt
))
6350 case GF_OMP_TARGET_KIND_REGION
:
6351 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6352 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6363 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6366 gimple_nop_p (const gimple
*g
)
6368 return gimple_code (g
) == GIMPLE_NOP
;
6372 /* Return true if GS is a GIMPLE_RESX. */
6375 is_gimple_resx (const gimple
*gs
)
6377 return gimple_code (gs
) == GIMPLE_RESX
;
6380 /* Return the type of the main expression computed by STMT. Return
6381 void_type_node if the statement computes nothing. */
6384 gimple_expr_type (const gimple
*stmt
)
6386 enum gimple_code code
= gimple_code (stmt
);
6387 /* In general we want to pass out a type that can be substituted
6388 for both the RHS and the LHS types if there is a possibly
6389 useless conversion involved. That means returning the
6390 original RHS type as far as we can reconstruct it. */
6391 if (code
== GIMPLE_CALL
)
6393 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6394 if (gimple_call_internal_p (call_stmt
))
6395 switch (gimple_call_internal_fn (call_stmt
))
6397 case IFN_MASK_STORE
:
6398 case IFN_SCATTER_STORE
:
6399 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6400 case IFN_MASK_SCATTER_STORE
:
6401 return TREE_TYPE (gimple_call_arg (call_stmt
, 4));
6405 return gimple_call_return_type (call_stmt
);
6407 else if (code
== GIMPLE_ASSIGN
)
6409 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6410 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6412 /* As fallback use the type of the LHS. */
6413 return TREE_TYPE (gimple_get_lhs (stmt
));
6415 else if (code
== GIMPLE_COND
)
6416 return boolean_type_node
;
6418 return void_type_node
;
6421 /* Enum and arrays used for allocation stats. Keep in sync with
6422 gimple.c:gimple_alloc_kind_names. */
6423 enum gimple_alloc_kind
6425 gimple_alloc_kind_assign
, /* Assignments. */
6426 gimple_alloc_kind_phi
, /* PHI nodes. */
6427 gimple_alloc_kind_cond
, /* Conditionals. */
6428 gimple_alloc_kind_rest
, /* Everything else. */
6429 gimple_alloc_kind_all
6432 extern uint64_t gimple_alloc_counts
[];
6433 extern uint64_t gimple_alloc_sizes
[];
6435 /* Return the allocation kind for a given stmt CODE. */
6436 static inline enum gimple_alloc_kind
6437 gimple_alloc_kind (enum gimple_code code
)
6442 return gimple_alloc_kind_assign
;
6444 return gimple_alloc_kind_phi
;
6446 return gimple_alloc_kind_cond
;
6448 return gimple_alloc_kind_rest
;
6452 /* Return true if a location should not be emitted for this statement
6453 by annotate_all_with_location. */
6456 gimple_do_not_emit_location_p (gimple
*g
)
6458 return gimple_plf (g
, GF_PLF_1
);
6461 /* Mark statement G so a location will not be emitted by
6462 annotate_one_with_location. */
6465 gimple_set_do_not_emit_location (gimple
*g
)
6467 /* The PLF flags are initialized to 0 when a new tuple is created,
6468 so no need to initialize it anywhere. */
6469 gimple_set_plf (g
, GF_PLF_1
, true);
6473 /* Macros for showing usage statistics. */
6474 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6476 : ((x) < 1024*1024*10 \
6478 : (x) / (1024*1024))))
6480 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6482 #endif /* GCC_GIMPLE_H */