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"
28 #include "basic-block.h"
30 #include "tree-ssa-operands.h"
31 #include "tree-ssa-alias.h"
32 #include "internal-fn.h"
34 typedef gimple gimple_seq_node
;
36 /* For each block, the PHI nodes that need to be rewritten are stored into
38 typedef vec
<gimple
> gimple_vec
;
41 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
44 LAST_AND_UNUSED_GIMPLE_CODE
47 extern const char *const gimple_code_name
[];
48 extern const unsigned char gimple_rhs_class_table
[];
50 /* Error out if a gimple tuple is addressed incorrectly. */
51 #if defined ENABLE_GIMPLE_CHECKING
52 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
53 extern void gimple_check_failed (const_gimple
, const char *, int, \
54 const char *, enum gimple_code
, \
55 enum tree_code
) ATTRIBUTE_NORETURN
;
57 #define GIMPLE_CHECK(GS, CODE) \
59 const_gimple __gs = (GS); \
60 if (gimple_code (__gs) != (CODE)) \
61 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
62 (CODE), ERROR_MARK); \
64 #else /* not ENABLE_GIMPLE_CHECKING */
65 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
66 #define GIMPLE_CHECK(GS, CODE) (void)0
69 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
70 get_gimple_rhs_class. */
73 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
74 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
75 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
76 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
77 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
78 name, a _DECL, a _REF, etc. */
81 /* Specific flags for individual GIMPLE statements. These flags are
82 always stored in gimple_statement_base.subcode and they may only be
83 defined for statement codes that do not use sub-codes.
85 Values for the masks can overlap as long as the overlapping values
86 are never used in the same statement class.
88 The maximum mask value that can be defined is 1 << 15 (i.e., each
89 statement code can hold up to 16 bitflags).
91 Keep this list sorted. */
93 GF_ASM_INPUT
= 1 << 0,
94 GF_ASM_VOLATILE
= 1 << 1,
95 GF_CALL_FROM_THUNK
= 1 << 0,
96 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
97 GF_CALL_TAILCALL
= 1 << 2,
98 GF_CALL_VA_ARG_PACK
= 1 << 3,
99 GF_CALL_NOTHROW
= 1 << 4,
100 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
101 GF_CALL_INTERNAL
= 1 << 6,
102 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
104 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
105 a thread synchronization via some sort of barrier. The exact barrier
106 that would otherwise be emitted is dependent on the OMP statement with
107 which this return is associated. */
108 GF_OMP_RETURN_NOWAIT
= 1 << 0,
110 GF_OMP_SECTION_LAST
= 1 << 0,
111 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
112 GF_PREDICT_TAKEN
= 1 << 15
115 /* Currently, there are only two types of gimple debug stmt. Others are
116 envisioned, for example, to enable the generation of is_stmt notes
117 in line number information, to mark sequence points, etc. This
118 subcode is to be used to tell them apart. */
119 enum gimple_debug_subcode
{
120 GIMPLE_DEBUG_BIND
= 0,
121 GIMPLE_DEBUG_SOURCE_BIND
= 1
124 /* Masks for selecting a pass local flag (PLF) to work on. These
125 masks are used by gimple_set_plf and gimple_plf. */
131 /* Iterator object for GIMPLE statement sequences. */
133 struct gimple_stmt_iterator_d
135 /* Sequence node holding the current statement. */
138 /* Sequence and basic block holding the statement. These fields
139 are necessary to handle edge cases such as when statement is
140 added to an empty basic block or when the last statement of a
141 block/sequence is removed. */
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 */
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
;
722 /* Offset in bytes to the location of the operand vector.
723 Zero if there is no operand vector for this tuple structure. */
724 extern size_t const gimple_ops_offset_
[];
726 /* Map GIMPLE codes to GSS codes. */
727 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
729 /* This variable holds the currently expanded gimple statement for purposes
730 of comminucating the profile info to the builtin expanders. */
731 extern gimple currently_expanding_gimple_stmt
;
733 gimple
gimple_build_return (tree
);
735 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
736 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
738 void extract_ops_from_tree_1 (tree
, enum tree_code
*, tree
*, tree
*, tree
*);
741 gimple_build_assign_with_ops (enum tree_code
, tree
,
742 tree
, tree CXX_MEM_STAT_INFO
);
744 gimple_build_assign_with_ops (enum tree_code
, tree
,
745 tree
, tree
, tree CXX_MEM_STAT_INFO
);
747 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
748 #define gimple_build_debug_bind(var,val,stmt) \
749 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
750 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
751 #define gimple_build_debug_source_bind(var,val,stmt) \
752 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
754 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
755 gimple
gimple_build_call (tree
, unsigned, ...);
756 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
757 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
758 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
759 gimple
gimple_build_call_from_tree (tree
);
760 gimple
gimplify_assign (tree
, tree
, gimple_seq
*);
761 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
762 gimple
gimple_build_label (tree label
);
763 gimple
gimple_build_goto (tree dest
);
764 gimple
gimple_build_nop (void);
765 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
766 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
767 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
769 gimple
gimple_build_catch (tree
, gimple_seq
);
770 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
771 gimple
gimple_build_eh_must_not_throw (tree
);
772 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
773 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
774 gimple
gimple_build_wce (gimple_seq
);
775 gimple
gimple_build_resx (int);
776 gimple
gimple_build_eh_dispatch (int);
777 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
778 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
779 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
780 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
781 gimple
gimple_build_omp_for (gimple_seq
, tree
, size_t, gimple_seq
);
782 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
783 gimple
gimple_build_omp_section (gimple_seq
);
784 gimple
gimple_build_omp_continue (tree
, tree
);
785 gimple
gimple_build_omp_master (gimple_seq
);
786 gimple
gimple_build_omp_return (bool);
787 gimple
gimple_build_omp_ordered (gimple_seq
);
788 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
789 gimple
gimple_build_omp_sections_switch (void);
790 gimple
gimple_build_omp_single (gimple_seq
, tree
);
791 gimple
gimple_build_cdt (tree
, tree
);
792 gimple
gimple_build_omp_atomic_load (tree
, tree
);
793 gimple
gimple_build_omp_atomic_store (tree
);
794 gimple
gimple_build_transaction (gimple_seq
, tree
);
795 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
796 enum gimple_statement_structure_enum
gss_for_assign (enum tree_code
);
797 void sort_case_labels (vec
<tree
> );
798 void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
799 void gimple_set_body (tree
, gimple_seq
);
800 gimple_seq
gimple_body (tree
);
801 bool gimple_has_body_p (tree
);
802 gimple_seq
gimple_seq_alloc (void);
803 void gimple_seq_free (gimple_seq
);
804 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
805 gimple_seq
gimple_seq_copy (gimple_seq
);
806 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
807 int gimple_call_flags (const_gimple
);
808 int gimple_call_return_flags (const_gimple
);
809 int gimple_call_arg_flags (const_gimple
, unsigned);
810 void gimple_call_reset_alias_info (gimple
);
811 bool gimple_assign_copy_p (gimple
);
812 bool gimple_assign_ssa_name_copy_p (gimple
);
813 bool gimple_assign_unary_nop_p (gimple
);
814 void gimple_set_bb (gimple
, basic_block
);
815 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
816 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
818 tree
gimple_get_lhs (const_gimple
);
819 void gimple_set_lhs (gimple
, tree
);
820 void gimple_replace_lhs (gimple
, tree
);
821 gimple
gimple_copy (gimple
);
822 void gimple_cond_get_ops_from_tree (tree
, enum tree_code
*, tree
*, tree
*);
823 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
824 void gimple_cond_set_condition_from_tree (gimple
, tree
);
825 bool gimple_has_side_effects (const_gimple
);
826 bool gimple_could_trap_p (gimple
);
827 bool gimple_could_trap_p_1 (gimple
, bool, bool);
828 bool gimple_assign_rhs_could_trap_p (gimple
);
829 void gimple_regimplify_operands (gimple
, gimple_stmt_iterator
*);
830 bool empty_body_p (gimple_seq
);
831 unsigned get_gimple_rhs_num_ops (enum tree_code
);
832 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
833 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
834 const char *gimple_decl_printable_name (tree
, int);
835 tree
gimple_get_virt_method_for_binfo (HOST_WIDE_INT
, tree
);
836 tree
gimple_extract_devirt_binfo_from_cst (tree
);
838 /* Returns true iff T is a scalar register variable. */
839 extern bool is_gimple_reg (tree
);
840 /* Returns true iff T is any sort of variable. */
841 extern bool is_gimple_variable (tree
);
842 /* Returns true iff T is any sort of symbol. */
843 extern bool is_gimple_id (tree
);
844 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
845 extern bool is_gimple_min_lval (tree
);
846 /* Returns true iff T is something whose address can be taken. */
847 extern bool is_gimple_addressable (tree
);
848 /* Returns true iff T is any valid GIMPLE lvalue. */
849 extern bool is_gimple_lvalue (tree
);
851 /* Returns true iff T is a GIMPLE address. */
852 bool is_gimple_address (const_tree
);
853 /* Returns true iff T is a GIMPLE invariant address. */
854 bool is_gimple_invariant_address (const_tree
);
855 /* Returns true iff T is a GIMPLE invariant address at interprocedural
857 bool is_gimple_ip_invariant_address (const_tree
);
858 /* Returns true iff T is a valid GIMPLE constant. */
859 bool is_gimple_constant (const_tree
);
860 /* Returns true iff T is a GIMPLE restricted function invariant. */
861 extern bool is_gimple_min_invariant (const_tree
);
862 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
863 extern bool is_gimple_ip_invariant (const_tree
);
864 /* Returns true iff T is a GIMPLE rvalue. */
865 extern bool is_gimple_val (tree
);
866 /* Returns true iff T is a GIMPLE asm statement input. */
867 extern bool is_gimple_asm_val (tree
);
868 /* Returns true iff T is a valid address operand of a MEM_REF. */
869 bool is_gimple_mem_ref_addr (tree
);
871 /* Returns true iff T is a valid if-statement condition. */
872 extern bool is_gimple_condexpr (tree
);
874 /* Returns true iff T is a valid call address expression. */
875 extern bool is_gimple_call_addr (tree
);
877 /* Return TRUE iff stmt is a call to a built-in function. */
878 extern bool is_gimple_builtin_call (gimple stmt
);
880 extern void recalculate_side_effects (tree
);
881 extern bool gimple_compare_field_offset (tree
, tree
);
882 extern tree
gimple_register_canonical_type (tree
);
883 extern void print_gimple_types_stats (const char *);
884 extern void free_gimple_type_tables (void);
885 extern tree
gimple_unsigned_type (tree
);
886 extern tree
gimple_signed_type (tree
);
887 extern alias_set_type
gimple_get_alias_set (tree
);
888 extern void count_uses_and_derefs (tree
, gimple
, unsigned *, unsigned *,
890 typedef bool (*walk_stmt_load_store_addr_fn
) (gimple
, tree
, tree
, void *);
891 extern bool walk_stmt_load_store_addr_ops (gimple
, void *,
892 walk_stmt_load_store_addr_fn
,
893 walk_stmt_load_store_addr_fn
,
894 walk_stmt_load_store_addr_fn
);
895 extern bool walk_stmt_load_store_ops (gimple
, void *,
896 walk_stmt_load_store_addr_fn
,
897 walk_stmt_load_store_addr_fn
);
898 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
899 extern bool gimple_call_builtin_p (gimple
, enum built_in_class
);
900 extern bool gimple_call_builtin_p (gimple
, enum built_in_function
);
901 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
904 extern tree
create_tmp_var_raw (tree
, const char *);
905 extern tree
create_tmp_var_name (const char *);
906 extern tree
create_tmp_var (tree
, const char *);
907 extern tree
create_tmp_reg (tree
, const char *);
908 extern tree
get_initialized_tmp_var (tree
, gimple_seq
*, gimple_seq
*);
909 extern tree
get_formal_tmp_var (tree
, gimple_seq
*);
910 extern void declare_vars (tree
, gimple
, bool);
911 extern void annotate_all_with_location (gimple_seq
, location_t
);
913 /* Validation of GIMPLE expressions. Note that these predicates only check
914 the basic form of the expression, they don't recurse to make sure that
915 underlying nodes are also of the right form. */
916 typedef bool (*gimple_predicate
)(tree
);
919 /* FIXME we should deduce this from the predicate. */
921 fb_none
= 0, /* Do not generate a temporary. */
923 fb_rvalue
= 1, /* Generate an rvalue to hold the result of a
924 gimplified expression. */
926 fb_lvalue
= 2, /* Generate an lvalue to hold the result of a
927 gimplified expression. */
929 fb_mayfail
= 4, /* Gimplification may fail. Error issued
931 fb_either
= fb_rvalue
| fb_lvalue
934 typedef int fallback_t
;
936 enum gimplify_status
{
937 GS_ERROR
= -2, /* Something Bad Seen. */
938 GS_UNHANDLED
= -1, /* A langhook result for "I dunno". */
939 GS_OK
= 0, /* We did something, maybe more to do. */
940 GS_ALL_DONE
= 1 /* The expression is fully gimplified. */
945 struct gimplify_ctx
*prev_context
;
947 vec
<gimple
> bind_expr_stack
;
949 gimple_seq conditional_cleanups
;
953 vec
<tree
> case_labels
;
954 /* The formal temporary table. Should this be persistent? */
960 bool allow_rhs_cond_expr
;
961 bool in_cleanup_point_expr
;
964 /* Return true if gimplify_one_sizepos doesn't need to gimplify
965 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
968 is_gimple_sizepos (tree expr
)
970 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
971 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
972 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
973 function, the gimplifier will want to replace it with a new variable,
974 but that will cause problems if this type is from outside the function.
975 It's OK to have that here. */
976 return (expr
== NULL_TREE
977 || TREE_CONSTANT (expr
)
978 || TREE_CODE (expr
) == VAR_DECL
979 || CONTAINS_PLACEHOLDER_P (expr
));
982 extern enum gimplify_status
gimplify_expr (tree
*, gimple_seq
*, gimple_seq
*,
983 bool (*) (tree
), fallback_t
);
984 extern void gimplify_type_sizes (tree
, gimple_seq
*);
985 extern void gimplify_one_sizepos (tree
*, gimple_seq
*);
986 enum gimplify_status
gimplify_self_mod_expr (tree
*, gimple_seq
*, gimple_seq
*,
988 extern bool gimplify_stmt (tree
*, gimple_seq
*);
989 extern gimple
gimplify_body (tree
, bool);
990 extern void push_gimplify_context (struct gimplify_ctx
*);
991 extern void pop_gimplify_context (gimple
);
992 extern void gimplify_and_add (tree
, gimple_seq
*);
994 /* Miscellaneous helpers. */
995 extern void gimple_add_tmp_var (tree
);
996 extern gimple
gimple_current_bind_expr (void);
997 extern vec
<gimple
> gimple_bind_expr_stack (void);
998 extern tree
voidify_wrapper_expr (tree
, tree
);
999 extern tree
build_and_jump (tree
*);
1000 extern tree
force_labels_r (tree
*, int *, void *);
1001 extern enum gimplify_status
gimplify_va_arg_expr (tree
*, gimple_seq
*,
1003 struct gimplify_omp_ctx
;
1004 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx
*, tree
);
1005 extern tree
gimple_boolify (tree
);
1006 extern gimple_predicate
rhs_predicate_for (tree
);
1007 extern tree
canonicalize_cond_expr_cond (tree
);
1010 extern tree
omp_reduction_init (tree
, tree
);
1012 /* In trans-mem.c. */
1013 extern void diagnose_tm_safe_errors (tree
);
1014 extern void compute_transaction_bits (void);
1016 /* In tree-nested.c. */
1017 extern void lower_nested_functions (tree
);
1018 extern void insert_field_into_struct (tree
, tree
);
1020 /* In gimplify.c. */
1021 extern void gimplify_function_tree (tree
);
1023 /* In cfgexpand.c. */
1024 extern tree
gimple_assign_rhs_to_tree (gimple
);
1027 extern bool validate_gimple_arglist (const_gimple
, ...);
1030 extern bool tree_ssa_useless_type_conversion (tree
);
1031 extern tree
tree_ssa_strip_useless_type_conversions (tree
);
1032 extern bool useless_type_conversion_p (tree
, tree
);
1033 extern bool types_compatible_p (tree
, tree
);
1035 /* In tree-ssa-coalesce.c */
1036 extern bool gimple_can_coalesce_p (tree
, tree
);
1038 /* Return the first node in GIMPLE sequence S. */
1040 static inline gimple_seq_node
1041 gimple_seq_first (gimple_seq s
)
1047 /* Return the first statement in GIMPLE sequence S. */
1049 static inline gimple
1050 gimple_seq_first_stmt (gimple_seq s
)
1052 gimple_seq_node n
= gimple_seq_first (s
);
1057 /* Return the last node in GIMPLE sequence S. */
1059 static inline gimple_seq_node
1060 gimple_seq_last (gimple_seq s
)
1062 return s
? s
->gsbase
.prev
: NULL
;
1066 /* Return the last statement in GIMPLE sequence S. */
1068 static inline gimple
1069 gimple_seq_last_stmt (gimple_seq s
)
1071 gimple_seq_node n
= gimple_seq_last (s
);
1076 /* Set the last node in GIMPLE sequence *PS to LAST. */
1079 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1081 (*ps
)->gsbase
.prev
= last
;
1085 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1088 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1094 /* Return true if GIMPLE sequence S is empty. */
1097 gimple_seq_empty_p (gimple_seq s
)
1103 void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1105 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1106 *SEQ_P is NULL, a new sequence is allocated. This function is
1107 similar to gimple_seq_add_stmt, but does not scan the operands.
1108 During gimplification, we need to manipulate statement sequences
1109 before the def/use vectors have been constructed. */
1110 void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1112 /* Allocate a new sequence and initialize its first element with STMT. */
1114 static inline gimple_seq
1115 gimple_seq_alloc_with_stmt (gimple stmt
)
1117 gimple_seq seq
= NULL
;
1118 gimple_seq_add_stmt (&seq
, stmt
);
1123 /* Returns the sequence of statements in BB. */
1125 static inline gimple_seq
1126 bb_seq (const_basic_block bb
)
1128 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1131 static inline gimple_seq
*
1132 bb_seq_addr (basic_block bb
)
1134 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1137 /* Sets the sequence of statements in BB to SEQ. */
1140 set_bb_seq (basic_block bb
, gimple_seq seq
)
1142 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1143 bb
->il
.gimple
.seq
= seq
;
1147 /* Return the code for GIMPLE statement G. */
1149 static inline enum gimple_code
1150 gimple_code (const_gimple g
)
1152 return g
->gsbase
.code
;
1156 /* Return the GSS code used by a GIMPLE code. */
1158 static inline enum gimple_statement_structure_enum
1159 gss_for_code (enum gimple_code code
)
1161 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1162 return gss_for_code_
[code
];
1166 /* Return which GSS code is used by GS. */
1168 static inline enum gimple_statement_structure_enum
1169 gimple_statement_structure (gimple gs
)
1171 return gss_for_code (gimple_code (gs
));
1175 /* Return true if statement G has sub-statements. This is only true for
1176 High GIMPLE statements. */
1179 gimple_has_substatements (gimple g
)
1181 switch (gimple_code (g
))
1185 case GIMPLE_EH_FILTER
:
1186 case GIMPLE_EH_ELSE
:
1188 case GIMPLE_OMP_FOR
:
1189 case GIMPLE_OMP_MASTER
:
1190 case GIMPLE_OMP_ORDERED
:
1191 case GIMPLE_OMP_SECTION
:
1192 case GIMPLE_OMP_PARALLEL
:
1193 case GIMPLE_OMP_TASK
:
1194 case GIMPLE_OMP_SECTIONS
:
1195 case GIMPLE_OMP_SINGLE
:
1196 case GIMPLE_OMP_CRITICAL
:
1197 case GIMPLE_WITH_CLEANUP_EXPR
:
1198 case GIMPLE_TRANSACTION
:
1207 /* Return the basic block holding statement G. */
1209 static inline basic_block
1210 gimple_bb (const_gimple g
)
1212 return g
->gsbase
.bb
;
1216 /* Return the lexical scope block holding statement G. */
1219 gimple_block (const_gimple g
)
1221 return LOCATION_BLOCK (g
->gsbase
.location
);
1225 /* Set BLOCK to be the lexical scope block holding statement G. */
1228 gimple_set_block (gimple g
, tree block
)
1231 g
->gsbase
.location
=
1232 COMBINE_LOCATION_DATA (line_table
, g
->gsbase
.location
, block
);
1234 g
->gsbase
.location
= LOCATION_LOCUS (g
->gsbase
.location
);
1238 /* Return location information for statement G. */
1240 static inline location_t
1241 gimple_location (const_gimple g
)
1243 return g
->gsbase
.location
;
1246 /* Return pointer to location information for statement G. */
1248 static inline const location_t
*
1249 gimple_location_ptr (const_gimple g
)
1251 return &g
->gsbase
.location
;
1255 /* Set location information for statement G. */
1258 gimple_set_location (gimple g
, location_t location
)
1260 g
->gsbase
.location
= location
;
1264 /* Return true if G contains location information. */
1267 gimple_has_location (const_gimple g
)
1269 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1273 /* Return the file name of the location of STMT. */
1275 static inline const char *
1276 gimple_filename (const_gimple stmt
)
1278 return LOCATION_FILE (gimple_location (stmt
));
1282 /* Return the line number of the location of STMT. */
1285 gimple_lineno (const_gimple stmt
)
1287 return LOCATION_LINE (gimple_location (stmt
));
1291 /* Determine whether SEQ is a singleton. */
1294 gimple_seq_singleton_p (gimple_seq seq
)
1296 return ((gimple_seq_first (seq
) != NULL
)
1297 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1300 /* Return true if no warnings should be emitted for statement STMT. */
1303 gimple_no_warning_p (const_gimple stmt
)
1305 return stmt
->gsbase
.no_warning
;
1308 /* Set the no_warning flag of STMT to NO_WARNING. */
1311 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1313 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1316 /* Set the visited status on statement STMT to VISITED_P. */
1319 gimple_set_visited (gimple stmt
, bool visited_p
)
1321 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1325 /* Return the visited status for statement STMT. */
1328 gimple_visited_p (gimple stmt
)
1330 return stmt
->gsbase
.visited
;
1334 /* Set pass local flag PLF on statement STMT to VAL_P. */
1337 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1340 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1342 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1346 /* Return the value of pass local flag PLF on statement STMT. */
1348 static inline unsigned int
1349 gimple_plf (gimple stmt
, enum plf_mask plf
)
1351 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1355 /* Set the UID of statement. */
1358 gimple_set_uid (gimple g
, unsigned uid
)
1360 g
->gsbase
.uid
= uid
;
1364 /* Return the UID of statement. */
1366 static inline unsigned
1367 gimple_uid (const_gimple g
)
1369 return g
->gsbase
.uid
;
1373 /* Make statement G a singleton sequence. */
1376 gimple_init_singleton (gimple g
)
1378 g
->gsbase
.next
= NULL
;
1383 /* Return true if GIMPLE statement G has register or memory operands. */
1386 gimple_has_ops (const_gimple g
)
1388 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1392 /* Return true if GIMPLE statement G has memory operands. */
1395 gimple_has_mem_ops (const_gimple g
)
1397 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1401 /* Return the set of USE operands for statement G. */
1403 static inline struct use_optype_d
*
1404 gimple_use_ops (const_gimple g
)
1406 if (!gimple_has_ops (g
))
1408 return g
->gsops
.opbase
.use_ops
;
1412 /* Set USE to be the set of USE operands for statement G. */
1415 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1417 gcc_gimple_checking_assert (gimple_has_ops (g
));
1418 g
->gsops
.opbase
.use_ops
= use
;
1422 /* Return the set of VUSE operand for statement G. */
1424 static inline use_operand_p
1425 gimple_vuse_op (const_gimple g
)
1427 struct use_optype_d
*ops
;
1428 if (!gimple_has_mem_ops (g
))
1429 return NULL_USE_OPERAND_P
;
1430 ops
= g
->gsops
.opbase
.use_ops
;
1432 && USE_OP_PTR (ops
)->use
== &g
->gsmembase
.vuse
)
1433 return USE_OP_PTR (ops
);
1434 return NULL_USE_OPERAND_P
;
1437 /* Return the set of VDEF operand for statement G. */
1439 static inline def_operand_p
1440 gimple_vdef_op (gimple g
)
1442 if (!gimple_has_mem_ops (g
))
1443 return NULL_DEF_OPERAND_P
;
1444 if (g
->gsmembase
.vdef
)
1445 return &g
->gsmembase
.vdef
;
1446 return NULL_DEF_OPERAND_P
;
1450 /* Return the single VUSE operand of the statement G. */
1453 gimple_vuse (const_gimple g
)
1455 if (!gimple_has_mem_ops (g
))
1457 return g
->gsmembase
.vuse
;
1460 /* Return the single VDEF operand of the statement G. */
1463 gimple_vdef (const_gimple g
)
1465 if (!gimple_has_mem_ops (g
))
1467 return g
->gsmembase
.vdef
;
1470 /* Return the single VUSE operand of the statement G. */
1472 static inline tree
*
1473 gimple_vuse_ptr (gimple g
)
1475 if (!gimple_has_mem_ops (g
))
1477 return &g
->gsmembase
.vuse
;
1480 /* Return the single VDEF operand of the statement G. */
1482 static inline tree
*
1483 gimple_vdef_ptr (gimple g
)
1485 if (!gimple_has_mem_ops (g
))
1487 return &g
->gsmembase
.vdef
;
1490 /* Set the single VUSE operand of the statement G. */
1493 gimple_set_vuse (gimple g
, tree vuse
)
1495 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1496 g
->gsmembase
.vuse
= vuse
;
1499 /* Set the single VDEF operand of the statement G. */
1502 gimple_set_vdef (gimple g
, tree vdef
)
1504 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1505 g
->gsmembase
.vdef
= vdef
;
1509 /* Return true if statement G has operands and the modified field has
1513 gimple_modified_p (const_gimple g
)
1515 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1519 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1520 a MODIFIED field. */
1523 gimple_set_modified (gimple s
, bool modifiedp
)
1525 if (gimple_has_ops (s
))
1526 s
->gsbase
.modified
= (unsigned) modifiedp
;
1530 /* Return the tree code for the expression computed by STMT. This is
1531 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1532 GIMPLE_CALL, return CALL_EXPR as the expression code for
1533 consistency. This is useful when the caller needs to deal with the
1534 three kinds of computation that GIMPLE supports. */
1536 static inline enum tree_code
1537 gimple_expr_code (const_gimple stmt
)
1539 enum gimple_code code
= gimple_code (stmt
);
1540 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1541 return (enum tree_code
) stmt
->gsbase
.subcode
;
1544 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1550 /* Mark statement S as modified, and update it. */
1553 update_stmt (gimple s
)
1555 if (gimple_has_ops (s
))
1557 gimple_set_modified (s
, true);
1558 update_stmt_operands (s
);
1562 /* Update statement S if it has been optimized. */
1565 update_stmt_if_modified (gimple s
)
1567 if (gimple_modified_p (s
))
1568 update_stmt_operands (s
);
1571 /* Return true if statement STMT contains volatile operands. */
1574 gimple_has_volatile_ops (const_gimple stmt
)
1576 if (gimple_has_mem_ops (stmt
))
1577 return stmt
->gsbase
.has_volatile_ops
;
1583 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1586 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1588 if (gimple_has_mem_ops (stmt
))
1589 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1592 /* Return true if BB is in a transaction. */
1595 block_in_transaction (basic_block bb
)
1597 return flag_tm
&& bb
->flags
& BB_IN_TRANSACTION
;
1600 /* Return true if STMT is in a transaction. */
1603 gimple_in_transaction (gimple stmt
)
1605 return block_in_transaction (gimple_bb (stmt
));
1608 /* Return true if statement STMT may access memory. */
1611 gimple_references_memory_p (gimple stmt
)
1613 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1617 /* Return the subcode for OMP statement S. */
1619 static inline unsigned
1620 gimple_omp_subcode (const_gimple s
)
1622 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1623 && gimple_code (s
) <= GIMPLE_OMP_SINGLE
);
1624 return s
->gsbase
.subcode
;
1627 /* Set the subcode for OMP statement S to SUBCODE. */
1630 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1632 /* We only have 16 bits for the subcode. Assert that we are not
1634 gcc_gimple_checking_assert (subcode
< (1 << 16));
1635 s
->gsbase
.subcode
= subcode
;
1638 /* Set the nowait flag on OMP_RETURN statement S. */
1641 gimple_omp_return_set_nowait (gimple s
)
1643 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1644 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1648 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1652 gimple_omp_return_nowait_p (const_gimple g
)
1654 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1655 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1659 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1663 gimple_omp_section_last_p (const_gimple g
)
1665 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1666 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1670 /* Set the GF_OMP_SECTION_LAST flag on G. */
1673 gimple_omp_section_set_last (gimple g
)
1675 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1676 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1680 /* Return true if OMP parallel statement G has the
1681 GF_OMP_PARALLEL_COMBINED flag set. */
1684 gimple_omp_parallel_combined_p (const_gimple g
)
1686 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1687 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1691 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1692 value of COMBINED_P. */
1695 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1697 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1699 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1701 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1705 /* Return true if OMP atomic load/store statement G has the
1706 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1709 gimple_omp_atomic_need_value_p (const_gimple g
)
1711 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1712 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1713 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
1717 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1720 gimple_omp_atomic_set_need_value (gimple g
)
1722 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1723 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1724 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
1728 /* Return the number of operands for statement GS. */
1730 static inline unsigned
1731 gimple_num_ops (const_gimple gs
)
1733 return gs
->gsbase
.num_ops
;
1737 /* Set the number of operands for statement GS. */
1740 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1742 gs
->gsbase
.num_ops
= num_ops
;
1746 /* Return the array of operands for statement GS. */
1748 static inline tree
*
1749 gimple_ops (gimple gs
)
1753 /* All the tuples have their operand vector at the very bottom
1754 of the structure. Note that those structures that do not
1755 have an operand vector have a zero offset. */
1756 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1757 gcc_gimple_checking_assert (off
!= 0);
1759 return (tree
*) ((char *) gs
+ off
);
1763 /* Return operand I for statement GS. */
1766 gimple_op (const_gimple gs
, unsigned i
)
1768 if (gimple_has_ops (gs
))
1770 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1771 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1777 /* Return a pointer to operand I for statement GS. */
1779 static inline tree
*
1780 gimple_op_ptr (const_gimple gs
, unsigned i
)
1782 if (gimple_has_ops (gs
))
1784 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1785 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1791 /* Set operand I of statement GS to OP. */
1794 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1796 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1798 /* Note. It may be tempting to assert that OP matches
1799 is_gimple_operand, but that would be wrong. Different tuples
1800 accept slightly different sets of tree operands. Each caller
1801 should perform its own validation. */
1802 gimple_ops (gs
)[i
] = op
;
1805 /* Return true if GS is a GIMPLE_ASSIGN. */
1808 is_gimple_assign (const_gimple gs
)
1810 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1813 /* Determine if expression CODE is one of the valid expressions that can
1814 be used on the RHS of GIMPLE assignments. */
1816 static inline enum gimple_rhs_class
1817 get_gimple_rhs_class (enum tree_code code
)
1819 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1822 /* Return the LHS of assignment statement GS. */
1825 gimple_assign_lhs (const_gimple gs
)
1827 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1828 return gimple_op (gs
, 0);
1832 /* Return a pointer to the LHS of assignment statement GS. */
1834 static inline tree
*
1835 gimple_assign_lhs_ptr (const_gimple gs
)
1837 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1838 return gimple_op_ptr (gs
, 0);
1842 /* Set LHS to be the LHS operand of assignment statement GS. */
1845 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1847 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1848 gimple_set_op (gs
, 0, lhs
);
1850 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1851 SSA_NAME_DEF_STMT (lhs
) = gs
;
1855 /* Return the first operand on the RHS of assignment statement GS. */
1858 gimple_assign_rhs1 (const_gimple gs
)
1860 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1861 return gimple_op (gs
, 1);
1865 /* Return a pointer to the first operand on the RHS of assignment
1868 static inline tree
*
1869 gimple_assign_rhs1_ptr (const_gimple gs
)
1871 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1872 return gimple_op_ptr (gs
, 1);
1875 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1878 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1880 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1882 gimple_set_op (gs
, 1, rhs
);
1886 /* Return the second operand on the RHS of assignment statement GS.
1887 If GS does not have two operands, NULL is returned instead. */
1890 gimple_assign_rhs2 (const_gimple gs
)
1892 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1894 if (gimple_num_ops (gs
) >= 3)
1895 return gimple_op (gs
, 2);
1901 /* Return a pointer to the second operand on the RHS of assignment
1904 static inline tree
*
1905 gimple_assign_rhs2_ptr (const_gimple gs
)
1907 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1908 return gimple_op_ptr (gs
, 2);
1912 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1915 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1917 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1919 gimple_set_op (gs
, 2, rhs
);
1922 /* Return the third operand on the RHS of assignment statement GS.
1923 If GS does not have two operands, NULL is returned instead. */
1926 gimple_assign_rhs3 (const_gimple gs
)
1928 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1930 if (gimple_num_ops (gs
) >= 4)
1931 return gimple_op (gs
, 3);
1936 /* Return a pointer to the third operand on the RHS of assignment
1939 static inline tree
*
1940 gimple_assign_rhs3_ptr (const_gimple gs
)
1942 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1943 return gimple_op_ptr (gs
, 3);
1947 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1950 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
1952 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1954 gimple_set_op (gs
, 3, rhs
);
1957 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1958 to see only a maximum of two operands. */
1961 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
1964 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
1967 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1968 to see only a maximum of two operands. */
1971 extract_ops_from_tree (tree expr
, enum tree_code
*code
, tree
*op0
,
1975 extract_ops_from_tree_1 (expr
, code
, op0
, op1
, &op2
);
1976 gcc_assert (op2
== NULL_TREE
);
1979 /* Returns true if GS is a nontemporal move. */
1982 gimple_assign_nontemporal_move_p (const_gimple gs
)
1984 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1985 return gs
->gsbase
.nontemporal_move
;
1988 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1991 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
1993 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1994 gs
->gsbase
.nontemporal_move
= nontemporal
;
1998 /* Return the code of the expression computed on the rhs of assignment
1999 statement GS. In case that the RHS is a single object, returns the
2000 tree code of the object. */
2002 static inline enum tree_code
2003 gimple_assign_rhs_code (const_gimple gs
)
2005 enum tree_code code
;
2006 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2008 code
= (enum tree_code
) gs
->gsbase
.subcode
;
2009 /* While we initially set subcode to the TREE_CODE of the rhs for
2010 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2011 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2012 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2013 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2019 /* Set CODE to be the code for the expression computed on the RHS of
2023 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2025 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2026 s
->gsbase
.subcode
= code
;
2030 /* Return the gimple rhs class of the code of the expression computed on
2031 the rhs of assignment statement GS.
2032 This will never return GIMPLE_INVALID_RHS. */
2034 static inline enum gimple_rhs_class
2035 gimple_assign_rhs_class (const_gimple gs
)
2037 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2040 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2041 there is no operator associated with the assignment itself.
2042 Unlike gimple_assign_copy_p, this predicate returns true for
2043 any RHS operand, including those that perform an operation
2044 and do not have the semantics of a copy, such as COND_EXPR. */
2047 gimple_assign_single_p (gimple gs
)
2049 return (is_gimple_assign (gs
)
2050 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2053 /* Return true if GS performs a store to its lhs. */
2056 gimple_store_p (gimple gs
)
2058 tree lhs
= gimple_get_lhs (gs
);
2059 return lhs
&& !is_gimple_reg (lhs
);
2062 /* Return true if GS is an assignment that loads from its rhs1. */
2065 gimple_assign_load_p (gimple gs
)
2068 if (!gimple_assign_single_p (gs
))
2070 rhs
= gimple_assign_rhs1 (gs
);
2071 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2073 rhs
= get_base_address (rhs
);
2074 return (DECL_P (rhs
)
2075 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2079 /* Return true if S is a type-cast assignment. */
2082 gimple_assign_cast_p (gimple s
)
2084 if (is_gimple_assign (s
))
2086 enum tree_code sc
= gimple_assign_rhs_code (s
);
2087 return CONVERT_EXPR_CODE_P (sc
)
2088 || sc
== VIEW_CONVERT_EXPR
2089 || sc
== FIX_TRUNC_EXPR
;
2095 /* Return true if S is a clobber statement. */
2098 gimple_clobber_p (gimple s
)
2100 return gimple_assign_single_p (s
)
2101 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2104 /* Return true if GS is a GIMPLE_CALL. */
2107 is_gimple_call (const_gimple gs
)
2109 return gimple_code (gs
) == GIMPLE_CALL
;
2112 /* Return the LHS of call statement GS. */
2115 gimple_call_lhs (const_gimple gs
)
2117 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2118 return gimple_op (gs
, 0);
2122 /* Return a pointer to the LHS of call statement GS. */
2124 static inline tree
*
2125 gimple_call_lhs_ptr (const_gimple gs
)
2127 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2128 return gimple_op_ptr (gs
, 0);
2132 /* Set LHS to be the LHS operand of call statement GS. */
2135 gimple_call_set_lhs (gimple gs
, tree lhs
)
2137 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2138 gimple_set_op (gs
, 0, lhs
);
2139 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2140 SSA_NAME_DEF_STMT (lhs
) = gs
;
2144 /* Return true if call GS calls an internal-only function, as enumerated
2148 gimple_call_internal_p (const_gimple gs
)
2150 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2151 return (gs
->gsbase
.subcode
& GF_CALL_INTERNAL
) != 0;
2155 /* Return the target of internal call GS. */
2157 static inline enum internal_fn
2158 gimple_call_internal_fn (const_gimple gs
)
2160 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2161 return gs
->gimple_call
.u
.internal_fn
;
2165 /* Return the function type of the function called by GS. */
2168 gimple_call_fntype (const_gimple gs
)
2170 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2171 if (gimple_call_internal_p (gs
))
2173 return gs
->gimple_call
.u
.fntype
;
2176 /* Set the type of the function called by GS to FNTYPE. */
2179 gimple_call_set_fntype (gimple gs
, tree fntype
)
2181 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2182 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2183 gs
->gimple_call
.u
.fntype
= fntype
;
2187 /* Return the tree node representing the function called by call
2191 gimple_call_fn (const_gimple gs
)
2193 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2194 return gimple_op (gs
, 1);
2197 /* Return a pointer to the tree node representing the function called by call
2200 static inline tree
*
2201 gimple_call_fn_ptr (const_gimple gs
)
2203 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2204 return gimple_op_ptr (gs
, 1);
2208 /* Set FN to be the function called by call statement GS. */
2211 gimple_call_set_fn (gimple gs
, tree fn
)
2213 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2214 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2215 gimple_set_op (gs
, 1, fn
);
2219 /* Set FNDECL to be the function called by call statement GS. */
2222 gimple_call_set_fndecl (gimple gs
, tree decl
)
2224 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2225 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2226 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2230 /* Set internal function FN to be the function called by call statement GS. */
2233 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2235 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2236 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2237 gs
->gimple_call
.u
.internal_fn
= fn
;
2241 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2242 associated with the callee if known. Otherwise return NULL_TREE. */
2245 gimple_call_addr_fndecl (const_tree fn
)
2247 if (fn
&& TREE_CODE (fn
) == ADDR_EXPR
)
2249 tree fndecl
= TREE_OPERAND (fn
, 0);
2250 if (TREE_CODE (fndecl
) == MEM_REF
2251 && TREE_CODE (TREE_OPERAND (fndecl
, 0)) == ADDR_EXPR
2252 && integer_zerop (TREE_OPERAND (fndecl
, 1)))
2253 fndecl
= TREE_OPERAND (TREE_OPERAND (fndecl
, 0), 0);
2254 if (TREE_CODE (fndecl
) == FUNCTION_DECL
)
2260 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2261 Otherwise return NULL. This function is analogous to
2262 get_callee_fndecl in tree land. */
2265 gimple_call_fndecl (const_gimple gs
)
2267 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2271 /* Return the type returned by call statement GS. */
2274 gimple_call_return_type (const_gimple gs
)
2276 tree type
= gimple_call_fntype (gs
);
2278 if (type
== NULL_TREE
)
2279 return TREE_TYPE (gimple_call_lhs (gs
));
2281 /* The type returned by a function is the type of its
2283 return TREE_TYPE (type
);
2287 /* Return the static chain for call statement GS. */
2290 gimple_call_chain (const_gimple gs
)
2292 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2293 return gimple_op (gs
, 2);
2297 /* Return a pointer to the static chain for call statement GS. */
2299 static inline tree
*
2300 gimple_call_chain_ptr (const_gimple gs
)
2302 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2303 return gimple_op_ptr (gs
, 2);
2306 /* Set CHAIN to be the static chain for call statement GS. */
2309 gimple_call_set_chain (gimple gs
, tree chain
)
2311 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2313 gimple_set_op (gs
, 2, chain
);
2317 /* Return the number of arguments used by call statement GS. */
2319 static inline unsigned
2320 gimple_call_num_args (const_gimple gs
)
2323 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2324 num_ops
= gimple_num_ops (gs
);
2329 /* Return the argument at position INDEX for call statement GS. */
2332 gimple_call_arg (const_gimple gs
, unsigned index
)
2334 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2335 return gimple_op (gs
, index
+ 3);
2339 /* Return a pointer to the argument at position INDEX for call
2342 static inline tree
*
2343 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2345 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2346 return gimple_op_ptr (gs
, index
+ 3);
2350 /* Set ARG to be the argument at position INDEX for call statement GS. */
2353 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2355 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2356 gimple_set_op (gs
, index
+ 3, arg
);
2360 /* If TAIL_P is true, mark call statement S as being a tail call
2361 (i.e., a call just before the exit of a function). These calls are
2362 candidate for tail call optimization. */
2365 gimple_call_set_tail (gimple s
, bool tail_p
)
2367 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2369 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2371 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2375 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2378 gimple_call_tail_p (gimple s
)
2380 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2381 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2385 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2386 slot optimization. This transformation uses the target of the call
2387 expansion as the return slot for calls that return in memory. */
2390 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2392 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2393 if (return_slot_opt_p
)
2394 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2396 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2400 /* Return true if S is marked for return slot optimization. */
2403 gimple_call_return_slot_opt_p (gimple s
)
2405 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2406 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2410 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2411 thunk to the thunked-to function. */
2414 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2416 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2418 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2420 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2424 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2427 gimple_call_from_thunk_p (gimple s
)
2429 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2430 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2434 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2435 argument pack in its argument list. */
2438 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2440 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2441 if (pass_arg_pack_p
)
2442 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2444 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2448 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2449 argument pack in its argument list. */
2452 gimple_call_va_arg_pack_p (gimple s
)
2454 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2455 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2459 /* Return true if S is a noreturn call. */
2462 gimple_call_noreturn_p (gimple s
)
2464 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2465 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2469 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2470 even if the called function can throw in other cases. */
2473 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2475 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2477 s
->gsbase
.subcode
|= GF_CALL_NOTHROW
;
2479 s
->gsbase
.subcode
&= ~GF_CALL_NOTHROW
;
2482 /* Return true if S is a nothrow call. */
2485 gimple_call_nothrow_p (gimple s
)
2487 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2488 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2491 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2492 is known to be emitted for VLA objects. Those are wrapped by
2493 stack_save/stack_restore calls and hence can't lead to unbounded
2494 stack growth even when they occur in loops. */
2497 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2499 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2501 s
->gsbase
.subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2503 s
->gsbase
.subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2506 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2509 gimple_call_alloca_for_var_p (gimple s
)
2511 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2512 return (s
->gsbase
.subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2515 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2518 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2520 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2521 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2522 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2526 /* Return a pointer to the points-to solution for the set of call-used
2527 variables of the call CALL. */
2529 static inline struct pt_solution
*
2530 gimple_call_use_set (gimple call
)
2532 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2533 return &call
->gimple_call
.call_used
;
2537 /* Return a pointer to the points-to solution for the set of call-used
2538 variables of the call CALL. */
2540 static inline struct pt_solution
*
2541 gimple_call_clobber_set (gimple call
)
2543 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2544 return &call
->gimple_call
.call_clobbered
;
2548 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2552 gimple_has_lhs (gimple stmt
)
2554 return (is_gimple_assign (stmt
)
2555 || (is_gimple_call (stmt
)
2556 && gimple_call_lhs (stmt
) != NULL_TREE
));
2560 /* Return the code of the predicate computed by conditional statement GS. */
2562 static inline enum tree_code
2563 gimple_cond_code (const_gimple gs
)
2565 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2566 return (enum tree_code
) gs
->gsbase
.subcode
;
2570 /* Set CODE to be the predicate code for the conditional statement GS. */
2573 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2575 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2576 gs
->gsbase
.subcode
= code
;
2580 /* Return the LHS of the predicate computed by conditional statement GS. */
2583 gimple_cond_lhs (const_gimple gs
)
2585 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2586 return gimple_op (gs
, 0);
2589 /* Return the pointer to the LHS of the predicate computed by conditional
2592 static inline tree
*
2593 gimple_cond_lhs_ptr (const_gimple gs
)
2595 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2596 return gimple_op_ptr (gs
, 0);
2599 /* Set LHS to be the LHS operand of the predicate computed by
2600 conditional statement GS. */
2603 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2605 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2606 gimple_set_op (gs
, 0, lhs
);
2610 /* Return the RHS operand of the predicate computed by conditional GS. */
2613 gimple_cond_rhs (const_gimple gs
)
2615 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2616 return gimple_op (gs
, 1);
2619 /* Return the pointer to the RHS operand of the predicate computed by
2622 static inline tree
*
2623 gimple_cond_rhs_ptr (const_gimple gs
)
2625 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2626 return gimple_op_ptr (gs
, 1);
2630 /* Set RHS to be the RHS operand of the predicate computed by
2631 conditional statement GS. */
2634 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2636 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2637 gimple_set_op (gs
, 1, rhs
);
2641 /* Return the label used by conditional statement GS when its
2642 predicate evaluates to true. */
2645 gimple_cond_true_label (const_gimple gs
)
2647 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2648 return gimple_op (gs
, 2);
2652 /* Set LABEL to be the label used by conditional statement GS when its
2653 predicate evaluates to true. */
2656 gimple_cond_set_true_label (gimple gs
, tree label
)
2658 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2659 gimple_set_op (gs
, 2, label
);
2663 /* Set LABEL to be the label used by conditional statement GS when its
2664 predicate evaluates to false. */
2667 gimple_cond_set_false_label (gimple gs
, tree label
)
2669 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2670 gimple_set_op (gs
, 3, label
);
2674 /* Return the label used by conditional statement GS when its
2675 predicate evaluates to false. */
2678 gimple_cond_false_label (const_gimple gs
)
2680 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2681 return gimple_op (gs
, 3);
2685 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2688 gimple_cond_make_false (gimple gs
)
2690 gimple_cond_set_lhs (gs
, boolean_true_node
);
2691 gimple_cond_set_rhs (gs
, boolean_false_node
);
2692 gs
->gsbase
.subcode
= EQ_EXPR
;
2696 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2699 gimple_cond_make_true (gimple gs
)
2701 gimple_cond_set_lhs (gs
, boolean_true_node
);
2702 gimple_cond_set_rhs (gs
, boolean_true_node
);
2703 gs
->gsbase
.subcode
= EQ_EXPR
;
2706 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2707 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2710 gimple_cond_true_p (const_gimple gs
)
2712 tree lhs
= gimple_cond_lhs (gs
);
2713 tree rhs
= gimple_cond_rhs (gs
);
2714 enum tree_code code
= gimple_cond_code (gs
);
2716 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2719 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2722 if (code
== NE_EXPR
&& lhs
!= rhs
)
2725 if (code
== EQ_EXPR
&& lhs
== rhs
)
2731 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2732 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2735 gimple_cond_false_p (const_gimple gs
)
2737 tree lhs
= gimple_cond_lhs (gs
);
2738 tree rhs
= gimple_cond_rhs (gs
);
2739 enum tree_code code
= gimple_cond_code (gs
);
2741 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2744 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2747 if (code
== NE_EXPR
&& lhs
== rhs
)
2750 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2756 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2760 gimple_cond_single_var_p (gimple gs
)
2762 if (gimple_cond_code (gs
) == NE_EXPR
2763 && gimple_cond_rhs (gs
) == boolean_false_node
)
2766 if (gimple_cond_code (gs
) == EQ_EXPR
2767 && gimple_cond_rhs (gs
) == boolean_true_node
)
2773 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2776 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2778 gimple_cond_set_code (stmt
, code
);
2779 gimple_cond_set_lhs (stmt
, lhs
);
2780 gimple_cond_set_rhs (stmt
, rhs
);
2783 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2786 gimple_label_label (const_gimple gs
)
2788 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2789 return gimple_op (gs
, 0);
2793 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2797 gimple_label_set_label (gimple gs
, tree label
)
2799 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2800 gimple_set_op (gs
, 0, label
);
2804 /* Return the destination of the unconditional jump GS. */
2807 gimple_goto_dest (const_gimple gs
)
2809 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2810 return gimple_op (gs
, 0);
2814 /* Set DEST to be the destination of the unconditonal jump GS. */
2817 gimple_goto_set_dest (gimple gs
, tree dest
)
2819 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2820 gimple_set_op (gs
, 0, dest
);
2824 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2827 gimple_bind_vars (const_gimple gs
)
2829 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2830 return gs
->gimple_bind
.vars
;
2834 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2838 gimple_bind_set_vars (gimple gs
, tree vars
)
2840 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2841 gs
->gimple_bind
.vars
= vars
;
2845 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2849 gimple_bind_append_vars (gimple gs
, tree vars
)
2851 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2852 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2856 static inline gimple_seq
*
2857 gimple_bind_body_ptr (gimple gs
)
2859 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2860 return &gs
->gimple_bind
.body
;
2863 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2865 static inline gimple_seq
2866 gimple_bind_body (gimple gs
)
2868 return *gimple_bind_body_ptr (gs
);
2872 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2876 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2878 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2879 gs
->gimple_bind
.body
= seq
;
2883 /* Append a statement to the end of a GIMPLE_BIND's body. */
2886 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2888 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2889 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2893 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2896 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2898 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2899 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2903 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2904 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2907 gimple_bind_block (const_gimple gs
)
2909 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2910 return gs
->gimple_bind
.block
;
2914 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2918 gimple_bind_set_block (gimple gs
, tree block
)
2920 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2921 gcc_gimple_checking_assert (block
== NULL_TREE
2922 || TREE_CODE (block
) == BLOCK
);
2923 gs
->gimple_bind
.block
= block
;
2927 /* Return the number of input operands for GIMPLE_ASM GS. */
2929 static inline unsigned
2930 gimple_asm_ninputs (const_gimple gs
)
2932 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2933 return gs
->gimple_asm
.ni
;
2937 /* Return the number of output operands for GIMPLE_ASM GS. */
2939 static inline unsigned
2940 gimple_asm_noutputs (const_gimple gs
)
2942 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2943 return gs
->gimple_asm
.no
;
2947 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2949 static inline unsigned
2950 gimple_asm_nclobbers (const_gimple gs
)
2952 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2953 return gs
->gimple_asm
.nc
;
2956 /* Return the number of label operands for GIMPLE_ASM GS. */
2958 static inline unsigned
2959 gimple_asm_nlabels (const_gimple gs
)
2961 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2962 return gs
->gimple_asm
.nl
;
2965 /* Return input operand INDEX of GIMPLE_ASM GS. */
2968 gimple_asm_input_op (const_gimple gs
, unsigned index
)
2970 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2971 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2972 return gimple_op (gs
, index
+ gs
->gimple_asm
.no
);
2975 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2977 static inline tree
*
2978 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
2980 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2981 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2982 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.no
);
2986 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2989 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
2991 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2992 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
2993 && TREE_CODE (in_op
) == TREE_LIST
);
2994 gimple_set_op (gs
, index
+ gs
->gimple_asm
.no
, in_op
);
2998 /* Return output operand INDEX of GIMPLE_ASM GS. */
3001 gimple_asm_output_op (const_gimple gs
, unsigned index
)
3003 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3004 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
3005 return gimple_op (gs
, index
);
3008 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3010 static inline tree
*
3011 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
3013 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3014 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
3015 return gimple_op_ptr (gs
, index
);
3019 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3022 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
3024 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3025 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
3026 && TREE_CODE (out_op
) == TREE_LIST
);
3027 gimple_set_op (gs
, index
, out_op
);
3031 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3034 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3036 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3037 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
);
3038 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
3042 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3045 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3047 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3048 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
3049 && TREE_CODE (clobber_op
) == TREE_LIST
);
3050 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
3053 /* Return label operand INDEX of GIMPLE_ASM GS. */
3056 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3058 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3059 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
);
3060 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
3063 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3066 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3068 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3069 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
3070 && TREE_CODE (label_op
) == TREE_LIST
);
3071 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
3074 /* Return the string representing the assembly instruction in
3077 static inline const char *
3078 gimple_asm_string (const_gimple gs
)
3080 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3081 return gs
->gimple_asm
.string
;
3085 /* Return true if GS is an asm statement marked volatile. */
3088 gimple_asm_volatile_p (const_gimple gs
)
3090 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3091 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
3095 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3098 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3100 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3102 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
3104 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
3108 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3111 gimple_asm_set_input (gimple gs
, bool input_p
)
3113 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3115 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
3117 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
3121 /* Return true if asm GS is an ASM_INPUT. */
3124 gimple_asm_input_p (const_gimple gs
)
3126 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3127 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
3131 /* Return the types handled by GIMPLE_CATCH statement GS. */
3134 gimple_catch_types (const_gimple gs
)
3136 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3137 return gs
->gimple_catch
.types
;
3141 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3143 static inline tree
*
3144 gimple_catch_types_ptr (gimple gs
)
3146 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3147 return &gs
->gimple_catch
.types
;
3151 /* Return a pointer to the GIMPLE sequence representing the body of
3152 the handler of GIMPLE_CATCH statement GS. */
3154 static inline gimple_seq
*
3155 gimple_catch_handler_ptr (gimple gs
)
3157 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3158 return &gs
->gimple_catch
.handler
;
3162 /* Return the GIMPLE sequence representing the body of the handler of
3163 GIMPLE_CATCH statement GS. */
3165 static inline gimple_seq
3166 gimple_catch_handler (gimple gs
)
3168 return *gimple_catch_handler_ptr (gs
);
3172 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3175 gimple_catch_set_types (gimple gs
, tree t
)
3177 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3178 gs
->gimple_catch
.types
= t
;
3182 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3185 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3187 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3188 gs
->gimple_catch
.handler
= handler
;
3192 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3195 gimple_eh_filter_types (const_gimple gs
)
3197 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3198 return gs
->gimple_eh_filter
.types
;
3202 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3205 static inline tree
*
3206 gimple_eh_filter_types_ptr (gimple gs
)
3208 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3209 return &gs
->gimple_eh_filter
.types
;
3213 /* Return a pointer to the sequence of statement to execute when
3214 GIMPLE_EH_FILTER statement fails. */
3216 static inline gimple_seq
*
3217 gimple_eh_filter_failure_ptr (gimple gs
)
3219 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3220 return &gs
->gimple_eh_filter
.failure
;
3224 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3227 static inline gimple_seq
3228 gimple_eh_filter_failure (gimple gs
)
3230 return *gimple_eh_filter_failure_ptr (gs
);
3234 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3237 gimple_eh_filter_set_types (gimple gs
, tree types
)
3239 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3240 gs
->gimple_eh_filter
.types
= types
;
3244 /* Set FAILURE to be the sequence of statements to execute on failure
3245 for GIMPLE_EH_FILTER GS. */
3248 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3250 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3251 gs
->gimple_eh_filter
.failure
= failure
;
3254 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3257 gimple_eh_must_not_throw_fndecl (gimple gs
)
3259 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3260 return gs
->gimple_eh_mnt
.fndecl
;
3263 /* Set the function decl to be called by GS to DECL. */
3266 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3268 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3269 gs
->gimple_eh_mnt
.fndecl
= decl
;
3272 /* GIMPLE_EH_ELSE accessors. */
3274 static inline gimple_seq
*
3275 gimple_eh_else_n_body_ptr (gimple gs
)
3277 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3278 return &gs
->gimple_eh_else
.n_body
;
3281 static inline gimple_seq
3282 gimple_eh_else_n_body (gimple gs
)
3284 return *gimple_eh_else_n_body_ptr (gs
);
3287 static inline gimple_seq
*
3288 gimple_eh_else_e_body_ptr (gimple gs
)
3290 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3291 return &gs
->gimple_eh_else
.e_body
;
3294 static inline gimple_seq
3295 gimple_eh_else_e_body (gimple gs
)
3297 return *gimple_eh_else_e_body_ptr (gs
);
3301 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3303 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3304 gs
->gimple_eh_else
.n_body
= seq
;
3308 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3310 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3311 gs
->gimple_eh_else
.e_body
= seq
;
3314 /* GIMPLE_TRY accessors. */
3316 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3317 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3319 static inline enum gimple_try_flags
3320 gimple_try_kind (const_gimple gs
)
3322 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3323 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
3327 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3330 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3332 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3333 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3334 || kind
== GIMPLE_TRY_FINALLY
);
3335 if (gimple_try_kind (gs
) != kind
)
3336 gs
->gsbase
.subcode
= (unsigned int) kind
;
3340 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3343 gimple_try_catch_is_cleanup (const_gimple gs
)
3345 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3346 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3350 /* Return a pointer to the sequence of statements used as the
3351 body for GIMPLE_TRY GS. */
3353 static inline gimple_seq
*
3354 gimple_try_eval_ptr (gimple gs
)
3356 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3357 return &gs
->gimple_try
.eval
;
3361 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3363 static inline gimple_seq
3364 gimple_try_eval (gimple gs
)
3366 return *gimple_try_eval_ptr (gs
);
3370 /* Return a pointer to the sequence of statements used as the cleanup body for
3373 static inline gimple_seq
*
3374 gimple_try_cleanup_ptr (gimple gs
)
3376 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3377 return &gs
->gimple_try
.cleanup
;
3381 /* Return the sequence of statements used as the cleanup body for
3384 static inline gimple_seq
3385 gimple_try_cleanup (gimple gs
)
3387 return *gimple_try_cleanup_ptr (gs
);
3391 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3394 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3396 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3397 if (catch_is_cleanup
)
3398 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3400 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3404 /* Set EVAL to be the sequence of statements to use as the body for
3408 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3410 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3411 gs
->gimple_try
.eval
= eval
;
3415 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3416 body for GIMPLE_TRY GS. */
3419 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3421 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3422 gs
->gimple_try
.cleanup
= cleanup
;
3426 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3428 static inline gimple_seq
*
3429 gimple_wce_cleanup_ptr (gimple gs
)
3431 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3432 return &gs
->gimple_wce
.cleanup
;
3436 /* Return the cleanup sequence for cleanup statement GS. */
3438 static inline gimple_seq
3439 gimple_wce_cleanup (gimple gs
)
3441 return *gimple_wce_cleanup_ptr (gs
);
3445 /* Set CLEANUP to be the cleanup sequence for GS. */
3448 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3450 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3451 gs
->gimple_wce
.cleanup
= cleanup
;
3455 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3458 gimple_wce_cleanup_eh_only (const_gimple gs
)
3460 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3461 return gs
->gsbase
.subcode
!= 0;
3465 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3468 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3470 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3471 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3475 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3477 static inline unsigned
3478 gimple_phi_capacity (const_gimple gs
)
3480 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3481 return gs
->gimple_phi
.capacity
;
3485 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3486 be exactly the number of incoming edges for the basic block holding
3489 static inline unsigned
3490 gimple_phi_num_args (const_gimple gs
)
3492 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3493 return gs
->gimple_phi
.nargs
;
3497 /* Return the SSA name created by GIMPLE_PHI GS. */
3500 gimple_phi_result (const_gimple gs
)
3502 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3503 return gs
->gimple_phi
.result
;
3506 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3508 static inline tree
*
3509 gimple_phi_result_ptr (gimple gs
)
3511 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3512 return &gs
->gimple_phi
.result
;
3515 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3518 gimple_phi_set_result (gimple gs
, tree result
)
3520 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3521 gs
->gimple_phi
.result
= result
;
3522 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3523 SSA_NAME_DEF_STMT (result
) = gs
;
3527 /* Return the PHI argument corresponding to incoming edge INDEX for
3530 static inline struct phi_arg_d
*
3531 gimple_phi_arg (gimple gs
, unsigned index
)
3533 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3534 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.capacity
);
3535 return &(gs
->gimple_phi
.args
[index
]);
3538 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3539 for GIMPLE_PHI GS. */
3542 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3544 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3545 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.nargs
);
3546 gs
->gimple_phi
.args
[index
] = *phiarg
;
3549 /* Return the region number for GIMPLE_RESX GS. */
3552 gimple_resx_region (const_gimple gs
)
3554 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3555 return gs
->gimple_eh_ctrl
.region
;
3558 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3561 gimple_resx_set_region (gimple gs
, int region
)
3563 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3564 gs
->gimple_eh_ctrl
.region
= region
;
3567 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3570 gimple_eh_dispatch_region (const_gimple gs
)
3572 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3573 return gs
->gimple_eh_ctrl
.region
;
3576 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3579 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3581 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3582 gs
->gimple_eh_ctrl
.region
= region
;
3585 /* Return the number of labels associated with the switch statement GS. */
3587 static inline unsigned
3588 gimple_switch_num_labels (const_gimple gs
)
3591 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3592 num_ops
= gimple_num_ops (gs
);
3593 gcc_gimple_checking_assert (num_ops
> 1);
3598 /* Set NLABELS to be the number of labels for the switch statement GS. */
3601 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3603 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3604 gimple_set_num_ops (g
, nlabels
+ 1);
3608 /* Return the index variable used by the switch statement GS. */
3611 gimple_switch_index (const_gimple gs
)
3613 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3614 return gimple_op (gs
, 0);
3618 /* Return a pointer to the index variable for the switch statement GS. */
3620 static inline tree
*
3621 gimple_switch_index_ptr (const_gimple gs
)
3623 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3624 return gimple_op_ptr (gs
, 0);
3628 /* Set INDEX to be the index variable for switch statement GS. */
3631 gimple_switch_set_index (gimple gs
, tree index
)
3633 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3634 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3635 gimple_set_op (gs
, 0, index
);
3639 /* Return the label numbered INDEX. The default label is 0, followed by any
3640 labels in a switch statement. */
3643 gimple_switch_label (const_gimple gs
, unsigned index
)
3645 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3646 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
3647 return gimple_op (gs
, index
+ 1);
3650 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3653 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3655 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3656 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
3657 && (label
== NULL_TREE
3658 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
3659 gimple_set_op (gs
, index
+ 1, label
);
3662 /* Return the default label for a switch statement. */
3665 gimple_switch_default_label (const_gimple gs
)
3667 tree label
= gimple_switch_label (gs
, 0);
3668 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3672 /* Set the default label for a switch statement. */
3675 gimple_switch_set_default_label (gimple gs
, tree label
)
3677 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3678 gimple_switch_set_label (gs
, 0, label
);
3681 /* Return true if GS is a GIMPLE_DEBUG statement. */
3684 is_gimple_debug (const_gimple gs
)
3686 return gimple_code (gs
) == GIMPLE_DEBUG
;
3689 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3692 gimple_debug_bind_p (const_gimple s
)
3694 if (is_gimple_debug (s
))
3695 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3700 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3703 gimple_debug_bind_get_var (gimple dbg
)
3705 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3706 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3707 return gimple_op (dbg
, 0);
3710 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3714 gimple_debug_bind_get_value (gimple dbg
)
3716 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3717 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3718 return gimple_op (dbg
, 1);
3721 /* Return a pointer to the value bound to the variable in a
3722 GIMPLE_DEBUG bind statement. */
3724 static inline tree
*
3725 gimple_debug_bind_get_value_ptr (gimple dbg
)
3727 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3728 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3729 return gimple_op_ptr (dbg
, 1);
3732 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3735 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3737 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3738 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3739 gimple_set_op (dbg
, 0, var
);
3742 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3746 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3748 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3749 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3750 gimple_set_op (dbg
, 1, value
);
3753 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3755 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3757 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3761 gimple_debug_bind_reset_value (gimple dbg
)
3763 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3764 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3765 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3768 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3772 gimple_debug_bind_has_value_p (gimple dbg
)
3774 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3775 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3776 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3779 #undef GIMPLE_DEBUG_BIND_NOVALUE
3781 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3784 gimple_debug_source_bind_p (const_gimple s
)
3786 if (is_gimple_debug (s
))
3787 return s
->gsbase
.subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
3792 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3795 gimple_debug_source_bind_get_var (gimple dbg
)
3797 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3798 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3799 return gimple_op (dbg
, 0);
3802 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3806 gimple_debug_source_bind_get_value (gimple dbg
)
3808 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3809 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3810 return gimple_op (dbg
, 1);
3813 /* Return a pointer to the value bound to the variable in a
3814 GIMPLE_DEBUG source bind statement. */
3816 static inline tree
*
3817 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
3819 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3820 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3821 return gimple_op_ptr (dbg
, 1);
3824 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3827 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
3829 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3830 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3831 gimple_set_op (dbg
, 0, var
);
3834 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3838 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
3840 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3841 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3842 gimple_set_op (dbg
, 1, value
);
3845 /* Return a pointer to the body for the OMP statement GS. */
3847 static inline gimple_seq
*
3848 gimple_omp_body_ptr (gimple gs
)
3850 return &gs
->omp
.body
;
3853 /* Return the body for the OMP statement GS. */
3855 static inline gimple_seq
3856 gimple_omp_body (gimple gs
)
3858 return *gimple_omp_body_ptr (gs
);
3861 /* Set BODY to be the body for the OMP statement GS. */
3864 gimple_omp_set_body (gimple gs
, gimple_seq body
)
3866 gs
->omp
.body
= body
;
3870 /* Return the name associated with OMP_CRITICAL statement GS. */
3873 gimple_omp_critical_name (const_gimple gs
)
3875 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3876 return gs
->gimple_omp_critical
.name
;
3880 /* Return a pointer to the name associated with OMP critical statement GS. */
3882 static inline tree
*
3883 gimple_omp_critical_name_ptr (gimple gs
)
3885 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3886 return &gs
->gimple_omp_critical
.name
;
3890 /* Set NAME to be the name associated with OMP critical statement GS. */
3893 gimple_omp_critical_set_name (gimple gs
, tree name
)
3895 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3896 gs
->gimple_omp_critical
.name
= name
;
3900 /* Return the clauses associated with OMP_FOR GS. */
3903 gimple_omp_for_clauses (const_gimple gs
)
3905 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3906 return gs
->gimple_omp_for
.clauses
;
3910 /* Return a pointer to the OMP_FOR GS. */
3912 static inline tree
*
3913 gimple_omp_for_clauses_ptr (gimple gs
)
3915 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3916 return &gs
->gimple_omp_for
.clauses
;
3920 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3923 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
3925 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3926 gs
->gimple_omp_for
.clauses
= clauses
;
3930 /* Get the collapse count of OMP_FOR GS. */
3932 static inline size_t
3933 gimple_omp_for_collapse (gimple gs
)
3935 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3936 return gs
->gimple_omp_for
.collapse
;
3940 /* Return the index variable for OMP_FOR GS. */
3943 gimple_omp_for_index (const_gimple gs
, size_t i
)
3945 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3946 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3947 return gs
->gimple_omp_for
.iter
[i
].index
;
3951 /* Return a pointer to the index variable for OMP_FOR GS. */
3953 static inline tree
*
3954 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
3956 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3957 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3958 return &gs
->gimple_omp_for
.iter
[i
].index
;
3962 /* Set INDEX to be the index variable for OMP_FOR GS. */
3965 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
3967 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3968 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3969 gs
->gimple_omp_for
.iter
[i
].index
= index
;
3973 /* Return the initial value for OMP_FOR GS. */
3976 gimple_omp_for_initial (const_gimple gs
, size_t i
)
3978 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3979 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3980 return gs
->gimple_omp_for
.iter
[i
].initial
;
3984 /* Return a pointer to the initial value for OMP_FOR GS. */
3986 static inline tree
*
3987 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
3989 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3990 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3991 return &gs
->gimple_omp_for
.iter
[i
].initial
;
3995 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3998 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4000 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4001 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4002 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
4006 /* Return the final value for OMP_FOR GS. */
4009 gimple_omp_for_final (const_gimple gs
, size_t i
)
4011 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4012 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4013 return gs
->gimple_omp_for
.iter
[i
].final
;
4017 /* Return a pointer to the final value for OMP_FOR GS. */
4019 static inline tree
*
4020 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4022 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4023 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4024 return &gs
->gimple_omp_for
.iter
[i
].final
;
4028 /* Set FINAL to be the final value for OMP_FOR GS. */
4031 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4033 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4034 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4035 gs
->gimple_omp_for
.iter
[i
].final
= final
;
4039 /* Return the increment value for OMP_FOR GS. */
4042 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4044 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4045 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4046 return gs
->gimple_omp_for
.iter
[i
].incr
;
4050 /* Return a pointer to the increment value for OMP_FOR GS. */
4052 static inline tree
*
4053 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4055 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4056 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4057 return &gs
->gimple_omp_for
.iter
[i
].incr
;
4061 /* Set INCR to be the increment value for OMP_FOR GS. */
4064 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4066 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4067 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4068 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
4072 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4073 statement GS starts. */
4075 static inline gimple_seq
*
4076 gimple_omp_for_pre_body_ptr (gimple gs
)
4078 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4079 return &gs
->gimple_omp_for
.pre_body
;
4083 /* Return the sequence of statements to execute before the OMP_FOR
4084 statement GS starts. */
4086 static inline gimple_seq
4087 gimple_omp_for_pre_body (gimple gs
)
4089 return *gimple_omp_for_pre_body_ptr (gs
);
4093 /* Set PRE_BODY to be the sequence of statements to execute before the
4094 OMP_FOR statement GS starts. */
4097 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4099 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4100 gs
->gimple_omp_for
.pre_body
= pre_body
;
4104 /* Return the clauses associated with OMP_PARALLEL GS. */
4107 gimple_omp_parallel_clauses (const_gimple gs
)
4109 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4110 return gs
->gimple_omp_parallel
.clauses
;
4114 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4116 static inline tree
*
4117 gimple_omp_parallel_clauses_ptr (gimple gs
)
4119 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4120 return &gs
->gimple_omp_parallel
.clauses
;
4124 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4128 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4130 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4131 gs
->gimple_omp_parallel
.clauses
= clauses
;
4135 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4138 gimple_omp_parallel_child_fn (const_gimple gs
)
4140 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4141 return gs
->gimple_omp_parallel
.child_fn
;
4144 /* Return a pointer to the child function used to hold the body of
4147 static inline tree
*
4148 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4150 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4151 return &gs
->gimple_omp_parallel
.child_fn
;
4155 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4158 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4160 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4161 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4165 /* Return the artificial argument used to send variables and values
4166 from the parent to the children threads in OMP_PARALLEL GS. */
4169 gimple_omp_parallel_data_arg (const_gimple gs
)
4171 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4172 return gs
->gimple_omp_parallel
.data_arg
;
4176 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4178 static inline tree
*
4179 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4181 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4182 return &gs
->gimple_omp_parallel
.data_arg
;
4186 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4189 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4191 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4192 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4196 /* Return the clauses associated with OMP_TASK GS. */
4199 gimple_omp_task_clauses (const_gimple gs
)
4201 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4202 return gs
->gimple_omp_parallel
.clauses
;
4206 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4208 static inline tree
*
4209 gimple_omp_task_clauses_ptr (gimple gs
)
4211 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4212 return &gs
->gimple_omp_parallel
.clauses
;
4216 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4220 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4222 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4223 gs
->gimple_omp_parallel
.clauses
= clauses
;
4227 /* Return the child function used to hold the body of OMP_TASK GS. */
4230 gimple_omp_task_child_fn (const_gimple gs
)
4232 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4233 return gs
->gimple_omp_parallel
.child_fn
;
4236 /* Return a pointer to the child function used to hold the body of
4239 static inline tree
*
4240 gimple_omp_task_child_fn_ptr (gimple gs
)
4242 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4243 return &gs
->gimple_omp_parallel
.child_fn
;
4247 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4250 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4252 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4253 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4257 /* Return the artificial argument used to send variables and values
4258 from the parent to the children threads in OMP_TASK GS. */
4261 gimple_omp_task_data_arg (const_gimple gs
)
4263 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4264 return gs
->gimple_omp_parallel
.data_arg
;
4268 /* Return a pointer to the data argument for OMP_TASK GS. */
4270 static inline tree
*
4271 gimple_omp_task_data_arg_ptr (gimple gs
)
4273 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4274 return &gs
->gimple_omp_parallel
.data_arg
;
4278 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4281 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4283 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4284 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4288 /* Return the clauses associated with OMP_TASK GS. */
4291 gimple_omp_taskreg_clauses (const_gimple gs
)
4293 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4294 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4295 return gs
->gimple_omp_parallel
.clauses
;
4299 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4301 static inline tree
*
4302 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4304 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4305 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4306 return &gs
->gimple_omp_parallel
.clauses
;
4310 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4314 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4316 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4317 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4318 gs
->gimple_omp_parallel
.clauses
= clauses
;
4322 /* Return the child function used to hold the body of OMP_TASK GS. */
4325 gimple_omp_taskreg_child_fn (const_gimple gs
)
4327 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4328 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4329 return gs
->gimple_omp_parallel
.child_fn
;
4332 /* Return a pointer to the child function used to hold the body of
4335 static inline tree
*
4336 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4338 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4339 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4340 return &gs
->gimple_omp_parallel
.child_fn
;
4344 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4347 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4349 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4350 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4351 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4355 /* Return the artificial argument used to send variables and values
4356 from the parent to the children threads in OMP_TASK GS. */
4359 gimple_omp_taskreg_data_arg (const_gimple gs
)
4361 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4362 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4363 return gs
->gimple_omp_parallel
.data_arg
;
4367 /* Return a pointer to the data argument for OMP_TASK GS. */
4369 static inline tree
*
4370 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4372 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4373 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4374 return &gs
->gimple_omp_parallel
.data_arg
;
4378 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4381 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4383 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4384 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4385 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4389 /* Return the copy function used to hold the body of OMP_TASK GS. */
4392 gimple_omp_task_copy_fn (const_gimple gs
)
4394 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4395 return gs
->gimple_omp_task
.copy_fn
;
4398 /* Return a pointer to the copy function used to hold the body of
4401 static inline tree
*
4402 gimple_omp_task_copy_fn_ptr (gimple gs
)
4404 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4405 return &gs
->gimple_omp_task
.copy_fn
;
4409 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4412 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4414 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4415 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
4419 /* Return size of the data block in bytes in OMP_TASK GS. */
4422 gimple_omp_task_arg_size (const_gimple gs
)
4424 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4425 return gs
->gimple_omp_task
.arg_size
;
4429 /* Return a pointer to the data block size for OMP_TASK GS. */
4431 static inline tree
*
4432 gimple_omp_task_arg_size_ptr (gimple gs
)
4434 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4435 return &gs
->gimple_omp_task
.arg_size
;
4439 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4442 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4444 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4445 gs
->gimple_omp_task
.arg_size
= arg_size
;
4449 /* Return align of the data block in bytes in OMP_TASK GS. */
4452 gimple_omp_task_arg_align (const_gimple gs
)
4454 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4455 return gs
->gimple_omp_task
.arg_align
;
4459 /* Return a pointer to the data block align for OMP_TASK GS. */
4461 static inline tree
*
4462 gimple_omp_task_arg_align_ptr (gimple gs
)
4464 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4465 return &gs
->gimple_omp_task
.arg_align
;
4469 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4472 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
4474 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4475 gs
->gimple_omp_task
.arg_align
= arg_align
;
4479 /* Return the clauses associated with OMP_SINGLE GS. */
4482 gimple_omp_single_clauses (const_gimple gs
)
4484 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4485 return gs
->gimple_omp_single
.clauses
;
4489 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4491 static inline tree
*
4492 gimple_omp_single_clauses_ptr (gimple gs
)
4494 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4495 return &gs
->gimple_omp_single
.clauses
;
4499 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4502 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
4504 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4505 gs
->gimple_omp_single
.clauses
= clauses
;
4509 /* Return the clauses associated with OMP_SECTIONS GS. */
4512 gimple_omp_sections_clauses (const_gimple gs
)
4514 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4515 return gs
->gimple_omp_sections
.clauses
;
4519 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4521 static inline tree
*
4522 gimple_omp_sections_clauses_ptr (gimple gs
)
4524 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4525 return &gs
->gimple_omp_sections
.clauses
;
4529 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4533 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4535 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4536 gs
->gimple_omp_sections
.clauses
= clauses
;
4540 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4544 gimple_omp_sections_control (const_gimple gs
)
4546 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4547 return gs
->gimple_omp_sections
.control
;
4551 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4554 static inline tree
*
4555 gimple_omp_sections_control_ptr (gimple gs
)
4557 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4558 return &gs
->gimple_omp_sections
.control
;
4562 /* Set CONTROL to be the set of clauses associated with the
4563 GIMPLE_OMP_SECTIONS in GS. */
4566 gimple_omp_sections_set_control (gimple gs
, tree control
)
4568 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4569 gs
->gimple_omp_sections
.control
= control
;
4573 /* Set COND to be the condition code for OMP_FOR GS. */
4576 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4578 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4579 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4580 && i
< gs
->gimple_omp_for
.collapse
);
4581 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4585 /* Return the condition code associated with OMP_FOR GS. */
4587 static inline enum tree_code
4588 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4590 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4591 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4592 return gs
->gimple_omp_for
.iter
[i
].cond
;
4596 /* Set the value being stored in an atomic store. */
4599 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4601 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4602 g
->gimple_omp_atomic_store
.val
= val
;
4606 /* Return the value being stored in an atomic store. */
4609 gimple_omp_atomic_store_val (const_gimple g
)
4611 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4612 return g
->gimple_omp_atomic_store
.val
;
4616 /* Return a pointer to the value being stored in an atomic store. */
4618 static inline tree
*
4619 gimple_omp_atomic_store_val_ptr (gimple g
)
4621 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4622 return &g
->gimple_omp_atomic_store
.val
;
4626 /* Set the LHS of an atomic load. */
4629 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
4631 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4632 g
->gimple_omp_atomic_load
.lhs
= lhs
;
4636 /* Get the LHS of an atomic load. */
4639 gimple_omp_atomic_load_lhs (const_gimple g
)
4641 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4642 return g
->gimple_omp_atomic_load
.lhs
;
4646 /* Return a pointer to the LHS of an atomic load. */
4648 static inline tree
*
4649 gimple_omp_atomic_load_lhs_ptr (gimple g
)
4651 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4652 return &g
->gimple_omp_atomic_load
.lhs
;
4656 /* Set the RHS of an atomic load. */
4659 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
4661 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4662 g
->gimple_omp_atomic_load
.rhs
= rhs
;
4666 /* Get the RHS of an atomic load. */
4669 gimple_omp_atomic_load_rhs (const_gimple g
)
4671 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4672 return g
->gimple_omp_atomic_load
.rhs
;
4676 /* Return a pointer to the RHS of an atomic load. */
4678 static inline tree
*
4679 gimple_omp_atomic_load_rhs_ptr (gimple g
)
4681 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4682 return &g
->gimple_omp_atomic_load
.rhs
;
4686 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4689 gimple_omp_continue_control_def (const_gimple g
)
4691 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4692 return g
->gimple_omp_continue
.control_def
;
4695 /* The same as above, but return the address. */
4697 static inline tree
*
4698 gimple_omp_continue_control_def_ptr (gimple g
)
4700 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4701 return &g
->gimple_omp_continue
.control_def
;
4704 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4707 gimple_omp_continue_set_control_def (gimple g
, tree def
)
4709 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4710 g
->gimple_omp_continue
.control_def
= def
;
4714 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4717 gimple_omp_continue_control_use (const_gimple g
)
4719 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4720 return g
->gimple_omp_continue
.control_use
;
4724 /* The same as above, but return the address. */
4726 static inline tree
*
4727 gimple_omp_continue_control_use_ptr (gimple g
)
4729 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4730 return &g
->gimple_omp_continue
.control_use
;
4734 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4737 gimple_omp_continue_set_control_use (gimple g
, tree use
)
4739 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4740 g
->gimple_omp_continue
.control_use
= use
;
4743 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4745 static inline gimple_seq
*
4746 gimple_transaction_body_ptr (gimple gs
)
4748 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4749 return &gs
->gimple_transaction
.body
;
4752 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4754 static inline gimple_seq
4755 gimple_transaction_body (gimple gs
)
4757 return *gimple_transaction_body_ptr (gs
);
4760 /* Return the label associated with a GIMPLE_TRANSACTION. */
4763 gimple_transaction_label (const_gimple gs
)
4765 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4766 return gs
->gimple_transaction
.label
;
4769 static inline tree
*
4770 gimple_transaction_label_ptr (gimple gs
)
4772 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4773 return &gs
->gimple_transaction
.label
;
4776 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4778 static inline unsigned int
4779 gimple_transaction_subcode (const_gimple gs
)
4781 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4782 return gs
->gsbase
.subcode
;
4785 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4788 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
4790 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4791 gs
->gimple_transaction
.body
= body
;
4794 /* Set the label associated with a GIMPLE_TRANSACTION. */
4797 gimple_transaction_set_label (gimple gs
, tree label
)
4799 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4800 gs
->gimple_transaction
.label
= label
;
4803 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4806 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
4808 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4809 gs
->gsbase
.subcode
= subcode
;
4813 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4815 static inline tree
*
4816 gimple_return_retval_ptr (const_gimple gs
)
4818 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4819 return gimple_op_ptr (gs
, 0);
4822 /* Return the return value for GIMPLE_RETURN GS. */
4825 gimple_return_retval (const_gimple gs
)
4827 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4828 return gimple_op (gs
, 0);
4832 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4835 gimple_return_set_retval (gimple gs
, tree retval
)
4837 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4838 gimple_set_op (gs
, 0, retval
);
4842 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4844 #define CASE_GIMPLE_OMP \
4845 case GIMPLE_OMP_PARALLEL: \
4846 case GIMPLE_OMP_TASK: \
4847 case GIMPLE_OMP_FOR: \
4848 case GIMPLE_OMP_SECTIONS: \
4849 case GIMPLE_OMP_SECTIONS_SWITCH: \
4850 case GIMPLE_OMP_SINGLE: \
4851 case GIMPLE_OMP_SECTION: \
4852 case GIMPLE_OMP_MASTER: \
4853 case GIMPLE_OMP_ORDERED: \
4854 case GIMPLE_OMP_CRITICAL: \
4855 case GIMPLE_OMP_RETURN: \
4856 case GIMPLE_OMP_ATOMIC_LOAD: \
4857 case GIMPLE_OMP_ATOMIC_STORE: \
4858 case GIMPLE_OMP_CONTINUE
4861 is_gimple_omp (const_gimple stmt
)
4863 switch (gimple_code (stmt
))
4873 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4876 gimple_nop_p (const_gimple g
)
4878 return gimple_code (g
) == GIMPLE_NOP
;
4882 /* Return true if GS is a GIMPLE_RESX. */
4885 is_gimple_resx (const_gimple gs
)
4887 return gimple_code (gs
) == GIMPLE_RESX
;
4890 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4892 static inline enum br_predictor
4893 gimple_predict_predictor (gimple gs
)
4895 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4896 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
4900 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4903 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
4905 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4906 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
4907 | (unsigned) predictor
;
4911 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4913 static inline enum prediction
4914 gimple_predict_outcome (gimple gs
)
4916 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4917 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
4921 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4924 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
4926 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4927 if (outcome
== TAKEN
)
4928 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
4930 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
4934 /* Return the type of the main expression computed by STMT. Return
4935 void_type_node if the statement computes nothing. */
4938 gimple_expr_type (const_gimple stmt
)
4940 enum gimple_code code
= gimple_code (stmt
);
4942 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
4945 /* In general we want to pass out a type that can be substituted
4946 for both the RHS and the LHS types if there is a possibly
4947 useless conversion involved. That means returning the
4948 original RHS type as far as we can reconstruct it. */
4949 if (code
== GIMPLE_CALL
)
4950 type
= gimple_call_return_type (stmt
);
4952 switch (gimple_assign_rhs_code (stmt
))
4954 case POINTER_PLUS_EXPR
:
4955 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
4959 /* As fallback use the type of the LHS. */
4960 type
= TREE_TYPE (gimple_get_lhs (stmt
));
4965 else if (code
== GIMPLE_COND
)
4966 return boolean_type_node
;
4968 return void_type_node
;
4971 /* Return true if TYPE is a suitable type for a scalar register variable. */
4974 is_gimple_reg_type (tree type
)
4976 return !AGGREGATE_TYPE_P (type
);
4979 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4981 static inline gimple_stmt_iterator
4982 gsi_start_1 (gimple_seq
*seq
)
4984 gimple_stmt_iterator i
;
4986 i
.ptr
= gimple_seq_first (*seq
);
4988 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
4993 #define gsi_start(x) gsi_start_1(&(x))
4995 static inline gimple_stmt_iterator
4998 gimple_stmt_iterator i
;
5005 /* Return a new iterator pointing to the first statement in basic block BB. */
5007 static inline gimple_stmt_iterator
5008 gsi_start_bb (basic_block bb
)
5010 gimple_stmt_iterator i
;
5013 seq
= bb_seq_addr (bb
);
5014 i
.ptr
= gimple_seq_first (*seq
);
5022 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5024 static inline gimple_stmt_iterator
5025 gsi_last_1 (gimple_seq
*seq
)
5027 gimple_stmt_iterator i
;
5029 i
.ptr
= gimple_seq_last (*seq
);
5031 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
5036 #define gsi_last(x) gsi_last_1(&(x))
5038 /* Return a new iterator pointing to the last statement in basic block BB. */
5040 static inline gimple_stmt_iterator
5041 gsi_last_bb (basic_block bb
)
5043 gimple_stmt_iterator i
;
5046 seq
= bb_seq_addr (bb
);
5047 i
.ptr
= gimple_seq_last (*seq
);
5055 /* Return true if I is at the end of its sequence. */
5058 gsi_end_p (gimple_stmt_iterator i
)
5060 return i
.ptr
== NULL
;
5064 /* Return true if I is one statement before the end of its sequence. */
5067 gsi_one_before_end_p (gimple_stmt_iterator i
)
5069 return i
.ptr
!= NULL
&& i
.ptr
->gsbase
.next
== NULL
;
5073 /* Advance the iterator to the next gimple statement. */
5076 gsi_next (gimple_stmt_iterator
*i
)
5078 i
->ptr
= i
->ptr
->gsbase
.next
;
5081 /* Advance the iterator to the previous gimple statement. */
5084 gsi_prev (gimple_stmt_iterator
*i
)
5086 gimple prev
= i
->ptr
->gsbase
.prev
;
5087 if (prev
->gsbase
.next
)
5093 /* Return the current stmt. */
5095 static inline gimple
5096 gsi_stmt (gimple_stmt_iterator i
)
5101 /* Return a block statement iterator that points to the first non-label
5102 statement in block BB. */
5104 static inline gimple_stmt_iterator
5105 gsi_after_labels (basic_block bb
)
5107 gimple_stmt_iterator gsi
= gsi_start_bb (bb
);
5109 while (!gsi_end_p (gsi
) && gimple_code (gsi_stmt (gsi
)) == GIMPLE_LABEL
)
5115 /* Advance the iterator to the next non-debug gimple statement. */
5118 gsi_next_nondebug (gimple_stmt_iterator
*i
)
5124 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5127 /* Advance the iterator to the next non-debug gimple statement. */
5130 gsi_prev_nondebug (gimple_stmt_iterator
*i
)
5136 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5139 /* Return a new iterator pointing to the first non-debug statement in
5142 static inline gimple_stmt_iterator
5143 gsi_start_nondebug_bb (basic_block bb
)
5145 gimple_stmt_iterator i
= gsi_start_bb (bb
);
5147 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5148 gsi_next_nondebug (&i
);
5153 /* Return a new iterator pointing to the last non-debug statement in
5156 static inline gimple_stmt_iterator
5157 gsi_last_nondebug_bb (basic_block bb
)
5159 gimple_stmt_iterator i
= gsi_last_bb (bb
);
5161 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5162 gsi_prev_nondebug (&i
);
5168 /* Return the basic block associated with this iterator. */
5170 static inline basic_block
5171 gsi_bb (gimple_stmt_iterator i
)
5177 /* Return the sequence associated with this iterator. */
5179 static inline gimple_seq
5180 gsi_seq (gimple_stmt_iterator i
)
5186 enum gsi_iterator_update
5188 GSI_NEW_STMT
, /* Only valid when single statement is added, move
5190 GSI_SAME_STMT
, /* Leave the iterator at the same statement. */
5191 GSI_CONTINUE_LINKING
/* Move iterator to whatever position is suitable
5192 for linking other statements in the same
5196 /* In gimple-iterator.c */
5197 gimple_stmt_iterator
gsi_start_phis (basic_block
);
5198 gimple_seq
gsi_split_seq_after (gimple_stmt_iterator
);
5199 void gsi_split_seq_before (gimple_stmt_iterator
*, gimple_seq
*);
5200 void gsi_set_stmt (gimple_stmt_iterator
*, gimple
);
5201 void gsi_replace (gimple_stmt_iterator
*, gimple
, bool);
5202 void gsi_replace_with_seq (gimple_stmt_iterator
*, gimple_seq
, bool);
5203 void gsi_insert_before (gimple_stmt_iterator
*, gimple
,
5204 enum gsi_iterator_update
);
5205 void gsi_insert_before_without_update (gimple_stmt_iterator
*, gimple
,
5206 enum gsi_iterator_update
);
5207 void gsi_insert_seq_before (gimple_stmt_iterator
*, gimple_seq
,
5208 enum gsi_iterator_update
);
5209 void gsi_insert_seq_before_without_update (gimple_stmt_iterator
*, gimple_seq
,
5210 enum gsi_iterator_update
);
5211 void gsi_insert_after (gimple_stmt_iterator
*, gimple
,
5212 enum gsi_iterator_update
);
5213 void gsi_insert_after_without_update (gimple_stmt_iterator
*, gimple
,
5214 enum gsi_iterator_update
);
5215 void gsi_insert_seq_after (gimple_stmt_iterator
*, gimple_seq
,
5216 enum gsi_iterator_update
);
5217 void gsi_insert_seq_after_without_update (gimple_stmt_iterator
*, gimple_seq
,
5218 enum gsi_iterator_update
);
5219 bool gsi_remove (gimple_stmt_iterator
*, bool);
5220 gimple_stmt_iterator
gsi_for_stmt (gimple
);
5221 void gsi_move_after (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5222 void gsi_move_before (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5223 void gsi_move_to_bb_end (gimple_stmt_iterator
*, basic_block
);
5224 void gsi_insert_on_edge (edge
, gimple
);
5225 void gsi_insert_seq_on_edge (edge
, gimple_seq
);
5226 basic_block
gsi_insert_on_edge_immediate (edge
, gimple
);
5227 basic_block
gsi_insert_seq_on_edge_immediate (edge
, gimple_seq
);
5228 void gsi_commit_one_edge_insert (edge
, basic_block
*);
5229 void gsi_commit_edge_inserts (void);
5230 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
5233 /* Convenience routines to walk all statements of a gimple function.
5234 Note that this is useful exclusively before the code is converted
5235 into SSA form. Once the program is in SSA form, the standard
5236 operand interface should be used to analyze/modify statements. */
5237 struct walk_stmt_info
5239 /* Points to the current statement being walked. */
5240 gimple_stmt_iterator gsi
;
5242 /* Additional data that the callback functions may want to carry
5243 through the recursion. */
5246 /* Pointer map used to mark visited tree nodes when calling
5247 walk_tree on each operand. If set to NULL, duplicate tree nodes
5248 will be visited more than once. */
5249 struct pointer_set_t
*pset
;
5251 /* Operand returned by the callbacks. This is set when calling
5252 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5253 returns non-NULL, this field will contain the tree returned by
5254 the last callback. */
5255 tree callback_result
;
5257 /* Indicates whether the operand being examined may be replaced
5258 with something that matches is_gimple_val (if true) or something
5259 slightly more complicated (if false). "Something" technically
5260 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5261 but we never try to form anything more complicated than that, so
5262 we don't bother checking.
5264 Also note that CALLBACK should update this flag while walking the
5265 sub-expressions of a statement. For instance, when walking the
5266 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5267 to true, however, when walking &var, the operand of that
5268 ADDR_EXPR does not need to be a GIMPLE value. */
5269 BOOL_BITFIELD val_only
: 1;
5271 /* True if we are currently walking the LHS of an assignment. */
5272 BOOL_BITFIELD is_lhs
: 1;
5274 /* Optional. Set to true by the callback functions if they made any
5276 BOOL_BITFIELD changed
: 1;
5278 /* True if we're interested in location information. */
5279 BOOL_BITFIELD want_locations
: 1;
5281 /* True if we've removed the statement that was processed. */
5282 BOOL_BITFIELD removed_stmt
: 1;
5285 /* Callback for walk_gimple_stmt. Called for every statement found
5286 during traversal. The first argument points to the statement to
5287 walk. The second argument is a flag that the callback sets to
5288 'true' if it the callback handled all the operands and
5289 sub-statements of the statement (the default value of this flag is
5290 'false'). The third argument is an anonymous pointer to data
5291 to be used by the callback. */
5292 typedef tree (*walk_stmt_fn
) (gimple_stmt_iterator
*, bool *,
5293 struct walk_stmt_info
*);
5295 gimple
walk_gimple_seq (gimple_seq
, walk_stmt_fn
, walk_tree_fn
,
5296 struct walk_stmt_info
*);
5297 gimple
walk_gimple_seq_mod (gimple_seq
*, walk_stmt_fn
, walk_tree_fn
,
5298 struct walk_stmt_info
*);
5299 tree
walk_gimple_stmt (gimple_stmt_iterator
*, walk_stmt_fn
, walk_tree_fn
,
5300 struct walk_stmt_info
*);
5301 tree
walk_gimple_op (gimple
, walk_tree_fn
, struct walk_stmt_info
*);
5303 /* Enum and arrays used for allocation stats. Keep in sync with
5304 gimple.c:gimple_alloc_kind_names. */
5305 enum gimple_alloc_kind
5307 gimple_alloc_kind_assign
, /* Assignments. */
5308 gimple_alloc_kind_phi
, /* PHI nodes. */
5309 gimple_alloc_kind_cond
, /* Conditionals. */
5310 gimple_alloc_kind_rest
, /* Everything else. */
5311 gimple_alloc_kind_all
5314 extern int gimple_alloc_counts
[];
5315 extern int gimple_alloc_sizes
[];
5317 /* Return the allocation kind for a given stmt CODE. */
5318 static inline enum gimple_alloc_kind
5319 gimple_alloc_kind (enum gimple_code code
)
5324 return gimple_alloc_kind_assign
;
5326 return gimple_alloc_kind_phi
;
5328 return gimple_alloc_kind_cond
;
5330 return gimple_alloc_kind_rest
;
5334 extern void dump_gimple_statistics (void);
5336 /* In gimple-fold.c. */
5337 void gimplify_and_update_call_from_tree (gimple_stmt_iterator
*, tree
);
5338 tree
gimple_fold_builtin (gimple
);
5339 bool fold_stmt (gimple_stmt_iterator
*);
5340 bool fold_stmt_inplace (gimple_stmt_iterator
*);
5341 tree
get_symbol_constant_value (tree
);
5342 tree
canonicalize_constructor_val (tree
, tree
);
5343 extern tree
maybe_fold_and_comparisons (enum tree_code
, tree
, tree
,
5344 enum tree_code
, tree
, tree
);
5345 extern tree
maybe_fold_or_comparisons (enum tree_code
, tree
, tree
,
5346 enum tree_code
, tree
, tree
);
5348 bool gimple_val_nonnegative_real_p (tree
);
5349 #endif /* GCC_GIMPLE_H */