1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 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 "pointer-set.h"
26 #include "hash-table.h"
29 #include "basic-block.h"
30 #include "tree-ssa-alias.h"
31 #include "internal-fn.h"
32 #include "gimple-fold.h"
34 #include "gimple-expr.h"
36 typedef gimple gimple_seq_node
;
38 /* For each block, the PHI nodes that need to be rewritten are stored into
40 typedef vec
<gimple
> gimple_vec
;
43 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
46 LAST_AND_UNUSED_GIMPLE_CODE
49 extern const char *const gimple_code_name
[];
50 extern const unsigned char gimple_rhs_class_table
[];
52 /* Error out if a gimple tuple is addressed incorrectly. */
53 #if defined ENABLE_GIMPLE_CHECKING
54 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
55 extern void gimple_check_failed (const_gimple
, const char *, int, \
56 const char *, enum gimple_code
, \
57 enum tree_code
) ATTRIBUTE_NORETURN
;
59 #define GIMPLE_CHECK(GS, CODE) \
61 const_gimple __gs = (GS); \
62 if (gimple_code (__gs) != (CODE)) \
63 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
64 (CODE), ERROR_MARK); \
66 #else /* not ENABLE_GIMPLE_CHECKING */
67 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
68 #define GIMPLE_CHECK(GS, CODE) (void)0
71 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
72 get_gimple_rhs_class. */
75 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
76 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
77 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
78 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
79 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
80 name, a _DECL, a _REF, etc. */
83 /* Specific flags for individual GIMPLE statements. These flags are
84 always stored in gimple_statement_base.subcode and they may only be
85 defined for statement codes that do not use subcodes.
87 Values for the masks can overlap as long as the overlapping values
88 are never used in the same statement class.
90 The maximum mask value that can be defined is 1 << 15 (i.e., each
91 statement code can hold up to 16 bitflags).
93 Keep this list sorted. */
95 GF_ASM_INPUT
= 1 << 0,
96 GF_ASM_VOLATILE
= 1 << 1,
97 GF_CALL_FROM_THUNK
= 1 << 0,
98 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
99 GF_CALL_TAILCALL
= 1 << 2,
100 GF_CALL_VA_ARG_PACK
= 1 << 3,
101 GF_CALL_NOTHROW
= 1 << 4,
102 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
103 GF_CALL_INTERNAL
= 1 << 6,
104 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
105 GF_OMP_FOR_KIND_MASK
= 3 << 0,
106 GF_OMP_FOR_KIND_FOR
= 0 << 0,
107 GF_OMP_FOR_KIND_SIMD
= 1 << 0,
108 GF_OMP_FOR_KIND_DISTRIBUTE
= 2 << 0,
109 GF_OMP_FOR_COMBINED
= 1 << 2,
110 GF_OMP_FOR_COMBINED_INTO
= 1 << 3,
111 GF_OMP_TARGET_KIND_MASK
= 3 << 0,
112 GF_OMP_TARGET_KIND_REGION
= 0 << 0,
113 GF_OMP_TARGET_KIND_DATA
= 1 << 0,
114 GF_OMP_TARGET_KIND_UPDATE
= 2 << 0,
116 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
117 a thread synchronization via some sort of barrier. The exact barrier
118 that would otherwise be emitted is dependent on the OMP statement with
119 which this return is associated. */
120 GF_OMP_RETURN_NOWAIT
= 1 << 0,
122 GF_OMP_SECTION_LAST
= 1 << 0,
123 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
124 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
125 GF_PREDICT_TAKEN
= 1 << 15
128 /* Currently, there are only two types of gimple debug stmt. Others are
129 envisioned, for example, to enable the generation of is_stmt notes
130 in line number information, to mark sequence points, etc. This
131 subcode is to be used to tell them apart. */
132 enum gimple_debug_subcode
{
133 GIMPLE_DEBUG_BIND
= 0,
134 GIMPLE_DEBUG_SOURCE_BIND
= 1
137 /* Masks for selecting a pass local flag (PLF) to work on. These
138 masks are used by gimple_set_plf and gimple_plf. */
144 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
145 are for 64 bit hosts. */
147 struct GTY((chain_next ("%h.next"))) gimple_statement_base
{
149 Main identifying code for a tuple. */
150 ENUM_BITFIELD(gimple_code
) code
: 8;
152 /* Nonzero if a warning should not be emitted on this tuple. */
153 unsigned int no_warning
: 1;
155 /* Nonzero if this tuple has been visited. Passes are responsible
156 for clearing this bit before using it. */
157 unsigned int visited
: 1;
159 /* Nonzero if this tuple represents a non-temporal move. */
160 unsigned int nontemporal_move
: 1;
162 /* Pass local flags. These flags are free for any pass to use as
163 they see fit. Passes should not assume that these flags contain
164 any useful value when the pass starts. Any initial state that
165 the pass requires should be set on entry to the pass. See
166 gimple_set_plf and gimple_plf for usage. */
167 unsigned int plf
: 2;
169 /* Nonzero if this statement has been modified and needs to have its
170 operands rescanned. */
171 unsigned modified
: 1;
173 /* Nonzero if this statement contains volatile operands. */
174 unsigned has_volatile_ops
: 1;
176 /* The SUBCODE field can be used for tuple-specific flags for tuples
177 that do not require subcodes. Note that SUBCODE should be at
178 least as wide as tree codes, as several tuples store tree codes
180 unsigned int subcode
: 16;
182 /* UID of this statement. This is used by passes that want to
183 assign IDs to statements. It must be assigned and used by each
184 pass. By default it should be assumed to contain garbage. */
188 Locus information for debug info. */
191 /* Number of operands in this tuple. */
195 Basic block holding this statement. */
199 Linked lists of gimple statements. The next pointers form
200 a NULL terminated list, the prev pointers are a cyclic list.
201 A gimple statement is hence also a double-ended list of
202 statements, with the pointer itself being the first element,
203 and the prev pointer being the last. */
205 gimple
GTY((skip
)) prev
;
209 /* Base structure for tuples with operands. */
211 struct GTY(()) gimple_statement_with_ops_base
214 struct gimple_statement_base gsbase
;
217 SSA operand vectors. NOTE: It should be possible to
218 amalgamate these vectors with the operand vector OP. However,
219 the SSA operand vectors are organized differently and contain
220 more information (like immediate use chaining). */
221 struct use_optype_d
GTY((skip (""))) *use_ops
;
225 /* Statements that take register operands. */
227 struct GTY(()) gimple_statement_with_ops
230 struct gimple_statement_with_ops_base opbase
;
233 Operand vector. NOTE! This must always be the last field
234 of this structure. In particular, this means that this
235 structure cannot be embedded inside another one. */
236 tree
GTY((length ("%h.opbase.gsbase.num_ops"))) op
[1];
240 /* Base for statements that take both memory and register operands. */
242 struct GTY(()) gimple_statement_with_memory_ops_base
245 struct gimple_statement_with_ops_base opbase
;
248 Virtual operands for this statement. The GC will pick them
249 up via the ssa_names array. */
250 tree
GTY((skip (""))) vdef
;
251 tree
GTY((skip (""))) vuse
;
255 /* Statements that take both memory and register operands. */
257 struct GTY(()) gimple_statement_with_memory_ops
260 struct gimple_statement_with_memory_ops_base membase
;
263 Operand vector. NOTE! This must always be the last field
264 of this structure. In particular, this means that this
265 structure cannot be embedded inside another one. */
266 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
270 /* Call statements that take both memory and register operands. */
272 struct GTY(()) gimple_statement_call
275 struct gimple_statement_with_memory_ops_base membase
;
278 struct pt_solution call_used
;
279 struct pt_solution call_clobbered
;
282 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
283 tree
GTY ((tag ("0"))) fntype
;
284 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
288 Operand vector. NOTE! This must always be the last field
289 of this structure. In particular, this means that this
290 structure cannot be embedded inside another one. */
291 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
295 /* OpenMP statements (#pragma omp). */
297 struct GTY(()) gimple_statement_omp
{
299 struct gimple_statement_base gsbase
;
308 struct GTY(()) gimple_statement_bind
{
310 struct gimple_statement_base gsbase
;
313 Variables declared in this scope. */
317 This is different than the BLOCK field in gimple_statement_base,
318 which is analogous to TREE_BLOCK (i.e., the lexical block holding
319 this statement). This field is the equivalent of BIND_EXPR_BLOCK
320 in tree land (i.e., the lexical scope defined by this bind). See
331 struct GTY(()) gimple_statement_catch
{
333 struct gimple_statement_base gsbase
;
343 /* GIMPLE_EH_FILTER */
345 struct GTY(()) gimple_statement_eh_filter
{
347 struct gimple_statement_base gsbase
;
360 struct GTY(()) gimple_statement_eh_else
{
362 struct gimple_statement_base gsbase
;
365 gimple_seq n_body
, e_body
;
368 /* GIMPLE_EH_MUST_NOT_THROW */
370 struct GTY(()) gimple_statement_eh_mnt
{
372 struct gimple_statement_base gsbase
;
374 /* [ WORD 7 ] Abort function decl. */
380 struct GTY(()) gimple_statement_phi
{
382 struct gimple_statement_base gsbase
;
392 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
396 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
398 struct GTY(()) gimple_statement_eh_ctrl
401 struct gimple_statement_base gsbase
;
404 Exception region number. */
411 struct GTY(()) gimple_statement_try
{
413 struct gimple_statement_base gsbase
;
416 Expression to evaluate. */
420 Cleanup expression. */
424 /* Kind of GIMPLE_TRY statements. */
425 enum gimple_try_flags
428 GIMPLE_TRY_CATCH
= 1 << 0,
431 GIMPLE_TRY_FINALLY
= 1 << 1,
432 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
434 /* Analogous to TRY_CATCH_IS_CLEANUP. */
435 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
438 /* GIMPLE_WITH_CLEANUP_EXPR */
440 struct GTY(()) gimple_statement_wce
{
442 struct gimple_statement_base gsbase
;
444 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
445 executed if an exception is thrown, not on normal exit of its
446 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
450 Cleanup expression. */
457 struct GTY(()) gimple_statement_asm
460 struct gimple_statement_with_memory_ops_base membase
;
463 __asm__ statement. */
467 Number of inputs, outputs, clobbers, labels. */
474 Operand vector. NOTE! This must always be the last field
475 of this structure. In particular, this means that this
476 structure cannot be embedded inside another one. */
477 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
480 /* GIMPLE_OMP_CRITICAL */
482 struct GTY(()) gimple_statement_omp_critical
{
484 struct gimple_statement_omp omp
;
487 Critical section name. */
492 struct GTY(()) gimple_omp_for_iter
{
493 /* Condition code. */
496 /* Index variable. */
511 struct GTY(()) gimple_statement_omp_for
{
513 struct gimple_statement_omp omp
;
519 Number of elements in iter array. */
523 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
526 Pre-body evaluated before the loop body begins. */
531 /* GIMPLE_OMP_PARALLEL */
533 struct GTY(()) gimple_statement_omp_parallel
{
535 struct gimple_statement_omp omp
;
542 Child function holding the body of the parallel region. */
546 Shared data argument. */
551 /* GIMPLE_OMP_TASK */
553 struct GTY(()) gimple_statement_omp_task
{
555 struct gimple_statement_omp_parallel par
;
558 Child function holding firstprivate initialization if needed. */
562 Size and alignment in bytes of the argument data block. */
568 /* GIMPLE_OMP_SECTION */
569 /* Uses struct gimple_statement_omp. */
572 /* GIMPLE_OMP_SECTIONS */
574 struct GTY(()) gimple_statement_omp_sections
{
576 struct gimple_statement_omp omp
;
582 The control variable used for deciding which of the sections to
587 /* GIMPLE_OMP_CONTINUE.
589 Note: This does not inherit from gimple_statement_omp, because we
590 do not need the body field. */
592 struct GTY(()) gimple_statement_omp_continue
{
594 struct gimple_statement_base gsbase
;
603 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS */
605 struct GTY(()) gimple_statement_omp_single
{
607 struct gimple_statement_omp omp
;
614 /* GIMPLE_OMP_ATOMIC_LOAD.
615 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
616 contains a sequence, which we don't need here. */
618 struct GTY(()) gimple_statement_omp_atomic_load
{
620 struct gimple_statement_base gsbase
;
626 /* GIMPLE_OMP_ATOMIC_STORE.
627 See note on GIMPLE_OMP_ATOMIC_LOAD. */
629 struct GTY(()) gimple_statement_omp_atomic_store
{
631 struct gimple_statement_base gsbase
;
637 /* GIMPLE_TRANSACTION. */
639 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
641 /* The __transaction_atomic was declared [[outer]] or it is
642 __transaction_relaxed. */
643 #define GTMA_IS_OUTER (1u << 0)
644 #define GTMA_IS_RELAXED (1u << 1)
645 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
647 /* The transaction is seen to not have an abort. */
648 #define GTMA_HAVE_ABORT (1u << 2)
649 /* The transaction is seen to have loads or stores. */
650 #define GTMA_HAVE_LOAD (1u << 3)
651 #define GTMA_HAVE_STORE (1u << 4)
652 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
653 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
654 /* The transaction WILL enter serial irrevocable mode.
655 An irrevocable block post-dominates the entire transaction, such
656 that all invocations of the transaction will go serial-irrevocable.
657 In such case, we don't bother instrumenting the transaction, and
658 tell the runtime that it should begin the transaction in
659 serial-irrevocable mode. */
660 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
661 /* The transaction contains no instrumentation code whatsover, most
662 likely because it is guaranteed to go irrevocable upon entry. */
663 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
665 struct GTY(()) gimple_statement_transaction
668 struct gimple_statement_with_memory_ops_base gsbase
;
677 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
678 enum gimple_statement_structure_enum
{
679 #include "gsstruct.def"
685 /* Define the overall contents of a gimple tuple. It may be any of the
686 structures declared above for various types of tuples. */
688 union GTY ((desc ("gimple_statement_structure (&%h)"),
689 chain_next ("%h.gsbase.next"), variable_size
)) gimple_statement_d
{
690 struct gimple_statement_base
GTY ((tag ("GSS_BASE"))) gsbase
;
691 struct gimple_statement_with_ops
GTY ((tag ("GSS_WITH_OPS"))) gsops
;
692 struct gimple_statement_with_memory_ops_base
GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase
;
693 struct gimple_statement_with_memory_ops
GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem
;
694 struct gimple_statement_call
GTY ((tag ("GSS_CALL"))) gimple_call
;
695 struct gimple_statement_omp
GTY ((tag ("GSS_OMP"))) omp
;
696 struct gimple_statement_bind
GTY ((tag ("GSS_BIND"))) gimple_bind
;
697 struct gimple_statement_catch
GTY ((tag ("GSS_CATCH"))) gimple_catch
;
698 struct gimple_statement_eh_filter
GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter
;
699 struct gimple_statement_eh_mnt
GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt
;
700 struct gimple_statement_eh_else
GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else
;
701 struct gimple_statement_phi
GTY ((tag ("GSS_PHI"))) gimple_phi
;
702 struct gimple_statement_eh_ctrl
GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl
;
703 struct gimple_statement_try
GTY ((tag ("GSS_TRY"))) gimple_try
;
704 struct gimple_statement_wce
GTY ((tag ("GSS_WCE"))) gimple_wce
;
705 struct gimple_statement_asm
GTY ((tag ("GSS_ASM"))) gimple_asm
;
706 struct gimple_statement_omp_critical
GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical
;
707 struct gimple_statement_omp_for
GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for
;
708 struct gimple_statement_omp_parallel
GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel
;
709 struct gimple_statement_omp_task
GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task
;
710 struct gimple_statement_omp_sections
GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections
;
711 struct gimple_statement_omp_single
GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single
;
712 struct gimple_statement_omp_continue
GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue
;
713 struct gimple_statement_omp_atomic_load
GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load
;
714 struct gimple_statement_omp_atomic_store
GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store
;
715 struct gimple_statement_transaction
GTY((tag ("GSS_TRANSACTION"))) gimple_transaction
;
718 /* Offset in bytes to the location of the operand vector.
719 Zero if there is no operand vector for this tuple structure. */
720 extern size_t const gimple_ops_offset_
[];
722 /* Map GIMPLE codes to GSS codes. */
723 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
725 /* This variable holds the currently expanded gimple statement for purposes
726 of comminucating the profile info to the builtin expanders. */
727 extern gimple currently_expanding_gimple_stmt
;
729 gimple
gimple_build_return (tree
);
731 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
732 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
735 gimple_build_assign_with_ops (enum tree_code
, tree
,
736 tree
, tree CXX_MEM_STAT_INFO
);
738 gimple_build_assign_with_ops (enum tree_code
, tree
,
739 tree
, tree
, tree CXX_MEM_STAT_INFO
);
741 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
742 #define gimple_build_debug_bind(var,val,stmt) \
743 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
744 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
745 #define gimple_build_debug_source_bind(var,val,stmt) \
746 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
748 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
749 gimple
gimple_build_call (tree
, unsigned, ...);
750 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
751 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
752 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
753 gimple
gimple_build_call_from_tree (tree
);
754 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
755 gimple
gimple_build_label (tree label
);
756 gimple
gimple_build_goto (tree dest
);
757 gimple
gimple_build_nop (void);
758 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
759 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
760 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
762 gimple
gimple_build_catch (tree
, gimple_seq
);
763 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
764 gimple
gimple_build_eh_must_not_throw (tree
);
765 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
766 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
767 gimple
gimple_build_wce (gimple_seq
);
768 gimple
gimple_build_resx (int);
769 gimple
gimple_build_eh_dispatch (int);
770 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
771 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
772 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
773 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
774 gimple
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
775 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
776 gimple
gimple_build_omp_section (gimple_seq
);
777 gimple
gimple_build_omp_continue (tree
, tree
);
778 gimple
gimple_build_omp_master (gimple_seq
);
779 gimple
gimple_build_omp_taskgroup (gimple_seq
);
780 gimple
gimple_build_omp_return (bool);
781 gimple
gimple_build_omp_ordered (gimple_seq
);
782 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
783 gimple
gimple_build_omp_sections_switch (void);
784 gimple
gimple_build_omp_single (gimple_seq
, tree
);
785 gimple
gimple_build_omp_target (gimple_seq
, int, tree
);
786 gimple
gimple_build_omp_teams (gimple_seq
, tree
);
787 gimple
gimple_build_cdt (tree
, tree
);
788 gimple
gimple_build_omp_atomic_load (tree
, tree
);
789 gimple
gimple_build_omp_atomic_store (tree
);
790 gimple
gimple_build_transaction (gimple_seq
, tree
);
791 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
792 enum gimple_statement_structure_enum
gss_for_assign (enum tree_code
);
793 gimple_seq
gimple_seq_alloc (void);
794 void gimple_seq_free (gimple_seq
);
795 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
796 gimple_seq
gimple_seq_copy (gimple_seq
);
797 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
798 int gimple_call_flags (const_gimple
);
799 int gimple_call_return_flags (const_gimple
);
800 int gimple_call_arg_flags (const_gimple
, unsigned);
801 void gimple_call_reset_alias_info (gimple
);
802 bool gimple_assign_copy_p (gimple
);
803 bool gimple_assign_ssa_name_copy_p (gimple
);
804 bool gimple_assign_unary_nop_p (gimple
);
805 void gimple_set_bb (gimple
, basic_block
);
806 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
807 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
809 tree
gimple_get_lhs (const_gimple
);
810 void gimple_set_lhs (gimple
, tree
);
811 void gimple_replace_lhs (gimple
, tree
);
812 gimple
gimple_copy (gimple
);
813 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
814 void gimple_cond_set_condition_from_tree (gimple
, tree
);
815 bool gimple_has_side_effects (const_gimple
);
816 bool gimple_could_trap_p (gimple
);
817 bool gimple_could_trap_p_1 (gimple
, bool, bool);
818 bool gimple_assign_rhs_could_trap_p (gimple
);
819 bool empty_body_p (gimple_seq
);
820 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
822 extern void annotate_all_with_location (gimple_seq
, location_t
);
823 unsigned get_gimple_rhs_num_ops (enum tree_code
);
824 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
825 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
827 /* Return TRUE iff stmt is a call to a built-in function. */
828 extern bool is_gimple_builtin_call (gimple stmt
);
830 extern void recalculate_side_effects (tree
);
831 extern bool gimple_compare_field_offset (tree
, tree
);
832 extern tree
gimple_unsigned_type (tree
);
833 extern tree
gimple_signed_type (tree
);
834 extern alias_set_type
gimple_get_alias_set (tree
);
835 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
836 extern bool gimple_call_builtin_p (gimple
, enum built_in_class
);
837 extern bool gimple_call_builtin_p (gimple
, enum built_in_function
);
838 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
839 extern unsigned gimple_call_get_nobnd_arg_index (const_gimple
, unsigned);
841 /* Formal (expression) temporary table handling: multiple occurrences of
842 the same scalar expression are evaluated into the same temporary. */
844 typedef struct gimple_temp_hash_elt
847 tree temp
; /* Value */
850 /* Gimplify hashtable helper. */
852 struct gimplify_hasher
: typed_free_remove
<elt_t
>
854 typedef elt_t value_type
;
855 typedef elt_t compare_type
;
856 static inline hashval_t
hash (const value_type
*);
857 static inline bool equal (const value_type
*, const compare_type
*);
861 gimplify_hasher::hash (const value_type
*p
)
864 return iterative_hash_expr (t
, 0);
868 gimplify_hasher::equal (const value_type
*p1
, const compare_type
*p2
)
872 enum tree_code code
= TREE_CODE (t1
);
874 if (TREE_CODE (t2
) != code
875 || TREE_TYPE (t1
) != TREE_TYPE (t2
))
878 if (!operand_equal_p (t1
, t2
, 0))
881 #ifdef ENABLE_CHECKING
882 /* Only allow them to compare equal if they also hash equal; otherwise
883 results are nondeterminate, and we fail bootstrap comparison. */
884 gcc_assert (hash (p1
) == hash (p2
));
892 struct gimplify_ctx
*prev_context
;
894 vec
<gimple
> bind_expr_stack
;
896 gimple_seq conditional_cleanups
;
900 vec
<tree
> case_labels
;
901 /* The formal temporary table. Should this be persistent? */
902 hash_table
<gimplify_hasher
> temp_htab
;
907 bool allow_rhs_cond_expr
;
908 bool in_cleanup_point_expr
;
911 /* Return true if gimplify_one_sizepos doesn't need to gimplify
912 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
915 is_gimple_sizepos (tree expr
)
917 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
918 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
919 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
920 function, the gimplifier will want to replace it with a new variable,
921 but that will cause problems if this type is from outside the function.
922 It's OK to have that here. */
923 return (expr
== NULL_TREE
924 || TREE_CONSTANT (expr
)
925 || TREE_CODE (expr
) == VAR_DECL
926 || CONTAINS_PLACEHOLDER_P (expr
));
929 /* Get the number of the next statement uid to be allocated. */
930 static inline unsigned int
931 gimple_stmt_max_uid (struct function
*fn
)
933 return fn
->last_stmt_uid
;
936 /* Set the number of the next statement uid to be allocated. */
938 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
940 fn
->last_stmt_uid
= maxid
;
943 /* Set the number of the next statement uid to be allocated. */
944 static inline unsigned int
945 inc_gimple_stmt_max_uid (struct function
*fn
)
947 return fn
->last_stmt_uid
++;
950 /* Miscellaneous helpers. */
951 struct gimplify_omp_ctx
;
952 extern tree
canonicalize_cond_expr_cond (tree
);
953 extern void dump_decl_set (FILE *, bitmap
);
954 extern bool nonfreeing_call_p (gimple
);
955 extern bool infer_nonnull_range (gimple
, tree
);
957 /* In trans-mem.c. */
958 extern void diagnose_tm_safe_errors (tree
);
959 extern void compute_transaction_bits (void);
961 /* In tree-nested.c. */
962 extern void lower_nested_functions (tree
);
963 extern void insert_field_into_struct (tree
, tree
);
965 /* In cfgexpand.c. */
966 extern tree
gimple_assign_rhs_to_tree (gimple
);
969 extern bool validate_gimple_arglist (const_gimple
, ...);
971 /* Return the first node in GIMPLE sequence S. */
973 static inline gimple_seq_node
974 gimple_seq_first (gimple_seq s
)
980 /* Return the first statement in GIMPLE sequence S. */
983 gimple_seq_first_stmt (gimple_seq s
)
985 gimple_seq_node n
= gimple_seq_first (s
);
990 /* Return the last node in GIMPLE sequence S. */
992 static inline gimple_seq_node
993 gimple_seq_last (gimple_seq s
)
995 return s
? s
->gsbase
.prev
: NULL
;
999 /* Return the last statement in GIMPLE sequence S. */
1001 static inline gimple
1002 gimple_seq_last_stmt (gimple_seq s
)
1004 gimple_seq_node n
= gimple_seq_last (s
);
1009 /* Set the last node in GIMPLE sequence *PS to LAST. */
1012 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1014 (*ps
)->gsbase
.prev
= last
;
1018 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1021 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1027 /* Return true if GIMPLE sequence S is empty. */
1030 gimple_seq_empty_p (gimple_seq s
)
1035 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1036 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1038 /* Allocate a new sequence and initialize its first element with STMT. */
1040 static inline gimple_seq
1041 gimple_seq_alloc_with_stmt (gimple stmt
)
1043 gimple_seq seq
= NULL
;
1044 gimple_seq_add_stmt (&seq
, stmt
);
1049 /* Returns the sequence of statements in BB. */
1051 static inline gimple_seq
1052 bb_seq (const_basic_block bb
)
1054 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1057 static inline gimple_seq
*
1058 bb_seq_addr (basic_block bb
)
1060 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1063 /* Sets the sequence of statements in BB to SEQ. */
1066 set_bb_seq (basic_block bb
, gimple_seq seq
)
1068 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1069 bb
->il
.gimple
.seq
= seq
;
1073 /* Return the code for GIMPLE statement G. */
1075 static inline enum gimple_code
1076 gimple_code (const_gimple g
)
1078 return g
->gsbase
.code
;
1082 /* Return the GSS code used by a GIMPLE code. */
1084 static inline enum gimple_statement_structure_enum
1085 gss_for_code (enum gimple_code code
)
1087 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1088 return gss_for_code_
[code
];
1092 /* Return which GSS code is used by GS. */
1094 static inline enum gimple_statement_structure_enum
1095 gimple_statement_structure (gimple gs
)
1097 return gss_for_code (gimple_code (gs
));
1101 /* Return true if statement G has sub-statements. This is only true for
1102 High GIMPLE statements. */
1105 gimple_has_substatements (gimple g
)
1107 switch (gimple_code (g
))
1111 case GIMPLE_EH_FILTER
:
1112 case GIMPLE_EH_ELSE
:
1114 case GIMPLE_OMP_FOR
:
1115 case GIMPLE_OMP_MASTER
:
1116 case GIMPLE_OMP_TASKGROUP
:
1117 case GIMPLE_OMP_ORDERED
:
1118 case GIMPLE_OMP_SECTION
:
1119 case GIMPLE_OMP_PARALLEL
:
1120 case GIMPLE_OMP_TASK
:
1121 case GIMPLE_OMP_SECTIONS
:
1122 case GIMPLE_OMP_SINGLE
:
1123 case GIMPLE_OMP_TARGET
:
1124 case GIMPLE_OMP_TEAMS
:
1125 case GIMPLE_OMP_CRITICAL
:
1126 case GIMPLE_WITH_CLEANUP_EXPR
:
1127 case GIMPLE_TRANSACTION
:
1136 /* Return the basic block holding statement G. */
1138 static inline basic_block
1139 gimple_bb (const_gimple g
)
1141 return g
->gsbase
.bb
;
1145 /* Return the lexical scope block holding statement G. */
1148 gimple_block (const_gimple g
)
1150 return LOCATION_BLOCK (g
->gsbase
.location
);
1154 /* Set BLOCK to be the lexical scope block holding statement G. */
1157 gimple_set_block (gimple g
, tree block
)
1160 g
->gsbase
.location
=
1161 COMBINE_LOCATION_DATA (line_table
, g
->gsbase
.location
, block
);
1163 g
->gsbase
.location
= LOCATION_LOCUS (g
->gsbase
.location
);
1167 /* Return location information for statement G. */
1169 static inline location_t
1170 gimple_location (const_gimple g
)
1172 return g
->gsbase
.location
;
1175 /* Return pointer to location information for statement G. */
1177 static inline const location_t
*
1178 gimple_location_ptr (const_gimple g
)
1180 return &g
->gsbase
.location
;
1184 /* Set location information for statement G. */
1187 gimple_set_location (gimple g
, location_t location
)
1189 g
->gsbase
.location
= location
;
1193 /* Return true if G contains location information. */
1196 gimple_has_location (const_gimple g
)
1198 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1202 /* Return the file name of the location of STMT. */
1204 static inline const char *
1205 gimple_filename (const_gimple stmt
)
1207 return LOCATION_FILE (gimple_location (stmt
));
1211 /* Return the line number of the location of STMT. */
1214 gimple_lineno (const_gimple stmt
)
1216 return LOCATION_LINE (gimple_location (stmt
));
1220 /* Determine whether SEQ is a singleton. */
1223 gimple_seq_singleton_p (gimple_seq seq
)
1225 return ((gimple_seq_first (seq
) != NULL
)
1226 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1229 /* Return true if no warnings should be emitted for statement STMT. */
1232 gimple_no_warning_p (const_gimple stmt
)
1234 return stmt
->gsbase
.no_warning
;
1237 /* Set the no_warning flag of STMT to NO_WARNING. */
1240 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1242 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1245 /* Set the visited status on statement STMT to VISITED_P. */
1248 gimple_set_visited (gimple stmt
, bool visited_p
)
1250 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1254 /* Return the visited status for statement STMT. */
1257 gimple_visited_p (gimple stmt
)
1259 return stmt
->gsbase
.visited
;
1263 /* Set pass local flag PLF on statement STMT to VAL_P. */
1266 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1269 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1271 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1275 /* Return the value of pass local flag PLF on statement STMT. */
1277 static inline unsigned int
1278 gimple_plf (gimple stmt
, enum plf_mask plf
)
1280 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1284 /* Set the UID of statement. */
1287 gimple_set_uid (gimple g
, unsigned uid
)
1289 g
->gsbase
.uid
= uid
;
1293 /* Return the UID of statement. */
1295 static inline unsigned
1296 gimple_uid (const_gimple g
)
1298 return g
->gsbase
.uid
;
1302 /* Make statement G a singleton sequence. */
1305 gimple_init_singleton (gimple g
)
1307 g
->gsbase
.next
= NULL
;
1312 /* Return true if GIMPLE statement G has register or memory operands. */
1315 gimple_has_ops (const_gimple g
)
1317 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1321 /* Return true if GIMPLE statement G has memory operands. */
1324 gimple_has_mem_ops (const_gimple g
)
1326 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1330 /* Return the set of USE operands for statement G. */
1332 static inline struct use_optype_d
*
1333 gimple_use_ops (const_gimple g
)
1335 if (!gimple_has_ops (g
))
1337 return g
->gsops
.opbase
.use_ops
;
1341 /* Set USE to be the set of USE operands for statement G. */
1344 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1346 gcc_gimple_checking_assert (gimple_has_ops (g
));
1347 g
->gsops
.opbase
.use_ops
= use
;
1351 /* Return the single VUSE operand of the statement G. */
1354 gimple_vuse (const_gimple g
)
1356 if (!gimple_has_mem_ops (g
))
1358 return g
->gsmembase
.vuse
;
1361 /* Return the single VDEF operand of the statement G. */
1364 gimple_vdef (const_gimple g
)
1366 if (!gimple_has_mem_ops (g
))
1368 return g
->gsmembase
.vdef
;
1371 /* Return the single VUSE operand of the statement G. */
1373 static inline tree
*
1374 gimple_vuse_ptr (gimple g
)
1376 if (!gimple_has_mem_ops (g
))
1378 return &g
->gsmembase
.vuse
;
1381 /* Return the single VDEF operand of the statement G. */
1383 static inline tree
*
1384 gimple_vdef_ptr (gimple g
)
1386 if (!gimple_has_mem_ops (g
))
1388 return &g
->gsmembase
.vdef
;
1391 /* Set the single VUSE operand of the statement G. */
1394 gimple_set_vuse (gimple g
, tree vuse
)
1396 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1397 g
->gsmembase
.vuse
= vuse
;
1400 /* Set the single VDEF operand of the statement G. */
1403 gimple_set_vdef (gimple g
, tree vdef
)
1405 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1406 g
->gsmembase
.vdef
= vdef
;
1410 /* Return true if statement G has operands and the modified field has
1414 gimple_modified_p (const_gimple g
)
1416 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1420 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1421 a MODIFIED field. */
1424 gimple_set_modified (gimple s
, bool modifiedp
)
1426 if (gimple_has_ops (s
))
1427 s
->gsbase
.modified
= (unsigned) modifiedp
;
1431 /* Return the tree code for the expression computed by STMT. This is
1432 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1433 GIMPLE_CALL, return CALL_EXPR as the expression code for
1434 consistency. This is useful when the caller needs to deal with the
1435 three kinds of computation that GIMPLE supports. */
1437 static inline enum tree_code
1438 gimple_expr_code (const_gimple stmt
)
1440 enum gimple_code code
= gimple_code (stmt
);
1441 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1442 return (enum tree_code
) stmt
->gsbase
.subcode
;
1445 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1451 /* Return true if statement STMT contains volatile operands. */
1454 gimple_has_volatile_ops (const_gimple stmt
)
1456 if (gimple_has_mem_ops (stmt
))
1457 return stmt
->gsbase
.has_volatile_ops
;
1463 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1466 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1468 if (gimple_has_mem_ops (stmt
))
1469 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1472 /* Return true if STMT is in a transaction. */
1475 gimple_in_transaction (gimple stmt
)
1477 return bb_in_transaction (gimple_bb (stmt
));
1480 /* Return true if statement STMT may access memory. */
1483 gimple_references_memory_p (gimple stmt
)
1485 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1489 /* Return the subcode for OMP statement S. */
1491 static inline unsigned
1492 gimple_omp_subcode (const_gimple s
)
1494 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1495 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
1496 return s
->gsbase
.subcode
;
1499 /* Set the subcode for OMP statement S to SUBCODE. */
1502 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1504 /* We only have 16 bits for the subcode. Assert that we are not
1506 gcc_gimple_checking_assert (subcode
< (1 << 16));
1507 s
->gsbase
.subcode
= subcode
;
1510 /* Set the nowait flag on OMP_RETURN statement S. */
1513 gimple_omp_return_set_nowait (gimple s
)
1515 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1516 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1520 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1524 gimple_omp_return_nowait_p (const_gimple g
)
1526 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1527 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1531 /* Set the LHS of OMP return. */
1534 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
1536 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1537 g
->gimple_omp_atomic_store
.val
= lhs
;
1541 /* Get the LHS of OMP return. */
1544 gimple_omp_return_lhs (const_gimple g
)
1546 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1547 return g
->gimple_omp_atomic_store
.val
;
1551 /* Return a pointer to the LHS of OMP return. */
1553 static inline tree
*
1554 gimple_omp_return_lhs_ptr (gimple g
)
1556 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1557 return &g
->gimple_omp_atomic_store
.val
;
1561 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1565 gimple_omp_section_last_p (const_gimple g
)
1567 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1568 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1572 /* Set the GF_OMP_SECTION_LAST flag on G. */
1575 gimple_omp_section_set_last (gimple g
)
1577 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1578 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1582 /* Return true if OMP parallel statement G has the
1583 GF_OMP_PARALLEL_COMBINED flag set. */
1586 gimple_omp_parallel_combined_p (const_gimple g
)
1588 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1589 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1593 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1594 value of COMBINED_P. */
1597 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1599 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1601 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1603 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1607 /* Return true if OMP atomic load/store statement G has the
1608 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1611 gimple_omp_atomic_need_value_p (const_gimple g
)
1613 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1614 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1615 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
1619 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1622 gimple_omp_atomic_set_need_value (gimple g
)
1624 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1625 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1626 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
1630 /* Return true if OMP atomic load/store statement G has the
1631 GF_OMP_ATOMIC_SEQ_CST flag set. */
1634 gimple_omp_atomic_seq_cst_p (const_gimple g
)
1636 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1637 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1638 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
1642 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
1645 gimple_omp_atomic_set_seq_cst (gimple g
)
1647 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1648 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1649 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
1653 /* Return the number of operands for statement GS. */
1655 static inline unsigned
1656 gimple_num_ops (const_gimple gs
)
1658 return gs
->gsbase
.num_ops
;
1662 /* Set the number of operands for statement GS. */
1665 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1667 gs
->gsbase
.num_ops
= num_ops
;
1671 /* Return the array of operands for statement GS. */
1673 static inline tree
*
1674 gimple_ops (gimple gs
)
1678 /* All the tuples have their operand vector at the very bottom
1679 of the structure. Note that those structures that do not
1680 have an operand vector have a zero offset. */
1681 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1682 gcc_gimple_checking_assert (off
!= 0);
1684 return (tree
*) ((char *) gs
+ off
);
1688 /* Return operand I for statement GS. */
1691 gimple_op (const_gimple gs
, unsigned i
)
1693 if (gimple_has_ops (gs
))
1695 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1696 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1702 /* Return a pointer to operand I for statement GS. */
1704 static inline tree
*
1705 gimple_op_ptr (const_gimple gs
, unsigned i
)
1707 if (gimple_has_ops (gs
))
1709 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1710 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1716 /* Set operand I of statement GS to OP. */
1719 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1721 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1723 /* Note. It may be tempting to assert that OP matches
1724 is_gimple_operand, but that would be wrong. Different tuples
1725 accept slightly different sets of tree operands. Each caller
1726 should perform its own validation. */
1727 gimple_ops (gs
)[i
] = op
;
1730 /* Return true if GS is a GIMPLE_ASSIGN. */
1733 is_gimple_assign (const_gimple gs
)
1735 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1738 /* Determine if expression CODE is one of the valid expressions that can
1739 be used on the RHS of GIMPLE assignments. */
1741 static inline enum gimple_rhs_class
1742 get_gimple_rhs_class (enum tree_code code
)
1744 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1747 /* Return the LHS of assignment statement GS. */
1750 gimple_assign_lhs (const_gimple gs
)
1752 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1753 return gimple_op (gs
, 0);
1757 /* Return a pointer to the LHS of assignment statement GS. */
1759 static inline tree
*
1760 gimple_assign_lhs_ptr (const_gimple gs
)
1762 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1763 return gimple_op_ptr (gs
, 0);
1767 /* Set LHS to be the LHS operand of assignment statement GS. */
1770 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1772 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1773 gimple_set_op (gs
, 0, lhs
);
1775 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1776 SSA_NAME_DEF_STMT (lhs
) = gs
;
1780 /* Return the first operand on the RHS of assignment statement GS. */
1783 gimple_assign_rhs1 (const_gimple gs
)
1785 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1786 return gimple_op (gs
, 1);
1790 /* Return a pointer to the first operand on the RHS of assignment
1793 static inline tree
*
1794 gimple_assign_rhs1_ptr (const_gimple gs
)
1796 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1797 return gimple_op_ptr (gs
, 1);
1800 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1803 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1805 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1807 gimple_set_op (gs
, 1, rhs
);
1811 /* Return the second operand on the RHS of assignment statement GS.
1812 If GS does not have two operands, NULL is returned instead. */
1815 gimple_assign_rhs2 (const_gimple gs
)
1817 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1819 if (gimple_num_ops (gs
) >= 3)
1820 return gimple_op (gs
, 2);
1826 /* Return a pointer to the second operand on the RHS of assignment
1829 static inline tree
*
1830 gimple_assign_rhs2_ptr (const_gimple gs
)
1832 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1833 return gimple_op_ptr (gs
, 2);
1837 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1840 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1842 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1844 gimple_set_op (gs
, 2, rhs
);
1847 /* Return the third operand on the RHS of assignment statement GS.
1848 If GS does not have two operands, NULL is returned instead. */
1851 gimple_assign_rhs3 (const_gimple gs
)
1853 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1855 if (gimple_num_ops (gs
) >= 4)
1856 return gimple_op (gs
, 3);
1861 /* Return a pointer to the third operand on the RHS of assignment
1864 static inline tree
*
1865 gimple_assign_rhs3_ptr (const_gimple gs
)
1867 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1868 return gimple_op_ptr (gs
, 3);
1872 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1875 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
1877 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1879 gimple_set_op (gs
, 3, rhs
);
1882 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1883 to see only a maximum of two operands. */
1886 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
1889 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
1892 /* Returns true if GS is a nontemporal move. */
1895 gimple_assign_nontemporal_move_p (const_gimple gs
)
1897 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1898 return gs
->gsbase
.nontemporal_move
;
1901 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1904 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
1906 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1907 gs
->gsbase
.nontemporal_move
= nontemporal
;
1911 /* Return the code of the expression computed on the rhs of assignment
1912 statement GS. In case that the RHS is a single object, returns the
1913 tree code of the object. */
1915 static inline enum tree_code
1916 gimple_assign_rhs_code (const_gimple gs
)
1918 enum tree_code code
;
1919 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1921 code
= (enum tree_code
) gs
->gsbase
.subcode
;
1922 /* While we initially set subcode to the TREE_CODE of the rhs for
1923 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1924 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1925 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
1926 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
1932 /* Set CODE to be the code for the expression computed on the RHS of
1936 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
1938 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
1939 s
->gsbase
.subcode
= code
;
1943 /* Return the gimple rhs class of the code of the expression computed on
1944 the rhs of assignment statement GS.
1945 This will never return GIMPLE_INVALID_RHS. */
1947 static inline enum gimple_rhs_class
1948 gimple_assign_rhs_class (const_gimple gs
)
1950 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
1953 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1954 there is no operator associated with the assignment itself.
1955 Unlike gimple_assign_copy_p, this predicate returns true for
1956 any RHS operand, including those that perform an operation
1957 and do not have the semantics of a copy, such as COND_EXPR. */
1960 gimple_assign_single_p (gimple gs
)
1962 return (is_gimple_assign (gs
)
1963 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
1966 /* Return true if GS performs a store to its lhs. */
1969 gimple_store_p (gimple gs
)
1971 tree lhs
= gimple_get_lhs (gs
);
1972 return lhs
&& !is_gimple_reg (lhs
);
1975 /* Return true if GS is an assignment that loads from its rhs1. */
1978 gimple_assign_load_p (gimple gs
)
1981 if (!gimple_assign_single_p (gs
))
1983 rhs
= gimple_assign_rhs1 (gs
);
1984 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
1986 rhs
= get_base_address (rhs
);
1987 return (DECL_P (rhs
)
1988 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
1992 /* Return true if S is a type-cast assignment. */
1995 gimple_assign_cast_p (gimple s
)
1997 if (is_gimple_assign (s
))
1999 enum tree_code sc
= gimple_assign_rhs_code (s
);
2000 return CONVERT_EXPR_CODE_P (sc
)
2001 || sc
== VIEW_CONVERT_EXPR
2002 || sc
== FIX_TRUNC_EXPR
;
2008 /* Return true if S is a clobber statement. */
2011 gimple_clobber_p (gimple s
)
2013 return gimple_assign_single_p (s
)
2014 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2017 /* Return true if GS is a GIMPLE_CALL. */
2020 is_gimple_call (const_gimple gs
)
2022 return gimple_code (gs
) == GIMPLE_CALL
;
2025 /* Return the LHS of call statement GS. */
2028 gimple_call_lhs (const_gimple gs
)
2030 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2031 return gimple_op (gs
, 0);
2035 /* Return a pointer to the LHS of call statement GS. */
2037 static inline tree
*
2038 gimple_call_lhs_ptr (const_gimple gs
)
2040 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2041 return gimple_op_ptr (gs
, 0);
2045 /* Set LHS to be the LHS operand of call statement GS. */
2048 gimple_call_set_lhs (gimple gs
, tree lhs
)
2050 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2051 gimple_set_op (gs
, 0, lhs
);
2052 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2053 SSA_NAME_DEF_STMT (lhs
) = gs
;
2057 /* Return true if call GS calls an internal-only function, as enumerated
2061 gimple_call_internal_p (const_gimple gs
)
2063 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2064 return (gs
->gsbase
.subcode
& GF_CALL_INTERNAL
) != 0;
2068 /* Return the target of internal call GS. */
2070 static inline enum internal_fn
2071 gimple_call_internal_fn (const_gimple gs
)
2073 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2074 return gs
->gimple_call
.u
.internal_fn
;
2078 /* Return the function type of the function called by GS. */
2081 gimple_call_fntype (const_gimple gs
)
2083 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2084 if (gimple_call_internal_p (gs
))
2086 return gs
->gimple_call
.u
.fntype
;
2089 /* Set the type of the function called by GS to FNTYPE. */
2092 gimple_call_set_fntype (gimple gs
, tree fntype
)
2094 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2095 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2096 gs
->gimple_call
.u
.fntype
= fntype
;
2100 /* Return the tree node representing the function called by call
2104 gimple_call_fn (const_gimple gs
)
2106 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2107 return gimple_op (gs
, 1);
2110 /* Return a pointer to the tree node representing the function called by call
2113 static inline tree
*
2114 gimple_call_fn_ptr (const_gimple gs
)
2116 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2117 return gimple_op_ptr (gs
, 1);
2121 /* Set FN to be the function called by call statement GS. */
2124 gimple_call_set_fn (gimple gs
, tree fn
)
2126 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2127 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2128 gimple_set_op (gs
, 1, fn
);
2132 /* Set FNDECL to be the function called by call statement GS. */
2135 gimple_call_set_fndecl (gimple gs
, tree decl
)
2137 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2138 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2139 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2143 /* Set internal function FN to be the function called by call statement GS. */
2146 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2148 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2149 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2150 gs
->gimple_call
.u
.internal_fn
= fn
;
2154 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2155 Otherwise return NULL. This function is analogous to
2156 get_callee_fndecl in tree land. */
2159 gimple_call_fndecl (const_gimple gs
)
2161 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2165 /* Return the type returned by call statement GS. */
2168 gimple_call_return_type (const_gimple gs
)
2170 tree type
= gimple_call_fntype (gs
);
2172 if (type
== NULL_TREE
)
2173 return TREE_TYPE (gimple_call_lhs (gs
));
2175 /* The type returned by a function is the type of its
2177 return TREE_TYPE (type
);
2181 /* Return the static chain for call statement GS. */
2184 gimple_call_chain (const_gimple gs
)
2186 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2187 return gimple_op (gs
, 2);
2191 /* Return a pointer to the static chain for call statement GS. */
2193 static inline tree
*
2194 gimple_call_chain_ptr (const_gimple gs
)
2196 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2197 return gimple_op_ptr (gs
, 2);
2200 /* Set CHAIN to be the static chain for call statement GS. */
2203 gimple_call_set_chain (gimple gs
, tree chain
)
2205 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2207 gimple_set_op (gs
, 2, chain
);
2211 /* Return the number of arguments used by call statement GS. */
2213 static inline unsigned
2214 gimple_call_num_args (const_gimple gs
)
2217 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2218 num_ops
= gimple_num_ops (gs
);
2223 /* Return the argument at position INDEX for call statement GS. */
2226 gimple_call_arg (const_gimple gs
, unsigned index
)
2228 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2229 return gimple_op (gs
, index
+ 3);
2233 /* Return the number of arguments used by call statement GS
2234 ignoring bound ones. */
2236 static inline unsigned
2237 gimple_call_num_nobnd_args (const_gimple gs
)
2239 unsigned num_args
= gimple_call_num_args (gs
);
2240 unsigned res
= num_args
;
2241 for (unsigned n
= 0; n
< num_args
; n
++)
2242 if (POINTER_BOUNDS_P (gimple_call_arg (gs
, n
)))
2248 /* Return INDEX's call argument ignoring bound ones. */
2250 gimple_call_nobnd_arg (const_gimple gs
, unsigned index
)
2252 /* No bound args may exist if pointers checker is off. */
2253 if (!flag_check_pointer_bounds
)
2254 return gimple_call_arg (gs
, index
);
2255 return gimple_call_arg (gs
, gimple_call_get_nobnd_arg_index (gs
, index
));
2259 /* Return a pointer to the argument at position INDEX for call
2262 static inline tree
*
2263 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2265 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2266 return gimple_op_ptr (gs
, index
+ 3);
2270 /* Set ARG to be the argument at position INDEX for call statement GS. */
2273 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2275 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2276 gimple_set_op (gs
, index
+ 3, arg
);
2280 /* If TAIL_P is true, mark call statement S as being a tail call
2281 (i.e., a call just before the exit of a function). These calls are
2282 candidate for tail call optimization. */
2285 gimple_call_set_tail (gimple s
, bool tail_p
)
2287 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2289 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2291 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2295 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2298 gimple_call_tail_p (gimple s
)
2300 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2301 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2305 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2306 slot optimization. This transformation uses the target of the call
2307 expansion as the return slot for calls that return in memory. */
2310 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2312 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2313 if (return_slot_opt_p
)
2314 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2316 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2320 /* Return true if S is marked for return slot optimization. */
2323 gimple_call_return_slot_opt_p (gimple s
)
2325 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2326 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2330 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2331 thunk to the thunked-to function. */
2334 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2336 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2338 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2340 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2344 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2347 gimple_call_from_thunk_p (gimple s
)
2349 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2350 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2354 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2355 argument pack in its argument list. */
2358 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2360 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2361 if (pass_arg_pack_p
)
2362 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2364 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2368 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2369 argument pack in its argument list. */
2372 gimple_call_va_arg_pack_p (gimple s
)
2374 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2375 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2379 /* Return true if S is a noreturn call. */
2382 gimple_call_noreturn_p (gimple s
)
2384 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2385 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2389 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2390 even if the called function can throw in other cases. */
2393 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2395 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2397 s
->gsbase
.subcode
|= GF_CALL_NOTHROW
;
2399 s
->gsbase
.subcode
&= ~GF_CALL_NOTHROW
;
2402 /* Return true if S is a nothrow call. */
2405 gimple_call_nothrow_p (gimple s
)
2407 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2408 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2411 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2412 is known to be emitted for VLA objects. Those are wrapped by
2413 stack_save/stack_restore calls and hence can't lead to unbounded
2414 stack growth even when they occur in loops. */
2417 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2419 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2421 s
->gsbase
.subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2423 s
->gsbase
.subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2426 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2429 gimple_call_alloca_for_var_p (gimple s
)
2431 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2432 return (s
->gsbase
.subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2435 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2438 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2440 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2441 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2442 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2446 /* Return a pointer to the points-to solution for the set of call-used
2447 variables of the call CALL. */
2449 static inline struct pt_solution
*
2450 gimple_call_use_set (gimple call
)
2452 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2453 return &call
->gimple_call
.call_used
;
2457 /* Return a pointer to the points-to solution for the set of call-used
2458 variables of the call CALL. */
2460 static inline struct pt_solution
*
2461 gimple_call_clobber_set (gimple call
)
2463 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2464 return &call
->gimple_call
.call_clobbered
;
2468 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2472 gimple_has_lhs (gimple stmt
)
2474 return (is_gimple_assign (stmt
)
2475 || (is_gimple_call (stmt
)
2476 && gimple_call_lhs (stmt
) != NULL_TREE
));
2480 /* Return the code of the predicate computed by conditional statement GS. */
2482 static inline enum tree_code
2483 gimple_cond_code (const_gimple gs
)
2485 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2486 return (enum tree_code
) gs
->gsbase
.subcode
;
2490 /* Set CODE to be the predicate code for the conditional statement GS. */
2493 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2495 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2496 gs
->gsbase
.subcode
= code
;
2500 /* Return the LHS of the predicate computed by conditional statement GS. */
2503 gimple_cond_lhs (const_gimple gs
)
2505 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2506 return gimple_op (gs
, 0);
2509 /* Return the pointer to the LHS of the predicate computed by conditional
2512 static inline tree
*
2513 gimple_cond_lhs_ptr (const_gimple gs
)
2515 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2516 return gimple_op_ptr (gs
, 0);
2519 /* Set LHS to be the LHS operand of the predicate computed by
2520 conditional statement GS. */
2523 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2525 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2526 gimple_set_op (gs
, 0, lhs
);
2530 /* Return the RHS operand of the predicate computed by conditional GS. */
2533 gimple_cond_rhs (const_gimple gs
)
2535 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2536 return gimple_op (gs
, 1);
2539 /* Return the pointer to the RHS operand of the predicate computed by
2542 static inline tree
*
2543 gimple_cond_rhs_ptr (const_gimple gs
)
2545 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2546 return gimple_op_ptr (gs
, 1);
2550 /* Set RHS to be the RHS operand of the predicate computed by
2551 conditional statement GS. */
2554 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2556 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2557 gimple_set_op (gs
, 1, rhs
);
2561 /* Return the label used by conditional statement GS when its
2562 predicate evaluates to true. */
2565 gimple_cond_true_label (const_gimple gs
)
2567 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2568 return gimple_op (gs
, 2);
2572 /* Set LABEL to be the label used by conditional statement GS when its
2573 predicate evaluates to true. */
2576 gimple_cond_set_true_label (gimple gs
, tree label
)
2578 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2579 gimple_set_op (gs
, 2, label
);
2583 /* Set LABEL to be the label used by conditional statement GS when its
2584 predicate evaluates to false. */
2587 gimple_cond_set_false_label (gimple gs
, tree label
)
2589 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2590 gimple_set_op (gs
, 3, label
);
2594 /* Return the label used by conditional statement GS when its
2595 predicate evaluates to false. */
2598 gimple_cond_false_label (const_gimple gs
)
2600 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2601 return gimple_op (gs
, 3);
2605 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2608 gimple_cond_make_false (gimple gs
)
2610 gimple_cond_set_lhs (gs
, boolean_true_node
);
2611 gimple_cond_set_rhs (gs
, boolean_false_node
);
2612 gs
->gsbase
.subcode
= EQ_EXPR
;
2616 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2619 gimple_cond_make_true (gimple gs
)
2621 gimple_cond_set_lhs (gs
, boolean_true_node
);
2622 gimple_cond_set_rhs (gs
, boolean_true_node
);
2623 gs
->gsbase
.subcode
= EQ_EXPR
;
2626 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2627 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2630 gimple_cond_true_p (const_gimple gs
)
2632 tree lhs
= gimple_cond_lhs (gs
);
2633 tree rhs
= gimple_cond_rhs (gs
);
2634 enum tree_code code
= gimple_cond_code (gs
);
2636 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2639 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2642 if (code
== NE_EXPR
&& lhs
!= rhs
)
2645 if (code
== EQ_EXPR
&& lhs
== rhs
)
2651 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2652 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2655 gimple_cond_false_p (const_gimple gs
)
2657 tree lhs
= gimple_cond_lhs (gs
);
2658 tree rhs
= gimple_cond_rhs (gs
);
2659 enum tree_code code
= gimple_cond_code (gs
);
2661 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2664 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2667 if (code
== NE_EXPR
&& lhs
== rhs
)
2670 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2676 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2679 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2681 gimple_cond_set_code (stmt
, code
);
2682 gimple_cond_set_lhs (stmt
, lhs
);
2683 gimple_cond_set_rhs (stmt
, rhs
);
2686 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2689 gimple_label_label (const_gimple gs
)
2691 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2692 return gimple_op (gs
, 0);
2696 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2700 gimple_label_set_label (gimple gs
, tree label
)
2702 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2703 gimple_set_op (gs
, 0, label
);
2707 /* Return the destination of the unconditional jump GS. */
2710 gimple_goto_dest (const_gimple gs
)
2712 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2713 return gimple_op (gs
, 0);
2717 /* Set DEST to be the destination of the unconditonal jump GS. */
2720 gimple_goto_set_dest (gimple gs
, tree dest
)
2722 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2723 gimple_set_op (gs
, 0, dest
);
2727 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2730 gimple_bind_vars (const_gimple gs
)
2732 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2733 return gs
->gimple_bind
.vars
;
2737 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2741 gimple_bind_set_vars (gimple gs
, tree vars
)
2743 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2744 gs
->gimple_bind
.vars
= vars
;
2748 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2752 gimple_bind_append_vars (gimple gs
, tree vars
)
2754 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2755 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2759 static inline gimple_seq
*
2760 gimple_bind_body_ptr (gimple gs
)
2762 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2763 return &gs
->gimple_bind
.body
;
2766 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2768 static inline gimple_seq
2769 gimple_bind_body (gimple gs
)
2771 return *gimple_bind_body_ptr (gs
);
2775 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2779 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2781 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2782 gs
->gimple_bind
.body
= seq
;
2786 /* Append a statement to the end of a GIMPLE_BIND's body. */
2789 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2791 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2792 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2796 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2799 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2801 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2802 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2806 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2807 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2810 gimple_bind_block (const_gimple gs
)
2812 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2813 return gs
->gimple_bind
.block
;
2817 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2821 gimple_bind_set_block (gimple gs
, tree block
)
2823 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2824 gcc_gimple_checking_assert (block
== NULL_TREE
2825 || TREE_CODE (block
) == BLOCK
);
2826 gs
->gimple_bind
.block
= block
;
2830 /* Return the number of input operands for GIMPLE_ASM GS. */
2832 static inline unsigned
2833 gimple_asm_ninputs (const_gimple gs
)
2835 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2836 return gs
->gimple_asm
.ni
;
2840 /* Return the number of output operands for GIMPLE_ASM GS. */
2842 static inline unsigned
2843 gimple_asm_noutputs (const_gimple gs
)
2845 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2846 return gs
->gimple_asm
.no
;
2850 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2852 static inline unsigned
2853 gimple_asm_nclobbers (const_gimple gs
)
2855 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2856 return gs
->gimple_asm
.nc
;
2859 /* Return the number of label operands for GIMPLE_ASM GS. */
2861 static inline unsigned
2862 gimple_asm_nlabels (const_gimple gs
)
2864 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2865 return gs
->gimple_asm
.nl
;
2868 /* Return input operand INDEX of GIMPLE_ASM GS. */
2871 gimple_asm_input_op (const_gimple gs
, unsigned index
)
2873 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2874 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2875 return gimple_op (gs
, index
+ gs
->gimple_asm
.no
);
2878 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2880 static inline tree
*
2881 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
2883 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2884 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2885 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.no
);
2889 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2892 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
2894 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2895 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
2896 && TREE_CODE (in_op
) == TREE_LIST
);
2897 gimple_set_op (gs
, index
+ gs
->gimple_asm
.no
, in_op
);
2901 /* Return output operand INDEX of GIMPLE_ASM GS. */
2904 gimple_asm_output_op (const_gimple gs
, unsigned index
)
2906 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2907 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
2908 return gimple_op (gs
, index
);
2911 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2913 static inline tree
*
2914 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
2916 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2917 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
2918 return gimple_op_ptr (gs
, index
);
2922 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2925 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
2927 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2928 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
2929 && TREE_CODE (out_op
) == TREE_LIST
);
2930 gimple_set_op (gs
, index
, out_op
);
2934 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2937 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
2939 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2940 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
);
2941 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
2945 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2948 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
2950 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2951 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
2952 && TREE_CODE (clobber_op
) == TREE_LIST
);
2953 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
2956 /* Return label operand INDEX of GIMPLE_ASM GS. */
2959 gimple_asm_label_op (const_gimple gs
, unsigned index
)
2961 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2962 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
);
2963 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
2966 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2969 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
2971 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2972 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
2973 && TREE_CODE (label_op
) == TREE_LIST
);
2974 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
2977 /* Return the string representing the assembly instruction in
2980 static inline const char *
2981 gimple_asm_string (const_gimple gs
)
2983 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2984 return gs
->gimple_asm
.string
;
2988 /* Return true if GS is an asm statement marked volatile. */
2991 gimple_asm_volatile_p (const_gimple gs
)
2993 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2994 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
2998 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3001 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3003 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3005 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
3007 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
3011 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3014 gimple_asm_set_input (gimple gs
, bool input_p
)
3016 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3018 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
3020 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
3024 /* Return true if asm GS is an ASM_INPUT. */
3027 gimple_asm_input_p (const_gimple gs
)
3029 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3030 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
3034 /* Return the types handled by GIMPLE_CATCH statement GS. */
3037 gimple_catch_types (const_gimple gs
)
3039 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3040 return gs
->gimple_catch
.types
;
3044 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3046 static inline tree
*
3047 gimple_catch_types_ptr (gimple gs
)
3049 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3050 return &gs
->gimple_catch
.types
;
3054 /* Return a pointer to the GIMPLE sequence representing the body of
3055 the handler of GIMPLE_CATCH statement GS. */
3057 static inline gimple_seq
*
3058 gimple_catch_handler_ptr (gimple gs
)
3060 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3061 return &gs
->gimple_catch
.handler
;
3065 /* Return the GIMPLE sequence representing the body of the handler of
3066 GIMPLE_CATCH statement GS. */
3068 static inline gimple_seq
3069 gimple_catch_handler (gimple gs
)
3071 return *gimple_catch_handler_ptr (gs
);
3075 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3078 gimple_catch_set_types (gimple gs
, tree t
)
3080 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3081 gs
->gimple_catch
.types
= t
;
3085 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3088 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3090 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3091 gs
->gimple_catch
.handler
= handler
;
3095 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3098 gimple_eh_filter_types (const_gimple gs
)
3100 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3101 return gs
->gimple_eh_filter
.types
;
3105 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3108 static inline tree
*
3109 gimple_eh_filter_types_ptr (gimple gs
)
3111 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3112 return &gs
->gimple_eh_filter
.types
;
3116 /* Return a pointer to the sequence of statement to execute when
3117 GIMPLE_EH_FILTER statement fails. */
3119 static inline gimple_seq
*
3120 gimple_eh_filter_failure_ptr (gimple gs
)
3122 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3123 return &gs
->gimple_eh_filter
.failure
;
3127 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3130 static inline gimple_seq
3131 gimple_eh_filter_failure (gimple gs
)
3133 return *gimple_eh_filter_failure_ptr (gs
);
3137 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3140 gimple_eh_filter_set_types (gimple gs
, tree types
)
3142 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3143 gs
->gimple_eh_filter
.types
= types
;
3147 /* Set FAILURE to be the sequence of statements to execute on failure
3148 for GIMPLE_EH_FILTER GS. */
3151 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3153 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3154 gs
->gimple_eh_filter
.failure
= failure
;
3157 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3160 gimple_eh_must_not_throw_fndecl (gimple gs
)
3162 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3163 return gs
->gimple_eh_mnt
.fndecl
;
3166 /* Set the function decl to be called by GS to DECL. */
3169 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3171 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3172 gs
->gimple_eh_mnt
.fndecl
= decl
;
3175 /* GIMPLE_EH_ELSE accessors. */
3177 static inline gimple_seq
*
3178 gimple_eh_else_n_body_ptr (gimple gs
)
3180 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3181 return &gs
->gimple_eh_else
.n_body
;
3184 static inline gimple_seq
3185 gimple_eh_else_n_body (gimple gs
)
3187 return *gimple_eh_else_n_body_ptr (gs
);
3190 static inline gimple_seq
*
3191 gimple_eh_else_e_body_ptr (gimple gs
)
3193 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3194 return &gs
->gimple_eh_else
.e_body
;
3197 static inline gimple_seq
3198 gimple_eh_else_e_body (gimple gs
)
3200 return *gimple_eh_else_e_body_ptr (gs
);
3204 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3206 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3207 gs
->gimple_eh_else
.n_body
= seq
;
3211 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3213 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3214 gs
->gimple_eh_else
.e_body
= seq
;
3217 /* GIMPLE_TRY accessors. */
3219 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3220 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3222 static inline enum gimple_try_flags
3223 gimple_try_kind (const_gimple gs
)
3225 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3226 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
3230 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3233 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3235 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3236 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3237 || kind
== GIMPLE_TRY_FINALLY
);
3238 if (gimple_try_kind (gs
) != kind
)
3239 gs
->gsbase
.subcode
= (unsigned int) kind
;
3243 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3246 gimple_try_catch_is_cleanup (const_gimple gs
)
3248 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3249 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3253 /* Return a pointer to the sequence of statements used as the
3254 body for GIMPLE_TRY GS. */
3256 static inline gimple_seq
*
3257 gimple_try_eval_ptr (gimple gs
)
3259 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3260 return &gs
->gimple_try
.eval
;
3264 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3266 static inline gimple_seq
3267 gimple_try_eval (gimple gs
)
3269 return *gimple_try_eval_ptr (gs
);
3273 /* Return a pointer to the sequence of statements used as the cleanup body for
3276 static inline gimple_seq
*
3277 gimple_try_cleanup_ptr (gimple gs
)
3279 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3280 return &gs
->gimple_try
.cleanup
;
3284 /* Return the sequence of statements used as the cleanup body for
3287 static inline gimple_seq
3288 gimple_try_cleanup (gimple gs
)
3290 return *gimple_try_cleanup_ptr (gs
);
3294 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3297 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3299 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3300 if (catch_is_cleanup
)
3301 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3303 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3307 /* Set EVAL to be the sequence of statements to use as the body for
3311 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3313 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3314 gs
->gimple_try
.eval
= eval
;
3318 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3319 body for GIMPLE_TRY GS. */
3322 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3324 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3325 gs
->gimple_try
.cleanup
= cleanup
;
3329 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3331 static inline gimple_seq
*
3332 gimple_wce_cleanup_ptr (gimple gs
)
3334 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3335 return &gs
->gimple_wce
.cleanup
;
3339 /* Return the cleanup sequence for cleanup statement GS. */
3341 static inline gimple_seq
3342 gimple_wce_cleanup (gimple gs
)
3344 return *gimple_wce_cleanup_ptr (gs
);
3348 /* Set CLEANUP to be the cleanup sequence for GS. */
3351 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3353 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3354 gs
->gimple_wce
.cleanup
= cleanup
;
3358 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3361 gimple_wce_cleanup_eh_only (const_gimple gs
)
3363 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3364 return gs
->gsbase
.subcode
!= 0;
3368 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3371 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3373 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3374 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3378 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3380 static inline unsigned
3381 gimple_phi_capacity (const_gimple gs
)
3383 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3384 return gs
->gimple_phi
.capacity
;
3388 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3389 be exactly the number of incoming edges for the basic block holding
3392 static inline unsigned
3393 gimple_phi_num_args (const_gimple gs
)
3395 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3396 return gs
->gimple_phi
.nargs
;
3400 /* Return the SSA name created by GIMPLE_PHI GS. */
3403 gimple_phi_result (const_gimple gs
)
3405 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3406 return gs
->gimple_phi
.result
;
3409 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3411 static inline tree
*
3412 gimple_phi_result_ptr (gimple gs
)
3414 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3415 return &gs
->gimple_phi
.result
;
3418 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3421 gimple_phi_set_result (gimple gs
, tree result
)
3423 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3424 gs
->gimple_phi
.result
= result
;
3425 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3426 SSA_NAME_DEF_STMT (result
) = gs
;
3430 /* Return the PHI argument corresponding to incoming edge INDEX for
3433 static inline struct phi_arg_d
*
3434 gimple_phi_arg (gimple gs
, unsigned index
)
3436 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3437 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.capacity
);
3438 return &(gs
->gimple_phi
.args
[index
]);
3441 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3442 for GIMPLE_PHI GS. */
3445 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3447 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3448 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.nargs
);
3449 gs
->gimple_phi
.args
[index
] = *phiarg
;
3452 /* Return the PHI nodes for basic block BB, or NULL if there are no
3455 static inline gimple_seq
3456 phi_nodes (const_basic_block bb
)
3458 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3459 return bb
->il
.gimple
.phi_nodes
;
3462 /* Return a pointer to the PHI nodes for basic block BB. */
3464 static inline gimple_seq
*
3465 phi_nodes_ptr (basic_block bb
)
3467 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3468 return &bb
->il
.gimple
.phi_nodes
;
3471 /* Return the tree operand for argument I of PHI node GS. */
3474 gimple_phi_arg_def (gimple gs
, size_t index
)
3476 return gimple_phi_arg (gs
, index
)->def
;
3480 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3482 static inline tree
*
3483 gimple_phi_arg_def_ptr (gimple gs
, size_t index
)
3485 return &gimple_phi_arg (gs
, index
)->def
;
3488 /* Return the edge associated with argument I of phi node GS. */
3491 gimple_phi_arg_edge (gimple gs
, size_t i
)
3493 return EDGE_PRED (gimple_bb (gs
), i
);
3496 /* Return the source location of gimple argument I of phi node GS. */
3498 static inline source_location
3499 gimple_phi_arg_location (gimple gs
, size_t i
)
3501 return gimple_phi_arg (gs
, i
)->locus
;
3504 /* Return the source location of the argument on edge E of phi node GS. */
3506 static inline source_location
3507 gimple_phi_arg_location_from_edge (gimple gs
, edge e
)
3509 return gimple_phi_arg (gs
, e
->dest_idx
)->locus
;
3512 /* Set the source location of gimple argument I of phi node GS to LOC. */
3515 gimple_phi_arg_set_location (gimple gs
, size_t i
, source_location loc
)
3517 gimple_phi_arg (gs
, i
)->locus
= loc
;
3520 /* Return TRUE if argument I of phi node GS has a location record. */
3523 gimple_phi_arg_has_location (gimple gs
, size_t i
)
3525 return gimple_phi_arg_location (gs
, i
) != UNKNOWN_LOCATION
;
3529 /* Return the region number for GIMPLE_RESX GS. */
3532 gimple_resx_region (const_gimple gs
)
3534 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3535 return gs
->gimple_eh_ctrl
.region
;
3538 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3541 gimple_resx_set_region (gimple gs
, int region
)
3543 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3544 gs
->gimple_eh_ctrl
.region
= region
;
3547 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3550 gimple_eh_dispatch_region (const_gimple gs
)
3552 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3553 return gs
->gimple_eh_ctrl
.region
;
3556 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3559 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3561 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3562 gs
->gimple_eh_ctrl
.region
= region
;
3565 /* Return the number of labels associated with the switch statement GS. */
3567 static inline unsigned
3568 gimple_switch_num_labels (const_gimple gs
)
3571 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3572 num_ops
= gimple_num_ops (gs
);
3573 gcc_gimple_checking_assert (num_ops
> 1);
3578 /* Set NLABELS to be the number of labels for the switch statement GS. */
3581 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3583 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3584 gimple_set_num_ops (g
, nlabels
+ 1);
3588 /* Return the index variable used by the switch statement GS. */
3591 gimple_switch_index (const_gimple gs
)
3593 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3594 return gimple_op (gs
, 0);
3598 /* Return a pointer to the index variable for the switch statement GS. */
3600 static inline tree
*
3601 gimple_switch_index_ptr (const_gimple gs
)
3603 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3604 return gimple_op_ptr (gs
, 0);
3608 /* Set INDEX to be the index variable for switch statement GS. */
3611 gimple_switch_set_index (gimple gs
, tree index
)
3613 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3614 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3615 gimple_set_op (gs
, 0, index
);
3619 /* Return the label numbered INDEX. The default label is 0, followed by any
3620 labels in a switch statement. */
3623 gimple_switch_label (const_gimple gs
, unsigned index
)
3625 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3626 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
3627 return gimple_op (gs
, index
+ 1);
3630 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3633 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3635 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3636 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
3637 && (label
== NULL_TREE
3638 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
3639 gimple_set_op (gs
, index
+ 1, label
);
3642 /* Return the default label for a switch statement. */
3645 gimple_switch_default_label (const_gimple gs
)
3647 tree label
= gimple_switch_label (gs
, 0);
3648 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3652 /* Set the default label for a switch statement. */
3655 gimple_switch_set_default_label (gimple gs
, tree label
)
3657 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3658 gimple_switch_set_label (gs
, 0, label
);
3661 /* Return true if GS is a GIMPLE_DEBUG statement. */
3664 is_gimple_debug (const_gimple gs
)
3666 return gimple_code (gs
) == GIMPLE_DEBUG
;
3669 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3672 gimple_debug_bind_p (const_gimple s
)
3674 if (is_gimple_debug (s
))
3675 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3680 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3683 gimple_debug_bind_get_var (gimple dbg
)
3685 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3686 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3687 return gimple_op (dbg
, 0);
3690 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3694 gimple_debug_bind_get_value (gimple dbg
)
3696 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3697 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3698 return gimple_op (dbg
, 1);
3701 /* Return a pointer to the value bound to the variable in a
3702 GIMPLE_DEBUG bind statement. */
3704 static inline tree
*
3705 gimple_debug_bind_get_value_ptr (gimple dbg
)
3707 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3708 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3709 return gimple_op_ptr (dbg
, 1);
3712 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3715 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3717 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3718 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3719 gimple_set_op (dbg
, 0, var
);
3722 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3726 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3728 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3729 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3730 gimple_set_op (dbg
, 1, value
);
3733 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3735 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3737 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3741 gimple_debug_bind_reset_value (gimple dbg
)
3743 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3744 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3745 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3748 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3752 gimple_debug_bind_has_value_p (gimple dbg
)
3754 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3755 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3756 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3759 #undef GIMPLE_DEBUG_BIND_NOVALUE
3761 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3764 gimple_debug_source_bind_p (const_gimple s
)
3766 if (is_gimple_debug (s
))
3767 return s
->gsbase
.subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
3772 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3775 gimple_debug_source_bind_get_var (gimple dbg
)
3777 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3778 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3779 return gimple_op (dbg
, 0);
3782 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3786 gimple_debug_source_bind_get_value (gimple dbg
)
3788 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3789 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3790 return gimple_op (dbg
, 1);
3793 /* Return a pointer to the value bound to the variable in a
3794 GIMPLE_DEBUG source bind statement. */
3796 static inline tree
*
3797 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
3799 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3800 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3801 return gimple_op_ptr (dbg
, 1);
3804 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3807 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
3809 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3810 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3811 gimple_set_op (dbg
, 0, var
);
3814 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3818 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
3820 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3821 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3822 gimple_set_op (dbg
, 1, value
);
3825 /* Return the line number for EXPR, or return -1 if we have no line
3826 number information for it. */
3828 get_lineno (const_gimple stmt
)
3835 loc
= gimple_location (stmt
);
3836 if (loc
== UNKNOWN_LOCATION
)
3839 return LOCATION_LINE (loc
);
3842 /* Return a pointer to the body for the OMP statement GS. */
3844 static inline gimple_seq
*
3845 gimple_omp_body_ptr (gimple gs
)
3847 return &gs
->omp
.body
;
3850 /* Return the body for the OMP statement GS. */
3852 static inline gimple_seq
3853 gimple_omp_body (gimple gs
)
3855 return *gimple_omp_body_ptr (gs
);
3858 /* Set BODY to be the body for the OMP statement GS. */
3861 gimple_omp_set_body (gimple gs
, gimple_seq body
)
3863 gs
->omp
.body
= body
;
3867 /* Return the name associated with OMP_CRITICAL statement GS. */
3870 gimple_omp_critical_name (const_gimple gs
)
3872 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3873 return gs
->gimple_omp_critical
.name
;
3877 /* Return a pointer to the name associated with OMP critical statement GS. */
3879 static inline tree
*
3880 gimple_omp_critical_name_ptr (gimple gs
)
3882 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3883 return &gs
->gimple_omp_critical
.name
;
3887 /* Set NAME to be the name associated with OMP critical statement GS. */
3890 gimple_omp_critical_set_name (gimple gs
, tree name
)
3892 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3893 gs
->gimple_omp_critical
.name
= name
;
3897 /* Return the kind of OMP for statemement. */
3900 gimple_omp_for_kind (const_gimple g
)
3902 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3903 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
3907 /* Set the OMP for kind. */
3910 gimple_omp_for_set_kind (gimple g
, int kind
)
3912 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3913 g
->gsbase
.subcode
= (g
->gsbase
.subcode
& ~GF_OMP_FOR_KIND_MASK
)
3914 | (kind
& GF_OMP_FOR_KIND_MASK
);
3918 /* Return true if OMP for statement G has the
3919 GF_OMP_FOR_COMBINED flag set. */
3922 gimple_omp_for_combined_p (const_gimple g
)
3924 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3925 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
3929 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
3930 value of COMBINED_P. */
3933 gimple_omp_for_set_combined_p (gimple g
, bool combined_p
)
3935 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3937 g
->gsbase
.subcode
|= GF_OMP_FOR_COMBINED
;
3939 g
->gsbase
.subcode
&= ~GF_OMP_FOR_COMBINED
;
3943 /* Return true if OMP for statement G has the
3944 GF_OMP_FOR_COMBINED_INTO flag set. */
3947 gimple_omp_for_combined_into_p (const_gimple g
)
3949 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3950 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
3954 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
3955 value of COMBINED_P. */
3958 gimple_omp_for_set_combined_into_p (gimple g
, bool combined_p
)
3960 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3962 g
->gsbase
.subcode
|= GF_OMP_FOR_COMBINED_INTO
;
3964 g
->gsbase
.subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
3968 /* Return the clauses associated with OMP_FOR GS. */
3971 gimple_omp_for_clauses (const_gimple gs
)
3973 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3974 return gs
->gimple_omp_for
.clauses
;
3978 /* Return a pointer to the OMP_FOR GS. */
3980 static inline tree
*
3981 gimple_omp_for_clauses_ptr (gimple gs
)
3983 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3984 return &gs
->gimple_omp_for
.clauses
;
3988 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3991 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
3993 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3994 gs
->gimple_omp_for
.clauses
= clauses
;
3998 /* Get the collapse count of OMP_FOR GS. */
4000 static inline size_t
4001 gimple_omp_for_collapse (gimple gs
)
4003 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4004 return gs
->gimple_omp_for
.collapse
;
4008 /* Return the index variable for OMP_FOR GS. */
4011 gimple_omp_for_index (const_gimple gs
, size_t i
)
4013 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4014 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4015 return gs
->gimple_omp_for
.iter
[i
].index
;
4019 /* Return a pointer to the index variable for OMP_FOR GS. */
4021 static inline tree
*
4022 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
4024 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4025 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4026 return &gs
->gimple_omp_for
.iter
[i
].index
;
4030 /* Set INDEX to be the index variable for OMP_FOR GS. */
4033 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
4035 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4036 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4037 gs
->gimple_omp_for
.iter
[i
].index
= index
;
4041 /* Return the initial value for OMP_FOR GS. */
4044 gimple_omp_for_initial (const_gimple gs
, size_t i
)
4046 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4047 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4048 return gs
->gimple_omp_for
.iter
[i
].initial
;
4052 /* Return a pointer to the initial value for OMP_FOR GS. */
4054 static inline tree
*
4055 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
4057 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4058 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4059 return &gs
->gimple_omp_for
.iter
[i
].initial
;
4063 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4066 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4068 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4069 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4070 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
4074 /* Return the final value for OMP_FOR GS. */
4077 gimple_omp_for_final (const_gimple gs
, size_t i
)
4079 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4080 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4081 return gs
->gimple_omp_for
.iter
[i
].final
;
4085 /* Return a pointer to the final value for OMP_FOR GS. */
4087 static inline tree
*
4088 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4090 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4091 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4092 return &gs
->gimple_omp_for
.iter
[i
].final
;
4096 /* Set FINAL to be the final value for OMP_FOR GS. */
4099 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4101 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4102 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4103 gs
->gimple_omp_for
.iter
[i
].final
= final
;
4107 /* Return the increment value for OMP_FOR GS. */
4110 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4112 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4113 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4114 return gs
->gimple_omp_for
.iter
[i
].incr
;
4118 /* Return a pointer to the increment value for OMP_FOR GS. */
4120 static inline tree
*
4121 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4123 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4124 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4125 return &gs
->gimple_omp_for
.iter
[i
].incr
;
4129 /* Set INCR to be the increment value for OMP_FOR GS. */
4132 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4134 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4135 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4136 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
4140 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4141 statement GS starts. */
4143 static inline gimple_seq
*
4144 gimple_omp_for_pre_body_ptr (gimple gs
)
4146 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4147 return &gs
->gimple_omp_for
.pre_body
;
4151 /* Return the sequence of statements to execute before the OMP_FOR
4152 statement GS starts. */
4154 static inline gimple_seq
4155 gimple_omp_for_pre_body (gimple gs
)
4157 return *gimple_omp_for_pre_body_ptr (gs
);
4161 /* Set PRE_BODY to be the sequence of statements to execute before the
4162 OMP_FOR statement GS starts. */
4165 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4167 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4168 gs
->gimple_omp_for
.pre_body
= pre_body
;
4172 /* Return the clauses associated with OMP_PARALLEL GS. */
4175 gimple_omp_parallel_clauses (const_gimple gs
)
4177 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4178 return gs
->gimple_omp_parallel
.clauses
;
4182 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4184 static inline tree
*
4185 gimple_omp_parallel_clauses_ptr (gimple gs
)
4187 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4188 return &gs
->gimple_omp_parallel
.clauses
;
4192 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4196 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4198 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4199 gs
->gimple_omp_parallel
.clauses
= clauses
;
4203 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4206 gimple_omp_parallel_child_fn (const_gimple gs
)
4208 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4209 return gs
->gimple_omp_parallel
.child_fn
;
4212 /* Return a pointer to the child function used to hold the body of
4215 static inline tree
*
4216 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4218 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4219 return &gs
->gimple_omp_parallel
.child_fn
;
4223 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4226 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4228 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4229 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4233 /* Return the artificial argument used to send variables and values
4234 from the parent to the children threads in OMP_PARALLEL GS. */
4237 gimple_omp_parallel_data_arg (const_gimple gs
)
4239 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4240 return gs
->gimple_omp_parallel
.data_arg
;
4244 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4246 static inline tree
*
4247 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4249 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4250 return &gs
->gimple_omp_parallel
.data_arg
;
4254 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4257 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4259 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4260 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4264 /* Return the clauses associated with OMP_TASK GS. */
4267 gimple_omp_task_clauses (const_gimple gs
)
4269 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4270 return gs
->gimple_omp_parallel
.clauses
;
4274 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4276 static inline tree
*
4277 gimple_omp_task_clauses_ptr (gimple gs
)
4279 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4280 return &gs
->gimple_omp_parallel
.clauses
;
4284 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4288 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4290 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4291 gs
->gimple_omp_parallel
.clauses
= clauses
;
4295 /* Return the child function used to hold the body of OMP_TASK GS. */
4298 gimple_omp_task_child_fn (const_gimple gs
)
4300 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4301 return gs
->gimple_omp_parallel
.child_fn
;
4304 /* Return a pointer to the child function used to hold the body of
4307 static inline tree
*
4308 gimple_omp_task_child_fn_ptr (gimple gs
)
4310 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4311 return &gs
->gimple_omp_parallel
.child_fn
;
4315 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4318 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4320 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4321 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4325 /* Return the artificial argument used to send variables and values
4326 from the parent to the children threads in OMP_TASK GS. */
4329 gimple_omp_task_data_arg (const_gimple gs
)
4331 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4332 return gs
->gimple_omp_parallel
.data_arg
;
4336 /* Return a pointer to the data argument for OMP_TASK GS. */
4338 static inline tree
*
4339 gimple_omp_task_data_arg_ptr (gimple gs
)
4341 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4342 return &gs
->gimple_omp_parallel
.data_arg
;
4346 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4349 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4351 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4352 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4356 /* Return the clauses associated with OMP_TASK GS. */
4359 gimple_omp_taskreg_clauses (const_gimple gs
)
4361 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4362 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4363 return gs
->gimple_omp_parallel
.clauses
;
4367 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4369 static inline tree
*
4370 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4372 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4373 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4374 return &gs
->gimple_omp_parallel
.clauses
;
4378 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4382 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4384 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4385 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4386 gs
->gimple_omp_parallel
.clauses
= clauses
;
4390 /* Return the child function used to hold the body of OMP_TASK GS. */
4393 gimple_omp_taskreg_child_fn (const_gimple gs
)
4395 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4396 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4397 return gs
->gimple_omp_parallel
.child_fn
;
4400 /* Return a pointer to the child function used to hold the body of
4403 static inline tree
*
4404 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4406 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4407 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4408 return &gs
->gimple_omp_parallel
.child_fn
;
4412 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4415 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4417 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4418 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4419 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4423 /* Return the artificial argument used to send variables and values
4424 from the parent to the children threads in OMP_TASK GS. */
4427 gimple_omp_taskreg_data_arg (const_gimple gs
)
4429 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4430 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4431 return gs
->gimple_omp_parallel
.data_arg
;
4435 /* Return a pointer to the data argument for OMP_TASK GS. */
4437 static inline tree
*
4438 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4440 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4441 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4442 return &gs
->gimple_omp_parallel
.data_arg
;
4446 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4449 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4451 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4452 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4453 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4457 /* Return the copy function used to hold the body of OMP_TASK GS. */
4460 gimple_omp_task_copy_fn (const_gimple gs
)
4462 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4463 return gs
->gimple_omp_task
.copy_fn
;
4466 /* Return a pointer to the copy function used to hold the body of
4469 static inline tree
*
4470 gimple_omp_task_copy_fn_ptr (gimple gs
)
4472 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4473 return &gs
->gimple_omp_task
.copy_fn
;
4477 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4480 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4482 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4483 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
4487 /* Return size of the data block in bytes in OMP_TASK GS. */
4490 gimple_omp_task_arg_size (const_gimple gs
)
4492 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4493 return gs
->gimple_omp_task
.arg_size
;
4497 /* Return a pointer to the data block size for OMP_TASK GS. */
4499 static inline tree
*
4500 gimple_omp_task_arg_size_ptr (gimple gs
)
4502 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4503 return &gs
->gimple_omp_task
.arg_size
;
4507 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4510 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4512 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4513 gs
->gimple_omp_task
.arg_size
= arg_size
;
4517 /* Return align of the data block in bytes in OMP_TASK GS. */
4520 gimple_omp_task_arg_align (const_gimple gs
)
4522 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4523 return gs
->gimple_omp_task
.arg_align
;
4527 /* Return a pointer to the data block align for OMP_TASK GS. */
4529 static inline tree
*
4530 gimple_omp_task_arg_align_ptr (gimple gs
)
4532 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4533 return &gs
->gimple_omp_task
.arg_align
;
4537 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4540 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
4542 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4543 gs
->gimple_omp_task
.arg_align
= arg_align
;
4547 /* Return the clauses associated with OMP_SINGLE GS. */
4550 gimple_omp_single_clauses (const_gimple gs
)
4552 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4553 return gs
->gimple_omp_single
.clauses
;
4557 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4559 static inline tree
*
4560 gimple_omp_single_clauses_ptr (gimple gs
)
4562 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4563 return &gs
->gimple_omp_single
.clauses
;
4567 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4570 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
4572 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4573 gs
->gimple_omp_single
.clauses
= clauses
;
4577 /* Return the clauses associated with OMP_TARGET GS. */
4580 gimple_omp_target_clauses (const_gimple gs
)
4582 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4583 return gs
->gimple_omp_parallel
.clauses
;
4587 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
4589 static inline tree
*
4590 gimple_omp_target_clauses_ptr (gimple gs
)
4592 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4593 return &gs
->gimple_omp_parallel
.clauses
;
4597 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
4600 gimple_omp_target_set_clauses (gimple gs
, tree clauses
)
4602 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4603 gs
->gimple_omp_parallel
.clauses
= clauses
;
4607 /* Return the kind of OMP target statemement. */
4610 gimple_omp_target_kind (const_gimple g
)
4612 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
4613 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
4617 /* Set the OMP target kind. */
4620 gimple_omp_target_set_kind (gimple g
, int kind
)
4622 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
4623 g
->gsbase
.subcode
= (g
->gsbase
.subcode
& ~GF_OMP_TARGET_KIND_MASK
)
4624 | (kind
& GF_OMP_TARGET_KIND_MASK
);
4628 /* Return the child function used to hold the body of OMP_TARGET GS. */
4631 gimple_omp_target_child_fn (const_gimple gs
)
4633 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4634 return gs
->gimple_omp_parallel
.child_fn
;
4637 /* Return a pointer to the child function used to hold the body of
4640 static inline tree
*
4641 gimple_omp_target_child_fn_ptr (gimple gs
)
4643 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4644 return &gs
->gimple_omp_parallel
.child_fn
;
4648 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
4651 gimple_omp_target_set_child_fn (gimple gs
, tree child_fn
)
4653 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4654 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4658 /* Return the artificial argument used to send variables and values
4659 from the parent to the children threads in OMP_TARGET GS. */
4662 gimple_omp_target_data_arg (const_gimple gs
)
4664 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4665 return gs
->gimple_omp_parallel
.data_arg
;
4669 /* Return a pointer to the data argument for OMP_TARGET GS. */
4671 static inline tree
*
4672 gimple_omp_target_data_arg_ptr (gimple gs
)
4674 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4675 return &gs
->gimple_omp_parallel
.data_arg
;
4679 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
4682 gimple_omp_target_set_data_arg (gimple gs
, tree data_arg
)
4684 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4685 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4689 /* Return the clauses associated with OMP_TEAMS GS. */
4692 gimple_omp_teams_clauses (const_gimple gs
)
4694 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4695 return gs
->gimple_omp_single
.clauses
;
4699 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
4701 static inline tree
*
4702 gimple_omp_teams_clauses_ptr (gimple gs
)
4704 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4705 return &gs
->gimple_omp_single
.clauses
;
4709 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
4712 gimple_omp_teams_set_clauses (gimple gs
, tree clauses
)
4714 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4715 gs
->gimple_omp_single
.clauses
= clauses
;
4719 /* Return the clauses associated with OMP_SECTIONS GS. */
4722 gimple_omp_sections_clauses (const_gimple gs
)
4724 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4725 return gs
->gimple_omp_sections
.clauses
;
4729 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4731 static inline tree
*
4732 gimple_omp_sections_clauses_ptr (gimple gs
)
4734 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4735 return &gs
->gimple_omp_sections
.clauses
;
4739 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4743 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4745 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4746 gs
->gimple_omp_sections
.clauses
= clauses
;
4750 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4754 gimple_omp_sections_control (const_gimple gs
)
4756 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4757 return gs
->gimple_omp_sections
.control
;
4761 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4764 static inline tree
*
4765 gimple_omp_sections_control_ptr (gimple gs
)
4767 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4768 return &gs
->gimple_omp_sections
.control
;
4772 /* Set CONTROL to be the set of clauses associated with the
4773 GIMPLE_OMP_SECTIONS in GS. */
4776 gimple_omp_sections_set_control (gimple gs
, tree control
)
4778 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4779 gs
->gimple_omp_sections
.control
= control
;
4783 /* Set COND to be the condition code for OMP_FOR GS. */
4786 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4788 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4789 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4790 && i
< gs
->gimple_omp_for
.collapse
);
4791 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4795 /* Return the condition code associated with OMP_FOR GS. */
4797 static inline enum tree_code
4798 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4800 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4801 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4802 return gs
->gimple_omp_for
.iter
[i
].cond
;
4806 /* Set the value being stored in an atomic store. */
4809 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4811 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4812 g
->gimple_omp_atomic_store
.val
= val
;
4816 /* Return the value being stored in an atomic store. */
4819 gimple_omp_atomic_store_val (const_gimple g
)
4821 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4822 return g
->gimple_omp_atomic_store
.val
;
4826 /* Return a pointer to the value being stored in an atomic store. */
4828 static inline tree
*
4829 gimple_omp_atomic_store_val_ptr (gimple g
)
4831 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4832 return &g
->gimple_omp_atomic_store
.val
;
4836 /* Set the LHS of an atomic load. */
4839 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
4841 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4842 g
->gimple_omp_atomic_load
.lhs
= lhs
;
4846 /* Get the LHS of an atomic load. */
4849 gimple_omp_atomic_load_lhs (const_gimple g
)
4851 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4852 return g
->gimple_omp_atomic_load
.lhs
;
4856 /* Return a pointer to the LHS of an atomic load. */
4858 static inline tree
*
4859 gimple_omp_atomic_load_lhs_ptr (gimple g
)
4861 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4862 return &g
->gimple_omp_atomic_load
.lhs
;
4866 /* Set the RHS of an atomic load. */
4869 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
4871 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4872 g
->gimple_omp_atomic_load
.rhs
= rhs
;
4876 /* Get the RHS of an atomic load. */
4879 gimple_omp_atomic_load_rhs (const_gimple g
)
4881 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4882 return g
->gimple_omp_atomic_load
.rhs
;
4886 /* Return a pointer to the RHS of an atomic load. */
4888 static inline tree
*
4889 gimple_omp_atomic_load_rhs_ptr (gimple g
)
4891 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4892 return &g
->gimple_omp_atomic_load
.rhs
;
4896 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4899 gimple_omp_continue_control_def (const_gimple g
)
4901 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4902 return g
->gimple_omp_continue
.control_def
;
4905 /* The same as above, but return the address. */
4907 static inline tree
*
4908 gimple_omp_continue_control_def_ptr (gimple g
)
4910 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4911 return &g
->gimple_omp_continue
.control_def
;
4914 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4917 gimple_omp_continue_set_control_def (gimple g
, tree def
)
4919 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4920 g
->gimple_omp_continue
.control_def
= def
;
4924 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4927 gimple_omp_continue_control_use (const_gimple g
)
4929 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4930 return g
->gimple_omp_continue
.control_use
;
4934 /* The same as above, but return the address. */
4936 static inline tree
*
4937 gimple_omp_continue_control_use_ptr (gimple g
)
4939 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4940 return &g
->gimple_omp_continue
.control_use
;
4944 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4947 gimple_omp_continue_set_control_use (gimple g
, tree use
)
4949 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4950 g
->gimple_omp_continue
.control_use
= use
;
4953 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4955 static inline gimple_seq
*
4956 gimple_transaction_body_ptr (gimple gs
)
4958 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4959 return &gs
->gimple_transaction
.body
;
4962 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4964 static inline gimple_seq
4965 gimple_transaction_body (gimple gs
)
4967 return *gimple_transaction_body_ptr (gs
);
4970 /* Return the label associated with a GIMPLE_TRANSACTION. */
4973 gimple_transaction_label (const_gimple gs
)
4975 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4976 return gs
->gimple_transaction
.label
;
4979 static inline tree
*
4980 gimple_transaction_label_ptr (gimple gs
)
4982 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4983 return &gs
->gimple_transaction
.label
;
4986 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4988 static inline unsigned int
4989 gimple_transaction_subcode (const_gimple gs
)
4991 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4992 return gs
->gsbase
.subcode
;
4995 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4998 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
5000 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5001 gs
->gimple_transaction
.body
= body
;
5004 /* Set the label associated with a GIMPLE_TRANSACTION. */
5007 gimple_transaction_set_label (gimple gs
, tree label
)
5009 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5010 gs
->gimple_transaction
.label
= label
;
5013 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5016 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
5018 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5019 gs
->gsbase
.subcode
= subcode
;
5023 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5025 static inline tree
*
5026 gimple_return_retval_ptr (const_gimple gs
)
5028 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5029 return gimple_op_ptr (gs
, 0);
5032 /* Return the return value for GIMPLE_RETURN GS. */
5035 gimple_return_retval (const_gimple gs
)
5037 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5038 return gimple_op (gs
, 0);
5042 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5045 gimple_return_set_retval (gimple gs
, tree retval
)
5047 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5048 gimple_set_op (gs
, 0, retval
);
5052 /* Return the return bounds for GIMPLE_RETURN GS. */
5055 gimple_return_retbnd (const_gimple gs
)
5057 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5058 return gimple_op (gs
, 1);
5062 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5065 gimple_return_set_retbnd (gimple gs
, tree retval
)
5067 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5068 gimple_set_op (gs
, 1, retval
);
5072 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5074 #define CASE_GIMPLE_OMP \
5075 case GIMPLE_OMP_PARALLEL: \
5076 case GIMPLE_OMP_TASK: \
5077 case GIMPLE_OMP_FOR: \
5078 case GIMPLE_OMP_SECTIONS: \
5079 case GIMPLE_OMP_SECTIONS_SWITCH: \
5080 case GIMPLE_OMP_SINGLE: \
5081 case GIMPLE_OMP_TARGET: \
5082 case GIMPLE_OMP_TEAMS: \
5083 case GIMPLE_OMP_SECTION: \
5084 case GIMPLE_OMP_MASTER: \
5085 case GIMPLE_OMP_TASKGROUP: \
5086 case GIMPLE_OMP_ORDERED: \
5087 case GIMPLE_OMP_CRITICAL: \
5088 case GIMPLE_OMP_RETURN: \
5089 case GIMPLE_OMP_ATOMIC_LOAD: \
5090 case GIMPLE_OMP_ATOMIC_STORE: \
5091 case GIMPLE_OMP_CONTINUE
5094 is_gimple_omp (const_gimple stmt
)
5096 switch (gimple_code (stmt
))
5106 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5109 gimple_nop_p (const_gimple g
)
5111 return gimple_code (g
) == GIMPLE_NOP
;
5115 /* Return true if GS is a GIMPLE_RESX. */
5118 is_gimple_resx (const_gimple gs
)
5120 return gimple_code (gs
) == GIMPLE_RESX
;
5123 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5125 static inline enum br_predictor
5126 gimple_predict_predictor (gimple gs
)
5128 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5129 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
5133 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5136 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5138 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5139 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
5140 | (unsigned) predictor
;
5144 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5146 static inline enum prediction
5147 gimple_predict_outcome (gimple gs
)
5149 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5150 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5154 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5157 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5159 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5160 if (outcome
== TAKEN
)
5161 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
5163 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
5167 /* Return the type of the main expression computed by STMT. Return
5168 void_type_node if the statement computes nothing. */
5171 gimple_expr_type (const_gimple stmt
)
5173 enum gimple_code code
= gimple_code (stmt
);
5175 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5178 /* In general we want to pass out a type that can be substituted
5179 for both the RHS and the LHS types if there is a possibly
5180 useless conversion involved. That means returning the
5181 original RHS type as far as we can reconstruct it. */
5182 if (code
== GIMPLE_CALL
)
5183 type
= gimple_call_return_type (stmt
);
5185 switch (gimple_assign_rhs_code (stmt
))
5187 case POINTER_PLUS_EXPR
:
5188 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5192 /* As fallback use the type of the LHS. */
5193 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5198 else if (code
== GIMPLE_COND
)
5199 return boolean_type_node
;
5201 return void_type_node
;
5204 enum gsi_iterator_update
5206 GSI_NEW_STMT
, /* Only valid when single statement is added, move
5208 GSI_SAME_STMT
, /* Leave the iterator at the same statement. */
5209 GSI_CONTINUE_LINKING
/* Move iterator to whatever position is suitable
5210 for linking other statements in the same
5214 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
5216 /* Enum and arrays used for allocation stats. Keep in sync with
5217 gimple.c:gimple_alloc_kind_names. */
5218 enum gimple_alloc_kind
5220 gimple_alloc_kind_assign
, /* Assignments. */
5221 gimple_alloc_kind_phi
, /* PHI nodes. */
5222 gimple_alloc_kind_cond
, /* Conditionals. */
5223 gimple_alloc_kind_rest
, /* Everything else. */
5224 gimple_alloc_kind_all
5227 extern int gimple_alloc_counts
[];
5228 extern int gimple_alloc_sizes
[];
5230 /* Return the allocation kind for a given stmt CODE. */
5231 static inline enum gimple_alloc_kind
5232 gimple_alloc_kind (enum gimple_code code
)
5237 return gimple_alloc_kind_assign
;
5239 return gimple_alloc_kind_phi
;
5241 return gimple_alloc_kind_cond
;
5243 return gimple_alloc_kind_rest
;
5247 extern void dump_gimple_statistics (void);
5249 /* Return true if a location should not be emitted for this statement
5250 by annotate_all_with_location. */
5253 gimple_do_not_emit_location_p (gimple g
)
5255 return gimple_plf (g
, GF_PLF_1
);
5258 /* Mark statement G so a location will not be emitted by
5259 annotate_one_with_location. */
5262 gimple_set_do_not_emit_location (gimple g
)
5264 /* The PLF flags are initialized to 0 when a new tuple is created,
5265 so no need to initialize it anywhere. */
5266 gimple_set_plf (g
, GF_PLF_1
, true);
5270 /* Macros for showing usage statistics. */
5271 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5273 : ((x) < 1024*1024*10 \
5275 : (x) / (1024*1024))))
5277 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5279 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
5281 extern void sort_case_labels (vec
<tree
> );
5282 extern void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
5283 extern void gimple_seq_set_location (gimple_seq
, location_t
);
5285 #endif /* GCC_GIMPLE_H */