1 /* Gimple IR definitions.
3 Copyright (C) 2007-2015 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_OMP_PARALLEL_COMBINED
= 1 << 0,
149 GF_OMP_TASK_TASKLOOP
= 1 << 0,
150 GF_OMP_FOR_KIND_MASK
= (1 << 4) - 1,
151 GF_OMP_FOR_KIND_FOR
= 0,
152 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
153 GF_OMP_FOR_KIND_TASKLOOP
= 2,
154 GF_OMP_FOR_KIND_CILKFOR
= 3,
155 GF_OMP_FOR_KIND_OACC_LOOP
= 4,
156 /* Flag for SIMD variants of OMP_FOR kinds. */
157 GF_OMP_FOR_SIMD
= 1 << 3,
158 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
159 GF_OMP_FOR_KIND_CILKSIMD
= GF_OMP_FOR_SIMD
| 1,
160 GF_OMP_FOR_COMBINED
= 1 << 4,
161 GF_OMP_FOR_COMBINED_INTO
= 1 << 5,
162 GF_OMP_TARGET_KIND_MASK
= (1 << 4) - 1,
163 GF_OMP_TARGET_KIND_REGION
= 0,
164 GF_OMP_TARGET_KIND_DATA
= 1,
165 GF_OMP_TARGET_KIND_UPDATE
= 2,
166 GF_OMP_TARGET_KIND_ENTER_DATA
= 3,
167 GF_OMP_TARGET_KIND_EXIT_DATA
= 4,
168 GF_OMP_TARGET_KIND_OACC_PARALLEL
= 5,
169 GF_OMP_TARGET_KIND_OACC_KERNELS
= 6,
170 GF_OMP_TARGET_KIND_OACC_DATA
= 7,
171 GF_OMP_TARGET_KIND_OACC_UPDATE
= 8,
172 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
= 9,
173 GF_OMP_TARGET_KIND_OACC_DECLARE
= 10,
175 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
176 a thread synchronization via some sort of barrier. The exact barrier
177 that would otherwise be emitted is dependent on the OMP statement with
178 which this return is associated. */
179 GF_OMP_RETURN_NOWAIT
= 1 << 0,
181 GF_OMP_SECTION_LAST
= 1 << 0,
182 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
183 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
184 GF_PREDICT_TAKEN
= 1 << 15
187 /* Currently, there are only two types of gimple debug stmt. Others are
188 envisioned, for example, to enable the generation of is_stmt notes
189 in line number information, to mark sequence points, etc. This
190 subcode is to be used to tell them apart. */
191 enum gimple_debug_subcode
{
192 GIMPLE_DEBUG_BIND
= 0,
193 GIMPLE_DEBUG_SOURCE_BIND
= 1
196 /* Masks for selecting a pass local flag (PLF) to work on. These
197 masks are used by gimple_set_plf and gimple_plf. */
203 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
204 are for 64 bit hosts. */
206 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
207 chain_next ("%h.next"), variable_size
))
211 Main identifying code for a tuple. */
212 ENUM_BITFIELD(gimple_code
) code
: 8;
214 /* Nonzero if a warning should not be emitted on this tuple. */
215 unsigned int no_warning
: 1;
217 /* Nonzero if this tuple has been visited. Passes are responsible
218 for clearing this bit before using it. */
219 unsigned int visited
: 1;
221 /* Nonzero if this tuple represents a non-temporal move. */
222 unsigned int nontemporal_move
: 1;
224 /* Pass local flags. These flags are free for any pass to use as
225 they see fit. Passes should not assume that these flags contain
226 any useful value when the pass starts. Any initial state that
227 the pass requires should be set on entry to the pass. See
228 gimple_set_plf and gimple_plf for usage. */
229 unsigned int plf
: 2;
231 /* Nonzero if this statement has been modified and needs to have its
232 operands rescanned. */
233 unsigned modified
: 1;
235 /* Nonzero if this statement contains volatile operands. */
236 unsigned has_volatile_ops
: 1;
238 /* Padding to get subcode to 16 bit alignment. */
241 /* The SUBCODE field can be used for tuple-specific flags for tuples
242 that do not require subcodes. Note that SUBCODE should be at
243 least as wide as tree codes, as several tuples store tree codes
245 unsigned int subcode
: 16;
247 /* UID of this statement. This is used by passes that want to
248 assign IDs to statements. It must be assigned and used by each
249 pass. By default it should be assumed to contain garbage. */
253 Locus information for debug info. */
256 /* Number of operands in this tuple. */
260 Basic block holding this statement. */
264 Linked lists of gimple statements. The next pointers form
265 a NULL terminated list, the prev pointers are a cyclic list.
266 A gimple statement is hence also a double-ended list of
267 statements, with the pointer itself being the first element,
268 and the prev pointer being the last. */
270 gimple
*GTY((skip
)) prev
;
274 /* Base structure for tuples with operands. */
276 /* This gimple subclass has no tag value. */
278 gimple_statement_with_ops_base
: public gimple
280 /* [ WORD 1-6 ] : base class */
283 SSA operand vectors. NOTE: It should be possible to
284 amalgamate these vectors with the operand vector OP. However,
285 the SSA operand vectors are organized differently and contain
286 more information (like immediate use chaining). */
287 struct use_optype_d
GTY((skip (""))) *use_ops
;
291 /* Statements that take register operands. */
293 struct GTY((tag("GSS_WITH_OPS")))
294 gimple_statement_with_ops
: public gimple_statement_with_ops_base
296 /* [ WORD 1-7 ] : base class */
299 Operand vector. NOTE! This must always be the last field
300 of this structure. In particular, this means that this
301 structure cannot be embedded inside another one. */
302 tree
GTY((length ("%h.num_ops"))) op
[1];
306 /* Base for statements that take both memory and register operands. */
308 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
309 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
311 /* [ WORD 1-7 ] : base class */
314 Virtual operands for this statement. The GC will pick them
315 up via the ssa_names array. */
316 tree
GTY((skip (""))) vdef
;
317 tree
GTY((skip (""))) vuse
;
321 /* Statements that take both memory and register operands. */
323 struct GTY((tag("GSS_WITH_MEM_OPS")))
324 gimple_statement_with_memory_ops
:
325 public gimple_statement_with_memory_ops_base
327 /* [ WORD 1-9 ] : base class */
330 Operand vector. NOTE! This must always be the last field
331 of this structure. In particular, this means that this
332 structure cannot be embedded inside another one. */
333 tree
GTY((length ("%h.num_ops"))) op
[1];
337 /* Call statements that take both memory and register operands. */
339 struct GTY((tag("GSS_CALL")))
340 gcall
: public gimple_statement_with_memory_ops_base
342 /* [ WORD 1-9 ] : base class */
345 struct pt_solution call_used
;
346 struct pt_solution call_clobbered
;
349 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
350 tree
GTY ((tag ("0"))) fntype
;
351 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
355 Operand vector. NOTE! This must always be the last field
356 of this structure. In particular, this means that this
357 structure cannot be embedded inside another one. */
358 tree
GTY((length ("%h.num_ops"))) op
[1];
360 static const enum gimple_code code_
= GIMPLE_CALL
;
364 /* OMP statements. */
366 struct GTY((tag("GSS_OMP")))
367 gimple_statement_omp
: public gimple
369 /* [ WORD 1-6 ] : base class */
378 struct GTY((tag("GSS_BIND")))
379 gbind
: public gimple
381 /* [ WORD 1-6 ] : base class */
384 Variables declared in this scope. */
388 This is different than the BLOCK field in gimple,
389 which is analogous to TREE_BLOCK (i.e., the lexical block holding
390 this statement). This field is the equivalent of BIND_EXPR_BLOCK
391 in tree land (i.e., the lexical scope defined by this bind). See
402 struct GTY((tag("GSS_CATCH")))
403 gcatch
: public gimple
405 /* [ WORD 1-6 ] : base class */
415 /* GIMPLE_EH_FILTER */
417 struct GTY((tag("GSS_EH_FILTER")))
418 geh_filter
: public gimple
420 /* [ WORD 1-6 ] : base class */
433 struct GTY((tag("GSS_EH_ELSE")))
434 geh_else
: public gimple
436 /* [ WORD 1-6 ] : base class */
439 gimple_seq n_body
, e_body
;
442 /* GIMPLE_EH_MUST_NOT_THROW */
444 struct GTY((tag("GSS_EH_MNT")))
445 geh_mnt
: public gimple
447 /* [ WORD 1-6 ] : base class */
449 /* [ WORD 7 ] Abort function decl. */
455 struct GTY((tag("GSS_PHI")))
458 /* [ WORD 1-6 ] : base class */
468 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
472 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
474 struct GTY((tag("GSS_EH_CTRL")))
475 gimple_statement_eh_ctrl
: public gimple
477 /* [ WORD 1-6 ] : base class */
480 Exception region number. */
484 struct GTY((tag("GSS_EH_CTRL")))
485 gresx
: public gimple_statement_eh_ctrl
487 /* No extra fields; adds invariant:
488 stmt->code == GIMPLE_RESX. */
491 struct GTY((tag("GSS_EH_CTRL")))
492 geh_dispatch
: public gimple_statement_eh_ctrl
494 /* No extra fields; adds invariant:
495 stmt->code == GIMPLE_EH_DISPATH. */
501 struct GTY((tag("GSS_TRY")))
504 /* [ WORD 1-6 ] : base class */
507 Expression to evaluate. */
511 Cleanup expression. */
515 /* Kind of GIMPLE_TRY statements. */
516 enum gimple_try_flags
519 GIMPLE_TRY_CATCH
= 1 << 0,
522 GIMPLE_TRY_FINALLY
= 1 << 1,
523 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
525 /* Analogous to TRY_CATCH_IS_CLEANUP. */
526 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
529 /* GIMPLE_WITH_CLEANUP_EXPR */
531 struct GTY((tag("GSS_WCE")))
532 gimple_statement_wce
: public gimple
534 /* [ WORD 1-6 ] : base class */
536 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
537 executed if an exception is thrown, not on normal exit of its
538 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
542 Cleanup expression. */
549 struct GTY((tag("GSS_ASM")))
550 gasm
: public gimple_statement_with_memory_ops_base
552 /* [ WORD 1-9 ] : base class */
555 __asm__ statement. */
559 Number of inputs, outputs, clobbers, labels. */
566 Operand vector. NOTE! This must always be the last field
567 of this structure. In particular, this means that this
568 structure cannot be embedded inside another one. */
569 tree
GTY((length ("%h.num_ops"))) op
[1];
572 /* GIMPLE_OMP_CRITICAL */
574 struct GTY((tag("GSS_OMP_CRITICAL")))
575 gomp_critical
: public gimple_statement_omp
577 /* [ WORD 1-7 ] : base class */
583 Critical section name. */
588 struct GTY(()) gimple_omp_for_iter
{
589 /* Condition code. */
592 /* Index variable. */
607 struct GTY((tag("GSS_OMP_FOR")))
608 gomp_for
: public gimple_statement_omp
610 /* [ WORD 1-7 ] : base class */
616 Number of elements in iter array. */
620 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
623 Pre-body evaluated before the loop body begins. */
628 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
630 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
631 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
633 /* [ WORD 1-7 ] : base class */
640 Child function holding the body of the parallel region. */
644 Shared data argument. */
648 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
649 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
650 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
652 /* No extra fields; adds invariant:
653 stmt->code == GIMPLE_OMP_PARALLEL
654 || stmt->code == GIMPLE_OMP_TASK. */
657 /* GIMPLE_OMP_PARALLEL */
658 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
659 gomp_parallel
: public gimple_statement_omp_taskreg
661 /* No extra fields; adds invariant:
662 stmt->code == GIMPLE_OMP_PARALLEL. */
665 /* GIMPLE_OMP_TARGET */
666 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
667 gomp_target
: public gimple_statement_omp_parallel_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_TARGET. */
673 /* GIMPLE_OMP_TASK */
675 struct GTY((tag("GSS_OMP_TASK")))
676 gomp_task
: public gimple_statement_omp_taskreg
678 /* [ WORD 1-10 ] : base class */
681 Child function holding firstprivate initialization if needed. */
685 Size and alignment in bytes of the argument data block. */
691 /* GIMPLE_OMP_SECTION */
692 /* Uses struct gimple_statement_omp. */
695 /* GIMPLE_OMP_SECTIONS */
697 struct GTY((tag("GSS_OMP_SECTIONS")))
698 gomp_sections
: public gimple_statement_omp
700 /* [ WORD 1-7 ] : base class */
706 The control variable used for deciding which of the sections to
711 /* GIMPLE_OMP_CONTINUE.
713 Note: This does not inherit from gimple_statement_omp, because we
714 do not need the body field. */
716 struct GTY((tag("GSS_OMP_CONTINUE")))
717 gomp_continue
: public gimple
719 /* [ WORD 1-6 ] : base class */
728 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
730 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
731 gimple_statement_omp_single_layout
: public gimple_statement_omp
733 /* [ WORD 1-7 ] : base class */
739 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
740 gomp_single
: public gimple_statement_omp_single_layout
742 /* No extra fields; adds invariant:
743 stmt->code == GIMPLE_OMP_SINGLE. */
746 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
747 gomp_teams
: public gimple_statement_omp_single_layout
749 /* No extra fields; adds invariant:
750 stmt->code == GIMPLE_OMP_TEAMS. */
753 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
754 gomp_ordered
: public gimple_statement_omp_single_layout
756 /* No extra fields; adds invariant:
757 stmt->code == GIMPLE_OMP_ORDERED. */
761 /* GIMPLE_OMP_ATOMIC_LOAD.
762 Note: This is based on gimple, not g_s_omp, because g_s_omp
763 contains a sequence, which we don't need here. */
765 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
766 gomp_atomic_load
: public gimple
768 /* [ WORD 1-6 ] : base class */
774 /* GIMPLE_OMP_ATOMIC_STORE.
775 See note on GIMPLE_OMP_ATOMIC_LOAD. */
777 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
778 gimple_statement_omp_atomic_store_layout
: public gimple
780 /* [ WORD 1-6 ] : base class */
786 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
788 public gimple_statement_omp_atomic_store_layout
790 /* No extra fields; adds invariant:
791 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
794 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
795 gimple_statement_omp_return
:
796 public gimple_statement_omp_atomic_store_layout
798 /* No extra fields; adds invariant:
799 stmt->code == GIMPLE_OMP_RETURN. */
802 /* GIMPLE_TRANSACTION. */
804 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
806 /* The __transaction_atomic was declared [[outer]] or it is
807 __transaction_relaxed. */
808 #define GTMA_IS_OUTER (1u << 0)
809 #define GTMA_IS_RELAXED (1u << 1)
810 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
812 /* The transaction is seen to not have an abort. */
813 #define GTMA_HAVE_ABORT (1u << 2)
814 /* The transaction is seen to have loads or stores. */
815 #define GTMA_HAVE_LOAD (1u << 3)
816 #define GTMA_HAVE_STORE (1u << 4)
817 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
818 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
819 /* The transaction WILL enter serial irrevocable mode.
820 An irrevocable block post-dominates the entire transaction, such
821 that all invocations of the transaction will go serial-irrevocable.
822 In such case, we don't bother instrumenting the transaction, and
823 tell the runtime that it should begin the transaction in
824 serial-irrevocable mode. */
825 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
826 /* The transaction contains no instrumentation code whatsover, most
827 likely because it is guaranteed to go irrevocable upon entry. */
828 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
830 struct GTY((tag("GSS_TRANSACTION")))
831 gtransaction
: public gimple_statement_with_memory_ops_base
833 /* [ WORD 1-9 ] : base class */
842 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
843 enum gimple_statement_structure_enum
{
844 #include "gsstruct.def"
849 /* A statement with the invariant that
850 stmt->code == GIMPLE_COND
851 i.e. a conditional jump statement. */
853 struct GTY((tag("GSS_WITH_OPS")))
854 gcond
: public gimple_statement_with_ops
856 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
857 static const enum gimple_code code_
= GIMPLE_COND
;
860 /* A statement with the invariant that
861 stmt->code == GIMPLE_DEBUG
862 i.e. a debug statement. */
864 struct GTY((tag("GSS_WITH_OPS")))
865 gdebug
: public gimple_statement_with_ops
867 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
870 /* A statement with the invariant that
871 stmt->code == GIMPLE_GOTO
872 i.e. a goto statement. */
874 struct GTY((tag("GSS_WITH_OPS")))
875 ggoto
: public gimple_statement_with_ops
877 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
880 /* A statement with the invariant that
881 stmt->code == GIMPLE_LABEL
882 i.e. a label statement. */
884 struct GTY((tag("GSS_WITH_OPS")))
885 glabel
: public gimple_statement_with_ops
887 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
890 /* A statement with the invariant that
891 stmt->code == GIMPLE_SWITCH
892 i.e. a switch statement. */
894 struct GTY((tag("GSS_WITH_OPS")))
895 gswitch
: public gimple_statement_with_ops
897 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
900 /* A statement with the invariant that
901 stmt->code == GIMPLE_ASSIGN
902 i.e. an assignment statement. */
904 struct GTY((tag("GSS_WITH_MEM_OPS")))
905 gassign
: public gimple_statement_with_memory_ops
907 static const enum gimple_code code_
= GIMPLE_ASSIGN
;
908 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
911 /* A statement with the invariant that
912 stmt->code == GIMPLE_RETURN
913 i.e. a return statement. */
915 struct GTY((tag("GSS_WITH_MEM_OPS")))
916 greturn
: public gimple_statement_with_memory_ops
918 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
924 is_a_helper
<gasm
*>::test (gimple
*gs
)
926 return gs
->code
== GIMPLE_ASM
;
932 is_a_helper
<gassign
*>::test (gimple
*gs
)
934 return gs
->code
== GIMPLE_ASSIGN
;
940 is_a_helper
<const gassign
*>::test (const gimple
*gs
)
942 return gs
->code
== GIMPLE_ASSIGN
;
948 is_a_helper
<gbind
*>::test (gimple
*gs
)
950 return gs
->code
== GIMPLE_BIND
;
956 is_a_helper
<gcall
*>::test (gimple
*gs
)
958 return gs
->code
== GIMPLE_CALL
;
964 is_a_helper
<gcatch
*>::test (gimple
*gs
)
966 return gs
->code
== GIMPLE_CATCH
;
972 is_a_helper
<gcond
*>::test (gimple
*gs
)
974 return gs
->code
== GIMPLE_COND
;
980 is_a_helper
<const gcond
*>::test (const gimple
*gs
)
982 return gs
->code
== GIMPLE_COND
;
988 is_a_helper
<gdebug
*>::test (gimple
*gs
)
990 return gs
->code
== GIMPLE_DEBUG
;
996 is_a_helper
<ggoto
*>::test (gimple
*gs
)
998 return gs
->code
== GIMPLE_GOTO
;
1004 is_a_helper
<glabel
*>::test (gimple
*gs
)
1006 return gs
->code
== GIMPLE_LABEL
;
1012 is_a_helper
<gresx
*>::test (gimple
*gs
)
1014 return gs
->code
== GIMPLE_RESX
;
1020 is_a_helper
<geh_dispatch
*>::test (gimple
*gs
)
1022 return gs
->code
== GIMPLE_EH_DISPATCH
;
1028 is_a_helper
<geh_else
*>::test (gimple
*gs
)
1030 return gs
->code
== GIMPLE_EH_ELSE
;
1036 is_a_helper
<geh_filter
*>::test (gimple
*gs
)
1038 return gs
->code
== GIMPLE_EH_FILTER
;
1044 is_a_helper
<geh_mnt
*>::test (gimple
*gs
)
1046 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
1052 is_a_helper
<gomp_atomic_load
*>::test (gimple
*gs
)
1054 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1060 is_a_helper
<gomp_atomic_store
*>::test (gimple
*gs
)
1062 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1068 is_a_helper
<gimple_statement_omp_return
*>::test (gimple
*gs
)
1070 return gs
->code
== GIMPLE_OMP_RETURN
;
1076 is_a_helper
<gomp_continue
*>::test (gimple
*gs
)
1078 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1084 is_a_helper
<gomp_critical
*>::test (gimple
*gs
)
1086 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1092 is_a_helper
<gomp_ordered
*>::test (gimple
*gs
)
1094 return gs
->code
== GIMPLE_OMP_ORDERED
;
1100 is_a_helper
<gomp_for
*>::test (gimple
*gs
)
1102 return gs
->code
== GIMPLE_OMP_FOR
;
1108 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple
*gs
)
1110 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1116 is_a_helper
<gomp_parallel
*>::test (gimple
*gs
)
1118 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1124 is_a_helper
<gomp_target
*>::test (gimple
*gs
)
1126 return gs
->code
== GIMPLE_OMP_TARGET
;
1132 is_a_helper
<gomp_sections
*>::test (gimple
*gs
)
1134 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1140 is_a_helper
<gomp_single
*>::test (gimple
*gs
)
1142 return gs
->code
== GIMPLE_OMP_SINGLE
;
1148 is_a_helper
<gomp_teams
*>::test (gimple
*gs
)
1150 return gs
->code
== GIMPLE_OMP_TEAMS
;
1156 is_a_helper
<gomp_task
*>::test (gimple
*gs
)
1158 return gs
->code
== GIMPLE_OMP_TASK
;
1164 is_a_helper
<gphi
*>::test (gimple
*gs
)
1166 return gs
->code
== GIMPLE_PHI
;
1172 is_a_helper
<greturn
*>::test (gimple
*gs
)
1174 return gs
->code
== GIMPLE_RETURN
;
1180 is_a_helper
<gswitch
*>::test (gimple
*gs
)
1182 return gs
->code
== GIMPLE_SWITCH
;
1188 is_a_helper
<gtransaction
*>::test (gimple
*gs
)
1190 return gs
->code
== GIMPLE_TRANSACTION
;
1196 is_a_helper
<gtry
*>::test (gimple
*gs
)
1198 return gs
->code
== GIMPLE_TRY
;
1204 is_a_helper
<gimple_statement_wce
*>::test (gimple
*gs
)
1206 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1212 is_a_helper
<const gasm
*>::test (const gimple
*gs
)
1214 return gs
->code
== GIMPLE_ASM
;
1220 is_a_helper
<const gbind
*>::test (const gimple
*gs
)
1222 return gs
->code
== GIMPLE_BIND
;
1228 is_a_helper
<const gcall
*>::test (const gimple
*gs
)
1230 return gs
->code
== GIMPLE_CALL
;
1236 is_a_helper
<const gcatch
*>::test (const gimple
*gs
)
1238 return gs
->code
== GIMPLE_CATCH
;
1244 is_a_helper
<const gresx
*>::test (const gimple
*gs
)
1246 return gs
->code
== GIMPLE_RESX
;
1252 is_a_helper
<const geh_dispatch
*>::test (const gimple
*gs
)
1254 return gs
->code
== GIMPLE_EH_DISPATCH
;
1260 is_a_helper
<const geh_filter
*>::test (const gimple
*gs
)
1262 return gs
->code
== GIMPLE_EH_FILTER
;
1268 is_a_helper
<const gomp_atomic_load
*>::test (const gimple
*gs
)
1270 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1276 is_a_helper
<const gomp_atomic_store
*>::test (const gimple
*gs
)
1278 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1284 is_a_helper
<const gimple_statement_omp_return
*>::test (const gimple
*gs
)
1286 return gs
->code
== GIMPLE_OMP_RETURN
;
1292 is_a_helper
<const gomp_continue
*>::test (const gimple
*gs
)
1294 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1300 is_a_helper
<const gomp_critical
*>::test (const gimple
*gs
)
1302 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1308 is_a_helper
<const gomp_ordered
*>::test (const gimple
*gs
)
1310 return gs
->code
== GIMPLE_OMP_ORDERED
;
1316 is_a_helper
<const gomp_for
*>::test (const gimple
*gs
)
1318 return gs
->code
== GIMPLE_OMP_FOR
;
1324 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const gimple
*gs
)
1326 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1332 is_a_helper
<const gomp_parallel
*>::test (const gimple
*gs
)
1334 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1340 is_a_helper
<const gomp_target
*>::test (const gimple
*gs
)
1342 return gs
->code
== GIMPLE_OMP_TARGET
;
1348 is_a_helper
<const gomp_sections
*>::test (const gimple
*gs
)
1350 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1356 is_a_helper
<const gomp_single
*>::test (const gimple
*gs
)
1358 return gs
->code
== GIMPLE_OMP_SINGLE
;
1364 is_a_helper
<const gomp_teams
*>::test (const gimple
*gs
)
1366 return gs
->code
== GIMPLE_OMP_TEAMS
;
1372 is_a_helper
<const gomp_task
*>::test (const gimple
*gs
)
1374 return gs
->code
== GIMPLE_OMP_TASK
;
1380 is_a_helper
<const gphi
*>::test (const gimple
*gs
)
1382 return gs
->code
== GIMPLE_PHI
;
1388 is_a_helper
<const gtransaction
*>::test (const gimple
*gs
)
1390 return gs
->code
== GIMPLE_TRANSACTION
;
1393 /* Offset in bytes to the location of the operand vector.
1394 Zero if there is no operand vector for this tuple structure. */
1395 extern size_t const gimple_ops_offset_
[];
1397 /* Map GIMPLE codes to GSS codes. */
1398 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1400 /* This variable holds the currently expanded gimple statement for purposes
1401 of comminucating the profile info to the builtin expanders. */
1402 extern gimple
*currently_expanding_gimple_stmt
;
1404 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1405 gimple
*gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
1406 greturn
*gimple_build_return (tree
);
1407 void gimple_call_reset_alias_info (gcall
*);
1408 gcall
*gimple_build_call_vec (tree
, vec
<tree
> );
1409 gcall
*gimple_build_call (tree
, unsigned, ...);
1410 gcall
*gimple_build_call_valist (tree
, unsigned, va_list);
1411 gcall
*gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1412 gcall
*gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1413 gcall
*gimple_build_call_from_tree (tree
);
1414 gassign
*gimple_build_assign (tree
, tree CXX_MEM_STAT_INFO
);
1415 gassign
*gimple_build_assign (tree
, enum tree_code
,
1416 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1417 gassign
*gimple_build_assign (tree
, enum tree_code
,
1418 tree
, tree CXX_MEM_STAT_INFO
);
1419 gassign
*gimple_build_assign (tree
, enum tree_code
, tree CXX_MEM_STAT_INFO
);
1420 gcond
*gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1421 gcond
*gimple_build_cond_from_tree (tree
, tree
, tree
);
1422 void gimple_cond_set_condition_from_tree (gcond
*, tree
);
1423 glabel
*gimple_build_label (tree label
);
1424 ggoto
*gimple_build_goto (tree dest
);
1425 gimple
*gimple_build_nop (void);
1426 gbind
*gimple_build_bind (tree
, gimple_seq
, tree
);
1427 gasm
*gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1428 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1429 vec
<tree
, va_gc
> *);
1430 gcatch
*gimple_build_catch (tree
, gimple_seq
);
1431 geh_filter
*gimple_build_eh_filter (tree
, gimple_seq
);
1432 geh_mnt
*gimple_build_eh_must_not_throw (tree
);
1433 geh_else
*gimple_build_eh_else (gimple_seq
, gimple_seq
);
1434 gtry
*gimple_build_try (gimple_seq
, gimple_seq
,
1435 enum gimple_try_flags
);
1436 gimple
*gimple_build_wce (gimple_seq
);
1437 gresx
*gimple_build_resx (int);
1438 gswitch
*gimple_build_switch_nlabels (unsigned, tree
, tree
);
1439 gswitch
*gimple_build_switch (tree
, tree
, vec
<tree
> );
1440 geh_dispatch
*gimple_build_eh_dispatch (int);
1441 gdebug
*gimple_build_debug_bind_stat (tree
, tree
, gimple
* MEM_STAT_DECL
);
1442 #define gimple_build_debug_bind(var,val,stmt) \
1443 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1444 gdebug
*gimple_build_debug_source_bind_stat (tree
, tree
, gimple
* MEM_STAT_DECL
);
1445 #define gimple_build_debug_source_bind(var,val,stmt) \
1446 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1447 gomp_critical
*gimple_build_omp_critical (gimple_seq
, tree
, tree
);
1448 gomp_for
*gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1449 gomp_parallel
*gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1450 gomp_task
*gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1452 gimple
*gimple_build_omp_section (gimple_seq
);
1453 gimple
*gimple_build_omp_master (gimple_seq
);
1454 gimple
*gimple_build_omp_taskgroup (gimple_seq
);
1455 gomp_continue
*gimple_build_omp_continue (tree
, tree
);
1456 gomp_ordered
*gimple_build_omp_ordered (gimple_seq
, tree
);
1457 gimple
*gimple_build_omp_return (bool);
1458 gomp_sections
*gimple_build_omp_sections (gimple_seq
, tree
);
1459 gimple
*gimple_build_omp_sections_switch (void);
1460 gomp_single
*gimple_build_omp_single (gimple_seq
, tree
);
1461 gomp_target
*gimple_build_omp_target (gimple_seq
, int, tree
);
1462 gomp_teams
*gimple_build_omp_teams (gimple_seq
, tree
);
1463 gomp_atomic_load
*gimple_build_omp_atomic_load (tree
, tree
);
1464 gomp_atomic_store
*gimple_build_omp_atomic_store (tree
);
1465 gtransaction
*gimple_build_transaction (gimple_seq
, tree
);
1466 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
*);
1467 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
*);
1468 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1469 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1470 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1472 extern void annotate_all_with_location (gimple_seq
, location_t
);
1473 bool empty_body_p (gimple_seq
);
1474 gimple_seq
gimple_seq_copy (gimple_seq
);
1475 bool gimple_call_same_target_p (const gimple
*, const gimple
*);
1476 int gimple_call_flags (const gimple
*);
1477 int gimple_call_arg_flags (const gcall
*, unsigned);
1478 int gimple_call_return_flags (const gcall
*);
1479 bool gimple_assign_copy_p (gimple
*);
1480 bool gimple_assign_ssa_name_copy_p (gimple
*);
1481 bool gimple_assign_unary_nop_p (gimple
*);
1482 void gimple_set_bb (gimple
*, basic_block
);
1483 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1484 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
1486 tree
gimple_get_lhs (const gimple
*);
1487 void gimple_set_lhs (gimple
*, tree
);
1488 gimple
*gimple_copy (gimple
*);
1489 bool gimple_has_side_effects (const gimple
*);
1490 bool gimple_could_trap_p_1 (gimple
*, bool, bool);
1491 bool gimple_could_trap_p (gimple
*);
1492 bool gimple_assign_rhs_could_trap_p (gimple
*);
1493 extern void dump_gimple_statistics (void);
1494 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1495 extern tree
canonicalize_cond_expr_cond (tree
);
1496 gcall
*gimple_call_copy_skip_args (gcall
*, bitmap
);
1497 extern bool gimple_compare_field_offset (tree
, tree
);
1498 extern tree
gimple_unsigned_type (tree
);
1499 extern tree
gimple_signed_type (tree
);
1500 extern alias_set_type
gimple_get_alias_set (tree
);
1501 extern bool gimple_ior_addresses_taken (bitmap
, gimple
*);
1502 extern bool gimple_builtin_call_types_compatible_p (const gimple
*, tree
);
1503 extern bool gimple_call_builtin_p (const gimple
*);
1504 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_class
);
1505 extern bool gimple_call_builtin_p (const gimple
*, enum built_in_function
);
1506 extern bool gimple_asm_clobbers_memory_p (const gasm
*);
1507 extern void dump_decl_set (FILE *, bitmap
);
1508 extern bool nonfreeing_call_p (gimple
*);
1509 extern bool infer_nonnull_range (gimple
*, tree
);
1510 extern bool infer_nonnull_range_by_dereference (gimple
*, tree
);
1511 extern bool infer_nonnull_range_by_attribute (gimple
*, tree
);
1512 extern void sort_case_labels (vec
<tree
>);
1513 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1514 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1515 extern void gimple_seq_discard (gimple_seq
);
1516 extern void maybe_remove_unused_call_args (struct function
*, gimple
*);
1518 /* Formal (expression) temporary table handling: multiple occurrences of
1519 the same scalar expression are evaluated into the same temporary. */
1521 typedef struct gimple_temp_hash_elt
1524 tree temp
; /* Value */
1527 /* Get the number of the next statement uid to be allocated. */
1528 static inline unsigned int
1529 gimple_stmt_max_uid (struct function
*fn
)
1531 return fn
->last_stmt_uid
;
1534 /* Set the number of the next statement uid to be allocated. */
1536 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1538 fn
->last_stmt_uid
= maxid
;
1541 /* Set the number of the next statement uid to be allocated. */
1542 static inline unsigned int
1543 inc_gimple_stmt_max_uid (struct function
*fn
)
1545 return fn
->last_stmt_uid
++;
1548 /* Return the first node in GIMPLE sequence S. */
1550 static inline gimple_seq_node
1551 gimple_seq_first (gimple_seq s
)
1557 /* Return the first statement in GIMPLE sequence S. */
1559 static inline gimple
*
1560 gimple_seq_first_stmt (gimple_seq s
)
1562 gimple_seq_node n
= gimple_seq_first (s
);
1566 /* Return the first statement in GIMPLE sequence S as a gbind *,
1567 verifying that it has code GIMPLE_BIND in a checked build. */
1569 static inline gbind
*
1570 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1572 gimple_seq_node n
= gimple_seq_first (s
);
1573 return as_a
<gbind
*> (n
);
1577 /* Return the last node in GIMPLE sequence S. */
1579 static inline gimple_seq_node
1580 gimple_seq_last (gimple_seq s
)
1582 return s
? s
->prev
: NULL
;
1586 /* Return the last statement in GIMPLE sequence S. */
1588 static inline gimple
*
1589 gimple_seq_last_stmt (gimple_seq s
)
1591 gimple_seq_node n
= gimple_seq_last (s
);
1596 /* Set the last node in GIMPLE sequence *PS to LAST. */
1599 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1605 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1608 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1614 /* Return true if GIMPLE sequence S is empty. */
1617 gimple_seq_empty_p (gimple_seq s
)
1622 /* Allocate a new sequence and initialize its first element with STMT. */
1624 static inline gimple_seq
1625 gimple_seq_alloc_with_stmt (gimple
*stmt
)
1627 gimple_seq seq
= NULL
;
1628 gimple_seq_add_stmt (&seq
, stmt
);
1633 /* Returns the sequence of statements in BB. */
1635 static inline gimple_seq
1636 bb_seq (const_basic_block bb
)
1638 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1641 static inline gimple_seq
*
1642 bb_seq_addr (basic_block bb
)
1644 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1647 /* Sets the sequence of statements in BB to SEQ. */
1650 set_bb_seq (basic_block bb
, gimple_seq seq
)
1652 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1653 bb
->il
.gimple
.seq
= seq
;
1657 /* Return the code for GIMPLE statement G. */
1659 static inline enum gimple_code
1660 gimple_code (const gimple
*g
)
1666 /* Return the GSS code used by a GIMPLE code. */
1668 static inline enum gimple_statement_structure_enum
1669 gss_for_code (enum gimple_code code
)
1671 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1672 return gss_for_code_
[code
];
1676 /* Return which GSS code is used by GS. */
1678 static inline enum gimple_statement_structure_enum
1679 gimple_statement_structure (gimple
*gs
)
1681 return gss_for_code (gimple_code (gs
));
1685 /* Return true if statement G has sub-statements. This is only true for
1686 High GIMPLE statements. */
1689 gimple_has_substatements (gimple
*g
)
1691 switch (gimple_code (g
))
1695 case GIMPLE_EH_FILTER
:
1696 case GIMPLE_EH_ELSE
:
1698 case GIMPLE_OMP_FOR
:
1699 case GIMPLE_OMP_MASTER
:
1700 case GIMPLE_OMP_TASKGROUP
:
1701 case GIMPLE_OMP_ORDERED
:
1702 case GIMPLE_OMP_SECTION
:
1703 case GIMPLE_OMP_PARALLEL
:
1704 case GIMPLE_OMP_TASK
:
1705 case GIMPLE_OMP_SECTIONS
:
1706 case GIMPLE_OMP_SINGLE
:
1707 case GIMPLE_OMP_TARGET
:
1708 case GIMPLE_OMP_TEAMS
:
1709 case GIMPLE_OMP_CRITICAL
:
1710 case GIMPLE_WITH_CLEANUP_EXPR
:
1711 case GIMPLE_TRANSACTION
:
1720 /* Return the basic block holding statement G. */
1722 static inline basic_block
1723 gimple_bb (const gimple
*g
)
1729 /* Return the lexical scope block holding statement G. */
1732 gimple_block (const gimple
*g
)
1734 return LOCATION_BLOCK (g
->location
);
1738 /* Set BLOCK to be the lexical scope block holding statement G. */
1741 gimple_set_block (gimple
*g
, tree block
)
1743 g
->location
= set_block (g
->location
, block
);
1747 /* Return location information for statement G. */
1749 static inline location_t
1750 gimple_location (const gimple
*g
)
1755 /* Return location information for statement G if g is not NULL.
1756 Otherwise, UNKNOWN_LOCATION is returned. */
1758 static inline location_t
1759 gimple_location_safe (const gimple
*g
)
1761 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1764 /* Set location information for statement G. */
1767 gimple_set_location (gimple
*g
, location_t location
)
1769 g
->location
= location
;
1773 /* Return true if G contains location information. */
1776 gimple_has_location (const gimple
*g
)
1778 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1782 /* Return the file name of the location of STMT. */
1784 static inline const char *
1785 gimple_filename (const gimple
*stmt
)
1787 return LOCATION_FILE (gimple_location (stmt
));
1791 /* Return the line number of the location of STMT. */
1794 gimple_lineno (const gimple
*stmt
)
1796 return LOCATION_LINE (gimple_location (stmt
));
1800 /* Determine whether SEQ is a singleton. */
1803 gimple_seq_singleton_p (gimple_seq seq
)
1805 return ((gimple_seq_first (seq
) != NULL
)
1806 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1809 /* Return true if no warnings should be emitted for statement STMT. */
1812 gimple_no_warning_p (const gimple
*stmt
)
1814 return stmt
->no_warning
;
1817 /* Set the no_warning flag of STMT to NO_WARNING. */
1820 gimple_set_no_warning (gimple
*stmt
, bool no_warning
)
1822 stmt
->no_warning
= (unsigned) no_warning
;
1825 /* Set the visited status on statement STMT to VISITED_P.
1827 Please note that this 'visited' property of the gimple statement is
1828 supposed to be undefined at pass boundaries. This means that a
1829 given pass should not assume it contains any useful value when the
1830 pass starts and thus can set it to any value it sees fit.
1832 You can learn more about the visited property of the gimple
1833 statement by reading the comments of the 'visited' data member of
1838 gimple_set_visited (gimple
*stmt
, bool visited_p
)
1840 stmt
->visited
= (unsigned) visited_p
;
1844 /* Return the visited status for statement STMT.
1846 Please note that this 'visited' property of the gimple statement is
1847 supposed to be undefined at pass boundaries. This means that a
1848 given pass should not assume it contains any useful value when the
1849 pass starts and thus can set it to any value it sees fit.
1851 You can learn more about the visited property of the gimple
1852 statement by reading the comments of the 'visited' data member of
1856 gimple_visited_p (gimple
*stmt
)
1858 return stmt
->visited
;
1862 /* Set pass local flag PLF on statement STMT to VAL_P.
1864 Please note that this PLF property of the gimple statement is
1865 supposed to be undefined at pass boundaries. This means that a
1866 given pass should not assume it contains any useful value when the
1867 pass starts and thus can set it to any value it sees fit.
1869 You can learn more about the PLF property by reading the comment of
1870 the 'plf' data member of struct gimple_statement_structure. */
1873 gimple_set_plf (gimple
*stmt
, enum plf_mask plf
, bool val_p
)
1876 stmt
->plf
|= (unsigned int) plf
;
1878 stmt
->plf
&= ~((unsigned int) plf
);
1882 /* Return the value of pass local flag PLF on statement STMT.
1884 Please note that this 'plf' property of the gimple statement is
1885 supposed to be undefined at pass boundaries. This means that a
1886 given pass should not assume it contains any useful value when the
1887 pass starts and thus can set it to any value it sees fit.
1889 You can learn more about the plf property by reading the comment of
1890 the 'plf' data member of struct gimple_statement_structure. */
1892 static inline unsigned int
1893 gimple_plf (gimple
*stmt
, enum plf_mask plf
)
1895 return stmt
->plf
& ((unsigned int) plf
);
1899 /* Set the UID of statement.
1901 Please note that this UID property is supposed to be undefined at
1902 pass boundaries. This means that a given pass should not assume it
1903 contains any useful value when the pass starts and thus can set it
1904 to any value it sees fit. */
1907 gimple_set_uid (gimple
*g
, unsigned uid
)
1913 /* Return 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. */
1920 static inline unsigned
1921 gimple_uid (const gimple
*g
)
1927 /* Make statement G a singleton sequence. */
1930 gimple_init_singleton (gimple
*g
)
1937 /* Return true if GIMPLE statement G has register or memory operands. */
1940 gimple_has_ops (const gimple
*g
)
1942 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1948 is_a_helper
<const gimple_statement_with_ops
*>::test (const gimple
*gs
)
1950 return gimple_has_ops (gs
);
1956 is_a_helper
<gimple_statement_with_ops
*>::test (gimple
*gs
)
1958 return gimple_has_ops (gs
);
1961 /* Return true if GIMPLE statement G has memory operands. */
1964 gimple_has_mem_ops (const gimple
*g
)
1966 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1972 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const gimple
*gs
)
1974 return gimple_has_mem_ops (gs
);
1980 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple
*gs
)
1982 return gimple_has_mem_ops (gs
);
1985 /* Return the set of USE operands for statement G. */
1987 static inline struct use_optype_d
*
1988 gimple_use_ops (const gimple
*g
)
1990 const gimple_statement_with_ops
*ops_stmt
=
1991 dyn_cast
<const gimple_statement_with_ops
*> (g
);
1994 return ops_stmt
->use_ops
;
1998 /* Set USE to be the set of USE operands for statement G. */
2001 gimple_set_use_ops (gimple
*g
, struct use_optype_d
*use
)
2003 gimple_statement_with_ops
*ops_stmt
=
2004 as_a
<gimple_statement_with_ops
*> (g
);
2005 ops_stmt
->use_ops
= use
;
2009 /* Return the single VUSE operand of the statement G. */
2012 gimple_vuse (const gimple
*g
)
2014 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2015 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2018 return mem_ops_stmt
->vuse
;
2021 /* Return the single VDEF operand of the statement G. */
2024 gimple_vdef (const gimple
*g
)
2026 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
2027 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
2030 return mem_ops_stmt
->vdef
;
2033 /* Return the single VUSE operand of the statement G. */
2035 static inline tree
*
2036 gimple_vuse_ptr (gimple
*g
)
2038 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2039 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2042 return &mem_ops_stmt
->vuse
;
2045 /* Return the single VDEF operand of the statement G. */
2047 static inline tree
*
2048 gimple_vdef_ptr (gimple
*g
)
2050 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2051 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
2054 return &mem_ops_stmt
->vdef
;
2057 /* Set the single VUSE operand of the statement G. */
2060 gimple_set_vuse (gimple
*g
, tree vuse
)
2062 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2063 as_a
<gimple_statement_with_memory_ops
*> (g
);
2064 mem_ops_stmt
->vuse
= vuse
;
2067 /* Set the single VDEF operand of the statement G. */
2070 gimple_set_vdef (gimple
*g
, tree vdef
)
2072 gimple_statement_with_memory_ops
*mem_ops_stmt
=
2073 as_a
<gimple_statement_with_memory_ops
*> (g
);
2074 mem_ops_stmt
->vdef
= vdef
;
2078 /* Return true if statement G has operands and the modified field has
2082 gimple_modified_p (const gimple
*g
)
2084 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
2088 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2089 a MODIFIED field. */
2092 gimple_set_modified (gimple
*s
, bool modifiedp
)
2094 if (gimple_has_ops (s
))
2095 s
->modified
= (unsigned) modifiedp
;
2099 /* Return the tree code for the expression computed by STMT. This is
2100 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2101 GIMPLE_CALL, return CALL_EXPR as the expression code for
2102 consistency. This is useful when the caller needs to deal with the
2103 three kinds of computation that GIMPLE supports. */
2105 static inline enum tree_code
2106 gimple_expr_code (const gimple
*stmt
)
2108 enum gimple_code code
= gimple_code (stmt
);
2109 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
2110 return (enum tree_code
) stmt
->subcode
;
2113 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
2119 /* Return true if statement STMT contains volatile operands. */
2122 gimple_has_volatile_ops (const gimple
*stmt
)
2124 if (gimple_has_mem_ops (stmt
))
2125 return stmt
->has_volatile_ops
;
2131 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2134 gimple_set_has_volatile_ops (gimple
*stmt
, bool volatilep
)
2136 if (gimple_has_mem_ops (stmt
))
2137 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2140 /* Return true if STMT is in a transaction. */
2143 gimple_in_transaction (const gimple
*stmt
)
2145 return bb_in_transaction (gimple_bb (stmt
));
2148 /* Return true if statement STMT may access memory. */
2151 gimple_references_memory_p (gimple
*stmt
)
2153 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2157 /* Return the subcode for OMP statement S. */
2159 static inline unsigned
2160 gimple_omp_subcode (const gimple
*s
)
2162 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2163 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2167 /* Set the subcode for OMP statement S to SUBCODE. */
2170 gimple_omp_set_subcode (gimple
*s
, unsigned int subcode
)
2172 /* We only have 16 bits for the subcode. Assert that we are not
2174 gcc_gimple_checking_assert (subcode
< (1 << 16));
2175 s
->subcode
= subcode
;
2178 /* Set the nowait flag on OMP_RETURN statement S. */
2181 gimple_omp_return_set_nowait (gimple
*s
)
2183 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2184 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2188 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2192 gimple_omp_return_nowait_p (const gimple
*g
)
2194 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2195 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2199 /* Set the LHS of OMP return. */
2202 gimple_omp_return_set_lhs (gimple
*g
, tree lhs
)
2204 gimple_statement_omp_return
*omp_return_stmt
=
2205 as_a
<gimple_statement_omp_return
*> (g
);
2206 omp_return_stmt
->val
= lhs
;
2210 /* Get the LHS of OMP return. */
2213 gimple_omp_return_lhs (const gimple
*g
)
2215 const gimple_statement_omp_return
*omp_return_stmt
=
2216 as_a
<const gimple_statement_omp_return
*> (g
);
2217 return omp_return_stmt
->val
;
2221 /* Return a pointer to the LHS of OMP return. */
2223 static inline tree
*
2224 gimple_omp_return_lhs_ptr (gimple
*g
)
2226 gimple_statement_omp_return
*omp_return_stmt
=
2227 as_a
<gimple_statement_omp_return
*> (g
);
2228 return &omp_return_stmt
->val
;
2232 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2236 gimple_omp_section_last_p (const gimple
*g
)
2238 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2239 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2243 /* Set the GF_OMP_SECTION_LAST flag on G. */
2246 gimple_omp_section_set_last (gimple
*g
)
2248 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2249 g
->subcode
|= GF_OMP_SECTION_LAST
;
2253 /* Return true if OMP parallel statement G has the
2254 GF_OMP_PARALLEL_COMBINED flag set. */
2257 gimple_omp_parallel_combined_p (const gimple
*g
)
2259 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2260 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2264 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2265 value of COMBINED_P. */
2268 gimple_omp_parallel_set_combined_p (gimple
*g
, bool combined_p
)
2270 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2272 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2274 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2278 /* Return true if OMP atomic load/store statement G has the
2279 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2282 gimple_omp_atomic_need_value_p (const gimple
*g
)
2284 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2285 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2286 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2290 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2293 gimple_omp_atomic_set_need_value (gimple
*g
)
2295 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2296 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2297 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2301 /* Return true if OMP atomic load/store statement G has the
2302 GF_OMP_ATOMIC_SEQ_CST flag set. */
2305 gimple_omp_atomic_seq_cst_p (const gimple
*g
)
2307 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2308 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2309 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2313 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2316 gimple_omp_atomic_set_seq_cst (gimple
*g
)
2318 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2319 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2320 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2324 /* Return the number of operands for statement GS. */
2326 static inline unsigned
2327 gimple_num_ops (const gimple
*gs
)
2333 /* Set the number of operands for statement GS. */
2336 gimple_set_num_ops (gimple
*gs
, unsigned num_ops
)
2338 gs
->num_ops
= num_ops
;
2342 /* Return the array of operands for statement GS. */
2344 static inline tree
*
2345 gimple_ops (gimple
*gs
)
2349 /* All the tuples have their operand vector at the very bottom
2350 of the structure. Note that those structures that do not
2351 have an operand vector have a zero offset. */
2352 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2353 gcc_gimple_checking_assert (off
!= 0);
2355 return (tree
*) ((char *) gs
+ off
);
2359 /* Return operand I for statement GS. */
2362 gimple_op (const gimple
*gs
, unsigned i
)
2364 if (gimple_has_ops (gs
))
2366 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2367 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2373 /* Return a pointer to operand I for statement GS. */
2375 static inline tree
*
2376 gimple_op_ptr (gimple
*gs
, unsigned i
)
2378 if (gimple_has_ops (gs
))
2380 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2381 return gimple_ops (gs
) + i
;
2387 /* Set operand I of statement GS to OP. */
2390 gimple_set_op (gimple
*gs
, unsigned i
, tree op
)
2392 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2394 /* Note. It may be tempting to assert that OP matches
2395 is_gimple_operand, but that would be wrong. Different tuples
2396 accept slightly different sets of tree operands. Each caller
2397 should perform its own validation. */
2398 gimple_ops (gs
)[i
] = op
;
2401 /* Return true if GS is a GIMPLE_ASSIGN. */
2404 is_gimple_assign (const gimple
*gs
)
2406 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2409 /* Determine if expression CODE is one of the valid expressions that can
2410 be used on the RHS of GIMPLE assignments. */
2412 static inline enum gimple_rhs_class
2413 get_gimple_rhs_class (enum tree_code code
)
2415 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2418 /* Return the LHS of assignment statement GS. */
2421 gimple_assign_lhs (const gassign
*gs
)
2427 gimple_assign_lhs (const gimple
*gs
)
2429 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2430 return gimple_assign_lhs (ass
);
2434 /* Return a pointer to the LHS of assignment statement GS. */
2436 static inline tree
*
2437 gimple_assign_lhs_ptr (gassign
*gs
)
2442 static inline tree
*
2443 gimple_assign_lhs_ptr (gimple
*gs
)
2445 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2446 return gimple_assign_lhs_ptr (ass
);
2450 /* Set LHS to be the LHS operand of assignment statement GS. */
2453 gimple_assign_set_lhs (gassign
*gs
, tree lhs
)
2457 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2458 SSA_NAME_DEF_STMT (lhs
) = gs
;
2462 gimple_assign_set_lhs (gimple
*gs
, tree lhs
)
2464 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2465 gimple_assign_set_lhs (ass
, lhs
);
2469 /* Return the first operand on the RHS of assignment statement GS. */
2472 gimple_assign_rhs1 (const gassign
*gs
)
2478 gimple_assign_rhs1 (const gimple
*gs
)
2480 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2481 return gimple_assign_rhs1 (ass
);
2485 /* Return a pointer to the first operand on the RHS of assignment
2488 static inline tree
*
2489 gimple_assign_rhs1_ptr (gassign
*gs
)
2494 static inline tree
*
2495 gimple_assign_rhs1_ptr (gimple
*gs
)
2497 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2498 return gimple_assign_rhs1_ptr (ass
);
2501 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2504 gimple_assign_set_rhs1 (gassign
*gs
, tree rhs
)
2510 gimple_assign_set_rhs1 (gimple
*gs
, tree rhs
)
2512 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2513 gimple_assign_set_rhs1 (ass
, rhs
);
2517 /* Return the second operand on the RHS of assignment statement GS.
2518 If GS does not have two operands, NULL is returned instead. */
2521 gimple_assign_rhs2 (const gassign
*gs
)
2523 if (gimple_num_ops (gs
) >= 3)
2530 gimple_assign_rhs2 (const gimple
*gs
)
2532 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2533 return gimple_assign_rhs2 (ass
);
2537 /* Return a pointer to the second operand on the RHS of assignment
2540 static inline tree
*
2541 gimple_assign_rhs2_ptr (gassign
*gs
)
2543 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2547 static inline tree
*
2548 gimple_assign_rhs2_ptr (gimple
*gs
)
2550 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2551 return gimple_assign_rhs2_ptr (ass
);
2555 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2558 gimple_assign_set_rhs2 (gassign
*gs
, tree rhs
)
2560 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 3);
2565 gimple_assign_set_rhs2 (gimple
*gs
, tree rhs
)
2567 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2568 return gimple_assign_set_rhs2 (ass
, rhs
);
2571 /* Return the third operand on the RHS of assignment statement GS.
2572 If GS does not have two operands, NULL is returned instead. */
2575 gimple_assign_rhs3 (const gassign
*gs
)
2577 if (gimple_num_ops (gs
) >= 4)
2584 gimple_assign_rhs3 (const gimple
*gs
)
2586 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2587 return gimple_assign_rhs3 (ass
);
2590 /* Return a pointer to the third operand on the RHS of assignment
2593 static inline tree
*
2594 gimple_assign_rhs3_ptr (gimple
*gs
)
2596 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2597 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2602 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2605 gimple_assign_set_rhs3 (gassign
*gs
, tree rhs
)
2607 gcc_gimple_checking_assert (gimple_num_ops (gs
) >= 4);
2612 gimple_assign_set_rhs3 (gimple
*gs
, tree rhs
)
2614 gassign
*ass
= GIMPLE_CHECK2
<gassign
*> (gs
);
2615 gimple_assign_set_rhs3 (ass
, rhs
);
2619 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2620 which expect to see only two operands. */
2623 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2626 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, op2
, NULL
);
2629 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2630 which expect to see only one operands. */
2633 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2636 gimple_assign_set_rhs_with_ops (gsi
, code
, op1
, NULL
, NULL
);
2639 /* Returns true if GS is a nontemporal move. */
2642 gimple_assign_nontemporal_move_p (const gassign
*gs
)
2644 return gs
->nontemporal_move
;
2647 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2650 gimple_assign_set_nontemporal_move (gimple
*gs
, bool nontemporal
)
2652 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2653 gs
->nontemporal_move
= nontemporal
;
2657 /* Return the code of the expression computed on the rhs of assignment
2658 statement GS. In case that the RHS is a single object, returns the
2659 tree code of the object. */
2661 static inline enum tree_code
2662 gimple_assign_rhs_code (const gassign
*gs
)
2664 enum tree_code code
= (enum tree_code
) gs
->subcode
;
2665 /* While we initially set subcode to the TREE_CODE of the rhs for
2666 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2667 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2668 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2669 code
= TREE_CODE (gs
->op
[1]);
2674 static inline enum tree_code
2675 gimple_assign_rhs_code (const gimple
*gs
)
2677 const gassign
*ass
= GIMPLE_CHECK2
<const gassign
*> (gs
);
2678 return gimple_assign_rhs_code (ass
);
2682 /* Set CODE to be the code for the expression computed on the RHS of
2686 gimple_assign_set_rhs_code (gimple
*s
, enum tree_code code
)
2688 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2693 /* Return the gimple rhs class of the code of the expression computed on
2694 the rhs of assignment statement GS.
2695 This will never return GIMPLE_INVALID_RHS. */
2697 static inline enum gimple_rhs_class
2698 gimple_assign_rhs_class (const gimple
*gs
)
2700 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2703 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2704 there is no operator associated with the assignment itself.
2705 Unlike gimple_assign_copy_p, this predicate returns true for
2706 any RHS operand, including those that perform an operation
2707 and do not have the semantics of a copy, such as COND_EXPR. */
2710 gimple_assign_single_p (const gimple
*gs
)
2712 return (is_gimple_assign (gs
)
2713 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2716 /* Return true if GS performs a store to its lhs. */
2719 gimple_store_p (const gimple
*gs
)
2721 tree lhs
= gimple_get_lhs (gs
);
2722 return lhs
&& !is_gimple_reg (lhs
);
2725 /* Return true if GS is an assignment that loads from its rhs1. */
2728 gimple_assign_load_p (const gimple
*gs
)
2731 if (!gimple_assign_single_p (gs
))
2733 rhs
= gimple_assign_rhs1 (gs
);
2734 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2736 rhs
= get_base_address (rhs
);
2737 return (DECL_P (rhs
)
2738 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2742 /* Return true if S is a type-cast assignment. */
2745 gimple_assign_cast_p (const gimple
*s
)
2747 if (is_gimple_assign (s
))
2749 enum tree_code sc
= gimple_assign_rhs_code (s
);
2750 return CONVERT_EXPR_CODE_P (sc
)
2751 || sc
== VIEW_CONVERT_EXPR
2752 || sc
== FIX_TRUNC_EXPR
;
2758 /* Return true if S is a clobber statement. */
2761 gimple_clobber_p (const gimple
*s
)
2763 return gimple_assign_single_p (s
)
2764 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2767 /* Return true if GS is a GIMPLE_CALL. */
2770 is_gimple_call (const gimple
*gs
)
2772 return gimple_code (gs
) == GIMPLE_CALL
;
2775 /* Return the LHS of call statement GS. */
2778 gimple_call_lhs (const gcall
*gs
)
2784 gimple_call_lhs (const gimple
*gs
)
2786 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2787 return gimple_call_lhs (gc
);
2791 /* Return a pointer to the LHS of call statement GS. */
2793 static inline tree
*
2794 gimple_call_lhs_ptr (gcall
*gs
)
2799 static inline tree
*
2800 gimple_call_lhs_ptr (gimple
*gs
)
2802 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2803 return gimple_call_lhs_ptr (gc
);
2807 /* Set LHS to be the LHS operand of call statement GS. */
2810 gimple_call_set_lhs (gcall
*gs
, tree lhs
)
2813 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2814 SSA_NAME_DEF_STMT (lhs
) = gs
;
2818 gimple_call_set_lhs (gimple
*gs
, tree lhs
)
2820 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2821 gimple_call_set_lhs (gc
, lhs
);
2825 /* Return true if call GS calls an internal-only function, as enumerated
2829 gimple_call_internal_p (const gcall
*gs
)
2831 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2835 gimple_call_internal_p (const gimple
*gs
)
2837 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2838 return gimple_call_internal_p (gc
);
2842 /* Return true if call GS is marked as instrumented by
2843 Pointer Bounds Checker. */
2846 gimple_call_with_bounds_p (const gcall
*gs
)
2848 return (gs
->subcode
& GF_CALL_WITH_BOUNDS
) != 0;
2852 gimple_call_with_bounds_p (const gimple
*gs
)
2854 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2855 return gimple_call_with_bounds_p (gc
);
2859 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2860 Pointer Bounds Checker. */
2863 gimple_call_set_with_bounds (gcall
*gs
, bool with_bounds
)
2866 gs
->subcode
|= GF_CALL_WITH_BOUNDS
;
2868 gs
->subcode
&= ~GF_CALL_WITH_BOUNDS
;
2872 gimple_call_set_with_bounds (gimple
*gs
, bool with_bounds
)
2874 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
2875 gimple_call_set_with_bounds (gc
, with_bounds
);
2879 /* Return the target of internal call GS. */
2881 static inline enum internal_fn
2882 gimple_call_internal_fn (const gcall
*gs
)
2884 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2885 return gs
->u
.internal_fn
;
2888 static inline enum internal_fn
2889 gimple_call_internal_fn (const gimple
*gs
)
2891 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2892 return gimple_call_internal_fn (gc
);
2895 /* Return true, if this internal gimple call is unique. */
2898 gimple_call_internal_unique_p (const gcall
*gs
)
2900 return gimple_call_internal_fn (gs
) == IFN_UNIQUE
;
2904 gimple_call_internal_unique_p (const gimple
*gs
)
2906 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2907 return gimple_call_internal_unique_p (gc
);
2910 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2911 that could alter control flow. */
2914 gimple_call_set_ctrl_altering (gcall
*s
, bool ctrl_altering_p
)
2916 if (ctrl_altering_p
)
2917 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2919 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2923 gimple_call_set_ctrl_altering (gimple
*s
, bool ctrl_altering_p
)
2925 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (s
);
2926 gimple_call_set_ctrl_altering (gc
, ctrl_altering_p
);
2929 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2930 flag is set. Such call could not be a stmt in the middle of a bb. */
2933 gimple_call_ctrl_altering_p (const gcall
*gs
)
2935 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2939 gimple_call_ctrl_altering_p (const gimple
*gs
)
2941 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2942 return gimple_call_ctrl_altering_p (gc
);
2946 /* Return the function type of the function called by GS. */
2949 gimple_call_fntype (const gcall
*gs
)
2951 if (gimple_call_internal_p (gs
))
2953 return gs
->u
.fntype
;
2957 gimple_call_fntype (const gimple
*gs
)
2959 const gcall
*call_stmt
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2960 return gimple_call_fntype (call_stmt
);
2963 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2966 gimple_call_set_fntype (gcall
*call_stmt
, tree fntype
)
2968 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt
));
2969 call_stmt
->u
.fntype
= fntype
;
2973 /* Return the tree node representing the function called by call
2977 gimple_call_fn (const gcall
*gs
)
2983 gimple_call_fn (const gimple
*gs
)
2985 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
2986 return gimple_call_fn (gc
);
2989 /* Return a pointer to the tree node representing the function called by call
2992 static inline tree
*
2993 gimple_call_fn_ptr (gcall
*gs
)
2998 static inline tree
*
2999 gimple_call_fn_ptr (gimple
*gs
)
3001 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3002 return gimple_call_fn_ptr (gc
);
3006 /* Set FN to be the function called by call statement GS. */
3009 gimple_call_set_fn (gcall
*gs
, tree fn
)
3011 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3016 /* Set FNDECL to be the function called by call statement GS. */
3019 gimple_call_set_fndecl (gcall
*gs
, tree decl
)
3021 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
3022 gs
->op
[1] = build1_loc (gimple_location (gs
), ADDR_EXPR
,
3023 build_pointer_type (TREE_TYPE (decl
)), decl
);
3027 gimple_call_set_fndecl (gimple
*gs
, tree decl
)
3029 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3030 gimple_call_set_fndecl (gc
, decl
);
3034 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3037 gimple_call_set_internal_fn (gcall
*call_stmt
, enum internal_fn fn
)
3039 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
3040 call_stmt
->u
.internal_fn
= fn
;
3044 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3045 Otherwise return NULL. This function is analogous to
3046 get_callee_fndecl in tree land. */
3049 gimple_call_fndecl (const gcall
*gs
)
3051 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
3055 gimple_call_fndecl (const gimple
*gs
)
3057 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3058 return gimple_call_fndecl (gc
);
3062 /* Return the type returned by call statement GS. */
3065 gimple_call_return_type (const gcall
*gs
)
3067 tree type
= gimple_call_fntype (gs
);
3069 if (type
== NULL_TREE
)
3070 return TREE_TYPE (gimple_call_lhs (gs
));
3072 /* The type returned by a function is the type of its
3074 return TREE_TYPE (type
);
3078 /* Return the static chain for call statement GS. */
3081 gimple_call_chain (const gcall
*gs
)
3087 gimple_call_chain (const gimple
*gs
)
3089 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3090 return gimple_call_chain (gc
);
3094 /* Return a pointer to the static chain for call statement CALL_STMT. */
3096 static inline tree
*
3097 gimple_call_chain_ptr (gcall
*call_stmt
)
3099 return &call_stmt
->op
[2];
3102 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3105 gimple_call_set_chain (gcall
*call_stmt
, tree chain
)
3107 call_stmt
->op
[2] = chain
;
3111 /* Return the number of arguments used by call statement GS. */
3113 static inline unsigned
3114 gimple_call_num_args (const gcall
*gs
)
3116 return gimple_num_ops (gs
) - 3;
3119 static inline unsigned
3120 gimple_call_num_args (const gimple
*gs
)
3122 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3123 return gimple_call_num_args (gc
);
3127 /* Return the argument at position INDEX for call statement GS. */
3130 gimple_call_arg (const gcall
*gs
, unsigned index
)
3132 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3133 return gs
->op
[index
+ 3];
3137 gimple_call_arg (const gimple
*gs
, unsigned index
)
3139 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (gs
);
3140 return gimple_call_arg (gc
, index
);
3144 /* Return a pointer to the argument at position INDEX for call
3147 static inline tree
*
3148 gimple_call_arg_ptr (gcall
*gs
, unsigned index
)
3150 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3151 return &gs
->op
[index
+ 3];
3154 static inline tree
*
3155 gimple_call_arg_ptr (gimple
*gs
, unsigned index
)
3157 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3158 return gimple_call_arg_ptr (gc
, index
);
3162 /* Set ARG to be the argument at position INDEX for call statement GS. */
3165 gimple_call_set_arg (gcall
*gs
, unsigned index
, tree arg
)
3167 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 3);
3168 gs
->op
[index
+ 3] = arg
;
3172 gimple_call_set_arg (gimple
*gs
, unsigned index
, tree arg
)
3174 gcall
*gc
= GIMPLE_CHECK2
<gcall
*> (gs
);
3175 gimple_call_set_arg (gc
, index
, arg
);
3179 /* If TAIL_P is true, mark call statement S as being a tail call
3180 (i.e., a call just before the exit of a function). These calls are
3181 candidate for tail call optimization. */
3184 gimple_call_set_tail (gcall
*s
, bool tail_p
)
3187 s
->subcode
|= GF_CALL_TAILCALL
;
3189 s
->subcode
&= ~GF_CALL_TAILCALL
;
3193 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3196 gimple_call_tail_p (gcall
*s
)
3198 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
3202 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3203 slot optimization. This transformation uses the target of the call
3204 expansion as the return slot for calls that return in memory. */
3207 gimple_call_set_return_slot_opt (gcall
*s
, bool return_slot_opt_p
)
3209 if (return_slot_opt_p
)
3210 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
3212 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
3216 /* Return true if S is marked for return slot optimization. */
3219 gimple_call_return_slot_opt_p (gcall
*s
)
3221 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
3225 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3226 thunk to the thunked-to function. */
3229 gimple_call_set_from_thunk (gcall
*s
, bool from_thunk_p
)
3232 s
->subcode
|= GF_CALL_FROM_THUNK
;
3234 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
3238 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3241 gimple_call_from_thunk_p (gcall
*s
)
3243 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
3247 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3248 argument pack in its argument list. */
3251 gimple_call_set_va_arg_pack (gcall
*s
, bool pass_arg_pack_p
)
3253 if (pass_arg_pack_p
)
3254 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
3256 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
3260 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3261 argument pack in its argument list. */
3264 gimple_call_va_arg_pack_p (gcall
*s
)
3266 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
3270 /* Return true if S is a noreturn call. */
3273 gimple_call_noreturn_p (const gcall
*s
)
3275 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
3279 gimple_call_noreturn_p (const gimple
*s
)
3281 const gcall
*gc
= GIMPLE_CHECK2
<const gcall
*> (s
);
3282 return gimple_call_noreturn_p (gc
);
3286 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3287 even if the called function can throw in other cases. */
3290 gimple_call_set_nothrow (gcall
*s
, bool nothrow_p
)
3293 s
->subcode
|= GF_CALL_NOTHROW
;
3295 s
->subcode
&= ~GF_CALL_NOTHROW
;
3298 /* Return true if S is a nothrow call. */
3301 gimple_call_nothrow_p (gcall
*s
)
3303 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
3306 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3307 is known to be emitted for VLA objects. Those are wrapped by
3308 stack_save/stack_restore calls and hence can't lead to unbounded
3309 stack growth even when they occur in loops. */
3312 gimple_call_set_alloca_for_var (gcall
*s
, bool for_var
)
3315 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
3317 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
3320 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3323 gimple_call_alloca_for_var_p (gcall
*s
)
3325 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
3328 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3331 gimple_call_copy_flags (gcall
*dest_call
, gcall
*orig_call
)
3333 dest_call
->subcode
= orig_call
->subcode
;
3337 /* Return a pointer to the points-to solution for the set of call-used
3338 variables of the call CALL_STMT. */
3340 static inline struct pt_solution
*
3341 gimple_call_use_set (gcall
*call_stmt
)
3343 return &call_stmt
->call_used
;
3347 /* Return a pointer to the points-to solution for the set of call-used
3348 variables of the call CALL_STMT. */
3350 static inline struct pt_solution
*
3351 gimple_call_clobber_set (gcall
*call_stmt
)
3353 return &call_stmt
->call_clobbered
;
3357 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3361 gimple_has_lhs (gimple
*stmt
)
3363 if (is_gimple_assign (stmt
))
3365 if (gcall
*call
= dyn_cast
<gcall
*> (stmt
))
3366 return gimple_call_lhs (call
) != NULL_TREE
;
3371 /* Return the code of the predicate computed by conditional statement GS. */
3373 static inline enum tree_code
3374 gimple_cond_code (const gcond
*gs
)
3376 return (enum tree_code
) gs
->subcode
;
3379 static inline enum tree_code
3380 gimple_cond_code (const gimple
*gs
)
3382 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3383 return gimple_cond_code (gc
);
3387 /* Set CODE to be the predicate code for the conditional statement GS. */
3390 gimple_cond_set_code (gcond
*gs
, enum tree_code code
)
3396 /* Return the LHS of the predicate computed by conditional statement GS. */
3399 gimple_cond_lhs (const gcond
*gs
)
3405 gimple_cond_lhs (const gimple
*gs
)
3407 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3408 return gimple_cond_lhs (gc
);
3411 /* Return the pointer to the LHS of the predicate computed by conditional
3414 static inline tree
*
3415 gimple_cond_lhs_ptr (gcond
*gs
)
3420 /* Set LHS to be the LHS operand of the predicate computed by
3421 conditional statement GS. */
3424 gimple_cond_set_lhs (gcond
*gs
, tree lhs
)
3430 /* Return the RHS operand of the predicate computed by conditional GS. */
3433 gimple_cond_rhs (const gcond
*gs
)
3439 gimple_cond_rhs (const gimple
*gs
)
3441 const gcond
*gc
= GIMPLE_CHECK2
<const gcond
*> (gs
);
3442 return gimple_cond_rhs (gc
);
3445 /* Return the pointer to the RHS operand of the predicate computed by
3448 static inline tree
*
3449 gimple_cond_rhs_ptr (gcond
*gs
)
3455 /* Set RHS to be the RHS operand of the predicate computed by
3456 conditional statement GS. */
3459 gimple_cond_set_rhs (gcond
*gs
, tree rhs
)
3465 /* Return the label used by conditional statement GS when its
3466 predicate evaluates to true. */
3469 gimple_cond_true_label (const gcond
*gs
)
3475 /* Set LABEL to be the label used by conditional statement GS when its
3476 predicate evaluates to true. */
3479 gimple_cond_set_true_label (gcond
*gs
, tree label
)
3485 /* Set LABEL to be the label used by conditional statement GS when its
3486 predicate evaluates to false. */
3489 gimple_cond_set_false_label (gcond
*gs
, tree label
)
3495 /* Return the label used by conditional statement GS when its
3496 predicate evaluates to false. */
3499 gimple_cond_false_label (const gcond
*gs
)
3505 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3508 gimple_cond_make_false (gcond
*gs
)
3510 gimple_cond_set_lhs (gs
, boolean_false_node
);
3511 gimple_cond_set_rhs (gs
, boolean_false_node
);
3512 gs
->subcode
= NE_EXPR
;
3516 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3519 gimple_cond_make_true (gcond
*gs
)
3521 gimple_cond_set_lhs (gs
, boolean_true_node
);
3522 gimple_cond_set_rhs (gs
, boolean_false_node
);
3523 gs
->subcode
= NE_EXPR
;
3526 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3527 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3530 gimple_cond_true_p (const gcond
*gs
)
3532 tree lhs
= gimple_cond_lhs (gs
);
3533 tree rhs
= gimple_cond_rhs (gs
);
3534 enum tree_code code
= gimple_cond_code (gs
);
3536 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3539 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3542 if (code
== NE_EXPR
&& lhs
!= rhs
)
3545 if (code
== EQ_EXPR
&& lhs
== rhs
)
3551 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3552 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3555 gimple_cond_false_p (const gcond
*gs
)
3557 tree lhs
= gimple_cond_lhs (gs
);
3558 tree rhs
= gimple_cond_rhs (gs
);
3559 enum tree_code code
= gimple_cond_code (gs
);
3561 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3564 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3567 if (code
== NE_EXPR
&& lhs
== rhs
)
3570 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3576 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3579 gimple_cond_set_condition (gcond
*stmt
, enum tree_code code
, tree lhs
,
3582 gimple_cond_set_code (stmt
, code
);
3583 gimple_cond_set_lhs (stmt
, lhs
);
3584 gimple_cond_set_rhs (stmt
, rhs
);
3587 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3590 gimple_label_label (const glabel
*gs
)
3596 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3600 gimple_label_set_label (glabel
*gs
, tree label
)
3606 /* Return the destination of the unconditional jump GS. */
3609 gimple_goto_dest (const gimple
*gs
)
3611 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3612 return gimple_op (gs
, 0);
3616 /* Set DEST to be the destination of the unconditonal jump GS. */
3619 gimple_goto_set_dest (ggoto
*gs
, tree dest
)
3625 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3628 gimple_bind_vars (const gbind
*bind_stmt
)
3630 return bind_stmt
->vars
;
3634 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3638 gimple_bind_set_vars (gbind
*bind_stmt
, tree vars
)
3640 bind_stmt
->vars
= vars
;
3644 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3648 gimple_bind_append_vars (gbind
*bind_stmt
, tree vars
)
3650 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3654 static inline gimple_seq
*
3655 gimple_bind_body_ptr (gbind
*bind_stmt
)
3657 return &bind_stmt
->body
;
3660 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3662 static inline gimple_seq
3663 gimple_bind_body (gbind
*gs
)
3665 return *gimple_bind_body_ptr (gs
);
3669 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3673 gimple_bind_set_body (gbind
*bind_stmt
, gimple_seq seq
)
3675 bind_stmt
->body
= seq
;
3679 /* Append a statement to the end of a GIMPLE_BIND's body. */
3682 gimple_bind_add_stmt (gbind
*bind_stmt
, gimple
*stmt
)
3684 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3688 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3691 gimple_bind_add_seq (gbind
*bind_stmt
, gimple_seq seq
)
3693 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3697 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3698 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3701 gimple_bind_block (const gbind
*bind_stmt
)
3703 return bind_stmt
->block
;
3707 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3711 gimple_bind_set_block (gbind
*bind_stmt
, tree block
)
3713 gcc_gimple_checking_assert (block
== NULL_TREE
3714 || TREE_CODE (block
) == BLOCK
);
3715 bind_stmt
->block
= block
;
3719 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3721 static inline unsigned
3722 gimple_asm_ninputs (const gasm
*asm_stmt
)
3724 return asm_stmt
->ni
;
3728 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3730 static inline unsigned
3731 gimple_asm_noutputs (const gasm
*asm_stmt
)
3733 return asm_stmt
->no
;
3737 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3739 static inline unsigned
3740 gimple_asm_nclobbers (const gasm
*asm_stmt
)
3742 return asm_stmt
->nc
;
3745 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3747 static inline unsigned
3748 gimple_asm_nlabels (const gasm
*asm_stmt
)
3750 return asm_stmt
->nl
;
3753 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3756 gimple_asm_input_op (const gasm
*asm_stmt
, unsigned index
)
3758 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3759 return asm_stmt
->op
[index
+ asm_stmt
->no
];
3762 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3765 gimple_asm_set_input_op (gasm
*asm_stmt
, unsigned index
, tree in_op
)
3767 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3768 && TREE_CODE (in_op
) == TREE_LIST
);
3769 asm_stmt
->op
[index
+ asm_stmt
->no
] = in_op
;
3773 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3776 gimple_asm_output_op (const gasm
*asm_stmt
, unsigned index
)
3778 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3779 return asm_stmt
->op
[index
];
3782 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3785 gimple_asm_set_output_op (gasm
*asm_stmt
, unsigned index
, tree out_op
)
3787 gcc_gimple_checking_assert (index
< asm_stmt
->no
3788 && TREE_CODE (out_op
) == TREE_LIST
);
3789 asm_stmt
->op
[index
] = out_op
;
3793 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3796 gimple_asm_clobber_op (const gasm
*asm_stmt
, unsigned index
)
3798 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3799 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
];
3803 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3806 gimple_asm_set_clobber_op (gasm
*asm_stmt
, unsigned index
, tree clobber_op
)
3808 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3809 && TREE_CODE (clobber_op
) == TREE_LIST
);
3810 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->no
] = clobber_op
;
3813 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3816 gimple_asm_label_op (const gasm
*asm_stmt
, unsigned index
)
3818 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3819 return asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
];
3822 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3825 gimple_asm_set_label_op (gasm
*asm_stmt
, unsigned index
, tree label_op
)
3827 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3828 && TREE_CODE (label_op
) == TREE_LIST
);
3829 asm_stmt
->op
[index
+ asm_stmt
->ni
+ asm_stmt
->nc
] = label_op
;
3832 /* Return the string representing the assembly instruction in
3833 GIMPLE_ASM ASM_STMT. */
3835 static inline const char *
3836 gimple_asm_string (const gasm
*asm_stmt
)
3838 return asm_stmt
->string
;
3842 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3845 gimple_asm_volatile_p (const gasm
*asm_stmt
)
3847 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
3851 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3854 gimple_asm_set_volatile (gasm
*asm_stmt
, bool volatile_p
)
3857 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
3859 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
3863 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3866 gimple_asm_set_input (gasm
*asm_stmt
, bool input_p
)
3869 asm_stmt
->subcode
|= GF_ASM_INPUT
;
3871 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
3875 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3878 gimple_asm_input_p (const gasm
*asm_stmt
)
3880 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
3884 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3887 gimple_catch_types (const gcatch
*catch_stmt
)
3889 return catch_stmt
->types
;
3893 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3895 static inline tree
*
3896 gimple_catch_types_ptr (gcatch
*catch_stmt
)
3898 return &catch_stmt
->types
;
3902 /* Return a pointer to the GIMPLE sequence representing the body of
3903 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3905 static inline gimple_seq
*
3906 gimple_catch_handler_ptr (gcatch
*catch_stmt
)
3908 return &catch_stmt
->handler
;
3912 /* Return the GIMPLE sequence representing the body of the handler of
3913 GIMPLE_CATCH statement CATCH_STMT. */
3915 static inline gimple_seq
3916 gimple_catch_handler (gcatch
*catch_stmt
)
3918 return *gimple_catch_handler_ptr (catch_stmt
);
3922 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3925 gimple_catch_set_types (gcatch
*catch_stmt
, tree t
)
3927 catch_stmt
->types
= t
;
3931 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3934 gimple_catch_set_handler (gcatch
*catch_stmt
, gimple_seq handler
)
3936 catch_stmt
->handler
= handler
;
3940 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3943 gimple_eh_filter_types (const gimple
*gs
)
3945 const geh_filter
*eh_filter_stmt
= as_a
<const geh_filter
*> (gs
);
3946 return eh_filter_stmt
->types
;
3950 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3953 static inline tree
*
3954 gimple_eh_filter_types_ptr (gimple
*gs
)
3956 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
3957 return &eh_filter_stmt
->types
;
3961 /* Return a pointer to the sequence of statement to execute when
3962 GIMPLE_EH_FILTER statement fails. */
3964 static inline gimple_seq
*
3965 gimple_eh_filter_failure_ptr (gimple
*gs
)
3967 geh_filter
*eh_filter_stmt
= as_a
<geh_filter
*> (gs
);
3968 return &eh_filter_stmt
->failure
;
3972 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3975 static inline gimple_seq
3976 gimple_eh_filter_failure (gimple
*gs
)
3978 return *gimple_eh_filter_failure_ptr (gs
);
3982 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3986 gimple_eh_filter_set_types (geh_filter
*eh_filter_stmt
, tree types
)
3988 eh_filter_stmt
->types
= types
;
3992 /* Set FAILURE to be the sequence of statements to execute on failure
3993 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3996 gimple_eh_filter_set_failure (geh_filter
*eh_filter_stmt
,
3999 eh_filter_stmt
->failure
= failure
;
4002 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4005 gimple_eh_must_not_throw_fndecl (geh_mnt
*eh_mnt_stmt
)
4007 return eh_mnt_stmt
->fndecl
;
4010 /* Set the function decl to be called by GS to DECL. */
4013 gimple_eh_must_not_throw_set_fndecl (geh_mnt
*eh_mnt_stmt
,
4016 eh_mnt_stmt
->fndecl
= decl
;
4019 /* GIMPLE_EH_ELSE accessors. */
4021 static inline gimple_seq
*
4022 gimple_eh_else_n_body_ptr (geh_else
*eh_else_stmt
)
4024 return &eh_else_stmt
->n_body
;
4027 static inline gimple_seq
4028 gimple_eh_else_n_body (geh_else
*eh_else_stmt
)
4030 return *gimple_eh_else_n_body_ptr (eh_else_stmt
);
4033 static inline gimple_seq
*
4034 gimple_eh_else_e_body_ptr (geh_else
*eh_else_stmt
)
4036 return &eh_else_stmt
->e_body
;
4039 static inline gimple_seq
4040 gimple_eh_else_e_body (geh_else
*eh_else_stmt
)
4042 return *gimple_eh_else_e_body_ptr (eh_else_stmt
);
4046 gimple_eh_else_set_n_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4048 eh_else_stmt
->n_body
= seq
;
4052 gimple_eh_else_set_e_body (geh_else
*eh_else_stmt
, gimple_seq seq
)
4054 eh_else_stmt
->e_body
= seq
;
4057 /* GIMPLE_TRY accessors. */
4059 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4060 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4062 static inline enum gimple_try_flags
4063 gimple_try_kind (const gimple
*gs
)
4065 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
4066 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
4070 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4073 gimple_try_set_kind (gtry
*gs
, enum gimple_try_flags kind
)
4075 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
4076 || kind
== GIMPLE_TRY_FINALLY
);
4077 if (gimple_try_kind (gs
) != kind
)
4078 gs
->subcode
= (unsigned int) kind
;
4082 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4085 gimple_try_catch_is_cleanup (const gimple
*gs
)
4087 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
4088 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
4092 /* Return a pointer to the sequence of statements used as the
4093 body for GIMPLE_TRY GS. */
4095 static inline gimple_seq
*
4096 gimple_try_eval_ptr (gimple
*gs
)
4098 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4099 return &try_stmt
->eval
;
4103 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4105 static inline gimple_seq
4106 gimple_try_eval (gimple
*gs
)
4108 return *gimple_try_eval_ptr (gs
);
4112 /* Return a pointer to the sequence of statements used as the cleanup body for
4115 static inline gimple_seq
*
4116 gimple_try_cleanup_ptr (gimple
*gs
)
4118 gtry
*try_stmt
= as_a
<gtry
*> (gs
);
4119 return &try_stmt
->cleanup
;
4123 /* Return the sequence of statements used as the cleanup body for
4126 static inline gimple_seq
4127 gimple_try_cleanup (gimple
*gs
)
4129 return *gimple_try_cleanup_ptr (gs
);
4133 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4136 gimple_try_set_catch_is_cleanup (gtry
*g
, bool catch_is_cleanup
)
4138 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
4139 if (catch_is_cleanup
)
4140 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
4142 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
4146 /* Set EVAL to be the sequence of statements to use as the body for
4147 GIMPLE_TRY TRY_STMT. */
4150 gimple_try_set_eval (gtry
*try_stmt
, gimple_seq eval
)
4152 try_stmt
->eval
= eval
;
4156 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4157 body for GIMPLE_TRY TRY_STMT. */
4160 gimple_try_set_cleanup (gtry
*try_stmt
, gimple_seq cleanup
)
4162 try_stmt
->cleanup
= cleanup
;
4166 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4168 static inline gimple_seq
*
4169 gimple_wce_cleanup_ptr (gimple
*gs
)
4171 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4172 return &wce_stmt
->cleanup
;
4176 /* Return the cleanup sequence for cleanup statement GS. */
4178 static inline gimple_seq
4179 gimple_wce_cleanup (gimple
*gs
)
4181 return *gimple_wce_cleanup_ptr (gs
);
4185 /* Set CLEANUP to be the cleanup sequence for GS. */
4188 gimple_wce_set_cleanup (gimple
*gs
, gimple_seq cleanup
)
4190 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
4191 wce_stmt
->cleanup
= cleanup
;
4195 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4198 gimple_wce_cleanup_eh_only (const gimple
*gs
)
4200 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4201 return gs
->subcode
!= 0;
4205 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4208 gimple_wce_set_cleanup_eh_only (gimple
*gs
, bool eh_only_p
)
4210 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
4211 gs
->subcode
= (unsigned int) eh_only_p
;
4215 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4217 static inline unsigned
4218 gimple_phi_capacity (const gimple
*gs
)
4220 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4221 return phi_stmt
->capacity
;
4225 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4226 be exactly the number of incoming edges for the basic block holding
4229 static inline unsigned
4230 gimple_phi_num_args (const gimple
*gs
)
4232 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4233 return phi_stmt
->nargs
;
4237 /* Return the SSA name created by GIMPLE_PHI GS. */
4240 gimple_phi_result (const gimple
*gs
)
4242 const gphi
*phi_stmt
= as_a
<const gphi
*> (gs
);
4243 return phi_stmt
->result
;
4246 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4248 static inline tree
*
4249 gimple_phi_result_ptr (gimple
*gs
)
4251 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4252 return &phi_stmt
->result
;
4255 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4258 gimple_phi_set_result (gphi
*phi
, tree result
)
4260 phi
->result
= result
;
4261 if (result
&& TREE_CODE (result
) == SSA_NAME
)
4262 SSA_NAME_DEF_STMT (result
) = phi
;
4266 /* Return the PHI argument corresponding to incoming edge INDEX for
4269 static inline struct phi_arg_d
*
4270 gimple_phi_arg (gimple
*gs
, unsigned index
)
4272 gphi
*phi_stmt
= as_a
<gphi
*> (gs
);
4273 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
4274 return &(phi_stmt
->args
[index
]);
4277 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4278 for GIMPLE_PHI PHI. */
4281 gimple_phi_set_arg (gphi
*phi
, unsigned index
, struct phi_arg_d
* phiarg
)
4283 gcc_gimple_checking_assert (index
<= phi
->nargs
);
4284 phi
->args
[index
] = *phiarg
;
4287 /* Return the PHI nodes for basic block BB, or NULL if there are no
4290 static inline gimple_seq
4291 phi_nodes (const_basic_block bb
)
4293 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4294 return bb
->il
.gimple
.phi_nodes
;
4297 /* Return a pointer to the PHI nodes for basic block BB. */
4299 static inline gimple_seq
*
4300 phi_nodes_ptr (basic_block bb
)
4302 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
4303 return &bb
->il
.gimple
.phi_nodes
;
4306 /* Return the tree operand for argument I of PHI node GS. */
4309 gimple_phi_arg_def (gimple
*gs
, size_t index
)
4311 return gimple_phi_arg (gs
, index
)->def
;
4315 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4317 static inline tree
*
4318 gimple_phi_arg_def_ptr (gphi
*phi
, size_t index
)
4320 return &gimple_phi_arg (phi
, index
)->def
;
4323 /* Return the edge associated with argument I of phi node PHI. */
4326 gimple_phi_arg_edge (gphi
*phi
, size_t i
)
4328 return EDGE_PRED (gimple_bb (phi
), i
);
4331 /* Return the source location of gimple argument I of phi node PHI. */
4333 static inline source_location
4334 gimple_phi_arg_location (gphi
*phi
, size_t i
)
4336 return gimple_phi_arg (phi
, i
)->locus
;
4339 /* Return the source location of the argument on edge E of phi node PHI. */
4341 static inline source_location
4342 gimple_phi_arg_location_from_edge (gphi
*phi
, edge e
)
4344 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
4347 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4350 gimple_phi_arg_set_location (gphi
*phi
, size_t i
, source_location loc
)
4352 gimple_phi_arg (phi
, i
)->locus
= loc
;
4355 /* Return TRUE if argument I of phi node PHI has a location record. */
4358 gimple_phi_arg_has_location (gphi
*phi
, size_t i
)
4360 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4364 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4367 gimple_resx_region (const gresx
*resx_stmt
)
4369 return resx_stmt
->region
;
4372 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4375 gimple_resx_set_region (gresx
*resx_stmt
, int region
)
4377 resx_stmt
->region
= region
;
4380 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4383 gimple_eh_dispatch_region (const geh_dispatch
*eh_dispatch_stmt
)
4385 return eh_dispatch_stmt
->region
;
4388 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4389 EH_DISPATCH_STMT. */
4392 gimple_eh_dispatch_set_region (geh_dispatch
*eh_dispatch_stmt
, int region
)
4394 eh_dispatch_stmt
->region
= region
;
4397 /* Return the number of labels associated with the switch statement GS. */
4399 static inline unsigned
4400 gimple_switch_num_labels (const gswitch
*gs
)
4403 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4404 num_ops
= gimple_num_ops (gs
);
4405 gcc_gimple_checking_assert (num_ops
> 1);
4410 /* Set NLABELS to be the number of labels for the switch statement GS. */
4413 gimple_switch_set_num_labels (gswitch
*g
, unsigned nlabels
)
4415 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4416 gimple_set_num_ops (g
, nlabels
+ 1);
4420 /* Return the index variable used by the switch statement GS. */
4423 gimple_switch_index (const gswitch
*gs
)
4429 /* Return a pointer to the index variable for the switch statement GS. */
4431 static inline tree
*
4432 gimple_switch_index_ptr (gswitch
*gs
)
4438 /* Set INDEX to be the index variable for switch statement GS. */
4441 gimple_switch_set_index (gswitch
*gs
, tree index
)
4443 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4448 /* Return the label numbered INDEX. The default label is 0, followed by any
4449 labels in a switch statement. */
4452 gimple_switch_label (const gswitch
*gs
, unsigned index
)
4454 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4455 return gs
->op
[index
+ 1];
4458 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4461 gimple_switch_set_label (gswitch
*gs
, unsigned index
, tree label
)
4463 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4464 && (label
== NULL_TREE
4465 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4466 gs
->op
[index
+ 1] = label
;
4469 /* Return the default label for a switch statement. */
4472 gimple_switch_default_label (const gswitch
*gs
)
4474 tree label
= gimple_switch_label (gs
, 0);
4475 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4479 /* Set the default label for a switch statement. */
4482 gimple_switch_set_default_label (gswitch
*gs
, tree label
)
4484 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4485 gimple_switch_set_label (gs
, 0, label
);
4488 /* Return true if GS is a GIMPLE_DEBUG statement. */
4491 is_gimple_debug (const gimple
*gs
)
4493 return gimple_code (gs
) == GIMPLE_DEBUG
;
4496 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4499 gimple_debug_bind_p (const gimple
*s
)
4501 if (is_gimple_debug (s
))
4502 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4507 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4510 gimple_debug_bind_get_var (gimple
*dbg
)
4512 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4513 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4514 return gimple_op (dbg
, 0);
4517 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4521 gimple_debug_bind_get_value (gimple
*dbg
)
4523 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4524 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4525 return gimple_op (dbg
, 1);
4528 /* Return a pointer to the value bound to the variable in a
4529 GIMPLE_DEBUG bind statement. */
4531 static inline tree
*
4532 gimple_debug_bind_get_value_ptr (gimple
*dbg
)
4534 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4535 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4536 return gimple_op_ptr (dbg
, 1);
4539 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4542 gimple_debug_bind_set_var (gimple
*dbg
, tree var
)
4544 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4545 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4546 gimple_set_op (dbg
, 0, var
);
4549 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4553 gimple_debug_bind_set_value (gimple
*dbg
, tree value
)
4555 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4556 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4557 gimple_set_op (dbg
, 1, value
);
4560 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4562 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4564 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4568 gimple_debug_bind_reset_value (gimple
*dbg
)
4570 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4571 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4572 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4575 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4579 gimple_debug_bind_has_value_p (gimple
*dbg
)
4581 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4582 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4583 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4586 #undef GIMPLE_DEBUG_BIND_NOVALUE
4588 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4591 gimple_debug_source_bind_p (const gimple
*s
)
4593 if (is_gimple_debug (s
))
4594 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4599 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4602 gimple_debug_source_bind_get_var (gimple
*dbg
)
4604 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4605 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4606 return gimple_op (dbg
, 0);
4609 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4613 gimple_debug_source_bind_get_value (gimple
*dbg
)
4615 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4616 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4617 return gimple_op (dbg
, 1);
4620 /* Return a pointer to the value bound to the variable in a
4621 GIMPLE_DEBUG source bind statement. */
4623 static inline tree
*
4624 gimple_debug_source_bind_get_value_ptr (gimple
*dbg
)
4626 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4627 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4628 return gimple_op_ptr (dbg
, 1);
4631 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4634 gimple_debug_source_bind_set_var (gimple
*dbg
, tree var
)
4636 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4637 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4638 gimple_set_op (dbg
, 0, var
);
4641 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4645 gimple_debug_source_bind_set_value (gimple
*dbg
, tree value
)
4647 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4648 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4649 gimple_set_op (dbg
, 1, value
);
4652 /* Return the line number for EXPR, or return -1 if we have no line
4653 number information for it. */
4655 get_lineno (const gimple
*stmt
)
4662 loc
= gimple_location (stmt
);
4663 if (loc
== UNKNOWN_LOCATION
)
4666 return LOCATION_LINE (loc
);
4669 /* Return a pointer to the body for the OMP statement GS. */
4671 static inline gimple_seq
*
4672 gimple_omp_body_ptr (gimple
*gs
)
4674 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4677 /* Return the body for the OMP statement GS. */
4679 static inline gimple_seq
4680 gimple_omp_body (gimple
*gs
)
4682 return *gimple_omp_body_ptr (gs
);
4685 /* Set BODY to be the body for the OMP statement GS. */
4688 gimple_omp_set_body (gimple
*gs
, gimple_seq body
)
4690 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4694 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4697 gimple_omp_critical_name (const gomp_critical
*crit_stmt
)
4699 return crit_stmt
->name
;
4703 /* Return a pointer to the name associated with OMP critical statement
4706 static inline tree
*
4707 gimple_omp_critical_name_ptr (gomp_critical
*crit_stmt
)
4709 return &crit_stmt
->name
;
4713 /* Set NAME to be the name associated with OMP critical statement
4717 gimple_omp_critical_set_name (gomp_critical
*crit_stmt
, tree name
)
4719 crit_stmt
->name
= name
;
4723 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4726 gimple_omp_critical_clauses (const gomp_critical
*crit_stmt
)
4728 return crit_stmt
->clauses
;
4732 /* Return a pointer to the clauses associated with OMP critical statement
4735 static inline tree
*
4736 gimple_omp_critical_clauses_ptr (gomp_critical
*crit_stmt
)
4738 return &crit_stmt
->clauses
;
4742 /* Set CLAUSES to be the clauses associated with OMP critical statement
4746 gimple_omp_critical_set_clauses (gomp_critical
*crit_stmt
, tree clauses
)
4748 crit_stmt
->clauses
= clauses
;
4752 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4755 gimple_omp_ordered_clauses (const gomp_ordered
*ord_stmt
)
4757 return ord_stmt
->clauses
;
4761 /* Return a pointer to the clauses associated with OMP ordered statement
4764 static inline tree
*
4765 gimple_omp_ordered_clauses_ptr (gomp_ordered
*ord_stmt
)
4767 return &ord_stmt
->clauses
;
4771 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4775 gimple_omp_ordered_set_clauses (gomp_ordered
*ord_stmt
, tree clauses
)
4777 ord_stmt
->clauses
= clauses
;
4781 /* Return the kind of the OMP_FOR statemement G. */
4784 gimple_omp_for_kind (const gimple
*g
)
4786 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4787 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4791 /* Set the kind of the OMP_FOR statement G. */
4794 gimple_omp_for_set_kind (gomp_for
*g
, int kind
)
4796 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4797 | (kind
& GF_OMP_FOR_KIND_MASK
);
4801 /* Return true if OMP_FOR statement G has the
4802 GF_OMP_FOR_COMBINED flag set. */
4805 gimple_omp_for_combined_p (const gimple
*g
)
4807 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4808 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4812 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4813 the boolean value of COMBINED_P. */
4816 gimple_omp_for_set_combined_p (gomp_for
*g
, bool combined_p
)
4819 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4821 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4825 /* Return true if the OMP_FOR statement G has the
4826 GF_OMP_FOR_COMBINED_INTO flag set. */
4829 gimple_omp_for_combined_into_p (const gimple
*g
)
4831 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4832 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4836 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4837 on the boolean value of COMBINED_P. */
4840 gimple_omp_for_set_combined_into_p (gomp_for
*g
, bool combined_p
)
4843 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4845 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4849 /* Return the clauses associated with the OMP_FOR statement GS. */
4852 gimple_omp_for_clauses (const gimple
*gs
)
4854 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4855 return omp_for_stmt
->clauses
;
4859 /* Return a pointer to the clauses associated with the OMP_FOR statement
4862 static inline tree
*
4863 gimple_omp_for_clauses_ptr (gimple
*gs
)
4865 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4866 return &omp_for_stmt
->clauses
;
4870 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4874 gimple_omp_for_set_clauses (gimple
*gs
, tree clauses
)
4876 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4877 omp_for_stmt
->clauses
= clauses
;
4881 /* Get the collapse count of the OMP_FOR statement GS. */
4883 static inline size_t
4884 gimple_omp_for_collapse (gimple
*gs
)
4886 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4887 return omp_for_stmt
->collapse
;
4891 /* Return the condition code associated with the OMP_FOR statement GS. */
4893 static inline enum tree_code
4894 gimple_omp_for_cond (const gimple
*gs
, size_t i
)
4896 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4897 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4898 return omp_for_stmt
->iter
[i
].cond
;
4902 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4905 gimple_omp_for_set_cond (gimple
*gs
, size_t i
, enum tree_code cond
)
4907 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4908 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4909 && i
< omp_for_stmt
->collapse
);
4910 omp_for_stmt
->iter
[i
].cond
= cond
;
4914 /* Return the index variable for the OMP_FOR statement GS. */
4917 gimple_omp_for_index (const gimple
*gs
, size_t i
)
4919 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4920 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4921 return omp_for_stmt
->iter
[i
].index
;
4925 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4927 static inline tree
*
4928 gimple_omp_for_index_ptr (gimple
*gs
, size_t i
)
4930 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4931 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4932 return &omp_for_stmt
->iter
[i
].index
;
4936 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4939 gimple_omp_for_set_index (gimple
*gs
, size_t i
, tree index
)
4941 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4942 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4943 omp_for_stmt
->iter
[i
].index
= index
;
4947 /* Return the initial value for the OMP_FOR statement GS. */
4950 gimple_omp_for_initial (const gimple
*gs
, size_t i
)
4952 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4953 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4954 return omp_for_stmt
->iter
[i
].initial
;
4958 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4960 static inline tree
*
4961 gimple_omp_for_initial_ptr (gimple
*gs
, size_t i
)
4963 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4964 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4965 return &omp_for_stmt
->iter
[i
].initial
;
4969 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4972 gimple_omp_for_set_initial (gimple
*gs
, size_t i
, tree initial
)
4974 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4975 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4976 omp_for_stmt
->iter
[i
].initial
= initial
;
4980 /* Return the final value for the OMP_FOR statement GS. */
4983 gimple_omp_for_final (const gimple
*gs
, size_t i
)
4985 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
4986 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4987 return omp_for_stmt
->iter
[i
].final
;
4991 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4993 static inline tree
*
4994 gimple_omp_for_final_ptr (gimple
*gs
, size_t i
)
4996 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
4997 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4998 return &omp_for_stmt
->iter
[i
].final
;
5002 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5005 gimple_omp_for_set_final (gimple
*gs
, size_t i
, tree final
)
5007 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5008 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5009 omp_for_stmt
->iter
[i
].final
= final
;
5013 /* Return the increment value for the OMP_FOR statement GS. */
5016 gimple_omp_for_incr (const gimple
*gs
, size_t i
)
5018 const gomp_for
*omp_for_stmt
= as_a
<const gomp_for
*> (gs
);
5019 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5020 return omp_for_stmt
->iter
[i
].incr
;
5024 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5026 static inline tree
*
5027 gimple_omp_for_incr_ptr (gimple
*gs
, size_t i
)
5029 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5030 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5031 return &omp_for_stmt
->iter
[i
].incr
;
5035 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5038 gimple_omp_for_set_incr (gimple
*gs
, size_t i
, tree incr
)
5040 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5041 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5042 omp_for_stmt
->iter
[i
].incr
= incr
;
5046 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5047 statement GS starts. */
5049 static inline gimple_seq
*
5050 gimple_omp_for_pre_body_ptr (gimple
*gs
)
5052 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5053 return &omp_for_stmt
->pre_body
;
5057 /* Return the sequence of statements to execute before the OMP_FOR
5058 statement GS starts. */
5060 static inline gimple_seq
5061 gimple_omp_for_pre_body (gimple
*gs
)
5063 return *gimple_omp_for_pre_body_ptr (gs
);
5067 /* Set PRE_BODY to be the sequence of statements to execute before the
5068 OMP_FOR statement GS starts. */
5071 gimple_omp_for_set_pre_body (gimple
*gs
, gimple_seq pre_body
)
5073 gomp_for
*omp_for_stmt
= as_a
<gomp_for
*> (gs
);
5074 omp_for_stmt
->pre_body
= pre_body
;
5078 /* Return the clauses associated with OMP_PARALLEL GS. */
5081 gimple_omp_parallel_clauses (const gimple
*gs
)
5083 const gomp_parallel
*omp_parallel_stmt
= as_a
<const gomp_parallel
*> (gs
);
5084 return omp_parallel_stmt
->clauses
;
5088 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5090 static inline tree
*
5091 gimple_omp_parallel_clauses_ptr (gomp_parallel
*omp_parallel_stmt
)
5093 return &omp_parallel_stmt
->clauses
;
5097 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5100 gimple_omp_parallel_set_clauses (gomp_parallel
*omp_parallel_stmt
,
5103 omp_parallel_stmt
->clauses
= clauses
;
5107 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5110 gimple_omp_parallel_child_fn (const gomp_parallel
*omp_parallel_stmt
)
5112 return omp_parallel_stmt
->child_fn
;
5115 /* Return a pointer to the child function used to hold the body of
5116 OMP_PARALLEL_STMT. */
5118 static inline tree
*
5119 gimple_omp_parallel_child_fn_ptr (gomp_parallel
*omp_parallel_stmt
)
5121 return &omp_parallel_stmt
->child_fn
;
5125 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5128 gimple_omp_parallel_set_child_fn (gomp_parallel
*omp_parallel_stmt
,
5131 omp_parallel_stmt
->child_fn
= child_fn
;
5135 /* Return the artificial argument used to send variables and values
5136 from the parent to the children threads in OMP_PARALLEL_STMT. */
5139 gimple_omp_parallel_data_arg (const gomp_parallel
*omp_parallel_stmt
)
5141 return omp_parallel_stmt
->data_arg
;
5145 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5147 static inline tree
*
5148 gimple_omp_parallel_data_arg_ptr (gomp_parallel
*omp_parallel_stmt
)
5150 return &omp_parallel_stmt
->data_arg
;
5154 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5157 gimple_omp_parallel_set_data_arg (gomp_parallel
*omp_parallel_stmt
,
5160 omp_parallel_stmt
->data_arg
= data_arg
;
5164 /* Return the clauses associated with OMP_TASK GS. */
5167 gimple_omp_task_clauses (const gimple
*gs
)
5169 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5170 return omp_task_stmt
->clauses
;
5174 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5176 static inline tree
*
5177 gimple_omp_task_clauses_ptr (gimple
*gs
)
5179 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5180 return &omp_task_stmt
->clauses
;
5184 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5188 gimple_omp_task_set_clauses (gimple
*gs
, tree clauses
)
5190 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5191 omp_task_stmt
->clauses
= clauses
;
5195 /* Return true if OMP task statement G has the
5196 GF_OMP_TASK_TASKLOOP flag set. */
5199 gimple_omp_task_taskloop_p (const gimple
*g
)
5201 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5202 return (gimple_omp_subcode (g
) & GF_OMP_TASK_TASKLOOP
) != 0;
5206 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5207 value of TASKLOOP_P. */
5210 gimple_omp_task_set_taskloop_p (gimple
*g
, bool taskloop_p
)
5212 GIMPLE_CHECK (g
, GIMPLE_OMP_TASK
);
5214 g
->subcode
|= GF_OMP_TASK_TASKLOOP
;
5216 g
->subcode
&= ~GF_OMP_TASK_TASKLOOP
;
5220 /* Return the child function used to hold the body of OMP_TASK GS. */
5223 gimple_omp_task_child_fn (const gimple
*gs
)
5225 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5226 return omp_task_stmt
->child_fn
;
5229 /* Return a pointer to the child function used to hold the body of
5232 static inline tree
*
5233 gimple_omp_task_child_fn_ptr (gimple
*gs
)
5235 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5236 return &omp_task_stmt
->child_fn
;
5240 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5243 gimple_omp_task_set_child_fn (gimple
*gs
, tree child_fn
)
5245 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5246 omp_task_stmt
->child_fn
= child_fn
;
5250 /* Return the artificial argument used to send variables and values
5251 from the parent to the children threads in OMP_TASK GS. */
5254 gimple_omp_task_data_arg (const gimple
*gs
)
5256 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5257 return omp_task_stmt
->data_arg
;
5261 /* Return a pointer to the data argument for OMP_TASK GS. */
5263 static inline tree
*
5264 gimple_omp_task_data_arg_ptr (gimple
*gs
)
5266 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5267 return &omp_task_stmt
->data_arg
;
5271 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5274 gimple_omp_task_set_data_arg (gimple
*gs
, tree data_arg
)
5276 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5277 omp_task_stmt
->data_arg
= data_arg
;
5281 /* Return the clauses associated with OMP_TASK GS. */
5284 gimple_omp_taskreg_clauses (const gimple
*gs
)
5286 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5287 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5288 return omp_taskreg_stmt
->clauses
;
5292 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5294 static inline tree
*
5295 gimple_omp_taskreg_clauses_ptr (gimple
*gs
)
5297 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5298 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5299 return &omp_taskreg_stmt
->clauses
;
5303 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5307 gimple_omp_taskreg_set_clauses (gimple
*gs
, tree clauses
)
5309 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5310 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5311 omp_taskreg_stmt
->clauses
= clauses
;
5315 /* Return the child function used to hold the body of OMP_TASK GS. */
5318 gimple_omp_taskreg_child_fn (const gimple
*gs
)
5320 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5321 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5322 return omp_taskreg_stmt
->child_fn
;
5325 /* Return a pointer to the child function used to hold the body of
5328 static inline tree
*
5329 gimple_omp_taskreg_child_fn_ptr (gimple
*gs
)
5331 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5332 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5333 return &omp_taskreg_stmt
->child_fn
;
5337 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5340 gimple_omp_taskreg_set_child_fn (gimple
*gs
, tree child_fn
)
5342 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5343 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5344 omp_taskreg_stmt
->child_fn
= child_fn
;
5348 /* Return the artificial argument used to send variables and values
5349 from the parent to the children threads in OMP_TASK GS. */
5352 gimple_omp_taskreg_data_arg (const gimple
*gs
)
5354 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
5355 = as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5356 return omp_taskreg_stmt
->data_arg
;
5360 /* Return a pointer to the data argument for OMP_TASK GS. */
5362 static inline tree
*
5363 gimple_omp_taskreg_data_arg_ptr (gimple
*gs
)
5365 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5366 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5367 return &omp_taskreg_stmt
->data_arg
;
5371 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5374 gimple_omp_taskreg_set_data_arg (gimple
*gs
, tree data_arg
)
5376 gimple_statement_omp_taskreg
*omp_taskreg_stmt
5377 = as_a
<gimple_statement_omp_taskreg
*> (gs
);
5378 omp_taskreg_stmt
->data_arg
= data_arg
;
5382 /* Return the copy function used to hold the body of OMP_TASK GS. */
5385 gimple_omp_task_copy_fn (const gimple
*gs
)
5387 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5388 return omp_task_stmt
->copy_fn
;
5391 /* Return a pointer to the copy function used to hold the body of
5394 static inline tree
*
5395 gimple_omp_task_copy_fn_ptr (gimple
*gs
)
5397 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5398 return &omp_task_stmt
->copy_fn
;
5402 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5405 gimple_omp_task_set_copy_fn (gimple
*gs
, tree copy_fn
)
5407 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5408 omp_task_stmt
->copy_fn
= copy_fn
;
5412 /* Return size of the data block in bytes in OMP_TASK GS. */
5415 gimple_omp_task_arg_size (const gimple
*gs
)
5417 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5418 return omp_task_stmt
->arg_size
;
5422 /* Return a pointer to the data block size for OMP_TASK GS. */
5424 static inline tree
*
5425 gimple_omp_task_arg_size_ptr (gimple
*gs
)
5427 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5428 return &omp_task_stmt
->arg_size
;
5432 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5435 gimple_omp_task_set_arg_size (gimple
*gs
, tree arg_size
)
5437 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5438 omp_task_stmt
->arg_size
= arg_size
;
5442 /* Return align of the data block in bytes in OMP_TASK GS. */
5445 gimple_omp_task_arg_align (const gimple
*gs
)
5447 const gomp_task
*omp_task_stmt
= as_a
<const gomp_task
*> (gs
);
5448 return omp_task_stmt
->arg_align
;
5452 /* Return a pointer to the data block align for OMP_TASK GS. */
5454 static inline tree
*
5455 gimple_omp_task_arg_align_ptr (gimple
*gs
)
5457 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5458 return &omp_task_stmt
->arg_align
;
5462 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5465 gimple_omp_task_set_arg_align (gimple
*gs
, tree arg_align
)
5467 gomp_task
*omp_task_stmt
= as_a
<gomp_task
*> (gs
);
5468 omp_task_stmt
->arg_align
= arg_align
;
5472 /* Return the clauses associated with OMP_SINGLE GS. */
5475 gimple_omp_single_clauses (const gimple
*gs
)
5477 const gomp_single
*omp_single_stmt
= as_a
<const gomp_single
*> (gs
);
5478 return omp_single_stmt
->clauses
;
5482 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5484 static inline tree
*
5485 gimple_omp_single_clauses_ptr (gimple
*gs
)
5487 gomp_single
*omp_single_stmt
= as_a
<gomp_single
*> (gs
);
5488 return &omp_single_stmt
->clauses
;
5492 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5495 gimple_omp_single_set_clauses (gomp_single
*omp_single_stmt
, tree clauses
)
5497 omp_single_stmt
->clauses
= clauses
;
5501 /* Return the clauses associated with OMP_TARGET GS. */
5504 gimple_omp_target_clauses (const gimple
*gs
)
5506 const gomp_target
*omp_target_stmt
= as_a
<const gomp_target
*> (gs
);
5507 return omp_target_stmt
->clauses
;
5511 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5513 static inline tree
*
5514 gimple_omp_target_clauses_ptr (gimple
*gs
)
5516 gomp_target
*omp_target_stmt
= as_a
<gomp_target
*> (gs
);
5517 return &omp_target_stmt
->clauses
;
5521 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5524 gimple_omp_target_set_clauses (gomp_target
*omp_target_stmt
,
5527 omp_target_stmt
->clauses
= clauses
;
5531 /* Return the kind of the OMP_TARGET G. */
5534 gimple_omp_target_kind (const gimple
*g
)
5536 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5537 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5541 /* Set the kind of the OMP_TARGET G. */
5544 gimple_omp_target_set_kind (gomp_target
*g
, int kind
)
5546 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5547 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5551 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5554 gimple_omp_target_child_fn (const gomp_target
*omp_target_stmt
)
5556 return omp_target_stmt
->child_fn
;
5559 /* Return a pointer to the child function used to hold the body of
5562 static inline tree
*
5563 gimple_omp_target_child_fn_ptr (gomp_target
*omp_target_stmt
)
5565 return &omp_target_stmt
->child_fn
;
5569 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5572 gimple_omp_target_set_child_fn (gomp_target
*omp_target_stmt
,
5575 omp_target_stmt
->child_fn
= child_fn
;
5579 /* Return the artificial argument used to send variables and values
5580 from the parent to the children threads in OMP_TARGET_STMT. */
5583 gimple_omp_target_data_arg (const gomp_target
*omp_target_stmt
)
5585 return omp_target_stmt
->data_arg
;
5589 /* Return a pointer to the data argument for OMP_TARGET GS. */
5591 static inline tree
*
5592 gimple_omp_target_data_arg_ptr (gomp_target
*omp_target_stmt
)
5594 return &omp_target_stmt
->data_arg
;
5598 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5601 gimple_omp_target_set_data_arg (gomp_target
*omp_target_stmt
,
5604 omp_target_stmt
->data_arg
= data_arg
;
5608 /* Return the clauses associated with OMP_TEAMS GS. */
5611 gimple_omp_teams_clauses (const gimple
*gs
)
5613 const gomp_teams
*omp_teams_stmt
= as_a
<const gomp_teams
*> (gs
);
5614 return omp_teams_stmt
->clauses
;
5618 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5620 static inline tree
*
5621 gimple_omp_teams_clauses_ptr (gimple
*gs
)
5623 gomp_teams
*omp_teams_stmt
= as_a
<gomp_teams
*> (gs
);
5624 return &omp_teams_stmt
->clauses
;
5628 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5631 gimple_omp_teams_set_clauses (gomp_teams
*omp_teams_stmt
, tree clauses
)
5633 omp_teams_stmt
->clauses
= clauses
;
5637 /* Return the clauses associated with OMP_SECTIONS GS. */
5640 gimple_omp_sections_clauses (const gimple
*gs
)
5642 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5643 return omp_sections_stmt
->clauses
;
5647 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5649 static inline tree
*
5650 gimple_omp_sections_clauses_ptr (gimple
*gs
)
5652 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5653 return &omp_sections_stmt
->clauses
;
5657 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5661 gimple_omp_sections_set_clauses (gimple
*gs
, tree clauses
)
5663 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5664 omp_sections_stmt
->clauses
= clauses
;
5668 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5672 gimple_omp_sections_control (const gimple
*gs
)
5674 const gomp_sections
*omp_sections_stmt
= as_a
<const gomp_sections
*> (gs
);
5675 return omp_sections_stmt
->control
;
5679 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5682 static inline tree
*
5683 gimple_omp_sections_control_ptr (gimple
*gs
)
5685 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5686 return &omp_sections_stmt
->control
;
5690 /* Set CONTROL to be the set of clauses associated with the
5691 GIMPLE_OMP_SECTIONS in GS. */
5694 gimple_omp_sections_set_control (gimple
*gs
, tree control
)
5696 gomp_sections
*omp_sections_stmt
= as_a
<gomp_sections
*> (gs
);
5697 omp_sections_stmt
->control
= control
;
5701 /* Set the value being stored in an atomic store. */
5704 gimple_omp_atomic_store_set_val (gomp_atomic_store
*store_stmt
, tree val
)
5706 store_stmt
->val
= val
;
5710 /* Return the value being stored in an atomic store. */
5713 gimple_omp_atomic_store_val (const gomp_atomic_store
*store_stmt
)
5715 return store_stmt
->val
;
5719 /* Return a pointer to the value being stored in an atomic store. */
5721 static inline tree
*
5722 gimple_omp_atomic_store_val_ptr (gomp_atomic_store
*store_stmt
)
5724 return &store_stmt
->val
;
5728 /* Set the LHS of an atomic load. */
5731 gimple_omp_atomic_load_set_lhs (gomp_atomic_load
*load_stmt
, tree lhs
)
5733 load_stmt
->lhs
= lhs
;
5737 /* Get the LHS of an atomic load. */
5740 gimple_omp_atomic_load_lhs (const gomp_atomic_load
*load_stmt
)
5742 return load_stmt
->lhs
;
5746 /* Return a pointer to the LHS of an atomic load. */
5748 static inline tree
*
5749 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load
*load_stmt
)
5751 return &load_stmt
->lhs
;
5755 /* Set the RHS of an atomic load. */
5758 gimple_omp_atomic_load_set_rhs (gomp_atomic_load
*load_stmt
, tree rhs
)
5760 load_stmt
->rhs
= rhs
;
5764 /* Get the RHS of an atomic load. */
5767 gimple_omp_atomic_load_rhs (const gomp_atomic_load
*load_stmt
)
5769 return load_stmt
->rhs
;
5773 /* Return a pointer to the RHS of an atomic load. */
5775 static inline tree
*
5776 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load
*load_stmt
)
5778 return &load_stmt
->rhs
;
5782 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5785 gimple_omp_continue_control_def (const gomp_continue
*cont_stmt
)
5787 return cont_stmt
->control_def
;
5790 /* The same as above, but return the address. */
5792 static inline tree
*
5793 gimple_omp_continue_control_def_ptr (gomp_continue
*cont_stmt
)
5795 return &cont_stmt
->control_def
;
5798 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5801 gimple_omp_continue_set_control_def (gomp_continue
*cont_stmt
, tree def
)
5803 cont_stmt
->control_def
= def
;
5807 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5810 gimple_omp_continue_control_use (const gomp_continue
*cont_stmt
)
5812 return cont_stmt
->control_use
;
5816 /* The same as above, but return the address. */
5818 static inline tree
*
5819 gimple_omp_continue_control_use_ptr (gomp_continue
*cont_stmt
)
5821 return &cont_stmt
->control_use
;
5825 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5828 gimple_omp_continue_set_control_use (gomp_continue
*cont_stmt
, tree use
)
5830 cont_stmt
->control_use
= use
;
5833 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5834 TRANSACTION_STMT. */
5836 static inline gimple_seq
*
5837 gimple_transaction_body_ptr (gtransaction
*transaction_stmt
)
5839 return &transaction_stmt
->body
;
5842 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5844 static inline gimple_seq
5845 gimple_transaction_body (gtransaction
*transaction_stmt
)
5847 return *gimple_transaction_body_ptr (transaction_stmt
);
5850 /* Return the label associated with a GIMPLE_TRANSACTION. */
5853 gimple_transaction_label (const gtransaction
*transaction_stmt
)
5855 return transaction_stmt
->label
;
5858 static inline tree
*
5859 gimple_transaction_label_ptr (gtransaction
*transaction_stmt
)
5861 return &transaction_stmt
->label
;
5864 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5866 static inline unsigned int
5867 gimple_transaction_subcode (const gtransaction
*transaction_stmt
)
5869 return transaction_stmt
->subcode
;
5872 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5873 TRANSACTION_STMT. */
5876 gimple_transaction_set_body (gtransaction
*transaction_stmt
,
5879 transaction_stmt
->body
= body
;
5882 /* Set the label associated with a GIMPLE_TRANSACTION. */
5885 gimple_transaction_set_label (gtransaction
*transaction_stmt
, tree label
)
5887 transaction_stmt
->label
= label
;
5890 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5893 gimple_transaction_set_subcode (gtransaction
*transaction_stmt
,
5894 unsigned int subcode
)
5896 transaction_stmt
->subcode
= subcode
;
5900 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5902 static inline tree
*
5903 gimple_return_retval_ptr (greturn
*gs
)
5908 /* Return the return value for GIMPLE_RETURN GS. */
5911 gimple_return_retval (const greturn
*gs
)
5917 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5920 gimple_return_set_retval (greturn
*gs
, tree retval
)
5926 /* Return the return bounds for GIMPLE_RETURN GS. */
5929 gimple_return_retbnd (const gimple
*gs
)
5931 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5932 return gimple_op (gs
, 1);
5936 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5939 gimple_return_set_retbnd (gimple
*gs
, tree retval
)
5941 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5942 gimple_set_op (gs
, 1, retval
);
5946 /* Returns true when the gimple statement STMT is any of the OMP types. */
5948 #define CASE_GIMPLE_OMP \
5949 case GIMPLE_OMP_PARALLEL: \
5950 case GIMPLE_OMP_TASK: \
5951 case GIMPLE_OMP_FOR: \
5952 case GIMPLE_OMP_SECTIONS: \
5953 case GIMPLE_OMP_SECTIONS_SWITCH: \
5954 case GIMPLE_OMP_SINGLE: \
5955 case GIMPLE_OMP_TARGET: \
5956 case GIMPLE_OMP_TEAMS: \
5957 case GIMPLE_OMP_SECTION: \
5958 case GIMPLE_OMP_MASTER: \
5959 case GIMPLE_OMP_TASKGROUP: \
5960 case GIMPLE_OMP_ORDERED: \
5961 case GIMPLE_OMP_CRITICAL: \
5962 case GIMPLE_OMP_RETURN: \
5963 case GIMPLE_OMP_ATOMIC_LOAD: \
5964 case GIMPLE_OMP_ATOMIC_STORE: \
5965 case GIMPLE_OMP_CONTINUE
5968 is_gimple_omp (const gimple
*stmt
)
5970 switch (gimple_code (stmt
))
5979 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
5983 is_gimple_omp_oacc (const gimple
*stmt
)
5985 gcc_assert (is_gimple_omp (stmt
));
5986 switch (gimple_code (stmt
))
5988 case GIMPLE_OMP_FOR
:
5989 switch (gimple_omp_for_kind (stmt
))
5991 case GF_OMP_FOR_KIND_OACC_LOOP
:
5996 case GIMPLE_OMP_TARGET
:
5997 switch (gimple_omp_target_kind (stmt
))
5999 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6000 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6001 case GF_OMP_TARGET_KIND_OACC_DATA
:
6002 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
6003 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
6004 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
6015 /* Return true if the OMP gimple statement STMT is offloaded. */
6018 is_gimple_omp_offloaded (const gimple
*stmt
)
6020 gcc_assert (is_gimple_omp (stmt
));
6021 switch (gimple_code (stmt
))
6023 case GIMPLE_OMP_TARGET
:
6024 switch (gimple_omp_target_kind (stmt
))
6026 case GF_OMP_TARGET_KIND_REGION
:
6027 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
6028 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
6039 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6042 gimple_nop_p (const gimple
*g
)
6044 return gimple_code (g
) == GIMPLE_NOP
;
6048 /* Return true if GS is a GIMPLE_RESX. */
6051 is_gimple_resx (const gimple
*gs
)
6053 return gimple_code (gs
) == GIMPLE_RESX
;
6056 /* Return the type of the main expression computed by STMT. Return
6057 void_type_node if the statement computes nothing. */
6060 gimple_expr_type (const gimple
*stmt
)
6062 enum gimple_code code
= gimple_code (stmt
);
6063 /* In general we want to pass out a type that can be substituted
6064 for both the RHS and the LHS types if there is a possibly
6065 useless conversion involved. That means returning the
6066 original RHS type as far as we can reconstruct it. */
6067 if (code
== GIMPLE_CALL
)
6069 const gcall
*call_stmt
= as_a
<const gcall
*> (stmt
);
6070 if (gimple_call_internal_p (call_stmt
)
6071 && gimple_call_internal_fn (call_stmt
) == IFN_MASK_STORE
)
6072 return TREE_TYPE (gimple_call_arg (call_stmt
, 3));
6074 return gimple_call_return_type (call_stmt
);
6076 else if (code
== GIMPLE_ASSIGN
)
6078 if (gimple_assign_rhs_code (stmt
) == POINTER_PLUS_EXPR
)
6079 return TREE_TYPE (gimple_assign_rhs1 (stmt
));
6081 /* As fallback use the type of the LHS. */
6082 return TREE_TYPE (gimple_get_lhs (stmt
));
6084 else if (code
== GIMPLE_COND
)
6085 return boolean_type_node
;
6087 return void_type_node
;
6090 /* Enum and arrays used for allocation stats. Keep in sync with
6091 gimple.c:gimple_alloc_kind_names. */
6092 enum gimple_alloc_kind
6094 gimple_alloc_kind_assign
, /* Assignments. */
6095 gimple_alloc_kind_phi
, /* PHI nodes. */
6096 gimple_alloc_kind_cond
, /* Conditionals. */
6097 gimple_alloc_kind_rest
, /* Everything else. */
6098 gimple_alloc_kind_all
6101 extern int gimple_alloc_counts
[];
6102 extern int gimple_alloc_sizes
[];
6104 /* Return the allocation kind for a given stmt CODE. */
6105 static inline enum gimple_alloc_kind
6106 gimple_alloc_kind (enum gimple_code code
)
6111 return gimple_alloc_kind_assign
;
6113 return gimple_alloc_kind_phi
;
6115 return gimple_alloc_kind_cond
;
6117 return gimple_alloc_kind_rest
;
6121 /* Return true if a location should not be emitted for this statement
6122 by annotate_all_with_location. */
6125 gimple_do_not_emit_location_p (gimple
*g
)
6127 return gimple_plf (g
, GF_PLF_1
);
6130 /* Mark statement G so a location will not be emitted by
6131 annotate_one_with_location. */
6134 gimple_set_do_not_emit_location (gimple
*g
)
6136 /* The PLF flags are initialized to 0 when a new tuple is created,
6137 so no need to initialize it anywhere. */
6138 gimple_set_plf (g
, GF_PLF_1
, true);
6142 /* Macros for showing usage statistics. */
6143 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6145 : ((x) < 1024*1024*10 \
6147 : (x) / (1024*1024))))
6149 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6151 #endif /* GCC_GIMPLE_H */