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
*);
1529 extern bool stmt_can_terminate_bb_p (gimple
*);
1531 /* Formal (expression) temporary table handling: multiple occurrences of
1532 the same scalar expression are evaluated into the same temporary. */
1534 typedef struct gimple_temp_hash_elt
1537 tree temp
; /* Value */
1540 /* Get the number of the next statement uid to be allocated. */
1541 static inline unsigned int
1542 gimple_stmt_max_uid (struct function
*fn
)
1544 return fn
->last_stmt_uid
;
1547 /* Set the number of the next statement uid to be allocated. */
1549 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1551 fn
->last_stmt_uid
= maxid
;
1554 /* Set the number of the next statement uid to be allocated. */
1555 static inline unsigned int
1556 inc_gimple_stmt_max_uid (struct function
*fn
)
1558 return fn
->last_stmt_uid
++;
1561 /* Return the first node in GIMPLE sequence S. */
1563 static inline gimple_seq_node
1564 gimple_seq_first (gimple_seq s
)
1570 /* Return the first statement in GIMPLE sequence S. */
1572 static inline gimple
*
1573 gimple_seq_first_stmt (gimple_seq s
)
1575 gimple_seq_node n
= gimple_seq_first (s
);
1579 /* Return the first statement in GIMPLE sequence S as a gbind *,
1580 verifying that it has code GIMPLE_BIND in a checked build. */
1582 static inline gbind
*
1583 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1585 gimple_seq_node n
= gimple_seq_first (s
);
1586 return as_a
<gbind
*> (n
);
1590 /* Return the last node in GIMPLE sequence S. */
1592 static inline gimple_seq_node
1593 gimple_seq_last (gimple_seq s
)
1595 return s
? s
->prev
: NULL
;
1599 /* Return the last statement in GIMPLE sequence S. */
1601 static inline gimple
*
1602 gimple_seq_last_stmt (gimple_seq s
)
1604 gimple_seq_node n
= gimple_seq_last (s
);
1609 /* Set the last node in GIMPLE sequence *PS to LAST. */
1612 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1618 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1621 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1627 /* Return true if GIMPLE sequence S is empty. */
1630 gimple_seq_empty_p (gimple_seq s
)
1635 /* Allocate a new sequence and initialize its first element with STMT. */
1637 static inline gimple_seq
1638 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1640 gimple_seq seq
= NULL
;
1641 gimple_seq_add_stmt (&seq
, stmt
);
1646 /* Returns the sequence of statements in BB. */
1648 static inline gimple_seq
1649 bb_seq (const_basic_block bb
)
1651 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1654 static inline gimple_seq
*
1655 bb_seq_addr (basic_block bb
)
1657 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1660 /* Sets the sequence of statements in BB to SEQ. */
1663 set_bb_seq (basic_block bb
, gimple_seq seq
)
1665 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1666 bb
->il
.gimple
.seq
= seq
;
1670 /* Return the code for GIMPLE statement G. */
1672 static inline enum gimple_code
1673 gimple_code (const gimple
*g
)
1679 /* Return the GSS code used by a GIMPLE code. */
1681 static inline enum gimple_statement_structure_enum
1682 gss_for_code (enum gimple_code code
)
1684 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1685 return gss_for_code_
[code
];
1689 /* Return which GSS code is used by GS. */
1691 static inline enum gimple_statement_structure_enum
1692 gimple_statement_structure (gimple
*gs
)
1694 return gss_for_code (gimple_code (gs
));
1698 /* Return true if statement G has sub-statements. This is only true for
1699 High GIMPLE statements. */
1702 gimple_has_substatements (gimple
*g
)
1704 switch (gimple_code (g
))
1708 case GIMPLE_EH_FILTER
:
1709 case GIMPLE_EH_ELSE
:
1711 case GIMPLE_OMP_FOR
:
1712 case GIMPLE_OMP_MASTER
:
1713 case GIMPLE_OMP_TASKGROUP
:
1714 case GIMPLE_OMP_ORDERED
:
1715 case GIMPLE_OMP_SECTION
:
1716 case GIMPLE_OMP_PARALLEL
:
1717 case GIMPLE_OMP_TASK
:
1718 case GIMPLE_OMP_SECTIONS
:
1719 case GIMPLE_OMP_SINGLE
:
1720 case GIMPLE_OMP_TARGET
:
1721 case GIMPLE_OMP_TEAMS
:
1722 case GIMPLE_OMP_CRITICAL
:
1723 case GIMPLE_WITH_CLEANUP_EXPR
:
1724 case GIMPLE_TRANSACTION
:
1725 case GIMPLE_OMP_GRID_BODY
:
1734 /* Return the basic block holding statement G. */
1736 static inline basic_block
1737 gimple_bb (const gimple
*g
)
1743 /* Return the lexical scope block holding statement G. */
1746 gimple_block (const gimple
*g
)
1748 return LOCATION_BLOCK (g
->location
);
1752 /* Set BLOCK to be the lexical scope block holding statement G. */
1755 gimple_set_block (gimple
*g
, tree block
)
1757 g
->location
= set_block (g
->location
, block
);
1761 /* Return location information for statement G. */
1763 static inline location_t
1764 gimple_location (const gimple
*g
)
1769 /* Return location information for statement G if g is not NULL.
1770 Otherwise, UNKNOWN_LOCATION is returned. */
1772 static inline location_t
1773 gimple_location_safe (const gimple
*g
)
1775 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1778 /* Set location information for statement G. */
1781 gimple_set_location (gimple
*g
, location_t location
)
1783 g
->location
= location
;
1787 /* Return true if G contains location information. */
1790 gimple_has_location (const gimple
*g
)
1792 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1796 /* Return the file name of the location of STMT. */
1798 static inline const char *
1799 gimple_filename (const gimple
*stmt
)
1801 return LOCATION_FILE (gimple_location (stmt
));
1805 /* Return the line number of the location of STMT. */
1808 gimple_lineno (const gimple
*stmt
)
1810 return LOCATION_LINE (gimple_location (stmt
));
1814 /* Determine whether SEQ is a singleton. */
1817 gimple_seq_singleton_p (gimple_seq seq
)
1819 return ((gimple_seq_first (seq
) != NULL
)
1820 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1823 /* Return true if no warnings should be emitted for statement STMT. */
1826 gimple_no_warning_p (const gimple
*stmt
)
1828 return stmt
->no_warning
;
1831 /* Set the no_warning flag of STMT to NO_WARNING. */
1834 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1836 stmt
->no_warning
= (unsigned) no_warning
;
1839 /* Set the visited status on statement STMT to VISITED_P.
1841 Please note that this 'visited' property of the gimple statement is
1842 supposed to be undefined at pass boundaries. This means that a
1843 given pass should not assume it contains any useful value when the
1844 pass starts and thus can set it to any value it sees fit.
1846 You can learn more about the visited property of the gimple
1847 statement by reading the comments of the 'visited' data member of
1852 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1854 stmt
->visited
= (unsigned) visited_p
;
1858 /* Return the visited status for statement STMT.
1860 Please note that this 'visited' property of the gimple statement is
1861 supposed to be undefined at pass boundaries. This means that a
1862 given pass should not assume it contains any useful value when the
1863 pass starts and thus can set it to any value it sees fit.
1865 You can learn more about the visited property of the gimple
1866 statement by reading the comments of the 'visited' data member of
1870 gimple_visited_p (gimple
*stmt
)
1872 return stmt
->visited
;
1876 /* Set pass local flag PLF on statement STMT to VAL_P.
1878 Please note that this PLF property of the gimple statement is
1879 supposed to be undefined at pass boundaries. This means that a
1880 given pass should not assume it contains any useful value when the
1881 pass starts and thus can set it to any value it sees fit.
1883 You can learn more about the PLF property by reading the comment of
1884 the 'plf' data member of struct gimple_statement_structure. */
1887 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
1890 stmt
->plf
|= (unsigned int) plf
;
1892 stmt
->plf
&= ~((unsigned int) plf
);
1896 /* Return the value of pass local flag PLF on statement STMT.
1898 Please note that this 'plf' property of the gimple statement is
1899 supposed to be undefined at pass boundaries. This means that a
1900 given pass should not assume it contains any useful value when the
1901 pass starts and thus can set it to any value it sees fit.
1903 You can learn more about the plf property by reading the comment of
1904 the 'plf' data member of struct gimple_statement_structure. */
1906 static inline unsigned int
1907 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
1909 return stmt
->plf
& ((unsigned int) plf
);
1913 /* Set the UID of statement.
1915 Please note that this UID property is supposed to be undefined at
1916 pass boundaries. This means that a given pass should not assume it
1917 contains any useful value when the pass starts and thus can set it
1918 to any value it sees fit. */
1921 gimple_set_uid (gimple
*g
, unsigned uid
)
1927 /* Return the UID of statement.
1929 Please note that this UID property is supposed to be undefined at
1930 pass boundaries. This means that a given pass should not assume it
1931 contains any useful value when the pass starts and thus can set it
1932 to any value it sees fit. */
1934 static inline unsigned
1935 gimple_uid (const gimple
*g
)
1941 /* Make statement G a singleton sequence. */
1944 gimple_init_singleton (gimple
*g
)
1951 /* Return true if GIMPLE statement G has register or memory operands. */
1954 gimple_has_ops (const gimple
*g
)
1956 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1962 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
1964 return gimple_has_ops (gs
);
1970 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
1972 return gimple_has_ops (gs
);
1975 /* Return true if GIMPLE statement G has memory operands. */
1978 gimple_has_mem_ops (const gimple
*g
)
1980 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1986 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
1988 return gimple_has_mem_ops (gs
);
1994 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
1996 return gimple_has_mem_ops (gs
);
1999 /* Return the set of USE operands for statement G. */
2001 static inline struct use_optype_d
*
2002 gimple_use_ops (const gimple
*g
)
2004 const gimple_statement_with_ops
*ops_stmt
=
2005 dyn_cast
<const gimple_statement_with_ops
*> (g
);
2008 return ops_stmt
->use_ops
;
2012 /* Set USE to be the set of USE operands for statement G. */
2015 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2017 gimple_statement_with_ops
*ops_stmt
=
2018 as_a
<gimple_statement_with_ops
*> (g
);
2019 ops_stmt
->use_ops
= use
;
2023 /* Return the single VUSE operand of the statement G. */
2026 gimple_vuse (const gimple
*g
)
2028 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2029 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2032 return mem_ops_stmt
->vuse
;
2035 /* Return the single VDEF operand of the statement G. */
2038 gimple_vdef (const gimple
*g
)
2040 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2041 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2044 return mem_ops_stmt
->vdef
;
2047 /* Return the single VUSE operand of the statement G. */
2049 static inline tree
*
2050 gimple_vuse_ptr (gimple
*g
)
2052 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2053 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2056 return &mem_ops_stmt
->vuse
;
2059 /* Return the single VDEF operand of the statement G. */
2061 static inline tree
*
2062 gimple_vdef_ptr (gimple
*g
)
2064 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2065 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2068 return &mem_ops_stmt
->vdef
;
2071 /* Set the single VUSE operand of the statement G. */
2074 gimple_set_vuse (gimple
*g
, tree vuse
)
2076 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2077 as_a
<gimple_statement_with_memory_ops
*> (g
);
2078 mem_ops_stmt
->vuse
= vuse
;
2081 /* Set the single VDEF operand of the statement G. */
2084 gimple_set_vdef (gimple
*g
, tree vdef
)
2086 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2087 as_a
<gimple_statement_with_memory_ops
*> (g
);
2088 mem_ops_stmt
->vdef
= vdef
;
2092 /* Return true if statement G has operands and the modified field has
2096 gimple_modified_p (const gimple
*g
)
2098 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2102 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2103 a MODIFIED field. */
2106 gimple_set_modified (gimple
*s
, bool modifiedp
)
2108 if (gimple_has_ops (s
))
2109 s
->modified
= (unsigned) modifiedp
;
2113 /* Return the tree code for the expression computed by STMT. This is
2114 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2115 GIMPLE_CALL, return CALL_EXPR as the expression code for
2116 consistency. This is useful when the caller needs to deal with the
2117 three kinds of computation that GIMPLE supports. */
2119 static inline enum tree_code
2120 gimple_expr_code (const gimple
*stmt
)
2122 enum gimple_code code
= gimple_code (stmt
);
2123 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
2124 return (enum tree_code
) stmt
->subcode
;
2127 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
2133 /* Return true if statement STMT contains volatile operands. */
2136 gimple_has_volatile_ops (const gimple
*stmt
)
2138 if (gimple_has_mem_ops (stmt
))
2139 return stmt
->has_volatile_ops
;
2145 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2148 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2150 if (gimple_has_mem_ops (stmt
))
2151 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2154 /* Return true if STMT is in a transaction. */
2157 gimple_in_transaction (const gimple
*stmt
)
2159 return bb_in_transaction (gimple_bb (stmt
));
2162 /* Return true if statement STMT may access memory. */
2165 gimple_references_memory_p (gimple
*stmt
)
2167 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2171 /* Return the subcode for OMP statement S. */
2173 static inline unsigned
2174 gimple_omp_subcode (const gimple
*s
)
2176 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2177 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2181 /* Set the subcode for OMP statement S to SUBCODE. */
2184 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2186 /* We only have 16 bits for the subcode. Assert that we are not
2188 gcc_gimple_checking_assert (subcode
< (1 << 16));
2189 s
->subcode
= subcode
;
2192 /* Set the nowait flag on OMP_RETURN statement S. */
2195 gimple_omp_return_set_nowait (gimple
*s
)
2197 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2198 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2202 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2206 gimple_omp_return_nowait_p (const gimple
*g
)
2208 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2209 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2213 /* Set the LHS of OMP return. */
2216 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2218 gimple_statement_omp_return
*omp_return_stmt
=
2219 as_a
<gimple_statement_omp_return
*> (g
);
2220 omp_return_stmt
->val
= lhs
;
2224 /* Get the LHS of OMP return. */
2227 gimple_omp_return_lhs (const gimple
*g
)
2229 const gimple_statement_omp_return
*omp_return_stmt
=
2230 as_a
<const gimple_statement_omp_return
*> (g
);
2231 return omp_return_stmt
->val
;
2235 /* Return a pointer to the LHS of OMP return. */
2237 static inline tree
*
2238 gimple_omp_return_lhs_ptr (gimple
*g
)
2240 gimple_statement_omp_return
*omp_return_stmt
=
2241 as_a
<gimple_statement_omp_return
*> (g
);
2242 return &omp_return_stmt
->val
;
2246 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2250 gimple_omp_section_last_p (const gimple
*g
)
2252 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2253 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2257 /* Set the GF_OMP_SECTION_LAST flag on G. */
2260 gimple_omp_section_set_last (gimple
*g
)
2262 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2263 g
->subcode
|= GF_OMP_SECTION_LAST
;
2267 /* Return true if OMP parallel statement G has the
2268 GF_OMP_PARALLEL_COMBINED flag set. */
2271 gimple_omp_parallel_combined_p (const gimple
*g
)
2273 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2274 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2278 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2279 value of COMBINED_P. */
2282 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2284 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2286 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2288 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2292 /* Return true if OMP atomic load/store statement G has the
2293 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2296 gimple_omp_atomic_need_value_p (const gimple
*g
)
2298 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2299 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2300 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2304 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2307 gimple_omp_atomic_set_need_value (gimple
*g
)
2309 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2310 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2311 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2315 /* Return true if OMP atomic load/store statement G has the
2316 GF_OMP_ATOMIC_SEQ_CST flag set. */
2319 gimple_omp_atomic_seq_cst_p (const gimple
*g
)
2321 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2322 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2323 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2327 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2330 gimple_omp_atomic_set_seq_cst (gimple
*g
)
2332 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2333 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2334 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2338 /* Return the number of operands for statement GS. */
2340 static inline unsigned
2341 gimple_num_ops (const gimple
*gs
)
2347 /* Set the number of operands for statement GS. */
2350 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2352 gs
->num_ops
= num_ops
;
2356 /* Return the array of operands for statement GS. */
2358 static inline tree
*
2359 gimple_ops (gimple
*gs
)
2363 /* All the tuples have their operand vector at the very bottom
2364 of the structure. Note that those structures that do not
2365 have an operand vector have a zero offset. */
2366 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2367 gcc_gimple_checking_assert (off
!= 0);
2369 return (tree
*) ((char *) gs
+ off
);
2373 /* Return operand I for statement GS. */
2376 gimple_op (const gimple
*gs
, unsigned i
)
2378 if (gimple_has_ops (gs
))
2380 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2381 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2387 /* Return a pointer to operand I for statement GS. */
2389 static inline tree
*
2390 gimple_op_ptr (gimple
*gs
, unsigned i
)
2392 if (gimple_has_ops (gs
))
2394 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2395 return gimple_ops (gs
) + i
;
2401 /* Set operand I of statement GS to OP. */
2404 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2406 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2408 /* Note. It may be tempting to assert that OP matches
2409 is_gimple_operand, but that would be wrong. Different tuples
2410 accept slightly different sets of tree operands. Each caller
2411 should perform its own validation. */
2412 gimple_ops (gs
)[i
] = op
;
2415 /* Return true if GS is a GIMPLE_ASSIGN. */
2418 is_gimple_assign (const gimple
*gs
)
2420 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2423 /* Determine if expression CODE is one of the valid expressions that can
2424 be used on the RHS of GIMPLE assignments. */
2426 static inline enum gimple_rhs_class
2427 get_gimple_rhs_class (enum tree_code code
)
2429 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2432 /* Return the LHS of assignment statement GS. */
2435 gimple_assign_lhs (const gassign
*gs
)
2441 gimple_assign_lhs (const gimple
*gs
)
2443 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2444 return gimple_assign_lhs (ass
);
2448 /* Return a pointer to the LHS of assignment statement GS. */
2450 static inline tree
*
2451 gimple_assign_lhs_ptr (gassign
*gs
)
2456 static inline tree
*
2457 gimple_assign_lhs_ptr (gimple
*gs
)
2459 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2460 return gimple_assign_lhs_ptr (ass
);
2464 /* Set LHS to be the LHS operand of assignment statement GS. */
2467 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2471 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2472 SSA_NAME_DEF_STMT (lhs
) = gs
;
2476 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2478 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2479 gimple_assign_set_lhs (ass
, lhs
);
2483 /* Return the first operand on the RHS of assignment statement GS. */
2486 gimple_assign_rhs1 (const gassign
*gs
)
2492 gimple_assign_rhs1 (const gimple
*gs
)
2494 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2495 return gimple_assign_rhs1 (ass
);
2499 /* Return a pointer to the first operand on the RHS of assignment
2502 static inline tree
*
2503 gimple_assign_rhs1_ptr (gassign
*gs
)
2508 static inline tree
*
2509 gimple_assign_rhs1_ptr (gimple
*gs
)
2511 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2512 return gimple_assign_rhs1_ptr (ass
);
2515 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2518 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2524 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2526 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2527 gimple_assign_set_rhs1 (ass
, rhs
);
2531 /* Return the second operand on the RHS of assignment statement GS.
2532 If GS does not have two operands, NULL is returned instead. */
2535 gimple_assign_rhs2 (const gassign
*gs
)
2537 if (gimple_num_ops (gs
) >= 3)
2544 gimple_assign_rhs2 (const gimple
*gs
)
2546 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2547 return gimple_assign_rhs2 (ass
);
2551 /* Return a pointer to the second operand on the RHS of assignment
2554 static inline tree
*
2555 gimple_assign_rhs2_ptr (gassign
*gs
)
2557 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2561 static inline tree
*
2562 gimple_assign_rhs2_ptr (gimple
*gs
)
2564 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2565 return gimple_assign_rhs2_ptr (ass
);
2569 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2572 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2574 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2579 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2581 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2582 return gimple_assign_set_rhs2 (ass
, rhs
);
2585 /* Return the third operand on the RHS of assignment statement GS.
2586 If GS does not have two operands, NULL is returned instead. */
2589 gimple_assign_rhs3 (const gassign
*gs
)
2591 if (gimple_num_ops (gs
) >= 4)
2598 gimple_assign_rhs3 (const gimple
*gs
)
2600 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2601 return gimple_assign_rhs3 (ass
);
2604 /* Return a pointer to the third operand on the RHS of assignment
2607 static inline tree
*
2608 gimple_assign_rhs3_ptr (gimple
*gs
)
2610 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2611 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2616 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2619 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2621 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2626 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2628 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2629 gimple_assign_set_rhs3 (ass
, rhs
);
2633 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2634 which expect to see only two operands. */
2637 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2640 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2643 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2644 which expect to see only one operands. */
2647 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2650 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2653 /* Returns true if GS is a nontemporal move. */
2656 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2658 return gs
->nontemporal_move
;
2661 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2664 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2666 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2667 gs
->nontemporal_move
= nontemporal
;
2671 /* Return the code of the expression computed on the rhs of assignment
2672 statement GS. In case that the RHS is a single object, returns the
2673 tree code of the object. */
2675 static inline enum tree_code
2676 gimple_assign_rhs_code (const gassign
*gs
)
2678 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2679 /* While we initially set subcode to the TREE_CODE of the rhs for
2680 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2681 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2682 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2683 code
= TREE_CODE (gs
->op
[1]);
2688 static inline enum tree_code
2689 gimple_assign_rhs_code (const gimple
*gs
)
2691 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2692 return gimple_assign_rhs_code (ass
);
2696 /* Set CODE to be the code for the expression computed on the RHS of
2700 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2702 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2707 /* Return the gimple rhs class of the code of the expression computed on
2708 the rhs of assignment statement GS.
2709 This will never return GIMPLE_INVALID_RHS. */
2711 static inline enum gimple_rhs_class
2712 gimple_assign_rhs_class (const gimple
*gs
)
2714 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2717 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2718 there is no operator associated with the assignment itself.
2719 Unlike gimple_assign_copy_p, this predicate returns true for
2720 any RHS operand, including those that perform an operation
2721 and do not have the semantics of a copy, such as COND_EXPR. */
2724 gimple_assign_single_p (const gimple
*gs
)
2726 return (is_gimple_assign (gs
)
2727 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2730 /* Return true if GS performs a store to its lhs. */
2733 gimple_store_p (const gimple
*gs
)
2735 tree lhs
= gimple_get_lhs (gs
);
2736 return lhs
&& !is_gimple_reg (lhs
);
2739 /* Return true if GS is an assignment that loads from its rhs1. */
2742 gimple_assign_load_p (const gimple
*gs
)
2745 if (!gimple_assign_single_p (gs
))
2747 rhs
= gimple_assign_rhs1 (gs
);
2748 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2750 rhs
= get_base_address (rhs
);
2751 return (DECL_P (rhs
)
2752 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2756 /* Return true if S is a type-cast assignment. */
2759 gimple_assign_cast_p (const gimple
*s
)
2761 if (is_gimple_assign (s
))
2763 enum tree_code sc
= gimple_assign_rhs_code (s
);
2764 return CONVERT_EXPR_CODE_P (sc
)
2765 || sc
== VIEW_CONVERT_EXPR
2766 || sc
== FIX_TRUNC_EXPR
;
2772 /* Return true if S is a clobber statement. */
2775 gimple_clobber_p (const gimple
*s
)
2777 return gimple_assign_single_p (s
)
2778 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2781 /* Return true if GS is a GIMPLE_CALL. */
2784 is_gimple_call (const gimple
*gs
)
2786 return gimple_code (gs
) == GIMPLE_CALL
;
2789 /* Return the LHS of call statement GS. */
2792 gimple_call_lhs (const gcall
*gs
)
2798 gimple_call_lhs (const gimple
*gs
)
2800 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2801 return gimple_call_lhs (gc
);
2805 /* Return a pointer to the LHS of call statement GS. */
2807 static inline tree
*
2808 gimple_call_lhs_ptr (gcall
*gs
)
2813 static inline tree
*
2814 gimple_call_lhs_ptr (gimple
*gs
)
2816 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2817 return gimple_call_lhs_ptr (gc
);
2821 /* Set LHS to be the LHS operand of call statement GS. */
2824 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2827 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2828 SSA_NAME_DEF_STMT (lhs
) = gs
;
2832 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2834 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2835 gimple_call_set_lhs (gc
, lhs
);
2839 /* Return true if call GS calls an internal-only function, as enumerated
2843 gimple_call_internal_p (const gcall
*gs
)
2845 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2849 gimple_call_internal_p (const gimple
*gs
)
2851 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2852 return gimple_call_internal_p (gc
);
2856 /* Return true if call GS is marked as instrumented by
2857 Pointer Bounds Checker. */
2860 gimple_call_with_bounds_p (const gcall
*gs
)
2862 return (gs
->subcode
& GF_CALL_WITH_BOUNDS
) != 0;
2866 gimple_call_with_bounds_p (const gimple
*gs
)
2868 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2869 return gimple_call_with_bounds_p (gc
);
2873 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2874 Pointer Bounds Checker. */
2877 gimple_call_set_with_bounds (gcall
*gs
, bool with_bounds
)
2880 gs
->subcode
|= GF_CALL_WITH_BOUNDS
;
2882 gs
->subcode
&= ~GF_CALL_WITH_BOUNDS
;
2886 gimple_call_set_with_bounds (gimple
*gs
, bool with_bounds
)
2888 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2889 gimple_call_set_with_bounds (gc
, with_bounds
);
2893 /* Return the target of internal call GS. */
2895 static inline enum internal_fn
2896 gimple_call_internal_fn (const gcall
*gs
)
2898 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2899 return gs
->u
.internal_fn
;
2902 static inline enum internal_fn
2903 gimple_call_internal_fn (const gimple
*gs
)
2905 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2906 return gimple_call_internal_fn (gc
);
2909 /* Return true, if this internal gimple call is unique. */
2912 gimple_call_internal_unique_p (const gcall
*gs
)
2914 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
2918 gimple_call_internal_unique_p (const gimple
*gs
)
2920 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2921 return gimple_call_internal_unique_p (gc
);
2924 /* Return true if GS is an internal function FN. */
2927 gimple_call_internal_p (const gimple
*gs
, internal_fn fn
)
2929 return (is_gimple_call (gs
)
2930 && gimple_call_internal_p (gs
)
2931 && gimple_call_internal_fn (gs
) == fn
);
2934 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2935 that could alter control flow. */
2938 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
2940 if (ctrl_altering_p
)
2941 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2943 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2947 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
2949 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
2950 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
2953 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2954 flag is set. Such call could not be a stmt in the middle of a bb. */
2957 gimple_call_ctrl_altering_p (const gcall
*gs
)
2959 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2963 gimple_call_ctrl_altering_p (const gimple
*gs
)
2965 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2966 return gimple_call_ctrl_altering_p (gc
);
2970 /* Return the function type of the function called by GS. */
2973 gimple_call_fntype (const gcall
*gs
)
2975 if (gimple_call_internal_p (gs
))
2977 return gs
->u
.fntype
;
2981 gimple_call_fntype (const gimple
*gs
)
2983 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2984 return gimple_call_fntype (call_stmt
);
2987 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2990 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
2992 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
2993 call_stmt
->u
.fntype
= fntype
;
2997 /* Return the tree node representing the function called by call
3001 gimple_call_fn (const gcall
*gs
)
3007 gimple_call_fn (const gimple
*gs
)
3009 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3010 return gimple_call_fn (gc
);
3013 /* Return a pointer to the tree node representing the function called by call
3016 static inline tree
*
3017 gimple_call_fn_ptr (gcall
*gs
)
3022 static inline tree
*
3023 gimple_call_fn_ptr (gimple
*gs
)
3025 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3026 return gimple_call_fn_ptr (gc
);
3030 /* Set FN to be the function called by call statement GS. */
3033 gimple_call_set_fn (gcall
*gs
, tree fn
)
3035 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3040 /* Set FNDECL to be the function called by call statement GS. */
3043 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3045 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3046 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3047 build_pointer_type (TREE_TYPE (decl
)), decl
);
3051 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3053 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3054 gimple_call_set_fndecl (gc
, decl
);
3058 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3061 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3063 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3064 call_stmt
->u
.internal_fn
= fn
;
3068 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3069 Otherwise return NULL. This function is analogous to
3070 get_callee_fndecl in tree land. */
3073 gimple_call_fndecl (const gcall
*gs
)
3075 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3079 gimple_call_fndecl (const gimple
*gs
)
3081 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3082 return gimple_call_fndecl (gc
);
3086 /* Return the type returned by call statement GS. */
3089 gimple_call_return_type (const gcall
*gs
)
3091 tree type
= gimple_call_fntype (gs
);
3093 if (type
== NULL_TREE
)
3094 return TREE_TYPE (gimple_call_lhs (gs
));
3096 /* The type returned by a function is the type of its
3098 return TREE_TYPE (type
);
3102 /* Return the static chain for call statement GS. */
3105 gimple_call_chain (const gcall
*gs
)
3111 gimple_call_chain (const gimple
*gs
)
3113 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3114 return gimple_call_chain (gc
);
3118 /* Return a pointer to the static chain for call statement CALL_STMT. */
3120 static inline tree
*
3121 gimple_call_chain_ptr (gcall
*call_stmt
)
3123 return &call_stmt
->op
[2];
3126 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3129 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3131 call_stmt
->op
[2] = chain
;
3135 /* Return the number of arguments used by call statement GS. */
3137 static inline unsigned
3138 gimple_call_num_args (const gcall
*gs
)
3140 return gimple_num_ops (gs
) - 3;
3143 static inline unsigned
3144 gimple_call_num_args (const gimple
*gs
)
3146 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3147 return gimple_call_num_args (gc
);
3151 /* Return the argument at position INDEX for call statement GS. */
3154 gimple_call_arg (const gcall
*gs
, unsigned index
)
3156 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3157 return gs
->op
[index
+ 3];
3161 gimple_call_arg (const gimple
*gs
, unsigned index
)
3163 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3164 return gimple_call_arg (gc
, index
);
3168 /* Return a pointer to the argument at position INDEX for call
3171 static inline tree
*
3172 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3174 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3175 return &gs
->op
[index
+ 3];
3178 static inline tree
*
3179 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3181 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3182 return gimple_call_arg_ptr (gc
, index
);
3186 /* Set ARG to be the argument at position INDEX for call statement GS. */
3189 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3191 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3192 gs
->op
[index
+ 3] = arg
;
3196 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3198 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3199 gimple_call_set_arg (gc
, index
, arg
);
3203 /* If TAIL_P is true, mark call statement S as being a tail call
3204 (i.e., a call just before the exit of a function). These calls are
3205 candidate for tail call optimization. */
3208 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3211 s
->subcode
|= GF_CALL_TAILCALL
;
3213 s
->subcode
&= ~GF_CALL_TAILCALL
;
3217 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3220 gimple_call_tail_p (gcall
*s
)
3222 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3225 /* Mark (or clear) call statement S as requiring tail call optimization. */
3228 gimple_call_set_must_tail (gcall
*s
, bool must_tail_p
)
3231 s
->subcode
|= GF_CALL_MUST_TAIL_CALL
;
3233 s
->subcode
&= ~GF_CALL_MUST_TAIL_CALL
;
3236 /* Return true if call statement has been marked as requiring
3237 tail call optimization. */
3240 gimple_call_must_tail_p (const gcall
*s
)
3242 return (s
->subcode
& GF_CALL_MUST_TAIL_CALL
) != 0;
3245 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3246 slot optimization. This transformation uses the target of the call
3247 expansion as the return slot for calls that return in memory. */
3250 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3252 if (return_slot_opt_p
)
3253 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3255 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3259 /* Return true if S is marked for return slot optimization. */
3262 gimple_call_return_slot_opt_p (gcall
*s
)
3264 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3268 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3269 thunk to the thunked-to function. */
3272 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3275 s
->subcode
|= GF_CALL_FROM_THUNK
;
3277 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3281 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3284 gimple_call_from_thunk_p (gcall
*s
)
3286 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3290 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3291 argument pack in its argument list. */
3294 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3296 if (pass_arg_pack_p
)
3297 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3299 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3303 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3304 argument pack in its argument list. */
3307 gimple_call_va_arg_pack_p (gcall
*s
)
3309 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3313 /* Return true if S is a noreturn call. */
3316 gimple_call_noreturn_p (const gcall
*s
)
3318 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3322 gimple_call_noreturn_p (const gimple
*s
)
3324 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3325 return gimple_call_noreturn_p (gc
);
3329 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3330 even if the called function can throw in other cases. */
3333 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3336 s
->subcode
|= GF_CALL_NOTHROW
;
3338 s
->subcode
&= ~GF_CALL_NOTHROW
;
3341 /* Return true if S is a nothrow call. */
3344 gimple_call_nothrow_p (gcall
*s
)
3346 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3349 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3350 is known to be emitted for VLA objects. Those are wrapped by
3351 stack_save/stack_restore calls and hence can't lead to unbounded
3352 stack growth even when they occur in loops. */
3355 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3358 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3360 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3363 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3366 gimple_call_alloca_for_var_p (gcall
*s
)
3368 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3371 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3374 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3376 dest_call
->subcode
= orig_call
->subcode
;
3380 /* Return a pointer to the points-to solution for the set of call-used
3381 variables of the call CALL_STMT. */
3383 static inline struct pt_solution
*
3384 gimple_call_use_set (gcall
*call_stmt
)
3386 return &call_stmt
->call_used
;
3390 /* Return a pointer to the points-to solution for the set of call-used
3391 variables of the call CALL_STMT. */
3393 static inline struct pt_solution
*
3394 gimple_call_clobber_set (gcall
*call_stmt
)
3396 return &call_stmt
->call_clobbered
;
3400 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3404 gimple_has_lhs (gimple
*stmt
)
3406 if (is_gimple_assign (stmt
))
3408 if (gcall
*call
= dyn_cast
<gcall
*> (stmt
))
3409 return gimple_call_lhs (call
) != NULL_TREE
;
3414 /* Return the code of the predicate computed by conditional statement GS. */
3416 static inline enum tree_code
3417 gimple_cond_code (const gcond
*gs
)
3419 return (enum tree_code
) gs
->subcode
;
3422 static inline enum tree_code
3423 gimple_cond_code (const gimple
*gs
)
3425 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3426 return gimple_cond_code (gc
);
3430 /* Set CODE to be the predicate code for the conditional statement GS. */
3433 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3439 /* Return the LHS of the predicate computed by conditional statement GS. */
3442 gimple_cond_lhs (const gcond
*gs
)
3448 gimple_cond_lhs (const gimple
*gs
)
3450 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3451 return gimple_cond_lhs (gc
);
3454 /* Return the pointer to the LHS of the predicate computed by conditional
3457 static inline tree
*
3458 gimple_cond_lhs_ptr (gcond
*gs
)
3463 /* Set LHS to be the LHS operand of the predicate computed by
3464 conditional statement GS. */
3467 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3473 /* Return the RHS operand of the predicate computed by conditional GS. */
3476 gimple_cond_rhs (const gcond
*gs
)
3482 gimple_cond_rhs (const gimple
*gs
)
3484 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3485 return gimple_cond_rhs (gc
);
3488 /* Return the pointer to the RHS operand of the predicate computed by
3491 static inline tree
*
3492 gimple_cond_rhs_ptr (gcond
*gs
)
3498 /* Set RHS to be the RHS operand of the predicate computed by
3499 conditional statement GS. */
3502 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3508 /* Return the label used by conditional statement GS when its
3509 predicate evaluates to true. */
3512 gimple_cond_true_label (const gcond
*gs
)
3518 /* Set LABEL to be the label used by conditional statement GS when its
3519 predicate evaluates to true. */
3522 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3528 /* Set LABEL to be the label used by conditional statement GS when its
3529 predicate evaluates to false. */
3532 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3538 /* Return the label used by conditional statement GS when its
3539 predicate evaluates to false. */
3542 gimple_cond_false_label (const gcond
*gs
)
3548 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3551 gimple_cond_make_false (gcond
*gs
)
3553 gimple_cond_set_lhs (gs
, boolean_false_node
);
3554 gimple_cond_set_rhs (gs
, boolean_false_node
);
3555 gs
->subcode
= NE_EXPR
;
3559 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3562 gimple_cond_make_true (gcond
*gs
)
3564 gimple_cond_set_lhs (gs
, boolean_true_node
);
3565 gimple_cond_set_rhs (gs
, boolean_false_node
);
3566 gs
->subcode
= NE_EXPR
;
3569 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3570 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3573 gimple_cond_true_p (const gcond
*gs
)
3575 tree lhs
= gimple_cond_lhs (gs
);
3576 tree rhs
= gimple_cond_rhs (gs
);
3577 enum tree_code code
= gimple_cond_code (gs
);
3579 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3582 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3585 if (code
== NE_EXPR
&& lhs
!= rhs
)
3588 if (code
== EQ_EXPR
&& lhs
== rhs
)
3594 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3595 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3598 gimple_cond_false_p (const gcond
*gs
)
3600 tree lhs
= gimple_cond_lhs (gs
);
3601 tree rhs
= gimple_cond_rhs (gs
);
3602 enum tree_code code
= gimple_cond_code (gs
);
3604 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3607 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3610 if (code
== NE_EXPR
&& lhs
== rhs
)
3613 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3619 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3622 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3625 gimple_cond_set_code (stmt
, code
);
3626 gimple_cond_set_lhs (stmt
, lhs
);
3627 gimple_cond_set_rhs (stmt
, rhs
);
3630 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3633 gimple_label_label (const glabel
*gs
)
3639 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3643 gimple_label_set_label (glabel
*gs
, tree label
)
3649 /* Return the destination of the unconditional jump GS. */
3652 gimple_goto_dest (const gimple
*gs
)
3654 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3655 return gimple_op (gs
, 0);
3659 /* Set DEST to be the destination of the unconditonal jump GS. */
3662 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3668 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3671 gimple_bind_vars (const gbind
*bind_stmt
)
3673 return bind_stmt
->vars
;
3677 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3681 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3683 bind_stmt
->vars
= vars
;
3687 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3691 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3693 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3697 static inline gimple_seq
*
3698 gimple_bind_body_ptr (gbind
*bind_stmt
)
3700 return &bind_stmt
->body
;
3703 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3705 static inline gimple_seq
3706 gimple_bind_body (gbind
*gs
)
3708 return *gimple_bind_body_ptr (gs
);
3712 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3716 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3718 bind_stmt
->body
= seq
;
3722 /* Append a statement to the end of a GIMPLE_BIND's body. */
3725 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3727 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3731 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3734 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3736 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3740 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3741 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3744 gimple_bind_block (const gbind
*bind_stmt
)
3746 return bind_stmt
->block
;
3750 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3754 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3756 gcc_gimple_checking_assert (block
== NULL_TREE
3757 || TREE_CODE (block
) == BLOCK
);
3758 bind_stmt
->block
= block
;
3762 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3764 static inline unsigned
3765 gimple_asm_ninputs (const gasm
*asm_stmt
)
3767 return asm_stmt
->ni
;
3771 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3773 static inline unsigned
3774 gimple_asm_noutputs (const gasm
*asm_stmt
)
3776 return asm_stmt
->no
;
3780 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3782 static inline unsigned
3783 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3785 return asm_stmt
->nc
;
3788 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3790 static inline unsigned
3791 gimple_asm_nlabels (const gasm
*asm_stmt
)
3793 return asm_stmt
->nl
;
3796 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3799 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3801 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3802 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3805 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3808 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3810 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3811 && TREE_CODE (in_op
) == TREE_LIST
);
3812 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3816 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3819 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3821 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3822 return asm_stmt
->op
[index
];
3825 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3828 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
3830 gcc_gimple_checking_assert (index
< asm_stmt
->no
3831 && TREE_CODE (out_op
) == TREE_LIST
);
3832 asm_stmt
->op
[index
] = out_op
;
3836 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3839 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
3841 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3842 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
3846 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3849 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
3851 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3852 && TREE_CODE (clobber_op
) == TREE_LIST
);
3853 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
3856 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3859 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
3861 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3862 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
];
3865 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3868 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
3870 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3871 && TREE_CODE (label_op
) == TREE_LIST
);
3872 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
3875 /* Return the string representing the assembly instruction in
3876 GIMPLE_ASM ASM_STMT. */
3878 static inline const char *
3879 gimple_asm_string (const gasm
*asm_stmt
)
3881 return asm_stmt
->string
;
3885 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3888 gimple_asm_volatile_p (const gasm
*asm_stmt
)
3890 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
3894 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3897 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
3900 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
3902 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
3906 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3909 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
3912 asm_stmt
->subcode
|= GF_ASM_INPUT
;
3914 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
3918 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3921 gimple_asm_input_p (const gasm
*asm_stmt
)
3923 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
3927 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3930 gimple_catch_types (const gcatch
*catch_stmt
)
3932 return catch_stmt
->types
;
3936 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3938 static inline tree
*
3939 gimple_catch_types_ptr (gcatch
*catch_stmt
)
3941 return &catch_stmt
->types
;
3945 /* Return a pointer to the GIMPLE sequence representing the body of
3946 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3948 static inline gimple_seq
*
3949 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
3951 return &catch_stmt
->handler
;
3955 /* Return the GIMPLE sequence representing the body of the handler of
3956 GIMPLE_CATCH statement CATCH_STMT. */
3958 static inline gimple_seq
3959 gimple_catch_handler (gcatch
*catch_stmt
)
3961 return *gimple_catch_handler_ptr (catch_stmt
);
3965 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3968 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
3970 catch_stmt
->types
= t
;
3974 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3977 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
3979 catch_stmt
->handler
= handler
;
3983 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3986 gimple_eh_filter_types (const gimple
*gs
)
3988 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
3989 return eh_filter_stmt
->types
;
3993 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3996 static inline tree
*
3997 gimple_eh_filter_types_ptr (gimple
*gs
)
3999 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4000 return &eh_filter_stmt
->types
;
4004 /* Return a pointer to the sequence of statement to execute when
4005 GIMPLE_EH_FILTER statement fails. */
4007 static inline gimple_seq
*
4008 gimple_eh_filter_failure_ptr (gimple
*gs
)
4010 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
4011 return &eh_filter_stmt
->failure
;
4015 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4018 static inline gimple_seq
4019 gimple_eh_filter_failure (gimple
*gs
)
4021 return *gimple_eh_filter_failure_ptr (gs
);
4025 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4029 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
4031 eh_filter_stmt
->types
= types
;
4035 /* Set FAILURE to be the sequence of statements to execute on failure
4036 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4039 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
4042 eh_filter_stmt
->failure
= failure
;
4045 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4048 gimple_eh_must_not_throw_fndecl (geh_mnt
*eh_mnt_stmt
)
4050 return eh_mnt_stmt
->fndecl
;
4053 /* Set the function decl to be called by GS to DECL. */
4056 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4059 eh_mnt_stmt
->fndecl
= decl
;
4062 /* GIMPLE_EH_ELSE accessors. */
4064 static inline gimple_seq
*
4065 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4067 return &eh_else_stmt
->n_body
;
4070 static inline gimple_seq
4071 gimple_eh_else_n_body (geh_else
*eh_else_stmt
)
4073 return *gimple_eh_else_n_body_ptr (eh_else_stmt
);
4076 static inline gimple_seq
*
4077 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4079 return &eh_else_stmt
->e_body
;
4082 static inline gimple_seq
4083 gimple_eh_else_e_body (geh_else
*eh_else_stmt
)
4085 return *gimple_eh_else_e_body_ptr (eh_else_stmt
);
4089 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4091 eh_else_stmt
->n_body
= seq
;
4095 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4097 eh_else_stmt
->e_body
= seq
;
4100 /* GIMPLE_TRY accessors. */
4102 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4103 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4105 static inline enum gimple_try_flags
4106 gimple_try_kind (const gimple
*gs
)
4108 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4109 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4113 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4116 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4118 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4119 || kind
== GIMPLE_TRY_FINALLY
);
4120 if (gimple_try_kind (gs
) != kind
)
4121 gs
->subcode
= (unsigned int) kind
;
4125 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4128 gimple_try_catch_is_cleanup (const gimple
*gs
)
4130 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4131 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4135 /* Return a pointer to the sequence of statements used as the
4136 body for GIMPLE_TRY GS. */
4138 static inline gimple_seq
*
4139 gimple_try_eval_ptr (gimple
*gs
)
4141 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4142 return &try_stmt
->eval
;
4146 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4148 static inline gimple_seq
4149 gimple_try_eval (gimple
*gs
)
4151 return *gimple_try_eval_ptr (gs
);
4155 /* Return a pointer to the sequence of statements used as the cleanup body for
4158 static inline gimple_seq
*
4159 gimple_try_cleanup_ptr (gimple
*gs
)
4161 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4162 return &try_stmt
->cleanup
;
4166 /* Return the sequence of statements used as the cleanup body for
4169 static inline gimple_seq
4170 gimple_try_cleanup (gimple
*gs
)
4172 return *gimple_try_cleanup_ptr (gs
);
4176 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4179 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4181 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4182 if (catch_is_cleanup
)
4183 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4185 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4189 /* Set EVAL to be the sequence of statements to use as the body for
4190 GIMPLE_TRY TRY_STMT. */
4193 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4195 try_stmt
->eval
= eval
;
4199 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4200 body for GIMPLE_TRY TRY_STMT. */
4203 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4205 try_stmt
->cleanup
= cleanup
;
4209 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4211 static inline gimple_seq
*
4212 gimple_wce_cleanup_ptr (gimple
*gs
)
4214 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4215 return &wce_stmt
->cleanup
;
4219 /* Return the cleanup sequence for cleanup statement GS. */
4221 static inline gimple_seq
4222 gimple_wce_cleanup (gimple
*gs
)
4224 return *gimple_wce_cleanup_ptr (gs
);
4228 /* Set CLEANUP to be the cleanup sequence for GS. */
4231 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4233 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4234 wce_stmt
->cleanup
= cleanup
;
4238 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4241 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4243 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4244 return gs
->subcode
!= 0;
4248 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4251 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4253 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4254 gs
->subcode
= (unsigned int) eh_only_p
;
4258 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4260 static inline unsigned
4261 gimple_phi_capacity (const gimple
*gs
)
4263 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4264 return phi_stmt
->capacity
;
4268 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4269 be exactly the number of incoming edges for the basic block holding
4272 static inline unsigned
4273 gimple_phi_num_args (const gimple
*gs
)
4275 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4276 return phi_stmt
->nargs
;
4280 /* Return the SSA name created by GIMPLE_PHI GS. */
4283 gimple_phi_result (const gimple
*gs
)
4285 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4286 return phi_stmt
->result
;
4289 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4291 static inline tree
*
4292 gimple_phi_result_ptr (gimple
*gs
)
4294 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4295 return &phi_stmt
->result
;
4298 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4301 gimple_phi_set_result (gphi
*phi
, tree result
)
4303 phi
->result
= result
;
4304 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4305 SSA_NAME_DEF_STMT (result
) = phi
;
4309 /* Return the PHI argument corresponding to incoming edge INDEX for
4312 static inline struct phi_arg_d
*
4313 gimple_phi_arg (gimple
*gs
, unsigned index
)
4315 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4316 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
4317 return &(phi_stmt
->args
[index
]);
4320 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4321 for GIMPLE_PHI PHI. */
4324 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4326 gcc_gimple_checking_assert (index
<= phi
->nargs
);
4327 phi
->args
[index
] = *phiarg
;
4330 /* Return the PHI nodes for basic block BB, or NULL if there are no
4333 static inline gimple_seq
4334 phi_nodes (const_basic_block bb
)
4336 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4337 return bb
->il
.gimple
.phi_nodes
;
4340 /* Return a pointer to the PHI nodes for basic block BB. */
4342 static inline gimple_seq
*
4343 phi_nodes_ptr (basic_block bb
)
4345 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4346 return &bb
->il
.gimple
.phi_nodes
;
4349 /* Return the tree operand for argument I of PHI node GS. */
4352 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4354 return gimple_phi_arg (gs
, index
)->def
;
4358 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4360 static inline tree
*
4361 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4363 return &gimple_phi_arg (phi
, index
)->def
;
4366 /* Return the edge associated with argument I of phi node PHI. */
4369 gimple_phi_arg_edge (gphi
*phi
, size_t i
)
4371 return EDGE_PRED (gimple_bb (phi
), i
);
4374 /* Return the source location of gimple argument I of phi node PHI. */
4376 static inline source_location
4377 gimple_phi_arg_location (gphi
*phi
, size_t i
)
4379 return gimple_phi_arg (phi
, i
)->locus
;
4382 /* Return the source location of the argument on edge E of phi node PHI. */
4384 static inline source_location
4385 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4387 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4390 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4393 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, source_location loc
)
4395 gimple_phi_arg (phi
, i
)->locus
= loc
;
4398 /* Return TRUE if argument I of phi node PHI has a location record. */
4401 gimple_phi_arg_has_location (gphi
*phi
, size_t i
)
4403 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4407 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4410 gimple_resx_region (const gresx
*resx_stmt
)
4412 return resx_stmt
->region
;
4415 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4418 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4420 resx_stmt
->region
= region
;
4423 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4426 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4428 return eh_dispatch_stmt
->region
;
4431 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4432 EH_DISPATCH_STMT. */
4435 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4437 eh_dispatch_stmt
->region
= region
;
4440 /* Return the number of labels associated with the switch statement GS. */
4442 static inline unsigned
4443 gimple_switch_num_labels (const gswitch
*gs
)
4446 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4447 num_ops
= gimple_num_ops (gs
);
4448 gcc_gimple_checking_assert (num_ops
> 1);
4453 /* Set NLABELS to be the number of labels for the switch statement GS. */
4456 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4458 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4459 gimple_set_num_ops (g
, nlabels
+ 1);
4463 /* Return the index variable used by the switch statement GS. */
4466 gimple_switch_index (const gswitch
*gs
)
4472 /* Return a pointer to the index variable for the switch statement GS. */
4474 static inline tree
*
4475 gimple_switch_index_ptr (gswitch
*gs
)
4481 /* Set INDEX to be the index variable for switch statement GS. */
4484 gimple_switch_set_index (gswitch
*gs
, tree index
)
4486 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4491 /* Return the label numbered INDEX. The default label is 0, followed by any
4492 labels in a switch statement. */
4495 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4497 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4498 return gs
->op
[index
+ 1];
4501 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4504 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4506 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4507 && (label
== NULL_TREE
4508 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4509 gs
->op
[index
+ 1] = label
;
4512 /* Return the default label for a switch statement. */
4515 gimple_switch_default_label (const gswitch
*gs
)
4517 tree label
= gimple_switch_label (gs
, 0);
4518 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4522 /* Set the default label for a switch statement. */
4525 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4527 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4528 gimple_switch_set_label (gs
, 0, label
);
4531 /* Return true if GS is a GIMPLE_DEBUG statement. */
4534 is_gimple_debug (const gimple
*gs
)
4536 return gimple_code (gs
) == GIMPLE_DEBUG
;
4539 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4542 gimple_debug_bind_p (const gimple
*s
)
4544 if (is_gimple_debug (s
))
4545 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4550 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4553 gimple_debug_bind_get_var (gimple
*dbg
)
4555 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4556 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4557 return gimple_op (dbg
, 0);
4560 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4564 gimple_debug_bind_get_value (gimple
*dbg
)
4566 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4567 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4568 return gimple_op (dbg
, 1);
4571 /* Return a pointer to the value bound to the variable in a
4572 GIMPLE_DEBUG bind statement. */
4574 static inline tree
*
4575 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4577 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4578 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4579 return gimple_op_ptr (dbg
, 1);
4582 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4585 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4587 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4588 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4589 gimple_set_op (dbg
, 0, var
);
4592 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4596 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4598 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4599 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4600 gimple_set_op (dbg
, 1, value
);
4603 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4605 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4607 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4611 gimple_debug_bind_reset_value (gimple
*dbg
)
4613 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4614 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4615 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4618 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4622 gimple_debug_bind_has_value_p (gimple
*dbg
)
4624 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4625 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4626 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4629 #undef GIMPLE_DEBUG_BIND_NOVALUE
4631 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4634 gimple_debug_source_bind_p (const gimple
*s
)
4636 if (is_gimple_debug (s
))
4637 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4642 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4645 gimple_debug_source_bind_get_var (gimple
*dbg
)
4647 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4648 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4649 return gimple_op (dbg
, 0);
4652 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4656 gimple_debug_source_bind_get_value (gimple
*dbg
)
4658 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4659 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4660 return gimple_op (dbg
, 1);
4663 /* Return a pointer to the value bound to the variable in a
4664 GIMPLE_DEBUG source bind statement. */
4666 static inline tree
*
4667 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4669 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4670 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4671 return gimple_op_ptr (dbg
, 1);
4674 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4677 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4679 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4680 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4681 gimple_set_op (dbg
, 0, var
);
4684 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4688 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4690 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4691 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4692 gimple_set_op (dbg
, 1, value
);
4695 /* Return the line number for EXPR, or return -1 if we have no line
4696 number information for it. */
4698 get_lineno (const gimple
*stmt
)
4705 loc
= gimple_location (stmt
);
4706 if (loc
== UNKNOWN_LOCATION
)
4709 return LOCATION_LINE (loc
);
4712 /* Return a pointer to the body for the OMP statement GS. */
4714 static inline gimple_seq
*
4715 gimple_omp_body_ptr (gimple
*gs
)
4717 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4720 /* Return the body for the OMP statement GS. */
4722 static inline gimple_seq
4723 gimple_omp_body (gimple
*gs
)
4725 return *gimple_omp_body_ptr (gs
);
4728 /* Set BODY to be the body for the OMP statement GS. */
4731 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
4733 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4737 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4740 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
4742 return crit_stmt
->name
;
4746 /* Return a pointer to the name associated with OMP critical statement
4749 static inline tree
*
4750 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
4752 return &crit_stmt
->name
;
4756 /* Set NAME to be the name associated with OMP critical statement
4760 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
4762 crit_stmt
->name
= name
;
4766 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4769 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
4771 return crit_stmt
->clauses
;
4775 /* Return a pointer to the clauses associated with OMP critical statement
4778 static inline tree
*
4779 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
4781 return &crit_stmt
->clauses
;
4785 /* Set CLAUSES to be the clauses associated with OMP critical statement
4789 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
4791 crit_stmt
->clauses
= clauses
;
4795 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4798 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
4800 return ord_stmt
->clauses
;
4804 /* Return a pointer to the clauses associated with OMP ordered statement
4807 static inline tree
*
4808 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
4810 return &ord_stmt
->clauses
;
4814 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4818 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
4820 ord_stmt
->clauses
= clauses
;
4824 /* Return the kind of the OMP_FOR statemement G. */
4827 gimple_omp_for_kind (const gimple
*g
)
4829 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4830 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4834 /* Set the kind of the OMP_FOR statement G. */
4837 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
4839 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4840 | (kind
& GF_OMP_FOR_KIND_MASK
);
4844 /* Return true if OMP_FOR statement G has the
4845 GF_OMP_FOR_COMBINED flag set. */
4848 gimple_omp_for_combined_p (const gimple
*g
)
4850 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4851 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4855 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4856 the boolean value of COMBINED_P. */
4859 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
4862 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4864 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4868 /* Return true if the OMP_FOR statement G has the
4869 GF_OMP_FOR_COMBINED_INTO flag set. */
4872 gimple_omp_for_combined_into_p (const gimple
*g
)
4874 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4875 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4879 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4880 on the boolean value of COMBINED_P. */
4883 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
4886 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4888 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4892 /* Return the clauses associated with the OMP_FOR statement GS. */
4895 gimple_omp_for_clauses (const gimple
*gs
)
4897 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4898 return omp_for_stmt
->clauses
;
4902 /* Return a pointer to the clauses associated with the OMP_FOR statement
4905 static inline tree
*
4906 gimple_omp_for_clauses_ptr (gimple
*gs
)
4908 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4909 return &omp_for_stmt
->clauses
;
4913 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4917 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
4919 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4920 omp_for_stmt
->clauses
= clauses
;
4924 /* Get the collapse count of the OMP_FOR statement GS. */
4926 static inline size_t
4927 gimple_omp_for_collapse (gimple
*gs
)
4929 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4930 return omp_for_stmt
->collapse
;
4934 /* Return the condition code associated with the OMP_FOR statement GS. */
4936 static inline enum tree_code
4937 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
4939 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4940 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4941 return omp_for_stmt
->iter
[i
].cond
;
4945 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4948 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
4950 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4951 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4952 && i
< omp_for_stmt
->collapse
);
4953 omp_for_stmt
->iter
[i
].cond
= cond
;
4957 /* Return the index variable for the OMP_FOR statement GS. */
4960 gimple_omp_for_index (const gimple
*gs
, size_t i
)
4962 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4963 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4964 return omp_for_stmt
->iter
[i
].index
;
4968 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4970 static inline tree
*
4971 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
4973 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4974 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4975 return &omp_for_stmt
->iter
[i
].index
;
4979 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4982 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
4984 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4985 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4986 omp_for_stmt
->iter
[i
].index
= index
;
4990 /* Return the initial value for the OMP_FOR statement GS. */
4993 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
4995 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4996 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4997 return omp_for_stmt
->iter
[i
].initial
;
5001 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5003 static inline tree
*
5004 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
5006 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5007 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5008 return &omp_for_stmt
->iter
[i
].initial
;
5012 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5015 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
5017 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5018 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5019 omp_for_stmt
->iter
[i
].initial
= initial
;
5023 /* Return the final value for the OMP_FOR statement GS. */
5026 gimple_omp_for_final (const gimple
*gs
, size_t i
)
5028 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5029 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5030 return omp_for_stmt
->iter
[i
].final
;
5034 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5036 static inline tree
*
5037 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
5039 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5040 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5041 return &omp_for_stmt
->iter
[i
].final
;
5045 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5048 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5050 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5051 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5052 omp_for_stmt
->iter
[i
].final
= final
;
5056 /* Return the increment value for the OMP_FOR statement GS. */
5059 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5061 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5062 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5063 return omp_for_stmt
->iter
[i
].incr
;
5067 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5069 static inline tree
*
5070 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5072 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5073 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5074 return &omp_for_stmt
->iter
[i
].incr
;
5078 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5081 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5083 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5084 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5085 omp_for_stmt
->iter
[i
].incr
= incr
;
5089 /* Return a pointer to 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_ptr (gimple
*gs
)
5095 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5096 return &omp_for_stmt
->pre_body
;
5100 /* Return the sequence of statements to execute before the OMP_FOR
5101 statement GS starts. */
5103 static inline gimple_seq
5104 gimple_omp_for_pre_body (gimple
*gs
)
5106 return *gimple_omp_for_pre_body_ptr (gs
);
5110 /* Set PRE_BODY to be the sequence of statements to execute before the
5111 OMP_FOR statement GS starts. */
5114 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5116 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5117 omp_for_stmt
->pre_body
= pre_body
;
5120 /* Return the kernel_phony of OMP_FOR statement. */
5123 gimple_omp_for_grid_phony (const gomp_for
*omp_for
)
5125 return (gimple_omp_subcode (omp_for
) & GF_OMP_FOR_GRID_PHONY
) != 0;
5128 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5131 gimple_omp_for_set_grid_phony (gomp_for
*omp_for
, bool value
)
5134 omp_for
->subcode
|= GF_OMP_FOR_GRID_PHONY
;
5136 omp_for
->subcode
&= ~GF_OMP_FOR_GRID_PHONY
;
5139 /* Return the clauses associated with OMP_PARALLEL GS. */
5142 gimple_omp_parallel_clauses (const gimple
*gs
)
5144 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5145 return omp_parallel_stmt
->clauses
;
5149 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5151 static inline tree
*
5152 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5154 return &omp_parallel_stmt
->clauses
;
5158 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5161 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5164 omp_parallel_stmt
->clauses
= clauses
;
5168 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5171 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5173 return omp_parallel_stmt
->child_fn
;
5176 /* Return a pointer to the child function used to hold the body of
5177 OMP_PARALLEL_STMT. */
5179 static inline tree
*
5180 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5182 return &omp_parallel_stmt
->child_fn
;
5186 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5189 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5192 omp_parallel_stmt
->child_fn
= child_fn
;
5196 /* Return the artificial argument used to send variables and values
5197 from the parent to the children threads in OMP_PARALLEL_STMT. */
5200 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5202 return omp_parallel_stmt
->data_arg
;
5206 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5208 static inline tree
*
5209 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5211 return &omp_parallel_stmt
->data_arg
;
5215 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5218 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5221 omp_parallel_stmt
->data_arg
= data_arg
;
5224 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5227 gimple_omp_parallel_grid_phony (const gomp_parallel
*stmt
)
5229 return (gimple_omp_subcode (stmt
) & GF_OMP_PARALLEL_GRID_PHONY
) != 0;
5232 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5235 gimple_omp_parallel_set_grid_phony (gomp_parallel
*stmt
, bool value
)
5238 stmt
->subcode
|= GF_OMP_PARALLEL_GRID_PHONY
;
5240 stmt
->subcode
&= ~GF_OMP_PARALLEL_GRID_PHONY
;
5243 /* Return the clauses associated with OMP_TASK GS. */
5246 gimple_omp_task_clauses (const gimple
*gs
)
5248 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5249 return omp_task_stmt
->clauses
;
5253 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5255 static inline tree
*
5256 gimple_omp_task_clauses_ptr (gimple
*gs
)
5258 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5259 return &omp_task_stmt
->clauses
;
5263 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5267 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5269 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5270 omp_task_stmt
->clauses
= clauses
;
5274 /* Return true if OMP task statement G has the
5275 GF_OMP_TASK_TASKLOOP flag set. */
5278 gimple_omp_task_taskloop_p (const gimple
*g
)
5280 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5281 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5285 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5286 value of TASKLOOP_P. */
5289 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5291 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5293 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5295 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5299 /* Return the child function used to hold the body of OMP_TASK GS. */
5302 gimple_omp_task_child_fn (const gimple
*gs
)
5304 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5305 return omp_task_stmt
->child_fn
;
5308 /* Return a pointer to the child function used to hold the body of
5311 static inline tree
*
5312 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5314 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5315 return &omp_task_stmt
->child_fn
;
5319 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5322 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5324 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5325 omp_task_stmt
->child_fn
= child_fn
;
5329 /* Return the artificial argument used to send variables and values
5330 from the parent to the children threads in OMP_TASK GS. */
5333 gimple_omp_task_data_arg (const gimple
*gs
)
5335 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5336 return omp_task_stmt
->data_arg
;
5340 /* Return a pointer to the data argument for OMP_TASK GS. */
5342 static inline tree
*
5343 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5345 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5346 return &omp_task_stmt
->data_arg
;
5350 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5353 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5355 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5356 omp_task_stmt
->data_arg
= data_arg
;
5360 /* Return the clauses associated with OMP_TASK GS. */
5363 gimple_omp_taskreg_clauses (const gimple
*gs
)
5365 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5366 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5367 return omp_taskreg_stmt
->clauses
;
5371 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5373 static inline tree
*
5374 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5376 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5377 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5378 return &omp_taskreg_stmt
->clauses
;
5382 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5386 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5388 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5389 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5390 omp_taskreg_stmt
->clauses
= clauses
;
5394 /* Return the child function used to hold the body of OMP_TASK GS. */
5397 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5399 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5400 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5401 return omp_taskreg_stmt
->child_fn
;
5404 /* Return a pointer to the child function used to hold the body of
5407 static inline tree
*
5408 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5410 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5411 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5412 return &omp_taskreg_stmt
->child_fn
;
5416 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5419 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5421 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5422 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5423 omp_taskreg_stmt
->child_fn
= child_fn
;
5427 /* Return the artificial argument used to send variables and values
5428 from the parent to the children threads in OMP_TASK GS. */
5431 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5433 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5434 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5435 return omp_taskreg_stmt
->data_arg
;
5439 /* Return a pointer to the data argument for OMP_TASK GS. */
5441 static inline tree
*
5442 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5444 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5445 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5446 return &omp_taskreg_stmt
->data_arg
;
5450 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5453 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5455 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5456 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5457 omp_taskreg_stmt
->data_arg
= data_arg
;
5461 /* Return the copy function used to hold the body of OMP_TASK GS. */
5464 gimple_omp_task_copy_fn (const gimple
*gs
)
5466 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5467 return omp_task_stmt
->copy_fn
;
5470 /* Return a pointer to the copy function used to hold the body of
5473 static inline tree
*
5474 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5476 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5477 return &omp_task_stmt
->copy_fn
;
5481 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5484 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5486 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5487 omp_task_stmt
->copy_fn
= copy_fn
;
5491 /* Return size of the data block in bytes in OMP_TASK GS. */
5494 gimple_omp_task_arg_size (const gimple
*gs
)
5496 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5497 return omp_task_stmt
->arg_size
;
5501 /* Return a pointer to the data block size for OMP_TASK GS. */
5503 static inline tree
*
5504 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5506 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5507 return &omp_task_stmt
->arg_size
;
5511 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5514 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5516 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5517 omp_task_stmt
->arg_size
= arg_size
;
5521 /* Return align of the data block in bytes in OMP_TASK GS. */
5524 gimple_omp_task_arg_align (const gimple
*gs
)
5526 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5527 return omp_task_stmt
->arg_align
;
5531 /* Return a pointer to the data block align for OMP_TASK GS. */
5533 static inline tree
*
5534 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5536 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5537 return &omp_task_stmt
->arg_align
;
5541 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5544 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5546 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5547 omp_task_stmt
->arg_align
= arg_align
;
5551 /* Return the clauses associated with OMP_SINGLE GS. */
5554 gimple_omp_single_clauses (const gimple
*gs
)
5556 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5557 return omp_single_stmt
->clauses
;
5561 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5563 static inline tree
*
5564 gimple_omp_single_clauses_ptr (gimple
*gs
)
5566 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5567 return &omp_single_stmt
->clauses
;
5571 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5574 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5576 omp_single_stmt
->clauses
= clauses
;
5580 /* Return the clauses associated with OMP_TARGET GS. */
5583 gimple_omp_target_clauses (const gimple
*gs
)
5585 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5586 return omp_target_stmt
->clauses
;
5590 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5592 static inline tree
*
5593 gimple_omp_target_clauses_ptr (gimple
*gs
)
5595 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5596 return &omp_target_stmt
->clauses
;
5600 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5603 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5606 omp_target_stmt
->clauses
= clauses
;
5610 /* Return the kind of the OMP_TARGET G. */
5613 gimple_omp_target_kind (const gimple
*g
)
5615 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5616 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5620 /* Set the kind of the OMP_TARGET G. */
5623 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5625 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5626 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5630 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5633 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5635 return omp_target_stmt
->child_fn
;
5638 /* Return a pointer to the child function used to hold the body of
5641 static inline tree
*
5642 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5644 return &omp_target_stmt
->child_fn
;
5648 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5651 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
5654 omp_target_stmt
->child_fn
= child_fn
;
5658 /* Return the artificial argument used to send variables and values
5659 from the parent to the children threads in OMP_TARGET_STMT. */
5662 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
5664 return omp_target_stmt
->data_arg
;
5668 /* Return a pointer to the data argument for OMP_TARGET GS. */
5670 static inline tree
*
5671 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
5673 return &omp_target_stmt
->data_arg
;
5677 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5680 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
5683 omp_target_stmt
->data_arg
= data_arg
;
5687 /* Return the clauses associated with OMP_TEAMS GS. */
5690 gimple_omp_teams_clauses (const gimple
*gs
)
5692 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
5693 return omp_teams_stmt
->clauses
;
5697 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5699 static inline tree
*
5700 gimple_omp_teams_clauses_ptr (gimple
*gs
)
5702 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
5703 return &omp_teams_stmt
->clauses
;
5707 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5710 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
5712 omp_teams_stmt
->clauses
= clauses
;
5715 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5718 gimple_omp_teams_grid_phony (const gomp_teams
*omp_teams_stmt
)
5720 return (gimple_omp_subcode (omp_teams_stmt
) & GF_OMP_TEAMS_GRID_PHONY
) != 0;
5723 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5726 gimple_omp_teams_set_grid_phony (gomp_teams
*omp_teams_stmt
, bool value
)
5729 omp_teams_stmt
->subcode
|= GF_OMP_TEAMS_GRID_PHONY
;
5731 omp_teams_stmt
->subcode
&= ~GF_OMP_TEAMS_GRID_PHONY
;
5734 /* Return the clauses associated with OMP_SECTIONS GS. */
5737 gimple_omp_sections_clauses (const gimple
*gs
)
5739 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5740 return omp_sections_stmt
->clauses
;
5744 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5746 static inline tree
*
5747 gimple_omp_sections_clauses_ptr (gimple
*gs
)
5749 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5750 return &omp_sections_stmt
->clauses
;
5754 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5758 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
5760 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5761 omp_sections_stmt
->clauses
= clauses
;
5765 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5769 gimple_omp_sections_control (const gimple
*gs
)
5771 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5772 return omp_sections_stmt
->control
;
5776 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5779 static inline tree
*
5780 gimple_omp_sections_control_ptr (gimple
*gs
)
5782 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5783 return &omp_sections_stmt
->control
;
5787 /* Set CONTROL to be the set of clauses associated with the
5788 GIMPLE_OMP_SECTIONS in GS. */
5791 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
5793 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5794 omp_sections_stmt
->control
= control
;
5798 /* Set the value being stored in an atomic store. */
5801 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
5803 store_stmt
->val
= val
;
5807 /* Return the value being stored in an atomic store. */
5810 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
5812 return store_stmt
->val
;
5816 /* Return a pointer to the value being stored in an atomic store. */
5818 static inline tree
*
5819 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
5821 return &store_stmt
->val
;
5825 /* Set the LHS of an atomic load. */
5828 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
5830 load_stmt
->lhs
= lhs
;
5834 /* Get the LHS of an atomic load. */
5837 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
5839 return load_stmt
->lhs
;
5843 /* Return a pointer to the LHS of an atomic load. */
5845 static inline tree
*
5846 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
5848 return &load_stmt
->lhs
;
5852 /* Set the RHS of an atomic load. */
5855 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
5857 load_stmt
->rhs
= rhs
;
5861 /* Get the RHS of an atomic load. */
5864 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
5866 return load_stmt
->rhs
;
5870 /* Return a pointer to the RHS of an atomic load. */
5872 static inline tree
*
5873 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
5875 return &load_stmt
->rhs
;
5879 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5882 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
5884 return cont_stmt
->control_def
;
5887 /* The same as above, but return the address. */
5889 static inline tree
*
5890 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
5892 return &cont_stmt
->control_def
;
5895 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5898 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
5900 cont_stmt
->control_def
= def
;
5904 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5907 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
5909 return cont_stmt
->control_use
;
5913 /* The same as above, but return the address. */
5915 static inline tree
*
5916 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
5918 return &cont_stmt
->control_use
;
5922 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5925 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
5927 cont_stmt
->control_use
= use
;
5930 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5931 TRANSACTION_STMT. */
5933 static inline gimple_seq
*
5934 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
5936 return &transaction_stmt
->body
;
5939 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5941 static inline gimple_seq
5942 gimple_transaction_body (gtransaction
*transaction_stmt
)
5944 return transaction_stmt
->body
;
5947 /* Return the label associated with a GIMPLE_TRANSACTION. */
5950 gimple_transaction_label_norm (const gtransaction
*transaction_stmt
)
5952 return transaction_stmt
->label_norm
;
5955 static inline tree
*
5956 gimple_transaction_label_norm_ptr (gtransaction
*transaction_stmt
)
5958 return &transaction_stmt
->label_norm
;
5962 gimple_transaction_label_uninst (const gtransaction
*transaction_stmt
)
5964 return transaction_stmt
->label_uninst
;
5967 static inline tree
*
5968 gimple_transaction_label_uninst_ptr (gtransaction
*transaction_stmt
)
5970 return &transaction_stmt
->label_uninst
;
5974 gimple_transaction_label_over (const gtransaction
*transaction_stmt
)
5976 return transaction_stmt
->label_over
;
5979 static inline tree
*
5980 gimple_transaction_label_over_ptr (gtransaction
*transaction_stmt
)
5982 return &transaction_stmt
->label_over
;
5985 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5987 static inline unsigned int
5988 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
5990 return transaction_stmt
->subcode
;
5993 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5994 TRANSACTION_STMT. */
5997 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
6000 transaction_stmt
->body
= body
;
6003 /* Set the label associated with a GIMPLE_TRANSACTION. */
6006 gimple_transaction_set_label_norm (gtransaction
*transaction_stmt
, tree label
)
6008 transaction_stmt
->label_norm
= label
;
6012 gimple_transaction_set_label_uninst (gtransaction
*transaction_stmt
, tree label
)
6014 transaction_stmt
->label_uninst
= label
;
6018 gimple_transaction_set_label_over (gtransaction
*transaction_stmt
, tree label
)
6020 transaction_stmt
->label_over
= label
;
6023 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6026 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
6027 unsigned int subcode
)
6029 transaction_stmt
->subcode
= subcode
;
6032 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6034 static inline tree
*
6035 gimple_return_retval_ptr (greturn
*gs
)
6040 /* Return the return value for GIMPLE_RETURN GS. */
6043 gimple_return_retval (const greturn
*gs
)
6049 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6052 gimple_return_set_retval (greturn
*gs
, tree retval
)
6058 /* Return the return bounds for GIMPLE_RETURN GS. */
6061 gimple_return_retbnd (const gimple
*gs
)
6063 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
6064 return gimple_op (gs
, 1);
6068 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6071 gimple_return_set_retbnd (gimple
*gs
, tree retval
)
6073 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
6074 gimple_set_op (gs
, 1, retval
);
6078 /* Returns true when the gimple statement STMT is any of the OMP types. */
6080 #define CASE_GIMPLE_OMP \
6081 case GIMPLE_OMP_PARALLEL: \
6082 case GIMPLE_OMP_TASK: \
6083 case GIMPLE_OMP_FOR: \
6084 case GIMPLE_OMP_SECTIONS: \
6085 case GIMPLE_OMP_SECTIONS_SWITCH: \
6086 case GIMPLE_OMP_SINGLE: \
6087 case GIMPLE_OMP_TARGET: \
6088 case GIMPLE_OMP_TEAMS: \
6089 case GIMPLE_OMP_SECTION: \
6090 case GIMPLE_OMP_MASTER: \
6091 case GIMPLE_OMP_TASKGROUP: \
6092 case GIMPLE_OMP_ORDERED: \
6093 case GIMPLE_OMP_CRITICAL: \
6094 case GIMPLE_OMP_RETURN: \
6095 case GIMPLE_OMP_ATOMIC_LOAD: \
6096 case GIMPLE_OMP_ATOMIC_STORE: \
6097 case GIMPLE_OMP_CONTINUE: \
6098 case GIMPLE_OMP_GRID_BODY
6101 is_gimple_omp (const gimple
*stmt
)
6103 switch (gimple_code (stmt
))
6112 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6116 is_gimple_omp_oacc (const gimple
*stmt
)
6118 gcc_assert (is_gimple_omp (stmt
));
6119 switch (gimple_code (stmt
))
6121 case GIMPLE_OMP_FOR
:
6122 switch (gimple_omp_for_kind (stmt
))
6124 case GF_OMP_FOR_KIND_OACC_LOOP
:
6129 case GIMPLE_OMP_TARGET
:
6130 switch (gimple_omp_target_kind (stmt
))
6132 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6133 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6134 case GF_OMP_TARGET_KIND_OACC_DATA
:
6135 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6136 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
6137 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6138 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
6149 /* Return true if the OMP gimple statement STMT is offloaded. */
6152 is_gimple_omp_offloaded (const gimple
*stmt
)
6154 gcc_assert (is_gimple_omp (stmt
));
6155 switch (gimple_code (stmt
))
6157 case GIMPLE_OMP_TARGET
:
6158 switch (gimple_omp_target_kind (stmt
))
6160 case GF_OMP_TARGET_KIND_REGION
:
6161 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6162 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6173 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6176 gimple_nop_p (const gimple
*g
)
6178 return gimple_code (g
) == GIMPLE_NOP
;
6182 /* Return true if GS is a GIMPLE_RESX. */
6185 is_gimple_resx (const gimple
*gs
)
6187 return gimple_code (gs
) == GIMPLE_RESX
;
6190 /* Return the type of the main expression computed by STMT. Return
6191 void_type_node if the statement computes nothing. */
6194 gimple_expr_type (const gimple
*stmt
)
6196 enum gimple_code code
= gimple_code (stmt
);
6197 /* In general we want to pass out a type that can be substituted
6198 for both the RHS and the LHS types if there is a possibly
6199 useless conversion involved. That means returning the
6200 original RHS type as far as we can reconstruct it. */
6201 if (code
== GIMPLE_CALL
)
6203 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6204 if (gimple_call_internal_p (call_stmt
)
6205 && gimple_call_internal_fn (call_stmt
) == IFN_MASK_STORE
)
6206 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6208 return gimple_call_return_type (call_stmt
);
6210 else if (code
== GIMPLE_ASSIGN
)
6212 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6213 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6215 /* As fallback use the type of the LHS. */
6216 return TREE_TYPE (gimple_get_lhs (stmt
));
6218 else if (code
== GIMPLE_COND
)
6219 return boolean_type_node
;
6221 return void_type_node
;
6224 /* Enum and arrays used for allocation stats. Keep in sync with
6225 gimple.c:gimple_alloc_kind_names. */
6226 enum gimple_alloc_kind
6228 gimple_alloc_kind_assign
, /* Assignments. */
6229 gimple_alloc_kind_phi
, /* PHI nodes. */
6230 gimple_alloc_kind_cond
, /* Conditionals. */
6231 gimple_alloc_kind_rest
, /* Everything else. */
6232 gimple_alloc_kind_all
6235 extern int gimple_alloc_counts
[];
6236 extern int gimple_alloc_sizes
[];
6238 /* Return the allocation kind for a given stmt CODE. */
6239 static inline enum gimple_alloc_kind
6240 gimple_alloc_kind (enum gimple_code code
)
6245 return gimple_alloc_kind_assign
;
6247 return gimple_alloc_kind_phi
;
6249 return gimple_alloc_kind_cond
;
6251 return gimple_alloc_kind_rest
;
6255 /* Return true if a location should not be emitted for this statement
6256 by annotate_all_with_location. */
6259 gimple_do_not_emit_location_p (gimple
*g
)
6261 return gimple_plf (g
, GF_PLF_1
);
6264 /* Mark statement G so a location will not be emitted by
6265 annotate_one_with_location. */
6268 gimple_set_do_not_emit_location (gimple
*g
)
6270 /* The PLF flags are initialized to 0 when a new tuple is created,
6271 so no need to initialize it anywhere. */
6272 gimple_set_plf (g
, GF_PLF_1
, true);
6276 /* Macros for showing usage statistics. */
6277 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6279 : ((x) < 1024*1024*10 \
6281 : (x) / (1024*1024))))
6283 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6285 #endif /* GCC_GIMPLE_H */