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_CALL_WITH_BOUNDS
= 1 << 7,
105 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
106 GF_OMP_FOR_KIND_MASK
= 3 << 0,
107 GF_OMP_FOR_KIND_FOR
= 0 << 0,
108 GF_OMP_FOR_KIND_DISTRIBUTE
= 1 << 0,
109 GF_OMP_FOR_KIND_SIMD
= 2 << 0,
110 GF_OMP_FOR_KIND_CILKSIMD
= 3 << 0,
111 GF_OMP_FOR_COMBINED
= 1 << 2,
112 GF_OMP_FOR_COMBINED_INTO
= 1 << 3,
113 GF_OMP_TARGET_KIND_MASK
= 3 << 0,
114 GF_OMP_TARGET_KIND_REGION
= 0 << 0,
115 GF_OMP_TARGET_KIND_DATA
= 1 << 0,
116 GF_OMP_TARGET_KIND_UPDATE
= 2 << 0,
118 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
119 a thread synchronization via some sort of barrier. The exact barrier
120 that would otherwise be emitted is dependent on the OMP statement with
121 which this return is associated. */
122 GF_OMP_RETURN_NOWAIT
= 1 << 0,
124 GF_OMP_SECTION_LAST
= 1 << 0,
125 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
126 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
127 GF_PREDICT_TAKEN
= 1 << 15
130 /* Currently, there are only two types of gimple debug stmt. Others are
131 envisioned, for example, to enable the generation of is_stmt notes
132 in line number information, to mark sequence points, etc. This
133 subcode is to be used to tell them apart. */
134 enum gimple_debug_subcode
{
135 GIMPLE_DEBUG_BIND
= 0,
136 GIMPLE_DEBUG_SOURCE_BIND
= 1
139 /* Masks for selecting a pass local flag (PLF) to work on. These
140 masks are used by gimple_set_plf and gimple_plf. */
146 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
147 are for 64 bit hosts. */
149 struct GTY((chain_next ("%h.next"))) gimple_statement_base
{
151 Main identifying code for a tuple. */
152 ENUM_BITFIELD(gimple_code
) code
: 8;
154 /* Nonzero if a warning should not be emitted on this tuple. */
155 unsigned int no_warning
: 1;
157 /* Nonzero if this tuple has been visited. Passes are responsible
158 for clearing this bit before using it. */
159 unsigned int visited
: 1;
161 /* Nonzero if this tuple represents a non-temporal move. */
162 unsigned int nontemporal_move
: 1;
164 /* Pass local flags. These flags are free for any pass to use as
165 they see fit. Passes should not assume that these flags contain
166 any useful value when the pass starts. Any initial state that
167 the pass requires should be set on entry to the pass. See
168 gimple_set_plf and gimple_plf for usage. */
169 unsigned int plf
: 2;
171 /* Nonzero if this statement has been modified and needs to have its
172 operands rescanned. */
173 unsigned modified
: 1;
175 /* Nonzero if this statement contains volatile operands. */
176 unsigned has_volatile_ops
: 1;
178 /* The SUBCODE field can be used for tuple-specific flags for tuples
179 that do not require subcodes. Note that SUBCODE should be at
180 least as wide as tree codes, as several tuples store tree codes
182 unsigned int subcode
: 16;
184 /* UID of this statement. This is used by passes that want to
185 assign IDs to statements. It must be assigned and used by each
186 pass. By default it should be assumed to contain garbage. */
190 Locus information for debug info. */
193 /* Number of operands in this tuple. */
197 Basic block holding this statement. */
201 Linked lists of gimple statements. The next pointers form
202 a NULL terminated list, the prev pointers are a cyclic list.
203 A gimple statement is hence also a double-ended list of
204 statements, with the pointer itself being the first element,
205 and the prev pointer being the last. */
207 gimple
GTY((skip
)) prev
;
211 /* Base structure for tuples with operands. */
213 struct GTY(()) gimple_statement_with_ops_base
216 struct gimple_statement_base gsbase
;
219 SSA operand vectors. NOTE: It should be possible to
220 amalgamate these vectors with the operand vector OP. However,
221 the SSA operand vectors are organized differently and contain
222 more information (like immediate use chaining). */
223 struct use_optype_d
GTY((skip (""))) *use_ops
;
227 /* Statements that take register operands. */
229 struct GTY(()) gimple_statement_with_ops
232 struct gimple_statement_with_ops_base opbase
;
235 Operand vector. NOTE! This must always be the last field
236 of this structure. In particular, this means that this
237 structure cannot be embedded inside another one. */
238 tree
GTY((length ("%h.opbase.gsbase.num_ops"))) op
[1];
242 /* Base for statements that take both memory and register operands. */
244 struct GTY(()) gimple_statement_with_memory_ops_base
247 struct gimple_statement_with_ops_base opbase
;
250 Virtual operands for this statement. The GC will pick them
251 up via the ssa_names array. */
252 tree
GTY((skip (""))) vdef
;
253 tree
GTY((skip (""))) vuse
;
257 /* Statements that take both memory and register operands. */
259 struct GTY(()) gimple_statement_with_memory_ops
262 struct gimple_statement_with_memory_ops_base membase
;
265 Operand vector. NOTE! This must always be the last field
266 of this structure. In particular, this means that this
267 structure cannot be embedded inside another one. */
268 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
272 /* Call statements that take both memory and register operands. */
274 struct GTY(()) gimple_statement_call
277 struct gimple_statement_with_memory_ops_base membase
;
280 struct pt_solution call_used
;
281 struct pt_solution call_clobbered
;
284 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
285 tree
GTY ((tag ("0"))) fntype
;
286 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
290 Operand vector. NOTE! This must always be the last field
291 of this structure. In particular, this means that this
292 structure cannot be embedded inside another one. */
293 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
297 /* OpenMP statements (#pragma omp). */
299 struct GTY(()) gimple_statement_omp
{
301 struct gimple_statement_base gsbase
;
310 struct GTY(()) gimple_statement_bind
{
312 struct gimple_statement_base gsbase
;
315 Variables declared in this scope. */
319 This is different than the BLOCK field in gimple_statement_base,
320 which is analogous to TREE_BLOCK (i.e., the lexical block holding
321 this statement). This field is the equivalent of BIND_EXPR_BLOCK
322 in tree land (i.e., the lexical scope defined by this bind). See
333 struct GTY(()) gimple_statement_catch
{
335 struct gimple_statement_base gsbase
;
345 /* GIMPLE_EH_FILTER */
347 struct GTY(()) gimple_statement_eh_filter
{
349 struct gimple_statement_base gsbase
;
362 struct GTY(()) gimple_statement_eh_else
{
364 struct gimple_statement_base gsbase
;
367 gimple_seq n_body
, e_body
;
370 /* GIMPLE_EH_MUST_NOT_THROW */
372 struct GTY(()) gimple_statement_eh_mnt
{
374 struct gimple_statement_base gsbase
;
376 /* [ WORD 7 ] Abort function decl. */
382 struct GTY(()) gimple_statement_phi
{
384 struct gimple_statement_base gsbase
;
394 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
398 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
400 struct GTY(()) gimple_statement_eh_ctrl
403 struct gimple_statement_base gsbase
;
406 Exception region number. */
413 struct GTY(()) gimple_statement_try
{
415 struct gimple_statement_base gsbase
;
418 Expression to evaluate. */
422 Cleanup expression. */
426 /* Kind of GIMPLE_TRY statements. */
427 enum gimple_try_flags
430 GIMPLE_TRY_CATCH
= 1 << 0,
433 GIMPLE_TRY_FINALLY
= 1 << 1,
434 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
436 /* Analogous to TRY_CATCH_IS_CLEANUP. */
437 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
440 /* GIMPLE_WITH_CLEANUP_EXPR */
442 struct GTY(()) gimple_statement_wce
{
444 struct gimple_statement_base gsbase
;
446 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
447 executed if an exception is thrown, not on normal exit of its
448 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
452 Cleanup expression. */
459 struct GTY(()) gimple_statement_asm
462 struct gimple_statement_with_memory_ops_base membase
;
465 __asm__ statement. */
469 Number of inputs, outputs, clobbers, labels. */
476 Operand vector. NOTE! This must always be the last field
477 of this structure. In particular, this means that this
478 structure cannot be embedded inside another one. */
479 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
482 /* GIMPLE_OMP_CRITICAL */
484 struct GTY(()) gimple_statement_omp_critical
{
486 struct gimple_statement_omp omp
;
489 Critical section name. */
494 struct GTY(()) gimple_omp_for_iter
{
495 /* Condition code. */
498 /* Index variable. */
513 struct GTY(()) gimple_statement_omp_for
{
515 struct gimple_statement_omp omp
;
521 Number of elements in iter array. */
525 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
528 Pre-body evaluated before the loop body begins. */
533 /* GIMPLE_OMP_PARALLEL */
535 struct GTY(()) gimple_statement_omp_parallel
{
537 struct gimple_statement_omp omp
;
544 Child function holding the body of the parallel region. */
548 Shared data argument. */
553 /* GIMPLE_OMP_TASK */
555 struct GTY(()) gimple_statement_omp_task
{
557 struct gimple_statement_omp_parallel par
;
560 Child function holding firstprivate initialization if needed. */
564 Size and alignment in bytes of the argument data block. */
570 /* GIMPLE_OMP_SECTION */
571 /* Uses struct gimple_statement_omp. */
574 /* GIMPLE_OMP_SECTIONS */
576 struct GTY(()) gimple_statement_omp_sections
{
578 struct gimple_statement_omp omp
;
584 The control variable used for deciding which of the sections to
589 /* GIMPLE_OMP_CONTINUE.
591 Note: This does not inherit from gimple_statement_omp, because we
592 do not need the body field. */
594 struct GTY(()) gimple_statement_omp_continue
{
596 struct gimple_statement_base gsbase
;
605 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS */
607 struct GTY(()) gimple_statement_omp_single
{
609 struct gimple_statement_omp omp
;
616 /* GIMPLE_OMP_ATOMIC_LOAD.
617 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
618 contains a sequence, which we don't need here. */
620 struct GTY(()) gimple_statement_omp_atomic_load
{
622 struct gimple_statement_base gsbase
;
628 /* GIMPLE_OMP_ATOMIC_STORE.
629 See note on GIMPLE_OMP_ATOMIC_LOAD. */
631 struct GTY(()) gimple_statement_omp_atomic_store
{
633 struct gimple_statement_base gsbase
;
639 /* GIMPLE_TRANSACTION. */
641 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
643 /* The __transaction_atomic was declared [[outer]] or it is
644 __transaction_relaxed. */
645 #define GTMA_IS_OUTER (1u << 0)
646 #define GTMA_IS_RELAXED (1u << 1)
647 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
649 /* The transaction is seen to not have an abort. */
650 #define GTMA_HAVE_ABORT (1u << 2)
651 /* The transaction is seen to have loads or stores. */
652 #define GTMA_HAVE_LOAD (1u << 3)
653 #define GTMA_HAVE_STORE (1u << 4)
654 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
655 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
656 /* The transaction WILL enter serial irrevocable mode.
657 An irrevocable block post-dominates the entire transaction, such
658 that all invocations of the transaction will go serial-irrevocable.
659 In such case, we don't bother instrumenting the transaction, and
660 tell the runtime that it should begin the transaction in
661 serial-irrevocable mode. */
662 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
663 /* The transaction contains no instrumentation code whatsover, most
664 likely because it is guaranteed to go irrevocable upon entry. */
665 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
667 struct GTY(()) gimple_statement_transaction
670 struct gimple_statement_with_memory_ops_base gsbase
;
679 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
680 enum gimple_statement_structure_enum
{
681 #include "gsstruct.def"
687 /* Define the overall contents of a gimple tuple. It may be any of the
688 structures declared above for various types of tuples. */
690 union GTY ((desc ("gimple_statement_structure (&%h)"),
691 chain_next ("%h.gsbase.next"), variable_size
)) gimple_statement_d
{
692 struct gimple_statement_base
GTY ((tag ("GSS_BASE"))) gsbase
;
693 struct gimple_statement_with_ops
GTY ((tag ("GSS_WITH_OPS"))) gsops
;
694 struct gimple_statement_with_memory_ops_base
GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase
;
695 struct gimple_statement_with_memory_ops
GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem
;
696 struct gimple_statement_call
GTY ((tag ("GSS_CALL"))) gimple_call
;
697 struct gimple_statement_omp
GTY ((tag ("GSS_OMP"))) omp
;
698 struct gimple_statement_bind
GTY ((tag ("GSS_BIND"))) gimple_bind
;
699 struct gimple_statement_catch
GTY ((tag ("GSS_CATCH"))) gimple_catch
;
700 struct gimple_statement_eh_filter
GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter
;
701 struct gimple_statement_eh_mnt
GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt
;
702 struct gimple_statement_eh_else
GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else
;
703 struct gimple_statement_phi
GTY ((tag ("GSS_PHI"))) gimple_phi
;
704 struct gimple_statement_eh_ctrl
GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl
;
705 struct gimple_statement_try
GTY ((tag ("GSS_TRY"))) gimple_try
;
706 struct gimple_statement_wce
GTY ((tag ("GSS_WCE"))) gimple_wce
;
707 struct gimple_statement_asm
GTY ((tag ("GSS_ASM"))) gimple_asm
;
708 struct gimple_statement_omp_critical
GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical
;
709 struct gimple_statement_omp_for
GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for
;
710 struct gimple_statement_omp_parallel
GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel
;
711 struct gimple_statement_omp_task
GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task
;
712 struct gimple_statement_omp_sections
GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections
;
713 struct gimple_statement_omp_single
GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single
;
714 struct gimple_statement_omp_continue
GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue
;
715 struct gimple_statement_omp_atomic_load
GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load
;
716 struct gimple_statement_omp_atomic_store
GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store
;
717 struct gimple_statement_transaction
GTY((tag ("GSS_TRANSACTION"))) gimple_transaction
;
720 /* Offset in bytes to the location of the operand vector.
721 Zero if there is no operand vector for this tuple structure. */
722 extern size_t const gimple_ops_offset_
[];
724 /* Map GIMPLE codes to GSS codes. */
725 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
727 /* This variable holds the currently expanded gimple statement for purposes
728 of comminucating the profile info to the builtin expanders. */
729 extern gimple currently_expanding_gimple_stmt
;
731 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
732 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
733 gimple
gimple_build_return (tree
);
734 void gimple_call_reset_alias_info (gimple
);
735 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
736 gimple
gimple_build_call (tree
, unsigned, ...);
737 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
738 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
739 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
740 gimple
gimple_build_call_from_tree (tree
);
741 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
742 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
743 gimple
gimple_build_assign_with_ops (enum tree_code
, tree
,
744 tree
, tree
, tree CXX_MEM_STAT_INFO
);
745 gimple
gimple_build_assign_with_ops (enum tree_code
, tree
,
746 tree
, tree CXX_MEM_STAT_INFO
);
747 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
748 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
749 void gimple_cond_set_condition_from_tree (gimple
, tree
);
750 gimple
gimple_build_label (tree label
);
751 gimple
gimple_build_goto (tree dest
);
752 gimple
gimple_build_nop (void);
753 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
754 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
755 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
757 gimple
gimple_build_catch (tree
, gimple_seq
);
758 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
759 gimple
gimple_build_eh_must_not_throw (tree
);
760 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
761 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
762 gimple
gimple_build_wce (gimple_seq
);
763 gimple
gimple_build_resx (int);
764 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
765 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
766 gimple
gimple_build_eh_dispatch (int);
767 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
768 #define gimple_build_debug_bind(var,val,stmt) \
769 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
770 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
771 #define gimple_build_debug_source_bind(var,val,stmt) \
772 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
773 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
774 gimple
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
775 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
776 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
777 gimple
gimple_build_omp_section (gimple_seq
);
778 gimple
gimple_build_omp_master (gimple_seq
);
779 gimple
gimple_build_omp_taskgroup (gimple_seq
);
780 gimple
gimple_build_omp_continue (tree
, tree
);
781 gimple
gimple_build_omp_ordered (gimple_seq
);
782 gimple
gimple_build_omp_return (bool);
783 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
784 gimple
gimple_build_omp_sections_switch (void);
785 gimple
gimple_build_omp_single (gimple_seq
, tree
);
786 gimple
gimple_build_omp_target (gimple_seq
, int, tree
);
787 gimple
gimple_build_omp_teams (gimple_seq
, 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 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
);
793 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
794 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
795 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
797 extern void annotate_all_with_location (gimple_seq
, location_t
);
798 bool empty_body_p (gimple_seq
);
799 gimple_seq
gimple_seq_copy (gimple_seq
);
800 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
801 int gimple_call_flags (const_gimple
);
802 int gimple_call_arg_flags (const_gimple
, unsigned);
803 int gimple_call_return_flags (const_gimple
);
804 bool gimple_assign_copy_p (gimple
);
805 bool gimple_assign_ssa_name_copy_p (gimple
);
806 bool gimple_assign_unary_nop_p (gimple
);
807 void gimple_set_bb (gimple
, basic_block
);
808 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
809 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
811 tree
gimple_get_lhs (const_gimple
);
812 void gimple_set_lhs (gimple
, tree
);
813 gimple
gimple_copy (gimple
);
814 bool gimple_has_side_effects (const_gimple
);
815 bool gimple_could_trap_p_1 (gimple
, bool, bool);
816 bool gimple_could_trap_p (gimple
);
817 bool gimple_assign_rhs_could_trap_p (gimple
);
818 extern void dump_gimple_statistics (void);
819 unsigned get_gimple_rhs_num_ops (enum tree_code
);
820 extern void recalculate_side_effects (tree
);
821 extern tree
canonicalize_cond_expr_cond (tree
);
822 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
823 extern bool gimple_compare_field_offset (tree
, tree
);
824 extern tree
gimple_unsigned_type (tree
);
825 extern tree
gimple_signed_type (tree
);
826 extern alias_set_type
gimple_get_alias_set (tree
);
827 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
828 extern bool is_gimple_builtin_call (gimple stmt
);
829 extern bool gimple_call_builtin_p (gimple
, enum built_in_class
);
830 extern bool gimple_call_builtin_p (gimple
, enum built_in_function
);
831 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
832 extern void dump_decl_set (FILE *, bitmap
);
833 extern bool nonfreeing_call_p (gimple
);
834 extern bool infer_nonnull_range (gimple
, tree
);
835 extern void sort_case_labels (vec
<tree
> );
836 extern void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
837 extern void gimple_seq_set_location (gimple_seq
, location_t
);
839 /* Formal (expression) temporary table handling: multiple occurrences of
840 the same scalar expression are evaluated into the same temporary. */
842 typedef struct gimple_temp_hash_elt
845 tree temp
; /* Value */
848 /* Get the number of the next statement uid to be allocated. */
849 static inline unsigned int
850 gimple_stmt_max_uid (struct function
*fn
)
852 return fn
->last_stmt_uid
;
855 /* Set the number of the next statement uid to be allocated. */
857 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
859 fn
->last_stmt_uid
= maxid
;
862 /* Set the number of the next statement uid to be allocated. */
863 static inline unsigned int
864 inc_gimple_stmt_max_uid (struct function
*fn
)
866 return fn
->last_stmt_uid
++;
869 /* Return the first node in GIMPLE sequence S. */
871 static inline gimple_seq_node
872 gimple_seq_first (gimple_seq s
)
878 /* Return the first statement in GIMPLE sequence S. */
881 gimple_seq_first_stmt (gimple_seq s
)
883 gimple_seq_node n
= gimple_seq_first (s
);
888 /* Return the last node in GIMPLE sequence S. */
890 static inline gimple_seq_node
891 gimple_seq_last (gimple_seq s
)
893 return s
? s
->gsbase
.prev
: NULL
;
897 /* Return the last statement in GIMPLE sequence S. */
900 gimple_seq_last_stmt (gimple_seq s
)
902 gimple_seq_node n
= gimple_seq_last (s
);
907 /* Set the last node in GIMPLE sequence *PS to LAST. */
910 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
912 (*ps
)->gsbase
.prev
= last
;
916 /* Set the first node in GIMPLE sequence *PS to FIRST. */
919 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
925 /* Return true if GIMPLE sequence S is empty. */
928 gimple_seq_empty_p (gimple_seq s
)
933 /* Allocate a new sequence and initialize its first element with STMT. */
935 static inline gimple_seq
936 gimple_seq_alloc_with_stmt (gimple stmt
)
938 gimple_seq seq
= NULL
;
939 gimple_seq_add_stmt (&seq
, stmt
);
944 /* Returns the sequence of statements in BB. */
946 static inline gimple_seq
947 bb_seq (const_basic_block bb
)
949 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
952 static inline gimple_seq
*
953 bb_seq_addr (basic_block bb
)
955 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
958 /* Sets the sequence of statements in BB to SEQ. */
961 set_bb_seq (basic_block bb
, gimple_seq seq
)
963 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
964 bb
->il
.gimple
.seq
= seq
;
968 /* Return the code for GIMPLE statement G. */
970 static inline enum gimple_code
971 gimple_code (const_gimple g
)
973 return g
->gsbase
.code
;
977 /* Return the GSS code used by a GIMPLE code. */
979 static inline enum gimple_statement_structure_enum
980 gss_for_code (enum gimple_code code
)
982 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
983 return gss_for_code_
[code
];
987 /* Return which GSS code is used by GS. */
989 static inline enum gimple_statement_structure_enum
990 gimple_statement_structure (gimple gs
)
992 return gss_for_code (gimple_code (gs
));
996 /* Return true if statement G has sub-statements. This is only true for
997 High GIMPLE statements. */
1000 gimple_has_substatements (gimple g
)
1002 switch (gimple_code (g
))
1006 case GIMPLE_EH_FILTER
:
1007 case GIMPLE_EH_ELSE
:
1009 case GIMPLE_OMP_FOR
:
1010 case GIMPLE_OMP_MASTER
:
1011 case GIMPLE_OMP_TASKGROUP
:
1012 case GIMPLE_OMP_ORDERED
:
1013 case GIMPLE_OMP_SECTION
:
1014 case GIMPLE_OMP_PARALLEL
:
1015 case GIMPLE_OMP_TASK
:
1016 case GIMPLE_OMP_SECTIONS
:
1017 case GIMPLE_OMP_SINGLE
:
1018 case GIMPLE_OMP_TARGET
:
1019 case GIMPLE_OMP_TEAMS
:
1020 case GIMPLE_OMP_CRITICAL
:
1021 case GIMPLE_WITH_CLEANUP_EXPR
:
1022 case GIMPLE_TRANSACTION
:
1031 /* Return the basic block holding statement G. */
1033 static inline basic_block
1034 gimple_bb (const_gimple g
)
1036 return g
->gsbase
.bb
;
1040 /* Return the lexical scope block holding statement G. */
1043 gimple_block (const_gimple g
)
1045 return LOCATION_BLOCK (g
->gsbase
.location
);
1049 /* Set BLOCK to be the lexical scope block holding statement G. */
1052 gimple_set_block (gimple g
, tree block
)
1055 g
->gsbase
.location
=
1056 COMBINE_LOCATION_DATA (line_table
, g
->gsbase
.location
, block
);
1058 g
->gsbase
.location
= LOCATION_LOCUS (g
->gsbase
.location
);
1062 /* Return location information for statement G. */
1064 static inline location_t
1065 gimple_location (const_gimple g
)
1067 return g
->gsbase
.location
;
1070 /* Return pointer to location information for statement G. */
1072 static inline const location_t
*
1073 gimple_location_ptr (const_gimple g
)
1075 return &g
->gsbase
.location
;
1079 /* Set location information for statement G. */
1082 gimple_set_location (gimple g
, location_t location
)
1084 g
->gsbase
.location
= location
;
1088 /* Return true if G contains location information. */
1091 gimple_has_location (const_gimple g
)
1093 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1097 /* Return the file name of the location of STMT. */
1099 static inline const char *
1100 gimple_filename (const_gimple stmt
)
1102 return LOCATION_FILE (gimple_location (stmt
));
1106 /* Return the line number of the location of STMT. */
1109 gimple_lineno (const_gimple stmt
)
1111 return LOCATION_LINE (gimple_location (stmt
));
1115 /* Determine whether SEQ is a singleton. */
1118 gimple_seq_singleton_p (gimple_seq seq
)
1120 return ((gimple_seq_first (seq
) != NULL
)
1121 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1124 /* Return true if no warnings should be emitted for statement STMT. */
1127 gimple_no_warning_p (const_gimple stmt
)
1129 return stmt
->gsbase
.no_warning
;
1132 /* Set the no_warning flag of STMT to NO_WARNING. */
1135 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1137 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1140 /* Set the visited status on statement STMT to VISITED_P. */
1143 gimple_set_visited (gimple stmt
, bool visited_p
)
1145 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1149 /* Return the visited status for statement STMT. */
1152 gimple_visited_p (gimple stmt
)
1154 return stmt
->gsbase
.visited
;
1158 /* Set pass local flag PLF on statement STMT to VAL_P. */
1161 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1164 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1166 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1170 /* Return the value of pass local flag PLF on statement STMT. */
1172 static inline unsigned int
1173 gimple_plf (gimple stmt
, enum plf_mask plf
)
1175 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1179 /* Set the UID of statement. */
1182 gimple_set_uid (gimple g
, unsigned uid
)
1184 g
->gsbase
.uid
= uid
;
1188 /* Return the UID of statement. */
1190 static inline unsigned
1191 gimple_uid (const_gimple g
)
1193 return g
->gsbase
.uid
;
1197 /* Make statement G a singleton sequence. */
1200 gimple_init_singleton (gimple g
)
1202 g
->gsbase
.next
= NULL
;
1207 /* Return true if GIMPLE statement G has register or memory operands. */
1210 gimple_has_ops (const_gimple g
)
1212 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1216 /* Return true if GIMPLE statement G has memory operands. */
1219 gimple_has_mem_ops (const_gimple g
)
1221 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1225 /* Return the set of USE operands for statement G. */
1227 static inline struct use_optype_d
*
1228 gimple_use_ops (const_gimple g
)
1230 if (!gimple_has_ops (g
))
1232 return g
->gsops
.opbase
.use_ops
;
1236 /* Set USE to be the set of USE operands for statement G. */
1239 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1241 gcc_gimple_checking_assert (gimple_has_ops (g
));
1242 g
->gsops
.opbase
.use_ops
= use
;
1246 /* Return the single VUSE operand of the statement G. */
1249 gimple_vuse (const_gimple g
)
1251 if (!gimple_has_mem_ops (g
))
1253 return g
->gsmembase
.vuse
;
1256 /* Return the single VDEF operand of the statement G. */
1259 gimple_vdef (const_gimple g
)
1261 if (!gimple_has_mem_ops (g
))
1263 return g
->gsmembase
.vdef
;
1266 /* Return the single VUSE operand of the statement G. */
1268 static inline tree
*
1269 gimple_vuse_ptr (gimple g
)
1271 if (!gimple_has_mem_ops (g
))
1273 return &g
->gsmembase
.vuse
;
1276 /* Return the single VDEF operand of the statement G. */
1278 static inline tree
*
1279 gimple_vdef_ptr (gimple g
)
1281 if (!gimple_has_mem_ops (g
))
1283 return &g
->gsmembase
.vdef
;
1286 /* Set the single VUSE operand of the statement G. */
1289 gimple_set_vuse (gimple g
, tree vuse
)
1291 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1292 g
->gsmembase
.vuse
= vuse
;
1295 /* Set the single VDEF operand of the statement G. */
1298 gimple_set_vdef (gimple g
, tree vdef
)
1300 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1301 g
->gsmembase
.vdef
= vdef
;
1305 /* Return true if statement G has operands and the modified field has
1309 gimple_modified_p (const_gimple g
)
1311 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1315 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1316 a MODIFIED field. */
1319 gimple_set_modified (gimple s
, bool modifiedp
)
1321 if (gimple_has_ops (s
))
1322 s
->gsbase
.modified
= (unsigned) modifiedp
;
1326 /* Return the tree code for the expression computed by STMT. This is
1327 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1328 GIMPLE_CALL, return CALL_EXPR as the expression code for
1329 consistency. This is useful when the caller needs to deal with the
1330 three kinds of computation that GIMPLE supports. */
1332 static inline enum tree_code
1333 gimple_expr_code (const_gimple stmt
)
1335 enum gimple_code code
= gimple_code (stmt
);
1336 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1337 return (enum tree_code
) stmt
->gsbase
.subcode
;
1340 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1346 /* Return true if statement STMT contains volatile operands. */
1349 gimple_has_volatile_ops (const_gimple stmt
)
1351 if (gimple_has_mem_ops (stmt
))
1352 return stmt
->gsbase
.has_volatile_ops
;
1358 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1361 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1363 if (gimple_has_mem_ops (stmt
))
1364 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1367 /* Return true if STMT is in a transaction. */
1370 gimple_in_transaction (gimple stmt
)
1372 return bb_in_transaction (gimple_bb (stmt
));
1375 /* Return true if statement STMT may access memory. */
1378 gimple_references_memory_p (gimple stmt
)
1380 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1384 /* Return the subcode for OMP statement S. */
1386 static inline unsigned
1387 gimple_omp_subcode (const_gimple s
)
1389 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1390 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
1391 return s
->gsbase
.subcode
;
1394 /* Set the subcode for OMP statement S to SUBCODE. */
1397 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1399 /* We only have 16 bits for the subcode. Assert that we are not
1401 gcc_gimple_checking_assert (subcode
< (1 << 16));
1402 s
->gsbase
.subcode
= subcode
;
1405 /* Set the nowait flag on OMP_RETURN statement S. */
1408 gimple_omp_return_set_nowait (gimple s
)
1410 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1411 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1415 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1419 gimple_omp_return_nowait_p (const_gimple g
)
1421 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1422 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1426 /* Set the LHS of OMP return. */
1429 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
1431 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1432 g
->gimple_omp_atomic_store
.val
= lhs
;
1436 /* Get the LHS of OMP return. */
1439 gimple_omp_return_lhs (const_gimple g
)
1441 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1442 return g
->gimple_omp_atomic_store
.val
;
1446 /* Return a pointer to the LHS of OMP return. */
1448 static inline tree
*
1449 gimple_omp_return_lhs_ptr (gimple g
)
1451 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1452 return &g
->gimple_omp_atomic_store
.val
;
1456 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1460 gimple_omp_section_last_p (const_gimple g
)
1462 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1463 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1467 /* Set the GF_OMP_SECTION_LAST flag on G. */
1470 gimple_omp_section_set_last (gimple g
)
1472 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1473 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1477 /* Return true if OMP parallel statement G has the
1478 GF_OMP_PARALLEL_COMBINED flag set. */
1481 gimple_omp_parallel_combined_p (const_gimple g
)
1483 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1484 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1488 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1489 value of COMBINED_P. */
1492 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1494 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1496 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1498 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1502 /* Return true if OMP atomic load/store statement G has the
1503 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1506 gimple_omp_atomic_need_value_p (const_gimple g
)
1508 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1509 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1510 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
1514 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1517 gimple_omp_atomic_set_need_value (gimple g
)
1519 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1520 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1521 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
1525 /* Return true if OMP atomic load/store statement G has the
1526 GF_OMP_ATOMIC_SEQ_CST flag set. */
1529 gimple_omp_atomic_seq_cst_p (const_gimple g
)
1531 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1532 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1533 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
1537 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
1540 gimple_omp_atomic_set_seq_cst (gimple g
)
1542 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1543 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1544 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
1548 /* Return the number of operands for statement GS. */
1550 static inline unsigned
1551 gimple_num_ops (const_gimple gs
)
1553 return gs
->gsbase
.num_ops
;
1557 /* Set the number of operands for statement GS. */
1560 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1562 gs
->gsbase
.num_ops
= num_ops
;
1566 /* Return the array of operands for statement GS. */
1568 static inline tree
*
1569 gimple_ops (gimple gs
)
1573 /* All the tuples have their operand vector at the very bottom
1574 of the structure. Note that those structures that do not
1575 have an operand vector have a zero offset. */
1576 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1577 gcc_gimple_checking_assert (off
!= 0);
1579 return (tree
*) ((char *) gs
+ off
);
1583 /* Return operand I for statement GS. */
1586 gimple_op (const_gimple gs
, unsigned i
)
1588 if (gimple_has_ops (gs
))
1590 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1591 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1597 /* Return a pointer to operand I for statement GS. */
1599 static inline tree
*
1600 gimple_op_ptr (const_gimple gs
, unsigned i
)
1602 if (gimple_has_ops (gs
))
1604 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1605 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1611 /* Set operand I of statement GS to OP. */
1614 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1616 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1618 /* Note. It may be tempting to assert that OP matches
1619 is_gimple_operand, but that would be wrong. Different tuples
1620 accept slightly different sets of tree operands. Each caller
1621 should perform its own validation. */
1622 gimple_ops (gs
)[i
] = op
;
1625 /* Return true if GS is a GIMPLE_ASSIGN. */
1628 is_gimple_assign (const_gimple gs
)
1630 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1633 /* Determine if expression CODE is one of the valid expressions that can
1634 be used on the RHS of GIMPLE assignments. */
1636 static inline enum gimple_rhs_class
1637 get_gimple_rhs_class (enum tree_code code
)
1639 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1642 /* Return the LHS of assignment statement GS. */
1645 gimple_assign_lhs (const_gimple gs
)
1647 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1648 return gimple_op (gs
, 0);
1652 /* Return a pointer to the LHS of assignment statement GS. */
1654 static inline tree
*
1655 gimple_assign_lhs_ptr (const_gimple gs
)
1657 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1658 return gimple_op_ptr (gs
, 0);
1662 /* Set LHS to be the LHS operand of assignment statement GS. */
1665 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1667 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1668 gimple_set_op (gs
, 0, lhs
);
1670 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1671 SSA_NAME_DEF_STMT (lhs
) = gs
;
1675 /* Return the first operand on the RHS of assignment statement GS. */
1678 gimple_assign_rhs1 (const_gimple gs
)
1680 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1681 return gimple_op (gs
, 1);
1685 /* Return a pointer to the first operand on the RHS of assignment
1688 static inline tree
*
1689 gimple_assign_rhs1_ptr (const_gimple gs
)
1691 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1692 return gimple_op_ptr (gs
, 1);
1695 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1698 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1700 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1702 gimple_set_op (gs
, 1, rhs
);
1706 /* Return the second operand on the RHS of assignment statement GS.
1707 If GS does not have two operands, NULL is returned instead. */
1710 gimple_assign_rhs2 (const_gimple gs
)
1712 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1714 if (gimple_num_ops (gs
) >= 3)
1715 return gimple_op (gs
, 2);
1721 /* Return a pointer to the second operand on the RHS of assignment
1724 static inline tree
*
1725 gimple_assign_rhs2_ptr (const_gimple gs
)
1727 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1728 return gimple_op_ptr (gs
, 2);
1732 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1735 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1737 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1739 gimple_set_op (gs
, 2, rhs
);
1742 /* Return the third operand on the RHS of assignment statement GS.
1743 If GS does not have two operands, NULL is returned instead. */
1746 gimple_assign_rhs3 (const_gimple gs
)
1748 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1750 if (gimple_num_ops (gs
) >= 4)
1751 return gimple_op (gs
, 3);
1756 /* Return a pointer to the third operand on the RHS of assignment
1759 static inline tree
*
1760 gimple_assign_rhs3_ptr (const_gimple gs
)
1762 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1763 return gimple_op_ptr (gs
, 3);
1767 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1770 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
1772 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1774 gimple_set_op (gs
, 3, rhs
);
1777 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1778 to see only a maximum of two operands. */
1781 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
1784 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
1787 /* Returns true if GS is a nontemporal move. */
1790 gimple_assign_nontemporal_move_p (const_gimple gs
)
1792 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1793 return gs
->gsbase
.nontemporal_move
;
1796 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1799 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
1801 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1802 gs
->gsbase
.nontemporal_move
= nontemporal
;
1806 /* Return the code of the expression computed on the rhs of assignment
1807 statement GS. In case that the RHS is a single object, returns the
1808 tree code of the object. */
1810 static inline enum tree_code
1811 gimple_assign_rhs_code (const_gimple gs
)
1813 enum tree_code code
;
1814 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1816 code
= (enum tree_code
) gs
->gsbase
.subcode
;
1817 /* While we initially set subcode to the TREE_CODE of the rhs for
1818 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1819 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1820 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
1821 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
1827 /* Set CODE to be the code for the expression computed on the RHS of
1831 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
1833 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
1834 s
->gsbase
.subcode
= code
;
1838 /* Return the gimple rhs class of the code of the expression computed on
1839 the rhs of assignment statement GS.
1840 This will never return GIMPLE_INVALID_RHS. */
1842 static inline enum gimple_rhs_class
1843 gimple_assign_rhs_class (const_gimple gs
)
1845 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
1848 /* Return true if GS is an assignment with a singleton RHS, i.e.,
1849 there is no operator associated with the assignment itself.
1850 Unlike gimple_assign_copy_p, this predicate returns true for
1851 any RHS operand, including those that perform an operation
1852 and do not have the semantics of a copy, such as COND_EXPR. */
1855 gimple_assign_single_p (gimple gs
)
1857 return (is_gimple_assign (gs
)
1858 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
1861 /* Return true if GS performs a store to its lhs. */
1864 gimple_store_p (gimple gs
)
1866 tree lhs
= gimple_get_lhs (gs
);
1867 return lhs
&& !is_gimple_reg (lhs
);
1870 /* Return true if GS is an assignment that loads from its rhs1. */
1873 gimple_assign_load_p (gimple gs
)
1876 if (!gimple_assign_single_p (gs
))
1878 rhs
= gimple_assign_rhs1 (gs
);
1879 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
1881 rhs
= get_base_address (rhs
);
1882 return (DECL_P (rhs
)
1883 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
1887 /* Return true if S is a type-cast assignment. */
1890 gimple_assign_cast_p (gimple s
)
1892 if (is_gimple_assign (s
))
1894 enum tree_code sc
= gimple_assign_rhs_code (s
);
1895 return CONVERT_EXPR_CODE_P (sc
)
1896 || sc
== VIEW_CONVERT_EXPR
1897 || sc
== FIX_TRUNC_EXPR
;
1903 /* Return true if S is a clobber statement. */
1906 gimple_clobber_p (gimple s
)
1908 return gimple_assign_single_p (s
)
1909 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
1912 /* Return true if GS is a GIMPLE_CALL. */
1915 is_gimple_call (const_gimple gs
)
1917 return gimple_code (gs
) == GIMPLE_CALL
;
1920 /* Return the LHS of call statement GS. */
1923 gimple_call_lhs (const_gimple gs
)
1925 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1926 return gimple_op (gs
, 0);
1930 /* Return a pointer to the LHS of call statement GS. */
1932 static inline tree
*
1933 gimple_call_lhs_ptr (const_gimple gs
)
1935 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1936 return gimple_op_ptr (gs
, 0);
1940 /* Set LHS to be the LHS operand of call statement GS. */
1943 gimple_call_set_lhs (gimple gs
, tree lhs
)
1945 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1946 gimple_set_op (gs
, 0, lhs
);
1947 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1948 SSA_NAME_DEF_STMT (lhs
) = gs
;
1952 /* Return true if call GS calls an internal-only function, as enumerated
1956 gimple_call_internal_p (const_gimple gs
)
1958 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1959 return (gs
->gsbase
.subcode
& GF_CALL_INTERNAL
) != 0;
1963 /* Return true if call GS is marked as instrumented by
1964 Pointer Bounds Checker. */
1967 gimple_call_with_bounds_p (const_gimple gs
)
1969 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1970 return (gs
->gsbase
.subcode
& GF_CALL_WITH_BOUNDS
) != 0;
1974 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
1975 Pointer Bounds Checker. */
1978 gimple_call_set_with_bounds (gimple gs
, bool with_bounds
)
1980 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1982 gs
->gsbase
.subcode
|= GF_CALL_WITH_BOUNDS
;
1984 gs
->gsbase
.subcode
&= ~GF_CALL_WITH_BOUNDS
;
1988 /* Return the target of internal call GS. */
1990 static inline enum internal_fn
1991 gimple_call_internal_fn (const_gimple gs
)
1993 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
1994 return gs
->gimple_call
.u
.internal_fn
;
1998 /* Return the function type of the function called by GS. */
2001 gimple_call_fntype (const_gimple gs
)
2003 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2004 if (gimple_call_internal_p (gs
))
2006 return gs
->gimple_call
.u
.fntype
;
2009 /* Set the type of the function called by GS to FNTYPE. */
2012 gimple_call_set_fntype (gimple gs
, tree fntype
)
2014 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2015 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2016 gs
->gimple_call
.u
.fntype
= fntype
;
2020 /* Return the tree node representing the function called by call
2024 gimple_call_fn (const_gimple gs
)
2026 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2027 return gimple_op (gs
, 1);
2030 /* Return a pointer to the tree node representing the function called by call
2033 static inline tree
*
2034 gimple_call_fn_ptr (const_gimple gs
)
2036 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2037 return gimple_op_ptr (gs
, 1);
2041 /* Set FN to be the function called by call statement GS. */
2044 gimple_call_set_fn (gimple gs
, tree fn
)
2046 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2047 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2048 gimple_set_op (gs
, 1, fn
);
2052 /* Set FNDECL to be the function called by call statement GS. */
2055 gimple_call_set_fndecl (gimple gs
, tree decl
)
2057 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2058 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2059 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2063 /* Set internal function FN to be the function called by call statement GS. */
2066 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2068 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2069 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2070 gs
->gimple_call
.u
.internal_fn
= fn
;
2074 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2075 Otherwise return NULL. This function is analogous to
2076 get_callee_fndecl in tree land. */
2079 gimple_call_fndecl (const_gimple gs
)
2081 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2085 /* Return the type returned by call statement GS. */
2088 gimple_call_return_type (const_gimple gs
)
2090 tree type
= gimple_call_fntype (gs
);
2092 if (type
== NULL_TREE
)
2093 return TREE_TYPE (gimple_call_lhs (gs
));
2095 /* The type returned by a function is the type of its
2097 return TREE_TYPE (type
);
2101 /* Return the static chain for call statement GS. */
2104 gimple_call_chain (const_gimple gs
)
2106 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2107 return gimple_op (gs
, 2);
2111 /* Return a pointer to the static chain for call statement GS. */
2113 static inline tree
*
2114 gimple_call_chain_ptr (const_gimple gs
)
2116 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2117 return gimple_op_ptr (gs
, 2);
2120 /* Set CHAIN to be the static chain for call statement GS. */
2123 gimple_call_set_chain (gimple gs
, tree chain
)
2125 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2127 gimple_set_op (gs
, 2, chain
);
2131 /* Return the number of arguments used by call statement GS. */
2133 static inline unsigned
2134 gimple_call_num_args (const_gimple gs
)
2137 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2138 num_ops
= gimple_num_ops (gs
);
2143 /* Return the argument at position INDEX for call statement GS. */
2146 gimple_call_arg (const_gimple gs
, unsigned index
)
2148 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2149 return gimple_op (gs
, index
+ 3);
2153 /* Return a pointer to the argument at position INDEX for call
2156 static inline tree
*
2157 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2159 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2160 return gimple_op_ptr (gs
, index
+ 3);
2164 /* Set ARG to be the argument at position INDEX for call statement GS. */
2167 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2169 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2170 gimple_set_op (gs
, index
+ 3, arg
);
2174 /* If TAIL_P is true, mark call statement S as being a tail call
2175 (i.e., a call just before the exit of a function). These calls are
2176 candidate for tail call optimization. */
2179 gimple_call_set_tail (gimple s
, bool tail_p
)
2181 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2183 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2185 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2189 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2192 gimple_call_tail_p (gimple s
)
2194 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2195 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2199 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2200 slot optimization. This transformation uses the target of the call
2201 expansion as the return slot for calls that return in memory. */
2204 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2206 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2207 if (return_slot_opt_p
)
2208 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2210 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2214 /* Return true if S is marked for return slot optimization. */
2217 gimple_call_return_slot_opt_p (gimple s
)
2219 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2220 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2224 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2225 thunk to the thunked-to function. */
2228 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2230 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2232 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2234 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2238 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2241 gimple_call_from_thunk_p (gimple s
)
2243 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2244 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2248 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2249 argument pack in its argument list. */
2252 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2254 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2255 if (pass_arg_pack_p
)
2256 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2258 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2262 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2263 argument pack in its argument list. */
2266 gimple_call_va_arg_pack_p (gimple s
)
2268 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2269 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2273 /* Return true if S is a noreturn call. */
2276 gimple_call_noreturn_p (gimple s
)
2278 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2279 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2283 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2284 even if the called function can throw in other cases. */
2287 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2289 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2291 s
->gsbase
.subcode
|= GF_CALL_NOTHROW
;
2293 s
->gsbase
.subcode
&= ~GF_CALL_NOTHROW
;
2296 /* Return true if S is a nothrow call. */
2299 gimple_call_nothrow_p (gimple s
)
2301 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2302 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2305 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2306 is known to be emitted for VLA objects. Those are wrapped by
2307 stack_save/stack_restore calls and hence can't lead to unbounded
2308 stack growth even when they occur in loops. */
2311 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2313 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2315 s
->gsbase
.subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2317 s
->gsbase
.subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2320 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2323 gimple_call_alloca_for_var_p (gimple s
)
2325 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2326 return (s
->gsbase
.subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2329 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2332 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2334 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2335 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2336 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2340 /* Return a pointer to the points-to solution for the set of call-used
2341 variables of the call CALL. */
2343 static inline struct pt_solution
*
2344 gimple_call_use_set (gimple call
)
2346 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2347 return &call
->gimple_call
.call_used
;
2351 /* Return a pointer to the points-to solution for the set of call-used
2352 variables of the call CALL. */
2354 static inline struct pt_solution
*
2355 gimple_call_clobber_set (gimple call
)
2357 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2358 return &call
->gimple_call
.call_clobbered
;
2362 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2366 gimple_has_lhs (gimple stmt
)
2368 return (is_gimple_assign (stmt
)
2369 || (is_gimple_call (stmt
)
2370 && gimple_call_lhs (stmt
) != NULL_TREE
));
2374 /* Return the code of the predicate computed by conditional statement GS. */
2376 static inline enum tree_code
2377 gimple_cond_code (const_gimple gs
)
2379 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2380 return (enum tree_code
) gs
->gsbase
.subcode
;
2384 /* Set CODE to be the predicate code for the conditional statement GS. */
2387 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2389 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2390 gs
->gsbase
.subcode
= code
;
2394 /* Return the LHS of the predicate computed by conditional statement GS. */
2397 gimple_cond_lhs (const_gimple gs
)
2399 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2400 return gimple_op (gs
, 0);
2403 /* Return the pointer to the LHS of the predicate computed by conditional
2406 static inline tree
*
2407 gimple_cond_lhs_ptr (const_gimple gs
)
2409 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2410 return gimple_op_ptr (gs
, 0);
2413 /* Set LHS to be the LHS operand of the predicate computed by
2414 conditional statement GS. */
2417 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2419 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2420 gimple_set_op (gs
, 0, lhs
);
2424 /* Return the RHS operand of the predicate computed by conditional GS. */
2427 gimple_cond_rhs (const_gimple gs
)
2429 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2430 return gimple_op (gs
, 1);
2433 /* Return the pointer to the RHS operand of the predicate computed by
2436 static inline tree
*
2437 gimple_cond_rhs_ptr (const_gimple gs
)
2439 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2440 return gimple_op_ptr (gs
, 1);
2444 /* Set RHS to be the RHS operand of the predicate computed by
2445 conditional statement GS. */
2448 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2450 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2451 gimple_set_op (gs
, 1, rhs
);
2455 /* Return the label used by conditional statement GS when its
2456 predicate evaluates to true. */
2459 gimple_cond_true_label (const_gimple gs
)
2461 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2462 return gimple_op (gs
, 2);
2466 /* Set LABEL to be the label used by conditional statement GS when its
2467 predicate evaluates to true. */
2470 gimple_cond_set_true_label (gimple gs
, tree label
)
2472 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2473 gimple_set_op (gs
, 2, label
);
2477 /* Set LABEL to be the label used by conditional statement GS when its
2478 predicate evaluates to false. */
2481 gimple_cond_set_false_label (gimple gs
, tree label
)
2483 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2484 gimple_set_op (gs
, 3, label
);
2488 /* Return the label used by conditional statement GS when its
2489 predicate evaluates to false. */
2492 gimple_cond_false_label (const_gimple gs
)
2494 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2495 return gimple_op (gs
, 3);
2499 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2502 gimple_cond_make_false (gimple gs
)
2504 gimple_cond_set_lhs (gs
, boolean_true_node
);
2505 gimple_cond_set_rhs (gs
, boolean_false_node
);
2506 gs
->gsbase
.subcode
= EQ_EXPR
;
2510 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2513 gimple_cond_make_true (gimple gs
)
2515 gimple_cond_set_lhs (gs
, boolean_true_node
);
2516 gimple_cond_set_rhs (gs
, boolean_true_node
);
2517 gs
->gsbase
.subcode
= EQ_EXPR
;
2520 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2521 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2524 gimple_cond_true_p (const_gimple gs
)
2526 tree lhs
= gimple_cond_lhs (gs
);
2527 tree rhs
= gimple_cond_rhs (gs
);
2528 enum tree_code code
= gimple_cond_code (gs
);
2530 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2533 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2536 if (code
== NE_EXPR
&& lhs
!= rhs
)
2539 if (code
== EQ_EXPR
&& lhs
== rhs
)
2545 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2546 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2549 gimple_cond_false_p (const_gimple gs
)
2551 tree lhs
= gimple_cond_lhs (gs
);
2552 tree rhs
= gimple_cond_rhs (gs
);
2553 enum tree_code code
= gimple_cond_code (gs
);
2555 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2558 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2561 if (code
== NE_EXPR
&& lhs
== rhs
)
2564 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2570 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2573 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2575 gimple_cond_set_code (stmt
, code
);
2576 gimple_cond_set_lhs (stmt
, lhs
);
2577 gimple_cond_set_rhs (stmt
, rhs
);
2580 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2583 gimple_label_label (const_gimple gs
)
2585 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2586 return gimple_op (gs
, 0);
2590 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2594 gimple_label_set_label (gimple gs
, tree label
)
2596 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2597 gimple_set_op (gs
, 0, label
);
2601 /* Return the destination of the unconditional jump GS. */
2604 gimple_goto_dest (const_gimple gs
)
2606 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2607 return gimple_op (gs
, 0);
2611 /* Set DEST to be the destination of the unconditonal jump GS. */
2614 gimple_goto_set_dest (gimple gs
, tree dest
)
2616 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2617 gimple_set_op (gs
, 0, dest
);
2621 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2624 gimple_bind_vars (const_gimple gs
)
2626 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2627 return gs
->gimple_bind
.vars
;
2631 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2635 gimple_bind_set_vars (gimple gs
, tree vars
)
2637 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2638 gs
->gimple_bind
.vars
= vars
;
2642 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2646 gimple_bind_append_vars (gimple gs
, tree vars
)
2648 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2649 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2653 static inline gimple_seq
*
2654 gimple_bind_body_ptr (gimple gs
)
2656 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2657 return &gs
->gimple_bind
.body
;
2660 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2662 static inline gimple_seq
2663 gimple_bind_body (gimple gs
)
2665 return *gimple_bind_body_ptr (gs
);
2669 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2673 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2675 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2676 gs
->gimple_bind
.body
= seq
;
2680 /* Append a statement to the end of a GIMPLE_BIND's body. */
2683 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2685 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2686 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2690 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2693 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2695 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2696 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2700 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2701 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2704 gimple_bind_block (const_gimple gs
)
2706 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2707 return gs
->gimple_bind
.block
;
2711 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2715 gimple_bind_set_block (gimple gs
, tree block
)
2717 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2718 gcc_gimple_checking_assert (block
== NULL_TREE
2719 || TREE_CODE (block
) == BLOCK
);
2720 gs
->gimple_bind
.block
= block
;
2724 /* Return the number of input operands for GIMPLE_ASM GS. */
2726 static inline unsigned
2727 gimple_asm_ninputs (const_gimple gs
)
2729 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2730 return gs
->gimple_asm
.ni
;
2734 /* Return the number of output operands for GIMPLE_ASM GS. */
2736 static inline unsigned
2737 gimple_asm_noutputs (const_gimple gs
)
2739 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2740 return gs
->gimple_asm
.no
;
2744 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2746 static inline unsigned
2747 gimple_asm_nclobbers (const_gimple gs
)
2749 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2750 return gs
->gimple_asm
.nc
;
2753 /* Return the number of label operands for GIMPLE_ASM GS. */
2755 static inline unsigned
2756 gimple_asm_nlabels (const_gimple gs
)
2758 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2759 return gs
->gimple_asm
.nl
;
2762 /* Return input operand INDEX of GIMPLE_ASM GS. */
2765 gimple_asm_input_op (const_gimple gs
, unsigned index
)
2767 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2768 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2769 return gimple_op (gs
, index
+ gs
->gimple_asm
.no
);
2772 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2774 static inline tree
*
2775 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
2777 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2778 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2779 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.no
);
2783 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2786 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
2788 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2789 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
2790 && TREE_CODE (in_op
) == TREE_LIST
);
2791 gimple_set_op (gs
, index
+ gs
->gimple_asm
.no
, in_op
);
2795 /* Return output operand INDEX of GIMPLE_ASM GS. */
2798 gimple_asm_output_op (const_gimple gs
, unsigned index
)
2800 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2801 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
2802 return gimple_op (gs
, index
);
2805 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2807 static inline tree
*
2808 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
2810 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2811 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
2812 return gimple_op_ptr (gs
, index
);
2816 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2819 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
2821 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2822 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
2823 && TREE_CODE (out_op
) == TREE_LIST
);
2824 gimple_set_op (gs
, index
, out_op
);
2828 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2831 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
2833 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2834 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
);
2835 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
2839 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2842 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
2844 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2845 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
2846 && TREE_CODE (clobber_op
) == TREE_LIST
);
2847 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
2850 /* Return label operand INDEX of GIMPLE_ASM GS. */
2853 gimple_asm_label_op (const_gimple gs
, unsigned index
)
2855 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2856 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
);
2857 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
2860 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2863 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
2865 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2866 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
2867 && TREE_CODE (label_op
) == TREE_LIST
);
2868 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
2871 /* Return the string representing the assembly instruction in
2874 static inline const char *
2875 gimple_asm_string (const_gimple gs
)
2877 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2878 return gs
->gimple_asm
.string
;
2882 /* Return true if GS is an asm statement marked volatile. */
2885 gimple_asm_volatile_p (const_gimple gs
)
2887 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2888 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
2892 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2895 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
2897 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2899 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
2901 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
2905 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2908 gimple_asm_set_input (gimple gs
, bool input_p
)
2910 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2912 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
2914 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
2918 /* Return true if asm GS is an ASM_INPUT. */
2921 gimple_asm_input_p (const_gimple gs
)
2923 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2924 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
2928 /* Return the types handled by GIMPLE_CATCH statement GS. */
2931 gimple_catch_types (const_gimple gs
)
2933 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2934 return gs
->gimple_catch
.types
;
2938 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2940 static inline tree
*
2941 gimple_catch_types_ptr (gimple gs
)
2943 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2944 return &gs
->gimple_catch
.types
;
2948 /* Return a pointer to the GIMPLE sequence representing the body of
2949 the handler of GIMPLE_CATCH statement GS. */
2951 static inline gimple_seq
*
2952 gimple_catch_handler_ptr (gimple gs
)
2954 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2955 return &gs
->gimple_catch
.handler
;
2959 /* Return the GIMPLE sequence representing the body of the handler of
2960 GIMPLE_CATCH statement GS. */
2962 static inline gimple_seq
2963 gimple_catch_handler (gimple gs
)
2965 return *gimple_catch_handler_ptr (gs
);
2969 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2972 gimple_catch_set_types (gimple gs
, tree t
)
2974 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2975 gs
->gimple_catch
.types
= t
;
2979 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2982 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
2984 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2985 gs
->gimple_catch
.handler
= handler
;
2989 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2992 gimple_eh_filter_types (const_gimple gs
)
2994 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
2995 return gs
->gimple_eh_filter
.types
;
2999 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3002 static inline tree
*
3003 gimple_eh_filter_types_ptr (gimple gs
)
3005 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3006 return &gs
->gimple_eh_filter
.types
;
3010 /* Return a pointer to the sequence of statement to execute when
3011 GIMPLE_EH_FILTER statement fails. */
3013 static inline gimple_seq
*
3014 gimple_eh_filter_failure_ptr (gimple gs
)
3016 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3017 return &gs
->gimple_eh_filter
.failure
;
3021 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3024 static inline gimple_seq
3025 gimple_eh_filter_failure (gimple gs
)
3027 return *gimple_eh_filter_failure_ptr (gs
);
3031 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3034 gimple_eh_filter_set_types (gimple gs
, tree types
)
3036 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3037 gs
->gimple_eh_filter
.types
= types
;
3041 /* Set FAILURE to be the sequence of statements to execute on failure
3042 for GIMPLE_EH_FILTER GS. */
3045 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3047 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3048 gs
->gimple_eh_filter
.failure
= failure
;
3051 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3054 gimple_eh_must_not_throw_fndecl (gimple gs
)
3056 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3057 return gs
->gimple_eh_mnt
.fndecl
;
3060 /* Set the function decl to be called by GS to DECL. */
3063 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3065 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3066 gs
->gimple_eh_mnt
.fndecl
= decl
;
3069 /* GIMPLE_EH_ELSE accessors. */
3071 static inline gimple_seq
*
3072 gimple_eh_else_n_body_ptr (gimple gs
)
3074 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3075 return &gs
->gimple_eh_else
.n_body
;
3078 static inline gimple_seq
3079 gimple_eh_else_n_body (gimple gs
)
3081 return *gimple_eh_else_n_body_ptr (gs
);
3084 static inline gimple_seq
*
3085 gimple_eh_else_e_body_ptr (gimple gs
)
3087 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3088 return &gs
->gimple_eh_else
.e_body
;
3091 static inline gimple_seq
3092 gimple_eh_else_e_body (gimple gs
)
3094 return *gimple_eh_else_e_body_ptr (gs
);
3098 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3100 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3101 gs
->gimple_eh_else
.n_body
= seq
;
3105 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3107 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3108 gs
->gimple_eh_else
.e_body
= seq
;
3111 /* GIMPLE_TRY accessors. */
3113 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3114 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3116 static inline enum gimple_try_flags
3117 gimple_try_kind (const_gimple gs
)
3119 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3120 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
3124 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3127 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3129 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3130 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3131 || kind
== GIMPLE_TRY_FINALLY
);
3132 if (gimple_try_kind (gs
) != kind
)
3133 gs
->gsbase
.subcode
= (unsigned int) kind
;
3137 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3140 gimple_try_catch_is_cleanup (const_gimple gs
)
3142 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3143 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3147 /* Return a pointer to the sequence of statements used as the
3148 body for GIMPLE_TRY GS. */
3150 static inline gimple_seq
*
3151 gimple_try_eval_ptr (gimple gs
)
3153 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3154 return &gs
->gimple_try
.eval
;
3158 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3160 static inline gimple_seq
3161 gimple_try_eval (gimple gs
)
3163 return *gimple_try_eval_ptr (gs
);
3167 /* Return a pointer to the sequence of statements used as the cleanup body for
3170 static inline gimple_seq
*
3171 gimple_try_cleanup_ptr (gimple gs
)
3173 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3174 return &gs
->gimple_try
.cleanup
;
3178 /* Return the sequence of statements used as the cleanup body for
3181 static inline gimple_seq
3182 gimple_try_cleanup (gimple gs
)
3184 return *gimple_try_cleanup_ptr (gs
);
3188 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3191 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3193 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3194 if (catch_is_cleanup
)
3195 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3197 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3201 /* Set EVAL to be the sequence of statements to use as the body for
3205 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3207 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3208 gs
->gimple_try
.eval
= eval
;
3212 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3213 body for GIMPLE_TRY GS. */
3216 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3218 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3219 gs
->gimple_try
.cleanup
= cleanup
;
3223 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3225 static inline gimple_seq
*
3226 gimple_wce_cleanup_ptr (gimple gs
)
3228 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3229 return &gs
->gimple_wce
.cleanup
;
3233 /* Return the cleanup sequence for cleanup statement GS. */
3235 static inline gimple_seq
3236 gimple_wce_cleanup (gimple gs
)
3238 return *gimple_wce_cleanup_ptr (gs
);
3242 /* Set CLEANUP to be the cleanup sequence for GS. */
3245 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3247 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3248 gs
->gimple_wce
.cleanup
= cleanup
;
3252 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3255 gimple_wce_cleanup_eh_only (const_gimple gs
)
3257 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3258 return gs
->gsbase
.subcode
!= 0;
3262 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3265 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3267 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3268 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3272 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3274 static inline unsigned
3275 gimple_phi_capacity (const_gimple gs
)
3277 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3278 return gs
->gimple_phi
.capacity
;
3282 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3283 be exactly the number of incoming edges for the basic block holding
3286 static inline unsigned
3287 gimple_phi_num_args (const_gimple gs
)
3289 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3290 return gs
->gimple_phi
.nargs
;
3294 /* Return the SSA name created by GIMPLE_PHI GS. */
3297 gimple_phi_result (const_gimple gs
)
3299 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3300 return gs
->gimple_phi
.result
;
3303 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3305 static inline tree
*
3306 gimple_phi_result_ptr (gimple gs
)
3308 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3309 return &gs
->gimple_phi
.result
;
3312 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3315 gimple_phi_set_result (gimple gs
, tree result
)
3317 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3318 gs
->gimple_phi
.result
= result
;
3319 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3320 SSA_NAME_DEF_STMT (result
) = gs
;
3324 /* Return the PHI argument corresponding to incoming edge INDEX for
3327 static inline struct phi_arg_d
*
3328 gimple_phi_arg (gimple gs
, unsigned index
)
3330 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3331 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.capacity
);
3332 return &(gs
->gimple_phi
.args
[index
]);
3335 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3336 for GIMPLE_PHI GS. */
3339 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3341 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3342 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.nargs
);
3343 gs
->gimple_phi
.args
[index
] = *phiarg
;
3346 /* Return the PHI nodes for basic block BB, or NULL if there are no
3349 static inline gimple_seq
3350 phi_nodes (const_basic_block bb
)
3352 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3353 return bb
->il
.gimple
.phi_nodes
;
3356 /* Return a pointer to the PHI nodes for basic block BB. */
3358 static inline gimple_seq
*
3359 phi_nodes_ptr (basic_block bb
)
3361 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3362 return &bb
->il
.gimple
.phi_nodes
;
3365 /* Return the tree operand for argument I of PHI node GS. */
3368 gimple_phi_arg_def (gimple gs
, size_t index
)
3370 return gimple_phi_arg (gs
, index
)->def
;
3374 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3376 static inline tree
*
3377 gimple_phi_arg_def_ptr (gimple gs
, size_t index
)
3379 return &gimple_phi_arg (gs
, index
)->def
;
3382 /* Return the edge associated with argument I of phi node GS. */
3385 gimple_phi_arg_edge (gimple gs
, size_t i
)
3387 return EDGE_PRED (gimple_bb (gs
), i
);
3390 /* Return the source location of gimple argument I of phi node GS. */
3392 static inline source_location
3393 gimple_phi_arg_location (gimple gs
, size_t i
)
3395 return gimple_phi_arg (gs
, i
)->locus
;
3398 /* Return the source location of the argument on edge E of phi node GS. */
3400 static inline source_location
3401 gimple_phi_arg_location_from_edge (gimple gs
, edge e
)
3403 return gimple_phi_arg (gs
, e
->dest_idx
)->locus
;
3406 /* Set the source location of gimple argument I of phi node GS to LOC. */
3409 gimple_phi_arg_set_location (gimple gs
, size_t i
, source_location loc
)
3411 gimple_phi_arg (gs
, i
)->locus
= loc
;
3414 /* Return TRUE if argument I of phi node GS has a location record. */
3417 gimple_phi_arg_has_location (gimple gs
, size_t i
)
3419 return gimple_phi_arg_location (gs
, i
) != UNKNOWN_LOCATION
;
3423 /* Return the region number for GIMPLE_RESX GS. */
3426 gimple_resx_region (const_gimple gs
)
3428 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3429 return gs
->gimple_eh_ctrl
.region
;
3432 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3435 gimple_resx_set_region (gimple gs
, int region
)
3437 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3438 gs
->gimple_eh_ctrl
.region
= region
;
3441 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3444 gimple_eh_dispatch_region (const_gimple gs
)
3446 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3447 return gs
->gimple_eh_ctrl
.region
;
3450 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3453 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3455 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3456 gs
->gimple_eh_ctrl
.region
= region
;
3459 /* Return the number of labels associated with the switch statement GS. */
3461 static inline unsigned
3462 gimple_switch_num_labels (const_gimple gs
)
3465 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3466 num_ops
= gimple_num_ops (gs
);
3467 gcc_gimple_checking_assert (num_ops
> 1);
3472 /* Set NLABELS to be the number of labels for the switch statement GS. */
3475 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3477 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3478 gimple_set_num_ops (g
, nlabels
+ 1);
3482 /* Return the index variable used by the switch statement GS. */
3485 gimple_switch_index (const_gimple gs
)
3487 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3488 return gimple_op (gs
, 0);
3492 /* Return a pointer to the index variable for the switch statement GS. */
3494 static inline tree
*
3495 gimple_switch_index_ptr (const_gimple gs
)
3497 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3498 return gimple_op_ptr (gs
, 0);
3502 /* Set INDEX to be the index variable for switch statement GS. */
3505 gimple_switch_set_index (gimple gs
, tree index
)
3507 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3508 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3509 gimple_set_op (gs
, 0, index
);
3513 /* Return the label numbered INDEX. The default label is 0, followed by any
3514 labels in a switch statement. */
3517 gimple_switch_label (const_gimple gs
, unsigned index
)
3519 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3520 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
3521 return gimple_op (gs
, index
+ 1);
3524 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3527 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3529 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3530 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
3531 && (label
== NULL_TREE
3532 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
3533 gimple_set_op (gs
, index
+ 1, label
);
3536 /* Return the default label for a switch statement. */
3539 gimple_switch_default_label (const_gimple gs
)
3541 tree label
= gimple_switch_label (gs
, 0);
3542 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3546 /* Set the default label for a switch statement. */
3549 gimple_switch_set_default_label (gimple gs
, tree label
)
3551 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3552 gimple_switch_set_label (gs
, 0, label
);
3555 /* Return true if GS is a GIMPLE_DEBUG statement. */
3558 is_gimple_debug (const_gimple gs
)
3560 return gimple_code (gs
) == GIMPLE_DEBUG
;
3563 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3566 gimple_debug_bind_p (const_gimple s
)
3568 if (is_gimple_debug (s
))
3569 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3574 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3577 gimple_debug_bind_get_var (gimple dbg
)
3579 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3580 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3581 return gimple_op (dbg
, 0);
3584 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3588 gimple_debug_bind_get_value (gimple dbg
)
3590 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3591 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3592 return gimple_op (dbg
, 1);
3595 /* Return a pointer to the value bound to the variable in a
3596 GIMPLE_DEBUG bind statement. */
3598 static inline tree
*
3599 gimple_debug_bind_get_value_ptr (gimple dbg
)
3601 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3602 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3603 return gimple_op_ptr (dbg
, 1);
3606 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3609 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3611 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3612 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3613 gimple_set_op (dbg
, 0, var
);
3616 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3620 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3622 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3623 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3624 gimple_set_op (dbg
, 1, value
);
3627 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3629 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3631 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3635 gimple_debug_bind_reset_value (gimple dbg
)
3637 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3638 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3639 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3642 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3646 gimple_debug_bind_has_value_p (gimple dbg
)
3648 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3649 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3650 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3653 #undef GIMPLE_DEBUG_BIND_NOVALUE
3655 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3658 gimple_debug_source_bind_p (const_gimple s
)
3660 if (is_gimple_debug (s
))
3661 return s
->gsbase
.subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
3666 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3669 gimple_debug_source_bind_get_var (gimple dbg
)
3671 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3672 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3673 return gimple_op (dbg
, 0);
3676 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3680 gimple_debug_source_bind_get_value (gimple dbg
)
3682 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3683 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3684 return gimple_op (dbg
, 1);
3687 /* Return a pointer to the value bound to the variable in a
3688 GIMPLE_DEBUG source bind statement. */
3690 static inline tree
*
3691 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
3693 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3694 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3695 return gimple_op_ptr (dbg
, 1);
3698 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3701 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
3703 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3704 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3705 gimple_set_op (dbg
, 0, var
);
3708 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3712 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
3714 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3715 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3716 gimple_set_op (dbg
, 1, value
);
3719 /* Return the line number for EXPR, or return -1 if we have no line
3720 number information for it. */
3722 get_lineno (const_gimple stmt
)
3729 loc
= gimple_location (stmt
);
3730 if (loc
== UNKNOWN_LOCATION
)
3733 return LOCATION_LINE (loc
);
3736 /* Return a pointer to the body for the OMP statement GS. */
3738 static inline gimple_seq
*
3739 gimple_omp_body_ptr (gimple gs
)
3741 return &gs
->omp
.body
;
3744 /* Return the body for the OMP statement GS. */
3746 static inline gimple_seq
3747 gimple_omp_body (gimple gs
)
3749 return *gimple_omp_body_ptr (gs
);
3752 /* Set BODY to be the body for the OMP statement GS. */
3755 gimple_omp_set_body (gimple gs
, gimple_seq body
)
3757 gs
->omp
.body
= body
;
3761 /* Return the name associated with OMP_CRITICAL statement GS. */
3764 gimple_omp_critical_name (const_gimple gs
)
3766 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3767 return gs
->gimple_omp_critical
.name
;
3771 /* Return a pointer to the name associated with OMP critical statement GS. */
3773 static inline tree
*
3774 gimple_omp_critical_name_ptr (gimple gs
)
3776 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3777 return &gs
->gimple_omp_critical
.name
;
3781 /* Set NAME to be the name associated with OMP critical statement GS. */
3784 gimple_omp_critical_set_name (gimple gs
, tree name
)
3786 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3787 gs
->gimple_omp_critical
.name
= name
;
3791 /* Return the kind of OMP for statemement. */
3794 gimple_omp_for_kind (const_gimple g
)
3796 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3797 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
3801 /* Set the OMP for kind. */
3804 gimple_omp_for_set_kind (gimple g
, int kind
)
3806 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3807 g
->gsbase
.subcode
= (g
->gsbase
.subcode
& ~GF_OMP_FOR_KIND_MASK
)
3808 | (kind
& GF_OMP_FOR_KIND_MASK
);
3812 /* Return true if OMP for statement G has the
3813 GF_OMP_FOR_COMBINED flag set. */
3816 gimple_omp_for_combined_p (const_gimple g
)
3818 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3819 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
3823 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
3824 value of COMBINED_P. */
3827 gimple_omp_for_set_combined_p (gimple g
, bool combined_p
)
3829 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3831 g
->gsbase
.subcode
|= GF_OMP_FOR_COMBINED
;
3833 g
->gsbase
.subcode
&= ~GF_OMP_FOR_COMBINED
;
3837 /* Return true if OMP for statement G has the
3838 GF_OMP_FOR_COMBINED_INTO flag set. */
3841 gimple_omp_for_combined_into_p (const_gimple g
)
3843 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3844 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
3848 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
3849 value of COMBINED_P. */
3852 gimple_omp_for_set_combined_into_p (gimple g
, bool combined_p
)
3854 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
3856 g
->gsbase
.subcode
|= GF_OMP_FOR_COMBINED_INTO
;
3858 g
->gsbase
.subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
3862 /* Return the clauses associated with OMP_FOR GS. */
3865 gimple_omp_for_clauses (const_gimple gs
)
3867 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3868 return gs
->gimple_omp_for
.clauses
;
3872 /* Return a pointer to the OMP_FOR GS. */
3874 static inline tree
*
3875 gimple_omp_for_clauses_ptr (gimple gs
)
3877 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3878 return &gs
->gimple_omp_for
.clauses
;
3882 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3885 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
3887 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3888 gs
->gimple_omp_for
.clauses
= clauses
;
3892 /* Get the collapse count of OMP_FOR GS. */
3894 static inline size_t
3895 gimple_omp_for_collapse (gimple gs
)
3897 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3898 return gs
->gimple_omp_for
.collapse
;
3902 /* Return the index variable for OMP_FOR GS. */
3905 gimple_omp_for_index (const_gimple gs
, size_t i
)
3907 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3908 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3909 return gs
->gimple_omp_for
.iter
[i
].index
;
3913 /* Return a pointer to the index variable for OMP_FOR GS. */
3915 static inline tree
*
3916 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
3918 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3919 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3920 return &gs
->gimple_omp_for
.iter
[i
].index
;
3924 /* Set INDEX to be the index variable for OMP_FOR GS. */
3927 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
3929 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3930 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3931 gs
->gimple_omp_for
.iter
[i
].index
= index
;
3935 /* Return the initial value for OMP_FOR GS. */
3938 gimple_omp_for_initial (const_gimple gs
, size_t i
)
3940 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3941 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3942 return gs
->gimple_omp_for
.iter
[i
].initial
;
3946 /* Return a pointer to the initial value for OMP_FOR GS. */
3948 static inline tree
*
3949 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
3951 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3952 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3953 return &gs
->gimple_omp_for
.iter
[i
].initial
;
3957 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3960 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
3962 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3963 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3964 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
3968 /* Return the final value for OMP_FOR GS. */
3971 gimple_omp_for_final (const_gimple gs
, size_t i
)
3973 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3974 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3975 return gs
->gimple_omp_for
.iter
[i
].final
;
3979 /* Return a pointer to the final value for OMP_FOR GS. */
3981 static inline tree
*
3982 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
3984 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3985 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3986 return &gs
->gimple_omp_for
.iter
[i
].final
;
3990 /* Set FINAL to be the final value for OMP_FOR GS. */
3993 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
3995 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3996 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3997 gs
->gimple_omp_for
.iter
[i
].final
= final
;
4001 /* Return the increment value for OMP_FOR GS. */
4004 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4006 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4007 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4008 return gs
->gimple_omp_for
.iter
[i
].incr
;
4012 /* Return a pointer to the increment value for OMP_FOR GS. */
4014 static inline tree
*
4015 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4017 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4018 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4019 return &gs
->gimple_omp_for
.iter
[i
].incr
;
4023 /* Set INCR to be the increment value for OMP_FOR GS. */
4026 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4028 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4029 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4030 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
4034 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4035 statement GS starts. */
4037 static inline gimple_seq
*
4038 gimple_omp_for_pre_body_ptr (gimple gs
)
4040 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4041 return &gs
->gimple_omp_for
.pre_body
;
4045 /* Return the sequence of statements to execute before the OMP_FOR
4046 statement GS starts. */
4048 static inline gimple_seq
4049 gimple_omp_for_pre_body (gimple gs
)
4051 return *gimple_omp_for_pre_body_ptr (gs
);
4055 /* Set PRE_BODY to be the sequence of statements to execute before the
4056 OMP_FOR statement GS starts. */
4059 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4061 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4062 gs
->gimple_omp_for
.pre_body
= pre_body
;
4066 /* Return the clauses associated with OMP_PARALLEL GS. */
4069 gimple_omp_parallel_clauses (const_gimple gs
)
4071 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4072 return gs
->gimple_omp_parallel
.clauses
;
4076 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4078 static inline tree
*
4079 gimple_omp_parallel_clauses_ptr (gimple gs
)
4081 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4082 return &gs
->gimple_omp_parallel
.clauses
;
4086 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4090 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4092 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4093 gs
->gimple_omp_parallel
.clauses
= clauses
;
4097 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4100 gimple_omp_parallel_child_fn (const_gimple gs
)
4102 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4103 return gs
->gimple_omp_parallel
.child_fn
;
4106 /* Return a pointer to the child function used to hold the body of
4109 static inline tree
*
4110 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4112 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4113 return &gs
->gimple_omp_parallel
.child_fn
;
4117 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4120 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4122 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4123 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4127 /* Return the artificial argument used to send variables and values
4128 from the parent to the children threads in OMP_PARALLEL GS. */
4131 gimple_omp_parallel_data_arg (const_gimple gs
)
4133 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4134 return gs
->gimple_omp_parallel
.data_arg
;
4138 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4140 static inline tree
*
4141 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4143 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4144 return &gs
->gimple_omp_parallel
.data_arg
;
4148 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4151 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4153 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4154 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4158 /* Return the clauses associated with OMP_TASK GS. */
4161 gimple_omp_task_clauses (const_gimple gs
)
4163 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4164 return gs
->gimple_omp_parallel
.clauses
;
4168 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4170 static inline tree
*
4171 gimple_omp_task_clauses_ptr (gimple gs
)
4173 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4174 return &gs
->gimple_omp_parallel
.clauses
;
4178 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4182 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4184 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4185 gs
->gimple_omp_parallel
.clauses
= clauses
;
4189 /* Return the child function used to hold the body of OMP_TASK GS. */
4192 gimple_omp_task_child_fn (const_gimple gs
)
4194 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4195 return gs
->gimple_omp_parallel
.child_fn
;
4198 /* Return a pointer to the child function used to hold the body of
4201 static inline tree
*
4202 gimple_omp_task_child_fn_ptr (gimple gs
)
4204 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4205 return &gs
->gimple_omp_parallel
.child_fn
;
4209 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4212 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4214 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4215 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4219 /* Return the artificial argument used to send variables and values
4220 from the parent to the children threads in OMP_TASK GS. */
4223 gimple_omp_task_data_arg (const_gimple gs
)
4225 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4226 return gs
->gimple_omp_parallel
.data_arg
;
4230 /* Return a pointer to the data argument for OMP_TASK GS. */
4232 static inline tree
*
4233 gimple_omp_task_data_arg_ptr (gimple gs
)
4235 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4236 return &gs
->gimple_omp_parallel
.data_arg
;
4240 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4243 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4245 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4246 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4250 /* Return the clauses associated with OMP_TASK GS. */
4253 gimple_omp_taskreg_clauses (const_gimple gs
)
4255 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4256 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4257 return gs
->gimple_omp_parallel
.clauses
;
4261 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4263 static inline tree
*
4264 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4266 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4267 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4268 return &gs
->gimple_omp_parallel
.clauses
;
4272 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4276 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4278 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4279 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4280 gs
->gimple_omp_parallel
.clauses
= clauses
;
4284 /* Return the child function used to hold the body of OMP_TASK GS. */
4287 gimple_omp_taskreg_child_fn (const_gimple gs
)
4289 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4290 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4291 return gs
->gimple_omp_parallel
.child_fn
;
4294 /* Return a pointer to the child function used to hold the body of
4297 static inline tree
*
4298 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4300 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4301 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4302 return &gs
->gimple_omp_parallel
.child_fn
;
4306 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4309 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4311 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4312 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4313 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4317 /* Return the artificial argument used to send variables and values
4318 from the parent to the children threads in OMP_TASK GS. */
4321 gimple_omp_taskreg_data_arg (const_gimple gs
)
4323 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4324 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4325 return gs
->gimple_omp_parallel
.data_arg
;
4329 /* Return a pointer to the data argument for OMP_TASK GS. */
4331 static inline tree
*
4332 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4334 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4335 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4336 return &gs
->gimple_omp_parallel
.data_arg
;
4340 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4343 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4345 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4346 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4347 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4351 /* Return the copy function used to hold the body of OMP_TASK GS. */
4354 gimple_omp_task_copy_fn (const_gimple gs
)
4356 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4357 return gs
->gimple_omp_task
.copy_fn
;
4360 /* Return a pointer to the copy function used to hold the body of
4363 static inline tree
*
4364 gimple_omp_task_copy_fn_ptr (gimple gs
)
4366 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4367 return &gs
->gimple_omp_task
.copy_fn
;
4371 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4374 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4376 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4377 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
4381 /* Return size of the data block in bytes in OMP_TASK GS. */
4384 gimple_omp_task_arg_size (const_gimple gs
)
4386 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4387 return gs
->gimple_omp_task
.arg_size
;
4391 /* Return a pointer to the data block size for OMP_TASK GS. */
4393 static inline tree
*
4394 gimple_omp_task_arg_size_ptr (gimple gs
)
4396 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4397 return &gs
->gimple_omp_task
.arg_size
;
4401 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4404 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4406 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4407 gs
->gimple_omp_task
.arg_size
= arg_size
;
4411 /* Return align of the data block in bytes in OMP_TASK GS. */
4414 gimple_omp_task_arg_align (const_gimple gs
)
4416 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4417 return gs
->gimple_omp_task
.arg_align
;
4421 /* Return a pointer to the data block align for OMP_TASK GS. */
4423 static inline tree
*
4424 gimple_omp_task_arg_align_ptr (gimple gs
)
4426 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4427 return &gs
->gimple_omp_task
.arg_align
;
4431 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4434 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
4436 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4437 gs
->gimple_omp_task
.arg_align
= arg_align
;
4441 /* Return the clauses associated with OMP_SINGLE GS. */
4444 gimple_omp_single_clauses (const_gimple gs
)
4446 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4447 return gs
->gimple_omp_single
.clauses
;
4451 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4453 static inline tree
*
4454 gimple_omp_single_clauses_ptr (gimple gs
)
4456 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4457 return &gs
->gimple_omp_single
.clauses
;
4461 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4464 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
4466 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4467 gs
->gimple_omp_single
.clauses
= clauses
;
4471 /* Return the clauses associated with OMP_TARGET GS. */
4474 gimple_omp_target_clauses (const_gimple gs
)
4476 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4477 return gs
->gimple_omp_parallel
.clauses
;
4481 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
4483 static inline tree
*
4484 gimple_omp_target_clauses_ptr (gimple gs
)
4486 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4487 return &gs
->gimple_omp_parallel
.clauses
;
4491 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
4494 gimple_omp_target_set_clauses (gimple gs
, tree clauses
)
4496 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4497 gs
->gimple_omp_parallel
.clauses
= clauses
;
4501 /* Return the kind of OMP target statemement. */
4504 gimple_omp_target_kind (const_gimple g
)
4506 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
4507 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
4511 /* Set the OMP target kind. */
4514 gimple_omp_target_set_kind (gimple g
, int kind
)
4516 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
4517 g
->gsbase
.subcode
= (g
->gsbase
.subcode
& ~GF_OMP_TARGET_KIND_MASK
)
4518 | (kind
& GF_OMP_TARGET_KIND_MASK
);
4522 /* Return the child function used to hold the body of OMP_TARGET GS. */
4525 gimple_omp_target_child_fn (const_gimple gs
)
4527 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4528 return gs
->gimple_omp_parallel
.child_fn
;
4531 /* Return a pointer to the child function used to hold the body of
4534 static inline tree
*
4535 gimple_omp_target_child_fn_ptr (gimple gs
)
4537 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4538 return &gs
->gimple_omp_parallel
.child_fn
;
4542 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
4545 gimple_omp_target_set_child_fn (gimple gs
, tree child_fn
)
4547 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4548 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4552 /* Return the artificial argument used to send variables and values
4553 from the parent to the children threads in OMP_TARGET GS. */
4556 gimple_omp_target_data_arg (const_gimple gs
)
4558 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4559 return gs
->gimple_omp_parallel
.data_arg
;
4563 /* Return a pointer to the data argument for OMP_TARGET GS. */
4565 static inline tree
*
4566 gimple_omp_target_data_arg_ptr (gimple gs
)
4568 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4569 return &gs
->gimple_omp_parallel
.data_arg
;
4573 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
4576 gimple_omp_target_set_data_arg (gimple gs
, tree data_arg
)
4578 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4579 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4583 /* Return the clauses associated with OMP_TEAMS GS. */
4586 gimple_omp_teams_clauses (const_gimple gs
)
4588 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4589 return gs
->gimple_omp_single
.clauses
;
4593 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
4595 static inline tree
*
4596 gimple_omp_teams_clauses_ptr (gimple gs
)
4598 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4599 return &gs
->gimple_omp_single
.clauses
;
4603 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
4606 gimple_omp_teams_set_clauses (gimple gs
, tree clauses
)
4608 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4609 gs
->gimple_omp_single
.clauses
= clauses
;
4613 /* Return the clauses associated with OMP_SECTIONS GS. */
4616 gimple_omp_sections_clauses (const_gimple gs
)
4618 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4619 return gs
->gimple_omp_sections
.clauses
;
4623 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4625 static inline tree
*
4626 gimple_omp_sections_clauses_ptr (gimple gs
)
4628 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4629 return &gs
->gimple_omp_sections
.clauses
;
4633 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4637 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4639 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4640 gs
->gimple_omp_sections
.clauses
= clauses
;
4644 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4648 gimple_omp_sections_control (const_gimple gs
)
4650 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4651 return gs
->gimple_omp_sections
.control
;
4655 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4658 static inline tree
*
4659 gimple_omp_sections_control_ptr (gimple gs
)
4661 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4662 return &gs
->gimple_omp_sections
.control
;
4666 /* Set CONTROL to be the set of clauses associated with the
4667 GIMPLE_OMP_SECTIONS in GS. */
4670 gimple_omp_sections_set_control (gimple gs
, tree control
)
4672 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4673 gs
->gimple_omp_sections
.control
= control
;
4677 /* Set COND to be the condition code for OMP_FOR GS. */
4680 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4682 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4683 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4684 && i
< gs
->gimple_omp_for
.collapse
);
4685 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4689 /* Return the condition code associated with OMP_FOR GS. */
4691 static inline enum tree_code
4692 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4694 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4695 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4696 return gs
->gimple_omp_for
.iter
[i
].cond
;
4700 /* Set the value being stored in an atomic store. */
4703 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4705 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4706 g
->gimple_omp_atomic_store
.val
= val
;
4710 /* Return the value being stored in an atomic store. */
4713 gimple_omp_atomic_store_val (const_gimple g
)
4715 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4716 return g
->gimple_omp_atomic_store
.val
;
4720 /* Return a pointer to the value being stored in an atomic store. */
4722 static inline tree
*
4723 gimple_omp_atomic_store_val_ptr (gimple g
)
4725 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4726 return &g
->gimple_omp_atomic_store
.val
;
4730 /* Set the LHS of an atomic load. */
4733 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
4735 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4736 g
->gimple_omp_atomic_load
.lhs
= lhs
;
4740 /* Get the LHS of an atomic load. */
4743 gimple_omp_atomic_load_lhs (const_gimple g
)
4745 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4746 return g
->gimple_omp_atomic_load
.lhs
;
4750 /* Return a pointer to the LHS of an atomic load. */
4752 static inline tree
*
4753 gimple_omp_atomic_load_lhs_ptr (gimple g
)
4755 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4756 return &g
->gimple_omp_atomic_load
.lhs
;
4760 /* Set the RHS of an atomic load. */
4763 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
4765 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4766 g
->gimple_omp_atomic_load
.rhs
= rhs
;
4770 /* Get the RHS of an atomic load. */
4773 gimple_omp_atomic_load_rhs (const_gimple g
)
4775 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4776 return g
->gimple_omp_atomic_load
.rhs
;
4780 /* Return a pointer to the RHS of an atomic load. */
4782 static inline tree
*
4783 gimple_omp_atomic_load_rhs_ptr (gimple g
)
4785 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4786 return &g
->gimple_omp_atomic_load
.rhs
;
4790 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4793 gimple_omp_continue_control_def (const_gimple g
)
4795 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4796 return g
->gimple_omp_continue
.control_def
;
4799 /* The same as above, but return the address. */
4801 static inline tree
*
4802 gimple_omp_continue_control_def_ptr (gimple g
)
4804 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4805 return &g
->gimple_omp_continue
.control_def
;
4808 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4811 gimple_omp_continue_set_control_def (gimple g
, tree def
)
4813 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4814 g
->gimple_omp_continue
.control_def
= def
;
4818 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4821 gimple_omp_continue_control_use (const_gimple g
)
4823 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4824 return g
->gimple_omp_continue
.control_use
;
4828 /* The same as above, but return the address. */
4830 static inline tree
*
4831 gimple_omp_continue_control_use_ptr (gimple g
)
4833 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4834 return &g
->gimple_omp_continue
.control_use
;
4838 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4841 gimple_omp_continue_set_control_use (gimple g
, tree use
)
4843 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4844 g
->gimple_omp_continue
.control_use
= use
;
4847 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4849 static inline gimple_seq
*
4850 gimple_transaction_body_ptr (gimple gs
)
4852 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4853 return &gs
->gimple_transaction
.body
;
4856 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4858 static inline gimple_seq
4859 gimple_transaction_body (gimple gs
)
4861 return *gimple_transaction_body_ptr (gs
);
4864 /* Return the label associated with a GIMPLE_TRANSACTION. */
4867 gimple_transaction_label (const_gimple gs
)
4869 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4870 return gs
->gimple_transaction
.label
;
4873 static inline tree
*
4874 gimple_transaction_label_ptr (gimple gs
)
4876 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4877 return &gs
->gimple_transaction
.label
;
4880 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4882 static inline unsigned int
4883 gimple_transaction_subcode (const_gimple gs
)
4885 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4886 return gs
->gsbase
.subcode
;
4889 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4892 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
4894 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4895 gs
->gimple_transaction
.body
= body
;
4898 /* Set the label associated with a GIMPLE_TRANSACTION. */
4901 gimple_transaction_set_label (gimple gs
, tree label
)
4903 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4904 gs
->gimple_transaction
.label
= label
;
4907 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4910 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
4912 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4913 gs
->gsbase
.subcode
= subcode
;
4917 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4919 static inline tree
*
4920 gimple_return_retval_ptr (const_gimple gs
)
4922 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4923 return gimple_op_ptr (gs
, 0);
4926 /* Return the return value for GIMPLE_RETURN GS. */
4929 gimple_return_retval (const_gimple gs
)
4931 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4932 return gimple_op (gs
, 0);
4936 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4939 gimple_return_set_retval (gimple gs
, tree retval
)
4941 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4942 gimple_set_op (gs
, 0, retval
);
4946 /* Return the return bounds for GIMPLE_RETURN GS. */
4949 gimple_return_retbnd (const_gimple gs
)
4951 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4952 return gimple_op (gs
, 1);
4956 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
4959 gimple_return_set_retbnd (gimple gs
, tree retval
)
4961 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4962 gimple_set_op (gs
, 1, retval
);
4966 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4968 #define CASE_GIMPLE_OMP \
4969 case GIMPLE_OMP_PARALLEL: \
4970 case GIMPLE_OMP_TASK: \
4971 case GIMPLE_OMP_FOR: \
4972 case GIMPLE_OMP_SECTIONS: \
4973 case GIMPLE_OMP_SECTIONS_SWITCH: \
4974 case GIMPLE_OMP_SINGLE: \
4975 case GIMPLE_OMP_TARGET: \
4976 case GIMPLE_OMP_TEAMS: \
4977 case GIMPLE_OMP_SECTION: \
4978 case GIMPLE_OMP_MASTER: \
4979 case GIMPLE_OMP_TASKGROUP: \
4980 case GIMPLE_OMP_ORDERED: \
4981 case GIMPLE_OMP_CRITICAL: \
4982 case GIMPLE_OMP_RETURN: \
4983 case GIMPLE_OMP_ATOMIC_LOAD: \
4984 case GIMPLE_OMP_ATOMIC_STORE: \
4985 case GIMPLE_OMP_CONTINUE
4988 is_gimple_omp (const_gimple stmt
)
4990 switch (gimple_code (stmt
))
5000 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5003 gimple_nop_p (const_gimple g
)
5005 return gimple_code (g
) == GIMPLE_NOP
;
5009 /* Return true if GS is a GIMPLE_RESX. */
5012 is_gimple_resx (const_gimple gs
)
5014 return gimple_code (gs
) == GIMPLE_RESX
;
5017 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5019 static inline enum br_predictor
5020 gimple_predict_predictor (gimple gs
)
5022 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5023 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
5027 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5030 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5032 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5033 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
5034 | (unsigned) predictor
;
5038 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5040 static inline enum prediction
5041 gimple_predict_outcome (gimple gs
)
5043 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5044 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5048 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5051 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5053 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5054 if (outcome
== TAKEN
)
5055 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
5057 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
5061 /* Return the type of the main expression computed by STMT. Return
5062 void_type_node if the statement computes nothing. */
5065 gimple_expr_type (const_gimple stmt
)
5067 enum gimple_code code
= gimple_code (stmt
);
5069 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5072 /* In general we want to pass out a type that can be substituted
5073 for both the RHS and the LHS types if there is a possibly
5074 useless conversion involved. That means returning the
5075 original RHS type as far as we can reconstruct it. */
5076 if (code
== GIMPLE_CALL
)
5077 type
= gimple_call_return_type (stmt
);
5079 switch (gimple_assign_rhs_code (stmt
))
5081 case POINTER_PLUS_EXPR
:
5082 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5086 /* As fallback use the type of the LHS. */
5087 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5092 else if (code
== GIMPLE_COND
)
5093 return boolean_type_node
;
5095 return void_type_node
;
5098 /* Enum and arrays used for allocation stats. Keep in sync with
5099 gimple.c:gimple_alloc_kind_names. */
5100 enum gimple_alloc_kind
5102 gimple_alloc_kind_assign
, /* Assignments. */
5103 gimple_alloc_kind_phi
, /* PHI nodes. */
5104 gimple_alloc_kind_cond
, /* Conditionals. */
5105 gimple_alloc_kind_rest
, /* Everything else. */
5106 gimple_alloc_kind_all
5109 extern int gimple_alloc_counts
[];
5110 extern int gimple_alloc_sizes
[];
5112 /* Return the allocation kind for a given stmt CODE. */
5113 static inline enum gimple_alloc_kind
5114 gimple_alloc_kind (enum gimple_code code
)
5119 return gimple_alloc_kind_assign
;
5121 return gimple_alloc_kind_phi
;
5123 return gimple_alloc_kind_cond
;
5125 return gimple_alloc_kind_rest
;
5129 /* Return true if a location should not be emitted for this statement
5130 by annotate_all_with_location. */
5133 gimple_do_not_emit_location_p (gimple g
)
5135 return gimple_plf (g
, GF_PLF_1
);
5138 /* Mark statement G so a location will not be emitted by
5139 annotate_one_with_location. */
5142 gimple_set_do_not_emit_location (gimple g
)
5144 /* The PLF flags are initialized to 0 when a new tuple is created,
5145 so no need to initialize it anywhere. */
5146 gimple_set_plf (g
, GF_PLF_1
, true);
5150 /* Macros for showing usage statistics. */
5151 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5153 : ((x) < 1024*1024*10 \
5155 : (x) / (1024*1024))))
5157 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5159 #endif /* GCC_GIMPLE_H */