1 /* Gimple IR definitions.
3 Copyright (C) 2007-2016 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
;
51 #define GIMPLE_CHECK(GS, CODE) \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
60 GIMPLE_CHECK2(const gimple
*gs
,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file
= __builtin_FILE (),
63 int line
= __builtin_LINE (),
64 const char *fun
= __builtin_FUNCTION ())
66 const char *file
= __FILE__
,
68 const char *fun
= NULL
)
71 T ret
= dyn_cast
<T
> (gs
);
73 gimple_check_failed (gs
, file
, line
, fun
,
74 remove_pointer
<T
>::type::code_
, ERROR_MARK
);
79 GIMPLE_CHECK2(gimple
*gs
,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file
= __builtin_FILE (),
82 int line
= __builtin_LINE (),
83 const char *fun
= __builtin_FUNCTION ())
85 const char *file
= __FILE__
,
87 const char *fun
= NULL
)
90 T ret
= dyn_cast
<T
> (gs
);
92 gimple_check_failed (gs
, file
, line
, fun
,
93 remove_pointer
<T
>::type::code_
, ERROR_MARK
);
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
101 GIMPLE_CHECK2(gimple
*gs
)
103 return as_a
<T
> (gs
);
105 template <typename T
>
107 GIMPLE_CHECK2(const gimple
*gs
)
109 return as_a
<T
> (gs
);
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
137 GF_ASM_INPUT
= 1 << 0,
138 GF_ASM_VOLATILE
= 1 << 1,
139 GF_CALL_FROM_THUNK
= 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
141 GF_CALL_TAILCALL
= 1 << 2,
142 GF_CALL_VA_ARG_PACK
= 1 << 3,
143 GF_CALL_NOTHROW
= 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
145 GF_CALL_INTERNAL
= 1 << 6,
146 GF_CALL_CTRL_ALTERING
= 1 << 7,
147 GF_CALL_WITH_BOUNDS
= 1 << 8,
148 GF_CALL_MUST_TAIL_CALL
= 1 << 9,
149 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
150 GF_OMP_PARALLEL_GRID_PHONY
= 1 << 1,
151 GF_OMP_TASK_TASKLOOP
= 1 << 0,
152 GF_OMP_FOR_KIND_MASK
= (1 << 4) - 1,
153 GF_OMP_FOR_KIND_FOR
= 0,
154 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
155 GF_OMP_FOR_KIND_TASKLOOP
= 2,
156 GF_OMP_FOR_KIND_CILKFOR
= 3,
157 GF_OMP_FOR_KIND_OACC_LOOP
= 4,
158 GF_OMP_FOR_KIND_GRID_LOOP
= 5,
159 /* Flag for SIMD variants of OMP_FOR kinds. */
160 GF_OMP_FOR_SIMD
= 1 << 3,
161 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
162 GF_OMP_FOR_KIND_CILKSIMD
= GF_OMP_FOR_SIMD
| 1,
163 GF_OMP_FOR_COMBINED
= 1 << 4,
164 GF_OMP_FOR_COMBINED_INTO
= 1 << 5,
165 GF_OMP_FOR_GRID_PHONY
= 1 << 6,
166 GF_OMP_TARGET_KIND_MASK
= (1 << 4) - 1,
167 GF_OMP_TARGET_KIND_REGION
= 0,
168 GF_OMP_TARGET_KIND_DATA
= 1,
169 GF_OMP_TARGET_KIND_UPDATE
= 2,
170 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
171 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
172 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
173 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
174 GF_OMP_TARGET_KIND_OACC_DATA
= 7,
175 GF_OMP_TARGET_KIND_OACC_UPDATE
= 8,
176 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
= 9,
177 GF_OMP_TARGET_KIND_OACC_DECLARE
= 10,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA
= 11,
179 GF_OMP_TEAMS_GRID_PHONY
= 1 << 0,
181 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
182 a thread synchronization via some sort of barrier. The exact barrier
183 that would otherwise be emitted is dependent on the OMP statement with
184 which this return is associated. */
185 GF_OMP_RETURN_NOWAIT
= 1 << 0,
187 GF_OMP_SECTION_LAST
= 1 << 0,
188 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
189 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
190 GF_PREDICT_TAKEN
= 1 << 15
193 /* Currently, there are only two types of gimple debug stmt. Others are
194 envisioned, for example, to enable the generation of is_stmt notes
195 in line number information, to mark sequence points, etc. This
196 subcode is to be used to tell them apart. */
197 enum gimple_debug_subcode
{
198 GIMPLE_DEBUG_BIND
= 0,
199 GIMPLE_DEBUG_SOURCE_BIND
= 1
202 /* Masks for selecting a pass local flag (PLF) to work on. These
203 masks are used by gimple_set_plf and gimple_plf. */
209 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
210 are for 64 bit hosts. */
212 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
213 chain_next ("%h.next"), variable_size
))
217 Main identifying code for a tuple. */
218 ENUM_BITFIELD(gimple_code
) code
: 8;
220 /* Nonzero if a warning should not be emitted on this tuple. */
221 unsigned int no_warning
: 1;
223 /* Nonzero if this tuple has been visited. Passes are responsible
224 for clearing this bit before using it. */
225 unsigned int visited
: 1;
227 /* Nonzero if this tuple represents a non-temporal move. */
228 unsigned int nontemporal_move
: 1;
230 /* Pass local flags. These flags are free for any pass to use as
231 they see fit. Passes should not assume that these flags contain
232 any useful value when the pass starts. Any initial state that
233 the pass requires should be set on entry to the pass. See
234 gimple_set_plf and gimple_plf for usage. */
235 unsigned int plf
: 2;
237 /* Nonzero if this statement has been modified and needs to have its
238 operands rescanned. */
239 unsigned modified
: 1;
241 /* Nonzero if this statement contains volatile operands. */
242 unsigned has_volatile_ops
: 1;
244 /* Padding to get subcode to 16 bit alignment. */
247 /* The SUBCODE field can be used for tuple-specific flags for tuples
248 that do not require subcodes. Note that SUBCODE should be at
249 least as wide as tree codes, as several tuples store tree codes
251 unsigned int subcode
: 16;
253 /* UID of this statement. This is used by passes that want to
254 assign IDs to statements. It must be assigned and used by each
255 pass. By default it should be assumed to contain garbage. */
259 Locus information for debug info. */
262 /* Number of operands in this tuple. */
266 Basic block holding this statement. */
270 Linked lists of gimple statements. The next pointers form
271 a NULL terminated list, the prev pointers are a cyclic list.
272 A gimple statement is hence also a double-ended list of
273 statements, with the pointer itself being the first element,
274 and the prev pointer being the last. */
276 gimple
*GTY((skip
)) prev
;
280 /* Base structure for tuples with operands. */
282 /* This gimple subclass has no tag value. */
284 gimple_statement_with_ops_base
: public gimple
286 /* [ WORD 1-6 ] : base class */
289 SSA operand vectors. NOTE: It should be possible to
290 amalgamate these vectors with the operand vector OP. However,
291 the SSA operand vectors are organized differently and contain
292 more information (like immediate use chaining). */
293 struct use_optype_d
GTY((skip (""))) *use_ops
;
297 /* Statements that take register operands. */
299 struct GTY((tag("GSS_WITH_OPS")))
300 gimple_statement_with_ops
: public gimple_statement_with_ops_base
302 /* [ WORD 1-7 ] : base class */
305 Operand vector. NOTE! This must always be the last field
306 of this structure. In particular, this means that this
307 structure cannot be embedded inside another one. */
308 tree
GTY((length ("%h.num_ops"))) op
[1];
312 /* Base for statements that take both memory and register operands. */
314 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
315 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
317 /* [ WORD 1-7 ] : base class */
320 Virtual operands for this statement. The GC will pick them
321 up via the ssa_names array. */
322 tree
GTY((skip (""))) vdef
;
323 tree
GTY((skip (""))) vuse
;
327 /* Statements that take both memory and register operands. */
329 struct GTY((tag("GSS_WITH_MEM_OPS")))
330 gimple_statement_with_memory_ops
:
331 public gimple_statement_with_memory_ops_base
333 /* [ WORD 1-9 ] : base class */
336 Operand vector. NOTE! This must always be the last field
337 of this structure. In particular, this means that this
338 structure cannot be embedded inside another one. */
339 tree
GTY((length ("%h.num_ops"))) op
[1];
343 /* Call statements that take both memory and register operands. */
345 struct GTY((tag("GSS_CALL")))
346 gcall
: public gimple_statement_with_memory_ops_base
348 /* [ WORD 1-9 ] : base class */
351 struct pt_solution call_used
;
352 struct pt_solution call_clobbered
;
355 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
356 tree
GTY ((tag ("0"))) fntype
;
357 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
361 Operand vector. NOTE! This must always be the last field
362 of this structure. In particular, this means that this
363 structure cannot be embedded inside another one. */
364 tree
GTY((length ("%h.num_ops"))) op
[1];
366 static const enum gimple_code code_
= GIMPLE_CALL
;
370 /* OMP statements. */
372 struct GTY((tag("GSS_OMP")))
373 gimple_statement_omp
: public gimple
375 /* [ WORD 1-6 ] : base class */
384 struct GTY((tag("GSS_BIND")))
385 gbind
: public gimple
387 /* [ WORD 1-6 ] : base class */
390 Variables declared in this scope. */
394 This is different than the BLOCK field in gimple,
395 which is analogous to TREE_BLOCK (i.e., the lexical block holding
396 this statement). This field is the equivalent of BIND_EXPR_BLOCK
397 in tree land (i.e., the lexical scope defined by this bind). See
408 struct GTY((tag("GSS_CATCH")))
409 gcatch
: public gimple
411 /* [ WORD 1-6 ] : base class */
421 /* GIMPLE_EH_FILTER */
423 struct GTY((tag("GSS_EH_FILTER")))
424 geh_filter
: public gimple
426 /* [ WORD 1-6 ] : base class */
439 struct GTY((tag("GSS_EH_ELSE")))
440 geh_else
: public gimple
442 /* [ WORD 1-6 ] : base class */
445 gimple_seq n_body
, e_body
;
448 /* GIMPLE_EH_MUST_NOT_THROW */
450 struct GTY((tag("GSS_EH_MNT")))
451 geh_mnt
: public gimple
453 /* [ WORD 1-6 ] : base class */
455 /* [ WORD 7 ] Abort function decl. */
461 struct GTY((tag("GSS_PHI")))
464 /* [ WORD 1-6 ] : base class */
474 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
478 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
480 struct GTY((tag("GSS_EH_CTRL")))
481 gimple_statement_eh_ctrl
: public gimple
483 /* [ WORD 1-6 ] : base class */
486 Exception region number. */
490 struct GTY((tag("GSS_EH_CTRL")))
491 gresx
: public gimple_statement_eh_ctrl
493 /* No extra fields; adds invariant:
494 stmt->code == GIMPLE_RESX. */
497 struct GTY((tag("GSS_EH_CTRL")))
498 geh_dispatch
: public gimple_statement_eh_ctrl
500 /* No extra fields; adds invariant:
501 stmt->code == GIMPLE_EH_DISPATH. */
507 struct GTY((tag("GSS_TRY")))
510 /* [ WORD 1-6 ] : base class */
513 Expression to evaluate. */
517 Cleanup expression. */
521 /* Kind of GIMPLE_TRY statements. */
522 enum gimple_try_flags
525 GIMPLE_TRY_CATCH
= 1 << 0,
528 GIMPLE_TRY_FINALLY
= 1 << 1,
529 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
531 /* Analogous to TRY_CATCH_IS_CLEANUP. */
532 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
535 /* GIMPLE_WITH_CLEANUP_EXPR */
537 struct GTY((tag("GSS_WCE")))
538 gimple_statement_wce
: public gimple
540 /* [ WORD 1-6 ] : base class */
542 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
543 executed if an exception is thrown, not on normal exit of its
544 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
548 Cleanup expression. */
555 struct GTY((tag("GSS_ASM")))
556 gasm
: public gimple_statement_with_memory_ops_base
558 /* [ WORD 1-9 ] : base class */
561 __asm__ statement. */
565 Number of inputs, outputs, clobbers, labels. */
572 Operand vector. NOTE! This must always be the last field
573 of this structure. In particular, this means that this
574 structure cannot be embedded inside another one. */
575 tree
GTY((length ("%h.num_ops"))) op
[1];
578 /* GIMPLE_OMP_CRITICAL */
580 struct GTY((tag("GSS_OMP_CRITICAL")))
581 gomp_critical
: public gimple_statement_omp
583 /* [ WORD 1-7 ] : base class */
589 Critical section name. */
594 struct GTY(()) gimple_omp_for_iter
{
595 /* Condition code. */
598 /* Index variable. */
613 struct GTY((tag("GSS_OMP_FOR")))
614 gomp_for
: public gimple_statement_omp
616 /* [ WORD 1-7 ] : base class */
622 Number of elements in iter array. */
626 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
629 Pre-body evaluated before the loop body begins. */
634 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
636 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
637 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
639 /* [ WORD 1-7 ] : base class */
646 Child function holding the body of the parallel region. */
650 Shared data argument. */
654 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
655 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
656 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
658 /* No extra fields; adds invariant:
659 stmt->code == GIMPLE_OMP_PARALLEL
660 || stmt->code == GIMPLE_OMP_TASK. */
663 /* GIMPLE_OMP_PARALLEL */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gomp_parallel
: public gimple_statement_omp_taskreg
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL. */
671 /* GIMPLE_OMP_TARGET */
672 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
673 gomp_target
: public gimple_statement_omp_parallel_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_TARGET. */
679 /* GIMPLE_OMP_TASK */
681 struct GTY((tag("GSS_OMP_TASK")))
682 gomp_task
: public gimple_statement_omp_taskreg
684 /* [ WORD 1-10 ] : base class */
687 Child function holding firstprivate initialization if needed. */
691 Size and alignment in bytes of the argument data block. */
697 /* GIMPLE_OMP_SECTION */
698 /* Uses struct gimple_statement_omp. */
701 /* GIMPLE_OMP_SECTIONS */
703 struct GTY((tag("GSS_OMP_SECTIONS")))
704 gomp_sections
: public gimple_statement_omp
706 /* [ WORD 1-7 ] : base class */
712 The control variable used for deciding which of the sections to
717 /* GIMPLE_OMP_CONTINUE.
719 Note: This does not inherit from gimple_statement_omp, because we
720 do not need the body field. */
722 struct GTY((tag("GSS_OMP_CONTINUE")))
723 gomp_continue
: public gimple
725 /* [ WORD 1-6 ] : base class */
734 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
736 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
737 gimple_statement_omp_single_layout
: public gimple_statement_omp
739 /* [ WORD 1-7 ] : base class */
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gomp_single
: public gimple_statement_omp_single_layout
748 /* No extra fields; adds invariant:
749 stmt->code == GIMPLE_OMP_SINGLE. */
752 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
753 gomp_teams
: public gimple_statement_omp_single_layout
755 /* No extra fields; adds invariant:
756 stmt->code == GIMPLE_OMP_TEAMS. */
759 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
760 gomp_ordered
: public gimple_statement_omp_single_layout
762 /* No extra fields; adds invariant:
763 stmt->code == GIMPLE_OMP_ORDERED. */
767 /* GIMPLE_OMP_ATOMIC_LOAD.
768 Note: This is based on gimple, not g_s_omp, because g_s_omp
769 contains a sequence, which we don't need here. */
771 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
772 gomp_atomic_load
: public gimple
774 /* [ WORD 1-6 ] : base class */
780 /* GIMPLE_OMP_ATOMIC_STORE.
781 See note on GIMPLE_OMP_ATOMIC_LOAD. */
783 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
784 gimple_statement_omp_atomic_store_layout
: public gimple
786 /* [ WORD 1-6 ] : base class */
792 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
794 public gimple_statement_omp_atomic_store_layout
796 /* No extra fields; adds invariant:
797 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
800 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 gimple_statement_omp_return
:
802 public gimple_statement_omp_atomic_store_layout
804 /* No extra fields; adds invariant:
805 stmt->code == GIMPLE_OMP_RETURN. */
808 /* GIMPLE_TRANSACTION. */
810 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
812 /* The __transaction_atomic was declared [[outer]] or it is
813 __transaction_relaxed. */
814 #define GTMA_IS_OUTER (1u << 0)
815 #define GTMA_IS_RELAXED (1u << 1)
816 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
818 /* The transaction is seen to not have an abort. */
819 #define GTMA_HAVE_ABORT (1u << 2)
820 /* The transaction is seen to have loads or stores. */
821 #define GTMA_HAVE_LOAD (1u << 3)
822 #define GTMA_HAVE_STORE (1u << 4)
823 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
824 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
825 /* The transaction WILL enter serial irrevocable mode.
826 An irrevocable block post-dominates the entire transaction, such
827 that all invocations of the transaction will go serial-irrevocable.
828 In such case, we don't bother instrumenting the transaction, and
829 tell the runtime that it should begin the transaction in
830 serial-irrevocable mode. */
831 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
832 /* The transaction contains no instrumentation code whatsover, most
833 likely because it is guaranteed to go irrevocable upon entry. */
834 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
836 struct GTY((tag("GSS_TRANSACTION")))
837 gtransaction
: public gimple_statement_with_memory_ops_base
839 /* [ WORD 1-9 ] : base class */
850 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
851 enum gimple_statement_structure_enum
{
852 #include "gsstruct.def"
857 /* A statement with the invariant that
858 stmt->code == GIMPLE_COND
859 i.e. a conditional jump statement. */
861 struct GTY((tag("GSS_WITH_OPS")))
862 gcond
: public gimple_statement_with_ops
864 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
865 static const enum gimple_code code_
= GIMPLE_COND
;
868 /* A statement with the invariant that
869 stmt->code == GIMPLE_DEBUG
870 i.e. a debug statement. */
872 struct GTY((tag("GSS_WITH_OPS")))
873 gdebug
: public gimple_statement_with_ops
875 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
878 /* A statement with the invariant that
879 stmt->code == GIMPLE_GOTO
880 i.e. a goto statement. */
882 struct GTY((tag("GSS_WITH_OPS")))
883 ggoto
: public gimple_statement_with_ops
885 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
888 /* A statement with the invariant that
889 stmt->code == GIMPLE_LABEL
890 i.e. a label statement. */
892 struct GTY((tag("GSS_WITH_OPS")))
893 glabel
: public gimple_statement_with_ops
895 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
898 /* A statement with the invariant that
899 stmt->code == GIMPLE_SWITCH
900 i.e. a switch statement. */
902 struct GTY((tag("GSS_WITH_OPS")))
903 gswitch
: public gimple_statement_with_ops
905 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
908 /* A statement with the invariant that
909 stmt->code == GIMPLE_ASSIGN
910 i.e. an assignment statement. */
912 struct GTY((tag("GSS_WITH_MEM_OPS")))
913 gassign
: public gimple_statement_with_memory_ops
915 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
916 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
919 /* A statement with the invariant that
920 stmt->code == GIMPLE_RETURN
921 i.e. a return statement. */
923 struct GTY((tag("GSS_WITH_MEM_OPS")))
924 greturn
: public gimple_statement_with_memory_ops
926 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
932 is_a_helper
<gasm
*>::test (gimple
*gs
)
934 return gs
->code
== GIMPLE_ASM
;
940 is_a_helper
<gassign
*>::test (gimple
*gs
)
942 return gs
->code
== GIMPLE_ASSIGN
;
948 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
950 return gs
->code
== GIMPLE_ASSIGN
;
956 is_a_helper
<gbind
*>::test (gimple
*gs
)
958 return gs
->code
== GIMPLE_BIND
;
964 is_a_helper
<gcall
*>::test (gimple
*gs
)
966 return gs
->code
== GIMPLE_CALL
;
972 is_a_helper
<gcatch
*>::test (gimple
*gs
)
974 return gs
->code
== GIMPLE_CATCH
;
980 is_a_helper
<gcond
*>::test (gimple
*gs
)
982 return gs
->code
== GIMPLE_COND
;
988 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
990 return gs
->code
== GIMPLE_COND
;
996 is_a_helper
<gdebug
*>::test (gimple
*gs
)
998 return gs
->code
== GIMPLE_DEBUG
;
1004 is_a_helper
<ggoto
*>::test (gimple
*gs
)
1006 return gs
->code
== GIMPLE_GOTO
;
1012 is_a_helper
<glabel
*>::test (gimple
*gs
)
1014 return gs
->code
== GIMPLE_LABEL
;
1020 is_a_helper
<gresx
*>::test (gimple
*gs
)
1022 return gs
->code
== GIMPLE_RESX
;
1028 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1030 return gs
->code
== GIMPLE_EH_DISPATCH
;
1036 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1038 return gs
->code
== GIMPLE_EH_ELSE
;
1044 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1046 return gs
->code
== GIMPLE_EH_FILTER
;
1052 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1054 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1060 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1062 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1068 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1070 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1076 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1078 return gs
->code
== GIMPLE_OMP_RETURN
;
1084 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1086 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1092 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1094 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1100 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1102 return gs
->code
== GIMPLE_OMP_ORDERED
;
1108 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1110 return gs
->code
== GIMPLE_OMP_FOR
;
1116 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1118 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1124 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1126 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1132 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1134 return gs
->code
== GIMPLE_OMP_TARGET
;
1140 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1142 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1148 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1150 return gs
->code
== GIMPLE_OMP_SINGLE
;
1156 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1158 return gs
->code
== GIMPLE_OMP_TEAMS
;
1164 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1166 return gs
->code
== GIMPLE_OMP_TASK
;
1172 is_a_helper
<gphi
*>::test (gimple
*gs
)
1174 return gs
->code
== GIMPLE_PHI
;
1180 is_a_helper
<greturn
*>::test (gimple
*gs
)
1182 return gs
->code
== GIMPLE_RETURN
;
1188 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1190 return gs
->code
== GIMPLE_SWITCH
;
1196 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1198 return gs
->code
== GIMPLE_TRANSACTION
;
1204 is_a_helper
<gtry
*>::test (gimple
*gs
)
1206 return gs
->code
== GIMPLE_TRY
;
1212 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1214 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1220 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1222 return gs
->code
== GIMPLE_ASM
;
1228 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1230 return gs
->code
== GIMPLE_BIND
;
1236 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1238 return gs
->code
== GIMPLE_CALL
;
1244 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1246 return gs
->code
== GIMPLE_CATCH
;
1252 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1254 return gs
->code
== GIMPLE_RESX
;
1260 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1262 return gs
->code
== GIMPLE_EH_DISPATCH
;
1268 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1270 return gs
->code
== GIMPLE_EH_FILTER
;
1276 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1278 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1284 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1286 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1292 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1294 return gs
->code
== GIMPLE_OMP_RETURN
;
1300 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1302 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1308 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1310 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1316 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1318 return gs
->code
== GIMPLE_OMP_ORDERED
;
1324 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1326 return gs
->code
== GIMPLE_OMP_FOR
;
1332 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1334 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1340 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1342 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1348 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1350 return gs
->code
== GIMPLE_OMP_TARGET
;
1356 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1358 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1364 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1366 return gs
->code
== GIMPLE_OMP_SINGLE
;
1372 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1374 return gs
->code
== GIMPLE_OMP_TEAMS
;
1380 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1382 return gs
->code
== GIMPLE_OMP_TASK
;
1388 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1390 return gs
->code
== GIMPLE_PHI
;
1396 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1398 return gs
->code
== GIMPLE_TRANSACTION
;
1401 /* Offset in bytes to the location of the operand vector.
1402 Zero if there is no operand vector for this tuple structure. */
1403 extern size_t const gimple_ops_offset_
[];
1405 /* Map GIMPLE codes to GSS codes. */
1406 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1408 /* This variable holds the currently expanded gimple statement for purposes
1409 of comminucating the profile info to the builtin expanders. */
1410 extern gimple
*currently_expanding_gimple_stmt
;
1412 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1413 gimple
*gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
1414 greturn
*gimple_build_return (tree
);
1415 void gimple_call_reset_alias_info (gcall
*);
1416 gcall
*gimple_build_call_vec (tree
, vec
<tree
> );
1417 gcall
*gimple_build_call (tree
, unsigned, ...);
1418 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1419 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1420 gcall
*gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1421 gcall
*gimple_build_call_from_tree (tree
);
1422 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1423 gassign
*gimple_build_assign (tree
, enum tree_code
,
1424 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1425 gassign
*gimple_build_assign (tree
, enum tree_code
,
1426 tree
, tree CXX_MEM_STAT_INFO
);
1427 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1428 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1429 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1430 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1431 glabel
*gimple_build_label (tree label
);
1432 ggoto
*gimple_build_goto (tree dest
);
1433 gimple
*gimple_build_nop (void);
1434 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1435 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1436 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1437 vec
<tree
, va_gc
> *);
1438 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1439 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1440 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1441 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1442 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1443 enum gimple_try_flags
);
1444 gimple
*gimple_build_wce (gimple_seq
);
1445 gresx
*gimple_build_resx (int);
1446 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1447 gswitch
*gimple_build_switch (tree
, tree
, vec
<tree
> );
1448 geh_dispatch
*gimple_build_eh_dispatch (int);
1449 gdebug
*gimple_build_debug_bind_stat (tree
, tree
, gimple
* MEM_STAT_DECL
);
1450 #define gimple_build_debug_bind(var,val,stmt) \
1451 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1452 gdebug
*gimple_build_debug_source_bind_stat (tree
, tree
, gimple
* MEM_STAT_DECL
);
1453 #define gimple_build_debug_source_bind(var,val,stmt) \
1454 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1455 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1456 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1457 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1458 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1460 gimple
*gimple_build_omp_section (gimple_seq
);
1461 gimple
*gimple_build_omp_master (gimple_seq
);
1462 gimple
*gimple_build_omp_grid_body (gimple_seq
);
1463 gimple
*gimple_build_omp_taskgroup (gimple_seq
);
1464 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1465 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1466 gimple
*gimple_build_omp_return (bool);
1467 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1468 gimple
*gimple_build_omp_sections_switch (void);
1469 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1470 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1471 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1472 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
);
1473 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
);
1474 gtransaction
*gimple_build_transaction (gimple_seq
);
1475 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1476 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1477 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1478 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1479 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1481 extern void annotate_all_with_location (gimple_seq
, location_t
);
1482 bool empty_body_p (gimple_seq
);
1483 gimple_seq
gimple_seq_copy (gimple_seq
);
1484 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1485 int gimple_call_flags (const gimple
*);
1486 int gimple_call_arg_flags (const gcall
*, unsigned);
1487 int gimple_call_return_flags (const gcall
*);
1488 bool gimple_assign_copy_p (gimple
*);
1489 bool gimple_assign_ssa_name_copy_p (gimple
*);
1490 bool gimple_assign_unary_nop_p (gimple
*);
1491 void gimple_set_bb (gimple
*, basic_block
);
1492 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1493 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1495 tree
gimple_get_lhs (const gimple
*);
1496 void gimple_set_lhs (gimple
*, tree
);
1497 gimple
*gimple_copy (gimple
*);
1498 bool gimple_has_side_effects (const gimple
*);
1499 bool gimple_could_trap_p_1 (gimple
*, bool, bool);
1500 bool gimple_could_trap_p (gimple
*);
1501 bool gimple_assign_rhs_could_trap_p (gimple
*);
1502 extern void dump_gimple_statistics (void);
1503 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1504 extern tree
canonicalize_cond_expr_cond (tree
);
1505 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1506 extern bool gimple_compare_field_offset (tree
, tree
);
1507 extern tree
gimple_unsigned_type (tree
);
1508 extern tree
gimple_signed_type (tree
);
1509 extern alias_set_type
gimple_get_alias_set (tree
);
1510 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1511 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1512 extern combined_fn
gimple_call_combined_fn (const gimple
*);
1513 extern bool gimple_call_builtin_p (const gimple
*);
1514 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1515 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1516 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1517 extern void dump_decl_set (FILE *, bitmap
);
1518 extern bool nonfreeing_call_p (gimple
*);
1519 extern bool nonbarrier_call_p (gimple
*);
1520 extern bool infer_nonnull_range (gimple
*, tree
);
1521 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1522 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1523 extern void sort_case_labels (vec
<tree
>);
1524 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1525 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1526 extern void gimple_seq_discard (gimple_seq
);
1527 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1528 extern bool gimple_inexpensive_call_p (gcall
*);
1530 /* Formal (expression) temporary table handling: multiple occurrences of
1531 the same scalar expression are evaluated into the same temporary. */
1533 typedef struct gimple_temp_hash_elt
1536 tree temp
; /* Value */
1539 /* Get the number of the next statement uid to be allocated. */
1540 static inline unsigned int
1541 gimple_stmt_max_uid (struct function
*fn
)
1543 return fn
->last_stmt_uid
;
1546 /* Set the number of the next statement uid to be allocated. */
1548 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1550 fn
->last_stmt_uid
= maxid
;
1553 /* Set the number of the next statement uid to be allocated. */
1554 static inline unsigned int
1555 inc_gimple_stmt_max_uid (struct function
*fn
)
1557 return fn
->last_stmt_uid
++;
1560 /* Return the first node in GIMPLE sequence S. */
1562 static inline gimple_seq_node
1563 gimple_seq_first (gimple_seq s
)
1569 /* Return the first statement in GIMPLE sequence S. */
1571 static inline gimple
*
1572 gimple_seq_first_stmt (gimple_seq s
)
1574 gimple_seq_node n
= gimple_seq_first (s
);
1578 /* Return the first statement in GIMPLE sequence S as a gbind *,
1579 verifying that it has code GIMPLE_BIND in a checked build. */
1581 static inline gbind
*
1582 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1584 gimple_seq_node n
= gimple_seq_first (s
);
1585 return as_a
<gbind
*> (n
);
1589 /* Return the last node in GIMPLE sequence S. */
1591 static inline gimple_seq_node
1592 gimple_seq_last (gimple_seq s
)
1594 return s
? s
->prev
: NULL
;
1598 /* Return the last statement in GIMPLE sequence S. */
1600 static inline gimple
*
1601 gimple_seq_last_stmt (gimple_seq s
)
1603 gimple_seq_node n
= gimple_seq_last (s
);
1608 /* Set the last node in GIMPLE sequence *PS to LAST. */
1611 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1617 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1620 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1626 /* Return true if GIMPLE sequence S is empty. */
1629 gimple_seq_empty_p (gimple_seq s
)
1634 /* Allocate a new sequence and initialize its first element with STMT. */
1636 static inline gimple_seq
1637 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1639 gimple_seq seq
= NULL
;
1640 gimple_seq_add_stmt (&seq
, stmt
);
1645 /* Returns the sequence of statements in BB. */
1647 static inline gimple_seq
1648 bb_seq (const_basic_block bb
)
1650 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1653 static inline gimple_seq
*
1654 bb_seq_addr (basic_block bb
)
1656 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1659 /* Sets the sequence of statements in BB to SEQ. */
1662 set_bb_seq (basic_block bb
, gimple_seq seq
)
1664 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1665 bb
->il
.gimple
.seq
= seq
;
1669 /* Return the code for GIMPLE statement G. */
1671 static inline enum gimple_code
1672 gimple_code (const gimple
*g
)
1678 /* Return the GSS code used by a GIMPLE code. */
1680 static inline enum gimple_statement_structure_enum
1681 gss_for_code (enum gimple_code code
)
1683 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1684 return gss_for_code_
[code
];
1688 /* Return which GSS code is used by GS. */
1690 static inline enum gimple_statement_structure_enum
1691 gimple_statement_structure (gimple
*gs
)
1693 return gss_for_code (gimple_code (gs
));
1697 /* Return true if statement G has sub-statements. This is only true for
1698 High GIMPLE statements. */
1701 gimple_has_substatements (gimple
*g
)
1703 switch (gimple_code (g
))
1707 case GIMPLE_EH_FILTER
:
1708 case GIMPLE_EH_ELSE
:
1710 case GIMPLE_OMP_FOR
:
1711 case GIMPLE_OMP_MASTER
:
1712 case GIMPLE_OMP_TASKGROUP
:
1713 case GIMPLE_OMP_ORDERED
:
1714 case GIMPLE_OMP_SECTION
:
1715 case GIMPLE_OMP_PARALLEL
:
1716 case GIMPLE_OMP_TASK
:
1717 case GIMPLE_OMP_SECTIONS
:
1718 case GIMPLE_OMP_SINGLE
:
1719 case GIMPLE_OMP_TARGET
:
1720 case GIMPLE_OMP_TEAMS
:
1721 case GIMPLE_OMP_CRITICAL
:
1722 case GIMPLE_WITH_CLEANUP_EXPR
:
1723 case GIMPLE_TRANSACTION
:
1724 case GIMPLE_OMP_GRID_BODY
:
1733 /* Return the basic block holding statement G. */
1735 static inline basic_block
1736 gimple_bb (const gimple
*g
)
1742 /* Return the lexical scope block holding statement G. */
1745 gimple_block (const gimple
*g
)
1747 return LOCATION_BLOCK (g
->location
);
1751 /* Set BLOCK to be the lexical scope block holding statement G. */
1754 gimple_set_block (gimple
*g
, tree block
)
1756 g
->location
= set_block (g
->location
, block
);
1760 /* Return location information for statement G. */
1762 static inline location_t
1763 gimple_location (const gimple
*g
)
1768 /* Return location information for statement G if g is not NULL.
1769 Otherwise, UNKNOWN_LOCATION is returned. */
1771 static inline location_t
1772 gimple_location_safe (const gimple
*g
)
1774 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1777 /* Set location information for statement G. */
1780 gimple_set_location (gimple
*g
, location_t location
)
1782 g
->location
= location
;
1786 /* Return true if G contains location information. */
1789 gimple_has_location (const gimple
*g
)
1791 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1795 /* Return the file name of the location of STMT. */
1797 static inline const char *
1798 gimple_filename (const gimple
*stmt
)
1800 return LOCATION_FILE (gimple_location (stmt
));
1804 /* Return the line number of the location of STMT. */
1807 gimple_lineno (const gimple
*stmt
)
1809 return LOCATION_LINE (gimple_location (stmt
));
1813 /* Determine whether SEQ is a singleton. */
1816 gimple_seq_singleton_p (gimple_seq seq
)
1818 return ((gimple_seq_first (seq
) != NULL
)
1819 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1822 /* Return true if no warnings should be emitted for statement STMT. */
1825 gimple_no_warning_p (const gimple
*stmt
)
1827 return stmt
->no_warning
;
1830 /* Set the no_warning flag of STMT to NO_WARNING. */
1833 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1835 stmt
->no_warning
= (unsigned) no_warning
;
1838 /* Set the visited status on statement STMT to VISITED_P.
1840 Please note that this 'visited' property of the gimple statement is
1841 supposed to be undefined at pass boundaries. This means that a
1842 given pass should not assume it contains any useful value when the
1843 pass starts and thus can set it to any value it sees fit.
1845 You can learn more about the visited property of the gimple
1846 statement by reading the comments of the 'visited' data member of
1851 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1853 stmt
->visited
= (unsigned) visited_p
;
1857 /* Return the visited status for statement STMT.
1859 Please note that this 'visited' property of the gimple statement is
1860 supposed to be undefined at pass boundaries. This means that a
1861 given pass should not assume it contains any useful value when the
1862 pass starts and thus can set it to any value it sees fit.
1864 You can learn more about the visited property of the gimple
1865 statement by reading the comments of the 'visited' data member of
1869 gimple_visited_p (gimple
*stmt
)
1871 return stmt
->visited
;
1875 /* Set pass local flag PLF on statement STMT to VAL_P.
1877 Please note that this PLF property of the gimple statement is
1878 supposed to be undefined at pass boundaries. This means that a
1879 given pass should not assume it contains any useful value when the
1880 pass starts and thus can set it to any value it sees fit.
1882 You can learn more about the PLF property by reading the comment of
1883 the 'plf' data member of struct gimple_statement_structure. */
1886 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
1889 stmt
->plf
|= (unsigned int) plf
;
1891 stmt
->plf
&= ~((unsigned int) plf
);
1895 /* Return the value of pass local flag PLF on statement STMT.
1897 Please note that this 'plf' property of the gimple statement is
1898 supposed to be undefined at pass boundaries. This means that a
1899 given pass should not assume it contains any useful value when the
1900 pass starts and thus can set it to any value it sees fit.
1902 You can learn more about the plf property by reading the comment of
1903 the 'plf' data member of struct gimple_statement_structure. */
1905 static inline unsigned int
1906 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
1908 return stmt
->plf
& ((unsigned int) plf
);
1912 /* Set the UID of statement.
1914 Please note that this UID property is supposed to be undefined at
1915 pass boundaries. This means that a given pass should not assume it
1916 contains any useful value when the pass starts and thus can set it
1917 to any value it sees fit. */
1920 gimple_set_uid (gimple
*g
, unsigned uid
)
1926 /* Return the UID of statement.
1928 Please note that this UID property is supposed to be undefined at
1929 pass boundaries. This means that a given pass should not assume it
1930 contains any useful value when the pass starts and thus can set it
1931 to any value it sees fit. */
1933 static inline unsigned
1934 gimple_uid (const gimple
*g
)
1940 /* Make statement G a singleton sequence. */
1943 gimple_init_singleton (gimple
*g
)
1950 /* Return true if GIMPLE statement G has register or memory operands. */
1953 gimple_has_ops (const gimple
*g
)
1955 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1961 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
1963 return gimple_has_ops (gs
);
1969 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
1971 return gimple_has_ops (gs
);
1974 /* Return true if GIMPLE statement G has memory operands. */
1977 gimple_has_mem_ops (const gimple
*g
)
1979 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1985 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
1987 return gimple_has_mem_ops (gs
);
1993 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
1995 return gimple_has_mem_ops (gs
);
1998 /* Return the set of USE operands for statement G. */
2000 static inline struct use_optype_d
*
2001 gimple_use_ops (const gimple
*g
)
2003 const gimple_statement_with_ops
*ops_stmt
=
2004 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2007 return ops_stmt
->use_ops
;
2011 /* Set USE to be the set of USE operands for statement G. */
2014 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2016 gimple_statement_with_ops
*ops_stmt
=
2017 as_a
<gimple_statement_with_ops
*> (g
);
2018 ops_stmt
->use_ops
= use
;
2022 /* Return the single VUSE operand of the statement G. */
2025 gimple_vuse (const gimple
*g
)
2027 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2028 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2031 return mem_ops_stmt
->vuse
;
2034 /* Return the single VDEF operand of the statement G. */
2037 gimple_vdef (const gimple
*g
)
2039 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2040 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2043 return mem_ops_stmt
->vdef
;
2046 /* Return the single VUSE operand of the statement G. */
2048 static inline tree
*
2049 gimple_vuse_ptr (gimple
*g
)
2051 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2052 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2055 return &mem_ops_stmt
->vuse
;
2058 /* Return the single VDEF operand of the statement G. */
2060 static inline tree
*
2061 gimple_vdef_ptr (gimple
*g
)
2063 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2064 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2067 return &mem_ops_stmt
->vdef
;
2070 /* Set the single VUSE operand of the statement G. */
2073 gimple_set_vuse (gimple
*g
, tree vuse
)
2075 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2076 as_a
<gimple_statement_with_memory_ops
*> (g
);
2077 mem_ops_stmt
->vuse
= vuse
;
2080 /* Set the single VDEF operand of the statement G. */
2083 gimple_set_vdef (gimple
*g
, tree vdef
)
2085 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2086 as_a
<gimple_statement_with_memory_ops
*> (g
);
2087 mem_ops_stmt
->vdef
= vdef
;
2091 /* Return true if statement G has operands and the modified field has
2095 gimple_modified_p (const gimple
*g
)
2097 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2101 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2102 a MODIFIED field. */
2105 gimple_set_modified (gimple
*s
, bool modifiedp
)
2107 if (gimple_has_ops (s
))
2108 s
->modified
= (unsigned) modifiedp
;
2112 /* Return the tree code for the expression computed by STMT. This is
2113 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2114 GIMPLE_CALL, return CALL_EXPR as the expression code for
2115 consistency. This is useful when the caller needs to deal with the
2116 three kinds of computation that GIMPLE supports. */
2118 static inline enum tree_code
2119 gimple_expr_code (const gimple
*stmt
)
2121 enum gimple_code code
= gimple_code (stmt
);
2122 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
2123 return (enum tree_code
) stmt
->subcode
;
2126 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
2132 /* Return true if statement STMT contains volatile operands. */
2135 gimple_has_volatile_ops (const gimple
*stmt
)
2137 if (gimple_has_mem_ops (stmt
))
2138 return stmt
->has_volatile_ops
;
2144 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2147 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2149 if (gimple_has_mem_ops (stmt
))
2150 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2153 /* Return true if STMT is in a transaction. */
2156 gimple_in_transaction (const gimple
*stmt
)
2158 return bb_in_transaction (gimple_bb (stmt
));
2161 /* Return true if statement STMT may access memory. */
2164 gimple_references_memory_p (gimple
*stmt
)
2166 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2170 /* Return the subcode for OMP statement S. */
2172 static inline unsigned
2173 gimple_omp_subcode (const gimple
*s
)
2175 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2176 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2180 /* Set the subcode for OMP statement S to SUBCODE. */
2183 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2185 /* We only have 16 bits for the subcode. Assert that we are not
2187 gcc_gimple_checking_assert (subcode
< (1 << 16));
2188 s
->subcode
= subcode
;
2191 /* Set the nowait flag on OMP_RETURN statement S. */
2194 gimple_omp_return_set_nowait (gimple
*s
)
2196 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2197 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2201 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2205 gimple_omp_return_nowait_p (const gimple
*g
)
2207 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2208 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2212 /* Set the LHS of OMP return. */
2215 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2217 gimple_statement_omp_return
*omp_return_stmt
=
2218 as_a
<gimple_statement_omp_return
*> (g
);
2219 omp_return_stmt
->val
= lhs
;
2223 /* Get the LHS of OMP return. */
2226 gimple_omp_return_lhs (const gimple
*g
)
2228 const gimple_statement_omp_return
*omp_return_stmt
=
2229 as_a
<const gimple_statement_omp_return
*> (g
);
2230 return omp_return_stmt
->val
;
2234 /* Return a pointer to the LHS of OMP return. */
2236 static inline tree
*
2237 gimple_omp_return_lhs_ptr (gimple
*g
)
2239 gimple_statement_omp_return
*omp_return_stmt
=
2240 as_a
<gimple_statement_omp_return
*> (g
);
2241 return &omp_return_stmt
->val
;
2245 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2249 gimple_omp_section_last_p (const gimple
*g
)
2251 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2252 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2256 /* Set the GF_OMP_SECTION_LAST flag on G. */
2259 gimple_omp_section_set_last (gimple
*g
)
2261 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2262 g
->subcode
|= GF_OMP_SECTION_LAST
;
2266 /* Return true if OMP parallel statement G has the
2267 GF_OMP_PARALLEL_COMBINED flag set. */
2270 gimple_omp_parallel_combined_p (const gimple
*g
)
2272 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2273 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2277 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2278 value of COMBINED_P. */
2281 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2283 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2285 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2287 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2291 /* Return true if OMP atomic load/store statement G has the
2292 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2295 gimple_omp_atomic_need_value_p (const gimple
*g
)
2297 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2298 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2299 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2303 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2306 gimple_omp_atomic_set_need_value (gimple
*g
)
2308 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2309 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2310 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2314 /* Return true if OMP atomic load/store statement G has the
2315 GF_OMP_ATOMIC_SEQ_CST flag set. */
2318 gimple_omp_atomic_seq_cst_p (const gimple
*g
)
2320 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2321 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2322 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2326 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2329 gimple_omp_atomic_set_seq_cst (gimple
*g
)
2331 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2332 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2333 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2337 /* Return the number of operands for statement GS. */
2339 static inline unsigned
2340 gimple_num_ops (const gimple
*gs
)
2346 /* Set the number of operands for statement GS. */
2349 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2351 gs
->num_ops
= num_ops
;
2355 /* Return the array of operands for statement GS. */
2357 static inline tree
*
2358 gimple_ops (gimple
*gs
)
2362 /* All the tuples have their operand vector at the very bottom
2363 of the structure. Note that those structures that do not
2364 have an operand vector have a zero offset. */
2365 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2366 gcc_gimple_checking_assert (off
!= 0);
2368 return (tree
*) ((char *) gs
+ off
);
2372 /* Return operand I for statement GS. */
2375 gimple_op (const gimple
*gs
, unsigned i
)
2377 if (gimple_has_ops (gs
))
2379 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2380 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2386 /* Return a pointer to operand I for statement GS. */
2388 static inline tree
*
2389 gimple_op_ptr (gimple
*gs
, unsigned i
)
2391 if (gimple_has_ops (gs
))
2393 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2394 return gimple_ops (gs
) + i
;
2400 /* Set operand I of statement GS to OP. */
2403 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2405 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2407 /* Note. It may be tempting to assert that OP matches
2408 is_gimple_operand, but that would be wrong. Different tuples
2409 accept slightly different sets of tree operands. Each caller
2410 should perform its own validation. */
2411 gimple_ops (gs
)[i
] = op
;
2414 /* Return true if GS is a GIMPLE_ASSIGN. */
2417 is_gimple_assign (const gimple
*gs
)
2419 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2422 /* Determine if expression CODE is one of the valid expressions that can
2423 be used on the RHS of GIMPLE assignments. */
2425 static inline enum gimple_rhs_class
2426 get_gimple_rhs_class (enum tree_code code
)
2428 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2431 /* Return the LHS of assignment statement GS. */
2434 gimple_assign_lhs (const gassign
*gs
)
2440 gimple_assign_lhs (const gimple
*gs
)
2442 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2443 return gimple_assign_lhs (ass
);
2447 /* Return a pointer to the LHS of assignment statement GS. */
2449 static inline tree
*
2450 gimple_assign_lhs_ptr (gassign
*gs
)
2455 static inline tree
*
2456 gimple_assign_lhs_ptr (gimple
*gs
)
2458 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2459 return gimple_assign_lhs_ptr (ass
);
2463 /* Set LHS to be the LHS operand of assignment statement GS. */
2466 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2470 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2471 SSA_NAME_DEF_STMT (lhs
) = gs
;
2475 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2477 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2478 gimple_assign_set_lhs (ass
, lhs
);
2482 /* Return the first operand on the RHS of assignment statement GS. */
2485 gimple_assign_rhs1 (const gassign
*gs
)
2491 gimple_assign_rhs1 (const gimple
*gs
)
2493 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2494 return gimple_assign_rhs1 (ass
);
2498 /* Return a pointer to the first operand on the RHS of assignment
2501 static inline tree
*
2502 gimple_assign_rhs1_ptr (gassign
*gs
)
2507 static inline tree
*
2508 gimple_assign_rhs1_ptr (gimple
*gs
)
2510 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2511 return gimple_assign_rhs1_ptr (ass
);
2514 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2517 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2523 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2525 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2526 gimple_assign_set_rhs1 (ass
, rhs
);
2530 /* Return the second operand on the RHS of assignment statement GS.
2531 If GS does not have two operands, NULL is returned instead. */
2534 gimple_assign_rhs2 (const gassign
*gs
)
2536 if (gimple_num_ops (gs
) >= 3)
2543 gimple_assign_rhs2 (const gimple
*gs
)
2545 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2546 return gimple_assign_rhs2 (ass
);
2550 /* Return a pointer to the second operand on the RHS of assignment
2553 static inline tree
*
2554 gimple_assign_rhs2_ptr (gassign
*gs
)
2556 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2560 static inline tree
*
2561 gimple_assign_rhs2_ptr (gimple
*gs
)
2563 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2564 return gimple_assign_rhs2_ptr (ass
);
2568 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2571 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2573 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2578 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2580 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2581 return gimple_assign_set_rhs2 (ass
, rhs
);
2584 /* Return the third operand on the RHS of assignment statement GS.
2585 If GS does not have two operands, NULL is returned instead. */
2588 gimple_assign_rhs3 (const gassign
*gs
)
2590 if (gimple_num_ops (gs
) >= 4)
2597 gimple_assign_rhs3 (const gimple
*gs
)
2599 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2600 return gimple_assign_rhs3 (ass
);
2603 /* Return a pointer to the third operand on the RHS of assignment
2606 static inline tree
*
2607 gimple_assign_rhs3_ptr (gimple
*gs
)
2609 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2610 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2615 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2618 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2620 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2625 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2627 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2628 gimple_assign_set_rhs3 (ass
, rhs
);
2632 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2633 which expect to see only two operands. */
2636 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2639 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2642 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2643 which expect to see only one operands. */
2646 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2649 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2652 /* Returns true if GS is a nontemporal move. */
2655 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2657 return gs
->nontemporal_move
;
2660 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2663 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2665 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2666 gs
->nontemporal_move
= nontemporal
;
2670 /* Return the code of the expression computed on the rhs of assignment
2671 statement GS. In case that the RHS is a single object, returns the
2672 tree code of the object. */
2674 static inline enum tree_code
2675 gimple_assign_rhs_code (const gassign
*gs
)
2677 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2678 /* While we initially set subcode to the TREE_CODE of the rhs for
2679 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2680 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2681 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2682 code
= TREE_CODE (gs
->op
[1]);
2687 static inline enum tree_code
2688 gimple_assign_rhs_code (const gimple
*gs
)
2690 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2691 return gimple_assign_rhs_code (ass
);
2695 /* Set CODE to be the code for the expression computed on the RHS of
2699 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2701 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2706 /* Return the gimple rhs class of the code of the expression computed on
2707 the rhs of assignment statement GS.
2708 This will never return GIMPLE_INVALID_RHS. */
2710 static inline enum gimple_rhs_class
2711 gimple_assign_rhs_class (const gimple
*gs
)
2713 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2716 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2717 there is no operator associated with the assignment itself.
2718 Unlike gimple_assign_copy_p, this predicate returns true for
2719 any RHS operand, including those that perform an operation
2720 and do not have the semantics of a copy, such as COND_EXPR. */
2723 gimple_assign_single_p (const gimple
*gs
)
2725 return (is_gimple_assign (gs
)
2726 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2729 /* Return true if GS performs a store to its lhs. */
2732 gimple_store_p (const gimple
*gs
)
2734 tree lhs
= gimple_get_lhs (gs
);
2735 return lhs
&& !is_gimple_reg (lhs
);
2738 /* Return true if GS is an assignment that loads from its rhs1. */
2741 gimple_assign_load_p (const gimple
*gs
)
2744 if (!gimple_assign_single_p (gs
))
2746 rhs
= gimple_assign_rhs1 (gs
);
2747 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2749 rhs
= get_base_address (rhs
);
2750 return (DECL_P (rhs
)
2751 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2755 /* Return true if S is a type-cast assignment. */
2758 gimple_assign_cast_p (const gimple
*s
)
2760 if (is_gimple_assign (s
))
2762 enum tree_code sc
= gimple_assign_rhs_code (s
);
2763 return CONVERT_EXPR_CODE_P (sc
)
2764 || sc
== VIEW_CONVERT_EXPR
2765 || sc
== FIX_TRUNC_EXPR
;
2771 /* Return true if S is a clobber statement. */
2774 gimple_clobber_p (const gimple
*s
)
2776 return gimple_assign_single_p (s
)
2777 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2780 /* Return true if GS is a GIMPLE_CALL. */
2783 is_gimple_call (const gimple
*gs
)
2785 return gimple_code (gs
) == GIMPLE_CALL
;
2788 /* Return the LHS of call statement GS. */
2791 gimple_call_lhs (const gcall
*gs
)
2797 gimple_call_lhs (const gimple
*gs
)
2799 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2800 return gimple_call_lhs (gc
);
2804 /* Return a pointer to the LHS of call statement GS. */
2806 static inline tree
*
2807 gimple_call_lhs_ptr (gcall
*gs
)
2812 static inline tree
*
2813 gimple_call_lhs_ptr (gimple
*gs
)
2815 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2816 return gimple_call_lhs_ptr (gc
);
2820 /* Set LHS to be the LHS operand of call statement GS. */
2823 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2826 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2827 SSA_NAME_DEF_STMT (lhs
) = gs
;
2831 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2833 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2834 gimple_call_set_lhs (gc
, lhs
);
2838 /* Return true if call GS calls an internal-only function, as enumerated
2842 gimple_call_internal_p (const gcall
*gs
)
2844 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2848 gimple_call_internal_p (const gimple
*gs
)
2850 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2851 return gimple_call_internal_p (gc
);
2855 /* Return true if call GS is marked as instrumented by
2856 Pointer Bounds Checker. */
2859 gimple_call_with_bounds_p (const gcall
*gs
)
2861 return (gs
->subcode
& GF_CALL_WITH_BOUNDS
) != 0;
2865 gimple_call_with_bounds_p (const gimple
*gs
)
2867 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2868 return gimple_call_with_bounds_p (gc
);
2872 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2873 Pointer Bounds Checker. */
2876 gimple_call_set_with_bounds (gcall
*gs
, bool with_bounds
)
2879 gs
->subcode
|= GF_CALL_WITH_BOUNDS
;
2881 gs
->subcode
&= ~GF_CALL_WITH_BOUNDS
;
2885 gimple_call_set_with_bounds (gimple
*gs
, bool with_bounds
)
2887 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2888 gimple_call_set_with_bounds (gc
, with_bounds
);
2892 /* Return the target of internal call GS. */
2894 static inline enum internal_fn
2895 gimple_call_internal_fn (const gcall
*gs
)
2897 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2898 return gs
->u
.internal_fn
;
2901 static inline enum internal_fn
2902 gimple_call_internal_fn (const gimple
*gs
)
2904 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2905 return gimple_call_internal_fn (gc
);
2908 /* Return true, if this internal gimple call is unique. */
2911 gimple_call_internal_unique_p (const gcall
*gs
)
2913 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
2917 gimple_call_internal_unique_p (const gimple
*gs
)
2919 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2920 return gimple_call_internal_unique_p (gc
);
2923 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2924 that could alter control flow. */
2927 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
2929 if (ctrl_altering_p
)
2930 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2932 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2936 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
2938 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
2939 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
2942 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2943 flag is set. Such call could not be a stmt in the middle of a bb. */
2946 gimple_call_ctrl_altering_p (const gcall
*gs
)
2948 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2952 gimple_call_ctrl_altering_p (const gimple
*gs
)
2954 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2955 return gimple_call_ctrl_altering_p (gc
);
2959 /* Return the function type of the function called by GS. */
2962 gimple_call_fntype (const gcall
*gs
)
2964 if (gimple_call_internal_p (gs
))
2966 return gs
->u
.fntype
;
2970 gimple_call_fntype (const gimple
*gs
)
2972 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2973 return gimple_call_fntype (call_stmt
);
2976 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2979 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
2981 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
2982 call_stmt
->u
.fntype
= fntype
;
2986 /* Return the tree node representing the function called by call
2990 gimple_call_fn (const gcall
*gs
)
2996 gimple_call_fn (const gimple
*gs
)
2998 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2999 return gimple_call_fn (gc
);
3002 /* Return a pointer to the tree node representing the function called by call
3005 static inline tree
*
3006 gimple_call_fn_ptr (gcall
*gs
)
3011 static inline tree
*
3012 gimple_call_fn_ptr (gimple
*gs
)
3014 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3015 return gimple_call_fn_ptr (gc
);
3019 /* Set FN to be the function called by call statement GS. */
3022 gimple_call_set_fn (gcall
*gs
, tree fn
)
3024 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3029 /* Set FNDECL to be the function called by call statement GS. */
3032 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3034 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3035 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3036 build_pointer_type (TREE_TYPE (decl
)), decl
);
3040 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3042 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3043 gimple_call_set_fndecl (gc
, decl
);
3047 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3050 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3052 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3053 call_stmt
->u
.internal_fn
= fn
;
3057 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3058 Otherwise return NULL. This function is analogous to
3059 get_callee_fndecl in tree land. */
3062 gimple_call_fndecl (const gcall
*gs
)
3064 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3068 gimple_call_fndecl (const gimple
*gs
)
3070 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3071 return gimple_call_fndecl (gc
);
3075 /* Return the type returned by call statement GS. */
3078 gimple_call_return_type (const gcall
*gs
)
3080 tree type
= gimple_call_fntype (gs
);
3082 if (type
== NULL_TREE
)
3083 return TREE_TYPE (gimple_call_lhs (gs
));
3085 /* The type returned by a function is the type of its
3087 return TREE_TYPE (type
);
3091 /* Return the static chain for call statement GS. */
3094 gimple_call_chain (const gcall
*gs
)
3100 gimple_call_chain (const gimple
*gs
)
3102 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3103 return gimple_call_chain (gc
);
3107 /* Return a pointer to the static chain for call statement CALL_STMT. */
3109 static inline tree
*
3110 gimple_call_chain_ptr (gcall
*call_stmt
)
3112 return &call_stmt
->op
[2];
3115 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3118 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3120 call_stmt
->op
[2] = chain
;
3124 /* Return the number of arguments used by call statement GS. */
3126 static inline unsigned
3127 gimple_call_num_args (const gcall
*gs
)
3129 return gimple_num_ops (gs
) - 3;
3132 static inline unsigned
3133 gimple_call_num_args (const gimple
*gs
)
3135 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3136 return gimple_call_num_args (gc
);
3140 /* Return the argument at position INDEX for call statement GS. */
3143 gimple_call_arg (const gcall
*gs
, unsigned index
)
3145 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3146 return gs
->op
[index
+ 3];
3150 gimple_call_arg (const gimple
*gs
, unsigned index
)
3152 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3153 return gimple_call_arg (gc
, index
);
3157 /* Return a pointer to the argument at position INDEX for call
3160 static inline tree
*
3161 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3163 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3164 return &gs
->op
[index
+ 3];
3167 static inline tree
*
3168 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3170 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3171 return gimple_call_arg_ptr (gc
, index
);
3175 /* Set ARG to be the argument at position INDEX for call statement GS. */
3178 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3180 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3181 gs
->op
[index
+ 3] = arg
;
3185 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3187 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3188 gimple_call_set_arg (gc
, index
, arg
);
3192 /* If TAIL_P is true, mark call statement S as being a tail call
3193 (i.e., a call just before the exit of a function). These calls are
3194 candidate for tail call optimization. */
3197 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3200 s
->subcode
|= GF_CALL_TAILCALL
;
3202 s
->subcode
&= ~GF_CALL_TAILCALL
;
3206 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3209 gimple_call_tail_p (gcall
*s
)
3211 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3214 /* Mark (or clear) call statement S as requiring tail call optimization. */
3217 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3220 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3222 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3225 /* Return true if call statement has been marked as requiring
3226 tail call optimization. */
3229 gimple_call_must_tail_p (const gcall
*s
)
3231 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3234 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3235 slot optimization. This transformation uses the target of the call
3236 expansion as the return slot for calls that return in memory. */
3239 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3241 if (return_slot_opt_p
)
3242 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3244 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3248 /* Return true if S is marked for return slot optimization. */
3251 gimple_call_return_slot_opt_p (gcall
*s
)
3253 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3257 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3258 thunk to the thunked-to function. */
3261 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3264 s
->subcode
|= GF_CALL_FROM_THUNK
;
3266 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3270 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3273 gimple_call_from_thunk_p (gcall
*s
)
3275 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3279 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3280 argument pack in its argument list. */
3283 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3285 if (pass_arg_pack_p
)
3286 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3288 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3292 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3293 argument pack in its argument list. */
3296 gimple_call_va_arg_pack_p (gcall
*s
)
3298 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3302 /* Return true if S is a noreturn call. */
3305 gimple_call_noreturn_p (const gcall
*s
)
3307 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3311 gimple_call_noreturn_p (const gimple
*s
)
3313 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3314 return gimple_call_noreturn_p (gc
);
3318 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3319 even if the called function can throw in other cases. */
3322 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3325 s
->subcode
|= GF_CALL_NOTHROW
;
3327 s
->subcode
&= ~GF_CALL_NOTHROW
;
3330 /* Return true if S is a nothrow call. */
3333 gimple_call_nothrow_p (gcall
*s
)
3335 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3338 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3339 is known to be emitted for VLA objects. Those are wrapped by
3340 stack_save/stack_restore calls and hence can't lead to unbounded
3341 stack growth even when they occur in loops. */
3344 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3347 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3349 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3352 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3355 gimple_call_alloca_for_var_p (gcall
*s
)
3357 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3360 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3363 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3365 dest_call
->subcode
= orig_call
->subcode
;
3369 /* Return a pointer to the points-to solution for the set of call-used
3370 variables of the call CALL_STMT. */
3372 static inline struct pt_solution
*
3373 gimple_call_use_set (gcall
*call_stmt
)
3375 return &call_stmt
->call_used
;
3379 /* Return a pointer to the points-to solution for the set of call-used
3380 variables of the call CALL_STMT. */
3382 static inline struct pt_solution
*
3383 gimple_call_clobber_set (gcall
*call_stmt
)
3385 return &call_stmt
->call_clobbered
;
3389 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3393 gimple_has_lhs (gimple
*stmt
)
3395 if (is_gimple_assign (stmt
))
3397 if (gcall
*call
= dyn_cast
<gcall
*> (stmt
))
3398 return gimple_call_lhs (call
) != NULL_TREE
;
3403 /* Return the code of the predicate computed by conditional statement GS. */
3405 static inline enum tree_code
3406 gimple_cond_code (const gcond
*gs
)
3408 return (enum tree_code
) gs
->subcode
;
3411 static inline enum tree_code
3412 gimple_cond_code (const gimple
*gs
)
3414 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3415 return gimple_cond_code (gc
);
3419 /* Set CODE to be the predicate code for the conditional statement GS. */
3422 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3428 /* Return the LHS of the predicate computed by conditional statement GS. */
3431 gimple_cond_lhs (const gcond
*gs
)
3437 gimple_cond_lhs (const gimple
*gs
)
3439 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3440 return gimple_cond_lhs (gc
);
3443 /* Return the pointer to the LHS of the predicate computed by conditional
3446 static inline tree
*
3447 gimple_cond_lhs_ptr (gcond
*gs
)
3452 /* Set LHS to be the LHS operand of the predicate computed by
3453 conditional statement GS. */
3456 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3462 /* Return the RHS operand of the predicate computed by conditional GS. */
3465 gimple_cond_rhs (const gcond
*gs
)
3471 gimple_cond_rhs (const gimple
*gs
)
3473 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3474 return gimple_cond_rhs (gc
);
3477 /* Return the pointer to the RHS operand of the predicate computed by
3480 static inline tree
*
3481 gimple_cond_rhs_ptr (gcond
*gs
)
3487 /* Set RHS to be the RHS operand of the predicate computed by
3488 conditional statement GS. */
3491 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3497 /* Return the label used by conditional statement GS when its
3498 predicate evaluates to true. */
3501 gimple_cond_true_label (const gcond
*gs
)
3507 /* Set LABEL to be the label used by conditional statement GS when its
3508 predicate evaluates to true. */
3511 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3517 /* Set LABEL to be the label used by conditional statement GS when its
3518 predicate evaluates to false. */
3521 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3527 /* Return the label used by conditional statement GS when its
3528 predicate evaluates to false. */
3531 gimple_cond_false_label (const gcond
*gs
)
3537 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3540 gimple_cond_make_false (gcond
*gs
)
3542 gimple_cond_set_lhs (gs
, boolean_false_node
);
3543 gimple_cond_set_rhs (gs
, boolean_false_node
);
3544 gs
->subcode
= NE_EXPR
;
3548 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3551 gimple_cond_make_true (gcond
*gs
)
3553 gimple_cond_set_lhs (gs
, boolean_true_node
);
3554 gimple_cond_set_rhs (gs
, boolean_false_node
);
3555 gs
->subcode
= NE_EXPR
;
3558 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3559 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3562 gimple_cond_true_p (const gcond
*gs
)
3564 tree lhs
= gimple_cond_lhs (gs
);
3565 tree rhs
= gimple_cond_rhs (gs
);
3566 enum tree_code code
= gimple_cond_code (gs
);
3568 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3571 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3574 if (code
== NE_EXPR
&& lhs
!= rhs
)
3577 if (code
== EQ_EXPR
&& lhs
== rhs
)
3583 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3584 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3587 gimple_cond_false_p (const gcond
*gs
)
3589 tree lhs
= gimple_cond_lhs (gs
);
3590 tree rhs
= gimple_cond_rhs (gs
);
3591 enum tree_code code
= gimple_cond_code (gs
);
3593 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3596 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3599 if (code
== NE_EXPR
&& lhs
== rhs
)
3602 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3608 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3611 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3614 gimple_cond_set_code (stmt
, code
);
3615 gimple_cond_set_lhs (stmt
, lhs
);
3616 gimple_cond_set_rhs (stmt
, rhs
);
3619 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3622 gimple_label_label (const glabel
*gs
)
3628 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3632 gimple_label_set_label (glabel
*gs
, tree label
)
3638 /* Return the destination of the unconditional jump GS. */
3641 gimple_goto_dest (const gimple
*gs
)
3643 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3644 return gimple_op (gs
, 0);
3648 /* Set DEST to be the destination of the unconditonal jump GS. */
3651 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3657 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3660 gimple_bind_vars (const gbind
*bind_stmt
)
3662 return bind_stmt
->vars
;
3666 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3670 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3672 bind_stmt
->vars
= vars
;
3676 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3680 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3682 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3686 static inline gimple_seq
*
3687 gimple_bind_body_ptr (gbind
*bind_stmt
)
3689 return &bind_stmt
->body
;
3692 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3694 static inline gimple_seq
3695 gimple_bind_body (gbind
*gs
)
3697 return *gimple_bind_body_ptr (gs
);
3701 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3705 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3707 bind_stmt
->body
= seq
;
3711 /* Append a statement to the end of a GIMPLE_BIND's body. */
3714 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3716 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3720 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3723 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3725 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3729 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3730 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3733 gimple_bind_block (const gbind
*bind_stmt
)
3735 return bind_stmt
->block
;
3739 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3743 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3745 gcc_gimple_checking_assert (block
== NULL_TREE
3746 || TREE_CODE (block
) == BLOCK
);
3747 bind_stmt
->block
= block
;
3751 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3753 static inline unsigned
3754 gimple_asm_ninputs (const gasm
*asm_stmt
)
3756 return asm_stmt
->ni
;
3760 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3762 static inline unsigned
3763 gimple_asm_noutputs (const gasm
*asm_stmt
)
3765 return asm_stmt
->no
;
3769 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3771 static inline unsigned
3772 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3774 return asm_stmt
->nc
;
3777 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3779 static inline unsigned
3780 gimple_asm_nlabels (const gasm
*asm_stmt
)
3782 return asm_stmt
->nl
;
3785 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3788 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3790 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3791 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3794 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3797 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3799 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3800 && TREE_CODE (in_op
) == TREE_LIST
);
3801 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3805 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3808 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3810 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3811 return asm_stmt
->op
[index
];
3814 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3817 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
3819 gcc_gimple_checking_assert (index
< asm_stmt
->no
3820 && TREE_CODE (out_op
) == TREE_LIST
);
3821 asm_stmt
->op
[index
] = out_op
;
3825 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3828 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
3830 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3831 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
3835 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3838 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
3840 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3841 && TREE_CODE (clobber_op
) == TREE_LIST
);
3842 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
3845 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3848 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
3850 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3851 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
];
3854 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3857 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
3859 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3860 && TREE_CODE (label_op
) == TREE_LIST
);
3861 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
3864 /* Return the string representing the assembly instruction in
3865 GIMPLE_ASM ASM_STMT. */
3867 static inline const char *
3868 gimple_asm_string (const gasm
*asm_stmt
)
3870 return asm_stmt
->string
;
3874 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3877 gimple_asm_volatile_p (const gasm
*asm_stmt
)
3879 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
3883 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3886 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
3889 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
3891 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
3895 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3898 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
3901 asm_stmt
->subcode
|= GF_ASM_INPUT
;
3903 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
3907 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3910 gimple_asm_input_p (const gasm
*asm_stmt
)
3912 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
3916 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3919 gimple_catch_types (const gcatch
*catch_stmt
)
3921 return catch_stmt
->types
;
3925 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3927 static inline tree
*
3928 gimple_catch_types_ptr (gcatch
*catch_stmt
)
3930 return &catch_stmt
->types
;
3934 /* Return a pointer to the GIMPLE sequence representing the body of
3935 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3937 static inline gimple_seq
*
3938 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
3940 return &catch_stmt
->handler
;
3944 /* Return the GIMPLE sequence representing the body of the handler of
3945 GIMPLE_CATCH statement CATCH_STMT. */
3947 static inline gimple_seq
3948 gimple_catch_handler (gcatch
*catch_stmt
)
3950 return *gimple_catch_handler_ptr (catch_stmt
);
3954 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3957 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
3959 catch_stmt
->types
= t
;
3963 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3966 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
3968 catch_stmt
->handler
= handler
;
3972 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3975 gimple_eh_filter_types (const gimple
*gs
)
3977 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
3978 return eh_filter_stmt
->types
;
3982 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3985 static inline tree
*
3986 gimple_eh_filter_types_ptr (gimple
*gs
)
3988 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
3989 return &eh_filter_stmt
->types
;
3993 /* Return a pointer to the sequence of statement to execute when
3994 GIMPLE_EH_FILTER statement fails. */
3996 static inline gimple_seq
*
3997 gimple_eh_filter_failure_ptr (gimple
*gs
)
3999 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4000 return &eh_filter_stmt
->failure
;
4004 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4007 static inline gimple_seq
4008 gimple_eh_filter_failure (gimple
*gs
)
4010 return *gimple_eh_filter_failure_ptr (gs
);
4014 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4018 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4020 eh_filter_stmt
->types
= types
;
4024 /* Set FAILURE to be the sequence of statements to execute on failure
4025 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4028 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4031 eh_filter_stmt
->failure
= failure
;
4034 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4037 gimple_eh_must_not_throw_fndecl (geh_mnt
*eh_mnt_stmt
)
4039 return eh_mnt_stmt
->fndecl
;
4042 /* Set the function decl to be called by GS to DECL. */
4045 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4048 eh_mnt_stmt
->fndecl
= decl
;
4051 /* GIMPLE_EH_ELSE accessors. */
4053 static inline gimple_seq
*
4054 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4056 return &eh_else_stmt
->n_body
;
4059 static inline gimple_seq
4060 gimple_eh_else_n_body (geh_else
*eh_else_stmt
)
4062 return *gimple_eh_else_n_body_ptr (eh_else_stmt
);
4065 static inline gimple_seq
*
4066 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4068 return &eh_else_stmt
->e_body
;
4071 static inline gimple_seq
4072 gimple_eh_else_e_body (geh_else
*eh_else_stmt
)
4074 return *gimple_eh_else_e_body_ptr (eh_else_stmt
);
4078 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4080 eh_else_stmt
->n_body
= seq
;
4084 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4086 eh_else_stmt
->e_body
= seq
;
4089 /* GIMPLE_TRY accessors. */
4091 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4092 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4094 static inline enum gimple_try_flags
4095 gimple_try_kind (const gimple
*gs
)
4097 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4098 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4102 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4105 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4107 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4108 || kind
== GIMPLE_TRY_FINALLY
);
4109 if (gimple_try_kind (gs
) != kind
)
4110 gs
->subcode
= (unsigned int) kind
;
4114 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4117 gimple_try_catch_is_cleanup (const gimple
*gs
)
4119 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4120 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4124 /* Return a pointer to the sequence of statements used as the
4125 body for GIMPLE_TRY GS. */
4127 static inline gimple_seq
*
4128 gimple_try_eval_ptr (gimple
*gs
)
4130 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4131 return &try_stmt
->eval
;
4135 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4137 static inline gimple_seq
4138 gimple_try_eval (gimple
*gs
)
4140 return *gimple_try_eval_ptr (gs
);
4144 /* Return a pointer to the sequence of statements used as the cleanup body for
4147 static inline gimple_seq
*
4148 gimple_try_cleanup_ptr (gimple
*gs
)
4150 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4151 return &try_stmt
->cleanup
;
4155 /* Return the sequence of statements used as the cleanup body for
4158 static inline gimple_seq
4159 gimple_try_cleanup (gimple
*gs
)
4161 return *gimple_try_cleanup_ptr (gs
);
4165 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4168 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4170 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4171 if (catch_is_cleanup
)
4172 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4174 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4178 /* Set EVAL to be the sequence of statements to use as the body for
4179 GIMPLE_TRY TRY_STMT. */
4182 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4184 try_stmt
->eval
= eval
;
4188 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4189 body for GIMPLE_TRY TRY_STMT. */
4192 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4194 try_stmt
->cleanup
= cleanup
;
4198 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4200 static inline gimple_seq
*
4201 gimple_wce_cleanup_ptr (gimple
*gs
)
4203 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4204 return &wce_stmt
->cleanup
;
4208 /* Return the cleanup sequence for cleanup statement GS. */
4210 static inline gimple_seq
4211 gimple_wce_cleanup (gimple
*gs
)
4213 return *gimple_wce_cleanup_ptr (gs
);
4217 /* Set CLEANUP to be the cleanup sequence for GS. */
4220 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4222 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4223 wce_stmt
->cleanup
= cleanup
;
4227 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4230 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4232 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4233 return gs
->subcode
!= 0;
4237 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4240 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4242 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4243 gs
->subcode
= (unsigned int) eh_only_p
;
4247 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4249 static inline unsigned
4250 gimple_phi_capacity (const gimple
*gs
)
4252 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4253 return phi_stmt
->capacity
;
4257 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4258 be exactly the number of incoming edges for the basic block holding
4261 static inline unsigned
4262 gimple_phi_num_args (const gimple
*gs
)
4264 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4265 return phi_stmt
->nargs
;
4269 /* Return the SSA name created by GIMPLE_PHI GS. */
4272 gimple_phi_result (const gimple
*gs
)
4274 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4275 return phi_stmt
->result
;
4278 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4280 static inline tree
*
4281 gimple_phi_result_ptr (gimple
*gs
)
4283 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4284 return &phi_stmt
->result
;
4287 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4290 gimple_phi_set_result (gphi
*phi
, tree result
)
4292 phi
->result
= result
;
4293 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4294 SSA_NAME_DEF_STMT (result
) = phi
;
4298 /* Return the PHI argument corresponding to incoming edge INDEX for
4301 static inline struct phi_arg_d
*
4302 gimple_phi_arg (gimple
*gs
, unsigned index
)
4304 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4305 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
4306 return &(phi_stmt
->args
[index
]);
4309 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4310 for GIMPLE_PHI PHI. */
4313 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4315 gcc_gimple_checking_assert (index
<= phi
->nargs
);
4316 phi
->args
[index
] = *phiarg
;
4319 /* Return the PHI nodes for basic block BB, or NULL if there are no
4322 static inline gimple_seq
4323 phi_nodes (const_basic_block bb
)
4325 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4326 return bb
->il
.gimple
.phi_nodes
;
4329 /* Return a pointer to the PHI nodes for basic block BB. */
4331 static inline gimple_seq
*
4332 phi_nodes_ptr (basic_block bb
)
4334 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4335 return &bb
->il
.gimple
.phi_nodes
;
4338 /* Return the tree operand for argument I of PHI node GS. */
4341 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4343 return gimple_phi_arg (gs
, index
)->def
;
4347 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4349 static inline tree
*
4350 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4352 return &gimple_phi_arg (phi
, index
)->def
;
4355 /* Return the edge associated with argument I of phi node PHI. */
4358 gimple_phi_arg_edge (gphi
*phi
, size_t i
)
4360 return EDGE_PRED (gimple_bb (phi
), i
);
4363 /* Return the source location of gimple argument I of phi node PHI. */
4365 static inline source_location
4366 gimple_phi_arg_location (gphi
*phi
, size_t i
)
4368 return gimple_phi_arg (phi
, i
)->locus
;
4371 /* Return the source location of the argument on edge E of phi node PHI. */
4373 static inline source_location
4374 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4376 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4379 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4382 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, source_location loc
)
4384 gimple_phi_arg (phi
, i
)->locus
= loc
;
4387 /* Return TRUE if argument I of phi node PHI has a location record. */
4390 gimple_phi_arg_has_location (gphi
*phi
, size_t i
)
4392 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4396 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4399 gimple_resx_region (const gresx
*resx_stmt
)
4401 return resx_stmt
->region
;
4404 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4407 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4409 resx_stmt
->region
= region
;
4412 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4415 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4417 return eh_dispatch_stmt
->region
;
4420 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4421 EH_DISPATCH_STMT. */
4424 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4426 eh_dispatch_stmt
->region
= region
;
4429 /* Return the number of labels associated with the switch statement GS. */
4431 static inline unsigned
4432 gimple_switch_num_labels (const gswitch
*gs
)
4435 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4436 num_ops
= gimple_num_ops (gs
);
4437 gcc_gimple_checking_assert (num_ops
> 1);
4442 /* Set NLABELS to be the number of labels for the switch statement GS. */
4445 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4447 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4448 gimple_set_num_ops (g
, nlabels
+ 1);
4452 /* Return the index variable used by the switch statement GS. */
4455 gimple_switch_index (const gswitch
*gs
)
4461 /* Return a pointer to the index variable for the switch statement GS. */
4463 static inline tree
*
4464 gimple_switch_index_ptr (gswitch
*gs
)
4470 /* Set INDEX to be the index variable for switch statement GS. */
4473 gimple_switch_set_index (gswitch
*gs
, tree index
)
4475 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4480 /* Return the label numbered INDEX. The default label is 0, followed by any
4481 labels in a switch statement. */
4484 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4486 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4487 return gs
->op
[index
+ 1];
4490 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4493 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4495 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4496 && (label
== NULL_TREE
4497 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4498 gs
->op
[index
+ 1] = label
;
4501 /* Return the default label for a switch statement. */
4504 gimple_switch_default_label (const gswitch
*gs
)
4506 tree label
= gimple_switch_label (gs
, 0);
4507 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4511 /* Set the default label for a switch statement. */
4514 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4516 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4517 gimple_switch_set_label (gs
, 0, label
);
4520 /* Return true if GS is a GIMPLE_DEBUG statement. */
4523 is_gimple_debug (const gimple
*gs
)
4525 return gimple_code (gs
) == GIMPLE_DEBUG
;
4528 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4531 gimple_debug_bind_p (const gimple
*s
)
4533 if (is_gimple_debug (s
))
4534 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4539 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4542 gimple_debug_bind_get_var (gimple
*dbg
)
4544 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4545 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4546 return gimple_op (dbg
, 0);
4549 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4553 gimple_debug_bind_get_value (gimple
*dbg
)
4555 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4556 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4557 return gimple_op (dbg
, 1);
4560 /* Return a pointer to the value bound to the variable in a
4561 GIMPLE_DEBUG bind statement. */
4563 static inline tree
*
4564 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4566 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4567 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4568 return gimple_op_ptr (dbg
, 1);
4571 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4574 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4576 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4577 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4578 gimple_set_op (dbg
, 0, var
);
4581 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4585 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4587 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4588 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4589 gimple_set_op (dbg
, 1, value
);
4592 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4594 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4596 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4600 gimple_debug_bind_reset_value (gimple
*dbg
)
4602 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4603 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4604 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4607 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4611 gimple_debug_bind_has_value_p (gimple
*dbg
)
4613 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4614 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4615 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4618 #undef GIMPLE_DEBUG_BIND_NOVALUE
4620 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4623 gimple_debug_source_bind_p (const gimple
*s
)
4625 if (is_gimple_debug (s
))
4626 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4631 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4634 gimple_debug_source_bind_get_var (gimple
*dbg
)
4636 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4637 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4638 return gimple_op (dbg
, 0);
4641 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4645 gimple_debug_source_bind_get_value (gimple
*dbg
)
4647 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4648 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4649 return gimple_op (dbg
, 1);
4652 /* Return a pointer to the value bound to the variable in a
4653 GIMPLE_DEBUG source bind statement. */
4655 static inline tree
*
4656 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4658 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4659 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4660 return gimple_op_ptr (dbg
, 1);
4663 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4666 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4668 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4669 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4670 gimple_set_op (dbg
, 0, var
);
4673 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4677 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4679 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4680 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4681 gimple_set_op (dbg
, 1, value
);
4684 /* Return the line number for EXPR, or return -1 if we have no line
4685 number information for it. */
4687 get_lineno (const gimple
*stmt
)
4694 loc
= gimple_location (stmt
);
4695 if (loc
== UNKNOWN_LOCATION
)
4698 return LOCATION_LINE (loc
);
4701 /* Return a pointer to the body for the OMP statement GS. */
4703 static inline gimple_seq
*
4704 gimple_omp_body_ptr (gimple
*gs
)
4706 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4709 /* Return the body for the OMP statement GS. */
4711 static inline gimple_seq
4712 gimple_omp_body (gimple
*gs
)
4714 return *gimple_omp_body_ptr (gs
);
4717 /* Set BODY to be the body for the OMP statement GS. */
4720 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
4722 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4726 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4729 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
4731 return crit_stmt
->name
;
4735 /* Return a pointer to the name associated with OMP critical statement
4738 static inline tree
*
4739 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
4741 return &crit_stmt
->name
;
4745 /* Set NAME to be the name associated with OMP critical statement
4749 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
4751 crit_stmt
->name
= name
;
4755 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4758 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
4760 return crit_stmt
->clauses
;
4764 /* Return a pointer to the clauses associated with OMP critical statement
4767 static inline tree
*
4768 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
4770 return &crit_stmt
->clauses
;
4774 /* Set CLAUSES to be the clauses associated with OMP critical statement
4778 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
4780 crit_stmt
->clauses
= clauses
;
4784 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4787 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
4789 return ord_stmt
->clauses
;
4793 /* Return a pointer to the clauses associated with OMP ordered statement
4796 static inline tree
*
4797 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
4799 return &ord_stmt
->clauses
;
4803 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4807 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
4809 ord_stmt
->clauses
= clauses
;
4813 /* Return the kind of the OMP_FOR statemement G. */
4816 gimple_omp_for_kind (const gimple
*g
)
4818 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4819 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4823 /* Set the kind of the OMP_FOR statement G. */
4826 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
4828 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4829 | (kind
& GF_OMP_FOR_KIND_MASK
);
4833 /* Return true if OMP_FOR statement G has the
4834 GF_OMP_FOR_COMBINED flag set. */
4837 gimple_omp_for_combined_p (const gimple
*g
)
4839 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4840 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4844 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4845 the boolean value of COMBINED_P. */
4848 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
4851 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4853 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4857 /* Return true if the OMP_FOR statement G has the
4858 GF_OMP_FOR_COMBINED_INTO flag set. */
4861 gimple_omp_for_combined_into_p (const gimple
*g
)
4863 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4864 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4868 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4869 on the boolean value of COMBINED_P. */
4872 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
4875 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4877 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4881 /* Return the clauses associated with the OMP_FOR statement GS. */
4884 gimple_omp_for_clauses (const gimple
*gs
)
4886 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4887 return omp_for_stmt
->clauses
;
4891 /* Return a pointer to the clauses associated with the OMP_FOR statement
4894 static inline tree
*
4895 gimple_omp_for_clauses_ptr (gimple
*gs
)
4897 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4898 return &omp_for_stmt
->clauses
;
4902 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4906 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
4908 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4909 omp_for_stmt
->clauses
= clauses
;
4913 /* Get the collapse count of the OMP_FOR statement GS. */
4915 static inline size_t
4916 gimple_omp_for_collapse (gimple
*gs
)
4918 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4919 return omp_for_stmt
->collapse
;
4923 /* Return the condition code associated with the OMP_FOR statement GS. */
4925 static inline enum tree_code
4926 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
4928 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4929 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4930 return omp_for_stmt
->iter
[i
].cond
;
4934 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4937 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
4939 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4940 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4941 && i
< omp_for_stmt
->collapse
);
4942 omp_for_stmt
->iter
[i
].cond
= cond
;
4946 /* Return the index variable for the OMP_FOR statement GS. */
4949 gimple_omp_for_index (const gimple
*gs
, size_t i
)
4951 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4952 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4953 return omp_for_stmt
->iter
[i
].index
;
4957 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4959 static inline tree
*
4960 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
4962 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4963 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4964 return &omp_for_stmt
->iter
[i
].index
;
4968 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4971 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
4973 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4974 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4975 omp_for_stmt
->iter
[i
].index
= index
;
4979 /* Return the initial value for the OMP_FOR statement GS. */
4982 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
4984 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4985 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4986 return omp_for_stmt
->iter
[i
].initial
;
4990 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4992 static inline tree
*
4993 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
4995 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4996 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4997 return &omp_for_stmt
->iter
[i
].initial
;
5001 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5004 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5006 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5007 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5008 omp_for_stmt
->iter
[i
].initial
= initial
;
5012 /* Return the final value for the OMP_FOR statement GS. */
5015 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5017 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5018 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5019 return omp_for_stmt
->iter
[i
].final
;
5023 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5025 static inline tree
*
5026 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5028 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5029 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5030 return &omp_for_stmt
->iter
[i
].final
;
5034 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5037 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5039 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5040 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5041 omp_for_stmt
->iter
[i
].final
= final
;
5045 /* Return the increment value for the OMP_FOR statement GS. */
5048 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5050 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5051 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5052 return omp_for_stmt
->iter
[i
].incr
;
5056 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5058 static inline tree
*
5059 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5061 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5062 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5063 return &omp_for_stmt
->iter
[i
].incr
;
5067 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5070 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5072 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5073 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5074 omp_for_stmt
->iter
[i
].incr
= incr
;
5078 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5079 statement GS starts. */
5081 static inline gimple_seq
*
5082 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5084 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5085 return &omp_for_stmt
->pre_body
;
5089 /* Return the sequence of statements to execute before the OMP_FOR
5090 statement GS starts. */
5092 static inline gimple_seq
5093 gimple_omp_for_pre_body (gimple
*gs
)
5095 return *gimple_omp_for_pre_body_ptr (gs
);
5099 /* Set PRE_BODY to be the sequence of statements to execute before the
5100 OMP_FOR statement GS starts. */
5103 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5105 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5106 omp_for_stmt
->pre_body
= pre_body
;
5109 /* Return the kernel_phony of OMP_FOR statement. */
5112 gimple_omp_for_grid_phony (const gomp_for
*omp_for
)
5114 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_PHONY
) != 0;
5117 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5120 gimple_omp_for_set_grid_phony (gomp_for
*omp_for
, bool value
)
5123 omp_for
->subcode
|= GF_OMP_FOR_GRID_PHONY
;
5125 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_PHONY
;
5128 /* Return the clauses associated with OMP_PARALLEL GS. */
5131 gimple_omp_parallel_clauses (const gimple
*gs
)
5133 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5134 return omp_parallel_stmt
->clauses
;
5138 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5140 static inline tree
*
5141 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5143 return &omp_parallel_stmt
->clauses
;
5147 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5150 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5153 omp_parallel_stmt
->clauses
= clauses
;
5157 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5160 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5162 return omp_parallel_stmt
->child_fn
;
5165 /* Return a pointer to the child function used to hold the body of
5166 OMP_PARALLEL_STMT. */
5168 static inline tree
*
5169 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5171 return &omp_parallel_stmt
->child_fn
;
5175 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5178 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5181 omp_parallel_stmt
->child_fn
= child_fn
;
5185 /* Return the artificial argument used to send variables and values
5186 from the parent to the children threads in OMP_PARALLEL_STMT. */
5189 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5191 return omp_parallel_stmt
->data_arg
;
5195 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5197 static inline tree
*
5198 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5200 return &omp_parallel_stmt
->data_arg
;
5204 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5207 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5210 omp_parallel_stmt
->data_arg
= data_arg
;
5213 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5216 gimple_omp_parallel_grid_phony (const gomp_parallel
*stmt
)
5218 return (gimple_omp_subcode (stmt
) & GF_OMP_PARALLEL_GRID_PHONY
) != 0;
5221 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5224 gimple_omp_parallel_set_grid_phony (gomp_parallel
*stmt
, bool value
)
5227 stmt
->subcode
|= GF_OMP_PARALLEL_GRID_PHONY
;
5229 stmt
->subcode
&= ~GF_OMP_PARALLEL_GRID_PHONY
;
5232 /* Return the clauses associated with OMP_TASK GS. */
5235 gimple_omp_task_clauses (const gimple
*gs
)
5237 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5238 return omp_task_stmt
->clauses
;
5242 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5244 static inline tree
*
5245 gimple_omp_task_clauses_ptr (gimple
*gs
)
5247 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5248 return &omp_task_stmt
->clauses
;
5252 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5256 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5258 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5259 omp_task_stmt
->clauses
= clauses
;
5263 /* Return true if OMP task statement G has the
5264 GF_OMP_TASK_TASKLOOP flag set. */
5267 gimple_omp_task_taskloop_p (const gimple
*g
)
5269 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5270 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5274 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5275 value of TASKLOOP_P. */
5278 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5280 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5282 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5284 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5288 /* Return the child function used to hold the body of OMP_TASK GS. */
5291 gimple_omp_task_child_fn (const gimple
*gs
)
5293 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5294 return omp_task_stmt
->child_fn
;
5297 /* Return a pointer to the child function used to hold the body of
5300 static inline tree
*
5301 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5303 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5304 return &omp_task_stmt
->child_fn
;
5308 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5311 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5313 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5314 omp_task_stmt
->child_fn
= child_fn
;
5318 /* Return the artificial argument used to send variables and values
5319 from the parent to the children threads in OMP_TASK GS. */
5322 gimple_omp_task_data_arg (const gimple
*gs
)
5324 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5325 return omp_task_stmt
->data_arg
;
5329 /* Return a pointer to the data argument for OMP_TASK GS. */
5331 static inline tree
*
5332 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5334 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5335 return &omp_task_stmt
->data_arg
;
5339 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5342 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5344 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5345 omp_task_stmt
->data_arg
= data_arg
;
5349 /* Return the clauses associated with OMP_TASK GS. */
5352 gimple_omp_taskreg_clauses (const gimple
*gs
)
5354 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5355 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5356 return omp_taskreg_stmt
->clauses
;
5360 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5362 static inline tree
*
5363 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5365 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5366 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5367 return &omp_taskreg_stmt
->clauses
;
5371 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5375 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5377 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5378 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5379 omp_taskreg_stmt
->clauses
= clauses
;
5383 /* Return the child function used to hold the body of OMP_TASK GS. */
5386 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5388 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5389 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5390 return omp_taskreg_stmt
->child_fn
;
5393 /* Return a pointer to the child function used to hold the body of
5396 static inline tree
*
5397 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5399 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5400 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5401 return &omp_taskreg_stmt
->child_fn
;
5405 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5408 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5410 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5411 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5412 omp_taskreg_stmt
->child_fn
= child_fn
;
5416 /* Return the artificial argument used to send variables and values
5417 from the parent to the children threads in OMP_TASK GS. */
5420 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5422 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5423 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5424 return omp_taskreg_stmt
->data_arg
;
5428 /* Return a pointer to the data argument for OMP_TASK GS. */
5430 static inline tree
*
5431 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5433 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5434 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5435 return &omp_taskreg_stmt
->data_arg
;
5439 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5442 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5444 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5445 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5446 omp_taskreg_stmt
->data_arg
= data_arg
;
5450 /* Return the copy function used to hold the body of OMP_TASK GS. */
5453 gimple_omp_task_copy_fn (const gimple
*gs
)
5455 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5456 return omp_task_stmt
->copy_fn
;
5459 /* Return a pointer to the copy function used to hold the body of
5462 static inline tree
*
5463 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5465 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5466 return &omp_task_stmt
->copy_fn
;
5470 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5473 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5475 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5476 omp_task_stmt
->copy_fn
= copy_fn
;
5480 /* Return size of the data block in bytes in OMP_TASK GS. */
5483 gimple_omp_task_arg_size (const gimple
*gs
)
5485 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5486 return omp_task_stmt
->arg_size
;
5490 /* Return a pointer to the data block size for OMP_TASK GS. */
5492 static inline tree
*
5493 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5495 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5496 return &omp_task_stmt
->arg_size
;
5500 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5503 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5505 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5506 omp_task_stmt
->arg_size
= arg_size
;
5510 /* Return align of the data block in bytes in OMP_TASK GS. */
5513 gimple_omp_task_arg_align (const gimple
*gs
)
5515 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5516 return omp_task_stmt
->arg_align
;
5520 /* Return a pointer to the data block align for OMP_TASK GS. */
5522 static inline tree
*
5523 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5525 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5526 return &omp_task_stmt
->arg_align
;
5530 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5533 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5535 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5536 omp_task_stmt
->arg_align
= arg_align
;
5540 /* Return the clauses associated with OMP_SINGLE GS. */
5543 gimple_omp_single_clauses (const gimple
*gs
)
5545 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5546 return omp_single_stmt
->clauses
;
5550 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5552 static inline tree
*
5553 gimple_omp_single_clauses_ptr (gimple
*gs
)
5555 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5556 return &omp_single_stmt
->clauses
;
5560 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5563 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5565 omp_single_stmt
->clauses
= clauses
;
5569 /* Return the clauses associated with OMP_TARGET GS. */
5572 gimple_omp_target_clauses (const gimple
*gs
)
5574 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5575 return omp_target_stmt
->clauses
;
5579 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5581 static inline tree
*
5582 gimple_omp_target_clauses_ptr (gimple
*gs
)
5584 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5585 return &omp_target_stmt
->clauses
;
5589 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5592 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5595 omp_target_stmt
->clauses
= clauses
;
5599 /* Return the kind of the OMP_TARGET G. */
5602 gimple_omp_target_kind (const gimple
*g
)
5604 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5605 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5609 /* Set the kind of the OMP_TARGET G. */
5612 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5614 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5615 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5619 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5622 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5624 return omp_target_stmt
->child_fn
;
5627 /* Return a pointer to the child function used to hold the body of
5630 static inline tree
*
5631 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5633 return &omp_target_stmt
->child_fn
;
5637 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5640 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
5643 omp_target_stmt
->child_fn
= child_fn
;
5647 /* Return the artificial argument used to send variables and values
5648 from the parent to the children threads in OMP_TARGET_STMT. */
5651 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
5653 return omp_target_stmt
->data_arg
;
5657 /* Return a pointer to the data argument for OMP_TARGET GS. */
5659 static inline tree
*
5660 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
5662 return &omp_target_stmt
->data_arg
;
5666 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5669 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
5672 omp_target_stmt
->data_arg
= data_arg
;
5676 /* Return the clauses associated with OMP_TEAMS GS. */
5679 gimple_omp_teams_clauses (const gimple
*gs
)
5681 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
5682 return omp_teams_stmt
->clauses
;
5686 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5688 static inline tree
*
5689 gimple_omp_teams_clauses_ptr (gimple
*gs
)
5691 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
5692 return &omp_teams_stmt
->clauses
;
5696 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5699 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
5701 omp_teams_stmt
->clauses
= clauses
;
5704 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5707 gimple_omp_teams_grid_phony (const gomp_teams
*omp_teams_stmt
)
5709 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_GRID_PHONY
) != 0;
5712 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5715 gimple_omp_teams_set_grid_phony (gomp_teams
*omp_teams_stmt
, bool value
)
5718 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_GRID_PHONY
;
5720 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_GRID_PHONY
;
5723 /* Return the clauses associated with OMP_SECTIONS GS. */
5726 gimple_omp_sections_clauses (const gimple
*gs
)
5728 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5729 return omp_sections_stmt
->clauses
;
5733 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5735 static inline tree
*
5736 gimple_omp_sections_clauses_ptr (gimple
*gs
)
5738 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5739 return &omp_sections_stmt
->clauses
;
5743 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5747 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
5749 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5750 omp_sections_stmt
->clauses
= clauses
;
5754 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5758 gimple_omp_sections_control (const gimple
*gs
)
5760 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5761 return omp_sections_stmt
->control
;
5765 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5768 static inline tree
*
5769 gimple_omp_sections_control_ptr (gimple
*gs
)
5771 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5772 return &omp_sections_stmt
->control
;
5776 /* Set CONTROL to be the set of clauses associated with the
5777 GIMPLE_OMP_SECTIONS in GS. */
5780 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
5782 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5783 omp_sections_stmt
->control
= control
;
5787 /* Set the value being stored in an atomic store. */
5790 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
5792 store_stmt
->val
= val
;
5796 /* Return the value being stored in an atomic store. */
5799 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
5801 return store_stmt
->val
;
5805 /* Return a pointer to the value being stored in an atomic store. */
5807 static inline tree
*
5808 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
5810 return &store_stmt
->val
;
5814 /* Set the LHS of an atomic load. */
5817 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
5819 load_stmt
->lhs
= lhs
;
5823 /* Get the LHS of an atomic load. */
5826 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
5828 return load_stmt
->lhs
;
5832 /* Return a pointer to the LHS of an atomic load. */
5834 static inline tree
*
5835 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
5837 return &load_stmt
->lhs
;
5841 /* Set the RHS of an atomic load. */
5844 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
5846 load_stmt
->rhs
= rhs
;
5850 /* Get the RHS of an atomic load. */
5853 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
5855 return load_stmt
->rhs
;
5859 /* Return a pointer to the RHS of an atomic load. */
5861 static inline tree
*
5862 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
5864 return &load_stmt
->rhs
;
5868 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5871 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
5873 return cont_stmt
->control_def
;
5876 /* The same as above, but return the address. */
5878 static inline tree
*
5879 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
5881 return &cont_stmt
->control_def
;
5884 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5887 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
5889 cont_stmt
->control_def
= def
;
5893 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5896 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
5898 return cont_stmt
->control_use
;
5902 /* The same as above, but return the address. */
5904 static inline tree
*
5905 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
5907 return &cont_stmt
->control_use
;
5911 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5914 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
5916 cont_stmt
->control_use
= use
;
5919 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5920 TRANSACTION_STMT. */
5922 static inline gimple_seq
*
5923 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
5925 return &transaction_stmt
->body
;
5928 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5930 static inline gimple_seq
5931 gimple_transaction_body (gtransaction
*transaction_stmt
)
5933 return transaction_stmt
->body
;
5936 /* Return the label associated with a GIMPLE_TRANSACTION. */
5939 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
5941 return transaction_stmt
->label_norm
;
5944 static inline tree
*
5945 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
5947 return &transaction_stmt
->label_norm
;
5951 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
5953 return transaction_stmt
->label_uninst
;
5956 static inline tree
*
5957 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
5959 return &transaction_stmt
->label_uninst
;
5963 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
5965 return transaction_stmt
->label_over
;
5968 static inline tree
*
5969 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
5971 return &transaction_stmt
->label_over
;
5974 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5976 static inline unsigned int
5977 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
5979 return transaction_stmt
->subcode
;
5982 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5983 TRANSACTION_STMT. */
5986 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
5989 transaction_stmt
->body
= body
;
5992 /* Set the label associated with a GIMPLE_TRANSACTION. */
5995 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
5997 transaction_stmt
->label_norm
= label
;
6001 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6003 transaction_stmt
->label_uninst
= label
;
6007 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6009 transaction_stmt
->label_over
= label
;
6012 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6015 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6016 unsigned int subcode
)
6018 transaction_stmt
->subcode
= subcode
;
6021 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6023 static inline tree
*
6024 gimple_return_retval_ptr (greturn
*gs
)
6029 /* Return the return value for GIMPLE_RETURN GS. */
6032 gimple_return_retval (const greturn
*gs
)
6038 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6041 gimple_return_set_retval (greturn
*gs
, tree retval
)
6047 /* Return the return bounds for GIMPLE_RETURN GS. */
6050 gimple_return_retbnd (const gimple
*gs
)
6052 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
6053 return gimple_op (gs
, 1);
6057 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6060 gimple_return_set_retbnd (gimple
*gs
, tree retval
)
6062 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
6063 gimple_set_op (gs
, 1, retval
);
6067 /* Returns true when the gimple statement STMT is any of the OMP types. */
6069 #define CASE_GIMPLE_OMP \
6070 case GIMPLE_OMP_PARALLEL: \
6071 case GIMPLE_OMP_TASK: \
6072 case GIMPLE_OMP_FOR: \
6073 case GIMPLE_OMP_SECTIONS: \
6074 case GIMPLE_OMP_SECTIONS_SWITCH: \
6075 case GIMPLE_OMP_SINGLE: \
6076 case GIMPLE_OMP_TARGET: \
6077 case GIMPLE_OMP_TEAMS: \
6078 case GIMPLE_OMP_SECTION: \
6079 case GIMPLE_OMP_MASTER: \
6080 case GIMPLE_OMP_TASKGROUP: \
6081 case GIMPLE_OMP_ORDERED: \
6082 case GIMPLE_OMP_CRITICAL: \
6083 case GIMPLE_OMP_RETURN: \
6084 case GIMPLE_OMP_ATOMIC_LOAD: \
6085 case GIMPLE_OMP_ATOMIC_STORE: \
6086 case GIMPLE_OMP_CONTINUE: \
6087 case GIMPLE_OMP_GRID_BODY
6090 is_gimple_omp (const gimple
*stmt
)
6092 switch (gimple_code (stmt
))
6101 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6105 is_gimple_omp_oacc (const gimple
*stmt
)
6107 gcc_assert (is_gimple_omp (stmt
));
6108 switch (gimple_code (stmt
))
6110 case GIMPLE_OMP_FOR
:
6111 switch (gimple_omp_for_kind (stmt
))
6113 case GF_OMP_FOR_KIND_OACC_LOOP
:
6118 case GIMPLE_OMP_TARGET
:
6119 switch (gimple_omp_target_kind (stmt
))
6121 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6122 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6123 case GF_OMP_TARGET_KIND_OACC_DATA
:
6124 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6125 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
6126 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6127 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6138 /* Return true if the OMP gimple statement STMT is offloaded. */
6141 is_gimple_omp_offloaded (const gimple
*stmt
)
6143 gcc_assert (is_gimple_omp (stmt
));
6144 switch (gimple_code (stmt
))
6146 case GIMPLE_OMP_TARGET
:
6147 switch (gimple_omp_target_kind (stmt
))
6149 case GF_OMP_TARGET_KIND_REGION
:
6150 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6151 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6162 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6165 gimple_nop_p (const gimple
*g
)
6167 return gimple_code (g
) == GIMPLE_NOP
;
6171 /* Return true if GS is a GIMPLE_RESX. */
6174 is_gimple_resx (const gimple
*gs
)
6176 return gimple_code (gs
) == GIMPLE_RESX
;
6179 /* Return the type of the main expression computed by STMT. Return
6180 void_type_node if the statement computes nothing. */
6183 gimple_expr_type (const gimple
*stmt
)
6185 enum gimple_code code
= gimple_code (stmt
);
6186 /* In general we want to pass out a type that can be substituted
6187 for both the RHS and the LHS types if there is a possibly
6188 useless conversion involved. That means returning the
6189 original RHS type as far as we can reconstruct it. */
6190 if (code
== GIMPLE_CALL
)
6192 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6193 if (gimple_call_internal_p (call_stmt
)
6194 && gimple_call_internal_fn (call_stmt
) == IFN_MASK_STORE
)
6195 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6197 return gimple_call_return_type (call_stmt
);
6199 else if (code
== GIMPLE_ASSIGN
)
6201 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6202 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6204 /* As fallback use the type of the LHS. */
6205 return TREE_TYPE (gimple_get_lhs (stmt
));
6207 else if (code
== GIMPLE_COND
)
6208 return boolean_type_node
;
6210 return void_type_node
;
6213 /* Enum and arrays used for allocation stats. Keep in sync with
6214 gimple.c:gimple_alloc_kind_names. */
6215 enum gimple_alloc_kind
6217 gimple_alloc_kind_assign
, /* Assignments. */
6218 gimple_alloc_kind_phi
, /* PHI nodes. */
6219 gimple_alloc_kind_cond
, /* Conditionals. */
6220 gimple_alloc_kind_rest
, /* Everything else. */
6221 gimple_alloc_kind_all
6224 extern int gimple_alloc_counts
[];
6225 extern int gimple_alloc_sizes
[];
6227 /* Return the allocation kind for a given stmt CODE. */
6228 static inline enum gimple_alloc_kind
6229 gimple_alloc_kind (enum gimple_code code
)
6234 return gimple_alloc_kind_assign
;
6236 return gimple_alloc_kind_phi
;
6238 return gimple_alloc_kind_cond
;
6240 return gimple_alloc_kind_rest
;
6244 /* Return true if a location should not be emitted for this statement
6245 by annotate_all_with_location. */
6248 gimple_do_not_emit_location_p (gimple
*g
)
6250 return gimple_plf (g
, GF_PLF_1
);
6253 /* Mark statement G so a location will not be emitted by
6254 annotate_one_with_location. */
6257 gimple_set_do_not_emit_location (gimple
*g
)
6259 /* The PLF flags are initialized to 0 when a new tuple is created,
6260 so no need to initialize it anywhere. */
6261 gimple_set_plf (g
, GF_PLF_1
, true);
6265 /* Macros for showing usage statistics. */
6266 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6268 : ((x) < 1024*1024*10 \
6270 : (x) / (1024*1024))))
6272 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6274 #endif /* GCC_GIMPLE_H */