1 /* Gimple IR definitions.
3 Copyright (C) 2007-2021 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple
*gimple_seq_node
;
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name
[];
38 extern const unsigned char gimple_rhs_class_table
[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T
> struct remove_pointer
{ typedef T type
; };
42 template<typename T
> struct remove_pointer
<T
*> { typedef T type
; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple
*, const char *, int, \
48 const char *, enum gimple_code
, \
49 enum tree_code
) ATTRIBUTE_NORETURN \
52 #define GIMPLE_CHECK(GS, CODE) \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
61 GIMPLE_CHECK2(const gimple
*gs
,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file
= __builtin_FILE (),
64 int line
= __builtin_LINE (),
65 const char *fun
= __builtin_FUNCTION ())
67 const char *file
= __FILE__
,
69 const char *fun
= NULL
)
72 T ret
= dyn_cast
<T
> (gs
);
74 gimple_check_failed (gs
, file
, line
, fun
,
75 remove_pointer
<T
>::type::code_
, ERROR_MARK
);
80 GIMPLE_CHECK2(gimple
*gs
,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file
= __builtin_FILE (),
83 int line
= __builtin_LINE (),
84 const char *fun
= __builtin_FUNCTION ())
86 const char *file
= __FILE__
,
88 const char *fun
= NULL
)
91 T ret
= dyn_cast
<T
> (gs
);
93 gimple_check_failed (gs
, file
, line
, fun
,
94 remove_pointer
<T
>::type::code_
, ERROR_MARK
);
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T
>
102 GIMPLE_CHECK2(gimple
*gs
)
104 return as_a
<T
> (gs
);
106 template <typename T
>
108 GIMPLE_CHECK2(const gimple
*gs
)
110 return as_a
<T
> (gs
);
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
138 GF_ASM_INPUT
= 1 << 0,
139 GF_ASM_VOLATILE
= 1 << 1,
140 GF_ASM_INLINE
= 1 << 2,
141 GF_CALL_FROM_THUNK
= 1 << 0,
142 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
143 GF_CALL_TAILCALL
= 1 << 2,
144 GF_CALL_VA_ARG_PACK
= 1 << 3,
145 GF_CALL_NOTHROW
= 1 << 4,
146 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
147 GF_CALL_INTERNAL
= 1 << 6,
148 GF_CALL_CTRL_ALTERING
= 1 << 7,
149 GF_CALL_MUST_TAIL_CALL
= 1 << 9,
150 GF_CALL_BY_DESCRIPTOR
= 1 << 10,
151 GF_CALL_NOCF_CHECK
= 1 << 11,
152 GF_CALL_FROM_NEW_OR_DELETE
= 1 << 12,
153 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
154 GF_OMP_TASK_TASKLOOP
= 1 << 0,
155 GF_OMP_TASK_TASKWAIT
= 1 << 1,
156 GF_OMP_FOR_KIND_MASK
= (1 << 3) - 1,
157 GF_OMP_FOR_KIND_FOR
= 0,
158 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
159 GF_OMP_FOR_KIND_TASKLOOP
= 2,
160 GF_OMP_FOR_KIND_OACC_LOOP
= 4,
161 GF_OMP_FOR_KIND_SIMD
= 5,
162 GF_OMP_FOR_COMBINED
= 1 << 3,
163 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
164 GF_OMP_TARGET_KIND_MASK
= (1 << 5) - 1,
165 GF_OMP_TARGET_KIND_REGION
= 0,
166 GF_OMP_TARGET_KIND_DATA
= 1,
167 GF_OMP_TARGET_KIND_UPDATE
= 2,
168 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
169 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
170 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
171 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
172 GF_OMP_TARGET_KIND_OACC_SERIAL
= 7,
173 GF_OMP_TARGET_KIND_OACC_DATA
= 8,
174 GF_OMP_TARGET_KIND_OACC_UPDATE
= 9,
175 GF_OMP_TARGET_KIND_OACC_ENTER_DATA
= 10,
176 GF_OMP_TARGET_KIND_OACC_EXIT_DATA
= 11,
177 GF_OMP_TARGET_KIND_OACC_DECLARE
= 12,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA
= 13,
179 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
180 decomposed part, parallelized. */
181 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
= 14,
182 /* A 'GF_OMP_TARGET_KIND_OACC_PARALLEL' representing an OpenACC 'kernels'
183 decomposed part, "gang-single". */
184 GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
= 15,
185 /* A 'GF_OMP_TARGET_KIND_OACC_DATA' representing an OpenACC 'kernels'
186 decomposed parts' 'data' construct. */
187 GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
= 16,
188 GF_OMP_TEAMS_HOST
= 1 << 0,
190 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
191 a thread synchronization via some sort of barrier. The exact barrier
192 that would otherwise be emitted is dependent on the OMP statement with
193 which this return is associated. */
194 GF_OMP_RETURN_NOWAIT
= 1 << 0,
196 GF_OMP_SECTION_LAST
= 1 << 0,
197 GF_OMP_ATOMIC_MEMORY_ORDER
= (1 << 3) - 1,
198 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 3,
199 GF_PREDICT_TAKEN
= 1 << 15
202 /* This subcode tells apart different kinds of stmts that are not used
203 for codegen, but rather to retain debug information. */
204 enum gimple_debug_subcode
{
205 GIMPLE_DEBUG_BIND
= 0,
206 GIMPLE_DEBUG_SOURCE_BIND
= 1,
207 GIMPLE_DEBUG_BEGIN_STMT
= 2,
208 GIMPLE_DEBUG_INLINE_ENTRY
= 3
211 /* Masks for selecting a pass local flag (PLF) to work on. These
212 masks are used by gimple_set_plf and gimple_plf. */
218 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
219 are for 64 bit hosts. */
221 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
222 chain_next ("%h.next"), variable_size
))
226 Main identifying code for a tuple. */
227 ENUM_BITFIELD(gimple_code
) code
: 8;
229 /* Nonzero if a warning should not be emitted on this tuple. */
230 unsigned int no_warning
: 1;
232 /* Nonzero if this tuple has been visited. Passes are responsible
233 for clearing this bit before using it. */
234 unsigned int visited
: 1;
236 /* Nonzero if this tuple represents a non-temporal move. */
237 unsigned int nontemporal_move
: 1;
239 /* Pass local flags. These flags are free for any pass to use as
240 they see fit. Passes should not assume that these flags contain
241 any useful value when the pass starts. Any initial state that
242 the pass requires should be set on entry to the pass. See
243 gimple_set_plf and gimple_plf for usage. */
244 unsigned int plf
: 2;
246 /* Nonzero if this statement has been modified and needs to have its
247 operands rescanned. */
248 unsigned modified
: 1;
250 /* Nonzero if this statement contains volatile operands. */
251 unsigned has_volatile_ops
: 1;
253 /* Padding to get subcode to 16 bit alignment. */
256 /* The SUBCODE field can be used for tuple-specific flags for tuples
257 that do not require subcodes. Note that SUBCODE should be at
258 least as wide as tree codes, as several tuples store tree codes
260 unsigned int subcode
: 16;
262 /* UID of this statement. This is used by passes that want to
263 assign IDs to statements. It must be assigned and used by each
264 pass. By default it should be assumed to contain garbage. */
268 Locus information for debug info. */
271 /* Number of operands in this tuple. */
275 Basic block holding this statement. */
279 Linked lists of gimple statements. The next pointers form
280 a NULL terminated list, the prev pointers are a cyclic list.
281 A gimple statement is hence also a double-ended list of
282 statements, with the pointer itself being the first element,
283 and the prev pointer being the last. */
285 gimple
*GTY((skip
)) prev
;
289 /* Base structure for tuples with operands. */
291 /* This gimple subclass has no tag value. */
293 gimple_statement_with_ops_base
: public gimple
295 /* [ WORD 1-6 ] : base class */
298 SSA operand vectors. NOTE: It should be possible to
299 amalgamate these vectors with the operand vector OP. However,
300 the SSA operand vectors are organized differently and contain
301 more information (like immediate use chaining). */
302 struct use_optype_d
GTY((skip (""))) *use_ops
;
306 /* Statements that take register operands. */
308 struct GTY((tag("GSS_WITH_OPS")))
309 gimple_statement_with_ops
: public gimple_statement_with_ops_base
311 /* [ WORD 1-7 ] : base class */
314 Operand vector. NOTE! This must always be the last field
315 of this structure. In particular, this means that this
316 structure cannot be embedded inside another one. */
317 tree
GTY((length ("%h.num_ops"))) op
[1];
321 /* Base for statements that take both memory and register operands. */
323 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
324 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
326 /* [ WORD 1-7 ] : base class */
329 Virtual operands for this statement. The GC will pick them
330 up via the ssa_names array. */
331 tree
GTY((skip (""))) vdef
;
332 tree
GTY((skip (""))) vuse
;
336 /* Statements that take both memory and register operands. */
338 struct GTY((tag("GSS_WITH_MEM_OPS")))
339 gimple_statement_with_memory_ops
:
340 public gimple_statement_with_memory_ops_base
342 /* [ WORD 1-9 ] : base class */
345 Operand vector. NOTE! This must always be the last field
346 of this structure. In particular, this means that this
347 structure cannot be embedded inside another one. */
348 tree
GTY((length ("%h.num_ops"))) op
[1];
352 /* Call statements that take both memory and register operands. */
354 struct GTY((tag("GSS_CALL")))
355 gcall
: public gimple_statement_with_memory_ops_base
357 /* [ WORD 1-9 ] : base class */
360 struct pt_solution call_used
;
361 struct pt_solution call_clobbered
;
364 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
365 tree
GTY ((tag ("0"))) fntype
;
366 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
370 Operand vector. NOTE! This must always be the last field
371 of this structure. In particular, this means that this
372 structure cannot be embedded inside another one. */
373 tree
GTY((length ("%h.num_ops"))) op
[1];
375 static const enum gimple_code code_
= GIMPLE_CALL
;
379 /* OMP statements. */
381 struct GTY((tag("GSS_OMP")))
382 gimple_statement_omp
: public gimple
384 /* [ WORD 1-6 ] : base class */
393 struct GTY((tag("GSS_BIND")))
394 gbind
: public gimple
396 /* [ WORD 1-6 ] : base class */
399 Variables declared in this scope. */
403 This is different than the BLOCK field in gimple,
404 which is analogous to TREE_BLOCK (i.e., the lexical block holding
405 this statement). This field is the equivalent of BIND_EXPR_BLOCK
406 in tree land (i.e., the lexical scope defined by this bind). See
417 struct GTY((tag("GSS_CATCH")))
418 gcatch
: public gimple
420 /* [ WORD 1-6 ] : base class */
430 /* GIMPLE_EH_FILTER */
432 struct GTY((tag("GSS_EH_FILTER")))
433 geh_filter
: public gimple
435 /* [ WORD 1-6 ] : base class */
448 struct GTY((tag("GSS_EH_ELSE")))
449 geh_else
: public gimple
451 /* [ WORD 1-6 ] : base class */
454 gimple_seq n_body
, e_body
;
457 /* GIMPLE_EH_MUST_NOT_THROW */
459 struct GTY((tag("GSS_EH_MNT")))
460 geh_mnt
: public gimple
462 /* [ WORD 1-6 ] : base class */
464 /* [ WORD 7 ] Abort function decl. */
470 struct GTY((tag("GSS_PHI")))
473 /* [ WORD 1-6 ] : base class */
483 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
487 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
489 struct GTY((tag("GSS_EH_CTRL")))
490 gimple_statement_eh_ctrl
: public gimple
492 /* [ WORD 1-6 ] : base class */
495 Exception region number. */
499 struct GTY((tag("GSS_EH_CTRL")))
500 gresx
: public gimple_statement_eh_ctrl
502 /* No extra fields; adds invariant:
503 stmt->code == GIMPLE_RESX. */
506 struct GTY((tag("GSS_EH_CTRL")))
507 geh_dispatch
: public gimple_statement_eh_ctrl
509 /* No extra fields; adds invariant:
510 stmt->code == GIMPLE_EH_DISPATH. */
516 struct GTY((tag("GSS_TRY")))
519 /* [ WORD 1-6 ] : base class */
522 Expression to evaluate. */
526 Cleanup expression. */
530 /* Kind of GIMPLE_TRY statements. */
531 enum gimple_try_flags
534 GIMPLE_TRY_CATCH
= 1 << 0,
537 GIMPLE_TRY_FINALLY
= 1 << 1,
538 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
540 /* Analogous to TRY_CATCH_IS_CLEANUP. */
541 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
544 /* GIMPLE_WITH_CLEANUP_EXPR */
546 struct GTY((tag("GSS_WCE")))
547 gimple_statement_wce
: public gimple
549 /* [ WORD 1-6 ] : base class */
551 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
552 executed if an exception is thrown, not on normal exit of its
553 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
557 Cleanup expression. */
564 struct GTY((tag("GSS_ASM")))
565 gasm
: public gimple_statement_with_memory_ops_base
567 /* [ WORD 1-9 ] : base class */
570 __asm__ statement. */
574 Number of inputs, outputs, clobbers, labels. */
581 Operand vector. NOTE! This must always be the last field
582 of this structure. In particular, this means that this
583 structure cannot be embedded inside another one. */
584 tree
GTY((length ("%h.num_ops"))) op
[1];
587 /* GIMPLE_OMP_CRITICAL */
589 struct GTY((tag("GSS_OMP_CRITICAL")))
590 gomp_critical
: public gimple_statement_omp
592 /* [ WORD 1-7 ] : base class */
598 Critical section name. */
603 struct GTY(()) gimple_omp_for_iter
{
604 /* Condition code. */
607 /* Index variable. */
622 struct GTY((tag("GSS_OMP_FOR")))
623 gomp_for
: public gimple_statement_omp
625 /* [ WORD 1-7 ] : base class */
631 Number of elements in iter array. */
635 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
638 Pre-body evaluated before the loop body begins. */
643 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK, GIMPLE_OMP_TEAMS */
645 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
646 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
648 /* [ WORD 1-7 ] : base class */
655 Child function holding the body of the parallel region. */
659 Shared data argument. */
663 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL
669 || stmt->code == GIMPLE_OMP_TASK
670 || stmt->code == GIMPLE_OMP_TEAMS. */
673 /* GIMPLE_OMP_PARALLEL */
674 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
675 gomp_parallel
: public gimple_statement_omp_taskreg
677 /* No extra fields; adds invariant:
678 stmt->code == GIMPLE_OMP_PARALLEL. */
681 /* GIMPLE_OMP_TARGET */
682 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
683 gomp_target
: public gimple_statement_omp_parallel_layout
685 /* No extra fields; adds invariant:
686 stmt->code == GIMPLE_OMP_TARGET. */
689 /* GIMPLE_OMP_TASK */
691 struct GTY((tag("GSS_OMP_TASK")))
692 gomp_task
: public gimple_statement_omp_taskreg
694 /* [ WORD 1-10 ] : base class */
697 Child function holding firstprivate initialization if needed. */
701 Size and alignment in bytes of the argument data block. */
707 /* GIMPLE_OMP_SECTION */
708 /* Uses struct gimple_statement_omp. */
711 /* GIMPLE_OMP_SECTIONS */
713 struct GTY((tag("GSS_OMP_SECTIONS")))
714 gomp_sections
: public gimple_statement_omp
716 /* [ WORD 1-7 ] : base class */
722 The control variable used for deciding which of the sections to
727 /* GIMPLE_OMP_CONTINUE.
729 Note: This does not inherit from gimple_statement_omp, because we
730 do not need the body field. */
732 struct GTY((tag("GSS_OMP_CONTINUE")))
733 gomp_continue
: public gimple
735 /* [ WORD 1-6 ] : base class */
744 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_ORDERED, GIMPLE_OMP_TASKGROUP,
747 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
748 gimple_statement_omp_single_layout
: public gimple_statement_omp
750 /* [ WORD 1-7 ] : base class */
756 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
757 gomp_single
: public gimple_statement_omp_single_layout
759 /* No extra fields; adds invariant:
760 stmt->code == GIMPLE_OMP_SINGLE. */
763 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
764 gomp_teams
: public gimple_statement_omp_taskreg
766 /* No extra fields; adds invariant:
767 stmt->code == GIMPLE_OMP_TEAMS. */
770 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
771 gomp_ordered
: public gimple_statement_omp_single_layout
773 /* No extra fields; adds invariant:
774 stmt->code == GIMPLE_OMP_ORDERED. */
777 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
778 gomp_scan
: public gimple_statement_omp_single_layout
780 /* No extra fields; adds invariant:
781 stmt->code == GIMPLE_OMP_SCAN. */
785 /* GIMPLE_OMP_ATOMIC_LOAD.
786 Note: This is based on gimple, not g_s_omp, because g_s_omp
787 contains a sequence, which we don't need here. */
789 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
790 gomp_atomic_load
: public gimple
792 /* [ WORD 1-6 ] : base class */
798 /* GIMPLE_OMP_ATOMIC_STORE.
799 See note on GIMPLE_OMP_ATOMIC_LOAD. */
801 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
802 gimple_statement_omp_atomic_store_layout
: public gimple
804 /* [ WORD 1-6 ] : base class */
810 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
812 public gimple_statement_omp_atomic_store_layout
814 /* No extra fields; adds invariant:
815 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
818 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
819 gimple_statement_omp_return
:
820 public gimple_statement_omp_atomic_store_layout
822 /* No extra fields; adds invariant:
823 stmt->code == GIMPLE_OMP_RETURN. */
826 /* GIMPLE_TRANSACTION. */
828 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
830 /* The __transaction_atomic was declared [[outer]] or it is
831 __transaction_relaxed. */
832 #define GTMA_IS_OUTER (1u << 0)
833 #define GTMA_IS_RELAXED (1u << 1)
834 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
836 /* The transaction is seen to not have an abort. */
837 #define GTMA_HAVE_ABORT (1u << 2)
838 /* The transaction is seen to have loads or stores. */
839 #define GTMA_HAVE_LOAD (1u << 3)
840 #define GTMA_HAVE_STORE (1u << 4)
841 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
842 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
843 /* The transaction WILL enter serial irrevocable mode.
844 An irrevocable block post-dominates the entire transaction, such
845 that all invocations of the transaction will go serial-irrevocable.
846 In such case, we don't bother instrumenting the transaction, and
847 tell the runtime that it should begin the transaction in
848 serial-irrevocable mode. */
849 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
850 /* The transaction contains no instrumentation code whatsover, most
851 likely because it is guaranteed to go irrevocable upon entry. */
852 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
854 struct GTY((tag("GSS_TRANSACTION")))
855 gtransaction
: public gimple_statement_with_memory_ops_base
857 /* [ WORD 1-9 ] : base class */
868 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
869 enum gimple_statement_structure_enum
{
870 #include "gsstruct.def"
875 /* A statement with the invariant that
876 stmt->code == GIMPLE_COND
877 i.e. a conditional jump statement. */
879 struct GTY((tag("GSS_WITH_OPS")))
880 gcond
: public gimple_statement_with_ops
882 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
883 static const enum gimple_code code_
= GIMPLE_COND
;
886 /* A statement with the invariant that
887 stmt->code == GIMPLE_DEBUG
888 i.e. a debug statement. */
890 struct GTY((tag("GSS_WITH_OPS")))
891 gdebug
: 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_GOTO
898 i.e. a goto statement. */
900 struct GTY((tag("GSS_WITH_OPS")))
901 ggoto
: 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_LABEL
908 i.e. a label statement. */
910 struct GTY((tag("GSS_WITH_OPS")))
911 glabel
: 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_SWITCH
918 i.e. a switch statement. */
920 struct GTY((tag("GSS_WITH_OPS")))
921 gswitch
: public gimple_statement_with_ops
923 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
926 /* A statement with the invariant that
927 stmt->code == GIMPLE_ASSIGN
928 i.e. an assignment statement. */
930 struct GTY((tag("GSS_WITH_MEM_OPS")))
931 gassign
: public gimple_statement_with_memory_ops
933 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
934 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
937 /* A statement with the invariant that
938 stmt->code == GIMPLE_RETURN
939 i.e. a return statement. */
941 struct GTY((tag("GSS_WITH_MEM_OPS")))
942 greturn
: public gimple_statement_with_memory_ops
944 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
950 is_a_helper
<gasm
*>::test (gimple
*gs
)
952 return gs
->code
== GIMPLE_ASM
;
958 is_a_helper
<gassign
*>::test (gimple
*gs
)
960 return gs
->code
== GIMPLE_ASSIGN
;
966 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
968 return gs
->code
== GIMPLE_ASSIGN
;
974 is_a_helper
<gbind
*>::test (gimple
*gs
)
976 return gs
->code
== GIMPLE_BIND
;
982 is_a_helper
<gcall
*>::test (gimple
*gs
)
984 return gs
->code
== GIMPLE_CALL
;
990 is_a_helper
<gcatch
*>::test (gimple
*gs
)
992 return gs
->code
== GIMPLE_CATCH
;
998 is_a_helper
<gcond
*>::test (gimple
*gs
)
1000 return gs
->code
== GIMPLE_COND
;
1006 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
1008 return gs
->code
== GIMPLE_COND
;
1014 is_a_helper
<gdebug
*>::test (gimple
*gs
)
1016 return gs
->code
== GIMPLE_DEBUG
;
1022 is_a_helper
<const gdebug
*>::test (const gimple
*gs
)
1024 return gs
->code
== GIMPLE_DEBUG
;
1030 is_a_helper
<ggoto
*>::test (gimple
*gs
)
1032 return gs
->code
== GIMPLE_GOTO
;
1038 is_a_helper
<const ggoto
*>::test (const gimple
*gs
)
1040 return gs
->code
== GIMPLE_GOTO
;
1046 is_a_helper
<glabel
*>::test (gimple
*gs
)
1048 return gs
->code
== GIMPLE_LABEL
;
1054 is_a_helper
<const glabel
*>::test (const gimple
*gs
)
1056 return gs
->code
== GIMPLE_LABEL
;
1062 is_a_helper
<gresx
*>::test (gimple
*gs
)
1064 return gs
->code
== GIMPLE_RESX
;
1070 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1072 return gs
->code
== GIMPLE_EH_DISPATCH
;
1078 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1080 return gs
->code
== GIMPLE_EH_ELSE
;
1086 is_a_helper
<const geh_else
*>::test (const gimple
*gs
)
1088 return gs
->code
== GIMPLE_EH_ELSE
;
1094 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1096 return gs
->code
== GIMPLE_EH_FILTER
;
1102 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1104 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1110 is_a_helper
<const geh_mnt
*>::test (const gimple
*gs
)
1112 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1118 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1120 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1126 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1128 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1134 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1136 return gs
->code
== GIMPLE_OMP_RETURN
;
1142 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1144 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1150 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1152 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1158 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1160 return gs
->code
== GIMPLE_OMP_ORDERED
;
1166 is_a_helper
<gomp_scan
*>::test (gimple
*gs
)
1168 return gs
->code
== GIMPLE_OMP_SCAN
;
1174 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1176 return gs
->code
== GIMPLE_OMP_FOR
;
1182 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1184 return (gs
->code
== GIMPLE_OMP_PARALLEL
1185 || gs
->code
== GIMPLE_OMP_TASK
1186 || gs
->code
== GIMPLE_OMP_TEAMS
);
1192 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1194 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1200 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1202 return gs
->code
== GIMPLE_OMP_TARGET
;
1208 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1210 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1216 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1218 return gs
->code
== GIMPLE_OMP_SINGLE
;
1224 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1226 return gs
->code
== GIMPLE_OMP_TEAMS
;
1232 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1234 return gs
->code
== GIMPLE_OMP_TASK
;
1240 is_a_helper
<gphi
*>::test (gimple
*gs
)
1242 return gs
->code
== GIMPLE_PHI
;
1248 is_a_helper
<greturn
*>::test (gimple
*gs
)
1250 return gs
->code
== GIMPLE_RETURN
;
1256 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1258 return gs
->code
== GIMPLE_SWITCH
;
1264 is_a_helper
<const gswitch
*>::test (const gimple
*gs
)
1266 return gs
->code
== GIMPLE_SWITCH
;
1272 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1274 return gs
->code
== GIMPLE_TRANSACTION
;
1280 is_a_helper
<gtry
*>::test (gimple
*gs
)
1282 return gs
->code
== GIMPLE_TRY
;
1288 is_a_helper
<const gtry
*>::test (const gimple
*gs
)
1290 return gs
->code
== GIMPLE_TRY
;
1296 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1298 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1304 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1306 return gs
->code
== GIMPLE_ASM
;
1312 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1314 return gs
->code
== GIMPLE_BIND
;
1320 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1322 return gs
->code
== GIMPLE_CALL
;
1328 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1330 return gs
->code
== GIMPLE_CATCH
;
1336 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1338 return gs
->code
== GIMPLE_RESX
;
1344 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1346 return gs
->code
== GIMPLE_EH_DISPATCH
;
1352 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1354 return gs
->code
== GIMPLE_EH_FILTER
;
1360 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1362 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1368 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1370 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1376 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1378 return gs
->code
== GIMPLE_OMP_RETURN
;
1384 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1386 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1392 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1394 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1400 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1402 return gs
->code
== GIMPLE_OMP_ORDERED
;
1408 is_a_helper
<const gomp_scan
*>::test (const gimple
*gs
)
1410 return gs
->code
== GIMPLE_OMP_SCAN
;
1416 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1418 return gs
->code
== GIMPLE_OMP_FOR
;
1424 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1426 return (gs
->code
== GIMPLE_OMP_PARALLEL
1427 || gs
->code
== GIMPLE_OMP_TASK
1428 || gs
->code
== GIMPLE_OMP_TEAMS
);
1434 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1436 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1442 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1444 return gs
->code
== GIMPLE_OMP_TARGET
;
1450 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1452 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1458 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1460 return gs
->code
== GIMPLE_OMP_SINGLE
;
1466 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1468 return gs
->code
== GIMPLE_OMP_TEAMS
;
1474 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1476 return gs
->code
== GIMPLE_OMP_TASK
;
1482 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1484 return gs
->code
== GIMPLE_PHI
;
1490 is_a_helper
<const greturn
*>::test (const gimple
*gs
)
1492 return gs
->code
== GIMPLE_RETURN
;
1498 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1500 return gs
->code
== GIMPLE_TRANSACTION
;
1503 /* Offset in bytes to the location of the operand vector.
1504 Zero if there is no operand vector for this tuple structure. */
1505 extern size_t const gimple_ops_offset_
[];
1507 /* Map GIMPLE codes to GSS codes. */
1508 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1510 /* This variable holds the currently expanded gimple statement for purposes
1511 of comminucating the profile info to the builtin expanders. */
1512 extern gimple
*currently_expanding_gimple_stmt
;
1514 size_t gimple_size (enum gimple_code code
, unsigned num_ops
= 0);
1515 void gimple_init (gimple
*g
, enum gimple_code code
, unsigned num_ops
);
1516 gimple
*gimple_alloc (enum gimple_code
, unsigned CXX_MEM_STAT_INFO
);
1517 greturn
*gimple_build_return (tree
);
1518 void gimple_call_reset_alias_info (gcall
*);
1519 gcall
*gimple_build_call_vec (tree
, vec
<tree
> );
1520 gcall
*gimple_build_call (tree
, unsigned, ...);
1521 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1522 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1523 gcall
*gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1524 gcall
*gimple_build_call_from_tree (tree
, tree
);
1525 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1526 gassign
*gimple_build_assign (tree
, enum tree_code
,
1527 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1528 gassign
*gimple_build_assign (tree
, enum tree_code
,
1529 tree
, tree CXX_MEM_STAT_INFO
);
1530 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1531 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1532 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1533 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1534 glabel
*gimple_build_label (tree label
);
1535 ggoto
*gimple_build_goto (tree dest
);
1536 gimple
*gimple_build_nop (void);
1537 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1538 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1539 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1540 vec
<tree
, va_gc
> *);
1541 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1542 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1543 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1544 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1545 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1546 enum gimple_try_flags
);
1547 gimple
*gimple_build_wce (gimple_seq
);
1548 gresx
*gimple_build_resx (int);
1549 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1550 gswitch
*gimple_build_switch (tree
, tree
, vec
<tree
> );
1551 geh_dispatch
*gimple_build_eh_dispatch (int);
1552 gdebug
*gimple_build_debug_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1553 gdebug
*gimple_build_debug_source_bind (tree
, tree
, gimple
* CXX_MEM_STAT_INFO
);
1554 gdebug
*gimple_build_debug_begin_stmt (tree
, location_t CXX_MEM_STAT_INFO
);
1555 gdebug
*gimple_build_debug_inline_entry (tree
, location_t CXX_MEM_STAT_INFO
);
1556 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1557 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1558 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1559 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1561 gimple
*gimple_build_omp_section (gimple_seq
);
1562 gimple
*gimple_build_omp_master (gimple_seq
);
1563 gimple
*gimple_build_omp_taskgroup (gimple_seq
, tree
);
1564 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1565 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1566 gimple
*gimple_build_omp_return (bool);
1567 gomp_scan
*gimple_build_omp_scan (gimple_seq
, tree
);
1568 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1569 gimple
*gimple_build_omp_sections_switch (void);
1570 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1571 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1572 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1573 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
,
1574 enum omp_memory_order
);
1575 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
, enum omp_memory_order
);
1576 gtransaction
*gimple_build_transaction (gimple_seq
);
1577 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1578 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1579 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1580 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1581 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1583 extern void annotate_all_with_location (gimple_seq
, location_t
);
1584 bool empty_body_p (gimple_seq
);
1585 gimple_seq
gimple_seq_copy (gimple_seq
);
1586 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1587 int gimple_call_flags (const gimple
*);
1588 int gimple_call_arg_flags (const gcall
*, unsigned);
1589 int gimple_call_return_flags (const gcall
*);
1590 bool gimple_call_nonnull_result_p (gcall
*);
1591 tree
gimple_call_nonnull_arg (gcall
*);
1592 bool gimple_assign_copy_p (gimple
*);
1593 bool gimple_assign_ssa_name_copy_p (gimple
*);
1594 bool gimple_assign_unary_nop_p (gimple
*);
1595 void gimple_set_bb (gimple
*, basic_block
);
1596 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1597 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1599 tree
gimple_get_lhs (const gimple
*);
1600 void gimple_set_lhs (gimple
*, tree
);
1601 gimple
*gimple_copy (gimple
*);
1602 void gimple_move_vops (gimple
*, gimple
*);
1603 bool gimple_has_side_effects (const gimple
*);
1604 bool gimple_could_trap_p_1 (gimple
*, bool, bool);
1605 bool gimple_could_trap_p (gimple
*);
1606 bool gimple_assign_rhs_could_trap_p (gimple
*);
1607 extern void dump_gimple_statistics (void);
1608 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1609 extern tree
canonicalize_cond_expr_cond (tree
);
1610 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1611 extern bool gimple_compare_field_offset (tree
, tree
);
1612 extern tree
gimple_unsigned_type (tree
);
1613 extern tree
gimple_signed_type (tree
);
1614 extern alias_set_type
gimple_get_alias_set (tree
);
1615 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1616 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1617 extern combined_fn
gimple_call_combined_fn (const gimple
*);
1618 extern bool gimple_call_operator_delete_p (const gcall
*);
1619 extern bool gimple_call_builtin_p (const gimple
*);
1620 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1621 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1622 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1623 extern void dump_decl_set (FILE *, bitmap
);
1624 extern bool nonfreeing_call_p (gimple
*);
1625 extern bool nonbarrier_call_p (gimple
*);
1626 extern bool infer_nonnull_range (gimple
*, tree
);
1627 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1628 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1629 extern void sort_case_labels (vec
<tree
>);
1630 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1631 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1632 extern void gimple_seq_discard (gimple_seq
);
1633 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1634 extern bool gimple_inexpensive_call_p (gcall
*);
1635 extern bool stmt_can_terminate_bb_p (gimple
*);
1636 extern location_t
gimple_or_expr_nonartificial_location (gimple
*, tree
);
1639 /* Formal (expression) temporary table handling: multiple occurrences of
1640 the same scalar expression are evaluated into the same temporary. */
1642 typedef struct gimple_temp_hash_elt
1645 tree temp
; /* Value */
1648 /* Get the number of the next statement uid to be allocated. */
1649 static inline unsigned int
1650 gimple_stmt_max_uid (struct function
*fn
)
1652 return fn
->last_stmt_uid
;
1655 /* Set the number of the next statement uid to be allocated. */
1657 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1659 fn
->last_stmt_uid
= maxid
;
1662 /* Set the number of the next statement uid to be allocated. */
1663 static inline unsigned int
1664 inc_gimple_stmt_max_uid (struct function
*fn
)
1666 return fn
->last_stmt_uid
++;
1669 /* Return the first node in GIMPLE sequence S. */
1671 static inline gimple_seq_node
1672 gimple_seq_first (gimple_seq s
)
1678 /* Return the first statement in GIMPLE sequence S. */
1680 static inline gimple
*
1681 gimple_seq_first_stmt (gimple_seq s
)
1683 gimple_seq_node n
= gimple_seq_first (s
);
1687 /* Return the first statement in GIMPLE sequence S as a gbind *,
1688 verifying that it has code GIMPLE_BIND in a checked build. */
1690 static inline gbind
*
1691 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1693 gimple_seq_node n
= gimple_seq_first (s
);
1694 return as_a
<gbind
*> (n
);
1698 /* Return the last node in GIMPLE sequence S. */
1700 static inline gimple_seq_node
1701 gimple_seq_last (gimple_seq s
)
1703 return s
? s
->prev
: NULL
;
1707 /* Return the last statement in GIMPLE sequence S. */
1709 static inline gimple
*
1710 gimple_seq_last_stmt (gimple_seq s
)
1712 gimple_seq_node n
= gimple_seq_last (s
);
1717 /* Set the last node in GIMPLE sequence *PS to LAST. */
1720 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1726 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1729 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1735 /* Return true if GIMPLE sequence S is empty. */
1738 gimple_seq_empty_p (gimple_seq s
)
1743 /* Allocate a new sequence and initialize its first element with STMT. */
1745 static inline gimple_seq
1746 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1748 gimple_seq seq
= NULL
;
1749 gimple_seq_add_stmt (&seq
, stmt
);
1754 /* Returns the sequence of statements in BB. */
1756 static inline gimple_seq
1757 bb_seq (const_basic_block bb
)
1759 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1762 static inline gimple_seq
*
1763 bb_seq_addr (basic_block bb
)
1765 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1768 /* Sets the sequence of statements in BB to SEQ. */
1771 set_bb_seq (basic_block bb
, gimple_seq seq
)
1773 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1774 bb
->il
.gimple
.seq
= seq
;
1778 /* Return the code for GIMPLE statement G. */
1780 static inline enum gimple_code
1781 gimple_code (const gimple
*g
)
1787 /* Return the GSS code used by a GIMPLE code. */
1789 static inline enum gimple_statement_structure_enum
1790 gss_for_code (enum gimple_code code
)
1792 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1793 return gss_for_code_
[code
];
1797 /* Return which GSS code is used by GS. */
1799 static inline enum gimple_statement_structure_enum
1800 gimple_statement_structure (gimple
*gs
)
1802 return gss_for_code (gimple_code (gs
));
1806 /* Return true if statement G has sub-statements. This is only true for
1807 High GIMPLE statements. */
1810 gimple_has_substatements (gimple
*g
)
1812 switch (gimple_code (g
))
1816 case GIMPLE_EH_FILTER
:
1817 case GIMPLE_EH_ELSE
:
1819 case GIMPLE_OMP_FOR
:
1820 case GIMPLE_OMP_MASTER
:
1821 case GIMPLE_OMP_TASKGROUP
:
1822 case GIMPLE_OMP_ORDERED
:
1823 case GIMPLE_OMP_SECTION
:
1824 case GIMPLE_OMP_PARALLEL
:
1825 case GIMPLE_OMP_TASK
:
1826 case GIMPLE_OMP_SECTIONS
:
1827 case GIMPLE_OMP_SINGLE
:
1828 case GIMPLE_OMP_TARGET
:
1829 case GIMPLE_OMP_TEAMS
:
1830 case GIMPLE_OMP_CRITICAL
:
1831 case GIMPLE_WITH_CLEANUP_EXPR
:
1832 case GIMPLE_TRANSACTION
:
1841 /* Return the basic block holding statement G. */
1843 static inline basic_block
1844 gimple_bb (const gimple
*g
)
1850 /* Return the lexical scope block holding statement G. */
1853 gimple_block (const gimple
*g
)
1855 return LOCATION_BLOCK (g
->location
);
1859 /* Set BLOCK to be the lexical scope block holding statement G. */
1862 gimple_set_block (gimple
*g
, tree block
)
1864 g
->location
= set_block (g
->location
, block
);
1868 /* Return location information for statement G. */
1870 static inline location_t
1871 gimple_location (const gimple
*g
)
1876 /* Return location information for statement G if g is not NULL.
1877 Otherwise, UNKNOWN_LOCATION is returned. */
1879 static inline location_t
1880 gimple_location_safe (const gimple
*g
)
1882 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1885 /* Set location information for statement G. */
1888 gimple_set_location (gimple
*g
, location_t location
)
1890 g
->location
= location
;
1893 /* Return address of the location information for statement G. */
1895 static inline location_t
*
1896 gimple_location_ptr (gimple
*g
)
1898 return &g
->location
;
1902 /* Return true if G contains location information. */
1905 gimple_has_location (const gimple
*g
)
1907 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1911 /* Return non-artificial location information for statement G. */
1913 static inline location_t
1914 gimple_nonartificial_location (const gimple
*g
)
1916 location_t
*ploc
= NULL
;
1918 if (tree block
= gimple_block (g
))
1919 ploc
= block_nonartificial_location (block
);
1921 return ploc
? *ploc
: gimple_location (g
);
1925 /* Return the file name of the location of STMT. */
1927 static inline const char *
1928 gimple_filename (const gimple
*stmt
)
1930 return LOCATION_FILE (gimple_location (stmt
));
1934 /* Return the line number of the location of STMT. */
1937 gimple_lineno (const gimple
*stmt
)
1939 return LOCATION_LINE (gimple_location (stmt
));
1943 /* Determine whether SEQ is a singleton. */
1946 gimple_seq_singleton_p (gimple_seq seq
)
1948 return ((gimple_seq_first (seq
) != NULL
)
1949 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1952 /* Return true if no warnings should be emitted for statement STMT. */
1955 gimple_no_warning_p (const gimple
*stmt
)
1957 return stmt
->no_warning
;
1960 /* Set the no_warning flag of STMT to NO_WARNING. */
1963 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1965 stmt
->no_warning
= (unsigned) no_warning
;
1968 /* Set the visited status on statement STMT to VISITED_P.
1970 Please note that this 'visited' property of the gimple statement is
1971 supposed to be undefined at pass boundaries. This means that a
1972 given pass should not assume it contains any useful value when the
1973 pass starts and thus can set it to any value it sees fit.
1975 You can learn more about the visited property of the gimple
1976 statement by reading the comments of the 'visited' data member of
1981 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1983 stmt
->visited
= (unsigned) visited_p
;
1987 /* Return the visited status for statement STMT.
1989 Please note that this 'visited' property of the gimple statement is
1990 supposed to be undefined at pass boundaries. This means that a
1991 given pass should not assume it contains any useful value when the
1992 pass starts and thus can set it to any value it sees fit.
1994 You can learn more about the visited property of the gimple
1995 statement by reading the comments of the 'visited' data member of
1999 gimple_visited_p (gimple
*stmt
)
2001 return stmt
->visited
;
2005 /* Set pass local flag PLF on statement STMT to VAL_P.
2007 Please note that this PLF property of the gimple statement is
2008 supposed to be undefined at pass boundaries. This means that a
2009 given pass should not assume it contains any useful value when the
2010 pass starts and thus can set it to any value it sees fit.
2012 You can learn more about the PLF property by reading the comment of
2013 the 'plf' data member of struct gimple_statement_structure. */
2016 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
2019 stmt
->plf
|= (unsigned int) plf
;
2021 stmt
->plf
&= ~((unsigned int) plf
);
2025 /* Return the value of pass local flag PLF on statement STMT.
2027 Please note that this 'plf' property of the gimple statement is
2028 supposed to be undefined at pass boundaries. This means that a
2029 given pass should not assume it contains any useful value when the
2030 pass starts and thus can set it to any value it sees fit.
2032 You can learn more about the plf property by reading the comment of
2033 the 'plf' data member of struct gimple_statement_structure. */
2035 static inline unsigned int
2036 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
2038 return stmt
->plf
& ((unsigned int) plf
);
2042 /* Set the UID of statement.
2044 Please note that this UID property is supposed to be undefined at
2045 pass boundaries. This means that a given pass should not assume it
2046 contains any useful value when the pass starts and thus can set it
2047 to any value it sees fit. */
2050 gimple_set_uid (gimple
*g
, unsigned uid
)
2056 /* Return the UID of statement.
2058 Please note that this UID property is supposed to be undefined at
2059 pass boundaries. This means that a given pass should not assume it
2060 contains any useful value when the pass starts and thus can set it
2061 to any value it sees fit. */
2063 static inline unsigned
2064 gimple_uid (const gimple
*g
)
2070 /* Make statement G a singleton sequence. */
2073 gimple_init_singleton (gimple
*g
)
2080 /* Return true if GIMPLE statement G has register or memory operands. */
2083 gimple_has_ops (const gimple
*g
)
2085 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
2091 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
2093 return gimple_has_ops (gs
);
2099 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
2101 return gimple_has_ops (gs
);
2104 /* Return true if GIMPLE statement G has memory operands. */
2107 gimple_has_mem_ops (const gimple
*g
)
2109 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
2115 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
2117 return gimple_has_mem_ops (gs
);
2123 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
2125 return gimple_has_mem_ops (gs
);
2128 /* Return the set of USE operands for statement G. */
2130 static inline struct use_optype_d
*
2131 gimple_use_ops (const gimple
*g
)
2133 const gimple_statement_with_ops
*ops_stmt
=
2134 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2137 return ops_stmt
->use_ops
;
2141 /* Set USE to be the set of USE operands for statement G. */
2144 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2146 gimple_statement_with_ops
*ops_stmt
=
2147 as_a
<gimple_statement_with_ops
*> (g
);
2148 ops_stmt
->use_ops
= use
;
2152 /* Return the single VUSE operand of the statement G. */
2155 gimple_vuse (const gimple
*g
)
2157 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2158 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2161 return mem_ops_stmt
->vuse
;
2164 /* Return the single VDEF operand of the statement G. */
2167 gimple_vdef (const gimple
*g
)
2169 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2170 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2173 return mem_ops_stmt
->vdef
;
2176 /* Return the single VUSE operand of the statement G. */
2178 static inline tree
*
2179 gimple_vuse_ptr (gimple
*g
)
2181 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2182 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2185 return &mem_ops_stmt
->vuse
;
2188 /* Return the single VDEF operand of the statement G. */
2190 static inline tree
*
2191 gimple_vdef_ptr (gimple
*g
)
2193 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2194 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2197 return &mem_ops_stmt
->vdef
;
2200 /* Set the single VUSE operand of the statement G. */
2203 gimple_set_vuse (gimple
*g
, tree vuse
)
2205 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2206 as_a
<gimple_statement_with_memory_ops
*> (g
);
2207 mem_ops_stmt
->vuse
= vuse
;
2210 /* Set the single VDEF operand of the statement G. */
2213 gimple_set_vdef (gimple
*g
, tree vdef
)
2215 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2216 as_a
<gimple_statement_with_memory_ops
*> (g
);
2217 mem_ops_stmt
->vdef
= vdef
;
2221 /* Return true if statement G has operands and the modified field has
2225 gimple_modified_p (const gimple
*g
)
2227 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2231 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2232 a MODIFIED field. */
2235 gimple_set_modified (gimple
*s
, bool modifiedp
)
2237 if (gimple_has_ops (s
))
2238 s
->modified
= (unsigned) modifiedp
;
2242 /* Return true if statement STMT contains volatile operands. */
2245 gimple_has_volatile_ops (const gimple
*stmt
)
2247 if (gimple_has_mem_ops (stmt
))
2248 return stmt
->has_volatile_ops
;
2254 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2257 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2259 if (gimple_has_mem_ops (stmt
))
2260 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2263 /* Return true if STMT is in a transaction. */
2266 gimple_in_transaction (const gimple
*stmt
)
2268 return bb_in_transaction (gimple_bb (stmt
));
2271 /* Return true if statement STMT may access memory. */
2274 gimple_references_memory_p (gimple
*stmt
)
2276 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2280 /* Return the subcode for OMP statement S. */
2282 static inline unsigned
2283 gimple_omp_subcode (const gimple
*s
)
2285 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2286 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2290 /* Set the subcode for OMP statement S to SUBCODE. */
2293 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2295 /* We only have 16 bits for the subcode. Assert that we are not
2297 gcc_gimple_checking_assert (subcode
< (1 << 16));
2298 s
->subcode
= subcode
;
2301 /* Set the nowait flag on OMP_RETURN statement S. */
2304 gimple_omp_return_set_nowait (gimple
*s
)
2306 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2307 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2311 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2315 gimple_omp_return_nowait_p (const gimple
*g
)
2317 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2318 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2322 /* Set the LHS of OMP return. */
2325 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2327 gimple_statement_omp_return
*omp_return_stmt
=
2328 as_a
<gimple_statement_omp_return
*> (g
);
2329 omp_return_stmt
->val
= lhs
;
2333 /* Get the LHS of OMP return. */
2336 gimple_omp_return_lhs (const gimple
*g
)
2338 const gimple_statement_omp_return
*omp_return_stmt
=
2339 as_a
<const gimple_statement_omp_return
*> (g
);
2340 return omp_return_stmt
->val
;
2344 /* Return a pointer to the LHS of OMP return. */
2346 static inline tree
*
2347 gimple_omp_return_lhs_ptr (gimple
*g
)
2349 gimple_statement_omp_return
*omp_return_stmt
=
2350 as_a
<gimple_statement_omp_return
*> (g
);
2351 return &omp_return_stmt
->val
;
2355 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2359 gimple_omp_section_last_p (const gimple
*g
)
2361 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2362 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2366 /* Set the GF_OMP_SECTION_LAST flag on G. */
2369 gimple_omp_section_set_last (gimple
*g
)
2371 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2372 g
->subcode
|= GF_OMP_SECTION_LAST
;
2376 /* Return true if OMP parallel statement G has the
2377 GF_OMP_PARALLEL_COMBINED flag set. */
2380 gimple_omp_parallel_combined_p (const gimple
*g
)
2382 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2383 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2387 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2388 value of COMBINED_P. */
2391 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2393 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2395 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2397 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2401 /* Return true if OMP atomic load/store statement G has the
2402 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2405 gimple_omp_atomic_need_value_p (const gimple
*g
)
2407 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2408 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2409 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2413 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2416 gimple_omp_atomic_set_need_value (gimple
*g
)
2418 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2419 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2420 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2424 /* Return the memory order of the OMP atomic load/store statement G. */
2426 static inline enum omp_memory_order
2427 gimple_omp_atomic_memory_order (const gimple
*g
)
2429 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2430 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2431 return (enum omp_memory_order
)
2432 (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_MEMORY_ORDER
);
2436 /* Set the memory order on G. */
2439 gimple_omp_atomic_set_memory_order (gimple
*g
, enum omp_memory_order mo
)
2441 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2442 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2443 g
->subcode
= ((g
->subcode
& ~GF_OMP_ATOMIC_MEMORY_ORDER
)
2444 | (mo
& GF_OMP_ATOMIC_MEMORY_ORDER
));
2448 /* Return the number of operands for statement GS. */
2450 static inline unsigned
2451 gimple_num_ops (const gimple
*gs
)
2457 /* Set the number of operands for statement GS. */
2460 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2462 gs
->num_ops
= num_ops
;
2466 /* Return the array of operands for statement GS. */
2468 static inline tree
*
2469 gimple_ops (gimple
*gs
)
2473 /* All the tuples have their operand vector at the very bottom
2474 of the structure. Note that those structures that do not
2475 have an operand vector have a zero offset. */
2476 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2477 gcc_gimple_checking_assert (off
!= 0);
2479 return (tree
*) ((char *) gs
+ off
);
2483 /* Return operand I for statement GS. */
2486 gimple_op (const gimple
*gs
, unsigned i
)
2488 if (gimple_has_ops (gs
))
2490 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2491 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2497 /* Return a pointer to operand I for statement GS. */
2499 static inline tree
*
2500 gimple_op_ptr (gimple
*gs
, unsigned i
)
2502 if (gimple_has_ops (gs
))
2504 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2505 return gimple_ops (gs
) + i
;
2511 /* Set operand I of statement GS to OP. */
2514 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2516 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2518 /* Note. It may be tempting to assert that OP matches
2519 is_gimple_operand, but that would be wrong. Different tuples
2520 accept slightly different sets of tree operands. Each caller
2521 should perform its own validation. */
2522 gimple_ops (gs
)[i
] = op
;
2525 /* Return true if GS is a GIMPLE_ASSIGN. */
2528 is_gimple_assign (const gimple
*gs
)
2530 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2533 /* Determine if expression CODE is one of the valid expressions that can
2534 be used on the RHS of GIMPLE assignments. */
2536 static inline enum gimple_rhs_class
2537 get_gimple_rhs_class (enum tree_code code
)
2539 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2542 /* Return the LHS of assignment statement GS. */
2545 gimple_assign_lhs (const gassign
*gs
)
2551 gimple_assign_lhs (const gimple
*gs
)
2553 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2554 return gimple_assign_lhs (ass
);
2558 /* Return a pointer to the LHS of assignment statement GS. */
2560 static inline tree
*
2561 gimple_assign_lhs_ptr (gassign
*gs
)
2566 static inline tree
*
2567 gimple_assign_lhs_ptr (gimple
*gs
)
2569 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2570 return gimple_assign_lhs_ptr (ass
);
2574 /* Set LHS to be the LHS operand of assignment statement GS. */
2577 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2581 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2582 SSA_NAME_DEF_STMT (lhs
) = gs
;
2586 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2588 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2589 gimple_assign_set_lhs (ass
, lhs
);
2593 /* Return the first operand on the RHS of assignment statement GS. */
2596 gimple_assign_rhs1 (const gassign
*gs
)
2602 gimple_assign_rhs1 (const gimple
*gs
)
2604 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2605 return gimple_assign_rhs1 (ass
);
2609 /* Return a pointer to the first operand on the RHS of assignment
2612 static inline tree
*
2613 gimple_assign_rhs1_ptr (gassign
*gs
)
2618 static inline tree
*
2619 gimple_assign_rhs1_ptr (gimple
*gs
)
2621 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2622 return gimple_assign_rhs1_ptr (ass
);
2625 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2628 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2634 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2636 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2637 gimple_assign_set_rhs1 (ass
, rhs
);
2641 /* Return the second operand on the RHS of assignment statement GS.
2642 If GS does not have two operands, NULL is returned instead. */
2645 gimple_assign_rhs2 (const gassign
*gs
)
2647 if (gimple_num_ops (gs
) >= 3)
2654 gimple_assign_rhs2 (const gimple
*gs
)
2656 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2657 return gimple_assign_rhs2 (ass
);
2661 /* Return a pointer to the second operand on the RHS of assignment
2664 static inline tree
*
2665 gimple_assign_rhs2_ptr (gassign
*gs
)
2667 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2671 static inline tree
*
2672 gimple_assign_rhs2_ptr (gimple
*gs
)
2674 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2675 return gimple_assign_rhs2_ptr (ass
);
2679 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2682 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2684 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2689 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2691 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2692 return gimple_assign_set_rhs2 (ass
, rhs
);
2695 /* Return the third operand on the RHS of assignment statement GS.
2696 If GS does not have two operands, NULL is returned instead. */
2699 gimple_assign_rhs3 (const gassign
*gs
)
2701 if (gimple_num_ops (gs
) >= 4)
2708 gimple_assign_rhs3 (const gimple
*gs
)
2710 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2711 return gimple_assign_rhs3 (ass
);
2714 /* Return a pointer to the third operand on the RHS of assignment
2717 static inline tree
*
2718 gimple_assign_rhs3_ptr (gimple
*gs
)
2720 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2721 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2726 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2729 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2731 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2736 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2738 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2739 gimple_assign_set_rhs3 (ass
, rhs
);
2743 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2744 which expect to see only two operands. */
2747 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2750 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2753 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2754 which expect to see only one operands. */
2757 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2760 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2763 /* Returns true if GS is a nontemporal move. */
2766 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2768 return gs
->nontemporal_move
;
2771 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2774 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2776 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2777 gs
->nontemporal_move
= nontemporal
;
2781 /* Return the code of the expression computed on the rhs of assignment
2782 statement GS. In case that the RHS is a single object, returns the
2783 tree code of the object. */
2785 static inline enum tree_code
2786 gimple_assign_rhs_code (const gassign
*gs
)
2788 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2789 /* While we initially set subcode to the TREE_CODE of the rhs for
2790 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2791 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2792 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2793 code
= TREE_CODE (gs
->op
[1]);
2798 static inline enum tree_code
2799 gimple_assign_rhs_code (const gimple
*gs
)
2801 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2802 return gimple_assign_rhs_code (ass
);
2806 /* Set CODE to be the code for the expression computed on the RHS of
2810 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2812 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2817 /* Return the gimple rhs class of the code of the expression computed on
2818 the rhs of assignment statement GS.
2819 This will never return GIMPLE_INVALID_RHS. */
2821 static inline enum gimple_rhs_class
2822 gimple_assign_rhs_class (const gimple
*gs
)
2824 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2827 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2828 there is no operator associated with the assignment itself.
2829 Unlike gimple_assign_copy_p, this predicate returns true for
2830 any RHS operand, including those that perform an operation
2831 and do not have the semantics of a copy, such as COND_EXPR. */
2834 gimple_assign_single_p (const gimple
*gs
)
2836 return (is_gimple_assign (gs
)
2837 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2840 /* Return true if GS performs a store to its lhs. */
2843 gimple_store_p (const gimple
*gs
)
2845 tree lhs
= gimple_get_lhs (gs
);
2846 return lhs
&& !is_gimple_reg (lhs
);
2849 /* Return true if GS is an assignment that loads from its rhs1. */
2852 gimple_assign_load_p (const gimple
*gs
)
2855 if (!gimple_assign_single_p (gs
))
2857 rhs
= gimple_assign_rhs1 (gs
);
2858 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2860 rhs
= get_base_address (rhs
);
2861 return (DECL_P (rhs
)
2862 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2866 /* Return true if S is a type-cast assignment. */
2869 gimple_assign_cast_p (const gimple
*s
)
2871 if (is_gimple_assign (s
))
2873 enum tree_code sc
= gimple_assign_rhs_code (s
);
2874 return CONVERT_EXPR_CODE_P (sc
)
2875 || sc
== VIEW_CONVERT_EXPR
2876 || sc
== FIX_TRUNC_EXPR
;
2882 /* Return true if S is a clobber statement. */
2885 gimple_clobber_p (const gimple
*s
)
2887 return gimple_assign_single_p (s
)
2888 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2891 /* Return true if GS is a GIMPLE_CALL. */
2894 is_gimple_call (const gimple
*gs
)
2896 return gimple_code (gs
) == GIMPLE_CALL
;
2899 /* Return the LHS of call statement GS. */
2902 gimple_call_lhs (const gcall
*gs
)
2908 gimple_call_lhs (const gimple
*gs
)
2910 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2911 return gimple_call_lhs (gc
);
2915 /* Return a pointer to the LHS of call statement GS. */
2917 static inline tree
*
2918 gimple_call_lhs_ptr (gcall
*gs
)
2923 static inline tree
*
2924 gimple_call_lhs_ptr (gimple
*gs
)
2926 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2927 return gimple_call_lhs_ptr (gc
);
2931 /* Set LHS to be the LHS operand of call statement GS. */
2934 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2937 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2938 SSA_NAME_DEF_STMT (lhs
) = gs
;
2942 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2944 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2945 gimple_call_set_lhs (gc
, lhs
);
2949 /* Return true if call GS calls an internal-only function, as enumerated
2953 gimple_call_internal_p (const gcall
*gs
)
2955 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2959 gimple_call_internal_p (const gimple
*gs
)
2961 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2962 return gimple_call_internal_p (gc
);
2965 /* Return true if call GS is marked as nocf_check. */
2968 gimple_call_nocf_check_p (const gcall
*gs
)
2970 return (gs
->subcode
& GF_CALL_NOCF_CHECK
) != 0;
2973 /* Mark statement GS as nocf_check call. */
2976 gimple_call_set_nocf_check (gcall
*gs
, bool nocf_check
)
2979 gs
->subcode
|= GF_CALL_NOCF_CHECK
;
2981 gs
->subcode
&= ~GF_CALL_NOCF_CHECK
;
2984 /* Return the target of internal call GS. */
2986 static inline enum internal_fn
2987 gimple_call_internal_fn (const gcall
*gs
)
2989 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2990 return gs
->u
.internal_fn
;
2993 static inline enum internal_fn
2994 gimple_call_internal_fn (const gimple
*gs
)
2996 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2997 return gimple_call_internal_fn (gc
);
3000 /* Return true, if this internal gimple call is unique. */
3003 gimple_call_internal_unique_p (const gcall
*gs
)
3005 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
3009 gimple_call_internal_unique_p (const gimple
*gs
)
3011 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3012 return gimple_call_internal_unique_p (gc
);
3015 /* Return true if GS is an internal function FN. */
3018 gimple_call_internal_p (const gimple
*gs
, internal_fn fn
)
3020 return (is_gimple_call (gs
)
3021 && gimple_call_internal_p (gs
)
3022 && gimple_call_internal_fn (gs
) == fn
);
3025 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
3026 that could alter control flow. */
3029 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
3031 if (ctrl_altering_p
)
3032 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
3034 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
3038 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
3040 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
3041 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
3044 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
3045 flag is set. Such call could not be a stmt in the middle of a bb. */
3048 gimple_call_ctrl_altering_p (const gcall
*gs
)
3050 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
3054 gimple_call_ctrl_altering_p (const gimple
*gs
)
3056 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3057 return gimple_call_ctrl_altering_p (gc
);
3061 /* Return the function type of the function called by GS. */
3064 gimple_call_fntype (const gcall
*gs
)
3066 if (gimple_call_internal_p (gs
))
3068 return gs
->u
.fntype
;
3072 gimple_call_fntype (const gimple
*gs
)
3074 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3075 return gimple_call_fntype (call_stmt
);
3078 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3081 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
3083 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
3084 call_stmt
->u
.fntype
= fntype
;
3088 /* Return the tree node representing the function called by call
3092 gimple_call_fn (const gcall
*gs
)
3098 gimple_call_fn (const gimple
*gs
)
3100 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3101 return gimple_call_fn (gc
);
3104 /* Return a pointer to the tree node representing the function called by call
3107 static inline tree
*
3108 gimple_call_fn_ptr (gcall
*gs
)
3113 static inline tree
*
3114 gimple_call_fn_ptr (gimple
*gs
)
3116 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3117 return gimple_call_fn_ptr (gc
);
3121 /* Set FN to be the function called by call statement GS. */
3124 gimple_call_set_fn (gcall
*gs
, tree fn
)
3126 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3131 /* Set FNDECL to be the function called by call statement GS. */
3134 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3136 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3137 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3138 build_pointer_type (TREE_TYPE (decl
)), decl
);
3142 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3144 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3145 gimple_call_set_fndecl (gc
, decl
);
3149 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3152 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3154 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3155 call_stmt
->u
.internal_fn
= fn
;
3159 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3160 Otherwise return NULL. This function is analogous to
3161 get_callee_fndecl in tree land. */
3164 gimple_call_fndecl (const gcall
*gs
)
3166 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3170 gimple_call_fndecl (const gimple
*gs
)
3172 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3173 return gimple_call_fndecl (gc
);
3177 /* Return the type returned by call statement GS. */
3180 gimple_call_return_type (const gcall
*gs
)
3182 tree type
= gimple_call_fntype (gs
);
3184 if (type
== NULL_TREE
)
3185 return TREE_TYPE (gimple_call_lhs (gs
));
3187 /* The type returned by a function is the type of its
3189 return TREE_TYPE (type
);
3193 /* Return the static chain for call statement GS. */
3196 gimple_call_chain (const gcall
*gs
)
3202 gimple_call_chain (const gimple
*gs
)
3204 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3205 return gimple_call_chain (gc
);
3209 /* Return a pointer to the static chain for call statement CALL_STMT. */
3211 static inline tree
*
3212 gimple_call_chain_ptr (gcall
*call_stmt
)
3214 return &call_stmt
->op
[2];
3217 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3220 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3222 call_stmt
->op
[2] = chain
;
3226 /* Return the number of arguments used by call statement GS. */
3228 static inline unsigned
3229 gimple_call_num_args (const gcall
*gs
)
3231 return gimple_num_ops (gs
) - 3;
3234 static inline unsigned
3235 gimple_call_num_args (const gimple
*gs
)
3237 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3238 return gimple_call_num_args (gc
);
3242 /* Return the argument at position INDEX for call statement GS. */
3245 gimple_call_arg (const gcall
*gs
, unsigned index
)
3247 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3248 return gs
->op
[index
+ 3];
3252 gimple_call_arg (const gimple
*gs
, unsigned index
)
3254 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3255 return gimple_call_arg (gc
, index
);
3259 /* Return a pointer to the argument at position INDEX for call
3262 static inline tree
*
3263 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3265 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3266 return &gs
->op
[index
+ 3];
3269 static inline tree
*
3270 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3272 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3273 return gimple_call_arg_ptr (gc
, index
);
3277 /* Set ARG to be the argument at position INDEX for call statement GS. */
3280 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3282 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3283 gs
->op
[index
+ 3] = arg
;
3287 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3289 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3290 gimple_call_set_arg (gc
, index
, arg
);
3294 /* If TAIL_P is true, mark call statement S as being a tail call
3295 (i.e., a call just before the exit of a function). These calls are
3296 candidate for tail call optimization. */
3299 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3302 s
->subcode
|= GF_CALL_TAILCALL
;
3304 s
->subcode
&= ~GF_CALL_TAILCALL
;
3308 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3311 gimple_call_tail_p (const gcall
*s
)
3313 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3316 /* Mark (or clear) call statement S as requiring tail call optimization. */
3319 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3322 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3324 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3327 /* Return true if call statement has been marked as requiring
3328 tail call optimization. */
3331 gimple_call_must_tail_p (const gcall
*s
)
3333 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3336 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3337 slot optimization. This transformation uses the target of the call
3338 expansion as the return slot for calls that return in memory. */
3341 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3343 if (return_slot_opt_p
)
3344 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3346 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3350 /* Return true if S is marked for return slot optimization. */
3353 gimple_call_return_slot_opt_p (const gcall
*s
)
3355 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3359 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3360 thunk to the thunked-to function. */
3363 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3366 s
->subcode
|= GF_CALL_FROM_THUNK
;
3368 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3372 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3375 gimple_call_from_thunk_p (gcall
*s
)
3377 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3381 /* If FROM_NEW_OR_DELETE_P is true, mark GIMPLE_CALL S as being a call
3382 to operator new or delete created from a new or delete expression. */
3385 gimple_call_set_from_new_or_delete (gcall
*s
, bool from_new_or_delete_p
)
3387 if (from_new_or_delete_p
)
3388 s
->subcode
|= GF_CALL_FROM_NEW_OR_DELETE
;
3390 s
->subcode
&= ~GF_CALL_FROM_NEW_OR_DELETE
;
3394 /* Return true if GIMPLE_CALL S is a call to operator new or delete from
3395 from a new or delete expression. */
3398 gimple_call_from_new_or_delete (const gcall
*s
)
3400 return (s
->subcode
& GF_CALL_FROM_NEW_OR_DELETE
) != 0;
3404 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3405 argument pack in its argument list. */
3408 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3410 if (pass_arg_pack_p
)
3411 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3413 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3417 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3418 argument pack in its argument list. */
3421 gimple_call_va_arg_pack_p (const gcall
*s
)
3423 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3427 /* Return true if S is a noreturn call. */
3430 gimple_call_noreturn_p (const gcall
*s
)
3432 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3436 gimple_call_noreturn_p (const gimple
*s
)
3438 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3439 return gimple_call_noreturn_p (gc
);
3443 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3444 even if the called function can throw in other cases. */
3447 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3450 s
->subcode
|= GF_CALL_NOTHROW
;
3452 s
->subcode
&= ~GF_CALL_NOTHROW
;
3455 /* Return true if S is a nothrow call. */
3458 gimple_call_nothrow_p (gcall
*s
)
3460 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3463 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3464 is known to be emitted for VLA objects. Those are wrapped by
3465 stack_save/stack_restore calls and hence can't lead to unbounded
3466 stack growth even when they occur in loops. */
3469 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3472 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3474 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3477 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3480 gimple_call_alloca_for_var_p (gcall
*s
)
3482 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3486 gimple_call_alloca_for_var_p (gimple
*s
)
3488 const gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
3489 return (gc
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3492 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3493 pointers to nested function are descriptors instead of trampolines. */
3496 gimple_call_set_by_descriptor (gcall
*s
, bool by_descriptor_p
)
3498 if (by_descriptor_p
)
3499 s
->subcode
|= GF_CALL_BY_DESCRIPTOR
;
3501 s
->subcode
&= ~GF_CALL_BY_DESCRIPTOR
;
3504 /* Return true if S is a by-descriptor call. */
3507 gimple_call_by_descriptor_p (gcall
*s
)
3509 return (s
->subcode
& GF_CALL_BY_DESCRIPTOR
) != 0;
3512 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3515 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3517 dest_call
->subcode
= orig_call
->subcode
;
3521 /* Return a pointer to the points-to solution for the set of call-used
3522 variables of the call CALL_STMT. */
3524 static inline struct pt_solution
*
3525 gimple_call_use_set (gcall
*call_stmt
)
3527 return &call_stmt
->call_used
;
3530 /* As above, but const. */
3532 static inline const pt_solution
*
3533 gimple_call_use_set (const gcall
*call_stmt
)
3535 return &call_stmt
->call_used
;
3538 /* Return a pointer to the points-to solution for the set of call-used
3539 variables of the call CALL_STMT. */
3541 static inline struct pt_solution
*
3542 gimple_call_clobber_set (gcall
*call_stmt
)
3544 return &call_stmt
->call_clobbered
;
3547 /* As above, but const. */
3549 static inline const pt_solution
*
3550 gimple_call_clobber_set (const gcall
*call_stmt
)
3552 return &call_stmt
->call_clobbered
;
3556 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3560 gimple_has_lhs (const gimple
*stmt
)
3562 if (is_gimple_assign (stmt
))
3564 if (const gcall
*call
= dyn_cast
<const gcall
*> (stmt
))
3565 return gimple_call_lhs (call
) != NULL_TREE
;
3570 /* Return the code of the predicate computed by conditional statement GS. */
3572 static inline enum tree_code
3573 gimple_cond_code (const gcond
*gs
)
3575 return (enum tree_code
) gs
->subcode
;
3578 static inline enum tree_code
3579 gimple_cond_code (const gimple
*gs
)
3581 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3582 return gimple_cond_code (gc
);
3586 /* Set CODE to be the predicate code for the conditional statement GS. */
3589 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3595 /* Return the LHS of the predicate computed by conditional statement GS. */
3598 gimple_cond_lhs (const gcond
*gs
)
3604 gimple_cond_lhs (const gimple
*gs
)
3606 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3607 return gimple_cond_lhs (gc
);
3610 /* Return the pointer to the LHS of the predicate computed by conditional
3613 static inline tree
*
3614 gimple_cond_lhs_ptr (gcond
*gs
)
3619 /* Set LHS to be the LHS operand of the predicate computed by
3620 conditional statement GS. */
3623 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3629 /* Return the RHS operand of the predicate computed by conditional GS. */
3632 gimple_cond_rhs (const gcond
*gs
)
3638 gimple_cond_rhs (const gimple
*gs
)
3640 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3641 return gimple_cond_rhs (gc
);
3644 /* Return the pointer to the RHS operand of the predicate computed by
3647 static inline tree
*
3648 gimple_cond_rhs_ptr (gcond
*gs
)
3654 /* Set RHS to be the RHS operand of the predicate computed by
3655 conditional statement GS. */
3658 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3664 /* Return the label used by conditional statement GS when its
3665 predicate evaluates to true. */
3668 gimple_cond_true_label (const gcond
*gs
)
3674 /* Set LABEL to be the label used by conditional statement GS when its
3675 predicate evaluates to true. */
3678 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3684 /* Set LABEL to be the label used by conditional statement GS when its
3685 predicate evaluates to false. */
3688 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3694 /* Return the label used by conditional statement GS when its
3695 predicate evaluates to false. */
3698 gimple_cond_false_label (const gcond
*gs
)
3704 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3707 gimple_cond_make_false (gcond
*gs
)
3709 gimple_cond_set_lhs (gs
, boolean_false_node
);
3710 gimple_cond_set_rhs (gs
, boolean_false_node
);
3711 gs
->subcode
= NE_EXPR
;
3715 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3718 gimple_cond_make_true (gcond
*gs
)
3720 gimple_cond_set_lhs (gs
, boolean_true_node
);
3721 gimple_cond_set_rhs (gs
, boolean_false_node
);
3722 gs
->subcode
= NE_EXPR
;
3725 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3726 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3729 gimple_cond_true_p (const gcond
*gs
)
3731 tree lhs
= gimple_cond_lhs (gs
);
3732 tree rhs
= gimple_cond_rhs (gs
);
3733 enum tree_code code
= gimple_cond_code (gs
);
3735 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3738 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3741 if (code
== NE_EXPR
&& lhs
!= rhs
)
3744 if (code
== EQ_EXPR
&& lhs
== rhs
)
3750 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3751 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3754 gimple_cond_false_p (const gcond
*gs
)
3756 tree lhs
= gimple_cond_lhs (gs
);
3757 tree rhs
= gimple_cond_rhs (gs
);
3758 enum tree_code code
= gimple_cond_code (gs
);
3760 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3763 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3766 if (code
== NE_EXPR
&& lhs
== rhs
)
3769 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3775 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3778 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3781 gimple_cond_set_code (stmt
, code
);
3782 gimple_cond_set_lhs (stmt
, lhs
);
3783 gimple_cond_set_rhs (stmt
, rhs
);
3787 /* Return the tree code for the expression computed by STMT. This is
3788 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
3789 GIMPLE_CALL, return CALL_EXPR as the expression code for
3790 consistency. This is useful when the caller needs to deal with the
3791 three kinds of computation that GIMPLE supports. */
3793 static inline enum tree_code
3794 gimple_expr_code (const gimple
*stmt
)
3796 if (const gassign
*ass
= dyn_cast
<const gassign
*> (stmt
))
3797 return gimple_assign_rhs_code (ass
);
3798 if (const gcond
*cond
= dyn_cast
<const gcond
*> (stmt
))
3799 return gimple_cond_code (cond
);
3802 gcc_gimple_checking_assert (gimple_code (stmt
) == GIMPLE_CALL
);
3808 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3811 gimple_label_label (const glabel
*gs
)
3817 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3821 gimple_label_set_label (glabel
*gs
, tree label
)
3827 /* Return the destination of the unconditional jump GS. */
3830 gimple_goto_dest (const gimple
*gs
)
3832 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3833 return gimple_op (gs
, 0);
3837 /* Set DEST to be the destination of the unconditonal jump GS. */
3840 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3846 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3849 gimple_bind_vars (const gbind
*bind_stmt
)
3851 return bind_stmt
->vars
;
3855 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3859 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3861 bind_stmt
->vars
= vars
;
3865 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3869 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3871 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3875 static inline gimple_seq
*
3876 gimple_bind_body_ptr (gbind
*bind_stmt
)
3878 return &bind_stmt
->body
;
3881 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3883 static inline gimple_seq
3884 gimple_bind_body (const gbind
*gs
)
3886 return *gimple_bind_body_ptr (const_cast <gbind
*> (gs
));
3890 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3894 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3896 bind_stmt
->body
= seq
;
3900 /* Append a statement to the end of a GIMPLE_BIND's body. */
3903 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3905 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3909 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3912 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3914 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3918 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3919 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3922 gimple_bind_block (const gbind
*bind_stmt
)
3924 return bind_stmt
->block
;
3928 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3932 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3934 gcc_gimple_checking_assert (block
== NULL_TREE
3935 || TREE_CODE (block
) == BLOCK
);
3936 bind_stmt
->block
= block
;
3940 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3942 static inline unsigned
3943 gimple_asm_ninputs (const gasm
*asm_stmt
)
3945 return asm_stmt
->ni
;
3949 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3951 static inline unsigned
3952 gimple_asm_noutputs (const gasm
*asm_stmt
)
3954 return asm_stmt
->no
;
3958 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3960 static inline unsigned
3961 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3963 return asm_stmt
->nc
;
3966 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3968 static inline unsigned
3969 gimple_asm_nlabels (const gasm
*asm_stmt
)
3971 return asm_stmt
->nl
;
3974 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3977 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3979 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3980 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3983 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3986 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3988 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3989 && TREE_CODE (in_op
) == TREE_LIST
);
3990 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3994 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3997 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3999 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
4000 return asm_stmt
->op
[index
];
4003 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
4006 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
4008 gcc_gimple_checking_assert (index
< asm_stmt
->no
4009 && TREE_CODE (out_op
) == TREE_LIST
);
4010 asm_stmt
->op
[index
] = out_op
;
4014 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
4017 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
4019 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
4020 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
4024 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
4027 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
4029 gcc_gimple_checking_assert (index
< asm_stmt
->nc
4030 && TREE_CODE (clobber_op
) == TREE_LIST
);
4031 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
4034 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
4037 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
4039 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
4040 return asm_stmt
->op
[index
+ asm_stmt
->no
+ asm_stmt
->ni
+ asm_stmt
->nc
];
4043 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
4046 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
4048 gcc_gimple_checking_assert (index
< asm_stmt
->nl
4049 && TREE_CODE (label_op
) == TREE_LIST
);
4050 asm_stmt
->op
[index
+ asm_stmt
->no
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
4053 /* Return the string representing the assembly instruction in
4054 GIMPLE_ASM ASM_STMT. */
4056 static inline const char *
4057 gimple_asm_string (const gasm
*asm_stmt
)
4059 return asm_stmt
->string
;
4063 /* Return true if ASM_STMT is marked volatile. */
4066 gimple_asm_volatile_p (const gasm
*asm_stmt
)
4068 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
4072 /* If VOLATILE_P is true, mark asm statement ASM_STMT as volatile. */
4075 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
4078 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
4080 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
4084 /* Return true if ASM_STMT is marked inline. */
4087 gimple_asm_inline_p (const gasm
*asm_stmt
)
4089 return (asm_stmt
->subcode
& GF_ASM_INLINE
) != 0;
4093 /* If INLINE_P is true, mark asm statement ASM_STMT as inline. */
4096 gimple_asm_set_inline (gasm
*asm_stmt
, bool inline_p
)
4099 asm_stmt
->subcode
|= GF_ASM_INLINE
;
4101 asm_stmt
->subcode
&= ~GF_ASM_INLINE
;
4105 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
4108 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
4111 asm_stmt
->subcode
|= GF_ASM_INPUT
;
4113 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
4117 /* Return true if asm ASM_STMT is an ASM_INPUT. */
4120 gimple_asm_input_p (const gasm
*asm_stmt
)
4122 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
4126 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4129 gimple_catch_types (const gcatch
*catch_stmt
)
4131 return catch_stmt
->types
;
4135 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
4137 static inline tree
*
4138 gimple_catch_types_ptr (gcatch
*catch_stmt
)
4140 return &catch_stmt
->types
;
4144 /* Return a pointer to the GIMPLE sequence representing the body of
4145 the handler of GIMPLE_CATCH statement CATCH_STMT. */
4147 static inline gimple_seq
*
4148 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
4150 return &catch_stmt
->handler
;
4154 /* Return the GIMPLE sequence representing the body of the handler of
4155 GIMPLE_CATCH statement CATCH_STMT. */
4157 static inline gimple_seq
4158 gimple_catch_handler (const gcatch
*catch_stmt
)
4160 return *gimple_catch_handler_ptr (const_cast <gcatch
*> (catch_stmt
));
4164 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4167 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
4169 catch_stmt
->types
= t
;
4173 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4176 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
4178 catch_stmt
->handler
= handler
;
4182 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4185 gimple_eh_filter_types (const gimple
*gs
)
4187 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
4188 return eh_filter_stmt
->types
;
4192 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4195 static inline tree
*
4196 gimple_eh_filter_types_ptr (gimple
*gs
)
4198 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4199 return &eh_filter_stmt
->types
;
4203 /* Return a pointer to the sequence of statement to execute when
4204 GIMPLE_EH_FILTER statement fails. */
4206 static inline gimple_seq
*
4207 gimple_eh_filter_failure_ptr (gimple
*gs
)
4209 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4210 return &eh_filter_stmt
->failure
;
4214 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4217 static inline gimple_seq
4218 gimple_eh_filter_failure (const gimple
*gs
)
4220 return *gimple_eh_filter_failure_ptr (const_cast <gimple
*> (gs
));
4224 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4228 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4230 eh_filter_stmt
->types
= types
;
4234 /* Set FAILURE to be the sequence of statements to execute on failure
4235 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4238 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4241 eh_filter_stmt
->failure
= failure
;
4244 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4247 gimple_eh_must_not_throw_fndecl (const geh_mnt
*eh_mnt_stmt
)
4249 return eh_mnt_stmt
->fndecl
;
4252 /* Set the function decl to be called by GS to DECL. */
4255 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4258 eh_mnt_stmt
->fndecl
= decl
;
4261 /* GIMPLE_EH_ELSE accessors. */
4263 static inline gimple_seq
*
4264 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4266 return &eh_else_stmt
->n_body
;
4269 static inline gimple_seq
4270 gimple_eh_else_n_body (const geh_else
*eh_else_stmt
)
4272 return *gimple_eh_else_n_body_ptr (const_cast <geh_else
*> (eh_else_stmt
));
4275 static inline gimple_seq
*
4276 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4278 return &eh_else_stmt
->e_body
;
4281 static inline gimple_seq
4282 gimple_eh_else_e_body (const geh_else
*eh_else_stmt
)
4284 return *gimple_eh_else_e_body_ptr (const_cast <geh_else
*> (eh_else_stmt
));
4288 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4290 eh_else_stmt
->n_body
= seq
;
4294 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4296 eh_else_stmt
->e_body
= seq
;
4299 /* GIMPLE_TRY accessors. */
4301 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4302 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4304 static inline enum gimple_try_flags
4305 gimple_try_kind (const gimple
*gs
)
4307 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4308 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4312 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4315 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4317 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4318 || kind
== GIMPLE_TRY_FINALLY
);
4319 if (gimple_try_kind (gs
) != kind
)
4320 gs
->subcode
= (unsigned int) kind
;
4324 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4327 gimple_try_catch_is_cleanup (const gimple
*gs
)
4329 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4330 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4334 /* Return a pointer to the sequence of statements used as the
4335 body for GIMPLE_TRY GS. */
4337 static inline gimple_seq
*
4338 gimple_try_eval_ptr (gimple
*gs
)
4340 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4341 return &try_stmt
->eval
;
4345 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4347 static inline gimple_seq
4348 gimple_try_eval (const gimple
*gs
)
4350 return *gimple_try_eval_ptr (const_cast <gimple
*> (gs
));
4354 /* Return a pointer to the sequence of statements used as the cleanup body for
4357 static inline gimple_seq
*
4358 gimple_try_cleanup_ptr (gimple
*gs
)
4360 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4361 return &try_stmt
->cleanup
;
4365 /* Return the sequence of statements used as the cleanup body for
4368 static inline gimple_seq
4369 gimple_try_cleanup (const gimple
*gs
)
4371 return *gimple_try_cleanup_ptr (const_cast <gimple
*> (gs
));
4375 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4378 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4380 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4381 if (catch_is_cleanup
)
4382 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4384 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4388 /* Set EVAL to be the sequence of statements to use as the body for
4389 GIMPLE_TRY TRY_STMT. */
4392 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4394 try_stmt
->eval
= eval
;
4398 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4399 body for GIMPLE_TRY TRY_STMT. */
4402 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4404 try_stmt
->cleanup
= cleanup
;
4408 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4410 static inline gimple_seq
*
4411 gimple_wce_cleanup_ptr (gimple
*gs
)
4413 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4414 return &wce_stmt
->cleanup
;
4418 /* Return the cleanup sequence for cleanup statement GS. */
4420 static inline gimple_seq
4421 gimple_wce_cleanup (gimple
*gs
)
4423 return *gimple_wce_cleanup_ptr (gs
);
4427 /* Set CLEANUP to be the cleanup sequence for GS. */
4430 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4432 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4433 wce_stmt
->cleanup
= cleanup
;
4437 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4440 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4442 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4443 return gs
->subcode
!= 0;
4447 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4450 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4452 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4453 gs
->subcode
= (unsigned int) eh_only_p
;
4457 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4459 static inline unsigned
4460 gimple_phi_capacity (const gimple
*gs
)
4462 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4463 return phi_stmt
->capacity
;
4467 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4468 be exactly the number of incoming edges for the basic block holding
4471 static inline unsigned
4472 gimple_phi_num_args (const gimple
*gs
)
4474 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4475 return phi_stmt
->nargs
;
4479 /* Return the SSA name created by GIMPLE_PHI GS. */
4482 gimple_phi_result (const gphi
*gs
)
4488 gimple_phi_result (const gimple
*gs
)
4490 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4491 return gimple_phi_result (phi_stmt
);
4494 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4496 static inline tree
*
4497 gimple_phi_result_ptr (gphi
*gs
)
4502 static inline tree
*
4503 gimple_phi_result_ptr (gimple
*gs
)
4505 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4506 return gimple_phi_result_ptr (phi_stmt
);
4509 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4512 gimple_phi_set_result (gphi
*phi
, tree result
)
4514 phi
->result
= result
;
4515 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4516 SSA_NAME_DEF_STMT (result
) = phi
;
4520 /* Return the PHI argument corresponding to incoming edge INDEX for
4523 static inline struct phi_arg_d
*
4524 gimple_phi_arg (gphi
*gs
, unsigned index
)
4526 gcc_gimple_checking_assert (index
< gs
->nargs
);
4527 return &(gs
->args
[index
]);
4530 static inline const phi_arg_d
*
4531 gimple_phi_arg (const gphi
*gs
, unsigned index
)
4533 gcc_gimple_checking_assert (index
< gs
->nargs
);
4534 return &(gs
->args
[index
]);
4537 static inline struct phi_arg_d
*
4538 gimple_phi_arg (gimple
*gs
, unsigned index
)
4540 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4541 return gimple_phi_arg (phi_stmt
, index
);
4544 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4545 for GIMPLE_PHI PHI. */
4548 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4550 gcc_gimple_checking_assert (index
< phi
->nargs
);
4551 phi
->args
[index
] = *phiarg
;
4554 /* Return the PHI nodes for basic block BB, or NULL if there are no
4557 static inline gimple_seq
4558 phi_nodes (const_basic_block bb
)
4560 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4561 return bb
->il
.gimple
.phi_nodes
;
4564 /* Return a pointer to the PHI nodes for basic block BB. */
4566 static inline gimple_seq
*
4567 phi_nodes_ptr (basic_block bb
)
4569 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4570 return &bb
->il
.gimple
.phi_nodes
;
4573 /* Return the tree operand for argument I of PHI node GS. */
4576 gimple_phi_arg_def (const gphi
*gs
, size_t index
)
4578 return gimple_phi_arg (gs
, index
)->def
;
4582 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4584 return gimple_phi_arg (gs
, index
)->def
;
4588 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4590 static inline tree
*
4591 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4593 return &gimple_phi_arg (phi
, index
)->def
;
4596 /* Return the edge associated with argument I of phi node PHI. */
4599 gimple_phi_arg_edge (const gphi
*phi
, size_t i
)
4601 return EDGE_PRED (gimple_bb (phi
), i
);
4604 /* Return the source location of gimple argument I of phi node PHI. */
4606 static inline location_t
4607 gimple_phi_arg_location (const gphi
*phi
, size_t i
)
4609 return gimple_phi_arg (phi
, i
)->locus
;
4612 /* Return the source location of the argument on edge E of phi node PHI. */
4614 static inline location_t
4615 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4617 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4620 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4623 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, location_t loc
)
4625 gimple_phi_arg (phi
, i
)->locus
= loc
;
4628 /* Return address of source location of gimple argument I of phi node PHI. */
4630 static inline location_t
*
4631 gimple_phi_arg_location_ptr (gphi
*phi
, size_t i
)
4633 return &gimple_phi_arg (phi
, i
)->locus
;
4636 /* Return TRUE if argument I of phi node PHI has a location record. */
4639 gimple_phi_arg_has_location (const gphi
*phi
, size_t i
)
4641 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4645 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4648 gimple_resx_region (const gresx
*resx_stmt
)
4650 return resx_stmt
->region
;
4653 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4656 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4658 resx_stmt
->region
= region
;
4661 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4664 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4666 return eh_dispatch_stmt
->region
;
4669 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4670 EH_DISPATCH_STMT. */
4673 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4675 eh_dispatch_stmt
->region
= region
;
4678 /* Return the number of labels associated with the switch statement GS. */
4680 static inline unsigned
4681 gimple_switch_num_labels (const gswitch
*gs
)
4684 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4685 num_ops
= gimple_num_ops (gs
);
4686 gcc_gimple_checking_assert (num_ops
> 1);
4691 /* Set NLABELS to be the number of labels for the switch statement GS. */
4694 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4696 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4697 gimple_set_num_ops (g
, nlabels
+ 1);
4701 /* Return the index variable used by the switch statement GS. */
4704 gimple_switch_index (const gswitch
*gs
)
4710 /* Return a pointer to the index variable for the switch statement GS. */
4712 static inline tree
*
4713 gimple_switch_index_ptr (gswitch
*gs
)
4719 /* Set INDEX to be the index variable for switch statement GS. */
4722 gimple_switch_set_index (gswitch
*gs
, tree index
)
4724 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4729 /* Return the label numbered INDEX. The default label is 0, followed by any
4730 labels in a switch statement. */
4733 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4735 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4736 return gs
->op
[index
+ 1];
4739 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4742 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4744 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4745 && (label
== NULL_TREE
4746 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4747 gs
->op
[index
+ 1] = label
;
4750 /* Return the default label for a switch statement. */
4753 gimple_switch_default_label (const gswitch
*gs
)
4755 tree label
= gimple_switch_label (gs
, 0);
4756 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4760 /* Set the default label for a switch statement. */
4763 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4765 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4766 gimple_switch_set_label (gs
, 0, label
);
4769 /* Return true if GS is a GIMPLE_DEBUG statement. */
4772 is_gimple_debug (const gimple
*gs
)
4774 return gimple_code (gs
) == GIMPLE_DEBUG
;
4778 /* Return the first nondebug statement in GIMPLE sequence S. */
4780 static inline gimple
*
4781 gimple_seq_first_nondebug_stmt (gimple_seq s
)
4783 gimple_seq_node n
= gimple_seq_first (s
);
4784 while (n
&& is_gimple_debug (n
))
4790 /* Return the last nondebug statement in GIMPLE sequence S. */
4792 static inline gimple
*
4793 gimple_seq_last_nondebug_stmt (gimple_seq s
)
4796 for (n
= gimple_seq_last (s
);
4797 n
&& is_gimple_debug (n
);
4805 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4808 gimple_debug_bind_p (const gimple
*s
)
4810 if (is_gimple_debug (s
))
4811 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4816 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4819 gimple_debug_bind_get_var (const gimple
*dbg
)
4821 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4822 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4823 return gimple_op (dbg
, 0);
4826 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4830 gimple_debug_bind_get_value (const gimple
*dbg
)
4832 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4833 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4834 return gimple_op (dbg
, 1);
4837 /* Return a pointer to the value bound to the variable in a
4838 GIMPLE_DEBUG bind statement. */
4840 static inline tree
*
4841 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4843 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4844 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4845 return gimple_op_ptr (dbg
, 1);
4848 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4851 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4853 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4854 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4855 gimple_set_op (dbg
, 0, var
);
4858 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4862 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4864 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4865 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4866 gimple_set_op (dbg
, 1, value
);
4869 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4871 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4873 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4877 gimple_debug_bind_reset_value (gimple
*dbg
)
4879 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4880 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4881 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4884 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4888 gimple_debug_bind_has_value_p (gimple
*dbg
)
4890 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4891 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4892 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4895 #undef GIMPLE_DEBUG_BIND_NOVALUE
4897 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4900 gimple_debug_source_bind_p (const gimple
*s
)
4902 if (is_gimple_debug (s
))
4903 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4908 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4911 gimple_debug_source_bind_get_var (const gimple
*dbg
)
4913 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4914 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4915 return gimple_op (dbg
, 0);
4918 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4922 gimple_debug_source_bind_get_value (const gimple
*dbg
)
4924 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4925 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4926 return gimple_op (dbg
, 1);
4929 /* Return a pointer to the value bound to the variable in a
4930 GIMPLE_DEBUG source bind statement. */
4932 static inline tree
*
4933 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4935 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4936 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4937 return gimple_op_ptr (dbg
, 1);
4940 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4943 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4945 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4946 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4947 gimple_set_op (dbg
, 0, var
);
4950 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4954 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4956 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4957 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4958 gimple_set_op (dbg
, 1, value
);
4961 /* Return true if S is a GIMPLE_DEBUG BEGIN_STMT statement. */
4964 gimple_debug_begin_stmt_p (const gimple
*s
)
4966 if (is_gimple_debug (s
))
4967 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
;
4972 /* Return true if S is a GIMPLE_DEBUG INLINE_ENTRY statement. */
4975 gimple_debug_inline_entry_p (const gimple
*s
)
4977 if (is_gimple_debug (s
))
4978 return s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4983 /* Return true if S is a GIMPLE_DEBUG non-binding marker statement. */
4986 gimple_debug_nonbind_marker_p (const gimple
*s
)
4988 if (is_gimple_debug (s
))
4989 return s
->subcode
== GIMPLE_DEBUG_BEGIN_STMT
4990 || s
->subcode
== GIMPLE_DEBUG_INLINE_ENTRY
;
4995 /* Return the line number for EXPR, or return -1 if we have no line
4996 number information for it. */
4998 get_lineno (const gimple
*stmt
)
5005 loc
= gimple_location (stmt
);
5006 if (loc
== UNKNOWN_LOCATION
)
5009 return LOCATION_LINE (loc
);
5012 /* Return a pointer to the body for the OMP statement GS. */
5014 static inline gimple_seq
*
5015 gimple_omp_body_ptr (gimple
*gs
)
5017 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
5020 /* Return the body for the OMP statement GS. */
5022 static inline gimple_seq
5023 gimple_omp_body (const gimple
*gs
)
5025 return *gimple_omp_body_ptr (const_cast <gimple
*> (gs
));
5028 /* Set BODY to be the body for the OMP statement GS. */
5031 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
5033 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
5037 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
5040 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
5042 return crit_stmt
->name
;
5046 /* Return a pointer to the name associated with OMP critical statement
5049 static inline tree
*
5050 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
5052 return &crit_stmt
->name
;
5056 /* Set NAME to be the name associated with OMP critical statement
5060 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
5062 crit_stmt
->name
= name
;
5066 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
5069 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
5071 return crit_stmt
->clauses
;
5075 /* Return a pointer to the clauses associated with OMP critical statement
5078 static inline tree
*
5079 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
5081 return &crit_stmt
->clauses
;
5085 /* Set CLAUSES to be the clauses associated with OMP critical statement
5089 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
5091 crit_stmt
->clauses
= clauses
;
5095 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
5098 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
5100 return ord_stmt
->clauses
;
5104 /* Return a pointer to the clauses associated with OMP ordered statement
5107 static inline tree
*
5108 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
5110 return &ord_stmt
->clauses
;
5114 /* Set CLAUSES to be the clauses associated with OMP ordered statement
5118 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
5120 ord_stmt
->clauses
= clauses
;
5124 /* Return the clauses associated with OMP_SCAN statement SCAN_STMT. */
5127 gimple_omp_scan_clauses (const gomp_scan
*scan_stmt
)
5129 return scan_stmt
->clauses
;
5133 /* Return a pointer to the clauses associated with OMP scan statement
5136 static inline tree
*
5137 gimple_omp_scan_clauses_ptr (gomp_scan
*scan_stmt
)
5139 return &scan_stmt
->clauses
;
5143 /* Set CLAUSES to be the clauses associated with OMP scan statement
5147 gimple_omp_scan_set_clauses (gomp_scan
*scan_stmt
, tree clauses
)
5149 scan_stmt
->clauses
= clauses
;
5153 /* Return the clauses associated with OMP_TASKGROUP statement GS. */
5156 gimple_omp_taskgroup_clauses (const gimple
*gs
)
5158 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5160 static_cast <const gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5164 /* Return a pointer to the clauses associated with OMP taskgroup statement
5167 static inline tree
*
5168 gimple_omp_taskgroup_clauses_ptr (gimple
*gs
)
5170 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5171 return &static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
;
5175 /* Set CLAUSES to be the clauses associated with OMP taskgroup statement
5179 gimple_omp_taskgroup_set_clauses (gimple
*gs
, tree clauses
)
5181 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASKGROUP
);
5182 static_cast <gimple_statement_omp_single_layout
*> (gs
)->clauses
5187 /* Return the kind of the OMP_FOR statemement G. */
5190 gimple_omp_for_kind (const gimple
*g
)
5192 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5193 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
5197 /* Set the kind of the OMP_FOR statement G. */
5200 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
5202 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
5203 | (kind
& GF_OMP_FOR_KIND_MASK
);
5207 /* Return true if OMP_FOR statement G has the
5208 GF_OMP_FOR_COMBINED flag set. */
5211 gimple_omp_for_combined_p (const gimple
*g
)
5213 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5214 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
5218 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
5219 the boolean value of COMBINED_P. */
5222 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
5225 g
->subcode
|= GF_OMP_FOR_COMBINED
;
5227 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
5231 /* Return true if the OMP_FOR statement G has the
5232 GF_OMP_FOR_COMBINED_INTO flag set. */
5235 gimple_omp_for_combined_into_p (const gimple
*g
)
5237 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
5238 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
5242 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
5243 on the boolean value of COMBINED_P. */
5246 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
5249 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
5251 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
5255 /* Return the clauses associated with the OMP_FOR statement GS. */
5258 gimple_omp_for_clauses (const gimple
*gs
)
5260 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5261 return omp_for_stmt
->clauses
;
5265 /* Return a pointer to the clauses associated with the OMP_FOR statement
5268 static inline tree
*
5269 gimple_omp_for_clauses_ptr (gimple
*gs
)
5271 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5272 return &omp_for_stmt
->clauses
;
5276 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
5280 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
5282 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5283 omp_for_stmt
->clauses
= clauses
;
5287 /* Get the collapse count of the OMP_FOR statement GS. */
5289 static inline size_t
5290 gimple_omp_for_collapse (const gimple
*gs
)
5292 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5293 return omp_for_stmt
->collapse
;
5297 /* Return the condition code associated with the OMP_FOR statement GS. */
5299 static inline enum tree_code
5300 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
5302 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5303 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5304 return omp_for_stmt
->iter
[i
].cond
;
5308 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5311 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
5313 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5314 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5315 && i
< omp_for_stmt
->collapse
);
5316 omp_for_stmt
->iter
[i
].cond
= cond
;
5320 /* Return the index variable for the OMP_FOR statement GS. */
5323 gimple_omp_for_index (const gimple
*gs
, size_t i
)
5325 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5326 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5327 return omp_for_stmt
->iter
[i
].index
;
5331 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5333 static inline tree
*
5334 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
5336 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5337 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5338 return &omp_for_stmt
->iter
[i
].index
;
5342 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5345 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
5347 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5348 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5349 omp_for_stmt
->iter
[i
].index
= index
;
5353 /* Return the initial value for the OMP_FOR statement GS. */
5356 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
5358 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5359 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5360 return omp_for_stmt
->iter
[i
].initial
;
5364 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5366 static inline tree
*
5367 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
5369 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5370 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5371 return &omp_for_stmt
->iter
[i
].initial
;
5375 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5378 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5380 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5381 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5382 omp_for_stmt
->iter
[i
].initial
= initial
;
5386 /* Return the final value for the OMP_FOR statement GS. */
5389 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5391 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5392 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5393 return omp_for_stmt
->iter
[i
].final
;
5397 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5399 static inline tree
*
5400 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5402 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5403 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5404 return &omp_for_stmt
->iter
[i
].final
;
5408 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5411 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5413 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5414 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5415 omp_for_stmt
->iter
[i
].final
= final
;
5419 /* Return the increment value for the OMP_FOR statement GS. */
5422 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5424 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5425 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5426 return omp_for_stmt
->iter
[i
].incr
;
5430 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5432 static inline tree
*
5433 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5435 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5436 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5437 return &omp_for_stmt
->iter
[i
].incr
;
5441 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5444 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5446 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5447 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5448 omp_for_stmt
->iter
[i
].incr
= incr
;
5452 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5453 statement GS starts. */
5455 static inline gimple_seq
*
5456 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5458 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5459 return &omp_for_stmt
->pre_body
;
5463 /* Return the sequence of statements to execute before the OMP_FOR
5464 statement GS starts. */
5466 static inline gimple_seq
5467 gimple_omp_for_pre_body (const gimple
*gs
)
5469 return *gimple_omp_for_pre_body_ptr (const_cast <gimple
*> (gs
));
5473 /* Set PRE_BODY to be the sequence of statements to execute before the
5474 OMP_FOR statement GS starts. */
5477 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5479 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5480 omp_for_stmt
->pre_body
= pre_body
;
5483 /* Return the clauses associated with OMP_PARALLEL GS. */
5486 gimple_omp_parallel_clauses (const gimple
*gs
)
5488 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5489 return omp_parallel_stmt
->clauses
;
5493 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5495 static inline tree
*
5496 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5498 return &omp_parallel_stmt
->clauses
;
5502 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5505 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5508 omp_parallel_stmt
->clauses
= clauses
;
5512 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5515 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5517 return omp_parallel_stmt
->child_fn
;
5520 /* Return a pointer to the child function used to hold the body of
5521 OMP_PARALLEL_STMT. */
5523 static inline tree
*
5524 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5526 return &omp_parallel_stmt
->child_fn
;
5530 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5533 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5536 omp_parallel_stmt
->child_fn
= child_fn
;
5540 /* Return the artificial argument used to send variables and values
5541 from the parent to the children threads in OMP_PARALLEL_STMT. */
5544 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5546 return omp_parallel_stmt
->data_arg
;
5550 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5552 static inline tree
*
5553 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5555 return &omp_parallel_stmt
->data_arg
;
5559 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5562 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5565 omp_parallel_stmt
->data_arg
= data_arg
;
5568 /* Return the clauses associated with OMP_TASK GS. */
5571 gimple_omp_task_clauses (const gimple
*gs
)
5573 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5574 return omp_task_stmt
->clauses
;
5578 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5580 static inline tree
*
5581 gimple_omp_task_clauses_ptr (gimple
*gs
)
5583 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5584 return &omp_task_stmt
->clauses
;
5588 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5592 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5594 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5595 omp_task_stmt
->clauses
= clauses
;
5599 /* Return true if OMP task statement G has the
5600 GF_OMP_TASK_TASKLOOP flag set. */
5603 gimple_omp_task_taskloop_p (const gimple
*g
)
5605 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5606 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5610 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5611 value of TASKLOOP_P. */
5614 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5616 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5618 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5620 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5624 /* Return true if OMP task statement G has the
5625 GF_OMP_TASK_TASKWAIT flag set. */
5628 gimple_omp_task_taskwait_p (const gimple
*g
)
5630 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5631 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKWAIT
) != 0;
5635 /* Set the GF_OMP_TASK_TASKWAIT field in G depending on the boolean
5636 value of TASKWAIT_P. */
5639 gimple_omp_task_set_taskwait_p (gimple
*g
, bool taskwait_p
)
5641 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5643 g
->subcode
|= GF_OMP_TASK_TASKWAIT
;
5645 g
->subcode
&= ~GF_OMP_TASK_TASKWAIT
;
5649 /* Return the child function used to hold the body of OMP_TASK GS. */
5652 gimple_omp_task_child_fn (const gimple
*gs
)
5654 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5655 return omp_task_stmt
->child_fn
;
5658 /* Return a pointer to the child function used to hold the body of
5661 static inline tree
*
5662 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5664 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5665 return &omp_task_stmt
->child_fn
;
5669 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5672 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5674 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5675 omp_task_stmt
->child_fn
= child_fn
;
5679 /* Return the artificial argument used to send variables and values
5680 from the parent to the children threads in OMP_TASK GS. */
5683 gimple_omp_task_data_arg (const gimple
*gs
)
5685 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5686 return omp_task_stmt
->data_arg
;
5690 /* Return a pointer to the data argument for OMP_TASK GS. */
5692 static inline tree
*
5693 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5695 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5696 return &omp_task_stmt
->data_arg
;
5700 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5703 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5705 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5706 omp_task_stmt
->data_arg
= data_arg
;
5710 /* Return the clauses associated with OMP_TASK GS. */
5713 gimple_omp_taskreg_clauses (const gimple
*gs
)
5715 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5716 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5717 return omp_taskreg_stmt
->clauses
;
5721 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5723 static inline tree
*
5724 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5726 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5727 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5728 return &omp_taskreg_stmt
->clauses
;
5732 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5736 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5738 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5739 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5740 omp_taskreg_stmt
->clauses
= clauses
;
5744 /* Return the child function used to hold the body of OMP_TASK GS. */
5747 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5749 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5750 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5751 return omp_taskreg_stmt
->child_fn
;
5754 /* Return a pointer to the child function used to hold the body of
5757 static inline tree
*
5758 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5760 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5761 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5762 return &omp_taskreg_stmt
->child_fn
;
5766 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5769 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5771 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5772 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5773 omp_taskreg_stmt
->child_fn
= child_fn
;
5777 /* Return the artificial argument used to send variables and values
5778 from the parent to the children threads in OMP_TASK GS. */
5781 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5783 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5784 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5785 return omp_taskreg_stmt
->data_arg
;
5789 /* Return a pointer to the data argument for OMP_TASK GS. */
5791 static inline tree
*
5792 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5794 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5795 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5796 return &omp_taskreg_stmt
->data_arg
;
5800 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5803 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5805 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5806 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5807 omp_taskreg_stmt
->data_arg
= data_arg
;
5811 /* Return the copy function used to hold the body of OMP_TASK GS. */
5814 gimple_omp_task_copy_fn (const gimple
*gs
)
5816 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5817 return omp_task_stmt
->copy_fn
;
5820 /* Return a pointer to the copy function used to hold the body of
5823 static inline tree
*
5824 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5826 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5827 return &omp_task_stmt
->copy_fn
;
5831 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5834 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5836 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5837 omp_task_stmt
->copy_fn
= copy_fn
;
5841 /* Return size of the data block in bytes in OMP_TASK GS. */
5844 gimple_omp_task_arg_size (const gimple
*gs
)
5846 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5847 return omp_task_stmt
->arg_size
;
5851 /* Return a pointer to the data block size for OMP_TASK GS. */
5853 static inline tree
*
5854 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5856 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5857 return &omp_task_stmt
->arg_size
;
5861 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5864 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5866 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5867 omp_task_stmt
->arg_size
= arg_size
;
5871 /* Return align of the data block in bytes in OMP_TASK GS. */
5874 gimple_omp_task_arg_align (const gimple
*gs
)
5876 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5877 return omp_task_stmt
->arg_align
;
5881 /* Return a pointer to the data block align for OMP_TASK GS. */
5883 static inline tree
*
5884 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5886 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5887 return &omp_task_stmt
->arg_align
;
5891 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5894 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5896 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5897 omp_task_stmt
->arg_align
= arg_align
;
5901 /* Return the clauses associated with OMP_SINGLE GS. */
5904 gimple_omp_single_clauses (const gimple
*gs
)
5906 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5907 return omp_single_stmt
->clauses
;
5911 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5913 static inline tree
*
5914 gimple_omp_single_clauses_ptr (gimple
*gs
)
5916 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5917 return &omp_single_stmt
->clauses
;
5921 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5924 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5926 omp_single_stmt
->clauses
= clauses
;
5930 /* Return the clauses associated with OMP_TARGET GS. */
5933 gimple_omp_target_clauses (const gimple
*gs
)
5935 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5936 return omp_target_stmt
->clauses
;
5940 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5942 static inline tree
*
5943 gimple_omp_target_clauses_ptr (gimple
*gs
)
5945 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5946 return &omp_target_stmt
->clauses
;
5950 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5953 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5956 omp_target_stmt
->clauses
= clauses
;
5960 /* Return the kind of the OMP_TARGET G. */
5963 gimple_omp_target_kind (const gimple
*g
)
5965 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5966 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5970 /* Set the kind of the OMP_TARGET G. */
5973 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5975 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5976 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5980 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5983 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5985 return omp_target_stmt
->child_fn
;
5988 /* Return a pointer to the child function used to hold the body of
5991 static inline tree
*
5992 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5994 return &omp_target_stmt
->child_fn
;
5998 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
6001 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
6004 omp_target_stmt
->child_fn
= child_fn
;
6008 /* Return the artificial argument used to send variables and values
6009 from the parent to the children threads in OMP_TARGET_STMT. */
6012 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
6014 return omp_target_stmt
->data_arg
;
6018 /* Return a pointer to the data argument for OMP_TARGET GS. */
6020 static inline tree
*
6021 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
6023 return &omp_target_stmt
->data_arg
;
6027 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
6030 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
6033 omp_target_stmt
->data_arg
= data_arg
;
6037 /* Return the clauses associated with OMP_TEAMS GS. */
6040 gimple_omp_teams_clauses (const gimple
*gs
)
6042 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
6043 return omp_teams_stmt
->clauses
;
6047 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
6049 static inline tree
*
6050 gimple_omp_teams_clauses_ptr (gimple
*gs
)
6052 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
6053 return &omp_teams_stmt
->clauses
;
6057 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
6060 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
6062 omp_teams_stmt
->clauses
= clauses
;
6065 /* Return the child function used to hold the body of OMP_TEAMS_STMT. */
6068 gimple_omp_teams_child_fn (const gomp_teams
*omp_teams_stmt
)
6070 return omp_teams_stmt
->child_fn
;
6073 /* Return a pointer to the child function used to hold the body of
6076 static inline tree
*
6077 gimple_omp_teams_child_fn_ptr (gomp_teams
*omp_teams_stmt
)
6079 return &omp_teams_stmt
->child_fn
;
6083 /* Set CHILD_FN to be the child function for OMP_TEAMS_STMT. */
6086 gimple_omp_teams_set_child_fn (gomp_teams
*omp_teams_stmt
, tree child_fn
)
6088 omp_teams_stmt
->child_fn
= child_fn
;
6092 /* Return the artificial argument used to send variables and values
6093 from the parent to the children threads in OMP_TEAMS_STMT. */
6096 gimple_omp_teams_data_arg (const gomp_teams
*omp_teams_stmt
)
6098 return omp_teams_stmt
->data_arg
;
6102 /* Return a pointer to the data argument for OMP_TEAMS_STMT. */
6104 static inline tree
*
6105 gimple_omp_teams_data_arg_ptr (gomp_teams
*omp_teams_stmt
)
6107 return &omp_teams_stmt
->data_arg
;
6111 /* Set DATA_ARG to be the data argument for OMP_TEAMS_STMT. */
6114 gimple_omp_teams_set_data_arg (gomp_teams
*omp_teams_stmt
, tree data_arg
)
6116 omp_teams_stmt
->data_arg
= data_arg
;
6119 /* Return the host flag of an OMP_TEAMS_STMT. */
6122 gimple_omp_teams_host (const gomp_teams
*omp_teams_stmt
)
6124 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_HOST
) != 0;
6127 /* Set host flag of an OMP_TEAMS_STMT to VALUE. */
6130 gimple_omp_teams_set_host (gomp_teams
*omp_teams_stmt
, bool value
)
6133 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_HOST
;
6135 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_HOST
;
6138 /* Return the clauses associated with OMP_SECTIONS GS. */
6141 gimple_omp_sections_clauses (const gimple
*gs
)
6143 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6144 return omp_sections_stmt
->clauses
;
6148 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
6150 static inline tree
*
6151 gimple_omp_sections_clauses_ptr (gimple
*gs
)
6153 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6154 return &omp_sections_stmt
->clauses
;
6158 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
6162 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
6164 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6165 omp_sections_stmt
->clauses
= clauses
;
6169 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
6173 gimple_omp_sections_control (const gimple
*gs
)
6175 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
6176 return omp_sections_stmt
->control
;
6180 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
6183 static inline tree
*
6184 gimple_omp_sections_control_ptr (gimple
*gs
)
6186 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6187 return &omp_sections_stmt
->control
;
6191 /* Set CONTROL to be the set of clauses associated with the
6192 GIMPLE_OMP_SECTIONS in GS. */
6195 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
6197 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
6198 omp_sections_stmt
->control
= control
;
6202 /* Set the value being stored in an atomic store. */
6205 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
6207 store_stmt
->val
= val
;
6211 /* Return the value being stored in an atomic store. */
6214 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
6216 return store_stmt
->val
;
6220 /* Return a pointer to the value being stored in an atomic store. */
6222 static inline tree
*
6223 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
6225 return &store_stmt
->val
;
6229 /* Set the LHS of an atomic load. */
6232 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
6234 load_stmt
->lhs
= lhs
;
6238 /* Get the LHS of an atomic load. */
6241 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
6243 return load_stmt
->lhs
;
6247 /* Return a pointer to the LHS of an atomic load. */
6249 static inline tree
*
6250 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
6252 return &load_stmt
->lhs
;
6256 /* Set the RHS of an atomic load. */
6259 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
6261 load_stmt
->rhs
= rhs
;
6265 /* Get the RHS of an atomic load. */
6268 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
6270 return load_stmt
->rhs
;
6274 /* Return a pointer to the RHS of an atomic load. */
6276 static inline tree
*
6277 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
6279 return &load_stmt
->rhs
;
6283 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6286 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
6288 return cont_stmt
->control_def
;
6291 /* The same as above, but return the address. */
6293 static inline tree
*
6294 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
6296 return &cont_stmt
->control_def
;
6299 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6302 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
6304 cont_stmt
->control_def
= def
;
6308 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6311 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
6313 return cont_stmt
->control_use
;
6317 /* The same as above, but return the address. */
6319 static inline tree
*
6320 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
6322 return &cont_stmt
->control_use
;
6326 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6329 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
6331 cont_stmt
->control_use
= use
;
6334 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6335 TRANSACTION_STMT. */
6337 static inline gimple_seq
*
6338 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
6340 return &transaction_stmt
->body
;
6343 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6345 static inline gimple_seq
6346 gimple_transaction_body (const gtransaction
*transaction_stmt
)
6348 return transaction_stmt
->body
;
6351 /* Return the label associated with a GIMPLE_TRANSACTION. */
6354 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
6356 return transaction_stmt
->label_norm
;
6359 static inline tree
*
6360 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
6362 return &transaction_stmt
->label_norm
;
6366 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
6368 return transaction_stmt
->label_uninst
;
6371 static inline tree
*
6372 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
6374 return &transaction_stmt
->label_uninst
;
6378 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
6380 return transaction_stmt
->label_over
;
6383 static inline tree
*
6384 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
6386 return &transaction_stmt
->label_over
;
6389 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6391 static inline unsigned int
6392 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
6394 return transaction_stmt
->subcode
;
6397 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6398 TRANSACTION_STMT. */
6401 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
6404 transaction_stmt
->body
= body
;
6407 /* Set the label associated with a GIMPLE_TRANSACTION. */
6410 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
6412 transaction_stmt
->label_norm
= label
;
6416 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6418 transaction_stmt
->label_uninst
= label
;
6422 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6424 transaction_stmt
->label_over
= label
;
6427 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6430 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6431 unsigned int subcode
)
6433 transaction_stmt
->subcode
= subcode
;
6436 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6438 static inline tree
*
6439 gimple_return_retval_ptr (greturn
*gs
)
6444 /* Return the return value for GIMPLE_RETURN GS. */
6447 gimple_return_retval (const greturn
*gs
)
6453 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6456 gimple_return_set_retval (greturn
*gs
, tree retval
)
6462 /* Returns true when the gimple statement STMT is any of the OMP types. */
6464 #define CASE_GIMPLE_OMP \
6465 case GIMPLE_OMP_PARALLEL: \
6466 case GIMPLE_OMP_TASK: \
6467 case GIMPLE_OMP_FOR: \
6468 case GIMPLE_OMP_SECTIONS: \
6469 case GIMPLE_OMP_SECTIONS_SWITCH: \
6470 case GIMPLE_OMP_SINGLE: \
6471 case GIMPLE_OMP_TARGET: \
6472 case GIMPLE_OMP_TEAMS: \
6473 case GIMPLE_OMP_SECTION: \
6474 case GIMPLE_OMP_MASTER: \
6475 case GIMPLE_OMP_TASKGROUP: \
6476 case GIMPLE_OMP_ORDERED: \
6477 case GIMPLE_OMP_CRITICAL: \
6478 case GIMPLE_OMP_SCAN: \
6479 case GIMPLE_OMP_RETURN: \
6480 case GIMPLE_OMP_ATOMIC_LOAD: \
6481 case GIMPLE_OMP_ATOMIC_STORE: \
6482 case GIMPLE_OMP_CONTINUE
6485 is_gimple_omp (const gimple
*stmt
)
6487 switch (gimple_code (stmt
))
6496 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6500 is_gimple_omp_oacc (const gimple
*stmt
)
6502 gcc_assert (is_gimple_omp (stmt
));
6503 switch (gimple_code (stmt
))
6505 case GIMPLE_OMP_ATOMIC_LOAD
:
6506 case GIMPLE_OMP_ATOMIC_STORE
:
6507 case GIMPLE_OMP_CONTINUE
:
6508 case GIMPLE_OMP_RETURN
:
6509 /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate
6513 case GIMPLE_OMP_FOR
:
6514 switch (gimple_omp_for_kind (stmt
))
6516 case GF_OMP_FOR_KIND_OACC_LOOP
:
6521 case GIMPLE_OMP_TARGET
:
6522 switch (gimple_omp_target_kind (stmt
))
6524 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6525 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6526 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
6527 case GF_OMP_TARGET_KIND_OACC_DATA
:
6528 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6529 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
6530 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
6531 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6532 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6533 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
6534 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
6535 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
6546 /* Return true if the OMP gimple statement STMT is offloaded. */
6549 is_gimple_omp_offloaded (const gimple
*stmt
)
6551 gcc_assert (is_gimple_omp (stmt
));
6552 switch (gimple_code (stmt
))
6554 case GIMPLE_OMP_TARGET
:
6555 switch (gimple_omp_target_kind (stmt
))
6557 case GF_OMP_TARGET_KIND_REGION
:
6558 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6559 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6560 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
6561 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
6562 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
6573 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6576 gimple_nop_p (const gimple
*g
)
6578 return gimple_code (g
) == GIMPLE_NOP
;
6582 /* Return true if GS is a GIMPLE_RESX. */
6585 is_gimple_resx (const gimple
*gs
)
6587 return gimple_code (gs
) == GIMPLE_RESX
;
6590 /* Return the type of the main expression computed by STMT. Return
6591 void_type_node if the statement computes nothing. */
6594 gimple_expr_type (const gimple
*stmt
)
6596 enum gimple_code code
= gimple_code (stmt
);
6597 /* In general we want to pass out a type that can be substituted
6598 for both the RHS and the LHS types if there is a possibly
6599 useless conversion involved. That means returning the
6600 original RHS type as far as we can reconstruct it. */
6601 if (code
== GIMPLE_CALL
)
6603 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6604 if (gimple_call_internal_p (call_stmt
))
6605 switch (gimple_call_internal_fn (call_stmt
))
6607 case IFN_MASK_STORE
:
6608 case IFN_SCATTER_STORE
:
6609 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6610 case IFN_MASK_SCATTER_STORE
:
6611 return TREE_TYPE (gimple_call_arg (call_stmt
, 4));
6615 return gimple_call_return_type (call_stmt
);
6617 else if (code
== GIMPLE_ASSIGN
)
6619 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6620 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6622 /* As fallback use the type of the LHS. */
6623 return TREE_TYPE (gimple_get_lhs (stmt
));
6625 else if (code
== GIMPLE_COND
)
6626 return boolean_type_node
;
6627 else if (code
== GIMPLE_PHI
)
6628 return TREE_TYPE (gimple_phi_result (stmt
));
6630 return void_type_node
;
6633 /* Enum and arrays used for allocation stats. Keep in sync with
6634 gimple.c:gimple_alloc_kind_names. */
6635 enum gimple_alloc_kind
6637 gimple_alloc_kind_assign
, /* Assignments. */
6638 gimple_alloc_kind_phi
, /* PHI nodes. */
6639 gimple_alloc_kind_cond
, /* Conditionals. */
6640 gimple_alloc_kind_rest
, /* Everything else. */
6641 gimple_alloc_kind_all
6644 extern uint64_t gimple_alloc_counts
[];
6645 extern uint64_t gimple_alloc_sizes
[];
6647 /* Return the allocation kind for a given stmt CODE. */
6648 static inline enum gimple_alloc_kind
6649 gimple_alloc_kind (enum gimple_code code
)
6654 return gimple_alloc_kind_assign
;
6656 return gimple_alloc_kind_phi
;
6658 return gimple_alloc_kind_cond
;
6660 return gimple_alloc_kind_rest
;
6664 /* Return true if a location should not be emitted for this statement
6665 by annotate_all_with_location. */
6668 gimple_do_not_emit_location_p (gimple
*g
)
6670 return gimple_plf (g
, GF_PLF_1
);
6673 /* Mark statement G so a location will not be emitted by
6674 annotate_one_with_location. */
6677 gimple_set_do_not_emit_location (gimple
*g
)
6679 /* The PLF flags are initialized to 0 when a new tuple is created,
6680 so no need to initialize it anywhere. */
6681 gimple_set_plf (g
, GF_PLF_1
, true);
6684 #endif /* GCC_GIMPLE_H */