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. */
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. */
144 } gimple_stmt_iterator
;
147 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
148 are for 64 bit hosts. */
150 struct GTY((chain_next ("%h.next"))) gimple_statement_base
{
152 Main identifying code for a tuple. */
153 ENUM_BITFIELD(gimple_code
) code
: 8;
155 /* Nonzero if a warning should not be emitted on this tuple. */
156 unsigned int no_warning
: 1;
158 /* Nonzero if this tuple has been visited. Passes are responsible
159 for clearing this bit before using it. */
160 unsigned int visited
: 1;
162 /* Nonzero if this tuple represents a non-temporal move. */
163 unsigned int nontemporal_move
: 1;
165 /* Pass local flags. These flags are free for any pass to use as
166 they see fit. Passes should not assume that these flags contain
167 any useful value when the pass starts. Any initial state that
168 the pass requires should be set on entry to the pass. See
169 gimple_set_plf and gimple_plf for usage. */
170 unsigned int plf
: 2;
172 /* Nonzero if this statement has been modified and needs to have its
173 operands rescanned. */
174 unsigned modified
: 1;
176 /* Nonzero if this statement contains volatile operands. */
177 unsigned has_volatile_ops
: 1;
179 /* The SUBCODE field can be used for tuple-specific flags for tuples
180 that do not require subcodes. Note that SUBCODE should be at
181 least as wide as tree codes, as several tuples store tree codes
183 unsigned int subcode
: 16;
185 /* UID of this statement. This is used by passes that want to
186 assign IDs to statements. It must be assigned and used by each
187 pass. By default it should be assumed to contain garbage. */
191 Locus information for debug info. */
194 /* Number of operands in this tuple. */
198 Basic block holding this statement. */
202 Linked lists of gimple statements. The next pointers form
203 a NULL terminated list, the prev pointers are a cyclic list.
204 A gimple statement is hence also a double-ended list of
205 statements, with the pointer itself being the first element,
206 and the prev pointer being the last. */
208 gimple
GTY((skip
)) prev
;
212 /* Base structure for tuples with operands. */
214 struct GTY(()) gimple_statement_with_ops_base
217 struct gimple_statement_base gsbase
;
220 SSA operand vectors. NOTE: It should be possible to
221 amalgamate these vectors with the operand vector OP. However,
222 the SSA operand vectors are organized differently and contain
223 more information (like immediate use chaining). */
224 struct use_optype_d
GTY((skip (""))) *use_ops
;
228 /* Statements that take register operands. */
230 struct GTY(()) gimple_statement_with_ops
233 struct gimple_statement_with_ops_base opbase
;
236 Operand vector. NOTE! This must always be the last field
237 of this structure. In particular, this means that this
238 structure cannot be embedded inside another one. */
239 tree
GTY((length ("%h.opbase.gsbase.num_ops"))) op
[1];
243 /* Base for statements that take both memory and register operands. */
245 struct GTY(()) gimple_statement_with_memory_ops_base
248 struct gimple_statement_with_ops_base opbase
;
251 Virtual operands for this statement. The GC will pick them
252 up via the ssa_names array. */
253 tree
GTY((skip (""))) vdef
;
254 tree
GTY((skip (""))) vuse
;
258 /* Statements that take both memory and register operands. */
260 struct GTY(()) gimple_statement_with_memory_ops
263 struct gimple_statement_with_memory_ops_base membase
;
266 Operand vector. NOTE! This must always be the last field
267 of this structure. In particular, this means that this
268 structure cannot be embedded inside another one. */
269 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
273 /* Call statements that take both memory and register operands. */
275 struct GTY(()) gimple_statement_call
278 struct gimple_statement_with_memory_ops_base membase
;
281 struct pt_solution call_used
;
282 struct pt_solution call_clobbered
;
285 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
286 tree
GTY ((tag ("0"))) fntype
;
287 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
291 Operand vector. NOTE! This must always be the last field
292 of this structure. In particular, this means that this
293 structure cannot be embedded inside another one. */
294 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
298 /* OpenMP statements (#pragma omp). */
300 struct GTY(()) gimple_statement_omp
{
302 struct gimple_statement_base gsbase
;
311 struct GTY(()) gimple_statement_bind
{
313 struct gimple_statement_base gsbase
;
316 Variables declared in this scope. */
320 This is different than the BLOCK field in gimple_statement_base,
321 which is analogous to TREE_BLOCK (i.e., the lexical block holding
322 this statement). This field is the equivalent of BIND_EXPR_BLOCK
323 in tree land (i.e., the lexical scope defined by this bind). See
334 struct GTY(()) gimple_statement_catch
{
336 struct gimple_statement_base gsbase
;
346 /* GIMPLE_EH_FILTER */
348 struct GTY(()) gimple_statement_eh_filter
{
350 struct gimple_statement_base gsbase
;
363 struct GTY(()) gimple_statement_eh_else
{
365 struct gimple_statement_base gsbase
;
368 gimple_seq n_body
, e_body
;
371 /* GIMPLE_EH_MUST_NOT_THROW */
373 struct GTY(()) gimple_statement_eh_mnt
{
375 struct gimple_statement_base gsbase
;
377 /* [ WORD 7 ] Abort function decl. */
383 struct GTY(()) gimple_statement_phi
{
385 struct gimple_statement_base gsbase
;
395 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
399 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
401 struct GTY(()) gimple_statement_eh_ctrl
404 struct gimple_statement_base gsbase
;
407 Exception region number. */
414 struct GTY(()) gimple_statement_try
{
416 struct gimple_statement_base gsbase
;
419 Expression to evaluate. */
423 Cleanup expression. */
427 /* Kind of GIMPLE_TRY statements. */
428 enum gimple_try_flags
431 GIMPLE_TRY_CATCH
= 1 << 0,
434 GIMPLE_TRY_FINALLY
= 1 << 1,
435 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
437 /* Analogous to TRY_CATCH_IS_CLEANUP. */
438 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
441 /* GIMPLE_WITH_CLEANUP_EXPR */
443 struct GTY(()) gimple_statement_wce
{
445 struct gimple_statement_base gsbase
;
447 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
448 executed if an exception is thrown, not on normal exit of its
449 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
453 Cleanup expression. */
460 struct GTY(()) gimple_statement_asm
463 struct gimple_statement_with_memory_ops_base membase
;
466 __asm__ statement. */
470 Number of inputs, outputs, clobbers, labels. */
477 Operand vector. NOTE! This must always be the last field
478 of this structure. In particular, this means that this
479 structure cannot be embedded inside another one. */
480 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
483 /* GIMPLE_OMP_CRITICAL */
485 struct GTY(()) gimple_statement_omp_critical
{
487 struct gimple_statement_omp omp
;
490 Critical section name. */
495 struct GTY(()) gimple_omp_for_iter
{
496 /* Condition code. */
499 /* Index variable. */
514 struct GTY(()) gimple_statement_omp_for
{
516 struct gimple_statement_omp omp
;
522 Number of elements in iter array. */
526 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
529 Pre-body evaluated before the loop body begins. */
534 /* GIMPLE_OMP_PARALLEL */
536 struct GTY(()) gimple_statement_omp_parallel
{
538 struct gimple_statement_omp omp
;
545 Child function holding the body of the parallel region. */
549 Shared data argument. */
554 /* GIMPLE_OMP_TASK */
556 struct GTY(()) gimple_statement_omp_task
{
558 struct gimple_statement_omp_parallel par
;
561 Child function holding firstprivate initialization if needed. */
565 Size and alignment in bytes of the argument data block. */
571 /* GIMPLE_OMP_SECTION */
572 /* Uses struct gimple_statement_omp. */
575 /* GIMPLE_OMP_SECTIONS */
577 struct GTY(()) gimple_statement_omp_sections
{
579 struct gimple_statement_omp omp
;
585 The control variable used for deciding which of the sections to
590 /* GIMPLE_OMP_CONTINUE.
592 Note: This does not inherit from gimple_statement_omp, because we
593 do not need the body field. */
595 struct GTY(()) gimple_statement_omp_continue
{
597 struct gimple_statement_base gsbase
;
606 /* GIMPLE_OMP_SINGLE */
608 struct GTY(()) gimple_statement_omp_single
{
610 struct gimple_statement_omp omp
;
617 /* GIMPLE_OMP_ATOMIC_LOAD.
618 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
619 contains a sequence, which we don't need here. */
621 struct GTY(()) gimple_statement_omp_atomic_load
{
623 struct gimple_statement_base gsbase
;
629 /* GIMPLE_OMP_ATOMIC_STORE.
630 See note on GIMPLE_OMP_ATOMIC_LOAD. */
632 struct GTY(()) gimple_statement_omp_atomic_store
{
634 struct gimple_statement_base gsbase
;
640 /* GIMPLE_TRANSACTION. */
642 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
644 /* The __transaction_atomic was declared [[outer]] or it is
645 __transaction_relaxed. */
646 #define GTMA_IS_OUTER (1u << 0)
647 #define GTMA_IS_RELAXED (1u << 1)
648 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
650 /* The transaction is seen to not have an abort. */
651 #define GTMA_HAVE_ABORT (1u << 2)
652 /* The transaction is seen to have loads or stores. */
653 #define GTMA_HAVE_LOAD (1u << 3)
654 #define GTMA_HAVE_STORE (1u << 4)
655 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
656 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
657 /* The transaction WILL enter serial irrevocable mode.
658 An irrevocable block post-dominates the entire transaction, such
659 that all invocations of the transaction will go serial-irrevocable.
660 In such case, we don't bother instrumenting the transaction, and
661 tell the runtime that it should begin the transaction in
662 serial-irrevocable mode. */
663 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
664 /* The transaction contains no instrumentation code whatsover, most
665 likely because it is guaranteed to go irrevocable upon entry. */
666 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
668 struct GTY(()) gimple_statement_transaction
671 struct gimple_statement_with_memory_ops_base gsbase
;
680 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
681 enum gimple_statement_structure_enum
{
682 #include "gsstruct.def"
688 /* Define the overall contents of a gimple tuple. It may be any of the
689 structures declared above for various types of tuples. */
691 union GTY ((desc ("gimple_statement_structure (&%h)"),
692 chain_next ("%h.gsbase.next"), variable_size
)) gimple_statement_d
{
693 struct gimple_statement_base
GTY ((tag ("GSS_BASE"))) gsbase
;
694 struct gimple_statement_with_ops
GTY ((tag ("GSS_WITH_OPS"))) gsops
;
695 struct gimple_statement_with_memory_ops_base
GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase
;
696 struct gimple_statement_with_memory_ops
GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem
;
697 struct gimple_statement_call
GTY ((tag ("GSS_CALL"))) gimple_call
;
698 struct gimple_statement_omp
GTY ((tag ("GSS_OMP"))) omp
;
699 struct gimple_statement_bind
GTY ((tag ("GSS_BIND"))) gimple_bind
;
700 struct gimple_statement_catch
GTY ((tag ("GSS_CATCH"))) gimple_catch
;
701 struct gimple_statement_eh_filter
GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter
;
702 struct gimple_statement_eh_mnt
GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt
;
703 struct gimple_statement_eh_else
GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else
;
704 struct gimple_statement_phi
GTY ((tag ("GSS_PHI"))) gimple_phi
;
705 struct gimple_statement_eh_ctrl
GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl
;
706 struct gimple_statement_try
GTY ((tag ("GSS_TRY"))) gimple_try
;
707 struct gimple_statement_wce
GTY ((tag ("GSS_WCE"))) gimple_wce
;
708 struct gimple_statement_asm
GTY ((tag ("GSS_ASM"))) gimple_asm
;
709 struct gimple_statement_omp_critical
GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical
;
710 struct gimple_statement_omp_for
GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for
;
711 struct gimple_statement_omp_parallel
GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel
;
712 struct gimple_statement_omp_task
GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task
;
713 struct gimple_statement_omp_sections
GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections
;
714 struct gimple_statement_omp_single
GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single
;
715 struct gimple_statement_omp_continue
GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue
;
716 struct gimple_statement_omp_atomic_load
GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load
;
717 struct gimple_statement_omp_atomic_store
GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store
;
718 struct gimple_statement_transaction
GTY((tag ("GSS_TRANSACTION"))) gimple_transaction
;
723 /* Offset in bytes to the location of the operand vector.
724 Zero if there is no operand vector for this tuple structure. */
725 extern size_t const gimple_ops_offset_
[];
727 /* Map GIMPLE codes to GSS codes. */
728 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
730 /* This variable holds the currently expanded gimple statement for purposes
731 of comminucating the profile info to the builtin expanders. */
732 extern gimple currently_expanding_gimple_stmt
;
734 gimple
gimple_build_return (tree
);
736 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
737 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
739 void extract_ops_from_tree_1 (tree
, enum tree_code
*, tree
*, tree
*, tree
*);
742 gimple_build_assign_with_ops (enum tree_code
, tree
,
743 tree
, tree CXX_MEM_STAT_INFO
);
745 gimple_build_assign_with_ops (enum tree_code
, tree
,
746 tree
, tree
, tree CXX_MEM_STAT_INFO
);
748 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
749 #define gimple_build_debug_bind(var,val,stmt) \
750 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
751 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
752 #define gimple_build_debug_source_bind(var,val,stmt) \
753 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
755 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
756 gimple
gimple_build_call (tree
, unsigned, ...);
757 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
758 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
759 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
760 gimple
gimple_build_call_from_tree (tree
);
761 gimple
gimplify_assign (tree
, tree
, gimple_seq
*);
762 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
763 gimple
gimple_build_label (tree label
);
764 gimple
gimple_build_goto (tree dest
);
765 gimple
gimple_build_nop (void);
766 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
767 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
768 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
770 gimple
gimple_build_catch (tree
, gimple_seq
);
771 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
772 gimple
gimple_build_eh_must_not_throw (tree
);
773 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
774 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
775 gimple
gimple_build_wce (gimple_seq
);
776 gimple
gimple_build_resx (int);
777 gimple
gimple_build_eh_dispatch (int);
778 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
779 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
780 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
781 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
782 gimple
gimple_build_omp_for (gimple_seq
, tree
, size_t, gimple_seq
);
783 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
784 gimple
gimple_build_omp_section (gimple_seq
);
785 gimple
gimple_build_omp_continue (tree
, tree
);
786 gimple
gimple_build_omp_master (gimple_seq
);
787 gimple
gimple_build_omp_return (bool);
788 gimple
gimple_build_omp_ordered (gimple_seq
);
789 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
790 gimple
gimple_build_omp_sections_switch (void);
791 gimple
gimple_build_omp_single (gimple_seq
, tree
);
792 gimple
gimple_build_cdt (tree
, tree
);
793 gimple
gimple_build_omp_atomic_load (tree
, tree
);
794 gimple
gimple_build_omp_atomic_store (tree
);
795 gimple
gimple_build_transaction (gimple_seq
, tree
);
796 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
797 enum gimple_statement_structure_enum
gss_for_assign (enum tree_code
);
798 void sort_case_labels (vec
<tree
> );
799 void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
800 void gimple_set_body (tree
, gimple_seq
);
801 gimple_seq
gimple_body (tree
);
802 bool gimple_has_body_p (tree
);
803 gimple_seq
gimple_seq_alloc (void);
804 void gimple_seq_free (gimple_seq
);
805 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
806 gimple_seq
gimple_seq_copy (gimple_seq
);
807 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
808 int gimple_call_flags (const_gimple
);
809 int gimple_call_return_flags (const_gimple
);
810 int gimple_call_arg_flags (const_gimple
, unsigned);
811 void gimple_call_reset_alias_info (gimple
);
812 bool gimple_assign_copy_p (gimple
);
813 bool gimple_assign_ssa_name_copy_p (gimple
);
814 bool gimple_assign_unary_nop_p (gimple
);
815 void gimple_set_bb (gimple
, basic_block
);
816 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
817 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
819 tree
gimple_get_lhs (const_gimple
);
820 void gimple_set_lhs (gimple
, tree
);
821 void gimple_replace_lhs (gimple
, tree
);
822 gimple
gimple_copy (gimple
);
823 void gimple_cond_get_ops_from_tree (tree
, enum tree_code
*, tree
*, tree
*);
824 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
825 void gimple_cond_set_condition_from_tree (gimple
, tree
);
826 bool gimple_has_side_effects (const_gimple
);
827 bool gimple_could_trap_p (gimple
);
828 bool gimple_could_trap_p_1 (gimple
, bool, bool);
829 bool gimple_assign_rhs_could_trap_p (gimple
);
830 void gimple_regimplify_operands (gimple
, gimple_stmt_iterator
*);
831 bool empty_body_p (gimple_seq
);
832 unsigned get_gimple_rhs_num_ops (enum tree_code
);
833 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
834 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
835 const char *gimple_decl_printable_name (tree
, int);
836 tree
gimple_get_virt_method_for_binfo (HOST_WIDE_INT
, tree
);
837 tree
gimple_extract_devirt_binfo_from_cst (tree
);
839 /* Returns true iff T is a scalar register variable. */
840 extern bool is_gimple_reg (tree
);
841 /* Returns true iff T is any sort of variable. */
842 extern bool is_gimple_variable (tree
);
843 /* Returns true iff T is any sort of symbol. */
844 extern bool is_gimple_id (tree
);
845 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
846 extern bool is_gimple_min_lval (tree
);
847 /* Returns true iff T is something whose address can be taken. */
848 extern bool is_gimple_addressable (tree
);
849 /* Returns true iff T is any valid GIMPLE lvalue. */
850 extern bool is_gimple_lvalue (tree
);
852 /* Returns true iff T is a GIMPLE address. */
853 bool is_gimple_address (const_tree
);
854 /* Returns true iff T is a GIMPLE invariant address. */
855 bool is_gimple_invariant_address (const_tree
);
856 /* Returns true iff T is a GIMPLE invariant address at interprocedural
858 bool is_gimple_ip_invariant_address (const_tree
);
859 /* Returns true iff T is a valid GIMPLE constant. */
860 bool is_gimple_constant (const_tree
);
861 /* Returns true iff T is a GIMPLE restricted function invariant. */
862 extern bool is_gimple_min_invariant (const_tree
);
863 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
864 extern bool is_gimple_ip_invariant (const_tree
);
865 /* Returns true iff T is a GIMPLE rvalue. */
866 extern bool is_gimple_val (tree
);
867 /* Returns true iff T is a GIMPLE asm statement input. */
868 extern bool is_gimple_asm_val (tree
);
869 /* Returns true iff T is a valid address operand of a MEM_REF. */
870 bool is_gimple_mem_ref_addr (tree
);
872 /* Returns true iff T is a valid if-statement condition. */
873 extern bool is_gimple_condexpr (tree
);
875 /* Returns true iff T is a valid call address expression. */
876 extern bool is_gimple_call_addr (tree
);
878 /* Return TRUE iff stmt is a call to a built-in function. */
879 extern bool is_gimple_builtin_call (gimple stmt
);
881 extern void recalculate_side_effects (tree
);
882 extern bool gimple_compare_field_offset (tree
, tree
);
883 extern tree
gimple_register_canonical_type (tree
);
884 extern void print_gimple_types_stats (const char *);
885 extern void free_gimple_type_tables (void);
886 extern tree
gimple_unsigned_type (tree
);
887 extern tree
gimple_signed_type (tree
);
888 extern alias_set_type
gimple_get_alias_set (tree
);
889 extern void count_uses_and_derefs (tree
, gimple
, unsigned *, unsigned *,
891 extern bool walk_stmt_load_store_addr_ops (gimple
, void *,
892 bool (*)(gimple
, tree
, void *),
893 bool (*)(gimple
, tree
, void *),
894 bool (*)(gimple
, tree
, void *));
895 extern bool walk_stmt_load_store_ops (gimple
, void *,
896 bool (*)(gimple
, tree
, void *),
897 bool (*)(gimple
, tree
, void *));
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 /* Return the first node in GIMPLE sequence S. */
1037 static inline gimple_seq_node
1038 gimple_seq_first (gimple_seq s
)
1044 /* Return the first statement in GIMPLE sequence S. */
1046 static inline gimple
1047 gimple_seq_first_stmt (gimple_seq s
)
1049 gimple_seq_node n
= gimple_seq_first (s
);
1054 /* Return the last node in GIMPLE sequence S. */
1056 static inline gimple_seq_node
1057 gimple_seq_last (gimple_seq s
)
1059 return s
? s
->gsbase
.prev
: NULL
;
1063 /* Return the last statement in GIMPLE sequence S. */
1065 static inline gimple
1066 gimple_seq_last_stmt (gimple_seq s
)
1068 gimple_seq_node n
= gimple_seq_last (s
);
1073 /* Set the last node in GIMPLE sequence *PS to LAST. */
1076 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1078 (*ps
)->gsbase
.prev
= last
;
1082 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1085 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1091 /* Return true if GIMPLE sequence S is empty. */
1094 gimple_seq_empty_p (gimple_seq s
)
1100 void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1102 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1103 *SEQ_P is NULL, a new sequence is allocated. This function is
1104 similar to gimple_seq_add_stmt, but does not scan the operands.
1105 During gimplification, we need to manipulate statement sequences
1106 before the def/use vectors have been constructed. */
1107 void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1109 /* Allocate a new sequence and initialize its first element with STMT. */
1111 static inline gimple_seq
1112 gimple_seq_alloc_with_stmt (gimple stmt
)
1114 gimple_seq seq
= NULL
;
1115 gimple_seq_add_stmt (&seq
, stmt
);
1120 /* Returns the sequence of statements in BB. */
1122 static inline gimple_seq
1123 bb_seq (const_basic_block bb
)
1125 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1128 static inline gimple_seq
*
1129 bb_seq_addr (basic_block bb
)
1131 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1134 /* Sets the sequence of statements in BB to SEQ. */
1137 set_bb_seq (basic_block bb
, gimple_seq seq
)
1139 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1140 bb
->il
.gimple
.seq
= seq
;
1144 /* Return the code for GIMPLE statement G. */
1146 static inline enum gimple_code
1147 gimple_code (const_gimple g
)
1149 return g
->gsbase
.code
;
1153 /* Return the GSS code used by a GIMPLE code. */
1155 static inline enum gimple_statement_structure_enum
1156 gss_for_code (enum gimple_code code
)
1158 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1159 return gss_for_code_
[code
];
1163 /* Return which GSS code is used by GS. */
1165 static inline enum gimple_statement_structure_enum
1166 gimple_statement_structure (gimple gs
)
1168 return gss_for_code (gimple_code (gs
));
1172 /* Return true if statement G has sub-statements. This is only true for
1173 High GIMPLE statements. */
1176 gimple_has_substatements (gimple g
)
1178 switch (gimple_code (g
))
1182 case GIMPLE_EH_FILTER
:
1183 case GIMPLE_EH_ELSE
:
1185 case GIMPLE_OMP_FOR
:
1186 case GIMPLE_OMP_MASTER
:
1187 case GIMPLE_OMP_ORDERED
:
1188 case GIMPLE_OMP_SECTION
:
1189 case GIMPLE_OMP_PARALLEL
:
1190 case GIMPLE_OMP_TASK
:
1191 case GIMPLE_OMP_SECTIONS
:
1192 case GIMPLE_OMP_SINGLE
:
1193 case GIMPLE_OMP_CRITICAL
:
1194 case GIMPLE_WITH_CLEANUP_EXPR
:
1195 case GIMPLE_TRANSACTION
:
1204 /* Return the basic block holding statement G. */
1206 static inline basic_block
1207 gimple_bb (const_gimple g
)
1209 return g
->gsbase
.bb
;
1213 /* Return the lexical scope block holding statement G. */
1216 gimple_block (const_gimple g
)
1218 return LOCATION_BLOCK (g
->gsbase
.location
);
1222 /* Set BLOCK to be the lexical scope block holding statement G. */
1225 gimple_set_block (gimple g
, tree block
)
1228 g
->gsbase
.location
=
1229 COMBINE_LOCATION_DATA (line_table
, g
->gsbase
.location
, block
);
1231 g
->gsbase
.location
= LOCATION_LOCUS (g
->gsbase
.location
);
1235 /* Return location information for statement G. */
1237 static inline location_t
1238 gimple_location (const_gimple g
)
1240 return g
->gsbase
.location
;
1243 /* Return pointer to location information for statement G. */
1245 static inline const location_t
*
1246 gimple_location_ptr (const_gimple g
)
1248 return &g
->gsbase
.location
;
1252 /* Set location information for statement G. */
1255 gimple_set_location (gimple g
, location_t location
)
1257 g
->gsbase
.location
= location
;
1261 /* Return true if G contains location information. */
1264 gimple_has_location (const_gimple g
)
1266 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1270 /* Return the file name of the location of STMT. */
1272 static inline const char *
1273 gimple_filename (const_gimple stmt
)
1275 return LOCATION_FILE (gimple_location (stmt
));
1279 /* Return the line number of the location of STMT. */
1282 gimple_lineno (const_gimple stmt
)
1284 return LOCATION_LINE (gimple_location (stmt
));
1288 /* Determine whether SEQ is a singleton. */
1291 gimple_seq_singleton_p (gimple_seq seq
)
1293 return ((gimple_seq_first (seq
) != NULL
)
1294 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1297 /* Return true if no warnings should be emitted for statement STMT. */
1300 gimple_no_warning_p (const_gimple stmt
)
1302 return stmt
->gsbase
.no_warning
;
1305 /* Set the no_warning flag of STMT to NO_WARNING. */
1308 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1310 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1313 /* Set the visited status on statement STMT to VISITED_P. */
1316 gimple_set_visited (gimple stmt
, bool visited_p
)
1318 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1322 /* Return the visited status for statement STMT. */
1325 gimple_visited_p (gimple stmt
)
1327 return stmt
->gsbase
.visited
;
1331 /* Set pass local flag PLF on statement STMT to VAL_P. */
1334 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1337 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1339 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1343 /* Return the value of pass local flag PLF on statement STMT. */
1345 static inline unsigned int
1346 gimple_plf (gimple stmt
, enum plf_mask plf
)
1348 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1352 /* Set the UID of statement. */
1355 gimple_set_uid (gimple g
, unsigned uid
)
1357 g
->gsbase
.uid
= uid
;
1361 /* Return the UID of statement. */
1363 static inline unsigned
1364 gimple_uid (const_gimple g
)
1366 return g
->gsbase
.uid
;
1370 /* Make statement G a singleton sequence. */
1373 gimple_init_singleton (gimple g
)
1375 g
->gsbase
.next
= NULL
;
1380 /* Return true if GIMPLE statement G has register or memory operands. */
1383 gimple_has_ops (const_gimple g
)
1385 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1389 /* Return true if GIMPLE statement G has memory operands. */
1392 gimple_has_mem_ops (const_gimple g
)
1394 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1398 /* Return the set of USE operands for statement G. */
1400 static inline struct use_optype_d
*
1401 gimple_use_ops (const_gimple g
)
1403 if (!gimple_has_ops (g
))
1405 return g
->gsops
.opbase
.use_ops
;
1409 /* Set USE to be the set of USE operands for statement G. */
1412 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1414 gcc_gimple_checking_assert (gimple_has_ops (g
));
1415 g
->gsops
.opbase
.use_ops
= use
;
1419 /* Return the set of VUSE operand for statement G. */
1421 static inline use_operand_p
1422 gimple_vuse_op (const_gimple g
)
1424 struct use_optype_d
*ops
;
1425 if (!gimple_has_mem_ops (g
))
1426 return NULL_USE_OPERAND_P
;
1427 ops
= g
->gsops
.opbase
.use_ops
;
1429 && USE_OP_PTR (ops
)->use
== &g
->gsmembase
.vuse
)
1430 return USE_OP_PTR (ops
);
1431 return NULL_USE_OPERAND_P
;
1434 /* Return the set of VDEF operand for statement G. */
1436 static inline def_operand_p
1437 gimple_vdef_op (gimple g
)
1439 if (!gimple_has_mem_ops (g
))
1440 return NULL_DEF_OPERAND_P
;
1441 if (g
->gsmembase
.vdef
)
1442 return &g
->gsmembase
.vdef
;
1443 return NULL_DEF_OPERAND_P
;
1447 /* Return the single VUSE operand of the statement G. */
1450 gimple_vuse (const_gimple g
)
1452 if (!gimple_has_mem_ops (g
))
1454 return g
->gsmembase
.vuse
;
1457 /* Return the single VDEF operand of the statement G. */
1460 gimple_vdef (const_gimple g
)
1462 if (!gimple_has_mem_ops (g
))
1464 return g
->gsmembase
.vdef
;
1467 /* Return the single VUSE operand of the statement G. */
1469 static inline tree
*
1470 gimple_vuse_ptr (gimple g
)
1472 if (!gimple_has_mem_ops (g
))
1474 return &g
->gsmembase
.vuse
;
1477 /* Return the single VDEF operand of the statement G. */
1479 static inline tree
*
1480 gimple_vdef_ptr (gimple g
)
1482 if (!gimple_has_mem_ops (g
))
1484 return &g
->gsmembase
.vdef
;
1487 /* Set the single VUSE operand of the statement G. */
1490 gimple_set_vuse (gimple g
, tree vuse
)
1492 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1493 g
->gsmembase
.vuse
= vuse
;
1496 /* Set the single VDEF operand of the statement G. */
1499 gimple_set_vdef (gimple g
, tree vdef
)
1501 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1502 g
->gsmembase
.vdef
= vdef
;
1506 /* Return true if statement G has operands and the modified field has
1510 gimple_modified_p (const_gimple g
)
1512 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1516 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1517 a MODIFIED field. */
1520 gimple_set_modified (gimple s
, bool modifiedp
)
1522 if (gimple_has_ops (s
))
1523 s
->gsbase
.modified
= (unsigned) modifiedp
;
1527 /* Return the tree code for the expression computed by STMT. This is
1528 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1529 GIMPLE_CALL, return CALL_EXPR as the expression code for
1530 consistency. This is useful when the caller needs to deal with the
1531 three kinds of computation that GIMPLE supports. */
1533 static inline enum tree_code
1534 gimple_expr_code (const_gimple stmt
)
1536 enum gimple_code code
= gimple_code (stmt
);
1537 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1538 return (enum tree_code
) stmt
->gsbase
.subcode
;
1541 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1547 /* Mark statement S as modified, and update it. */
1550 update_stmt (gimple s
)
1552 if (gimple_has_ops (s
))
1554 gimple_set_modified (s
, true);
1555 update_stmt_operands (s
);
1559 /* Update statement S if it has been optimized. */
1562 update_stmt_if_modified (gimple s
)
1564 if (gimple_modified_p (s
))
1565 update_stmt_operands (s
);
1568 /* Return true if statement STMT contains volatile operands. */
1571 gimple_has_volatile_ops (const_gimple stmt
)
1573 if (gimple_has_mem_ops (stmt
))
1574 return stmt
->gsbase
.has_volatile_ops
;
1580 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1583 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1585 if (gimple_has_mem_ops (stmt
))
1586 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1589 /* Return true if BB is in a transaction. */
1592 block_in_transaction (basic_block bb
)
1594 return flag_tm
&& bb
->flags
& BB_IN_TRANSACTION
;
1597 /* Return true if STMT is in a transaction. */
1600 gimple_in_transaction (gimple stmt
)
1602 return block_in_transaction (gimple_bb (stmt
));
1605 /* Return true if statement STMT may access memory. */
1608 gimple_references_memory_p (gimple stmt
)
1610 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1614 /* Return the subcode for OMP statement S. */
1616 static inline unsigned
1617 gimple_omp_subcode (const_gimple s
)
1619 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1620 && gimple_code (s
) <= GIMPLE_OMP_SINGLE
);
1621 return s
->gsbase
.subcode
;
1624 /* Set the subcode for OMP statement S to SUBCODE. */
1627 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1629 /* We only have 16 bits for the subcode. Assert that we are not
1631 gcc_gimple_checking_assert (subcode
< (1 << 16));
1632 s
->gsbase
.subcode
= subcode
;
1635 /* Set the nowait flag on OMP_RETURN statement S. */
1638 gimple_omp_return_set_nowait (gimple s
)
1640 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1641 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1645 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1649 gimple_omp_return_nowait_p (const_gimple g
)
1651 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1652 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1656 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1660 gimple_omp_section_last_p (const_gimple g
)
1662 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1663 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1667 /* Set the GF_OMP_SECTION_LAST flag on G. */
1670 gimple_omp_section_set_last (gimple g
)
1672 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1673 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1677 /* Return true if OMP parallel statement G has the
1678 GF_OMP_PARALLEL_COMBINED flag set. */
1681 gimple_omp_parallel_combined_p (const_gimple g
)
1683 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1684 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1688 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1689 value of COMBINED_P. */
1692 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1694 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1696 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1698 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1702 /* Return true if OMP atomic load/store statement G has the
1703 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1706 gimple_omp_atomic_need_value_p (const_gimple g
)
1708 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1709 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1710 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
1714 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1717 gimple_omp_atomic_set_need_value (gimple g
)
1719 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1720 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1721 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
1725 /* Return the number of operands for statement GS. */
1727 static inline unsigned
1728 gimple_num_ops (const_gimple gs
)
1730 return gs
->gsbase
.num_ops
;
1734 /* Set the number of operands for statement GS. */
1737 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1739 gs
->gsbase
.num_ops
= num_ops
;
1743 /* Return the array of operands for statement GS. */
1745 static inline tree
*
1746 gimple_ops (gimple gs
)
1750 /* All the tuples have their operand vector at the very bottom
1751 of the structure. Note that those structures that do not
1752 have an operand vector have a zero offset. */
1753 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1754 gcc_gimple_checking_assert (off
!= 0);
1756 return (tree
*) ((char *) gs
+ off
);
1760 /* Return operand I for statement GS. */
1763 gimple_op (const_gimple gs
, unsigned i
)
1765 if (gimple_has_ops (gs
))
1767 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1768 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1774 /* Return a pointer to operand I for statement GS. */
1776 static inline tree
*
1777 gimple_op_ptr (const_gimple gs
, unsigned i
)
1779 if (gimple_has_ops (gs
))
1781 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1782 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1788 /* Set operand I of statement GS to OP. */
1791 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1793 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1795 /* Note. It may be tempting to assert that OP matches
1796 is_gimple_operand, but that would be wrong. Different tuples
1797 accept slightly different sets of tree operands. Each caller
1798 should perform its own validation. */
1799 gimple_ops (gs
)[i
] = op
;
1802 /* Return true if GS is a GIMPLE_ASSIGN. */
1805 is_gimple_assign (const_gimple gs
)
1807 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1810 /* Determine if expression CODE is one of the valid expressions that can
1811 be used on the RHS of GIMPLE assignments. */
1813 static inline enum gimple_rhs_class
1814 get_gimple_rhs_class (enum tree_code code
)
1816 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1819 /* Return the LHS of assignment statement GS. */
1822 gimple_assign_lhs (const_gimple gs
)
1824 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1825 return gimple_op (gs
, 0);
1829 /* Return a pointer to the LHS of assignment statement GS. */
1831 static inline tree
*
1832 gimple_assign_lhs_ptr (const_gimple gs
)
1834 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1835 return gimple_op_ptr (gs
, 0);
1839 /* Set LHS to be the LHS operand of assignment statement GS. */
1842 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1844 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1845 gimple_set_op (gs
, 0, lhs
);
1847 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1848 SSA_NAME_DEF_STMT (lhs
) = gs
;
1852 /* Return the first operand on the RHS of assignment statement GS. */
1855 gimple_assign_rhs1 (const_gimple gs
)
1857 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1858 return gimple_op (gs
, 1);
1862 /* Return a pointer to the first operand on the RHS of assignment
1865 static inline tree
*
1866 gimple_assign_rhs1_ptr (const_gimple gs
)
1868 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1869 return gimple_op_ptr (gs
, 1);
1872 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1875 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1877 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1879 gimple_set_op (gs
, 1, rhs
);
1883 /* Return the second operand on the RHS of assignment statement GS.
1884 If GS does not have two operands, NULL is returned instead. */
1887 gimple_assign_rhs2 (const_gimple gs
)
1889 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1891 if (gimple_num_ops (gs
) >= 3)
1892 return gimple_op (gs
, 2);
1898 /* Return a pointer to the second operand on the RHS of assignment
1901 static inline tree
*
1902 gimple_assign_rhs2_ptr (const_gimple gs
)
1904 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1905 return gimple_op_ptr (gs
, 2);
1909 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1912 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1914 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1916 gimple_set_op (gs
, 2, rhs
);
1919 /* Return the third operand on the RHS of assignment statement GS.
1920 If GS does not have two operands, NULL is returned instead. */
1923 gimple_assign_rhs3 (const_gimple gs
)
1925 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1927 if (gimple_num_ops (gs
) >= 4)
1928 return gimple_op (gs
, 3);
1933 /* Return a pointer to the third operand on the RHS of assignment
1936 static inline tree
*
1937 gimple_assign_rhs3_ptr (const_gimple gs
)
1939 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1940 return gimple_op_ptr (gs
, 3);
1944 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1947 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
1949 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1951 gimple_set_op (gs
, 3, rhs
);
1954 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1955 to see only a maximum of two operands. */
1958 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
1961 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
1964 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1965 to see only a maximum of two operands. */
1968 extract_ops_from_tree (tree expr
, enum tree_code
*code
, tree
*op0
,
1972 extract_ops_from_tree_1 (expr
, code
, op0
, op1
, &op2
);
1973 gcc_assert (op2
== NULL_TREE
);
1976 /* Returns true if GS is a nontemporal move. */
1979 gimple_assign_nontemporal_move_p (const_gimple gs
)
1981 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1982 return gs
->gsbase
.nontemporal_move
;
1985 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1988 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
1990 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1991 gs
->gsbase
.nontemporal_move
= nontemporal
;
1995 /* Return the code of the expression computed on the rhs of assignment
1996 statement GS. In case that the RHS is a single object, returns the
1997 tree code of the object. */
1999 static inline enum tree_code
2000 gimple_assign_rhs_code (const_gimple gs
)
2002 enum tree_code code
;
2003 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2005 code
= (enum tree_code
) gs
->gsbase
.subcode
;
2006 /* While we initially set subcode to the TREE_CODE of the rhs for
2007 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2008 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2009 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2010 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2016 /* Set CODE to be the code for the expression computed on the RHS of
2020 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2022 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2023 s
->gsbase
.subcode
= code
;
2027 /* Return the gimple rhs class of the code of the expression computed on
2028 the rhs of assignment statement GS.
2029 This will never return GIMPLE_INVALID_RHS. */
2031 static inline enum gimple_rhs_class
2032 gimple_assign_rhs_class (const_gimple gs
)
2034 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2037 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2038 there is no operator associated with the assignment itself.
2039 Unlike gimple_assign_copy_p, this predicate returns true for
2040 any RHS operand, including those that perform an operation
2041 and do not have the semantics of a copy, such as COND_EXPR. */
2044 gimple_assign_single_p (gimple gs
)
2046 return (is_gimple_assign (gs
)
2047 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2050 /* Return true if GS performs a store to its lhs. */
2053 gimple_store_p (gimple gs
)
2055 tree lhs
= gimple_get_lhs (gs
);
2056 return lhs
&& !is_gimple_reg (lhs
);
2059 /* Return true if GS is an assignment that loads from its rhs1. */
2062 gimple_assign_load_p (gimple gs
)
2065 if (!gimple_assign_single_p (gs
))
2067 rhs
= gimple_assign_rhs1 (gs
);
2068 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2070 rhs
= get_base_address (rhs
);
2071 return (DECL_P (rhs
)
2072 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2076 /* Return true if S is a type-cast assignment. */
2079 gimple_assign_cast_p (gimple s
)
2081 if (is_gimple_assign (s
))
2083 enum tree_code sc
= gimple_assign_rhs_code (s
);
2084 return CONVERT_EXPR_CODE_P (sc
)
2085 || sc
== VIEW_CONVERT_EXPR
2086 || sc
== FIX_TRUNC_EXPR
;
2092 /* Return true if S is a clobber statement. */
2095 gimple_clobber_p (gimple s
)
2097 return gimple_assign_single_p (s
)
2098 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2101 /* Return true if GS is a GIMPLE_CALL. */
2104 is_gimple_call (const_gimple gs
)
2106 return gimple_code (gs
) == GIMPLE_CALL
;
2109 /* Return the LHS of call statement GS. */
2112 gimple_call_lhs (const_gimple gs
)
2114 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2115 return gimple_op (gs
, 0);
2119 /* Return a pointer to the LHS of call statement GS. */
2121 static inline tree
*
2122 gimple_call_lhs_ptr (const_gimple gs
)
2124 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2125 return gimple_op_ptr (gs
, 0);
2129 /* Set LHS to be the LHS operand of call statement GS. */
2132 gimple_call_set_lhs (gimple gs
, tree lhs
)
2134 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2135 gimple_set_op (gs
, 0, lhs
);
2136 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2137 SSA_NAME_DEF_STMT (lhs
) = gs
;
2141 /* Return true if call GS calls an internal-only function, as enumerated
2145 gimple_call_internal_p (const_gimple gs
)
2147 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2148 return (gs
->gsbase
.subcode
& GF_CALL_INTERNAL
) != 0;
2152 /* Return the target of internal call GS. */
2154 static inline enum internal_fn
2155 gimple_call_internal_fn (const_gimple gs
)
2157 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2158 return gs
->gimple_call
.u
.internal_fn
;
2162 /* Return the function type of the function called by GS. */
2165 gimple_call_fntype (const_gimple gs
)
2167 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2168 if (gimple_call_internal_p (gs
))
2170 return gs
->gimple_call
.u
.fntype
;
2173 /* Set the type of the function called by GS to FNTYPE. */
2176 gimple_call_set_fntype (gimple gs
, tree fntype
)
2178 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2179 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2180 gs
->gimple_call
.u
.fntype
= fntype
;
2184 /* Return the tree node representing the function called by call
2188 gimple_call_fn (const_gimple gs
)
2190 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2191 return gimple_op (gs
, 1);
2194 /* Return a pointer to the tree node representing the function called by call
2197 static inline tree
*
2198 gimple_call_fn_ptr (const_gimple gs
)
2200 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2201 return gimple_op_ptr (gs
, 1);
2205 /* Set FN to be the function called by call statement GS. */
2208 gimple_call_set_fn (gimple gs
, tree fn
)
2210 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2211 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2212 gimple_set_op (gs
, 1, fn
);
2216 /* Set FNDECL to be the function called by call statement GS. */
2219 gimple_call_set_fndecl (gimple gs
, tree decl
)
2221 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2222 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2223 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2227 /* Set internal function FN to be the function called by call statement GS. */
2230 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2232 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2233 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2234 gs
->gimple_call
.u
.internal_fn
= fn
;
2238 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2239 associated with the callee if known. Otherwise return NULL_TREE. */
2242 gimple_call_addr_fndecl (const_tree fn
)
2244 if (fn
&& TREE_CODE (fn
) == ADDR_EXPR
)
2246 tree fndecl
= TREE_OPERAND (fn
, 0);
2247 if (TREE_CODE (fndecl
) == MEM_REF
2248 && TREE_CODE (TREE_OPERAND (fndecl
, 0)) == ADDR_EXPR
2249 && integer_zerop (TREE_OPERAND (fndecl
, 1)))
2250 fndecl
= TREE_OPERAND (TREE_OPERAND (fndecl
, 0), 0);
2251 if (TREE_CODE (fndecl
) == FUNCTION_DECL
)
2257 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2258 Otherwise return NULL. This function is analogous to
2259 get_callee_fndecl in tree land. */
2262 gimple_call_fndecl (const_gimple gs
)
2264 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2268 /* Return the type returned by call statement GS. */
2271 gimple_call_return_type (const_gimple gs
)
2273 tree type
= gimple_call_fntype (gs
);
2275 if (type
== NULL_TREE
)
2276 return TREE_TYPE (gimple_call_lhs (gs
));
2278 /* The type returned by a function is the type of its
2280 return TREE_TYPE (type
);
2284 /* Return the static chain for call statement GS. */
2287 gimple_call_chain (const_gimple gs
)
2289 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2290 return gimple_op (gs
, 2);
2294 /* Return a pointer to the static chain for call statement GS. */
2296 static inline tree
*
2297 gimple_call_chain_ptr (const_gimple gs
)
2299 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2300 return gimple_op_ptr (gs
, 2);
2303 /* Set CHAIN to be the static chain for call statement GS. */
2306 gimple_call_set_chain (gimple gs
, tree chain
)
2308 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2310 gimple_set_op (gs
, 2, chain
);
2314 /* Return the number of arguments used by call statement GS. */
2316 static inline unsigned
2317 gimple_call_num_args (const_gimple gs
)
2320 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2321 num_ops
= gimple_num_ops (gs
);
2326 /* Return the argument at position INDEX for call statement GS. */
2329 gimple_call_arg (const_gimple gs
, unsigned index
)
2331 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2332 return gimple_op (gs
, index
+ 3);
2336 /* Return a pointer to the argument at position INDEX for call
2339 static inline tree
*
2340 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2342 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2343 return gimple_op_ptr (gs
, index
+ 3);
2347 /* Set ARG to be the argument at position INDEX for call statement GS. */
2350 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2352 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2353 gimple_set_op (gs
, index
+ 3, arg
);
2357 /* If TAIL_P is true, mark call statement S as being a tail call
2358 (i.e., a call just before the exit of a function). These calls are
2359 candidate for tail call optimization. */
2362 gimple_call_set_tail (gimple s
, bool tail_p
)
2364 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2366 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2368 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2372 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2375 gimple_call_tail_p (gimple s
)
2377 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2378 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2382 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2383 slot optimization. This transformation uses the target of the call
2384 expansion as the return slot for calls that return in memory. */
2387 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2389 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2390 if (return_slot_opt_p
)
2391 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2393 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2397 /* Return true if S is marked for return slot optimization. */
2400 gimple_call_return_slot_opt_p (gimple s
)
2402 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2403 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2407 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2408 thunk to the thunked-to function. */
2411 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2413 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2415 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2417 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2421 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2424 gimple_call_from_thunk_p (gimple s
)
2426 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2427 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2431 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2432 argument pack in its argument list. */
2435 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2437 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2438 if (pass_arg_pack_p
)
2439 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2441 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2445 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2446 argument pack in its argument list. */
2449 gimple_call_va_arg_pack_p (gimple s
)
2451 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2452 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2456 /* Return true if S is a noreturn call. */
2459 gimple_call_noreturn_p (gimple s
)
2461 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2462 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2466 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2467 even if the called function can throw in other cases. */
2470 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2472 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2474 s
->gsbase
.subcode
|= GF_CALL_NOTHROW
;
2476 s
->gsbase
.subcode
&= ~GF_CALL_NOTHROW
;
2479 /* Return true if S is a nothrow call. */
2482 gimple_call_nothrow_p (gimple s
)
2484 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2485 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2488 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2489 is known to be emitted for VLA objects. Those are wrapped by
2490 stack_save/stack_restore calls and hence can't lead to unbounded
2491 stack growth even when they occur in loops. */
2494 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2496 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2498 s
->gsbase
.subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2500 s
->gsbase
.subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2503 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2506 gimple_call_alloca_for_var_p (gimple s
)
2508 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2509 return (s
->gsbase
.subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2512 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2515 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2517 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2518 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2519 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2523 /* Return a pointer to the points-to solution for the set of call-used
2524 variables of the call CALL. */
2526 static inline struct pt_solution
*
2527 gimple_call_use_set (gimple call
)
2529 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2530 return &call
->gimple_call
.call_used
;
2534 /* Return a pointer to the points-to solution for the set of call-used
2535 variables of the call CALL. */
2537 static inline struct pt_solution
*
2538 gimple_call_clobber_set (gimple call
)
2540 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2541 return &call
->gimple_call
.call_clobbered
;
2545 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2549 gimple_has_lhs (gimple stmt
)
2551 return (is_gimple_assign (stmt
)
2552 || (is_gimple_call (stmt
)
2553 && gimple_call_lhs (stmt
) != NULL_TREE
));
2557 /* Return the code of the predicate computed by conditional statement GS. */
2559 static inline enum tree_code
2560 gimple_cond_code (const_gimple gs
)
2562 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2563 return (enum tree_code
) gs
->gsbase
.subcode
;
2567 /* Set CODE to be the predicate code for the conditional statement GS. */
2570 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2572 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2573 gs
->gsbase
.subcode
= code
;
2577 /* Return the LHS of the predicate computed by conditional statement GS. */
2580 gimple_cond_lhs (const_gimple gs
)
2582 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2583 return gimple_op (gs
, 0);
2586 /* Return the pointer to the LHS of the predicate computed by conditional
2589 static inline tree
*
2590 gimple_cond_lhs_ptr (const_gimple gs
)
2592 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2593 return gimple_op_ptr (gs
, 0);
2596 /* Set LHS to be the LHS operand of the predicate computed by
2597 conditional statement GS. */
2600 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2602 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2603 gimple_set_op (gs
, 0, lhs
);
2607 /* Return the RHS operand of the predicate computed by conditional GS. */
2610 gimple_cond_rhs (const_gimple gs
)
2612 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2613 return gimple_op (gs
, 1);
2616 /* Return the pointer to the RHS operand of the predicate computed by
2619 static inline tree
*
2620 gimple_cond_rhs_ptr (const_gimple gs
)
2622 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2623 return gimple_op_ptr (gs
, 1);
2627 /* Set RHS to be the RHS operand of the predicate computed by
2628 conditional statement GS. */
2631 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2633 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2634 gimple_set_op (gs
, 1, rhs
);
2638 /* Return the label used by conditional statement GS when its
2639 predicate evaluates to true. */
2642 gimple_cond_true_label (const_gimple gs
)
2644 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2645 return gimple_op (gs
, 2);
2649 /* Set LABEL to be the label used by conditional statement GS when its
2650 predicate evaluates to true. */
2653 gimple_cond_set_true_label (gimple gs
, tree label
)
2655 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2656 gimple_set_op (gs
, 2, label
);
2660 /* Set LABEL to be the label used by conditional statement GS when its
2661 predicate evaluates to false. */
2664 gimple_cond_set_false_label (gimple gs
, tree label
)
2666 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2667 gimple_set_op (gs
, 3, label
);
2671 /* Return the label used by conditional statement GS when its
2672 predicate evaluates to false. */
2675 gimple_cond_false_label (const_gimple gs
)
2677 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2678 return gimple_op (gs
, 3);
2682 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2685 gimple_cond_make_false (gimple gs
)
2687 gimple_cond_set_lhs (gs
, boolean_true_node
);
2688 gimple_cond_set_rhs (gs
, boolean_false_node
);
2689 gs
->gsbase
.subcode
= EQ_EXPR
;
2693 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2696 gimple_cond_make_true (gimple gs
)
2698 gimple_cond_set_lhs (gs
, boolean_true_node
);
2699 gimple_cond_set_rhs (gs
, boolean_true_node
);
2700 gs
->gsbase
.subcode
= EQ_EXPR
;
2703 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2704 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2707 gimple_cond_true_p (const_gimple gs
)
2709 tree lhs
= gimple_cond_lhs (gs
);
2710 tree rhs
= gimple_cond_rhs (gs
);
2711 enum tree_code code
= gimple_cond_code (gs
);
2713 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2716 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2719 if (code
== NE_EXPR
&& lhs
!= rhs
)
2722 if (code
== EQ_EXPR
&& lhs
== rhs
)
2728 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2729 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2732 gimple_cond_false_p (const_gimple gs
)
2734 tree lhs
= gimple_cond_lhs (gs
);
2735 tree rhs
= gimple_cond_rhs (gs
);
2736 enum tree_code code
= gimple_cond_code (gs
);
2738 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2741 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2744 if (code
== NE_EXPR
&& lhs
== rhs
)
2747 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2753 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2756 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2758 gimple_cond_set_code (stmt
, code
);
2759 gimple_cond_set_lhs (stmt
, lhs
);
2760 gimple_cond_set_rhs (stmt
, rhs
);
2763 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2766 gimple_label_label (const_gimple gs
)
2768 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2769 return gimple_op (gs
, 0);
2773 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2777 gimple_label_set_label (gimple gs
, tree label
)
2779 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2780 gimple_set_op (gs
, 0, label
);
2784 /* Return the destination of the unconditional jump GS. */
2787 gimple_goto_dest (const_gimple gs
)
2789 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2790 return gimple_op (gs
, 0);
2794 /* Set DEST to be the destination of the unconditonal jump GS. */
2797 gimple_goto_set_dest (gimple gs
, tree dest
)
2799 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2800 gimple_set_op (gs
, 0, dest
);
2804 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2807 gimple_bind_vars (const_gimple gs
)
2809 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2810 return gs
->gimple_bind
.vars
;
2814 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2818 gimple_bind_set_vars (gimple gs
, tree vars
)
2820 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2821 gs
->gimple_bind
.vars
= vars
;
2825 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2829 gimple_bind_append_vars (gimple gs
, tree vars
)
2831 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2832 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2836 static inline gimple_seq
*
2837 gimple_bind_body_ptr (gimple gs
)
2839 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2840 return &gs
->gimple_bind
.body
;
2843 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2845 static inline gimple_seq
2846 gimple_bind_body (gimple gs
)
2848 return *gimple_bind_body_ptr (gs
);
2852 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2856 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2858 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2859 gs
->gimple_bind
.body
= seq
;
2863 /* Append a statement to the end of a GIMPLE_BIND's body. */
2866 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2868 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2869 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2873 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2876 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2878 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2879 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2883 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2884 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2887 gimple_bind_block (const_gimple gs
)
2889 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2890 return gs
->gimple_bind
.block
;
2894 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2898 gimple_bind_set_block (gimple gs
, tree block
)
2900 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2901 gcc_gimple_checking_assert (block
== NULL_TREE
2902 || TREE_CODE (block
) == BLOCK
);
2903 gs
->gimple_bind
.block
= block
;
2907 /* Return the number of input operands for GIMPLE_ASM GS. */
2909 static inline unsigned
2910 gimple_asm_ninputs (const_gimple gs
)
2912 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2913 return gs
->gimple_asm
.ni
;
2917 /* Return the number of output operands for GIMPLE_ASM GS. */
2919 static inline unsigned
2920 gimple_asm_noutputs (const_gimple gs
)
2922 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2923 return gs
->gimple_asm
.no
;
2927 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2929 static inline unsigned
2930 gimple_asm_nclobbers (const_gimple gs
)
2932 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2933 return gs
->gimple_asm
.nc
;
2936 /* Return the number of label operands for GIMPLE_ASM GS. */
2938 static inline unsigned
2939 gimple_asm_nlabels (const_gimple gs
)
2941 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2942 return gs
->gimple_asm
.nl
;
2945 /* Return input operand INDEX of GIMPLE_ASM GS. */
2948 gimple_asm_input_op (const_gimple gs
, unsigned index
)
2950 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2951 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2952 return gimple_op (gs
, index
+ gs
->gimple_asm
.no
);
2955 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2957 static inline tree
*
2958 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
2960 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2961 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
2962 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.no
);
2966 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2969 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
2971 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2972 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
2973 && TREE_CODE (in_op
) == TREE_LIST
);
2974 gimple_set_op (gs
, index
+ gs
->gimple_asm
.no
, in_op
);
2978 /* Return output operand INDEX of GIMPLE_ASM GS. */
2981 gimple_asm_output_op (const_gimple gs
, unsigned index
)
2983 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2984 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
2985 return gimple_op (gs
, index
);
2988 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2990 static inline tree
*
2991 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
2993 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2994 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
2995 return gimple_op_ptr (gs
, index
);
2999 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3002 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
3004 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3005 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
3006 && TREE_CODE (out_op
) == TREE_LIST
);
3007 gimple_set_op (gs
, index
, out_op
);
3011 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3014 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3016 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3017 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
);
3018 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
3022 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3025 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3027 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3028 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
3029 && TREE_CODE (clobber_op
) == TREE_LIST
);
3030 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
3033 /* Return label operand INDEX of GIMPLE_ASM GS. */
3036 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3038 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3039 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
);
3040 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
3043 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3046 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3048 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3049 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
3050 && TREE_CODE (label_op
) == TREE_LIST
);
3051 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
3054 /* Return the string representing the assembly instruction in
3057 static inline const char *
3058 gimple_asm_string (const_gimple gs
)
3060 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3061 return gs
->gimple_asm
.string
;
3065 /* Return true if GS is an asm statement marked volatile. */
3068 gimple_asm_volatile_p (const_gimple gs
)
3070 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3071 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
3075 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3078 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3080 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3082 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
3084 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
3088 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3091 gimple_asm_set_input (gimple gs
, bool input_p
)
3093 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3095 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
3097 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
3101 /* Return true if asm GS is an ASM_INPUT. */
3104 gimple_asm_input_p (const_gimple gs
)
3106 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3107 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
3111 /* Return the types handled by GIMPLE_CATCH statement GS. */
3114 gimple_catch_types (const_gimple gs
)
3116 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3117 return gs
->gimple_catch
.types
;
3121 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3123 static inline tree
*
3124 gimple_catch_types_ptr (gimple gs
)
3126 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3127 return &gs
->gimple_catch
.types
;
3131 /* Return a pointer to the GIMPLE sequence representing the body of
3132 the handler of GIMPLE_CATCH statement GS. */
3134 static inline gimple_seq
*
3135 gimple_catch_handler_ptr (gimple gs
)
3137 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3138 return &gs
->gimple_catch
.handler
;
3142 /* Return the GIMPLE sequence representing the body of the handler of
3143 GIMPLE_CATCH statement GS. */
3145 static inline gimple_seq
3146 gimple_catch_handler (gimple gs
)
3148 return *gimple_catch_handler_ptr (gs
);
3152 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3155 gimple_catch_set_types (gimple gs
, tree t
)
3157 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3158 gs
->gimple_catch
.types
= t
;
3162 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3165 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3167 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3168 gs
->gimple_catch
.handler
= handler
;
3172 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3175 gimple_eh_filter_types (const_gimple gs
)
3177 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3178 return gs
->gimple_eh_filter
.types
;
3182 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3185 static inline tree
*
3186 gimple_eh_filter_types_ptr (gimple gs
)
3188 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3189 return &gs
->gimple_eh_filter
.types
;
3193 /* Return a pointer to the sequence of statement to execute when
3194 GIMPLE_EH_FILTER statement fails. */
3196 static inline gimple_seq
*
3197 gimple_eh_filter_failure_ptr (gimple gs
)
3199 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3200 return &gs
->gimple_eh_filter
.failure
;
3204 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3207 static inline gimple_seq
3208 gimple_eh_filter_failure (gimple gs
)
3210 return *gimple_eh_filter_failure_ptr (gs
);
3214 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3217 gimple_eh_filter_set_types (gimple gs
, tree types
)
3219 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3220 gs
->gimple_eh_filter
.types
= types
;
3224 /* Set FAILURE to be the sequence of statements to execute on failure
3225 for GIMPLE_EH_FILTER GS. */
3228 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3230 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3231 gs
->gimple_eh_filter
.failure
= failure
;
3234 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3237 gimple_eh_must_not_throw_fndecl (gimple gs
)
3239 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3240 return gs
->gimple_eh_mnt
.fndecl
;
3243 /* Set the function decl to be called by GS to DECL. */
3246 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3248 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3249 gs
->gimple_eh_mnt
.fndecl
= decl
;
3252 /* GIMPLE_EH_ELSE accessors. */
3254 static inline gimple_seq
*
3255 gimple_eh_else_n_body_ptr (gimple gs
)
3257 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3258 return &gs
->gimple_eh_else
.n_body
;
3261 static inline gimple_seq
3262 gimple_eh_else_n_body (gimple gs
)
3264 return *gimple_eh_else_n_body_ptr (gs
);
3267 static inline gimple_seq
*
3268 gimple_eh_else_e_body_ptr (gimple gs
)
3270 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3271 return &gs
->gimple_eh_else
.e_body
;
3274 static inline gimple_seq
3275 gimple_eh_else_e_body (gimple gs
)
3277 return *gimple_eh_else_e_body_ptr (gs
);
3281 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3283 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3284 gs
->gimple_eh_else
.n_body
= seq
;
3288 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3290 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3291 gs
->gimple_eh_else
.e_body
= seq
;
3294 /* GIMPLE_TRY accessors. */
3296 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3297 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3299 static inline enum gimple_try_flags
3300 gimple_try_kind (const_gimple gs
)
3302 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3303 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
3307 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3310 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3312 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3313 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3314 || kind
== GIMPLE_TRY_FINALLY
);
3315 if (gimple_try_kind (gs
) != kind
)
3316 gs
->gsbase
.subcode
= (unsigned int) kind
;
3320 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3323 gimple_try_catch_is_cleanup (const_gimple gs
)
3325 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3326 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3330 /* Return a pointer to the sequence of statements used as the
3331 body for GIMPLE_TRY GS. */
3333 static inline gimple_seq
*
3334 gimple_try_eval_ptr (gimple gs
)
3336 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3337 return &gs
->gimple_try
.eval
;
3341 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3343 static inline gimple_seq
3344 gimple_try_eval (gimple gs
)
3346 return *gimple_try_eval_ptr (gs
);
3350 /* Return a pointer to the sequence of statements used as the cleanup body for
3353 static inline gimple_seq
*
3354 gimple_try_cleanup_ptr (gimple gs
)
3356 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3357 return &gs
->gimple_try
.cleanup
;
3361 /* Return the sequence of statements used as the cleanup body for
3364 static inline gimple_seq
3365 gimple_try_cleanup (gimple gs
)
3367 return *gimple_try_cleanup_ptr (gs
);
3371 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3374 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3376 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3377 if (catch_is_cleanup
)
3378 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3380 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3384 /* Set EVAL to be the sequence of statements to use as the body for
3388 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3390 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3391 gs
->gimple_try
.eval
= eval
;
3395 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3396 body for GIMPLE_TRY GS. */
3399 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3401 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3402 gs
->gimple_try
.cleanup
= cleanup
;
3406 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3408 static inline gimple_seq
*
3409 gimple_wce_cleanup_ptr (gimple gs
)
3411 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3412 return &gs
->gimple_wce
.cleanup
;
3416 /* Return the cleanup sequence for cleanup statement GS. */
3418 static inline gimple_seq
3419 gimple_wce_cleanup (gimple gs
)
3421 return *gimple_wce_cleanup_ptr (gs
);
3425 /* Set CLEANUP to be the cleanup sequence for GS. */
3428 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3430 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3431 gs
->gimple_wce
.cleanup
= cleanup
;
3435 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3438 gimple_wce_cleanup_eh_only (const_gimple gs
)
3440 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3441 return gs
->gsbase
.subcode
!= 0;
3445 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3448 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3450 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3451 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3455 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3457 static inline unsigned
3458 gimple_phi_capacity (const_gimple gs
)
3460 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3461 return gs
->gimple_phi
.capacity
;
3465 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3466 be exactly the number of incoming edges for the basic block holding
3469 static inline unsigned
3470 gimple_phi_num_args (const_gimple gs
)
3472 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3473 return gs
->gimple_phi
.nargs
;
3477 /* Return the SSA name created by GIMPLE_PHI GS. */
3480 gimple_phi_result (const_gimple gs
)
3482 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3483 return gs
->gimple_phi
.result
;
3486 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3488 static inline tree
*
3489 gimple_phi_result_ptr (gimple gs
)
3491 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3492 return &gs
->gimple_phi
.result
;
3495 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3498 gimple_phi_set_result (gimple gs
, tree result
)
3500 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3501 gs
->gimple_phi
.result
= result
;
3502 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3503 SSA_NAME_DEF_STMT (result
) = gs
;
3507 /* Return the PHI argument corresponding to incoming edge INDEX for
3510 static inline struct phi_arg_d
*
3511 gimple_phi_arg (gimple gs
, unsigned index
)
3513 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3514 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.capacity
);
3515 return &(gs
->gimple_phi
.args
[index
]);
3518 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3519 for GIMPLE_PHI GS. */
3522 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3524 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3525 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.nargs
);
3526 gs
->gimple_phi
.args
[index
] = *phiarg
;
3529 /* Return the region number for GIMPLE_RESX GS. */
3532 gimple_resx_region (const_gimple gs
)
3534 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3535 return gs
->gimple_eh_ctrl
.region
;
3538 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3541 gimple_resx_set_region (gimple gs
, int region
)
3543 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3544 gs
->gimple_eh_ctrl
.region
= region
;
3547 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3550 gimple_eh_dispatch_region (const_gimple gs
)
3552 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3553 return gs
->gimple_eh_ctrl
.region
;
3556 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3559 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3561 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3562 gs
->gimple_eh_ctrl
.region
= region
;
3565 /* Return the number of labels associated with the switch statement GS. */
3567 static inline unsigned
3568 gimple_switch_num_labels (const_gimple gs
)
3571 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3572 num_ops
= gimple_num_ops (gs
);
3573 gcc_gimple_checking_assert (num_ops
> 1);
3578 /* Set NLABELS to be the number of labels for the switch statement GS. */
3581 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3583 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3584 gimple_set_num_ops (g
, nlabels
+ 1);
3588 /* Return the index variable used by the switch statement GS. */
3591 gimple_switch_index (const_gimple gs
)
3593 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3594 return gimple_op (gs
, 0);
3598 /* Return a pointer to the index variable for the switch statement GS. */
3600 static inline tree
*
3601 gimple_switch_index_ptr (const_gimple gs
)
3603 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3604 return gimple_op_ptr (gs
, 0);
3608 /* Set INDEX to be the index variable for switch statement GS. */
3611 gimple_switch_set_index (gimple gs
, tree index
)
3613 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3614 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3615 gimple_set_op (gs
, 0, index
);
3619 /* Return the label numbered INDEX. The default label is 0, followed by any
3620 labels in a switch statement. */
3623 gimple_switch_label (const_gimple gs
, unsigned index
)
3625 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3626 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
3627 return gimple_op (gs
, index
+ 1);
3630 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3633 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3635 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3636 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
3637 && (label
== NULL_TREE
3638 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
3639 gimple_set_op (gs
, index
+ 1, label
);
3642 /* Return the default label for a switch statement. */
3645 gimple_switch_default_label (const_gimple gs
)
3647 tree label
= gimple_switch_label (gs
, 0);
3648 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3652 /* Set the default label for a switch statement. */
3655 gimple_switch_set_default_label (gimple gs
, tree label
)
3657 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3658 gimple_switch_set_label (gs
, 0, label
);
3661 /* Return true if GS is a GIMPLE_DEBUG statement. */
3664 is_gimple_debug (const_gimple gs
)
3666 return gimple_code (gs
) == GIMPLE_DEBUG
;
3669 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3672 gimple_debug_bind_p (const_gimple s
)
3674 if (is_gimple_debug (s
))
3675 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3680 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3683 gimple_debug_bind_get_var (gimple dbg
)
3685 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3686 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3687 return gimple_op (dbg
, 0);
3690 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3694 gimple_debug_bind_get_value (gimple dbg
)
3696 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3697 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3698 return gimple_op (dbg
, 1);
3701 /* Return a pointer to the value bound to the variable in a
3702 GIMPLE_DEBUG bind statement. */
3704 static inline tree
*
3705 gimple_debug_bind_get_value_ptr (gimple dbg
)
3707 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3708 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3709 return gimple_op_ptr (dbg
, 1);
3712 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3715 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3717 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3718 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3719 gimple_set_op (dbg
, 0, var
);
3722 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3726 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3728 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3729 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3730 gimple_set_op (dbg
, 1, value
);
3733 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3735 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3737 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3741 gimple_debug_bind_reset_value (gimple dbg
)
3743 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3744 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3745 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3748 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3752 gimple_debug_bind_has_value_p (gimple dbg
)
3754 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3755 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3756 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3759 #undef GIMPLE_DEBUG_BIND_NOVALUE
3761 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3764 gimple_debug_source_bind_p (const_gimple s
)
3766 if (is_gimple_debug (s
))
3767 return s
->gsbase
.subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
3772 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3775 gimple_debug_source_bind_get_var (gimple dbg
)
3777 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3778 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3779 return gimple_op (dbg
, 0);
3782 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3786 gimple_debug_source_bind_get_value (gimple dbg
)
3788 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3789 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3790 return gimple_op (dbg
, 1);
3793 /* Return a pointer to the value bound to the variable in a
3794 GIMPLE_DEBUG source bind statement. */
3796 static inline tree
*
3797 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
3799 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3800 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3801 return gimple_op_ptr (dbg
, 1);
3804 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3807 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
3809 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3810 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3811 gimple_set_op (dbg
, 0, var
);
3814 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3818 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
3820 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3821 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3822 gimple_set_op (dbg
, 1, value
);
3825 /* Return a pointer to the body for the OMP statement GS. */
3827 static inline gimple_seq
*
3828 gimple_omp_body_ptr (gimple gs
)
3830 return &gs
->omp
.body
;
3833 /* Return the body for the OMP statement GS. */
3835 static inline gimple_seq
3836 gimple_omp_body (gimple gs
)
3838 return *gimple_omp_body_ptr (gs
);
3841 /* Set BODY to be the body for the OMP statement GS. */
3844 gimple_omp_set_body (gimple gs
, gimple_seq body
)
3846 gs
->omp
.body
= body
;
3850 /* Return the name associated with OMP_CRITICAL statement GS. */
3853 gimple_omp_critical_name (const_gimple gs
)
3855 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3856 return gs
->gimple_omp_critical
.name
;
3860 /* Return a pointer to the name associated with OMP critical statement GS. */
3862 static inline tree
*
3863 gimple_omp_critical_name_ptr (gimple gs
)
3865 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3866 return &gs
->gimple_omp_critical
.name
;
3870 /* Set NAME to be the name associated with OMP critical statement GS. */
3873 gimple_omp_critical_set_name (gimple gs
, tree name
)
3875 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3876 gs
->gimple_omp_critical
.name
= name
;
3880 /* Return the clauses associated with OMP_FOR GS. */
3883 gimple_omp_for_clauses (const_gimple gs
)
3885 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3886 return gs
->gimple_omp_for
.clauses
;
3890 /* Return a pointer to the OMP_FOR GS. */
3892 static inline tree
*
3893 gimple_omp_for_clauses_ptr (gimple gs
)
3895 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3896 return &gs
->gimple_omp_for
.clauses
;
3900 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3903 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
3905 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3906 gs
->gimple_omp_for
.clauses
= clauses
;
3910 /* Get the collapse count of OMP_FOR GS. */
3912 static inline size_t
3913 gimple_omp_for_collapse (gimple gs
)
3915 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3916 return gs
->gimple_omp_for
.collapse
;
3920 /* Return the index variable for OMP_FOR GS. */
3923 gimple_omp_for_index (const_gimple gs
, size_t i
)
3925 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3926 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3927 return gs
->gimple_omp_for
.iter
[i
].index
;
3931 /* Return a pointer to the index variable for OMP_FOR GS. */
3933 static inline tree
*
3934 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
3936 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3937 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3938 return &gs
->gimple_omp_for
.iter
[i
].index
;
3942 /* Set INDEX to be the index variable for OMP_FOR GS. */
3945 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
3947 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3948 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3949 gs
->gimple_omp_for
.iter
[i
].index
= index
;
3953 /* Return the initial value for OMP_FOR GS. */
3956 gimple_omp_for_initial (const_gimple gs
, size_t i
)
3958 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3959 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3960 return gs
->gimple_omp_for
.iter
[i
].initial
;
3964 /* Return a pointer to the initial value for OMP_FOR GS. */
3966 static inline tree
*
3967 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
3969 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3970 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3971 return &gs
->gimple_omp_for
.iter
[i
].initial
;
3975 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3978 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
3980 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3981 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3982 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
3986 /* Return the final value for OMP_FOR GS. */
3989 gimple_omp_for_final (const_gimple gs
, size_t i
)
3991 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3992 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3993 return gs
->gimple_omp_for
.iter
[i
].final
;
3997 /* Return a pointer to the final value for OMP_FOR GS. */
3999 static inline tree
*
4000 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4002 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4003 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4004 return &gs
->gimple_omp_for
.iter
[i
].final
;
4008 /* Set FINAL to be the final value for OMP_FOR GS. */
4011 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4013 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4014 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4015 gs
->gimple_omp_for
.iter
[i
].final
= final
;
4019 /* Return the increment value for OMP_FOR GS. */
4022 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4024 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4025 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4026 return gs
->gimple_omp_for
.iter
[i
].incr
;
4030 /* Return a pointer to the increment value for OMP_FOR GS. */
4032 static inline tree
*
4033 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4035 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4036 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4037 return &gs
->gimple_omp_for
.iter
[i
].incr
;
4041 /* Set INCR to be the increment value for OMP_FOR GS. */
4044 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4046 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4047 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4048 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
4052 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4053 statement GS starts. */
4055 static inline gimple_seq
*
4056 gimple_omp_for_pre_body_ptr (gimple gs
)
4058 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4059 return &gs
->gimple_omp_for
.pre_body
;
4063 /* Return the sequence of statements to execute before the OMP_FOR
4064 statement GS starts. */
4066 static inline gimple_seq
4067 gimple_omp_for_pre_body (gimple gs
)
4069 return *gimple_omp_for_pre_body_ptr (gs
);
4073 /* Set PRE_BODY to be the sequence of statements to execute before the
4074 OMP_FOR statement GS starts. */
4077 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4079 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4080 gs
->gimple_omp_for
.pre_body
= pre_body
;
4084 /* Return the clauses associated with OMP_PARALLEL GS. */
4087 gimple_omp_parallel_clauses (const_gimple gs
)
4089 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4090 return gs
->gimple_omp_parallel
.clauses
;
4094 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4096 static inline tree
*
4097 gimple_omp_parallel_clauses_ptr (gimple gs
)
4099 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4100 return &gs
->gimple_omp_parallel
.clauses
;
4104 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4108 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4110 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4111 gs
->gimple_omp_parallel
.clauses
= clauses
;
4115 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4118 gimple_omp_parallel_child_fn (const_gimple gs
)
4120 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4121 return gs
->gimple_omp_parallel
.child_fn
;
4124 /* Return a pointer to the child function used to hold the body of
4127 static inline tree
*
4128 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4130 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4131 return &gs
->gimple_omp_parallel
.child_fn
;
4135 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4138 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4140 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4141 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4145 /* Return the artificial argument used to send variables and values
4146 from the parent to the children threads in OMP_PARALLEL GS. */
4149 gimple_omp_parallel_data_arg (const_gimple gs
)
4151 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4152 return gs
->gimple_omp_parallel
.data_arg
;
4156 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4158 static inline tree
*
4159 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4161 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4162 return &gs
->gimple_omp_parallel
.data_arg
;
4166 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4169 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4171 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4172 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4176 /* Return the clauses associated with OMP_TASK GS. */
4179 gimple_omp_task_clauses (const_gimple gs
)
4181 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4182 return gs
->gimple_omp_parallel
.clauses
;
4186 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4188 static inline tree
*
4189 gimple_omp_task_clauses_ptr (gimple gs
)
4191 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4192 return &gs
->gimple_omp_parallel
.clauses
;
4196 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4200 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4202 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4203 gs
->gimple_omp_parallel
.clauses
= clauses
;
4207 /* Return the child function used to hold the body of OMP_TASK GS. */
4210 gimple_omp_task_child_fn (const_gimple gs
)
4212 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4213 return gs
->gimple_omp_parallel
.child_fn
;
4216 /* Return a pointer to the child function used to hold the body of
4219 static inline tree
*
4220 gimple_omp_task_child_fn_ptr (gimple gs
)
4222 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4223 return &gs
->gimple_omp_parallel
.child_fn
;
4227 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4230 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4232 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4233 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4237 /* Return the artificial argument used to send variables and values
4238 from the parent to the children threads in OMP_TASK GS. */
4241 gimple_omp_task_data_arg (const_gimple gs
)
4243 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4244 return gs
->gimple_omp_parallel
.data_arg
;
4248 /* Return a pointer to the data argument for OMP_TASK GS. */
4250 static inline tree
*
4251 gimple_omp_task_data_arg_ptr (gimple gs
)
4253 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4254 return &gs
->gimple_omp_parallel
.data_arg
;
4258 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4261 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4263 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4264 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4268 /* Return the clauses associated with OMP_TASK GS. */
4271 gimple_omp_taskreg_clauses (const_gimple gs
)
4273 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4274 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4275 return gs
->gimple_omp_parallel
.clauses
;
4279 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4281 static inline tree
*
4282 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4284 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4285 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4286 return &gs
->gimple_omp_parallel
.clauses
;
4290 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4294 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4296 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4297 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4298 gs
->gimple_omp_parallel
.clauses
= clauses
;
4302 /* Return the child function used to hold the body of OMP_TASK GS. */
4305 gimple_omp_taskreg_child_fn (const_gimple gs
)
4307 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4308 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4309 return gs
->gimple_omp_parallel
.child_fn
;
4312 /* Return a pointer to the child function used to hold the body of
4315 static inline tree
*
4316 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4318 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4319 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4320 return &gs
->gimple_omp_parallel
.child_fn
;
4324 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4327 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4329 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4330 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4331 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4335 /* Return the artificial argument used to send variables and values
4336 from the parent to the children threads in OMP_TASK GS. */
4339 gimple_omp_taskreg_data_arg (const_gimple gs
)
4341 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4342 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4343 return gs
->gimple_omp_parallel
.data_arg
;
4347 /* Return a pointer to the data argument for OMP_TASK GS. */
4349 static inline tree
*
4350 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4352 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4353 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4354 return &gs
->gimple_omp_parallel
.data_arg
;
4358 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4361 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4363 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4364 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4365 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4369 /* Return the copy function used to hold the body of OMP_TASK GS. */
4372 gimple_omp_task_copy_fn (const_gimple gs
)
4374 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4375 return gs
->gimple_omp_task
.copy_fn
;
4378 /* Return a pointer to the copy function used to hold the body of
4381 static inline tree
*
4382 gimple_omp_task_copy_fn_ptr (gimple gs
)
4384 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4385 return &gs
->gimple_omp_task
.copy_fn
;
4389 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4392 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4394 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4395 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
4399 /* Return size of the data block in bytes in OMP_TASK GS. */
4402 gimple_omp_task_arg_size (const_gimple gs
)
4404 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4405 return gs
->gimple_omp_task
.arg_size
;
4409 /* Return a pointer to the data block size for OMP_TASK GS. */
4411 static inline tree
*
4412 gimple_omp_task_arg_size_ptr (gimple gs
)
4414 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4415 return &gs
->gimple_omp_task
.arg_size
;
4419 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4422 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4424 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4425 gs
->gimple_omp_task
.arg_size
= arg_size
;
4429 /* Return align of the data block in bytes in OMP_TASK GS. */
4432 gimple_omp_task_arg_align (const_gimple gs
)
4434 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4435 return gs
->gimple_omp_task
.arg_align
;
4439 /* Return a pointer to the data block align for OMP_TASK GS. */
4441 static inline tree
*
4442 gimple_omp_task_arg_align_ptr (gimple gs
)
4444 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4445 return &gs
->gimple_omp_task
.arg_align
;
4449 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4452 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
4454 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4455 gs
->gimple_omp_task
.arg_align
= arg_align
;
4459 /* Return the clauses associated with OMP_SINGLE GS. */
4462 gimple_omp_single_clauses (const_gimple gs
)
4464 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4465 return gs
->gimple_omp_single
.clauses
;
4469 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4471 static inline tree
*
4472 gimple_omp_single_clauses_ptr (gimple gs
)
4474 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4475 return &gs
->gimple_omp_single
.clauses
;
4479 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4482 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
4484 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4485 gs
->gimple_omp_single
.clauses
= clauses
;
4489 /* Return the clauses associated with OMP_SECTIONS GS. */
4492 gimple_omp_sections_clauses (const_gimple gs
)
4494 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4495 return gs
->gimple_omp_sections
.clauses
;
4499 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4501 static inline tree
*
4502 gimple_omp_sections_clauses_ptr (gimple gs
)
4504 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4505 return &gs
->gimple_omp_sections
.clauses
;
4509 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4513 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4515 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4516 gs
->gimple_omp_sections
.clauses
= clauses
;
4520 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4524 gimple_omp_sections_control (const_gimple gs
)
4526 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4527 return gs
->gimple_omp_sections
.control
;
4531 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4534 static inline tree
*
4535 gimple_omp_sections_control_ptr (gimple gs
)
4537 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4538 return &gs
->gimple_omp_sections
.control
;
4542 /* Set CONTROL to be the set of clauses associated with the
4543 GIMPLE_OMP_SECTIONS in GS. */
4546 gimple_omp_sections_set_control (gimple gs
, tree control
)
4548 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4549 gs
->gimple_omp_sections
.control
= control
;
4553 /* Set COND to be the condition code for OMP_FOR GS. */
4556 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4558 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4559 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4560 && i
< gs
->gimple_omp_for
.collapse
);
4561 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4565 /* Return the condition code associated with OMP_FOR GS. */
4567 static inline enum tree_code
4568 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4570 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4571 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4572 return gs
->gimple_omp_for
.iter
[i
].cond
;
4576 /* Set the value being stored in an atomic store. */
4579 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4581 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4582 g
->gimple_omp_atomic_store
.val
= val
;
4586 /* Return the value being stored in an atomic store. */
4589 gimple_omp_atomic_store_val (const_gimple g
)
4591 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4592 return g
->gimple_omp_atomic_store
.val
;
4596 /* Return a pointer to the value being stored in an atomic store. */
4598 static inline tree
*
4599 gimple_omp_atomic_store_val_ptr (gimple g
)
4601 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4602 return &g
->gimple_omp_atomic_store
.val
;
4606 /* Set the LHS of an atomic load. */
4609 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
4611 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4612 g
->gimple_omp_atomic_load
.lhs
= lhs
;
4616 /* Get the LHS of an atomic load. */
4619 gimple_omp_atomic_load_lhs (const_gimple g
)
4621 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4622 return g
->gimple_omp_atomic_load
.lhs
;
4626 /* Return a pointer to the LHS of an atomic load. */
4628 static inline tree
*
4629 gimple_omp_atomic_load_lhs_ptr (gimple g
)
4631 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4632 return &g
->gimple_omp_atomic_load
.lhs
;
4636 /* Set the RHS of an atomic load. */
4639 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
4641 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4642 g
->gimple_omp_atomic_load
.rhs
= rhs
;
4646 /* Get the RHS of an atomic load. */
4649 gimple_omp_atomic_load_rhs (const_gimple g
)
4651 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4652 return g
->gimple_omp_atomic_load
.rhs
;
4656 /* Return a pointer to the RHS of an atomic load. */
4658 static inline tree
*
4659 gimple_omp_atomic_load_rhs_ptr (gimple g
)
4661 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4662 return &g
->gimple_omp_atomic_load
.rhs
;
4666 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4669 gimple_omp_continue_control_def (const_gimple g
)
4671 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4672 return g
->gimple_omp_continue
.control_def
;
4675 /* The same as above, but return the address. */
4677 static inline tree
*
4678 gimple_omp_continue_control_def_ptr (gimple g
)
4680 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4681 return &g
->gimple_omp_continue
.control_def
;
4684 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4687 gimple_omp_continue_set_control_def (gimple g
, tree def
)
4689 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4690 g
->gimple_omp_continue
.control_def
= def
;
4694 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4697 gimple_omp_continue_control_use (const_gimple g
)
4699 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4700 return g
->gimple_omp_continue
.control_use
;
4704 /* The same as above, but return the address. */
4706 static inline tree
*
4707 gimple_omp_continue_control_use_ptr (gimple g
)
4709 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4710 return &g
->gimple_omp_continue
.control_use
;
4714 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4717 gimple_omp_continue_set_control_use (gimple g
, tree use
)
4719 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4720 g
->gimple_omp_continue
.control_use
= use
;
4723 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4725 static inline gimple_seq
*
4726 gimple_transaction_body_ptr (gimple gs
)
4728 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4729 return &gs
->gimple_transaction
.body
;
4732 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4734 static inline gimple_seq
4735 gimple_transaction_body (gimple gs
)
4737 return *gimple_transaction_body_ptr (gs
);
4740 /* Return the label associated with a GIMPLE_TRANSACTION. */
4743 gimple_transaction_label (const_gimple gs
)
4745 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4746 return gs
->gimple_transaction
.label
;
4749 static inline tree
*
4750 gimple_transaction_label_ptr (gimple gs
)
4752 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4753 return &gs
->gimple_transaction
.label
;
4756 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4758 static inline unsigned int
4759 gimple_transaction_subcode (const_gimple gs
)
4761 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4762 return gs
->gsbase
.subcode
;
4765 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4768 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
4770 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4771 gs
->gimple_transaction
.body
= body
;
4774 /* Set the label associated with a GIMPLE_TRANSACTION. */
4777 gimple_transaction_set_label (gimple gs
, tree label
)
4779 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4780 gs
->gimple_transaction
.label
= label
;
4783 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4786 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
4788 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4789 gs
->gsbase
.subcode
= subcode
;
4793 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4795 static inline tree
*
4796 gimple_return_retval_ptr (const_gimple gs
)
4798 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4799 return gimple_op_ptr (gs
, 0);
4802 /* Return the return value for GIMPLE_RETURN GS. */
4805 gimple_return_retval (const_gimple gs
)
4807 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4808 return gimple_op (gs
, 0);
4812 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4815 gimple_return_set_retval (gimple gs
, tree retval
)
4817 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4818 gimple_set_op (gs
, 0, retval
);
4822 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4824 #define CASE_GIMPLE_OMP \
4825 case GIMPLE_OMP_PARALLEL: \
4826 case GIMPLE_OMP_TASK: \
4827 case GIMPLE_OMP_FOR: \
4828 case GIMPLE_OMP_SECTIONS: \
4829 case GIMPLE_OMP_SECTIONS_SWITCH: \
4830 case GIMPLE_OMP_SINGLE: \
4831 case GIMPLE_OMP_SECTION: \
4832 case GIMPLE_OMP_MASTER: \
4833 case GIMPLE_OMP_ORDERED: \
4834 case GIMPLE_OMP_CRITICAL: \
4835 case GIMPLE_OMP_RETURN: \
4836 case GIMPLE_OMP_ATOMIC_LOAD: \
4837 case GIMPLE_OMP_ATOMIC_STORE: \
4838 case GIMPLE_OMP_CONTINUE
4841 is_gimple_omp (const_gimple stmt
)
4843 switch (gimple_code (stmt
))
4853 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4856 gimple_nop_p (const_gimple g
)
4858 return gimple_code (g
) == GIMPLE_NOP
;
4862 /* Return true if GS is a GIMPLE_RESX. */
4865 is_gimple_resx (const_gimple gs
)
4867 return gimple_code (gs
) == GIMPLE_RESX
;
4870 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4872 static inline enum br_predictor
4873 gimple_predict_predictor (gimple gs
)
4875 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4876 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
4880 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4883 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
4885 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4886 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
4887 | (unsigned) predictor
;
4891 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4893 static inline enum prediction
4894 gimple_predict_outcome (gimple gs
)
4896 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4897 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
4901 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4904 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
4906 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4907 if (outcome
== TAKEN
)
4908 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
4910 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
4914 /* Return the type of the main expression computed by STMT. Return
4915 void_type_node if the statement computes nothing. */
4918 gimple_expr_type (const_gimple stmt
)
4920 enum gimple_code code
= gimple_code (stmt
);
4922 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
4925 /* In general we want to pass out a type that can be substituted
4926 for both the RHS and the LHS types if there is a possibly
4927 useless conversion involved. That means returning the
4928 original RHS type as far as we can reconstruct it. */
4929 if (code
== GIMPLE_CALL
)
4930 type
= gimple_call_return_type (stmt
);
4932 switch (gimple_assign_rhs_code (stmt
))
4934 case POINTER_PLUS_EXPR
:
4935 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
4939 /* As fallback use the type of the LHS. */
4940 type
= TREE_TYPE (gimple_get_lhs (stmt
));
4945 else if (code
== GIMPLE_COND
)
4946 return boolean_type_node
;
4948 return void_type_node
;
4951 /* Return true if TYPE is a suitable type for a scalar register variable. */
4954 is_gimple_reg_type (tree type
)
4956 return !AGGREGATE_TYPE_P (type
);
4959 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4961 static inline gimple_stmt_iterator
4962 gsi_start_1 (gimple_seq
*seq
)
4964 gimple_stmt_iterator i
;
4966 i
.ptr
= gimple_seq_first (*seq
);
4968 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
4973 #define gsi_start(x) gsi_start_1(&(x))
4975 static inline gimple_stmt_iterator
4978 gimple_stmt_iterator i
;
4985 /* Return a new iterator pointing to the first statement in basic block BB. */
4987 static inline gimple_stmt_iterator
4988 gsi_start_bb (basic_block bb
)
4990 gimple_stmt_iterator i
;
4993 seq
= bb_seq_addr (bb
);
4994 i
.ptr
= gimple_seq_first (*seq
);
5002 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5004 static inline gimple_stmt_iterator
5005 gsi_last_1 (gimple_seq
*seq
)
5007 gimple_stmt_iterator i
;
5009 i
.ptr
= gimple_seq_last (*seq
);
5011 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
5016 #define gsi_last(x) gsi_last_1(&(x))
5018 /* Return a new iterator pointing to the last statement in basic block BB. */
5020 static inline gimple_stmt_iterator
5021 gsi_last_bb (basic_block bb
)
5023 gimple_stmt_iterator i
;
5026 seq
= bb_seq_addr (bb
);
5027 i
.ptr
= gimple_seq_last (*seq
);
5035 /* Return true if I is at the end of its sequence. */
5038 gsi_end_p (gimple_stmt_iterator i
)
5040 return i
.ptr
== NULL
;
5044 /* Return true if I is one statement before the end of its sequence. */
5047 gsi_one_before_end_p (gimple_stmt_iterator i
)
5049 return i
.ptr
!= NULL
&& i
.ptr
->gsbase
.next
== NULL
;
5053 /* Advance the iterator to the next gimple statement. */
5056 gsi_next (gimple_stmt_iterator
*i
)
5058 i
->ptr
= i
->ptr
->gsbase
.next
;
5061 /* Advance the iterator to the previous gimple statement. */
5064 gsi_prev (gimple_stmt_iterator
*i
)
5066 gimple prev
= i
->ptr
->gsbase
.prev
;
5067 if (prev
->gsbase
.next
)
5073 /* Return the current stmt. */
5075 static inline gimple
5076 gsi_stmt (gimple_stmt_iterator i
)
5081 /* Return a block statement iterator that points to the first non-label
5082 statement in block BB. */
5084 static inline gimple_stmt_iterator
5085 gsi_after_labels (basic_block bb
)
5087 gimple_stmt_iterator gsi
= gsi_start_bb (bb
);
5089 while (!gsi_end_p (gsi
) && gimple_code (gsi_stmt (gsi
)) == GIMPLE_LABEL
)
5095 /* Advance the iterator to the next non-debug gimple statement. */
5098 gsi_next_nondebug (gimple_stmt_iterator
*i
)
5104 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5107 /* Advance the iterator to the next non-debug gimple statement. */
5110 gsi_prev_nondebug (gimple_stmt_iterator
*i
)
5116 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5119 /* Return a new iterator pointing to the first non-debug statement in
5122 static inline gimple_stmt_iterator
5123 gsi_start_nondebug_bb (basic_block bb
)
5125 gimple_stmt_iterator i
= gsi_start_bb (bb
);
5127 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5128 gsi_next_nondebug (&i
);
5133 /* Return a new iterator pointing to the last non-debug statement in
5136 static inline gimple_stmt_iterator
5137 gsi_last_nondebug_bb (basic_block bb
)
5139 gimple_stmt_iterator i
= gsi_last_bb (bb
);
5141 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5142 gsi_prev_nondebug (&i
);
5148 /* Return the basic block associated with this iterator. */
5150 static inline basic_block
5151 gsi_bb (gimple_stmt_iterator i
)
5157 /* Return the sequence associated with this iterator. */
5159 static inline gimple_seq
5160 gsi_seq (gimple_stmt_iterator i
)
5166 enum gsi_iterator_update
5168 GSI_NEW_STMT
, /* Only valid when single statement is added, move
5170 GSI_SAME_STMT
, /* Leave the iterator at the same statement. */
5171 GSI_CONTINUE_LINKING
/* Move iterator to whatever position is suitable
5172 for linking other statements in the same
5176 /* In gimple-iterator.c */
5177 gimple_stmt_iterator
gsi_start_phis (basic_block
);
5178 gimple_seq
gsi_split_seq_after (gimple_stmt_iterator
);
5179 void gsi_split_seq_before (gimple_stmt_iterator
*, gimple_seq
*);
5180 void gsi_set_stmt (gimple_stmt_iterator
*, gimple
);
5181 void gsi_replace (gimple_stmt_iterator
*, gimple
, bool);
5182 void gsi_replace_with_seq (gimple_stmt_iterator
*, gimple_seq
, bool);
5183 void gsi_insert_before (gimple_stmt_iterator
*, gimple
,
5184 enum gsi_iterator_update
);
5185 void gsi_insert_before_without_update (gimple_stmt_iterator
*, gimple
,
5186 enum gsi_iterator_update
);
5187 void gsi_insert_seq_before (gimple_stmt_iterator
*, gimple_seq
,
5188 enum gsi_iterator_update
);
5189 void gsi_insert_seq_before_without_update (gimple_stmt_iterator
*, gimple_seq
,
5190 enum gsi_iterator_update
);
5191 void gsi_insert_after (gimple_stmt_iterator
*, gimple
,
5192 enum gsi_iterator_update
);
5193 void gsi_insert_after_without_update (gimple_stmt_iterator
*, gimple
,
5194 enum gsi_iterator_update
);
5195 void gsi_insert_seq_after (gimple_stmt_iterator
*, gimple_seq
,
5196 enum gsi_iterator_update
);
5197 void gsi_insert_seq_after_without_update (gimple_stmt_iterator
*, gimple_seq
,
5198 enum gsi_iterator_update
);
5199 bool gsi_remove (gimple_stmt_iterator
*, bool);
5200 gimple_stmt_iterator
gsi_for_stmt (gimple
);
5201 void gsi_move_after (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5202 void gsi_move_before (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5203 void gsi_move_to_bb_end (gimple_stmt_iterator
*, basic_block
);
5204 void gsi_insert_on_edge (edge
, gimple
);
5205 void gsi_insert_seq_on_edge (edge
, gimple_seq
);
5206 basic_block
gsi_insert_on_edge_immediate (edge
, gimple
);
5207 basic_block
gsi_insert_seq_on_edge_immediate (edge
, gimple_seq
);
5208 void gsi_commit_one_edge_insert (edge
, basic_block
*);
5209 void gsi_commit_edge_inserts (void);
5210 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
5213 /* Convenience routines to walk all statements of a gimple function.
5214 Note that this is useful exclusively before the code is converted
5215 into SSA form. Once the program is in SSA form, the standard
5216 operand interface should be used to analyze/modify statements. */
5217 struct walk_stmt_info
5219 /* Points to the current statement being walked. */
5220 gimple_stmt_iterator gsi
;
5222 /* Additional data that the callback functions may want to carry
5223 through the recursion. */
5226 /* Pointer map used to mark visited tree nodes when calling
5227 walk_tree on each operand. If set to NULL, duplicate tree nodes
5228 will be visited more than once. */
5229 struct pointer_set_t
*pset
;
5231 /* Operand returned by the callbacks. This is set when calling
5232 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5233 returns non-NULL, this field will contain the tree returned by
5234 the last callback. */
5235 tree callback_result
;
5237 /* Indicates whether the operand being examined may be replaced
5238 with something that matches is_gimple_val (if true) or something
5239 slightly more complicated (if false). "Something" technically
5240 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5241 but we never try to form anything more complicated than that, so
5242 we don't bother checking.
5244 Also note that CALLBACK should update this flag while walking the
5245 sub-expressions of a statement. For instance, when walking the
5246 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5247 to true, however, when walking &var, the operand of that
5248 ADDR_EXPR does not need to be a GIMPLE value. */
5249 BOOL_BITFIELD val_only
: 1;
5251 /* True if we are currently walking the LHS of an assignment. */
5252 BOOL_BITFIELD is_lhs
: 1;
5254 /* Optional. Set to true by the callback functions if they made any
5256 BOOL_BITFIELD changed
: 1;
5258 /* True if we're interested in location information. */
5259 BOOL_BITFIELD want_locations
: 1;
5261 /* True if we've removed the statement that was processed. */
5262 BOOL_BITFIELD removed_stmt
: 1;
5265 /* Callback for walk_gimple_stmt. Called for every statement found
5266 during traversal. The first argument points to the statement to
5267 walk. The second argument is a flag that the callback sets to
5268 'true' if it the callback handled all the operands and
5269 sub-statements of the statement (the default value of this flag is
5270 'false'). The third argument is an anonymous pointer to data
5271 to be used by the callback. */
5272 typedef tree (*walk_stmt_fn
) (gimple_stmt_iterator
*, bool *,
5273 struct walk_stmt_info
*);
5275 gimple
walk_gimple_seq (gimple_seq
, walk_stmt_fn
, walk_tree_fn
,
5276 struct walk_stmt_info
*);
5277 gimple
walk_gimple_seq_mod (gimple_seq
*, walk_stmt_fn
, walk_tree_fn
,
5278 struct walk_stmt_info
*);
5279 tree
walk_gimple_stmt (gimple_stmt_iterator
*, walk_stmt_fn
, walk_tree_fn
,
5280 struct walk_stmt_info
*);
5281 tree
walk_gimple_op (gimple
, walk_tree_fn
, struct walk_stmt_info
*);
5283 /* Enum and arrays used for allocation stats. Keep in sync with
5284 gimple.c:gimple_alloc_kind_names. */
5285 enum gimple_alloc_kind
5287 gimple_alloc_kind_assign
, /* Assignments. */
5288 gimple_alloc_kind_phi
, /* PHI nodes. */
5289 gimple_alloc_kind_cond
, /* Conditionals. */
5290 gimple_alloc_kind_rest
, /* Everything else. */
5291 gimple_alloc_kind_all
5294 extern int gimple_alloc_counts
[];
5295 extern int gimple_alloc_sizes
[];
5297 /* Return the allocation kind for a given stmt CODE. */
5298 static inline enum gimple_alloc_kind
5299 gimple_alloc_kind (enum gimple_code code
)
5304 return gimple_alloc_kind_assign
;
5306 return gimple_alloc_kind_phi
;
5308 return gimple_alloc_kind_cond
;
5310 return gimple_alloc_kind_rest
;
5314 extern void dump_gimple_statistics (void);
5316 /* In gimple-fold.c. */
5317 void gimplify_and_update_call_from_tree (gimple_stmt_iterator
*, tree
);
5318 tree
gimple_fold_builtin (gimple
);
5319 bool fold_stmt (gimple_stmt_iterator
*);
5320 bool fold_stmt_inplace (gimple_stmt_iterator
*);
5321 tree
get_symbol_constant_value (tree
);
5322 tree
canonicalize_constructor_val (tree
, tree
);
5323 extern tree
maybe_fold_and_comparisons (enum tree_code
, tree
, tree
,
5324 enum tree_code
, tree
, tree
);
5325 extern tree
maybe_fold_or_comparisons (enum tree_code
, tree
, tree
,
5326 enum tree_code
, tree
, tree
);
5328 bool gimple_val_nonnegative_real_p (tree
);
5329 #endif /* GCC_GIMPLE_H */