1 /* Gimple IR definitions.
3 Copyright (C) 2007-2013 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 #include "pointer-set.h"
26 #include "hash-table.h"
29 #include "basic-block.h"
30 #include "tree-ssa-alias.h"
31 #include "internal-fn.h"
32 #include "gimple-fold.h"
35 typedef gimple gimple_seq_node
;
37 /* For each block, the PHI nodes that need to be rewritten are stored into
39 typedef vec
<gimple
> gimple_vec
;
42 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
45 LAST_AND_UNUSED_GIMPLE_CODE
48 extern const char *const gimple_code_name
[];
49 extern const unsigned char gimple_rhs_class_table
[];
51 /* Error out if a gimple tuple is addressed incorrectly. */
52 #if defined ENABLE_GIMPLE_CHECKING
53 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
54 extern void gimple_check_failed (const_gimple
, const char *, int, \
55 const char *, enum gimple_code
, \
56 enum tree_code
) ATTRIBUTE_NORETURN
;
58 #define GIMPLE_CHECK(GS, CODE) \
60 const_gimple __gs = (GS); \
61 if (gimple_code (__gs) != (CODE)) \
62 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
63 (CODE), ERROR_MARK); \
65 #else /* not ENABLE_GIMPLE_CHECKING */
66 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
67 #define GIMPLE_CHECK(GS, CODE) (void)0
70 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
71 get_gimple_rhs_class. */
74 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
75 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
76 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
77 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
78 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
79 name, a _DECL, a _REF, etc. */
82 /* Specific flags for individual GIMPLE statements. These flags are
83 always stored in gimple_statement_base.subcode and they may only be
84 defined for statement codes that do not use subcodes.
86 Values for the masks can overlap as long as the overlapping values
87 are never used in the same statement class.
89 The maximum mask value that can be defined is 1 << 15 (i.e., each
90 statement code can hold up to 16 bitflags).
92 Keep this list sorted. */
94 GF_ASM_INPUT
= 1 << 0,
95 GF_ASM_VOLATILE
= 1 << 1,
96 GF_CALL_FROM_THUNK
= 1 << 0,
97 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
98 GF_CALL_TAILCALL
= 1 << 2,
99 GF_CALL_VA_ARG_PACK
= 1 << 3,
100 GF_CALL_NOTHROW
= 1 << 4,
101 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
102 GF_CALL_INTERNAL
= 1 << 6,
103 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
104 GF_OMP_FOR_KIND_MASK
= 3 << 0,
105 GF_OMP_FOR_KIND_FOR
= 0 << 0,
106 GF_OMP_FOR_KIND_SIMD
= 1 << 0,
107 GF_OMP_FOR_KIND_DISTRIBUTE
= 2 << 0,
108 GF_OMP_FOR_COMBINED
= 1 << 2,
109 GF_OMP_FOR_COMBINED_INTO
= 1 << 3,
110 GF_OMP_TARGET_KIND_MASK
= 3 << 0,
111 GF_OMP_TARGET_KIND_REGION
= 0 << 0,
112 GF_OMP_TARGET_KIND_DATA
= 1 << 0,
113 GF_OMP_TARGET_KIND_UPDATE
= 2 << 0,
115 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
116 a thread synchronization via some sort of barrier. The exact barrier
117 that would otherwise be emitted is dependent on the OMP statement with
118 which this return is associated. */
119 GF_OMP_RETURN_NOWAIT
= 1 << 0,
121 GF_OMP_SECTION_LAST
= 1 << 0,
122 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
123 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
124 GF_PREDICT_TAKEN
= 1 << 15
127 /* Currently, there are only two types of gimple debug stmt. Others are
128 envisioned, for example, to enable the generation of is_stmt notes
129 in line number information, to mark sequence points, etc. This
130 subcode is to be used to tell them apart. */
131 enum gimple_debug_subcode
{
132 GIMPLE_DEBUG_BIND
= 0,
133 GIMPLE_DEBUG_SOURCE_BIND
= 1
136 /* Masks for selecting a pass local flag (PLF) to work on. These
137 masks are used by gimple_set_plf and gimple_plf. */
143 /* Iterator object for GIMPLE statement sequences. */
145 struct gimple_stmt_iterator_d
147 /* Sequence node holding the current statement. */
150 /* Sequence and basic block holding the statement. These fields
151 are necessary to handle edge cases such as when statement is
152 added to an empty basic block or when the last statement of a
153 block/sequence is removed. */
158 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
159 are for 64 bit hosts. */
161 struct GTY((chain_next ("%h.next"))) gimple_statement_base
{
163 Main identifying code for a tuple. */
164 ENUM_BITFIELD(gimple_code
) code
: 8;
166 /* Nonzero if a warning should not be emitted on this tuple. */
167 unsigned int no_warning
: 1;
169 /* Nonzero if this tuple has been visited. Passes are responsible
170 for clearing this bit before using it. */
171 unsigned int visited
: 1;
173 /* Nonzero if this tuple represents a non-temporal move. */
174 unsigned int nontemporal_move
: 1;
176 /* Pass local flags. These flags are free for any pass to use as
177 they see fit. Passes should not assume that these flags contain
178 any useful value when the pass starts. Any initial state that
179 the pass requires should be set on entry to the pass. See
180 gimple_set_plf and gimple_plf for usage. */
181 unsigned int plf
: 2;
183 /* Nonzero if this statement has been modified and needs to have its
184 operands rescanned. */
185 unsigned modified
: 1;
187 /* Nonzero if this statement contains volatile operands. */
188 unsigned has_volatile_ops
: 1;
190 /* The SUBCODE field can be used for tuple-specific flags for tuples
191 that do not require subcodes. Note that SUBCODE should be at
192 least as wide as tree codes, as several tuples store tree codes
194 unsigned int subcode
: 16;
196 /* UID of this statement. This is used by passes that want to
197 assign IDs to statements. It must be assigned and used by each
198 pass. By default it should be assumed to contain garbage. */
202 Locus information for debug info. */
205 /* Number of operands in this tuple. */
209 Basic block holding this statement. */
213 Linked lists of gimple statements. The next pointers form
214 a NULL terminated list, the prev pointers are a cyclic list.
215 A gimple statement is hence also a double-ended list of
216 statements, with the pointer itself being the first element,
217 and the prev pointer being the last. */
219 gimple
GTY((skip
)) prev
;
223 /* Base structure for tuples with operands. */
225 struct GTY(()) gimple_statement_with_ops_base
228 struct gimple_statement_base gsbase
;
231 SSA operand vectors. NOTE: It should be possible to
232 amalgamate these vectors with the operand vector OP. However,
233 the SSA operand vectors are organized differently and contain
234 more information (like immediate use chaining). */
235 struct use_optype_d
GTY((skip (""))) *use_ops
;
239 /* Statements that take register operands. */
241 struct GTY(()) gimple_statement_with_ops
244 struct gimple_statement_with_ops_base opbase
;
247 Operand vector. NOTE! This must always be the last field
248 of this structure. In particular, this means that this
249 structure cannot be embedded inside another one. */
250 tree
GTY((length ("%h.opbase.gsbase.num_ops"))) op
[1];
254 /* Base for statements that take both memory and register operands. */
256 struct GTY(()) gimple_statement_with_memory_ops_base
259 struct gimple_statement_with_ops_base opbase
;
262 Virtual operands for this statement. The GC will pick them
263 up via the ssa_names array. */
264 tree
GTY((skip (""))) vdef
;
265 tree
GTY((skip (""))) vuse
;
269 /* Statements that take both memory and register operands. */
271 struct GTY(()) gimple_statement_with_memory_ops
274 struct gimple_statement_with_memory_ops_base membase
;
277 Operand vector. NOTE! This must always be the last field
278 of this structure. In particular, this means that this
279 structure cannot be embedded inside another one. */
280 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
284 /* Call statements that take both memory and register operands. */
286 struct GTY(()) gimple_statement_call
289 struct gimple_statement_with_memory_ops_base membase
;
292 struct pt_solution call_used
;
293 struct pt_solution call_clobbered
;
296 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
297 tree
GTY ((tag ("0"))) fntype
;
298 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
302 Operand vector. NOTE! This must always be the last field
303 of this structure. In particular, this means that this
304 structure cannot be embedded inside another one. */
305 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
309 /* OpenMP statements (#pragma omp). */
311 struct GTY(()) gimple_statement_omp
{
313 struct gimple_statement_base gsbase
;
322 struct GTY(()) gimple_statement_bind
{
324 struct gimple_statement_base gsbase
;
327 Variables declared in this scope. */
331 This is different than the BLOCK field in gimple_statement_base,
332 which is analogous to TREE_BLOCK (i.e., the lexical block holding
333 this statement). This field is the equivalent of BIND_EXPR_BLOCK
334 in tree land (i.e., the lexical scope defined by this bind). See
345 struct GTY(()) gimple_statement_catch
{
347 struct gimple_statement_base gsbase
;
357 /* GIMPLE_EH_FILTER */
359 struct GTY(()) gimple_statement_eh_filter
{
361 struct gimple_statement_base gsbase
;
374 struct GTY(()) gimple_statement_eh_else
{
376 struct gimple_statement_base gsbase
;
379 gimple_seq n_body
, e_body
;
382 /* GIMPLE_EH_MUST_NOT_THROW */
384 struct GTY(()) gimple_statement_eh_mnt
{
386 struct gimple_statement_base gsbase
;
388 /* [ WORD 7 ] Abort function decl. */
394 struct GTY(()) gimple_statement_phi
{
396 struct gimple_statement_base gsbase
;
406 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
410 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
412 struct GTY(()) gimple_statement_eh_ctrl
415 struct gimple_statement_base gsbase
;
418 Exception region number. */
425 struct GTY(()) gimple_statement_try
{
427 struct gimple_statement_base gsbase
;
430 Expression to evaluate. */
434 Cleanup expression. */
438 /* Kind of GIMPLE_TRY statements. */
439 enum gimple_try_flags
442 GIMPLE_TRY_CATCH
= 1 << 0,
445 GIMPLE_TRY_FINALLY
= 1 << 1,
446 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
448 /* Analogous to TRY_CATCH_IS_CLEANUP. */
449 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
452 /* GIMPLE_WITH_CLEANUP_EXPR */
454 struct GTY(()) gimple_statement_wce
{
456 struct gimple_statement_base gsbase
;
458 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
459 executed if an exception is thrown, not on normal exit of its
460 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
464 Cleanup expression. */
471 struct GTY(()) gimple_statement_asm
474 struct gimple_statement_with_memory_ops_base membase
;
477 __asm__ statement. */
481 Number of inputs, outputs, clobbers, labels. */
488 Operand vector. NOTE! This must always be the last field
489 of this structure. In particular, this means that this
490 structure cannot be embedded inside another one. */
491 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
494 /* GIMPLE_OMP_CRITICAL */
496 struct GTY(()) gimple_statement_omp_critical
{
498 struct gimple_statement_omp omp
;
501 Critical section name. */
506 struct GTY(()) gimple_omp_for_iter
{
507 /* Condition code. */
510 /* Index variable. */
525 struct GTY(()) gimple_statement_omp_for
{
527 struct gimple_statement_omp omp
;
533 Number of elements in iter array. */
537 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
540 Pre-body evaluated before the loop body begins. */
545 /* GIMPLE_OMP_PARALLEL */
547 struct GTY(()) gimple_statement_omp_parallel
{
549 struct gimple_statement_omp omp
;
556 Child function holding the body of the parallel region. */
560 Shared data argument. */
565 /* GIMPLE_OMP_TASK */
567 struct GTY(()) gimple_statement_omp_task
{
569 struct gimple_statement_omp_parallel par
;
572 Child function holding firstprivate initialization if needed. */
576 Size and alignment in bytes of the argument data block. */
582 /* GIMPLE_OMP_SECTION */
583 /* Uses struct gimple_statement_omp. */
586 /* GIMPLE_OMP_SECTIONS */
588 struct GTY(()) gimple_statement_omp_sections
{
590 struct gimple_statement_omp omp
;
596 The control variable used for deciding which of the sections to
601 /* GIMPLE_OMP_CONTINUE.
603 Note: This does not inherit from gimple_statement_omp, because we
604 do not need the body field. */
606 struct GTY(()) gimple_statement_omp_continue
{
608 struct gimple_statement_base gsbase
;
617 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS */
619 struct GTY(()) gimple_statement_omp_single
{
621 struct gimple_statement_omp omp
;
628 /* GIMPLE_OMP_ATOMIC_LOAD.
629 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
630 contains a sequence, which we don't need here. */
632 struct GTY(()) gimple_statement_omp_atomic_load
{
634 struct gimple_statement_base gsbase
;
640 /* GIMPLE_OMP_ATOMIC_STORE.
641 See note on GIMPLE_OMP_ATOMIC_LOAD. */
643 struct GTY(()) gimple_statement_omp_atomic_store
{
645 struct gimple_statement_base gsbase
;
651 /* GIMPLE_TRANSACTION. */
653 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
655 /* The __transaction_atomic was declared [[outer]] or it is
656 __transaction_relaxed. */
657 #define GTMA_IS_OUTER (1u << 0)
658 #define GTMA_IS_RELAXED (1u << 1)
659 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
661 /* The transaction is seen to not have an abort. */
662 #define GTMA_HAVE_ABORT (1u << 2)
663 /* The transaction is seen to have loads or stores. */
664 #define GTMA_HAVE_LOAD (1u << 3)
665 #define GTMA_HAVE_STORE (1u << 4)
666 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
667 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
668 /* The transaction WILL enter serial irrevocable mode.
669 An irrevocable block post-dominates the entire transaction, such
670 that all invocations of the transaction will go serial-irrevocable.
671 In such case, we don't bother instrumenting the transaction, and
672 tell the runtime that it should begin the transaction in
673 serial-irrevocable mode. */
674 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
675 /* The transaction contains no instrumentation code whatsover, most
676 likely because it is guaranteed to go irrevocable upon entry. */
677 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
679 struct GTY(()) gimple_statement_transaction
682 struct gimple_statement_with_memory_ops_base gsbase
;
691 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
692 enum gimple_statement_structure_enum
{
693 #include "gsstruct.def"
699 /* Define the overall contents of a gimple tuple. It may be any of the
700 structures declared above for various types of tuples. */
702 union GTY ((desc ("gimple_statement_structure (&%h)"),
703 chain_next ("%h.gsbase.next"), variable_size
)) gimple_statement_d
{
704 struct gimple_statement_base
GTY ((tag ("GSS_BASE"))) gsbase
;
705 struct gimple_statement_with_ops
GTY ((tag ("GSS_WITH_OPS"))) gsops
;
706 struct gimple_statement_with_memory_ops_base
GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase
;
707 struct gimple_statement_with_memory_ops
GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem
;
708 struct gimple_statement_call
GTY ((tag ("GSS_CALL"))) gimple_call
;
709 struct gimple_statement_omp
GTY ((tag ("GSS_OMP"))) omp
;
710 struct gimple_statement_bind
GTY ((tag ("GSS_BIND"))) gimple_bind
;
711 struct gimple_statement_catch
GTY ((tag ("GSS_CATCH"))) gimple_catch
;
712 struct gimple_statement_eh_filter
GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter
;
713 struct gimple_statement_eh_mnt
GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt
;
714 struct gimple_statement_eh_else
GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else
;
715 struct gimple_statement_phi
GTY ((tag ("GSS_PHI"))) gimple_phi
;
716 struct gimple_statement_eh_ctrl
GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl
;
717 struct gimple_statement_try
GTY ((tag ("GSS_TRY"))) gimple_try
;
718 struct gimple_statement_wce
GTY ((tag ("GSS_WCE"))) gimple_wce
;
719 struct gimple_statement_asm
GTY ((tag ("GSS_ASM"))) gimple_asm
;
720 struct gimple_statement_omp_critical
GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical
;
721 struct gimple_statement_omp_for
GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for
;
722 struct gimple_statement_omp_parallel
GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel
;
723 struct gimple_statement_omp_task
GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task
;
724 struct gimple_statement_omp_sections
GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections
;
725 struct gimple_statement_omp_single
GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single
;
726 struct gimple_statement_omp_continue
GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue
;
727 struct gimple_statement_omp_atomic_load
GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load
;
728 struct gimple_statement_omp_atomic_store
GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store
;
729 struct gimple_statement_transaction
GTY((tag ("GSS_TRANSACTION"))) gimple_transaction
;
732 /* Offset in bytes to the location of the operand vector.
733 Zero if there is no operand vector for this tuple structure. */
734 extern size_t const gimple_ops_offset_
[];
736 /* Map GIMPLE codes to GSS codes. */
737 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
739 /* This variable holds the currently expanded gimple statement for purposes
740 of comminucating the profile info to the builtin expanders. */
741 extern gimple currently_expanding_gimple_stmt
;
743 gimple
gimple_build_return (tree
);
745 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
746 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
748 void extract_ops_from_tree_1 (tree
, enum tree_code
*, tree
*, tree
*, tree
*);
751 gimple_build_assign_with_ops (enum tree_code
, tree
,
752 tree
, tree CXX_MEM_STAT_INFO
);
754 gimple_build_assign_with_ops (enum tree_code
, tree
,
755 tree
, tree
, tree CXX_MEM_STAT_INFO
);
757 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
758 #define gimple_build_debug_bind(var,val,stmt) \
759 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
760 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
761 #define gimple_build_debug_source_bind(var,val,stmt) \
762 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
764 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
765 gimple
gimple_build_call (tree
, unsigned, ...);
766 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
767 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
768 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
769 gimple
gimple_build_call_from_tree (tree
);
770 gimple
gimplify_assign (tree
, tree
, gimple_seq
*);
771 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
772 gimple
gimple_build_label (tree label
);
773 gimple
gimple_build_goto (tree dest
);
774 gimple
gimple_build_nop (void);
775 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
776 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
777 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
779 gimple
gimple_build_catch (tree
, gimple_seq
);
780 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
781 gimple
gimple_build_eh_must_not_throw (tree
);
782 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
783 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
784 gimple
gimple_build_wce (gimple_seq
);
785 gimple
gimple_build_resx (int);
786 gimple
gimple_build_eh_dispatch (int);
787 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
788 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
789 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
790 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
791 gimple
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
792 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
793 gimple
gimple_build_omp_section (gimple_seq
);
794 gimple
gimple_build_omp_continue (tree
, tree
);
795 gimple
gimple_build_omp_master (gimple_seq
);
796 gimple
gimple_build_omp_taskgroup (gimple_seq
);
797 gimple
gimple_build_omp_return (bool);
798 gimple
gimple_build_omp_ordered (gimple_seq
);
799 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
800 gimple
gimple_build_omp_sections_switch (void);
801 gimple
gimple_build_omp_single (gimple_seq
, tree
);
802 gimple
gimple_build_omp_target (gimple_seq
, int, tree
);
803 gimple
gimple_build_omp_teams (gimple_seq
, tree
);
804 gimple
gimple_build_cdt (tree
, tree
);
805 gimple
gimple_build_omp_atomic_load (tree
, tree
);
806 gimple
gimple_build_omp_atomic_store (tree
);
807 gimple
gimple_build_transaction (gimple_seq
, tree
);
808 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
809 enum gimple_statement_structure_enum
gss_for_assign (enum tree_code
);
810 void sort_case_labels (vec
<tree
> );
811 void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
812 void gimple_set_body (tree
, gimple_seq
);
813 gimple_seq
gimple_body (tree
);
814 bool gimple_has_body_p (tree
);
815 gimple_seq
gimple_seq_alloc (void);
816 void gimple_seq_free (gimple_seq
);
817 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
818 gimple_seq
gimple_seq_copy (gimple_seq
);
819 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
820 int gimple_call_flags (const_gimple
);
821 int gimple_call_return_flags (const_gimple
);
822 int gimple_call_arg_flags (const_gimple
, unsigned);
823 void gimple_call_reset_alias_info (gimple
);
824 bool gimple_assign_copy_p (gimple
);
825 bool gimple_assign_ssa_name_copy_p (gimple
);
826 bool gimple_assign_unary_nop_p (gimple
);
827 void gimple_set_bb (gimple
, basic_block
);
828 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
829 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
831 tree
gimple_get_lhs (const_gimple
);
832 void gimple_set_lhs (gimple
, tree
);
833 void gimple_replace_lhs (gimple
, tree
);
834 gimple
gimple_copy (gimple
);
835 void gimple_cond_get_ops_from_tree (tree
, enum tree_code
*, tree
*, tree
*);
836 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
837 void gimple_cond_set_condition_from_tree (gimple
, tree
);
838 bool gimple_has_side_effects (const_gimple
);
839 bool gimple_could_trap_p (gimple
);
840 bool gimple_could_trap_p_1 (gimple
, bool, bool);
841 bool gimple_assign_rhs_could_trap_p (gimple
);
842 void gimple_regimplify_operands (gimple
, gimple_stmt_iterator
*);
843 bool empty_body_p (gimple_seq
);
844 unsigned get_gimple_rhs_num_ops (enum tree_code
);
845 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
846 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
847 const char *gimple_decl_printable_name (tree
, int);
849 /* Returns true iff T is a virtual ssa name decl. */
850 extern bool virtual_operand_p (tree
);
851 /* Returns true iff T is a scalar register variable. */
852 extern bool is_gimple_reg (tree
);
853 /* Returns true iff T is any sort of variable. */
854 extern bool is_gimple_variable (tree
);
855 /* Returns true iff T is any sort of symbol. */
856 extern bool is_gimple_id (tree
);
857 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
858 extern bool is_gimple_min_lval (tree
);
859 /* Returns true iff T is something whose address can be taken. */
860 extern bool is_gimple_addressable (tree
);
861 /* Returns true iff T is any valid GIMPLE lvalue. */
862 extern bool is_gimple_lvalue (tree
);
864 /* Returns true iff T is a GIMPLE address. */
865 bool is_gimple_address (const_tree
);
866 /* Returns true iff T is a GIMPLE invariant address. */
867 bool is_gimple_invariant_address (const_tree
);
868 /* Returns true iff T is a GIMPLE invariant address at interprocedural
870 bool is_gimple_ip_invariant_address (const_tree
);
871 /* Returns true iff T is a valid GIMPLE constant. */
872 bool is_gimple_constant (const_tree
);
873 /* Returns true iff T is a GIMPLE restricted function invariant. */
874 extern bool is_gimple_min_invariant (const_tree
);
875 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
876 extern bool is_gimple_ip_invariant (const_tree
);
877 /* Returns true iff T is a GIMPLE rvalue. */
878 extern bool is_gimple_val (tree
);
879 /* Returns true iff T is a GIMPLE asm statement input. */
880 extern bool is_gimple_asm_val (tree
);
881 /* Returns true iff T is a valid address operand of a MEM_REF. */
882 bool is_gimple_mem_ref_addr (tree
);
884 /* Returns true iff T is a valid if-statement condition. */
885 extern bool is_gimple_condexpr (tree
);
887 /* Returns true iff T is a valid call address expression. */
888 extern bool is_gimple_call_addr (tree
);
890 /* Return TRUE iff stmt is a call to a built-in function. */
891 extern bool is_gimple_builtin_call (gimple stmt
);
893 extern void recalculate_side_effects (tree
);
894 extern bool gimple_compare_field_offset (tree
, tree
);
895 extern tree
gimple_unsigned_type (tree
);
896 extern tree
gimple_signed_type (tree
);
897 extern alias_set_type
gimple_get_alias_set (tree
);
898 extern bool walk_stmt_load_store_addr_ops (gimple
, void *,
899 bool (*)(gimple
, tree
, void *),
900 bool (*)(gimple
, tree
, void *),
901 bool (*)(gimple
, tree
, void *));
902 extern bool walk_stmt_load_store_ops (gimple
, void *,
903 bool (*)(gimple
, tree
, void *),
904 bool (*)(gimple
, tree
, void *));
905 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
906 extern bool gimple_call_builtin_p (gimple
, enum built_in_class
);
907 extern bool gimple_call_builtin_p (gimple
, enum built_in_function
);
908 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
909 extern bool useless_type_conversion_p (tree
, tree
);
910 extern bool types_compatible_p (tree
, tree
);
913 extern tree
create_tmp_var_raw (tree
, const char *);
914 extern tree
create_tmp_var_name (const char *);
915 extern tree
create_tmp_var (tree
, const char *);
916 extern tree
create_tmp_reg (tree
, const char *);
917 extern tree
get_initialized_tmp_var (tree
, gimple_seq
*, gimple_seq
*);
918 extern tree
get_formal_tmp_var (tree
, gimple_seq
*);
919 extern void declare_vars (tree
, gimple
, bool);
920 extern void annotate_all_with_location (gimple_seq
, location_t
);
922 /* Validation of GIMPLE expressions. Note that these predicates only check
923 the basic form of the expression, they don't recurse to make sure that
924 underlying nodes are also of the right form. */
925 typedef bool (*gimple_predicate
)(tree
);
928 /* FIXME we should deduce this from the predicate. */
930 fb_none
= 0, /* Do not generate a temporary. */
932 fb_rvalue
= 1, /* Generate an rvalue to hold the result of a
933 gimplified expression. */
935 fb_lvalue
= 2, /* Generate an lvalue to hold the result of a
936 gimplified expression. */
938 fb_mayfail
= 4, /* Gimplification may fail. Error issued
940 fb_either
= fb_rvalue
| fb_lvalue
943 typedef int fallback_t
;
945 enum gimplify_status
{
946 GS_ERROR
= -2, /* Something Bad Seen. */
947 GS_UNHANDLED
= -1, /* A langhook result for "I dunno". */
948 GS_OK
= 0, /* We did something, maybe more to do. */
949 GS_ALL_DONE
= 1 /* The expression is fully gimplified. */
952 /* Formal (expression) temporary table handling: multiple occurrences of
953 the same scalar expression are evaluated into the same temporary. */
955 typedef struct gimple_temp_hash_elt
958 tree temp
; /* Value */
961 /* Gimplify hashtable helper. */
963 struct gimplify_hasher
: typed_free_remove
<elt_t
>
965 typedef elt_t value_type
;
966 typedef elt_t compare_type
;
967 static inline hashval_t
hash (const value_type
*);
968 static inline bool equal (const value_type
*, const compare_type
*);
972 gimplify_hasher::hash (const value_type
*p
)
975 return iterative_hash_expr (t
, 0);
979 gimplify_hasher::equal (const value_type
*p1
, const compare_type
*p2
)
983 enum tree_code code
= TREE_CODE (t1
);
985 if (TREE_CODE (t2
) != code
986 || TREE_TYPE (t1
) != TREE_TYPE (t2
))
989 if (!operand_equal_p (t1
, t2
, 0))
992 #ifdef ENABLE_CHECKING
993 /* Only allow them to compare equal if they also hash equal; otherwise
994 results are nondeterminate, and we fail bootstrap comparison. */
995 gcc_assert (hash (p1
) == hash (p2
));
1003 struct gimplify_ctx
*prev_context
;
1005 vec
<gimple
> bind_expr_stack
;
1007 gimple_seq conditional_cleanups
;
1011 vec
<tree
> case_labels
;
1012 /* The formal temporary table. Should this be persistent? */
1013 hash_table
<gimplify_hasher
> temp_htab
;
1018 bool allow_rhs_cond_expr
;
1019 bool in_cleanup_point_expr
;
1022 /* Return true if gimplify_one_sizepos doesn't need to gimplify
1023 expr (when in TYPE_SIZE{,_UNIT} and similar type/decl size/bitsize
1026 is_gimple_sizepos (tree expr
)
1028 /* gimplify_one_sizepos doesn't need to do anything if the value isn't there,
1029 is constant, or contains A PLACEHOLDER_EXPR. We also don't want to do
1030 anything if it's already a VAR_DECL. If it's a VAR_DECL from another
1031 function, the gimplifier will want to replace it with a new variable,
1032 but that will cause problems if this type is from outside the function.
1033 It's OK to have that here. */
1034 return (expr
== NULL_TREE
1035 || TREE_CONSTANT (expr
)
1036 || TREE_CODE (expr
) == VAR_DECL
1037 || CONTAINS_PLACEHOLDER_P (expr
));
1040 /* Get the number of the next statement uid to be allocated. */
1041 static inline unsigned int
1042 gimple_stmt_max_uid (struct function
*fn
)
1044 return fn
->last_stmt_uid
;
1047 /* Set the number of the next statement uid to be allocated. */
1049 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1051 fn
->last_stmt_uid
= maxid
;
1054 /* Set the number of the next statement uid to be allocated. */
1055 static inline unsigned int
1056 inc_gimple_stmt_max_uid (struct function
*fn
)
1058 return fn
->last_stmt_uid
++;
1061 extern enum gimplify_status
gimplify_expr (tree
*, gimple_seq
*, gimple_seq
*,
1062 bool (*) (tree
), fallback_t
);
1063 extern void gimplify_type_sizes (tree
, gimple_seq
*);
1064 extern void gimplify_one_sizepos (tree
*, gimple_seq
*);
1065 enum gimplify_status
gimplify_self_mod_expr (tree
*, gimple_seq
*, gimple_seq
*,
1067 extern bool gimplify_stmt (tree
*, gimple_seq
*);
1068 extern gimple
gimplify_body (tree
, bool);
1069 extern void push_gimplify_context (struct gimplify_ctx
*);
1070 extern void pop_gimplify_context (gimple
);
1071 extern void gimplify_and_add (tree
, gimple_seq
*);
1073 /* Miscellaneous helpers. */
1074 extern void gimple_add_tmp_var (tree
);
1075 extern gimple
gimple_current_bind_expr (void);
1076 extern vec
<gimple
> gimple_bind_expr_stack (void);
1077 extern tree
voidify_wrapper_expr (tree
, tree
);
1078 extern tree
build_and_jump (tree
*);
1079 extern tree
force_labels_r (tree
*, int *, void *);
1080 extern enum gimplify_status
gimplify_va_arg_expr (tree
*, gimple_seq
*,
1082 struct gimplify_omp_ctx
;
1083 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx
*, tree
);
1084 extern tree
gimple_boolify (tree
);
1085 extern gimple_predicate
rhs_predicate_for (tree
);
1086 extern tree
canonicalize_cond_expr_cond (tree
);
1087 extern void dump_decl_set (FILE *, bitmap
);
1088 extern bool gimple_can_coalesce_p (tree
, tree
);
1089 extern bool nonfreeing_call_p (gimple
);
1090 extern tree
copy_var_decl (tree
, tree
, tree
);
1092 /* In trans-mem.c. */
1093 extern void diagnose_tm_safe_errors (tree
);
1094 extern void compute_transaction_bits (void);
1096 /* In tree-nested.c. */
1097 extern void lower_nested_functions (tree
);
1098 extern void insert_field_into_struct (tree
, tree
);
1100 /* In gimplify.c. */
1101 extern void gimplify_function_tree (tree
);
1103 /* In cfgexpand.c. */
1104 extern tree
gimple_assign_rhs_to_tree (gimple
);
1107 extern bool validate_gimple_arglist (const_gimple
, ...);
1109 /* Return the first node in GIMPLE sequence S. */
1111 static inline gimple_seq_node
1112 gimple_seq_first (gimple_seq s
)
1118 /* Return the first statement in GIMPLE sequence S. */
1120 static inline gimple
1121 gimple_seq_first_stmt (gimple_seq s
)
1123 gimple_seq_node n
= gimple_seq_first (s
);
1128 /* Return the last node in GIMPLE sequence S. */
1130 static inline gimple_seq_node
1131 gimple_seq_last (gimple_seq s
)
1133 return s
? s
->gsbase
.prev
: NULL
;
1137 /* Return the last statement in GIMPLE sequence S. */
1139 static inline gimple
1140 gimple_seq_last_stmt (gimple_seq s
)
1142 gimple_seq_node n
= gimple_seq_last (s
);
1147 /* Set the last node in GIMPLE sequence *PS to LAST. */
1150 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1152 (*ps
)->gsbase
.prev
= last
;
1156 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1159 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1165 /* Return true if GIMPLE sequence S is empty. */
1168 gimple_seq_empty_p (gimple_seq s
)
1173 void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1175 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1176 *SEQ_P is NULL, a new sequence is allocated. This function is
1177 similar to gimple_seq_add_stmt, but does not scan the operands.
1178 During gimplification, we need to manipulate statement sequences
1179 before the def/use vectors have been constructed. */
1180 void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1182 /* Allocate a new sequence and initialize its first element with STMT. */
1184 static inline gimple_seq
1185 gimple_seq_alloc_with_stmt (gimple stmt
)
1187 gimple_seq seq
= NULL
;
1188 gimple_seq_add_stmt (&seq
, stmt
);
1193 /* Returns the sequence of statements in BB. */
1195 static inline gimple_seq
1196 bb_seq (const_basic_block bb
)
1198 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1201 static inline gimple_seq
*
1202 bb_seq_addr (basic_block bb
)
1204 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1207 /* Sets the sequence of statements in BB to SEQ. */
1210 set_bb_seq (basic_block bb
, gimple_seq seq
)
1212 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1213 bb
->il
.gimple
.seq
= seq
;
1217 /* Return the code for GIMPLE statement G. */
1219 static inline enum gimple_code
1220 gimple_code (const_gimple g
)
1222 return g
->gsbase
.code
;
1226 /* Return the GSS code used by a GIMPLE code. */
1228 static inline enum gimple_statement_structure_enum
1229 gss_for_code (enum gimple_code code
)
1231 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1232 return gss_for_code_
[code
];
1236 /* Return which GSS code is used by GS. */
1238 static inline enum gimple_statement_structure_enum
1239 gimple_statement_structure (gimple gs
)
1241 return gss_for_code (gimple_code (gs
));
1245 /* Return true if statement G has sub-statements. This is only true for
1246 High GIMPLE statements. */
1249 gimple_has_substatements (gimple g
)
1251 switch (gimple_code (g
))
1255 case GIMPLE_EH_FILTER
:
1256 case GIMPLE_EH_ELSE
:
1258 case GIMPLE_OMP_FOR
:
1259 case GIMPLE_OMP_MASTER
:
1260 case GIMPLE_OMP_TASKGROUP
:
1261 case GIMPLE_OMP_ORDERED
:
1262 case GIMPLE_OMP_SECTION
:
1263 case GIMPLE_OMP_PARALLEL
:
1264 case GIMPLE_OMP_TASK
:
1265 case GIMPLE_OMP_SECTIONS
:
1266 case GIMPLE_OMP_SINGLE
:
1267 case GIMPLE_OMP_TARGET
:
1268 case GIMPLE_OMP_TEAMS
:
1269 case GIMPLE_OMP_CRITICAL
:
1270 case GIMPLE_WITH_CLEANUP_EXPR
:
1271 case GIMPLE_TRANSACTION
:
1280 /* Return the basic block holding statement G. */
1282 static inline basic_block
1283 gimple_bb (const_gimple g
)
1285 return g
->gsbase
.bb
;
1289 /* Return the lexical scope block holding statement G. */
1292 gimple_block (const_gimple g
)
1294 return LOCATION_BLOCK (g
->gsbase
.location
);
1298 /* Set BLOCK to be the lexical scope block holding statement G. */
1301 gimple_set_block (gimple g
, tree block
)
1304 g
->gsbase
.location
=
1305 COMBINE_LOCATION_DATA (line_table
, g
->gsbase
.location
, block
);
1307 g
->gsbase
.location
= LOCATION_LOCUS (g
->gsbase
.location
);
1311 /* Return location information for statement G. */
1313 static inline location_t
1314 gimple_location (const_gimple g
)
1316 return g
->gsbase
.location
;
1319 /* Return pointer to location information for statement G. */
1321 static inline const location_t
*
1322 gimple_location_ptr (const_gimple g
)
1324 return &g
->gsbase
.location
;
1328 /* Set location information for statement G. */
1331 gimple_set_location (gimple g
, location_t location
)
1333 g
->gsbase
.location
= location
;
1337 /* Return true if G contains location information. */
1340 gimple_has_location (const_gimple g
)
1342 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1346 /* Return the file name of the location of STMT. */
1348 static inline const char *
1349 gimple_filename (const_gimple stmt
)
1351 return LOCATION_FILE (gimple_location (stmt
));
1355 /* Return the line number of the location of STMT. */
1358 gimple_lineno (const_gimple stmt
)
1360 return LOCATION_LINE (gimple_location (stmt
));
1364 /* Determine whether SEQ is a singleton. */
1367 gimple_seq_singleton_p (gimple_seq seq
)
1369 return ((gimple_seq_first (seq
) != NULL
)
1370 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1373 /* Return true if no warnings should be emitted for statement STMT. */
1376 gimple_no_warning_p (const_gimple stmt
)
1378 return stmt
->gsbase
.no_warning
;
1381 /* Set the no_warning flag of STMT to NO_WARNING. */
1384 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1386 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1389 /* Set the visited status on statement STMT to VISITED_P. */
1392 gimple_set_visited (gimple stmt
, bool visited_p
)
1394 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1398 /* Return the visited status for statement STMT. */
1401 gimple_visited_p (gimple stmt
)
1403 return stmt
->gsbase
.visited
;
1407 /* Set pass local flag PLF on statement STMT to VAL_P. */
1410 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1413 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1415 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1419 /* Return the value of pass local flag PLF on statement STMT. */
1421 static inline unsigned int
1422 gimple_plf (gimple stmt
, enum plf_mask plf
)
1424 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1428 /* Set the UID of statement. */
1431 gimple_set_uid (gimple g
, unsigned uid
)
1433 g
->gsbase
.uid
= uid
;
1437 /* Return the UID of statement. */
1439 static inline unsigned
1440 gimple_uid (const_gimple g
)
1442 return g
->gsbase
.uid
;
1446 /* Make statement G a singleton sequence. */
1449 gimple_init_singleton (gimple g
)
1451 g
->gsbase
.next
= NULL
;
1456 /* Return true if GIMPLE statement G has register or memory operands. */
1459 gimple_has_ops (const_gimple g
)
1461 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1465 /* Return true if GIMPLE statement G has memory operands. */
1468 gimple_has_mem_ops (const_gimple g
)
1470 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1474 /* Return the set of USE operands for statement G. */
1476 static inline struct use_optype_d
*
1477 gimple_use_ops (const_gimple g
)
1479 if (!gimple_has_ops (g
))
1481 return g
->gsops
.opbase
.use_ops
;
1485 /* Set USE to be the set of USE operands for statement G. */
1488 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1490 gcc_gimple_checking_assert (gimple_has_ops (g
));
1491 g
->gsops
.opbase
.use_ops
= use
;
1495 /* Return the single VUSE operand of the statement G. */
1498 gimple_vuse (const_gimple g
)
1500 if (!gimple_has_mem_ops (g
))
1502 return g
->gsmembase
.vuse
;
1505 /* Return the single VDEF operand of the statement G. */
1508 gimple_vdef (const_gimple g
)
1510 if (!gimple_has_mem_ops (g
))
1512 return g
->gsmembase
.vdef
;
1515 /* Return the single VUSE operand of the statement G. */
1517 static inline tree
*
1518 gimple_vuse_ptr (gimple g
)
1520 if (!gimple_has_mem_ops (g
))
1522 return &g
->gsmembase
.vuse
;
1525 /* Return the single VDEF operand of the statement G. */
1527 static inline tree
*
1528 gimple_vdef_ptr (gimple g
)
1530 if (!gimple_has_mem_ops (g
))
1532 return &g
->gsmembase
.vdef
;
1535 /* Set the single VUSE operand of the statement G. */
1538 gimple_set_vuse (gimple g
, tree vuse
)
1540 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1541 g
->gsmembase
.vuse
= vuse
;
1544 /* Set the single VDEF operand of the statement G. */
1547 gimple_set_vdef (gimple g
, tree vdef
)
1549 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1550 g
->gsmembase
.vdef
= vdef
;
1554 /* Return true if statement G has operands and the modified field has
1558 gimple_modified_p (const_gimple g
)
1560 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1564 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1565 a MODIFIED field. */
1568 gimple_set_modified (gimple s
, bool modifiedp
)
1570 if (gimple_has_ops (s
))
1571 s
->gsbase
.modified
= (unsigned) modifiedp
;
1575 /* Return the tree code for the expression computed by STMT. This is
1576 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1577 GIMPLE_CALL, return CALL_EXPR as the expression code for
1578 consistency. This is useful when the caller needs to deal with the
1579 three kinds of computation that GIMPLE supports. */
1581 static inline enum tree_code
1582 gimple_expr_code (const_gimple stmt
)
1584 enum gimple_code code
= gimple_code (stmt
);
1585 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1586 return (enum tree_code
) stmt
->gsbase
.subcode
;
1589 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1595 /* Return true if statement STMT contains volatile operands. */
1598 gimple_has_volatile_ops (const_gimple stmt
)
1600 if (gimple_has_mem_ops (stmt
))
1601 return stmt
->gsbase
.has_volatile_ops
;
1607 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1610 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1612 if (gimple_has_mem_ops (stmt
))
1613 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1616 /* Return true if BB is in a transaction. */
1619 block_in_transaction (basic_block bb
)
1621 return flag_tm
&& bb
->flags
& BB_IN_TRANSACTION
;
1624 /* Return true if STMT is in a transaction. */
1627 gimple_in_transaction (gimple stmt
)
1629 return block_in_transaction (gimple_bb (stmt
));
1632 /* Return true if statement STMT may access memory. */
1635 gimple_references_memory_p (gimple stmt
)
1637 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1641 /* Return the subcode for OMP statement S. */
1643 static inline unsigned
1644 gimple_omp_subcode (const_gimple s
)
1646 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1647 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
1648 return s
->gsbase
.subcode
;
1651 /* Set the subcode for OMP statement S to SUBCODE. */
1654 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1656 /* We only have 16 bits for the subcode. Assert that we are not
1658 gcc_gimple_checking_assert (subcode
< (1 << 16));
1659 s
->gsbase
.subcode
= subcode
;
1662 /* Set the nowait flag on OMP_RETURN statement S. */
1665 gimple_omp_return_set_nowait (gimple s
)
1667 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1668 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1672 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1676 gimple_omp_return_nowait_p (const_gimple g
)
1678 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1679 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1683 /* Set the LHS of OMP return. */
1686 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
1688 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1689 g
->gimple_omp_atomic_store
.val
= lhs
;
1693 /* Get the LHS of OMP return. */
1696 gimple_omp_return_lhs (const_gimple g
)
1698 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1699 return g
->gimple_omp_atomic_store
.val
;
1703 /* Return a pointer to the LHS of OMP return. */
1705 static inline tree
*
1706 gimple_omp_return_lhs_ptr (gimple g
)
1708 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1709 return &g
->gimple_omp_atomic_store
.val
;
1713 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1717 gimple_omp_section_last_p (const_gimple g
)
1719 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1720 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1724 /* Set the GF_OMP_SECTION_LAST flag on G. */
1727 gimple_omp_section_set_last (gimple g
)
1729 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1730 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1734 /* Return true if OMP parallel statement G has the
1735 GF_OMP_PARALLEL_COMBINED flag set. */
1738 gimple_omp_parallel_combined_p (const_gimple g
)
1740 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1741 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1745 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1746 value of COMBINED_P. */
1749 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1751 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1753 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1755 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1759 /* Return true if OMP atomic load/store statement G has the
1760 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1763 gimple_omp_atomic_need_value_p (const_gimple g
)
1765 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1766 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1767 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
1771 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1774 gimple_omp_atomic_set_need_value (gimple g
)
1776 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1777 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1778 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
1782 /* Return true if OMP atomic load/store statement G has the
1783 GF_OMP_ATOMIC_SEQ_CST flag set. */
1786 gimple_omp_atomic_seq_cst_p (const_gimple g
)
1788 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1789 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1790 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
1794 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
1797 gimple_omp_atomic_set_seq_cst (gimple g
)
1799 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1800 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1801 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
1805 /* Return the number of operands for statement GS. */
1807 static inline unsigned
1808 gimple_num_ops (const_gimple gs
)
1810 return gs
->gsbase
.num_ops
;
1814 /* Set the number of operands for statement GS. */
1817 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1819 gs
->gsbase
.num_ops
= num_ops
;
1823 /* Return the array of operands for statement GS. */
1825 static inline tree
*
1826 gimple_ops (gimple gs
)
1830 /* All the tuples have their operand vector at the very bottom
1831 of the structure. Note that those structures that do not
1832 have an operand vector have a zero offset. */
1833 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1834 gcc_gimple_checking_assert (off
!= 0);
1836 return (tree
*) ((char *) gs
+ off
);
1840 /* Return operand I for statement GS. */
1843 gimple_op (const_gimple gs
, unsigned i
)
1845 if (gimple_has_ops (gs
))
1847 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1848 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1854 /* Return a pointer to operand I for statement GS. */
1856 static inline tree
*
1857 gimple_op_ptr (const_gimple gs
, unsigned i
)
1859 if (gimple_has_ops (gs
))
1861 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1862 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1868 /* Set operand I of statement GS to OP. */
1871 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1873 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1875 /* Note. It may be tempting to assert that OP matches
1876 is_gimple_operand, but that would be wrong. Different tuples
1877 accept slightly different sets of tree operands. Each caller
1878 should perform its own validation. */
1879 gimple_ops (gs
)[i
] = op
;
1882 /* Return true if GS is a GIMPLE_ASSIGN. */
1885 is_gimple_assign (const_gimple gs
)
1887 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1890 /* Determine if expression CODE is one of the valid expressions that can
1891 be used on the RHS of GIMPLE assignments. */
1893 static inline enum gimple_rhs_class
1894 get_gimple_rhs_class (enum tree_code code
)
1896 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1899 /* Return the LHS of assignment statement GS. */
1902 gimple_assign_lhs (const_gimple gs
)
1904 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1905 return gimple_op (gs
, 0);
1909 /* Return a pointer to the LHS of assignment statement GS. */
1911 static inline tree
*
1912 gimple_assign_lhs_ptr (const_gimple gs
)
1914 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1915 return gimple_op_ptr (gs
, 0);
1919 /* Set LHS to be the LHS operand of assignment statement GS. */
1922 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1924 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1925 gimple_set_op (gs
, 0, lhs
);
1927 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1928 SSA_NAME_DEF_STMT (lhs
) = gs
;
1932 /* Return the first operand on the RHS of assignment statement GS. */
1935 gimple_assign_rhs1 (const_gimple gs
)
1937 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1938 return gimple_op (gs
, 1);
1942 /* Return a pointer to the first operand on the RHS of assignment
1945 static inline tree
*
1946 gimple_assign_rhs1_ptr (const_gimple gs
)
1948 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1949 return gimple_op_ptr (gs
, 1);
1952 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1955 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1957 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1959 gimple_set_op (gs
, 1, rhs
);
1963 /* Return the second operand on the RHS of assignment statement GS.
1964 If GS does not have two operands, NULL is returned instead. */
1967 gimple_assign_rhs2 (const_gimple gs
)
1969 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1971 if (gimple_num_ops (gs
) >= 3)
1972 return gimple_op (gs
, 2);
1978 /* Return a pointer to the second operand on the RHS of assignment
1981 static inline tree
*
1982 gimple_assign_rhs2_ptr (const_gimple gs
)
1984 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1985 return gimple_op_ptr (gs
, 2);
1989 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1992 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1994 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1996 gimple_set_op (gs
, 2, rhs
);
1999 /* Return the third operand on the RHS of assignment statement GS.
2000 If GS does not have two operands, NULL is returned instead. */
2003 gimple_assign_rhs3 (const_gimple gs
)
2005 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2007 if (gimple_num_ops (gs
) >= 4)
2008 return gimple_op (gs
, 3);
2013 /* Return a pointer to the third operand on the RHS of assignment
2016 static inline tree
*
2017 gimple_assign_rhs3_ptr (const_gimple gs
)
2019 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2020 return gimple_op_ptr (gs
, 3);
2024 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2027 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
2029 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2031 gimple_set_op (gs
, 3, rhs
);
2034 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2035 to see only a maximum of two operands. */
2038 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2041 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
2044 /* A wrapper around extract_ops_from_tree_1, for callers which expect
2045 to see only a maximum of two operands. */
2048 extract_ops_from_tree (tree expr
, enum tree_code
*code
, tree
*op0
,
2052 extract_ops_from_tree_1 (expr
, code
, op0
, op1
, &op2
);
2053 gcc_assert (op2
== NULL_TREE
);
2056 /* Returns true if GS is a nontemporal move. */
2059 gimple_assign_nontemporal_move_p (const_gimple gs
)
2061 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2062 return gs
->gsbase
.nontemporal_move
;
2065 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2068 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
2070 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2071 gs
->gsbase
.nontemporal_move
= nontemporal
;
2075 /* Return the code of the expression computed on the rhs of assignment
2076 statement GS. In case that the RHS is a single object, returns the
2077 tree code of the object. */
2079 static inline enum tree_code
2080 gimple_assign_rhs_code (const_gimple gs
)
2082 enum tree_code code
;
2083 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2085 code
= (enum tree_code
) gs
->gsbase
.subcode
;
2086 /* While we initially set subcode to the TREE_CODE of the rhs for
2087 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2088 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2089 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2090 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2096 /* Set CODE to be the code for the expression computed on the RHS of
2100 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2102 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2103 s
->gsbase
.subcode
= code
;
2107 /* Return the gimple rhs class of the code of the expression computed on
2108 the rhs of assignment statement GS.
2109 This will never return GIMPLE_INVALID_RHS. */
2111 static inline enum gimple_rhs_class
2112 gimple_assign_rhs_class (const_gimple gs
)
2114 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2117 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2118 there is no operator associated with the assignment itself.
2119 Unlike gimple_assign_copy_p, this predicate returns true for
2120 any RHS operand, including those that perform an operation
2121 and do not have the semantics of a copy, such as COND_EXPR. */
2124 gimple_assign_single_p (gimple gs
)
2126 return (is_gimple_assign (gs
)
2127 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2130 /* Return true if GS performs a store to its lhs. */
2133 gimple_store_p (gimple gs
)
2135 tree lhs
= gimple_get_lhs (gs
);
2136 return lhs
&& !is_gimple_reg (lhs
);
2139 /* Return true if GS is an assignment that loads from its rhs1. */
2142 gimple_assign_load_p (gimple gs
)
2145 if (!gimple_assign_single_p (gs
))
2147 rhs
= gimple_assign_rhs1 (gs
);
2148 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2150 rhs
= get_base_address (rhs
);
2151 return (DECL_P (rhs
)
2152 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2156 /* Return true if S is a type-cast assignment. */
2159 gimple_assign_cast_p (gimple s
)
2161 if (is_gimple_assign (s
))
2163 enum tree_code sc
= gimple_assign_rhs_code (s
);
2164 return CONVERT_EXPR_CODE_P (sc
)
2165 || sc
== VIEW_CONVERT_EXPR
2166 || sc
== FIX_TRUNC_EXPR
;
2172 /* Return true if S is a clobber statement. */
2175 gimple_clobber_p (gimple s
)
2177 return gimple_assign_single_p (s
)
2178 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2181 /* Return true if GS is a GIMPLE_CALL. */
2184 is_gimple_call (const_gimple gs
)
2186 return gimple_code (gs
) == GIMPLE_CALL
;
2189 /* Return the LHS of call statement GS. */
2192 gimple_call_lhs (const_gimple gs
)
2194 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2195 return gimple_op (gs
, 0);
2199 /* Return a pointer to the LHS of call statement GS. */
2201 static inline tree
*
2202 gimple_call_lhs_ptr (const_gimple gs
)
2204 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2205 return gimple_op_ptr (gs
, 0);
2209 /* Set LHS to be the LHS operand of call statement GS. */
2212 gimple_call_set_lhs (gimple gs
, tree lhs
)
2214 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2215 gimple_set_op (gs
, 0, lhs
);
2216 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2217 SSA_NAME_DEF_STMT (lhs
) = gs
;
2221 /* Return true if call GS calls an internal-only function, as enumerated
2225 gimple_call_internal_p (const_gimple gs
)
2227 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2228 return (gs
->gsbase
.subcode
& GF_CALL_INTERNAL
) != 0;
2232 /* Return the target of internal call GS. */
2234 static inline enum internal_fn
2235 gimple_call_internal_fn (const_gimple gs
)
2237 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2238 return gs
->gimple_call
.u
.internal_fn
;
2242 /* Return the function type of the function called by GS. */
2245 gimple_call_fntype (const_gimple gs
)
2247 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2248 if (gimple_call_internal_p (gs
))
2250 return gs
->gimple_call
.u
.fntype
;
2253 /* Set the type of the function called by GS to FNTYPE. */
2256 gimple_call_set_fntype (gimple gs
, tree fntype
)
2258 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2259 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2260 gs
->gimple_call
.u
.fntype
= fntype
;
2264 /* Return the tree node representing the function called by call
2268 gimple_call_fn (const_gimple gs
)
2270 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2271 return gimple_op (gs
, 1);
2274 /* Return a pointer to the tree node representing the function called by call
2277 static inline tree
*
2278 gimple_call_fn_ptr (const_gimple gs
)
2280 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2281 return gimple_op_ptr (gs
, 1);
2285 /* Set FN to be the function called by call statement GS. */
2288 gimple_call_set_fn (gimple gs
, tree fn
)
2290 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2291 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2292 gimple_set_op (gs
, 1, fn
);
2296 /* Set FNDECL to be the function called by call statement GS. */
2299 gimple_call_set_fndecl (gimple gs
, tree decl
)
2301 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2302 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2303 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2307 /* Set internal function FN to be the function called by call statement GS. */
2310 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2312 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2313 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2314 gs
->gimple_call
.u
.internal_fn
= fn
;
2318 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2319 associated with the callee if known. Otherwise return NULL_TREE. */
2322 gimple_call_addr_fndecl (const_tree fn
)
2324 if (fn
&& TREE_CODE (fn
) == ADDR_EXPR
)
2326 tree fndecl
= TREE_OPERAND (fn
, 0);
2327 if (TREE_CODE (fndecl
) == MEM_REF
2328 && TREE_CODE (TREE_OPERAND (fndecl
, 0)) == ADDR_EXPR
2329 && integer_zerop (TREE_OPERAND (fndecl
, 1)))
2330 fndecl
= TREE_OPERAND (TREE_OPERAND (fndecl
, 0), 0);
2331 if (TREE_CODE (fndecl
) == FUNCTION_DECL
)
2337 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2338 Otherwise return NULL. This function is analogous to
2339 get_callee_fndecl in tree land. */
2342 gimple_call_fndecl (const_gimple gs
)
2344 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2348 /* Return the type returned by call statement GS. */
2351 gimple_call_return_type (const_gimple gs
)
2353 tree type
= gimple_call_fntype (gs
);
2355 if (type
== NULL_TREE
)
2356 return TREE_TYPE (gimple_call_lhs (gs
));
2358 /* The type returned by a function is the type of its
2360 return TREE_TYPE (type
);
2364 /* Return the static chain for call statement GS. */
2367 gimple_call_chain (const_gimple gs
)
2369 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2370 return gimple_op (gs
, 2);
2374 /* Return a pointer to the static chain for call statement GS. */
2376 static inline tree
*
2377 gimple_call_chain_ptr (const_gimple gs
)
2379 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2380 return gimple_op_ptr (gs
, 2);
2383 /* Set CHAIN to be the static chain for call statement GS. */
2386 gimple_call_set_chain (gimple gs
, tree chain
)
2388 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2390 gimple_set_op (gs
, 2, chain
);
2394 /* Return the number of arguments used by call statement GS. */
2396 static inline unsigned
2397 gimple_call_num_args (const_gimple gs
)
2400 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2401 num_ops
= gimple_num_ops (gs
);
2406 /* Return the argument at position INDEX for call statement GS. */
2409 gimple_call_arg (const_gimple gs
, unsigned index
)
2411 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2412 return gimple_op (gs
, index
+ 3);
2416 /* Return a pointer to the argument at position INDEX for call
2419 static inline tree
*
2420 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2422 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2423 return gimple_op_ptr (gs
, index
+ 3);
2427 /* Set ARG to be the argument at position INDEX for call statement GS. */
2430 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2432 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2433 gimple_set_op (gs
, index
+ 3, arg
);
2437 /* If TAIL_P is true, mark call statement S as being a tail call
2438 (i.e., a call just before the exit of a function). These calls are
2439 candidate for tail call optimization. */
2442 gimple_call_set_tail (gimple s
, bool tail_p
)
2444 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2446 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2448 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2452 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2455 gimple_call_tail_p (gimple s
)
2457 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2458 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2462 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2463 slot optimization. This transformation uses the target of the call
2464 expansion as the return slot for calls that return in memory. */
2467 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2469 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2470 if (return_slot_opt_p
)
2471 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2473 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2477 /* Return true if S is marked for return slot optimization. */
2480 gimple_call_return_slot_opt_p (gimple s
)
2482 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2483 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2487 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2488 thunk to the thunked-to function. */
2491 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2493 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2495 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2497 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2501 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2504 gimple_call_from_thunk_p (gimple s
)
2506 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2507 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2511 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2512 argument pack in its argument list. */
2515 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2517 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2518 if (pass_arg_pack_p
)
2519 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2521 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2525 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2526 argument pack in its argument list. */
2529 gimple_call_va_arg_pack_p (gimple s
)
2531 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2532 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2536 /* Return true if S is a noreturn call. */
2539 gimple_call_noreturn_p (gimple s
)
2541 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2542 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2546 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2547 even if the called function can throw in other cases. */
2550 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2552 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2554 s
->gsbase
.subcode
|= GF_CALL_NOTHROW
;
2556 s
->gsbase
.subcode
&= ~GF_CALL_NOTHROW
;
2559 /* Return true if S is a nothrow call. */
2562 gimple_call_nothrow_p (gimple s
)
2564 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2565 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2568 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2569 is known to be emitted for VLA objects. Those are wrapped by
2570 stack_save/stack_restore calls and hence can't lead to unbounded
2571 stack growth even when they occur in loops. */
2574 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2576 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2578 s
->gsbase
.subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2580 s
->gsbase
.subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2583 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2586 gimple_call_alloca_for_var_p (gimple s
)
2588 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2589 return (s
->gsbase
.subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2592 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2595 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2597 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2598 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2599 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2603 /* Return a pointer to the points-to solution for the set of call-used
2604 variables of the call CALL. */
2606 static inline struct pt_solution
*
2607 gimple_call_use_set (gimple call
)
2609 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2610 return &call
->gimple_call
.call_used
;
2614 /* Return a pointer to the points-to solution for the set of call-used
2615 variables of the call CALL. */
2617 static inline struct pt_solution
*
2618 gimple_call_clobber_set (gimple call
)
2620 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2621 return &call
->gimple_call
.call_clobbered
;
2625 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2629 gimple_has_lhs (gimple stmt
)
2631 return (is_gimple_assign (stmt
)
2632 || (is_gimple_call (stmt
)
2633 && gimple_call_lhs (stmt
) != NULL_TREE
));
2637 /* Return the code of the predicate computed by conditional statement GS. */
2639 static inline enum tree_code
2640 gimple_cond_code (const_gimple gs
)
2642 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2643 return (enum tree_code
) gs
->gsbase
.subcode
;
2647 /* Set CODE to be the predicate code for the conditional statement GS. */
2650 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2652 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2653 gs
->gsbase
.subcode
= code
;
2657 /* Return the LHS of the predicate computed by conditional statement GS. */
2660 gimple_cond_lhs (const_gimple gs
)
2662 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2663 return gimple_op (gs
, 0);
2666 /* Return the pointer to the LHS of the predicate computed by conditional
2669 static inline tree
*
2670 gimple_cond_lhs_ptr (const_gimple gs
)
2672 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2673 return gimple_op_ptr (gs
, 0);
2676 /* Set LHS to be the LHS operand of the predicate computed by
2677 conditional statement GS. */
2680 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2682 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2683 gimple_set_op (gs
, 0, lhs
);
2687 /* Return the RHS operand of the predicate computed by conditional GS. */
2690 gimple_cond_rhs (const_gimple gs
)
2692 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2693 return gimple_op (gs
, 1);
2696 /* Return the pointer to the RHS operand of the predicate computed by
2699 static inline tree
*
2700 gimple_cond_rhs_ptr (const_gimple gs
)
2702 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2703 return gimple_op_ptr (gs
, 1);
2707 /* Set RHS to be the RHS operand of the predicate computed by
2708 conditional statement GS. */
2711 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2713 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2714 gimple_set_op (gs
, 1, rhs
);
2718 /* Return the label used by conditional statement GS when its
2719 predicate evaluates to true. */
2722 gimple_cond_true_label (const_gimple gs
)
2724 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2725 return gimple_op (gs
, 2);
2729 /* Set LABEL to be the label used by conditional statement GS when its
2730 predicate evaluates to true. */
2733 gimple_cond_set_true_label (gimple gs
, tree label
)
2735 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2736 gimple_set_op (gs
, 2, label
);
2740 /* Set LABEL to be the label used by conditional statement GS when its
2741 predicate evaluates to false. */
2744 gimple_cond_set_false_label (gimple gs
, tree label
)
2746 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2747 gimple_set_op (gs
, 3, label
);
2751 /* Return the label used by conditional statement GS when its
2752 predicate evaluates to false. */
2755 gimple_cond_false_label (const_gimple gs
)
2757 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2758 return gimple_op (gs
, 3);
2762 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2765 gimple_cond_make_false (gimple gs
)
2767 gimple_cond_set_lhs (gs
, boolean_true_node
);
2768 gimple_cond_set_rhs (gs
, boolean_false_node
);
2769 gs
->gsbase
.subcode
= EQ_EXPR
;
2773 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2776 gimple_cond_make_true (gimple gs
)
2778 gimple_cond_set_lhs (gs
, boolean_true_node
);
2779 gimple_cond_set_rhs (gs
, boolean_true_node
);
2780 gs
->gsbase
.subcode
= EQ_EXPR
;
2783 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2784 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2787 gimple_cond_true_p (const_gimple gs
)
2789 tree lhs
= gimple_cond_lhs (gs
);
2790 tree rhs
= gimple_cond_rhs (gs
);
2791 enum tree_code code
= gimple_cond_code (gs
);
2793 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2796 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2799 if (code
== NE_EXPR
&& lhs
!= rhs
)
2802 if (code
== EQ_EXPR
&& lhs
== rhs
)
2808 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2809 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2812 gimple_cond_false_p (const_gimple gs
)
2814 tree lhs
= gimple_cond_lhs (gs
);
2815 tree rhs
= gimple_cond_rhs (gs
);
2816 enum tree_code code
= gimple_cond_code (gs
);
2818 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2821 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2824 if (code
== NE_EXPR
&& lhs
== rhs
)
2827 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2833 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2836 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2838 gimple_cond_set_code (stmt
, code
);
2839 gimple_cond_set_lhs (stmt
, lhs
);
2840 gimple_cond_set_rhs (stmt
, rhs
);
2843 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2846 gimple_label_label (const_gimple gs
)
2848 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2849 return gimple_op (gs
, 0);
2853 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2857 gimple_label_set_label (gimple gs
, tree label
)
2859 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2860 gimple_set_op (gs
, 0, label
);
2864 /* Return the destination of the unconditional jump GS. */
2867 gimple_goto_dest (const_gimple gs
)
2869 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2870 return gimple_op (gs
, 0);
2874 /* Set DEST to be the destination of the unconditonal jump GS. */
2877 gimple_goto_set_dest (gimple gs
, tree dest
)
2879 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2880 gimple_set_op (gs
, 0, dest
);
2884 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2887 gimple_bind_vars (const_gimple gs
)
2889 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2890 return gs
->gimple_bind
.vars
;
2894 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2898 gimple_bind_set_vars (gimple gs
, tree vars
)
2900 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2901 gs
->gimple_bind
.vars
= vars
;
2905 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2909 gimple_bind_append_vars (gimple gs
, tree vars
)
2911 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2912 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2916 static inline gimple_seq
*
2917 gimple_bind_body_ptr (gimple gs
)
2919 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2920 return &gs
->gimple_bind
.body
;
2923 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2925 static inline gimple_seq
2926 gimple_bind_body (gimple gs
)
2928 return *gimple_bind_body_ptr (gs
);
2932 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2936 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2938 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2939 gs
->gimple_bind
.body
= seq
;
2943 /* Append a statement to the end of a GIMPLE_BIND's body. */
2946 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2948 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2949 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2953 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2956 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2958 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2959 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2963 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2964 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2967 gimple_bind_block (const_gimple gs
)
2969 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2970 return gs
->gimple_bind
.block
;
2974 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2978 gimple_bind_set_block (gimple gs
, tree block
)
2980 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2981 gcc_gimple_checking_assert (block
== NULL_TREE
2982 || TREE_CODE (block
) == BLOCK
);
2983 gs
->gimple_bind
.block
= block
;
2987 /* Return the number of input operands for GIMPLE_ASM GS. */
2989 static inline unsigned
2990 gimple_asm_ninputs (const_gimple gs
)
2992 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2993 return gs
->gimple_asm
.ni
;
2997 /* Return the number of output operands for GIMPLE_ASM GS. */
2999 static inline unsigned
3000 gimple_asm_noutputs (const_gimple gs
)
3002 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3003 return gs
->gimple_asm
.no
;
3007 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3009 static inline unsigned
3010 gimple_asm_nclobbers (const_gimple gs
)
3012 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3013 return gs
->gimple_asm
.nc
;
3016 /* Return the number of label operands for GIMPLE_ASM GS. */
3018 static inline unsigned
3019 gimple_asm_nlabels (const_gimple gs
)
3021 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3022 return gs
->gimple_asm
.nl
;
3025 /* Return input operand INDEX of GIMPLE_ASM GS. */
3028 gimple_asm_input_op (const_gimple gs
, unsigned index
)
3030 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3031 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
3032 return gimple_op (gs
, index
+ gs
->gimple_asm
.no
);
3035 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3037 static inline tree
*
3038 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
3040 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3041 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
);
3042 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.no
);
3046 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3049 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
3051 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3052 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.ni
3053 && TREE_CODE (in_op
) == TREE_LIST
);
3054 gimple_set_op (gs
, index
+ gs
->gimple_asm
.no
, in_op
);
3058 /* Return output operand INDEX of GIMPLE_ASM GS. */
3061 gimple_asm_output_op (const_gimple gs
, unsigned index
)
3063 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3064 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
3065 return gimple_op (gs
, index
);
3068 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3070 static inline tree
*
3071 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
3073 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3074 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
);
3075 return gimple_op_ptr (gs
, index
);
3079 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3082 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
3084 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3085 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.no
3086 && TREE_CODE (out_op
) == TREE_LIST
);
3087 gimple_set_op (gs
, index
, out_op
);
3091 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3094 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3096 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3097 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
);
3098 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
3102 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3105 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3107 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3108 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nc
3109 && TREE_CODE (clobber_op
) == TREE_LIST
);
3110 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
3113 /* Return label operand INDEX of GIMPLE_ASM GS. */
3116 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3118 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3119 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
);
3120 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
3123 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3126 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3128 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3129 gcc_gimple_checking_assert (index
< gs
->gimple_asm
.nl
3130 && TREE_CODE (label_op
) == TREE_LIST
);
3131 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
3134 /* Return the string representing the assembly instruction in
3137 static inline const char *
3138 gimple_asm_string (const_gimple gs
)
3140 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3141 return gs
->gimple_asm
.string
;
3145 /* Return true if GS is an asm statement marked volatile. */
3148 gimple_asm_volatile_p (const_gimple gs
)
3150 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3151 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
3155 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3158 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3160 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3162 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
3164 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
3168 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3171 gimple_asm_set_input (gimple gs
, bool input_p
)
3173 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3175 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
3177 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
3181 /* Return true if asm GS is an ASM_INPUT. */
3184 gimple_asm_input_p (const_gimple gs
)
3186 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3187 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
3191 /* Return the types handled by GIMPLE_CATCH statement GS. */
3194 gimple_catch_types (const_gimple gs
)
3196 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3197 return gs
->gimple_catch
.types
;
3201 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3203 static inline tree
*
3204 gimple_catch_types_ptr (gimple gs
)
3206 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3207 return &gs
->gimple_catch
.types
;
3211 /* Return a pointer to the GIMPLE sequence representing the body of
3212 the handler of GIMPLE_CATCH statement GS. */
3214 static inline gimple_seq
*
3215 gimple_catch_handler_ptr (gimple gs
)
3217 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3218 return &gs
->gimple_catch
.handler
;
3222 /* Return the GIMPLE sequence representing the body of the handler of
3223 GIMPLE_CATCH statement GS. */
3225 static inline gimple_seq
3226 gimple_catch_handler (gimple gs
)
3228 return *gimple_catch_handler_ptr (gs
);
3232 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3235 gimple_catch_set_types (gimple gs
, tree t
)
3237 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3238 gs
->gimple_catch
.types
= t
;
3242 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3245 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3247 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3248 gs
->gimple_catch
.handler
= handler
;
3252 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3255 gimple_eh_filter_types (const_gimple gs
)
3257 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3258 return gs
->gimple_eh_filter
.types
;
3262 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3265 static inline tree
*
3266 gimple_eh_filter_types_ptr (gimple gs
)
3268 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3269 return &gs
->gimple_eh_filter
.types
;
3273 /* Return a pointer to the sequence of statement to execute when
3274 GIMPLE_EH_FILTER statement fails. */
3276 static inline gimple_seq
*
3277 gimple_eh_filter_failure_ptr (gimple gs
)
3279 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3280 return &gs
->gimple_eh_filter
.failure
;
3284 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3287 static inline gimple_seq
3288 gimple_eh_filter_failure (gimple gs
)
3290 return *gimple_eh_filter_failure_ptr (gs
);
3294 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3297 gimple_eh_filter_set_types (gimple gs
, tree types
)
3299 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3300 gs
->gimple_eh_filter
.types
= types
;
3304 /* Set FAILURE to be the sequence of statements to execute on failure
3305 for GIMPLE_EH_FILTER GS. */
3308 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3310 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3311 gs
->gimple_eh_filter
.failure
= failure
;
3314 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3317 gimple_eh_must_not_throw_fndecl (gimple gs
)
3319 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3320 return gs
->gimple_eh_mnt
.fndecl
;
3323 /* Set the function decl to be called by GS to DECL. */
3326 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3328 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3329 gs
->gimple_eh_mnt
.fndecl
= decl
;
3332 /* GIMPLE_EH_ELSE accessors. */
3334 static inline gimple_seq
*
3335 gimple_eh_else_n_body_ptr (gimple gs
)
3337 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3338 return &gs
->gimple_eh_else
.n_body
;
3341 static inline gimple_seq
3342 gimple_eh_else_n_body (gimple gs
)
3344 return *gimple_eh_else_n_body_ptr (gs
);
3347 static inline gimple_seq
*
3348 gimple_eh_else_e_body_ptr (gimple gs
)
3350 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3351 return &gs
->gimple_eh_else
.e_body
;
3354 static inline gimple_seq
3355 gimple_eh_else_e_body (gimple gs
)
3357 return *gimple_eh_else_e_body_ptr (gs
);
3361 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3363 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3364 gs
->gimple_eh_else
.n_body
= seq
;
3368 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3370 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3371 gs
->gimple_eh_else
.e_body
= seq
;
3374 /* GIMPLE_TRY accessors. */
3376 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3377 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3379 static inline enum gimple_try_flags
3380 gimple_try_kind (const_gimple gs
)
3382 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3383 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
3387 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3390 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3392 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3393 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3394 || kind
== GIMPLE_TRY_FINALLY
);
3395 if (gimple_try_kind (gs
) != kind
)
3396 gs
->gsbase
.subcode
= (unsigned int) kind
;
3400 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3403 gimple_try_catch_is_cleanup (const_gimple gs
)
3405 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3406 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3410 /* Return a pointer to the sequence of statements used as the
3411 body for GIMPLE_TRY GS. */
3413 static inline gimple_seq
*
3414 gimple_try_eval_ptr (gimple gs
)
3416 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3417 return &gs
->gimple_try
.eval
;
3421 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3423 static inline gimple_seq
3424 gimple_try_eval (gimple gs
)
3426 return *gimple_try_eval_ptr (gs
);
3430 /* Return a pointer to the sequence of statements used as the cleanup body for
3433 static inline gimple_seq
*
3434 gimple_try_cleanup_ptr (gimple gs
)
3436 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3437 return &gs
->gimple_try
.cleanup
;
3441 /* Return the sequence of statements used as the cleanup body for
3444 static inline gimple_seq
3445 gimple_try_cleanup (gimple gs
)
3447 return *gimple_try_cleanup_ptr (gs
);
3451 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3454 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3456 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3457 if (catch_is_cleanup
)
3458 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3460 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3464 /* Set EVAL to be the sequence of statements to use as the body for
3468 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3470 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3471 gs
->gimple_try
.eval
= eval
;
3475 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3476 body for GIMPLE_TRY GS. */
3479 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3481 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3482 gs
->gimple_try
.cleanup
= cleanup
;
3486 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3488 static inline gimple_seq
*
3489 gimple_wce_cleanup_ptr (gimple gs
)
3491 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3492 return &gs
->gimple_wce
.cleanup
;
3496 /* Return the cleanup sequence for cleanup statement GS. */
3498 static inline gimple_seq
3499 gimple_wce_cleanup (gimple gs
)
3501 return *gimple_wce_cleanup_ptr (gs
);
3505 /* Set CLEANUP to be the cleanup sequence for GS. */
3508 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3510 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3511 gs
->gimple_wce
.cleanup
= cleanup
;
3515 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3518 gimple_wce_cleanup_eh_only (const_gimple gs
)
3520 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3521 return gs
->gsbase
.subcode
!= 0;
3525 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3528 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3530 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3531 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3535 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3537 static inline unsigned
3538 gimple_phi_capacity (const_gimple gs
)
3540 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3541 return gs
->gimple_phi
.capacity
;
3545 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3546 be exactly the number of incoming edges for the basic block holding
3549 static inline unsigned
3550 gimple_phi_num_args (const_gimple gs
)
3552 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3553 return gs
->gimple_phi
.nargs
;
3557 /* Return the SSA name created by GIMPLE_PHI GS. */
3560 gimple_phi_result (const_gimple gs
)
3562 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3563 return gs
->gimple_phi
.result
;
3566 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3568 static inline tree
*
3569 gimple_phi_result_ptr (gimple gs
)
3571 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3572 return &gs
->gimple_phi
.result
;
3575 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3578 gimple_phi_set_result (gimple gs
, tree result
)
3580 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3581 gs
->gimple_phi
.result
= result
;
3582 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3583 SSA_NAME_DEF_STMT (result
) = gs
;
3587 /* Return the PHI argument corresponding to incoming edge INDEX for
3590 static inline struct phi_arg_d
*
3591 gimple_phi_arg (gimple gs
, unsigned index
)
3593 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3594 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.capacity
);
3595 return &(gs
->gimple_phi
.args
[index
]);
3598 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3599 for GIMPLE_PHI GS. */
3602 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3604 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3605 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.nargs
);
3606 gs
->gimple_phi
.args
[index
] = *phiarg
;
3609 /* PHI nodes should contain only ssa_names and invariants. A test
3610 for ssa_name is definitely simpler; don't let invalid contents
3611 slip in in the meantime. */
3614 phi_ssa_name_p (const_tree t
)
3616 if (TREE_CODE (t
) == SSA_NAME
)
3618 gcc_checking_assert (is_gimple_min_invariant (t
));
3622 /* Return the PHI nodes for basic block BB, or NULL if there are no
3625 static inline gimple_seq
3626 phi_nodes (const_basic_block bb
)
3628 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3629 return bb
->il
.gimple
.phi_nodes
;
3632 /* Return a pointer to the PHI nodes for basic block BB. */
3634 static inline gimple_seq
*
3635 phi_nodes_ptr (basic_block bb
)
3637 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3638 return &bb
->il
.gimple
.phi_nodes
;
3641 /* Return the tree operand for argument I of PHI node GS. */
3644 gimple_phi_arg_def (gimple gs
, size_t index
)
3646 return gimple_phi_arg (gs
, index
)->def
;
3650 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3652 static inline tree
*
3653 gimple_phi_arg_def_ptr (gimple gs
, size_t index
)
3655 return &gimple_phi_arg (gs
, index
)->def
;
3658 /* Return the edge associated with argument I of phi node GS. */
3661 gimple_phi_arg_edge (gimple gs
, size_t i
)
3663 return EDGE_PRED (gimple_bb (gs
), i
);
3666 /* Return the source location of gimple argument I of phi node GS. */
3668 static inline source_location
3669 gimple_phi_arg_location (gimple gs
, size_t i
)
3671 return gimple_phi_arg (gs
, i
)->locus
;
3674 /* Return the source location of the argument on edge E of phi node GS. */
3676 static inline source_location
3677 gimple_phi_arg_location_from_edge (gimple gs
, edge e
)
3679 return gimple_phi_arg (gs
, e
->dest_idx
)->locus
;
3682 /* Set the source location of gimple argument I of phi node GS to LOC. */
3685 gimple_phi_arg_set_location (gimple gs
, size_t i
, source_location loc
)
3687 gimple_phi_arg (gs
, i
)->locus
= loc
;
3690 /* Return TRUE if argument I of phi node GS has a location record. */
3693 gimple_phi_arg_has_location (gimple gs
, size_t i
)
3695 return gimple_phi_arg_location (gs
, i
) != UNKNOWN_LOCATION
;
3699 /* Return the region number for GIMPLE_RESX GS. */
3702 gimple_resx_region (const_gimple gs
)
3704 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3705 return gs
->gimple_eh_ctrl
.region
;
3708 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3711 gimple_resx_set_region (gimple gs
, int region
)
3713 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3714 gs
->gimple_eh_ctrl
.region
= region
;
3717 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3720 gimple_eh_dispatch_region (const_gimple gs
)
3722 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3723 return gs
->gimple_eh_ctrl
.region
;
3726 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3729 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3731 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3732 gs
->gimple_eh_ctrl
.region
= region
;
3735 /* Return the number of labels associated with the switch statement GS. */
3737 static inline unsigned
3738 gimple_switch_num_labels (const_gimple gs
)
3741 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3742 num_ops
= gimple_num_ops (gs
);
3743 gcc_gimple_checking_assert (num_ops
> 1);
3748 /* Set NLABELS to be the number of labels for the switch statement GS. */
3751 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3753 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3754 gimple_set_num_ops (g
, nlabels
+ 1);
3758 /* Return the index variable used by the switch statement GS. */
3761 gimple_switch_index (const_gimple gs
)
3763 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3764 return gimple_op (gs
, 0);
3768 /* Return a pointer to the index variable for the switch statement GS. */
3770 static inline tree
*
3771 gimple_switch_index_ptr (const_gimple gs
)
3773 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3774 return gimple_op_ptr (gs
, 0);
3778 /* Set INDEX to be the index variable for switch statement GS. */
3781 gimple_switch_set_index (gimple gs
, tree index
)
3783 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3784 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3785 gimple_set_op (gs
, 0, index
);
3789 /* Return the label numbered INDEX. The default label is 0, followed by any
3790 labels in a switch statement. */
3793 gimple_switch_label (const_gimple gs
, unsigned index
)
3795 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3796 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
3797 return gimple_op (gs
, index
+ 1);
3800 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3803 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3805 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3806 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
3807 && (label
== NULL_TREE
3808 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
3809 gimple_set_op (gs
, index
+ 1, label
);
3812 /* Return the default label for a switch statement. */
3815 gimple_switch_default_label (const_gimple gs
)
3817 tree label
= gimple_switch_label (gs
, 0);
3818 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3822 /* Set the default label for a switch statement. */
3825 gimple_switch_set_default_label (gimple gs
, tree label
)
3827 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
3828 gimple_switch_set_label (gs
, 0, label
);
3831 /* Return true if GS is a GIMPLE_DEBUG statement. */
3834 is_gimple_debug (const_gimple gs
)
3836 return gimple_code (gs
) == GIMPLE_DEBUG
;
3839 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3842 gimple_debug_bind_p (const_gimple s
)
3844 if (is_gimple_debug (s
))
3845 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3850 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3853 gimple_debug_bind_get_var (gimple dbg
)
3855 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3856 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3857 return gimple_op (dbg
, 0);
3860 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3864 gimple_debug_bind_get_value (gimple dbg
)
3866 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3867 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3868 return gimple_op (dbg
, 1);
3871 /* Return a pointer to the value bound to the variable in a
3872 GIMPLE_DEBUG bind statement. */
3874 static inline tree
*
3875 gimple_debug_bind_get_value_ptr (gimple dbg
)
3877 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3878 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3879 return gimple_op_ptr (dbg
, 1);
3882 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3885 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3887 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3888 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3889 gimple_set_op (dbg
, 0, var
);
3892 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3896 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3898 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3899 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3900 gimple_set_op (dbg
, 1, value
);
3903 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3905 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3907 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3911 gimple_debug_bind_reset_value (gimple dbg
)
3913 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3914 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3915 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3918 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3922 gimple_debug_bind_has_value_p (gimple dbg
)
3924 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3925 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3926 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3929 #undef GIMPLE_DEBUG_BIND_NOVALUE
3931 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3934 gimple_debug_source_bind_p (const_gimple s
)
3936 if (is_gimple_debug (s
))
3937 return s
->gsbase
.subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
3942 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3945 gimple_debug_source_bind_get_var (gimple dbg
)
3947 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3948 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3949 return gimple_op (dbg
, 0);
3952 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3956 gimple_debug_source_bind_get_value (gimple dbg
)
3958 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3959 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3960 return gimple_op (dbg
, 1);
3963 /* Return a pointer to the value bound to the variable in a
3964 GIMPLE_DEBUG source bind statement. */
3966 static inline tree
*
3967 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
3969 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3970 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3971 return gimple_op_ptr (dbg
, 1);
3974 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3977 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
3979 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3980 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3981 gimple_set_op (dbg
, 0, var
);
3984 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3988 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
3990 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3991 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3992 gimple_set_op (dbg
, 1, value
);
3995 /* Return the line number for EXPR, or return -1 if we have no line
3996 number information for it. */
3998 get_lineno (const_gimple stmt
)
4005 loc
= gimple_location (stmt
);
4006 if (loc
== UNKNOWN_LOCATION
)
4009 return LOCATION_LINE (loc
);
4012 /* Return a pointer to the body for the OMP statement GS. */
4014 static inline gimple_seq
*
4015 gimple_omp_body_ptr (gimple gs
)
4017 return &gs
->omp
.body
;
4020 /* Return the body for the OMP statement GS. */
4022 static inline gimple_seq
4023 gimple_omp_body (gimple gs
)
4025 return *gimple_omp_body_ptr (gs
);
4028 /* Set BODY to be the body for the OMP statement GS. */
4031 gimple_omp_set_body (gimple gs
, gimple_seq body
)
4033 gs
->omp
.body
= body
;
4037 /* Return the name associated with OMP_CRITICAL statement GS. */
4040 gimple_omp_critical_name (const_gimple gs
)
4042 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
4043 return gs
->gimple_omp_critical
.name
;
4047 /* Return a pointer to the name associated with OMP critical statement GS. */
4049 static inline tree
*
4050 gimple_omp_critical_name_ptr (gimple gs
)
4052 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
4053 return &gs
->gimple_omp_critical
.name
;
4057 /* Set NAME to be the name associated with OMP critical statement GS. */
4060 gimple_omp_critical_set_name (gimple gs
, tree name
)
4062 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
4063 gs
->gimple_omp_critical
.name
= name
;
4067 /* Return the kind of OMP for statemement. */
4070 gimple_omp_for_kind (const_gimple g
)
4072 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4073 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4077 /* Set the OMP for kind. */
4080 gimple_omp_for_set_kind (gimple g
, int kind
)
4082 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4083 g
->gsbase
.subcode
= (g
->gsbase
.subcode
& ~GF_OMP_FOR_KIND_MASK
)
4084 | (kind
& GF_OMP_FOR_KIND_MASK
);
4088 /* Return true if OMP for statement G has the
4089 GF_OMP_FOR_COMBINED flag set. */
4092 gimple_omp_for_combined_p (const_gimple g
)
4094 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4095 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4099 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4100 value of COMBINED_P. */
4103 gimple_omp_for_set_combined_p (gimple g
, bool combined_p
)
4105 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4107 g
->gsbase
.subcode
|= GF_OMP_FOR_COMBINED
;
4109 g
->gsbase
.subcode
&= ~GF_OMP_FOR_COMBINED
;
4113 /* Return true if OMP for statement G has the
4114 GF_OMP_FOR_COMBINED_INTO flag set. */
4117 gimple_omp_for_combined_into_p (const_gimple g
)
4119 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4120 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4124 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4125 value of COMBINED_P. */
4128 gimple_omp_for_set_combined_into_p (gimple g
, bool combined_p
)
4130 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4132 g
->gsbase
.subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4134 g
->gsbase
.subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4138 /* Return the clauses associated with OMP_FOR GS. */
4141 gimple_omp_for_clauses (const_gimple gs
)
4143 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4144 return gs
->gimple_omp_for
.clauses
;
4148 /* Return a pointer to the OMP_FOR GS. */
4150 static inline tree
*
4151 gimple_omp_for_clauses_ptr (gimple gs
)
4153 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4154 return &gs
->gimple_omp_for
.clauses
;
4158 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4161 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
4163 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4164 gs
->gimple_omp_for
.clauses
= clauses
;
4168 /* Get the collapse count of OMP_FOR GS. */
4170 static inline size_t
4171 gimple_omp_for_collapse (gimple gs
)
4173 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4174 return gs
->gimple_omp_for
.collapse
;
4178 /* Return the index variable for OMP_FOR GS. */
4181 gimple_omp_for_index (const_gimple gs
, size_t i
)
4183 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4184 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4185 return gs
->gimple_omp_for
.iter
[i
].index
;
4189 /* Return a pointer to the index variable for OMP_FOR GS. */
4191 static inline tree
*
4192 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
4194 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4195 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4196 return &gs
->gimple_omp_for
.iter
[i
].index
;
4200 /* Set INDEX to be the index variable for OMP_FOR GS. */
4203 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
4205 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4206 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4207 gs
->gimple_omp_for
.iter
[i
].index
= index
;
4211 /* Return the initial value for OMP_FOR GS. */
4214 gimple_omp_for_initial (const_gimple gs
, size_t i
)
4216 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4217 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4218 return gs
->gimple_omp_for
.iter
[i
].initial
;
4222 /* Return a pointer to the initial value for OMP_FOR GS. */
4224 static inline tree
*
4225 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
4227 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4228 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4229 return &gs
->gimple_omp_for
.iter
[i
].initial
;
4233 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4236 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4238 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4239 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4240 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
4244 /* Return the final value for OMP_FOR GS. */
4247 gimple_omp_for_final (const_gimple gs
, size_t i
)
4249 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4250 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4251 return gs
->gimple_omp_for
.iter
[i
].final
;
4255 /* Return a pointer to the final value for OMP_FOR GS. */
4257 static inline tree
*
4258 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4260 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4261 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4262 return &gs
->gimple_omp_for
.iter
[i
].final
;
4266 /* Set FINAL to be the final value for OMP_FOR GS. */
4269 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4271 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4272 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4273 gs
->gimple_omp_for
.iter
[i
].final
= final
;
4277 /* Return the increment value for OMP_FOR GS. */
4280 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4282 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4283 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4284 return gs
->gimple_omp_for
.iter
[i
].incr
;
4288 /* Return a pointer to the increment value for OMP_FOR GS. */
4290 static inline tree
*
4291 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4293 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4294 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4295 return &gs
->gimple_omp_for
.iter
[i
].incr
;
4299 /* Set INCR to be the increment value for OMP_FOR GS. */
4302 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4304 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4305 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4306 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
4310 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4311 statement GS starts. */
4313 static inline gimple_seq
*
4314 gimple_omp_for_pre_body_ptr (gimple gs
)
4316 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4317 return &gs
->gimple_omp_for
.pre_body
;
4321 /* Return the sequence of statements to execute before the OMP_FOR
4322 statement GS starts. */
4324 static inline gimple_seq
4325 gimple_omp_for_pre_body (gimple gs
)
4327 return *gimple_omp_for_pre_body_ptr (gs
);
4331 /* Set PRE_BODY to be the sequence of statements to execute before the
4332 OMP_FOR statement GS starts. */
4335 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4337 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4338 gs
->gimple_omp_for
.pre_body
= pre_body
;
4342 /* Return the clauses associated with OMP_PARALLEL GS. */
4345 gimple_omp_parallel_clauses (const_gimple gs
)
4347 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4348 return gs
->gimple_omp_parallel
.clauses
;
4352 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4354 static inline tree
*
4355 gimple_omp_parallel_clauses_ptr (gimple gs
)
4357 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4358 return &gs
->gimple_omp_parallel
.clauses
;
4362 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4366 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4368 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4369 gs
->gimple_omp_parallel
.clauses
= clauses
;
4373 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4376 gimple_omp_parallel_child_fn (const_gimple gs
)
4378 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4379 return gs
->gimple_omp_parallel
.child_fn
;
4382 /* Return a pointer to the child function used to hold the body of
4385 static inline tree
*
4386 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4388 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4389 return &gs
->gimple_omp_parallel
.child_fn
;
4393 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4396 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4398 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4399 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4403 /* Return the artificial argument used to send variables and values
4404 from the parent to the children threads in OMP_PARALLEL GS. */
4407 gimple_omp_parallel_data_arg (const_gimple gs
)
4409 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4410 return gs
->gimple_omp_parallel
.data_arg
;
4414 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4416 static inline tree
*
4417 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4419 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4420 return &gs
->gimple_omp_parallel
.data_arg
;
4424 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4427 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4429 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4430 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4434 /* Return the clauses associated with OMP_TASK GS. */
4437 gimple_omp_task_clauses (const_gimple gs
)
4439 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4440 return gs
->gimple_omp_parallel
.clauses
;
4444 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4446 static inline tree
*
4447 gimple_omp_task_clauses_ptr (gimple gs
)
4449 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4450 return &gs
->gimple_omp_parallel
.clauses
;
4454 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4458 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4460 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4461 gs
->gimple_omp_parallel
.clauses
= clauses
;
4465 /* Return the child function used to hold the body of OMP_TASK GS. */
4468 gimple_omp_task_child_fn (const_gimple gs
)
4470 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4471 return gs
->gimple_omp_parallel
.child_fn
;
4474 /* Return a pointer to the child function used to hold the body of
4477 static inline tree
*
4478 gimple_omp_task_child_fn_ptr (gimple gs
)
4480 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4481 return &gs
->gimple_omp_parallel
.child_fn
;
4485 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4488 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4490 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4491 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4495 /* Return the artificial argument used to send variables and values
4496 from the parent to the children threads in OMP_TASK GS. */
4499 gimple_omp_task_data_arg (const_gimple gs
)
4501 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4502 return gs
->gimple_omp_parallel
.data_arg
;
4506 /* Return a pointer to the data argument for OMP_TASK GS. */
4508 static inline tree
*
4509 gimple_omp_task_data_arg_ptr (gimple gs
)
4511 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4512 return &gs
->gimple_omp_parallel
.data_arg
;
4516 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4519 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4521 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4522 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4526 /* Return the clauses associated with OMP_TASK GS. */
4529 gimple_omp_taskreg_clauses (const_gimple gs
)
4531 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4532 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4533 return gs
->gimple_omp_parallel
.clauses
;
4537 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4539 static inline tree
*
4540 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4542 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4543 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4544 return &gs
->gimple_omp_parallel
.clauses
;
4548 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4552 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4554 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4555 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4556 gs
->gimple_omp_parallel
.clauses
= clauses
;
4560 /* Return the child function used to hold the body of OMP_TASK GS. */
4563 gimple_omp_taskreg_child_fn (const_gimple gs
)
4565 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4566 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4567 return gs
->gimple_omp_parallel
.child_fn
;
4570 /* Return a pointer to the child function used to hold the body of
4573 static inline tree
*
4574 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4576 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4577 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4578 return &gs
->gimple_omp_parallel
.child_fn
;
4582 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4585 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4587 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4588 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4589 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4593 /* Return the artificial argument used to send variables and values
4594 from the parent to the children threads in OMP_TASK GS. */
4597 gimple_omp_taskreg_data_arg (const_gimple gs
)
4599 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4600 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4601 return gs
->gimple_omp_parallel
.data_arg
;
4605 /* Return a pointer to the data argument for OMP_TASK GS. */
4607 static inline tree
*
4608 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4610 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4611 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4612 return &gs
->gimple_omp_parallel
.data_arg
;
4616 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4619 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4621 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4622 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4623 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4627 /* Return the copy function used to hold the body of OMP_TASK GS. */
4630 gimple_omp_task_copy_fn (const_gimple gs
)
4632 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4633 return gs
->gimple_omp_task
.copy_fn
;
4636 /* Return a pointer to the copy function used to hold the body of
4639 static inline tree
*
4640 gimple_omp_task_copy_fn_ptr (gimple gs
)
4642 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4643 return &gs
->gimple_omp_task
.copy_fn
;
4647 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4650 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4652 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4653 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
4657 /* Return size of the data block in bytes in OMP_TASK GS. */
4660 gimple_omp_task_arg_size (const_gimple gs
)
4662 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4663 return gs
->gimple_omp_task
.arg_size
;
4667 /* Return a pointer to the data block size for OMP_TASK GS. */
4669 static inline tree
*
4670 gimple_omp_task_arg_size_ptr (gimple gs
)
4672 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4673 return &gs
->gimple_omp_task
.arg_size
;
4677 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4680 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4682 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4683 gs
->gimple_omp_task
.arg_size
= arg_size
;
4687 /* Return align of the data block in bytes in OMP_TASK GS. */
4690 gimple_omp_task_arg_align (const_gimple gs
)
4692 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4693 return gs
->gimple_omp_task
.arg_align
;
4697 /* Return a pointer to the data block align for OMP_TASK GS. */
4699 static inline tree
*
4700 gimple_omp_task_arg_align_ptr (gimple gs
)
4702 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4703 return &gs
->gimple_omp_task
.arg_align
;
4707 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4710 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
4712 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4713 gs
->gimple_omp_task
.arg_align
= arg_align
;
4717 /* Return the clauses associated with OMP_SINGLE GS. */
4720 gimple_omp_single_clauses (const_gimple gs
)
4722 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4723 return gs
->gimple_omp_single
.clauses
;
4727 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4729 static inline tree
*
4730 gimple_omp_single_clauses_ptr (gimple gs
)
4732 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4733 return &gs
->gimple_omp_single
.clauses
;
4737 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4740 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
4742 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4743 gs
->gimple_omp_single
.clauses
= clauses
;
4747 /* Return the clauses associated with OMP_TARGET GS. */
4750 gimple_omp_target_clauses (const_gimple gs
)
4752 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4753 return gs
->gimple_omp_parallel
.clauses
;
4757 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
4759 static inline tree
*
4760 gimple_omp_target_clauses_ptr (gimple gs
)
4762 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4763 return &gs
->gimple_omp_parallel
.clauses
;
4767 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
4770 gimple_omp_target_set_clauses (gimple gs
, tree clauses
)
4772 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4773 gs
->gimple_omp_parallel
.clauses
= clauses
;
4777 /* Return the kind of OMP target statemement. */
4780 gimple_omp_target_kind (const_gimple g
)
4782 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
4783 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
4787 /* Set the OMP target kind. */
4790 gimple_omp_target_set_kind (gimple g
, int kind
)
4792 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
4793 g
->gsbase
.subcode
= (g
->gsbase
.subcode
& ~GF_OMP_TARGET_KIND_MASK
)
4794 | (kind
& GF_OMP_TARGET_KIND_MASK
);
4798 /* Return the child function used to hold the body of OMP_TARGET GS. */
4801 gimple_omp_target_child_fn (const_gimple gs
)
4803 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4804 return gs
->gimple_omp_parallel
.child_fn
;
4807 /* Return a pointer to the child function used to hold the body of
4810 static inline tree
*
4811 gimple_omp_target_child_fn_ptr (gimple gs
)
4813 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4814 return &gs
->gimple_omp_parallel
.child_fn
;
4818 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
4821 gimple_omp_target_set_child_fn (gimple gs
, tree child_fn
)
4823 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4824 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4828 /* Return the artificial argument used to send variables and values
4829 from the parent to the children threads in OMP_TARGET GS. */
4832 gimple_omp_target_data_arg (const_gimple gs
)
4834 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4835 return gs
->gimple_omp_parallel
.data_arg
;
4839 /* Return a pointer to the data argument for OMP_TARGET GS. */
4841 static inline tree
*
4842 gimple_omp_target_data_arg_ptr (gimple gs
)
4844 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4845 return &gs
->gimple_omp_parallel
.data_arg
;
4849 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
4852 gimple_omp_target_set_data_arg (gimple gs
, tree data_arg
)
4854 GIMPLE_CHECK (gs
, GIMPLE_OMP_TARGET
);
4855 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4859 /* Return the clauses associated with OMP_TEAMS GS. */
4862 gimple_omp_teams_clauses (const_gimple gs
)
4864 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4865 return gs
->gimple_omp_single
.clauses
;
4869 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
4871 static inline tree
*
4872 gimple_omp_teams_clauses_ptr (gimple gs
)
4874 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4875 return &gs
->gimple_omp_single
.clauses
;
4879 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
4882 gimple_omp_teams_set_clauses (gimple gs
, tree clauses
)
4884 GIMPLE_CHECK (gs
, GIMPLE_OMP_TEAMS
);
4885 gs
->gimple_omp_single
.clauses
= clauses
;
4889 /* Return the clauses associated with OMP_SECTIONS GS. */
4892 gimple_omp_sections_clauses (const_gimple gs
)
4894 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4895 return gs
->gimple_omp_sections
.clauses
;
4899 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4901 static inline tree
*
4902 gimple_omp_sections_clauses_ptr (gimple gs
)
4904 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4905 return &gs
->gimple_omp_sections
.clauses
;
4909 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4913 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4915 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4916 gs
->gimple_omp_sections
.clauses
= clauses
;
4920 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4924 gimple_omp_sections_control (const_gimple gs
)
4926 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4927 return gs
->gimple_omp_sections
.control
;
4931 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4934 static inline tree
*
4935 gimple_omp_sections_control_ptr (gimple gs
)
4937 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4938 return &gs
->gimple_omp_sections
.control
;
4942 /* Set CONTROL to be the set of clauses associated with the
4943 GIMPLE_OMP_SECTIONS in GS. */
4946 gimple_omp_sections_set_control (gimple gs
, tree control
)
4948 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4949 gs
->gimple_omp_sections
.control
= control
;
4953 /* Set COND to be the condition code for OMP_FOR GS. */
4956 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4958 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4959 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4960 && i
< gs
->gimple_omp_for
.collapse
);
4961 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4965 /* Return the condition code associated with OMP_FOR GS. */
4967 static inline enum tree_code
4968 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4970 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4971 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4972 return gs
->gimple_omp_for
.iter
[i
].cond
;
4976 /* Set the value being stored in an atomic store. */
4979 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4981 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4982 g
->gimple_omp_atomic_store
.val
= val
;
4986 /* Return the value being stored in an atomic store. */
4989 gimple_omp_atomic_store_val (const_gimple g
)
4991 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4992 return g
->gimple_omp_atomic_store
.val
;
4996 /* Return a pointer to the value being stored in an atomic store. */
4998 static inline tree
*
4999 gimple_omp_atomic_store_val_ptr (gimple g
)
5001 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
5002 return &g
->gimple_omp_atomic_store
.val
;
5006 /* Set the LHS of an atomic load. */
5009 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
5011 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
5012 g
->gimple_omp_atomic_load
.lhs
= lhs
;
5016 /* Get the LHS of an atomic load. */
5019 gimple_omp_atomic_load_lhs (const_gimple g
)
5021 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
5022 return g
->gimple_omp_atomic_load
.lhs
;
5026 /* Return a pointer to the LHS of an atomic load. */
5028 static inline tree
*
5029 gimple_omp_atomic_load_lhs_ptr (gimple g
)
5031 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
5032 return &g
->gimple_omp_atomic_load
.lhs
;
5036 /* Set the RHS of an atomic load. */
5039 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
5041 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
5042 g
->gimple_omp_atomic_load
.rhs
= rhs
;
5046 /* Get the RHS of an atomic load. */
5049 gimple_omp_atomic_load_rhs (const_gimple g
)
5051 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
5052 return g
->gimple_omp_atomic_load
.rhs
;
5056 /* Return a pointer to the RHS of an atomic load. */
5058 static inline tree
*
5059 gimple_omp_atomic_load_rhs_ptr (gimple g
)
5061 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
5062 return &g
->gimple_omp_atomic_load
.rhs
;
5066 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5069 gimple_omp_continue_control_def (const_gimple g
)
5071 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
5072 return g
->gimple_omp_continue
.control_def
;
5075 /* The same as above, but return the address. */
5077 static inline tree
*
5078 gimple_omp_continue_control_def_ptr (gimple g
)
5080 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
5081 return &g
->gimple_omp_continue
.control_def
;
5084 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5087 gimple_omp_continue_set_control_def (gimple g
, tree def
)
5089 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
5090 g
->gimple_omp_continue
.control_def
= def
;
5094 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5097 gimple_omp_continue_control_use (const_gimple g
)
5099 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
5100 return g
->gimple_omp_continue
.control_use
;
5104 /* The same as above, but return the address. */
5106 static inline tree
*
5107 gimple_omp_continue_control_use_ptr (gimple g
)
5109 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
5110 return &g
->gimple_omp_continue
.control_use
;
5114 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5117 gimple_omp_continue_set_control_use (gimple g
, tree use
)
5119 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
5120 g
->gimple_omp_continue
.control_use
= use
;
5123 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5125 static inline gimple_seq
*
5126 gimple_transaction_body_ptr (gimple gs
)
5128 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5129 return &gs
->gimple_transaction
.body
;
5132 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5134 static inline gimple_seq
5135 gimple_transaction_body (gimple gs
)
5137 return *gimple_transaction_body_ptr (gs
);
5140 /* Return the label associated with a GIMPLE_TRANSACTION. */
5143 gimple_transaction_label (const_gimple gs
)
5145 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5146 return gs
->gimple_transaction
.label
;
5149 static inline tree
*
5150 gimple_transaction_label_ptr (gimple gs
)
5152 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5153 return &gs
->gimple_transaction
.label
;
5156 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5158 static inline unsigned int
5159 gimple_transaction_subcode (const_gimple gs
)
5161 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5162 return gs
->gsbase
.subcode
;
5165 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5168 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
5170 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5171 gs
->gimple_transaction
.body
= body
;
5174 /* Set the label associated with a GIMPLE_TRANSACTION. */
5177 gimple_transaction_set_label (gimple gs
, tree label
)
5179 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5180 gs
->gimple_transaction
.label
= label
;
5183 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5186 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
5188 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5189 gs
->gsbase
.subcode
= subcode
;
5193 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5195 static inline tree
*
5196 gimple_return_retval_ptr (const_gimple gs
)
5198 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5199 return gimple_op_ptr (gs
, 0);
5202 /* Return the return value for GIMPLE_RETURN GS. */
5205 gimple_return_retval (const_gimple gs
)
5207 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5208 return gimple_op (gs
, 0);
5212 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5215 gimple_return_set_retval (gimple gs
, tree retval
)
5217 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5218 gimple_set_op (gs
, 0, retval
);
5222 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5224 #define CASE_GIMPLE_OMP \
5225 case GIMPLE_OMP_PARALLEL: \
5226 case GIMPLE_OMP_TASK: \
5227 case GIMPLE_OMP_FOR: \
5228 case GIMPLE_OMP_SECTIONS: \
5229 case GIMPLE_OMP_SECTIONS_SWITCH: \
5230 case GIMPLE_OMP_SINGLE: \
5231 case GIMPLE_OMP_TARGET: \
5232 case GIMPLE_OMP_TEAMS: \
5233 case GIMPLE_OMP_SECTION: \
5234 case GIMPLE_OMP_MASTER: \
5235 case GIMPLE_OMP_TASKGROUP: \
5236 case GIMPLE_OMP_ORDERED: \
5237 case GIMPLE_OMP_CRITICAL: \
5238 case GIMPLE_OMP_RETURN: \
5239 case GIMPLE_OMP_ATOMIC_LOAD: \
5240 case GIMPLE_OMP_ATOMIC_STORE: \
5241 case GIMPLE_OMP_CONTINUE
5244 is_gimple_omp (const_gimple stmt
)
5246 switch (gimple_code (stmt
))
5256 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5259 gimple_nop_p (const_gimple g
)
5261 return gimple_code (g
) == GIMPLE_NOP
;
5265 /* Return true if GS is a GIMPLE_RESX. */
5268 is_gimple_resx (const_gimple gs
)
5270 return gimple_code (gs
) == GIMPLE_RESX
;
5273 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5275 static inline enum br_predictor
5276 gimple_predict_predictor (gimple gs
)
5278 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5279 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
5283 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5286 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5288 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5289 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
5290 | (unsigned) predictor
;
5294 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5296 static inline enum prediction
5297 gimple_predict_outcome (gimple gs
)
5299 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5300 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5304 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5307 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5309 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5310 if (outcome
== TAKEN
)
5311 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
5313 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
5317 /* Return the type of the main expression computed by STMT. Return
5318 void_type_node if the statement computes nothing. */
5321 gimple_expr_type (const_gimple stmt
)
5323 enum gimple_code code
= gimple_code (stmt
);
5325 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5328 /* In general we want to pass out a type that can be substituted
5329 for both the RHS and the LHS types if there is a possibly
5330 useless conversion involved. That means returning the
5331 original RHS type as far as we can reconstruct it. */
5332 if (code
== GIMPLE_CALL
)
5333 type
= gimple_call_return_type (stmt
);
5335 switch (gimple_assign_rhs_code (stmt
))
5337 case POINTER_PLUS_EXPR
:
5338 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5342 /* As fallback use the type of the LHS. */
5343 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5348 else if (code
== GIMPLE_COND
)
5349 return boolean_type_node
;
5351 return void_type_node
;
5354 /* Return true if TYPE is a suitable type for a scalar register variable. */
5357 is_gimple_reg_type (tree type
)
5359 return !AGGREGATE_TYPE_P (type
);
5362 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
5364 static inline gimple_stmt_iterator
5365 gsi_start_1 (gimple_seq
*seq
)
5367 gimple_stmt_iterator i
;
5369 i
.ptr
= gimple_seq_first (*seq
);
5371 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
5376 #define gsi_start(x) gsi_start_1 (&(x))
5378 static inline gimple_stmt_iterator
5381 gimple_stmt_iterator i
;
5388 /* Return a new iterator pointing to the first statement in basic block BB. */
5390 static inline gimple_stmt_iterator
5391 gsi_start_bb (basic_block bb
)
5393 gimple_stmt_iterator i
;
5396 seq
= bb_seq_addr (bb
);
5397 i
.ptr
= gimple_seq_first (*seq
);
5405 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
5407 static inline gimple_stmt_iterator
5408 gsi_last_1 (gimple_seq
*seq
)
5410 gimple_stmt_iterator i
;
5412 i
.ptr
= gimple_seq_last (*seq
);
5414 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
5419 #define gsi_last(x) gsi_last_1 (&(x))
5421 /* Return a new iterator pointing to the last statement in basic block BB. */
5423 static inline gimple_stmt_iterator
5424 gsi_last_bb (basic_block bb
)
5426 gimple_stmt_iterator i
;
5429 seq
= bb_seq_addr (bb
);
5430 i
.ptr
= gimple_seq_last (*seq
);
5438 /* Return true if I is at the end of its sequence. */
5441 gsi_end_p (gimple_stmt_iterator i
)
5443 return i
.ptr
== NULL
;
5447 /* Return true if I is one statement before the end of its sequence. */
5450 gsi_one_before_end_p (gimple_stmt_iterator i
)
5452 return i
.ptr
!= NULL
&& i
.ptr
->gsbase
.next
== NULL
;
5456 /* Advance the iterator to the next gimple statement. */
5459 gsi_next (gimple_stmt_iterator
*i
)
5461 i
->ptr
= i
->ptr
->gsbase
.next
;
5464 /* Advance the iterator to the previous gimple statement. */
5467 gsi_prev (gimple_stmt_iterator
*i
)
5469 gimple prev
= i
->ptr
->gsbase
.prev
;
5470 if (prev
->gsbase
.next
)
5476 /* Return the current stmt. */
5478 static inline gimple
5479 gsi_stmt (gimple_stmt_iterator i
)
5484 /* Return a block statement iterator that points to the first non-label
5485 statement in block BB. */
5487 static inline gimple_stmt_iterator
5488 gsi_after_labels (basic_block bb
)
5490 gimple_stmt_iterator gsi
= gsi_start_bb (bb
);
5492 while (!gsi_end_p (gsi
) && gimple_code (gsi_stmt (gsi
)) == GIMPLE_LABEL
)
5498 /* Advance the iterator to the next non-debug gimple statement. */
5501 gsi_next_nondebug (gimple_stmt_iterator
*i
)
5507 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5510 /* Advance the iterator to the next non-debug gimple statement. */
5513 gsi_prev_nondebug (gimple_stmt_iterator
*i
)
5519 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5522 /* Return a new iterator pointing to the first non-debug statement in
5525 static inline gimple_stmt_iterator
5526 gsi_start_nondebug_bb (basic_block bb
)
5528 gimple_stmt_iterator i
= gsi_start_bb (bb
);
5530 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5531 gsi_next_nondebug (&i
);
5536 /* Return a new iterator pointing to the last non-debug statement in
5539 static inline gimple_stmt_iterator
5540 gsi_last_nondebug_bb (basic_block bb
)
5542 gimple_stmt_iterator i
= gsi_last_bb (bb
);
5544 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5545 gsi_prev_nondebug (&i
);
5551 /* Return the basic block associated with this iterator. */
5553 static inline basic_block
5554 gsi_bb (gimple_stmt_iterator i
)
5560 /* Return the sequence associated with this iterator. */
5562 static inline gimple_seq
5563 gsi_seq (gimple_stmt_iterator i
)
5569 enum gsi_iterator_update
5571 GSI_NEW_STMT
, /* Only valid when single statement is added, move
5573 GSI_SAME_STMT
, /* Leave the iterator at the same statement. */
5574 GSI_CONTINUE_LINKING
/* Move iterator to whatever position is suitable
5575 for linking other statements in the same
5579 /* In gimple-iterator.c */
5580 gimple_stmt_iterator
gsi_start_phis (basic_block
);
5581 gimple_seq
gsi_split_seq_after (gimple_stmt_iterator
);
5582 void gsi_split_seq_before (gimple_stmt_iterator
*, gimple_seq
*);
5583 void gsi_set_stmt (gimple_stmt_iterator
*, gimple
);
5584 void gsi_replace (gimple_stmt_iterator
*, gimple
, bool);
5585 void gsi_replace_with_seq (gimple_stmt_iterator
*, gimple_seq
, bool);
5586 void gsi_insert_before (gimple_stmt_iterator
*, gimple
,
5587 enum gsi_iterator_update
);
5588 void gsi_insert_before_without_update (gimple_stmt_iterator
*, gimple
,
5589 enum gsi_iterator_update
);
5590 void gsi_insert_seq_before (gimple_stmt_iterator
*, gimple_seq
,
5591 enum gsi_iterator_update
);
5592 void gsi_insert_seq_before_without_update (gimple_stmt_iterator
*, gimple_seq
,
5593 enum gsi_iterator_update
);
5594 void gsi_insert_after (gimple_stmt_iterator
*, gimple
,
5595 enum gsi_iterator_update
);
5596 void gsi_insert_after_without_update (gimple_stmt_iterator
*, gimple
,
5597 enum gsi_iterator_update
);
5598 void gsi_insert_seq_after (gimple_stmt_iterator
*, gimple_seq
,
5599 enum gsi_iterator_update
);
5600 void gsi_insert_seq_after_without_update (gimple_stmt_iterator
*, gimple_seq
,
5601 enum gsi_iterator_update
);
5602 bool gsi_remove (gimple_stmt_iterator
*, bool);
5603 gimple_stmt_iterator
gsi_for_stmt (gimple
);
5604 void gsi_move_after (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5605 void gsi_move_before (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5606 void gsi_move_to_bb_end (gimple_stmt_iterator
*, basic_block
);
5607 void gsi_insert_on_edge (edge
, gimple
);
5608 void gsi_insert_seq_on_edge (edge
, gimple_seq
);
5609 basic_block
gsi_insert_on_edge_immediate (edge
, gimple
);
5610 basic_block
gsi_insert_seq_on_edge_immediate (edge
, gimple_seq
);
5611 void gsi_commit_one_edge_insert (edge
, basic_block
*);
5612 void gsi_commit_edge_inserts (void);
5613 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
5615 /* In gimplify.c. */
5616 tree
force_gimple_operand_1 (tree
, gimple_seq
*, gimple_predicate
, tree
);
5617 tree
force_gimple_operand (tree
, gimple_seq
*, bool, tree
);
5618 tree
force_gimple_operand_gsi_1 (gimple_stmt_iterator
*, tree
,
5619 gimple_predicate
, tree
,
5620 bool, enum gsi_iterator_update
);
5621 tree
force_gimple_operand_gsi (gimple_stmt_iterator
*, tree
, bool, tree
,
5622 bool, enum gsi_iterator_update
);
5624 /* Convenience routines to walk all statements of a gimple function.
5625 Note that this is useful exclusively before the code is converted
5626 into SSA form. Once the program is in SSA form, the standard
5627 operand interface should be used to analyze/modify statements. */
5628 struct walk_stmt_info
5630 /* Points to the current statement being walked. */
5631 gimple_stmt_iterator gsi
;
5633 /* Additional data that the callback functions may want to carry
5634 through the recursion. */
5637 /* Pointer map used to mark visited tree nodes when calling
5638 walk_tree on each operand. If set to NULL, duplicate tree nodes
5639 will be visited more than once. */
5640 struct pointer_set_t
*pset
;
5642 /* Operand returned by the callbacks. This is set when calling
5643 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5644 returns non-NULL, this field will contain the tree returned by
5645 the last callback. */
5646 tree callback_result
;
5648 /* Indicates whether the operand being examined may be replaced
5649 with something that matches is_gimple_val (if true) or something
5650 slightly more complicated (if false). "Something" technically
5651 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5652 but we never try to form anything more complicated than that, so
5653 we don't bother checking.
5655 Also note that CALLBACK should update this flag while walking the
5656 sub-expressions of a statement. For instance, when walking the
5657 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5658 to true, however, when walking &var, the operand of that
5659 ADDR_EXPR does not need to be a GIMPLE value. */
5660 BOOL_BITFIELD val_only
: 1;
5662 /* True if we are currently walking the LHS of an assignment. */
5663 BOOL_BITFIELD is_lhs
: 1;
5665 /* Optional. Set to true by the callback functions if they made any
5667 BOOL_BITFIELD changed
: 1;
5669 /* True if we're interested in location information. */
5670 BOOL_BITFIELD want_locations
: 1;
5672 /* True if we've removed the statement that was processed. */
5673 BOOL_BITFIELD removed_stmt
: 1;
5676 /* Callback for walk_gimple_stmt. Called for every statement found
5677 during traversal. The first argument points to the statement to
5678 walk. The second argument is a flag that the callback sets to
5679 'true' if it the callback handled all the operands and
5680 sub-statements of the statement (the default value of this flag is
5681 'false'). The third argument is an anonymous pointer to data
5682 to be used by the callback. */
5683 typedef tree (*walk_stmt_fn
) (gimple_stmt_iterator
*, bool *,
5684 struct walk_stmt_info
*);
5686 gimple
walk_gimple_seq (gimple_seq
, walk_stmt_fn
, walk_tree_fn
,
5687 struct walk_stmt_info
*);
5688 gimple
walk_gimple_seq_mod (gimple_seq
*, walk_stmt_fn
, walk_tree_fn
,
5689 struct walk_stmt_info
*);
5690 tree
walk_gimple_stmt (gimple_stmt_iterator
*, walk_stmt_fn
, walk_tree_fn
,
5691 struct walk_stmt_info
*);
5692 tree
walk_gimple_op (gimple
, walk_tree_fn
, struct walk_stmt_info
*);
5694 /* Enum and arrays used for allocation stats. Keep in sync with
5695 gimple.c:gimple_alloc_kind_names. */
5696 enum gimple_alloc_kind
5698 gimple_alloc_kind_assign
, /* Assignments. */
5699 gimple_alloc_kind_phi
, /* PHI nodes. */
5700 gimple_alloc_kind_cond
, /* Conditionals. */
5701 gimple_alloc_kind_rest
, /* Everything else. */
5702 gimple_alloc_kind_all
5705 extern int gimple_alloc_counts
[];
5706 extern int gimple_alloc_sizes
[];
5708 /* Return the allocation kind for a given stmt CODE. */
5709 static inline enum gimple_alloc_kind
5710 gimple_alloc_kind (enum gimple_code code
)
5715 return gimple_alloc_kind_assign
;
5717 return gimple_alloc_kind_phi
;
5719 return gimple_alloc_kind_cond
;
5721 return gimple_alloc_kind_rest
;
5725 extern void dump_gimple_statistics (void);
5727 /* Set the location of all statements in SEQ to LOC. */
5730 gimple_seq_set_location (gimple_seq seq
, location_t loc
)
5732 for (gimple_stmt_iterator i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
5733 gimple_set_location (gsi_stmt (i
), loc
);
5736 /* Macros for showing usage statistics. */
5737 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5739 : ((x) < 1024*1024*10 \
5741 : (x) / (1024*1024))))
5743 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5745 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
5747 #endif /* GCC_GIMPLE_H */