1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010, 2011, 2012 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"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
33 #include "internal-fn.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
, heap
) *gimple_vec
;
40 DEF_VEC_P (gimple_vec
);
41 DEF_VEC_ALLOC_P (gimple_vec
, heap
);
44 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
47 LAST_AND_UNUSED_GIMPLE_CODE
50 extern const char *const gimple_code_name
[];
51 extern const unsigned char gimple_rhs_class_table
[];
53 /* Error out if a gimple tuple is addressed incorrectly. */
54 #if defined ENABLE_GIMPLE_CHECKING
55 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
56 extern void gimple_check_failed (const_gimple
, const char *, int, \
57 const char *, enum gimple_code
, \
58 enum tree_code
) ATTRIBUTE_NORETURN
;
60 #define GIMPLE_CHECK(GS, CODE) \
62 const_gimple __gs = (GS); \
63 if (gimple_code (__gs) != (CODE)) \
64 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
65 (CODE), ERROR_MARK); \
67 #else /* not ENABLE_GIMPLE_CHECKING */
68 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
69 #define GIMPLE_CHECK(GS, CODE) (void)0
72 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
73 get_gimple_rhs_class. */
76 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
77 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
78 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
79 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
80 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
81 name, a _DECL, a _REF, etc. */
84 /* Specific flags for individual GIMPLE statements. These flags are
85 always stored in gimple_statement_base.subcode and they may only be
86 defined for statement codes that do not use sub-codes.
88 Values for the masks can overlap as long as the overlapping values
89 are never used in the same statement class.
91 The maximum mask value that can be defined is 1 << 15 (i.e., each
92 statement code can hold up to 16 bitflags).
94 Keep this list sorted. */
96 GF_ASM_INPUT
= 1 << 0,
97 GF_ASM_VOLATILE
= 1 << 1,
98 GF_CALL_FROM_THUNK
= 1 << 0,
99 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
100 GF_CALL_TAILCALL
= 1 << 2,
101 GF_CALL_VA_ARG_PACK
= 1 << 3,
102 GF_CALL_NOTHROW
= 1 << 4,
103 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
104 GF_CALL_INTERNAL
= 1 << 6,
105 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
107 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
108 a thread synchronization via some sort of barrier. The exact barrier
109 that would otherwise be emitted is dependent on the OMP statement with
110 which this return is associated. */
111 GF_OMP_RETURN_NOWAIT
= 1 << 0,
113 GF_OMP_SECTION_LAST
= 1 << 0,
114 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
115 GF_PREDICT_TAKEN
= 1 << 15
118 /* Currently, there are only two types of gimple debug stmt. Others are
119 envisioned, for example, to enable the generation of is_stmt notes
120 in line number information, to mark sequence points, etc. This
121 subcode is to be used to tell them apart. */
122 enum gimple_debug_subcode
{
123 GIMPLE_DEBUG_BIND
= 0,
124 GIMPLE_DEBUG_SOURCE_BIND
= 1
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
134 /* Iterator object for GIMPLE statement sequences. */
138 /* Sequence node holding the current statement. */
141 /* Sequence and basic block holding the statement. These fields
142 are necessary to handle edge cases such as when statement is
143 added to an empty basic block or when the last statement of a
144 block/sequence is removed. */
147 } gimple_stmt_iterator
;
150 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
151 are for 64 bit hosts. */
153 struct GTY(()) gimple_statement_base
{
155 Main identifying code for a tuple. */
156 ENUM_BITFIELD(gimple_code
) code
: 8;
158 /* Nonzero if a warning should not be emitted on this tuple. */
159 unsigned int no_warning
: 1;
161 /* Nonzero if this tuple has been visited. Passes are responsible
162 for clearing this bit before using it. */
163 unsigned int visited
: 1;
165 /* Nonzero if this tuple represents a non-temporal move. */
166 unsigned int nontemporal_move
: 1;
168 /* Pass local flags. These flags are free for any pass to use as
169 they see fit. Passes should not assume that these flags contain
170 any useful value when the pass starts. Any initial state that
171 the pass requires should be set on entry to the pass. See
172 gimple_set_plf and gimple_plf for usage. */
173 unsigned int plf
: 2;
175 /* Nonzero if this statement has been modified and needs to have its
176 operands rescanned. */
177 unsigned modified
: 1;
179 /* Nonzero if this statement contains volatile operands. */
180 unsigned has_volatile_ops
: 1;
182 /* The SUBCODE field can be used for tuple-specific flags for tuples
183 that do not require subcodes. Note that SUBCODE should be at
184 least as wide as tree codes, as several tuples store tree codes
186 unsigned int subcode
: 16;
188 /* UID of this statement. This is used by passes that want to
189 assign IDs to statements. It must be assigned and used by each
190 pass. By default it should be assumed to contain garbage. */
194 Locus information for debug info. */
197 /* Number of operands in this tuple. */
201 Basic block holding this statement. */
202 struct basic_block_def
*bb
;
205 Linked lists of gimple statements. The next pointers form
206 a NULL terminated list, the prev pointers are a cyclic list.
207 A gimple statement is hence also a double-ended list of
208 statements, with the pointer itself being the first element,
209 and the prev pointer being the last. */
211 gimple
GTY((skip
)) prev
;
214 Lexical block holding this statement. */
219 /* Base structure for tuples with operands. */
221 struct GTY(()) gimple_statement_with_ops_base
224 struct gimple_statement_base gsbase
;
227 SSA operand vectors. NOTE: It should be possible to
228 amalgamate these vectors with the operand vector OP. However,
229 the SSA operand vectors are organized differently and contain
230 more information (like immediate use chaining). */
231 struct def_optype_d
GTY((skip (""))) *def_ops
;
232 struct use_optype_d
GTY((skip (""))) *use_ops
;
236 /* Statements that take register operands. */
238 struct GTY(()) gimple_statement_with_ops
241 struct gimple_statement_with_ops_base opbase
;
244 Operand vector. NOTE! This must always be the last field
245 of this structure. In particular, this means that this
246 structure cannot be embedded inside another one. */
247 tree
GTY((length ("%h.opbase.gsbase.num_ops"))) op
[1];
251 /* Base for statements that take both memory and register operands. */
253 struct GTY(()) gimple_statement_with_memory_ops_base
256 struct gimple_statement_with_ops_base opbase
;
259 Virtual operands for this statement. The GC will pick them
260 up via the ssa_names array. */
261 tree
GTY((skip (""))) vdef
;
262 tree
GTY((skip (""))) vuse
;
266 /* Statements that take both memory and register operands. */
268 struct GTY(()) gimple_statement_with_memory_ops
271 struct gimple_statement_with_memory_ops_base membase
;
274 Operand vector. NOTE! This must always be the last field
275 of this structure. In particular, this means that this
276 structure cannot be embedded inside another one. */
277 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
281 /* Call statements that take both memory and register operands. */
283 struct GTY(()) gimple_statement_call
286 struct gimple_statement_with_memory_ops_base membase
;
289 struct pt_solution call_used
;
290 struct pt_solution call_clobbered
;
293 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
294 tree
GTY ((tag ("0"))) fntype
;
295 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
299 Operand vector. NOTE! This must always be the last field
300 of this structure. In particular, this means that this
301 structure cannot be embedded inside another one. */
302 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
306 /* OpenMP statements (#pragma omp). */
308 struct GTY(()) gimple_statement_omp
{
310 struct gimple_statement_base gsbase
;
319 struct GTY(()) gimple_statement_bind
{
321 struct gimple_statement_base gsbase
;
324 Variables declared in this scope. */
328 This is different than the BLOCK field in gimple_statement_base,
329 which is analogous to TREE_BLOCK (i.e., the lexical block holding
330 this statement). This field is the equivalent of BIND_EXPR_BLOCK
331 in tree land (i.e., the lexical scope defined by this bind). See
342 struct GTY(()) gimple_statement_catch
{
344 struct gimple_statement_base gsbase
;
354 /* GIMPLE_EH_FILTER */
356 struct GTY(()) gimple_statement_eh_filter
{
358 struct gimple_statement_base gsbase
;
371 struct GTY(()) gimple_statement_eh_else
{
373 struct gimple_statement_base gsbase
;
376 gimple_seq n_body
, e_body
;
379 /* GIMPLE_EH_MUST_NOT_THROW */
381 struct GTY(()) gimple_statement_eh_mnt
{
383 struct gimple_statement_base gsbase
;
385 /* [ WORD 7 ] Abort function decl. */
391 struct GTY(()) gimple_statement_phi
{
393 struct gimple_statement_base gsbase
;
403 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
407 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
409 struct GTY(()) gimple_statement_eh_ctrl
412 struct gimple_statement_base gsbase
;
415 Exception region number. */
422 struct GTY(()) gimple_statement_try
{
424 struct gimple_statement_base gsbase
;
427 Expression to evaluate. */
431 Cleanup expression. */
435 /* Kind of GIMPLE_TRY statements. */
436 enum gimple_try_flags
439 GIMPLE_TRY_CATCH
= 1 << 0,
442 GIMPLE_TRY_FINALLY
= 1 << 1,
443 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
445 /* Analogous to TRY_CATCH_IS_CLEANUP. */
446 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
449 /* GIMPLE_WITH_CLEANUP_EXPR */
451 struct GTY(()) gimple_statement_wce
{
453 struct gimple_statement_base gsbase
;
455 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
456 executed if an exception is thrown, not on normal exit of its
457 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
461 Cleanup expression. */
468 struct GTY(()) gimple_statement_asm
471 struct gimple_statement_with_memory_ops_base membase
;
474 __asm__ statement. */
478 Number of inputs, outputs, clobbers, labels. */
485 Operand vector. NOTE! This must always be the last field
486 of this structure. In particular, this means that this
487 structure cannot be embedded inside another one. */
488 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
491 /* GIMPLE_OMP_CRITICAL */
493 struct GTY(()) gimple_statement_omp_critical
{
495 struct gimple_statement_omp omp
;
498 Critical section name. */
503 struct GTY(()) gimple_omp_for_iter
{
504 /* Condition code. */
507 /* Index variable. */
522 struct GTY(()) gimple_statement_omp_for
{
524 struct gimple_statement_omp omp
;
530 Number of elements in iter array. */
534 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
537 Pre-body evaluated before the loop body begins. */
542 /* GIMPLE_OMP_PARALLEL */
544 struct GTY(()) gimple_statement_omp_parallel
{
546 struct gimple_statement_omp omp
;
553 Child function holding the body of the parallel region. */
557 Shared data argument. */
562 /* GIMPLE_OMP_TASK */
564 struct GTY(()) gimple_statement_omp_task
{
566 struct gimple_statement_omp_parallel par
;
569 Child function holding firstprivate initialization if needed. */
573 Size and alignment in bytes of the argument data block. */
579 /* GIMPLE_OMP_SECTION */
580 /* Uses struct gimple_statement_omp. */
583 /* GIMPLE_OMP_SECTIONS */
585 struct GTY(()) gimple_statement_omp_sections
{
587 struct gimple_statement_omp omp
;
593 The control variable used for deciding which of the sections to
598 /* GIMPLE_OMP_CONTINUE.
600 Note: This does not inherit from gimple_statement_omp, because we
601 do not need the body field. */
603 struct GTY(()) gimple_statement_omp_continue
{
605 struct gimple_statement_base gsbase
;
614 /* GIMPLE_OMP_SINGLE */
616 struct GTY(()) gimple_statement_omp_single
{
618 struct gimple_statement_omp omp
;
625 /* GIMPLE_OMP_ATOMIC_LOAD.
626 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
627 contains a sequence, which we don't need here. */
629 struct GTY(()) gimple_statement_omp_atomic_load
{
631 struct gimple_statement_base gsbase
;
637 /* GIMPLE_OMP_ATOMIC_STORE.
638 See note on GIMPLE_OMP_ATOMIC_LOAD. */
640 struct GTY(()) gimple_statement_omp_atomic_store
{
642 struct gimple_statement_base gsbase
;
648 /* GIMPLE_TRANSACTION. */
650 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
652 /* The __transaction_atomic was declared [[outer]] or it is
653 __transaction_relaxed. */
654 #define GTMA_IS_OUTER (1u << 0)
655 #define GTMA_IS_RELAXED (1u << 1)
656 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
658 /* The transaction is seen to not have an abort. */
659 #define GTMA_HAVE_ABORT (1u << 2)
660 /* The transaction is seen to have loads or stores. */
661 #define GTMA_HAVE_LOAD (1u << 3)
662 #define GTMA_HAVE_STORE (1u << 4)
663 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
664 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
665 /* The transaction WILL enter serial irrevocable mode.
666 An irrevocable block post-dominates the entire transaction, such
667 that all invocations of the transaction will go serial-irrevocable.
668 In such case, we don't bother instrumenting the transaction, and
669 tell the runtime that it should begin the transaction in
670 serial-irrevocable mode. */
671 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
673 struct GTY(()) gimple_statement_transaction
676 struct gimple_statement_with_memory_ops_base gsbase
;
685 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
686 enum gimple_statement_structure_enum
{
687 #include "gsstruct.def"
693 /* Define the overall contents of a gimple tuple. It may be any of the
694 structures declared above for various types of tuples. */
696 union GTY ((desc ("gimple_statement_structure (&%h)"),
697 chain_next ("%h.gsbase.next"), variable_size
)) gimple_statement_d
{
698 struct gimple_statement_base
GTY ((tag ("GSS_BASE"))) gsbase
;
699 struct gimple_statement_with_ops
GTY ((tag ("GSS_WITH_OPS"))) gsops
;
700 struct gimple_statement_with_memory_ops_base
GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase
;
701 struct gimple_statement_with_memory_ops
GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem
;
702 struct gimple_statement_call
GTY ((tag ("GSS_CALL"))) gimple_call
;
703 struct gimple_statement_omp
GTY ((tag ("GSS_OMP"))) omp
;
704 struct gimple_statement_bind
GTY ((tag ("GSS_BIND"))) gimple_bind
;
705 struct gimple_statement_catch
GTY ((tag ("GSS_CATCH"))) gimple_catch
;
706 struct gimple_statement_eh_filter
GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter
;
707 struct gimple_statement_eh_mnt
GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt
;
708 struct gimple_statement_eh_else
GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else
;
709 struct gimple_statement_phi
GTY ((tag ("GSS_PHI"))) gimple_phi
;
710 struct gimple_statement_eh_ctrl
GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl
;
711 struct gimple_statement_try
GTY ((tag ("GSS_TRY"))) gimple_try
;
712 struct gimple_statement_wce
GTY ((tag ("GSS_WCE"))) gimple_wce
;
713 struct gimple_statement_asm
GTY ((tag ("GSS_ASM"))) gimple_asm
;
714 struct gimple_statement_omp_critical
GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical
;
715 struct gimple_statement_omp_for
GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for
;
716 struct gimple_statement_omp_parallel
GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel
;
717 struct gimple_statement_omp_task
GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task
;
718 struct gimple_statement_omp_sections
GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections
;
719 struct gimple_statement_omp_single
GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single
;
720 struct gimple_statement_omp_continue
GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue
;
721 struct gimple_statement_omp_atomic_load
GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load
;
722 struct gimple_statement_omp_atomic_store
GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store
;
723 struct gimple_statement_transaction
GTY((tag ("GSS_TRANSACTION"))) gimple_transaction
;
728 /* Offset in bytes to the location of the operand vector.
729 Zero if there is no operand vector for this tuple structure. */
730 extern size_t const gimple_ops_offset_
[];
732 /* Map GIMPLE codes to GSS codes. */
733 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
735 /* This variable holds the currently expanded gimple statement for purposes
736 of comminucating the profile info to the builtin expanders. */
737 extern gimple currently_expanding_gimple_stmt
;
739 gimple
gimple_build_return (tree
);
741 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
742 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
744 void extract_ops_from_tree_1 (tree
, enum tree_code
*, tree
*, tree
*, tree
*);
746 gimple
gimple_build_assign_with_ops_stat (enum tree_code
, tree
, tree
,
747 tree
, tree MEM_STAT_DECL
);
748 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
749 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
750 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
751 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
753 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
754 #define gimple_build_debug_bind(var,val,stmt) \
755 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
756 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
757 #define gimple_build_debug_source_bind(var,val,stmt) \
758 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
760 gimple
gimple_build_call_vec (tree
, VEC(tree
, heap
) *);
761 gimple
gimple_build_call (tree
, unsigned, ...);
762 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
763 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
764 gimple
gimple_build_call_internal_vec (enum internal_fn
, VEC(tree
, heap
) *);
765 gimple
gimple_build_call_from_tree (tree
);
766 gimple
gimplify_assign (tree
, tree
, gimple_seq
*);
767 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
768 gimple
gimple_build_label (tree label
);
769 gimple
gimple_build_goto (tree dest
);
770 gimple
gimple_build_nop (void);
771 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
772 gimple
gimple_build_asm_vec (const char *, VEC(tree
,gc
) *, VEC(tree
,gc
) *,
773 VEC(tree
,gc
) *, VEC(tree
,gc
) *);
774 gimple
gimple_build_catch (tree
, gimple_seq
);
775 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
776 gimple
gimple_build_eh_must_not_throw (tree
);
777 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
778 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
779 gimple
gimple_build_wce (gimple_seq
);
780 gimple
gimple_build_resx (int);
781 gimple
gimple_build_eh_dispatch (int);
782 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
783 gimple
gimple_build_switch (unsigned, tree
, tree
, ...);
784 gimple
gimple_build_switch_vec (tree
, tree
, VEC(tree
,heap
) *);
785 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
786 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
787 gimple
gimple_build_omp_for (gimple_seq
, tree
, size_t, gimple_seq
);
788 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
789 gimple
gimple_build_omp_section (gimple_seq
);
790 gimple
gimple_build_omp_continue (tree
, tree
);
791 gimple
gimple_build_omp_master (gimple_seq
);
792 gimple
gimple_build_omp_return (bool);
793 gimple
gimple_build_omp_ordered (gimple_seq
);
794 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
795 gimple
gimple_build_omp_sections_switch (void);
796 gimple
gimple_build_omp_single (gimple_seq
, tree
);
797 gimple
gimple_build_cdt (tree
, tree
);
798 gimple
gimple_build_omp_atomic_load (tree
, tree
);
799 gimple
gimple_build_omp_atomic_store (tree
);
800 gimple
gimple_build_transaction (gimple_seq
, tree
);
801 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
802 enum gimple_statement_structure_enum
gss_for_assign (enum tree_code
);
803 void sort_case_labels (VEC(tree
,heap
) *);
804 void preprocess_case_label_vec_for_gimple (VEC(tree
,heap
) *, tree
, tree
*);
805 void gimple_set_body (tree
, gimple_seq
);
806 gimple_seq
gimple_body (tree
);
807 bool gimple_has_body_p (tree
);
808 gimple_seq
gimple_seq_alloc (void);
809 void gimple_seq_free (gimple_seq
);
810 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
811 gimple_seq
gimple_seq_copy (gimple_seq
);
812 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
813 int gimple_call_flags (const_gimple
);
814 int gimple_call_return_flags (const_gimple
);
815 int gimple_call_arg_flags (const_gimple
, unsigned);
816 void gimple_call_reset_alias_info (gimple
);
817 bool gimple_assign_copy_p (gimple
);
818 bool gimple_assign_ssa_name_copy_p (gimple
);
819 bool gimple_assign_unary_nop_p (gimple
);
820 void gimple_set_bb (gimple
, struct basic_block_def
*);
821 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
822 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
824 tree
gimple_get_lhs (const_gimple
);
825 void gimple_set_lhs (gimple
, tree
);
826 void gimple_replace_lhs (gimple
, tree
);
827 gimple
gimple_copy (gimple
);
828 void gimple_cond_get_ops_from_tree (tree
, enum tree_code
*, tree
*, tree
*);
829 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
830 void gimple_cond_set_condition_from_tree (gimple
, tree
);
831 bool gimple_has_side_effects (const_gimple
);
832 bool gimple_could_trap_p (gimple
);
833 bool gimple_could_trap_p_1 (gimple
, bool, bool);
834 bool gimple_assign_rhs_could_trap_p (gimple
);
835 void gimple_regimplify_operands (gimple
, gimple_stmt_iterator
*);
836 bool empty_body_p (gimple_seq
);
837 unsigned get_gimple_rhs_num_ops (enum tree_code
);
838 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
839 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
840 const char *gimple_decl_printable_name (tree
, int);
841 tree
gimple_get_virt_method_for_binfo (HOST_WIDE_INT
, tree
);
842 tree
gimple_extract_devirt_binfo_from_cst (tree
);
844 /* Returns true iff T is a scalar register variable. */
845 extern bool is_gimple_reg (tree
);
846 /* Returns true iff T is any sort of variable. */
847 extern bool is_gimple_variable (tree
);
848 /* Returns true iff T is any sort of symbol. */
849 extern bool is_gimple_id (tree
);
850 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
851 extern bool is_gimple_min_lval (tree
);
852 /* Returns true iff T is something whose address can be taken. */
853 extern bool is_gimple_addressable (tree
);
854 /* Returns true iff T is any valid GIMPLE lvalue. */
855 extern bool is_gimple_lvalue (tree
);
857 /* Returns true iff T is a GIMPLE address. */
858 bool is_gimple_address (const_tree
);
859 /* Returns true iff T is a GIMPLE invariant address. */
860 bool is_gimple_invariant_address (const_tree
);
861 /* Returns true iff T is a GIMPLE invariant address at interprocedural
863 bool is_gimple_ip_invariant_address (const_tree
);
864 /* Returns true iff T is a valid GIMPLE constant. */
865 bool is_gimple_constant (const_tree
);
866 /* Returns true iff T is a GIMPLE restricted function invariant. */
867 extern bool is_gimple_min_invariant (const_tree
);
868 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
869 extern bool is_gimple_ip_invariant (const_tree
);
870 /* Returns true iff T is a GIMPLE rvalue. */
871 extern bool is_gimple_val (tree
);
872 /* Returns true iff T is a GIMPLE asm statement input. */
873 extern bool is_gimple_asm_val (tree
);
874 /* Returns true iff T is a valid address operand of a MEM_REF. */
875 bool is_gimple_mem_ref_addr (tree
);
877 /* Returns true iff T is a valid if-statement condition. */
878 extern bool is_gimple_condexpr (tree
);
880 /* Returns true iff T is a valid call address expression. */
881 extern bool is_gimple_call_addr (tree
);
883 extern void recalculate_side_effects (tree
);
884 extern bool gimple_compare_field_offset (tree
, tree
);
885 extern tree
gimple_register_type (tree
);
886 extern tree
gimple_register_canonical_type (tree
);
887 extern void print_gimple_types_stats (void);
888 extern void free_gimple_type_tables (void);
889 extern tree
gimple_unsigned_type (tree
);
890 extern tree
gimple_signed_type (tree
);
891 extern alias_set_type
gimple_get_alias_set (tree
);
892 extern void count_uses_and_derefs (tree
, gimple
, unsigned *, unsigned *,
894 extern bool walk_stmt_load_store_addr_ops (gimple
, void *,
895 bool (*)(gimple
, tree
, void *),
896 bool (*)(gimple
, tree
, void *),
897 bool (*)(gimple
, tree
, void *));
898 extern bool walk_stmt_load_store_ops (gimple
, void *,
899 bool (*)(gimple
, tree
, void *),
900 bool (*)(gimple
, tree
, void *));
901 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
902 extern bool gimple_call_builtin_p (gimple
, enum built_in_function
);
903 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
906 extern tree
create_tmp_var_raw (tree
, const char *);
907 extern tree
create_tmp_var_name (const char *);
908 extern tree
create_tmp_var (tree
, const char *);
909 extern tree
create_tmp_reg (tree
, const char *);
910 extern tree
get_initialized_tmp_var (tree
, gimple_seq
*, gimple_seq
*);
911 extern tree
get_formal_tmp_var (tree
, gimple_seq
*);
912 extern void declare_vars (tree
, gimple
, bool);
913 extern void annotate_all_with_location (gimple_seq
, location_t
);
915 /* Validation of GIMPLE expressions. Note that these predicates only check
916 the basic form of the expression, they don't recurse to make sure that
917 underlying nodes are also of the right form. */
918 typedef bool (*gimple_predicate
)(tree
);
921 /* FIXME we should deduce this from the predicate. */
923 fb_none
= 0, /* Do not generate a temporary. */
925 fb_rvalue
= 1, /* Generate an rvalue to hold the result of a
926 gimplified expression. */
928 fb_lvalue
= 2, /* Generate an lvalue to hold the result of a
929 gimplified expression. */
931 fb_mayfail
= 4, /* Gimplification may fail. Error issued
933 fb_either
= fb_rvalue
| fb_lvalue
936 typedef int fallback_t
;
938 enum gimplify_status
{
939 GS_ERROR
= -2, /* Something Bad Seen. */
940 GS_UNHANDLED
= -1, /* A langhook result for "I dunno". */
941 GS_OK
= 0, /* We did something, maybe more to do. */
942 GS_ALL_DONE
= 1 /* The expression is fully gimplified. */
947 struct gimplify_ctx
*prev_context
;
949 VEC(gimple
,heap
) *bind_expr_stack
;
951 gimple_seq conditional_cleanups
;
955 VEC(tree
,heap
) *case_labels
;
956 /* The formal temporary table. Should this be persistent? */
962 bool allow_rhs_cond_expr
;
963 bool in_cleanup_point_expr
;
966 extern enum gimplify_status
gimplify_expr (tree
*, gimple_seq
*, gimple_seq
*,
967 bool (*) (tree
), fallback_t
);
968 extern void gimplify_type_sizes (tree
, gimple_seq
*);
969 extern void gimplify_one_sizepos (tree
*, gimple_seq
*);
970 extern bool gimplify_stmt (tree
*, gimple_seq
*);
971 extern gimple
gimplify_body (tree
, bool);
972 extern void push_gimplify_context (struct gimplify_ctx
*);
973 extern void pop_gimplify_context (gimple
);
974 extern void gimplify_and_add (tree
, gimple_seq
*);
976 /* Miscellaneous helpers. */
977 extern void gimple_add_tmp_var (tree
);
978 extern bool flag_instrument_functions_exclude_p (tree
);
979 extern gimple
gimple_current_bind_expr (void);
980 extern VEC(gimple
, heap
) *gimple_bind_expr_stack (void);
981 extern tree
voidify_wrapper_expr (tree
, tree
);
982 extern tree
build_and_jump (tree
*);
983 extern tree
force_labels_r (tree
*, int *, void *);
984 extern enum gimplify_status
gimplify_va_arg_expr (tree
*, gimple_seq
*,
986 struct gimplify_omp_ctx
;
987 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx
*, tree
);
988 extern tree
gimple_boolify (tree
);
989 extern gimple_predicate
rhs_predicate_for (tree
);
990 extern tree
canonicalize_cond_expr_cond (tree
);
993 extern tree
omp_reduction_init (tree
, tree
);
995 /* In trans-mem.c. */
996 extern void diagnose_tm_safe_errors (tree
);
997 extern void compute_transaction_bits (void);
999 /* In tree-nested.c. */
1000 extern void lower_nested_functions (tree
);
1001 extern void insert_field_into_struct (tree
, tree
);
1003 /* In gimplify.c. */
1004 extern void gimplify_function_tree (tree
);
1006 /* In cfgexpand.c. */
1007 extern tree
gimple_assign_rhs_to_tree (gimple
);
1010 extern bool validate_gimple_arglist (const_gimple
, ...);
1013 extern bool tree_ssa_useless_type_conversion (tree
);
1014 extern tree
tree_ssa_strip_useless_type_conversions (tree
);
1015 extern bool useless_type_conversion_p (tree
, tree
);
1016 extern bool types_compatible_p (tree
, tree
);
1018 /* Return the first node in GIMPLE sequence S. */
1020 static inline gimple_seq_node
1021 gimple_seq_first (gimple_seq s
)
1027 /* Return the first statement in GIMPLE sequence S. */
1029 static inline gimple
1030 gimple_seq_first_stmt (gimple_seq s
)
1032 gimple_seq_node n
= gimple_seq_first (s
);
1037 /* Return the last node in GIMPLE sequence S. */
1039 static inline gimple_seq_node
1040 gimple_seq_last (gimple_seq s
)
1042 return s
? s
->gsbase
.prev
: NULL
;
1046 /* Return the last statement in GIMPLE sequence S. */
1048 static inline gimple
1049 gimple_seq_last_stmt (gimple_seq s
)
1051 gimple_seq_node n
= gimple_seq_last (s
);
1056 /* Set the last node in GIMPLE sequence *PS to LAST. */
1059 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1061 (*ps
)->gsbase
.prev
= last
;
1065 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1068 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1074 /* Return true if GIMPLE sequence S is empty. */
1077 gimple_seq_empty_p (gimple_seq s
)
1083 void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1085 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
1086 *SEQ_P is NULL, a new sequence is allocated. This function is
1087 similar to gimple_seq_add_stmt, but does not scan the operands.
1088 During gimplification, we need to manipulate statement sequences
1089 before the def/use vectors have been constructed. */
1090 void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1092 /* Allocate a new sequence and initialize its first element with STMT. */
1094 static inline gimple_seq
1095 gimple_seq_alloc_with_stmt (gimple stmt
)
1097 gimple_seq seq
= NULL
;
1098 gimple_seq_add_stmt (&seq
, stmt
);
1103 /* Returns the sequence of statements in BB. */
1105 static inline gimple_seq
1106 bb_seq (const_basic_block bb
)
1108 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1111 static inline gimple_seq
*
1112 bb_seq_addr (basic_block bb
)
1114 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1117 /* Sets the sequence of statements in BB to SEQ. */
1120 set_bb_seq (basic_block bb
, gimple_seq seq
)
1122 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1123 bb
->il
.gimple
.seq
= seq
;
1127 /* Return the code for GIMPLE statement G. */
1129 static inline enum gimple_code
1130 gimple_code (const_gimple g
)
1132 return g
->gsbase
.code
;
1136 /* Return the GSS code used by a GIMPLE code. */
1138 static inline enum gimple_statement_structure_enum
1139 gss_for_code (enum gimple_code code
)
1141 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1142 return gss_for_code_
[code
];
1146 /* Return which GSS code is used by GS. */
1148 static inline enum gimple_statement_structure_enum
1149 gimple_statement_structure (gimple gs
)
1151 return gss_for_code (gimple_code (gs
));
1155 /* Return true if statement G has sub-statements. This is only true for
1156 High GIMPLE statements. */
1159 gimple_has_substatements (gimple g
)
1161 switch (gimple_code (g
))
1165 case GIMPLE_EH_FILTER
:
1166 case GIMPLE_EH_ELSE
:
1168 case GIMPLE_OMP_FOR
:
1169 case GIMPLE_OMP_MASTER
:
1170 case GIMPLE_OMP_ORDERED
:
1171 case GIMPLE_OMP_SECTION
:
1172 case GIMPLE_OMP_PARALLEL
:
1173 case GIMPLE_OMP_TASK
:
1174 case GIMPLE_OMP_SECTIONS
:
1175 case GIMPLE_OMP_SINGLE
:
1176 case GIMPLE_OMP_CRITICAL
:
1177 case GIMPLE_WITH_CLEANUP_EXPR
:
1178 case GIMPLE_TRANSACTION
:
1187 /* Return the basic block holding statement G. */
1189 static inline struct basic_block_def
*
1190 gimple_bb (const_gimple g
)
1192 return g
->gsbase
.bb
;
1196 /* Return the lexical scope block holding statement G. */
1199 gimple_block (const_gimple g
)
1201 return g
->gsbase
.block
;
1205 /* Set BLOCK to be the lexical scope block holding statement G. */
1208 gimple_set_block (gimple g
, tree block
)
1210 g
->gsbase
.block
= block
;
1214 /* Return location information for statement G. */
1216 static inline location_t
1217 gimple_location (const_gimple g
)
1219 return g
->gsbase
.location
;
1222 /* Return pointer to location information for statement G. */
1224 static inline const location_t
*
1225 gimple_location_ptr (const_gimple g
)
1227 return &g
->gsbase
.location
;
1231 /* Set location information for statement G. */
1234 gimple_set_location (gimple g
, location_t location
)
1236 g
->gsbase
.location
= location
;
1240 /* Return true if G contains location information. */
1243 gimple_has_location (const_gimple g
)
1245 return gimple_location (g
) != UNKNOWN_LOCATION
;
1249 /* Return the file name of the location of STMT. */
1251 static inline const char *
1252 gimple_filename (const_gimple stmt
)
1254 return LOCATION_FILE (gimple_location (stmt
));
1258 /* Return the line number of the location of STMT. */
1261 gimple_lineno (const_gimple stmt
)
1263 return LOCATION_LINE (gimple_location (stmt
));
1267 /* Determine whether SEQ is a singleton. */
1270 gimple_seq_singleton_p (gimple_seq seq
)
1272 return ((gimple_seq_first (seq
) != NULL
)
1273 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1276 /* Return true if no warnings should be emitted for statement STMT. */
1279 gimple_no_warning_p (const_gimple stmt
)
1281 return stmt
->gsbase
.no_warning
;
1284 /* Set the no_warning flag of STMT to NO_WARNING. */
1287 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1289 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1292 /* Set the visited status on statement STMT to VISITED_P. */
1295 gimple_set_visited (gimple stmt
, bool visited_p
)
1297 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1301 /* Return the visited status for statement STMT. */
1304 gimple_visited_p (gimple stmt
)
1306 return stmt
->gsbase
.visited
;
1310 /* Set pass local flag PLF on statement STMT to VAL_P. */
1313 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1316 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1318 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1322 /* Return the value of pass local flag PLF on statement STMT. */
1324 static inline unsigned int
1325 gimple_plf (gimple stmt
, enum plf_mask plf
)
1327 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1331 /* Set the UID of statement. */
1334 gimple_set_uid (gimple g
, unsigned uid
)
1336 g
->gsbase
.uid
= uid
;
1340 /* Return the UID of statement. */
1342 static inline unsigned
1343 gimple_uid (const_gimple g
)
1345 return g
->gsbase
.uid
;
1349 /* Make statement G a singleton sequence. */
1352 gimple_init_singleton (gimple g
)
1354 g
->gsbase
.next
= NULL
;
1359 /* Return true if GIMPLE statement G has register or memory operands. */
1362 gimple_has_ops (const_gimple g
)
1364 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1368 /* Return true if GIMPLE statement G has memory operands. */
1371 gimple_has_mem_ops (const_gimple g
)
1373 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1377 /* Return the set of DEF operands for statement G. */
1379 static inline struct def_optype_d
*
1380 gimple_def_ops (const_gimple g
)
1382 if (!gimple_has_ops (g
))
1384 return g
->gsops
.opbase
.def_ops
;
1388 /* Set DEF to be the set of DEF operands for statement G. */
1391 gimple_set_def_ops (gimple g
, struct def_optype_d
*def
)
1393 gcc_gimple_checking_assert (gimple_has_ops (g
));
1394 g
->gsops
.opbase
.def_ops
= def
;
1398 /* Return the set of USE operands for statement G. */
1400 static inline struct use_optype_d
*
1401 gimple_use_ops (const_gimple g
)
1403 if (!gimple_has_ops (g
))
1405 return g
->gsops
.opbase
.use_ops
;
1409 /* Set USE to be the set of USE operands for statement G. */
1412 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1414 gcc_gimple_checking_assert (gimple_has_ops (g
));
1415 g
->gsops
.opbase
.use_ops
= use
;
1419 /* Return the set of VUSE operand for statement G. */
1421 static inline use_operand_p
1422 gimple_vuse_op (const_gimple g
)
1424 struct use_optype_d
*ops
;
1425 if (!gimple_has_mem_ops (g
))
1426 return NULL_USE_OPERAND_P
;
1427 ops
= g
->gsops
.opbase
.use_ops
;
1429 && USE_OP_PTR (ops
)->use
== &g
->gsmembase
.vuse
)
1430 return USE_OP_PTR (ops
);
1431 return NULL_USE_OPERAND_P
;
1434 /* Return the set of VDEF operand for statement G. */
1436 static inline def_operand_p
1437 gimple_vdef_op (const_gimple g
)
1439 struct def_optype_d
*ops
;
1440 if (!gimple_has_mem_ops (g
))
1441 return NULL_DEF_OPERAND_P
;
1442 ops
= g
->gsops
.opbase
.def_ops
;
1444 && DEF_OP_PTR (ops
) == &g
->gsmembase
.vdef
)
1445 return DEF_OP_PTR (ops
);
1446 return NULL_DEF_OPERAND_P
;
1450 /* Return the single VUSE operand of the statement G. */
1453 gimple_vuse (const_gimple g
)
1455 if (!gimple_has_mem_ops (g
))
1457 return g
->gsmembase
.vuse
;
1460 /* Return the single VDEF operand of the statement G. */
1463 gimple_vdef (const_gimple g
)
1465 if (!gimple_has_mem_ops (g
))
1467 return g
->gsmembase
.vdef
;
1470 /* Return the single VUSE operand of the statement G. */
1472 static inline tree
*
1473 gimple_vuse_ptr (gimple g
)
1475 if (!gimple_has_mem_ops (g
))
1477 return &g
->gsmembase
.vuse
;
1480 /* Return the single VDEF operand of the statement G. */
1482 static inline tree
*
1483 gimple_vdef_ptr (gimple g
)
1485 if (!gimple_has_mem_ops (g
))
1487 return &g
->gsmembase
.vdef
;
1490 /* Set the single VUSE operand of the statement G. */
1493 gimple_set_vuse (gimple g
, tree vuse
)
1495 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1496 g
->gsmembase
.vuse
= vuse
;
1499 /* Set the single VDEF operand of the statement G. */
1502 gimple_set_vdef (gimple g
, tree vdef
)
1504 gcc_gimple_checking_assert (gimple_has_mem_ops (g
));
1505 g
->gsmembase
.vdef
= vdef
;
1509 /* Return true if statement G has operands and the modified field has
1513 gimple_modified_p (const_gimple g
)
1515 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1519 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1520 a MODIFIED field. */
1523 gimple_set_modified (gimple s
, bool modifiedp
)
1525 if (gimple_has_ops (s
))
1526 s
->gsbase
.modified
= (unsigned) modifiedp
;
1530 /* Return the tree code for the expression computed by STMT. This is
1531 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1532 GIMPLE_CALL, return CALL_EXPR as the expression code for
1533 consistency. This is useful when the caller needs to deal with the
1534 three kinds of computation that GIMPLE supports. */
1536 static inline enum tree_code
1537 gimple_expr_code (const_gimple stmt
)
1539 enum gimple_code code
= gimple_code (stmt
);
1540 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1541 return (enum tree_code
) stmt
->gsbase
.subcode
;
1544 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1550 /* Mark statement S as modified, and update it. */
1553 update_stmt (gimple s
)
1555 if (gimple_has_ops (s
))
1557 gimple_set_modified (s
, true);
1558 update_stmt_operands (s
);
1562 /* Update statement S if it has been optimized. */
1565 update_stmt_if_modified (gimple s
)
1567 if (gimple_modified_p (s
))
1568 update_stmt_operands (s
);
1571 /* Return true if statement STMT contains volatile operands. */
1574 gimple_has_volatile_ops (const_gimple stmt
)
1576 if (gimple_has_mem_ops (stmt
))
1577 return stmt
->gsbase
.has_volatile_ops
;
1583 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1586 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1588 if (gimple_has_mem_ops (stmt
))
1589 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1592 /* Return true if BB is in a transaction. */
1595 block_in_transaction (basic_block bb
)
1597 return flag_tm
&& bb
->flags
& BB_IN_TRANSACTION
;
1600 /* Return true if STMT is in a transaction. */
1603 gimple_in_transaction (gimple stmt
)
1605 return block_in_transaction (gimple_bb (stmt
));
1608 /* Return true if statement STMT may access memory. */
1611 gimple_references_memory_p (gimple stmt
)
1613 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1617 /* Return the subcode for OMP statement S. */
1619 static inline unsigned
1620 gimple_omp_subcode (const_gimple s
)
1622 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1623 && gimple_code (s
) <= GIMPLE_OMP_SINGLE
);
1624 return s
->gsbase
.subcode
;
1627 /* Set the subcode for OMP statement S to SUBCODE. */
1630 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1632 /* We only have 16 bits for the subcode. Assert that we are not
1634 gcc_gimple_checking_assert (subcode
< (1 << 16));
1635 s
->gsbase
.subcode
= subcode
;
1638 /* Set the nowait flag on OMP_RETURN statement S. */
1641 gimple_omp_return_set_nowait (gimple s
)
1643 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1644 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1648 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1652 gimple_omp_return_nowait_p (const_gimple g
)
1654 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1655 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1659 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1663 gimple_omp_section_last_p (const_gimple g
)
1665 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1666 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1670 /* Set the GF_OMP_SECTION_LAST flag on G. */
1673 gimple_omp_section_set_last (gimple g
)
1675 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1676 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1680 /* Return true if OMP parallel statement G has the
1681 GF_OMP_PARALLEL_COMBINED flag set. */
1684 gimple_omp_parallel_combined_p (const_gimple g
)
1686 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1687 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1691 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1692 value of COMBINED_P. */
1695 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1697 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1699 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1701 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1705 /* Return true if OMP atomic load/store statement G has the
1706 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1709 gimple_omp_atomic_need_value_p (const_gimple g
)
1711 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1712 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1713 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
1717 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1720 gimple_omp_atomic_set_need_value (gimple g
)
1722 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
1723 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
1724 g
->gsbase
.subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
1728 /* Return the number of operands for statement GS. */
1730 static inline unsigned
1731 gimple_num_ops (const_gimple gs
)
1733 return gs
->gsbase
.num_ops
;
1737 /* Set the number of operands for statement GS. */
1740 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1742 gs
->gsbase
.num_ops
= num_ops
;
1746 /* Return the array of operands for statement GS. */
1748 static inline tree
*
1749 gimple_ops (gimple gs
)
1753 /* All the tuples have their operand vector at the very bottom
1754 of the structure. Note that those structures that do not
1755 have an operand vector have a zero offset. */
1756 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1757 gcc_gimple_checking_assert (off
!= 0);
1759 return (tree
*) ((char *) gs
+ off
);
1763 /* Return operand I for statement GS. */
1766 gimple_op (const_gimple gs
, unsigned i
)
1768 if (gimple_has_ops (gs
))
1770 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1771 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1777 /* Return a pointer to operand I for statement GS. */
1779 static inline tree
*
1780 gimple_op_ptr (const_gimple gs
, unsigned i
)
1782 if (gimple_has_ops (gs
))
1784 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
1785 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1791 /* Set operand I of statement GS to OP. */
1794 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1796 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1798 /* Note. It may be tempting to assert that OP matches
1799 is_gimple_operand, but that would be wrong. Different tuples
1800 accept slightly different sets of tree operands. Each caller
1801 should perform its own validation. */
1802 gimple_ops (gs
)[i
] = op
;
1805 /* Return true if GS is a GIMPLE_ASSIGN. */
1808 is_gimple_assign (const_gimple gs
)
1810 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1813 /* Determine if expression CODE is one of the valid expressions that can
1814 be used on the RHS of GIMPLE assignments. */
1816 static inline enum gimple_rhs_class
1817 get_gimple_rhs_class (enum tree_code code
)
1819 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1822 /* Return the LHS of assignment statement GS. */
1825 gimple_assign_lhs (const_gimple gs
)
1827 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1828 return gimple_op (gs
, 0);
1832 /* Return a pointer to the LHS of assignment statement GS. */
1834 static inline tree
*
1835 gimple_assign_lhs_ptr (const_gimple gs
)
1837 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1838 return gimple_op_ptr (gs
, 0);
1842 /* Set LHS to be the LHS operand of assignment statement GS. */
1845 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1847 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1848 gimple_set_op (gs
, 0, lhs
);
1850 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1851 SSA_NAME_DEF_STMT (lhs
) = gs
;
1855 /* Return the first operand on the RHS of assignment statement GS. */
1858 gimple_assign_rhs1 (const_gimple gs
)
1860 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1861 return gimple_op (gs
, 1);
1865 /* Return a pointer to the first operand on the RHS of assignment
1868 static inline tree
*
1869 gimple_assign_rhs1_ptr (const_gimple gs
)
1871 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1872 return gimple_op_ptr (gs
, 1);
1875 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1878 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1880 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1882 gimple_set_op (gs
, 1, rhs
);
1886 /* Return the second operand on the RHS of assignment statement GS.
1887 If GS does not have two operands, NULL is returned instead. */
1890 gimple_assign_rhs2 (const_gimple gs
)
1892 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1894 if (gimple_num_ops (gs
) >= 3)
1895 return gimple_op (gs
, 2);
1901 /* Return a pointer to the second operand on the RHS of assignment
1904 static inline tree
*
1905 gimple_assign_rhs2_ptr (const_gimple gs
)
1907 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1908 return gimple_op_ptr (gs
, 2);
1912 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1915 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1917 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1919 gimple_set_op (gs
, 2, rhs
);
1922 /* Return the third operand on the RHS of assignment statement GS.
1923 If GS does not have two operands, NULL is returned instead. */
1926 gimple_assign_rhs3 (const_gimple gs
)
1928 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1930 if (gimple_num_ops (gs
) >= 4)
1931 return gimple_op (gs
, 3);
1936 /* Return a pointer to the third operand on the RHS of assignment
1939 static inline tree
*
1940 gimple_assign_rhs3_ptr (const_gimple gs
)
1942 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1943 return gimple_op_ptr (gs
, 3);
1947 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1950 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
1952 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1954 gimple_set_op (gs
, 3, rhs
);
1957 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1958 to see only a maximum of two operands. */
1961 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
1964 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
1967 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1968 to see only a maximum of two operands. */
1971 extract_ops_from_tree (tree expr
, enum tree_code
*code
, tree
*op0
,
1975 extract_ops_from_tree_1 (expr
, code
, op0
, op1
, &op2
);
1976 gcc_assert (op2
== NULL_TREE
);
1979 /* Returns true if GS is a nontemporal move. */
1982 gimple_assign_nontemporal_move_p (const_gimple gs
)
1984 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1985 return gs
->gsbase
.nontemporal_move
;
1988 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1991 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
1993 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1994 gs
->gsbase
.nontemporal_move
= nontemporal
;
1998 /* Return the code of the expression computed on the rhs of assignment
1999 statement GS. In case that the RHS is a single object, returns the
2000 tree code of the object. */
2002 static inline enum tree_code
2003 gimple_assign_rhs_code (const_gimple gs
)
2005 enum tree_code code
;
2006 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2008 code
= (enum tree_code
) gs
->gsbase
.subcode
;
2009 /* While we initially set subcode to the TREE_CODE of the rhs for
2010 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2011 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2012 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2013 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2019 /* Set CODE to be the code for the expression computed on the RHS of
2023 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2025 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2026 s
->gsbase
.subcode
= code
;
2030 /* Return the gimple rhs class of the code of the expression computed on
2031 the rhs of assignment statement GS.
2032 This will never return GIMPLE_INVALID_RHS. */
2034 static inline enum gimple_rhs_class
2035 gimple_assign_rhs_class (const_gimple gs
)
2037 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2040 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2041 there is no operator associated with the assignment itself.
2042 Unlike gimple_assign_copy_p, this predicate returns true for
2043 any RHS operand, including those that perform an operation
2044 and do not have the semantics of a copy, such as COND_EXPR. */
2047 gimple_assign_single_p (gimple gs
)
2049 return (is_gimple_assign (gs
)
2050 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2054 /* Return true if S is a type-cast assignment. */
2057 gimple_assign_cast_p (gimple s
)
2059 if (is_gimple_assign (s
))
2061 enum tree_code sc
= gimple_assign_rhs_code (s
);
2062 return CONVERT_EXPR_CODE_P (sc
)
2063 || sc
== VIEW_CONVERT_EXPR
2064 || sc
== FIX_TRUNC_EXPR
;
2070 /* Return true if S is a clobber statement. */
2073 gimple_clobber_p (gimple s
)
2075 return gimple_assign_single_p (s
)
2076 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2079 /* Return true if GS is a GIMPLE_CALL. */
2082 is_gimple_call (const_gimple gs
)
2084 return gimple_code (gs
) == GIMPLE_CALL
;
2087 /* Return the LHS of call statement GS. */
2090 gimple_call_lhs (const_gimple gs
)
2092 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2093 return gimple_op (gs
, 0);
2097 /* Return a pointer to the LHS of call statement GS. */
2099 static inline tree
*
2100 gimple_call_lhs_ptr (const_gimple gs
)
2102 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2103 return gimple_op_ptr (gs
, 0);
2107 /* Set LHS to be the LHS operand of call statement GS. */
2110 gimple_call_set_lhs (gimple gs
, tree lhs
)
2112 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2113 gimple_set_op (gs
, 0, lhs
);
2114 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2115 SSA_NAME_DEF_STMT (lhs
) = gs
;
2119 /* Return true if call GS calls an internal-only function, as enumerated
2123 gimple_call_internal_p (const_gimple gs
)
2125 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2126 return (gs
->gsbase
.subcode
& GF_CALL_INTERNAL
) != 0;
2130 /* Return the target of internal call GS. */
2132 static inline enum internal_fn
2133 gimple_call_internal_fn (const_gimple gs
)
2135 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2136 return gs
->gimple_call
.u
.internal_fn
;
2140 /* Return the function type of the function called by GS. */
2143 gimple_call_fntype (const_gimple gs
)
2145 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2146 if (gimple_call_internal_p (gs
))
2148 return gs
->gimple_call
.u
.fntype
;
2151 /* Set the type of the function called by GS to FNTYPE. */
2154 gimple_call_set_fntype (gimple gs
, tree fntype
)
2156 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2157 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2158 gs
->gimple_call
.u
.fntype
= fntype
;
2162 /* Return the tree node representing the function called by call
2166 gimple_call_fn (const_gimple gs
)
2168 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2169 return gimple_op (gs
, 1);
2172 /* Return a pointer to the tree node representing the function called by call
2175 static inline tree
*
2176 gimple_call_fn_ptr (const_gimple gs
)
2178 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2179 return gimple_op_ptr (gs
, 1);
2183 /* Set FN to be the function called by call statement GS. */
2186 gimple_call_set_fn (gimple gs
, tree fn
)
2188 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2189 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2190 gimple_set_op (gs
, 1, fn
);
2194 /* Set FNDECL to be the function called by call statement GS. */
2197 gimple_call_set_fndecl (gimple gs
, tree decl
)
2199 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2200 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2201 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2205 /* Set internal function FN to be the function called by call statement GS. */
2208 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2210 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2211 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2212 gs
->gimple_call
.u
.internal_fn
= fn
;
2216 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2217 associated with the callee if known. Otherwise return NULL_TREE. */
2220 gimple_call_addr_fndecl (const_tree fn
)
2222 if (fn
&& TREE_CODE (fn
) == ADDR_EXPR
)
2224 tree fndecl
= TREE_OPERAND (fn
, 0);
2225 if (TREE_CODE (fndecl
) == MEM_REF
2226 && TREE_CODE (TREE_OPERAND (fndecl
, 0)) == ADDR_EXPR
2227 && integer_zerop (TREE_OPERAND (fndecl
, 1)))
2228 fndecl
= TREE_OPERAND (TREE_OPERAND (fndecl
, 0), 0);
2229 if (TREE_CODE (fndecl
) == FUNCTION_DECL
)
2235 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2236 Otherwise return NULL. This function is analogous to
2237 get_callee_fndecl in tree land. */
2240 gimple_call_fndecl (const_gimple gs
)
2242 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2246 /* Return the type returned by call statement GS. */
2249 gimple_call_return_type (const_gimple gs
)
2251 tree type
= gimple_call_fntype (gs
);
2253 if (type
== NULL_TREE
)
2254 return TREE_TYPE (gimple_call_lhs (gs
));
2256 /* The type returned by a function is the type of its
2258 return TREE_TYPE (type
);
2262 /* Return the static chain for call statement GS. */
2265 gimple_call_chain (const_gimple gs
)
2267 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2268 return gimple_op (gs
, 2);
2272 /* Return a pointer to the static chain for call statement GS. */
2274 static inline tree
*
2275 gimple_call_chain_ptr (const_gimple gs
)
2277 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2278 return gimple_op_ptr (gs
, 2);
2281 /* Set CHAIN to be the static chain for call statement GS. */
2284 gimple_call_set_chain (gimple gs
, tree chain
)
2286 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2288 gimple_set_op (gs
, 2, chain
);
2292 /* Return the number of arguments used by call statement GS. */
2294 static inline unsigned
2295 gimple_call_num_args (const_gimple gs
)
2298 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2299 num_ops
= gimple_num_ops (gs
);
2304 /* Return the argument at position INDEX for call statement GS. */
2307 gimple_call_arg (const_gimple gs
, unsigned index
)
2309 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2310 return gimple_op (gs
, index
+ 3);
2314 /* Return a pointer to the argument at position INDEX for call
2317 static inline tree
*
2318 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2320 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2321 return gimple_op_ptr (gs
, index
+ 3);
2325 /* Set ARG to be the argument at position INDEX for call statement GS. */
2328 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2330 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2331 gimple_set_op (gs
, index
+ 3, arg
);
2335 /* If TAIL_P is true, mark call statement S as being a tail call
2336 (i.e., a call just before the exit of a function). These calls are
2337 candidate for tail call optimization. */
2340 gimple_call_set_tail (gimple s
, bool tail_p
)
2342 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2344 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2346 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2350 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2353 gimple_call_tail_p (gimple s
)
2355 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2356 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2360 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2361 slot optimization. This transformation uses the target of the call
2362 expansion as the return slot for calls that return in memory. */
2365 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2367 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2368 if (return_slot_opt_p
)
2369 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2371 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2375 /* Return true if S is marked for return slot optimization. */
2378 gimple_call_return_slot_opt_p (gimple s
)
2380 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2381 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2385 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2386 thunk to the thunked-to function. */
2389 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2391 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2393 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2395 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2399 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2402 gimple_call_from_thunk_p (gimple s
)
2404 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2405 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2409 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2410 argument pack in its argument list. */
2413 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2415 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2416 if (pass_arg_pack_p
)
2417 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2419 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2423 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2424 argument pack in its argument list. */
2427 gimple_call_va_arg_pack_p (gimple s
)
2429 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2430 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2434 /* Return true if S is a noreturn call. */
2437 gimple_call_noreturn_p (gimple s
)
2439 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2440 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2444 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2445 even if the called function can throw in other cases. */
2448 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2450 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2452 s
->gsbase
.subcode
|= GF_CALL_NOTHROW
;
2454 s
->gsbase
.subcode
&= ~GF_CALL_NOTHROW
;
2457 /* Return true if S is a nothrow call. */
2460 gimple_call_nothrow_p (gimple s
)
2462 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2463 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2466 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2467 is known to be emitted for VLA objects. Those are wrapped by
2468 stack_save/stack_restore calls and hence can't lead to unbounded
2469 stack growth even when they occur in loops. */
2472 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2474 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2476 s
->gsbase
.subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2478 s
->gsbase
.subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2481 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2484 gimple_call_alloca_for_var_p (gimple s
)
2486 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2487 return (s
->gsbase
.subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2490 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2493 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2495 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2496 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2497 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2501 /* Return a pointer to the points-to solution for the set of call-used
2502 variables of the call CALL. */
2504 static inline struct pt_solution
*
2505 gimple_call_use_set (gimple call
)
2507 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2508 return &call
->gimple_call
.call_used
;
2512 /* Return a pointer to the points-to solution for the set of call-used
2513 variables of the call CALL. */
2515 static inline struct pt_solution
*
2516 gimple_call_clobber_set (gimple call
)
2518 GIMPLE_CHECK (call
, GIMPLE_CALL
);
2519 return &call
->gimple_call
.call_clobbered
;
2523 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2527 gimple_has_lhs (gimple stmt
)
2529 return (is_gimple_assign (stmt
)
2530 || (is_gimple_call (stmt
)
2531 && gimple_call_lhs (stmt
) != NULL_TREE
));
2535 /* Return the code of the predicate computed by conditional statement GS. */
2537 static inline enum tree_code
2538 gimple_cond_code (const_gimple gs
)
2540 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2541 return (enum tree_code
) gs
->gsbase
.subcode
;
2545 /* Set CODE to be the predicate code for the conditional statement GS. */
2548 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2550 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2551 gs
->gsbase
.subcode
= code
;
2555 /* Return the LHS of the predicate computed by conditional statement GS. */
2558 gimple_cond_lhs (const_gimple gs
)
2560 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2561 return gimple_op (gs
, 0);
2564 /* Return the pointer to the LHS of the predicate computed by conditional
2567 static inline tree
*
2568 gimple_cond_lhs_ptr (const_gimple gs
)
2570 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2571 return gimple_op_ptr (gs
, 0);
2574 /* Set LHS to be the LHS operand of the predicate computed by
2575 conditional statement GS. */
2578 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2580 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2581 gimple_set_op (gs
, 0, lhs
);
2585 /* Return the RHS operand of the predicate computed by conditional GS. */
2588 gimple_cond_rhs (const_gimple gs
)
2590 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2591 return gimple_op (gs
, 1);
2594 /* Return the pointer to the RHS operand of the predicate computed by
2597 static inline tree
*
2598 gimple_cond_rhs_ptr (const_gimple gs
)
2600 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2601 return gimple_op_ptr (gs
, 1);
2605 /* Set RHS to be the RHS operand of the predicate computed by
2606 conditional statement GS. */
2609 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2611 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2612 gimple_set_op (gs
, 1, rhs
);
2616 /* Return the label used by conditional statement GS when its
2617 predicate evaluates to true. */
2620 gimple_cond_true_label (const_gimple gs
)
2622 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2623 return gimple_op (gs
, 2);
2627 /* Set LABEL to be the label used by conditional statement GS when its
2628 predicate evaluates to true. */
2631 gimple_cond_set_true_label (gimple gs
, tree label
)
2633 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2634 gimple_set_op (gs
, 2, label
);
2638 /* Set LABEL to be the label used by conditional statement GS when its
2639 predicate evaluates to false. */
2642 gimple_cond_set_false_label (gimple gs
, tree label
)
2644 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2645 gimple_set_op (gs
, 3, label
);
2649 /* Return the label used by conditional statement GS when its
2650 predicate evaluates to false. */
2653 gimple_cond_false_label (const_gimple gs
)
2655 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2656 return gimple_op (gs
, 3);
2660 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2663 gimple_cond_make_false (gimple gs
)
2665 gimple_cond_set_lhs (gs
, boolean_true_node
);
2666 gimple_cond_set_rhs (gs
, boolean_false_node
);
2667 gs
->gsbase
.subcode
= EQ_EXPR
;
2671 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2674 gimple_cond_make_true (gimple gs
)
2676 gimple_cond_set_lhs (gs
, boolean_true_node
);
2677 gimple_cond_set_rhs (gs
, boolean_true_node
);
2678 gs
->gsbase
.subcode
= EQ_EXPR
;
2681 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2682 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2685 gimple_cond_true_p (const_gimple gs
)
2687 tree lhs
= gimple_cond_lhs (gs
);
2688 tree rhs
= gimple_cond_rhs (gs
);
2689 enum tree_code code
= gimple_cond_code (gs
);
2691 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2694 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2697 if (code
== NE_EXPR
&& lhs
!= rhs
)
2700 if (code
== EQ_EXPR
&& lhs
== rhs
)
2706 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2707 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2710 gimple_cond_false_p (const_gimple gs
)
2712 tree lhs
= gimple_cond_lhs (gs
);
2713 tree rhs
= gimple_cond_rhs (gs
);
2714 enum tree_code code
= gimple_cond_code (gs
);
2716 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2719 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2722 if (code
== NE_EXPR
&& lhs
== rhs
)
2725 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2731 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2735 gimple_cond_single_var_p (gimple gs
)
2737 if (gimple_cond_code (gs
) == NE_EXPR
2738 && gimple_cond_rhs (gs
) == boolean_false_node
)
2741 if (gimple_cond_code (gs
) == EQ_EXPR
2742 && gimple_cond_rhs (gs
) == boolean_true_node
)
2748 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2751 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2753 gimple_cond_set_code (stmt
, code
);
2754 gimple_cond_set_lhs (stmt
, lhs
);
2755 gimple_cond_set_rhs (stmt
, rhs
);
2758 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2761 gimple_label_label (const_gimple gs
)
2763 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2764 return gimple_op (gs
, 0);
2768 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2772 gimple_label_set_label (gimple gs
, tree label
)
2774 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2775 gimple_set_op (gs
, 0, label
);
2779 /* Return the destination of the unconditional jump GS. */
2782 gimple_goto_dest (const_gimple gs
)
2784 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2785 return gimple_op (gs
, 0);
2789 /* Set DEST to be the destination of the unconditonal jump GS. */
2792 gimple_goto_set_dest (gimple gs
, tree dest
)
2794 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2795 gimple_set_op (gs
, 0, dest
);
2799 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2802 gimple_bind_vars (const_gimple gs
)
2804 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2805 return gs
->gimple_bind
.vars
;
2809 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2813 gimple_bind_set_vars (gimple gs
, tree vars
)
2815 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2816 gs
->gimple_bind
.vars
= vars
;
2820 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2824 gimple_bind_append_vars (gimple gs
, tree vars
)
2826 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2827 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2831 static inline gimple_seq
*
2832 gimple_bind_body_ptr (gimple gs
)
2834 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2835 return &gs
->gimple_bind
.body
;
2838 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2840 static inline gimple_seq
2841 gimple_bind_body (gimple gs
)
2843 return *gimple_bind_body_ptr (gs
);
2847 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2851 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2853 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2854 gs
->gimple_bind
.body
= seq
;
2858 /* Append a statement to the end of a GIMPLE_BIND's body. */
2861 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2863 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2864 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2868 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2871 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2873 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2874 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2878 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2879 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2882 gimple_bind_block (const_gimple gs
)
2884 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2885 return gs
->gimple_bind
.block
;
2889 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2893 gimple_bind_set_block (gimple gs
, tree block
)
2895 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2896 gcc_gimple_checking_assert (block
== NULL_TREE
2897 || TREE_CODE (block
) == BLOCK
);
2898 gs
->gimple_bind
.block
= block
;
2902 /* Return the number of input operands for GIMPLE_ASM GS. */
2904 static inline unsigned
2905 gimple_asm_ninputs (const_gimple gs
)
2907 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2908 return gs
->gimple_asm
.ni
;
2912 /* Return the number of output operands for GIMPLE_ASM GS. */
2914 static inline unsigned
2915 gimple_asm_noutputs (const_gimple gs
)
2917 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2918 return gs
->gimple_asm
.no
;
2922 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2924 static inline unsigned
2925 gimple_asm_nclobbers (const_gimple gs
)
2927 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2928 return gs
->gimple_asm
.nc
;
2931 /* Return the number of label operands for GIMPLE_ASM GS. */
2933 static inline unsigned
2934 gimple_asm_nlabels (const_gimple gs
)
2936 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2937 return gs
->gimple_asm
.nl
;
2940 /* Return input operand INDEX of GIMPLE_ASM GS. */
2943 gimple_asm_input_op (const_gimple gs
, unsigned index
)
2945 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2946 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.ni
);
2947 return gimple_op (gs
, index
);
2950 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2952 static inline tree
*
2953 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
2955 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2956 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.ni
);
2957 return gimple_op_ptr (gs
, index
);
2961 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2964 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
2966 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2967 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.ni
2968 && TREE_CODE (in_op
) == TREE_LIST
);
2969 gimple_set_op (gs
, index
, in_op
);
2973 /* Return output operand INDEX of GIMPLE_ASM GS. */
2976 gimple_asm_output_op (const_gimple gs
, unsigned index
)
2978 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2979 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.no
);
2980 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
);
2983 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2985 static inline tree
*
2986 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
2988 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2989 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.no
);
2990 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.ni
);
2994 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2997 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
2999 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3000 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.no
3001 && TREE_CODE (out_op
) == TREE_LIST
);
3002 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
, out_op
);
3006 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3009 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3011 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3012 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.nc
);
3013 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
3017 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3020 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3022 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3023 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.nc
3024 && TREE_CODE (clobber_op
) == TREE_LIST
);
3025 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
3028 /* Return label operand INDEX of GIMPLE_ASM GS. */
3031 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3033 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3034 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.nl
);
3035 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
3038 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3041 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3043 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3044 gcc_gimple_checking_assert (index
<= gs
->gimple_asm
.nl
3045 && TREE_CODE (label_op
) == TREE_LIST
);
3046 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
3049 /* Return the string representing the assembly instruction in
3052 static inline const char *
3053 gimple_asm_string (const_gimple gs
)
3055 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3056 return gs
->gimple_asm
.string
;
3060 /* Return true if GS is an asm statement marked volatile. */
3063 gimple_asm_volatile_p (const_gimple gs
)
3065 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3066 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
3070 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3073 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3075 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3077 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
3079 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
3083 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3086 gimple_asm_set_input (gimple gs
, bool input_p
)
3088 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3090 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
3092 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
3096 /* Return true if asm GS is an ASM_INPUT. */
3099 gimple_asm_input_p (const_gimple gs
)
3101 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3102 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
3106 /* Return the types handled by GIMPLE_CATCH statement GS. */
3109 gimple_catch_types (const_gimple gs
)
3111 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3112 return gs
->gimple_catch
.types
;
3116 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3118 static inline tree
*
3119 gimple_catch_types_ptr (gimple gs
)
3121 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3122 return &gs
->gimple_catch
.types
;
3126 /* Return a pointer to the GIMPLE sequence representing the body of
3127 the handler of GIMPLE_CATCH statement GS. */
3129 static inline gimple_seq
*
3130 gimple_catch_handler_ptr (gimple gs
)
3132 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3133 return &gs
->gimple_catch
.handler
;
3137 /* Return the GIMPLE sequence representing the body of the handler of
3138 GIMPLE_CATCH statement GS. */
3140 static inline gimple_seq
3141 gimple_catch_handler (gimple gs
)
3143 return *gimple_catch_handler_ptr (gs
);
3147 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3150 gimple_catch_set_types (gimple gs
, tree t
)
3152 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3153 gs
->gimple_catch
.types
= t
;
3157 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3160 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3162 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
3163 gs
->gimple_catch
.handler
= handler
;
3167 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3170 gimple_eh_filter_types (const_gimple gs
)
3172 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3173 return gs
->gimple_eh_filter
.types
;
3177 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3180 static inline tree
*
3181 gimple_eh_filter_types_ptr (gimple gs
)
3183 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3184 return &gs
->gimple_eh_filter
.types
;
3188 /* Return a pointer to the sequence of statement to execute when
3189 GIMPLE_EH_FILTER statement fails. */
3191 static inline gimple_seq
*
3192 gimple_eh_filter_failure_ptr (gimple gs
)
3194 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3195 return &gs
->gimple_eh_filter
.failure
;
3199 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3202 static inline gimple_seq
3203 gimple_eh_filter_failure (gimple gs
)
3205 return *gimple_eh_filter_failure_ptr (gs
);
3209 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3212 gimple_eh_filter_set_types (gimple gs
, tree types
)
3214 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3215 gs
->gimple_eh_filter
.types
= types
;
3219 /* Set FAILURE to be the sequence of statements to execute on failure
3220 for GIMPLE_EH_FILTER GS. */
3223 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3225 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
3226 gs
->gimple_eh_filter
.failure
= failure
;
3229 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3232 gimple_eh_must_not_throw_fndecl (gimple gs
)
3234 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3235 return gs
->gimple_eh_mnt
.fndecl
;
3238 /* Set the function decl to be called by GS to DECL. */
3241 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3243 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
3244 gs
->gimple_eh_mnt
.fndecl
= decl
;
3247 /* GIMPLE_EH_ELSE accessors. */
3249 static inline gimple_seq
*
3250 gimple_eh_else_n_body_ptr (gimple gs
)
3252 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3253 return &gs
->gimple_eh_else
.n_body
;
3256 static inline gimple_seq
3257 gimple_eh_else_n_body (gimple gs
)
3259 return *gimple_eh_else_n_body_ptr (gs
);
3262 static inline gimple_seq
*
3263 gimple_eh_else_e_body_ptr (gimple gs
)
3265 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3266 return &gs
->gimple_eh_else
.e_body
;
3269 static inline gimple_seq
3270 gimple_eh_else_e_body (gimple gs
)
3272 return *gimple_eh_else_e_body_ptr (gs
);
3276 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3278 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3279 gs
->gimple_eh_else
.n_body
= seq
;
3283 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3285 GIMPLE_CHECK (gs
, GIMPLE_EH_ELSE
);
3286 gs
->gimple_eh_else
.e_body
= seq
;
3289 /* GIMPLE_TRY accessors. */
3291 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3292 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3294 static inline enum gimple_try_flags
3295 gimple_try_kind (const_gimple gs
)
3297 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3298 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
3302 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3305 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3307 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3308 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3309 || kind
== GIMPLE_TRY_FINALLY
);
3310 if (gimple_try_kind (gs
) != kind
)
3311 gs
->gsbase
.subcode
= (unsigned int) kind
;
3315 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3318 gimple_try_catch_is_cleanup (const_gimple gs
)
3320 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3321 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3325 /* Return a pointer to the sequence of statements used as the
3326 body for GIMPLE_TRY GS. */
3328 static inline gimple_seq
*
3329 gimple_try_eval_ptr (gimple gs
)
3331 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3332 return &gs
->gimple_try
.eval
;
3336 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3338 static inline gimple_seq
3339 gimple_try_eval (gimple gs
)
3341 return *gimple_try_eval_ptr (gs
);
3345 /* Return a pointer to the sequence of statements used as the cleanup body for
3348 static inline gimple_seq
*
3349 gimple_try_cleanup_ptr (gimple gs
)
3351 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3352 return &gs
->gimple_try
.cleanup
;
3356 /* Return the sequence of statements used as the cleanup body for
3359 static inline gimple_seq
3360 gimple_try_cleanup (gimple gs
)
3362 return *gimple_try_cleanup_ptr (gs
);
3366 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3369 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3371 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3372 if (catch_is_cleanup
)
3373 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3375 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3379 /* Set EVAL to be the sequence of statements to use as the body for
3383 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3385 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3386 gs
->gimple_try
.eval
= eval
;
3390 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3391 body for GIMPLE_TRY GS. */
3394 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3396 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3397 gs
->gimple_try
.cleanup
= cleanup
;
3401 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3403 static inline gimple_seq
*
3404 gimple_wce_cleanup_ptr (gimple gs
)
3406 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3407 return &gs
->gimple_wce
.cleanup
;
3411 /* Return the cleanup sequence for cleanup statement GS. */
3413 static inline gimple_seq
3414 gimple_wce_cleanup (gimple gs
)
3416 return *gimple_wce_cleanup_ptr (gs
);
3420 /* Set CLEANUP to be the cleanup sequence for GS. */
3423 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3425 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3426 gs
->gimple_wce
.cleanup
= cleanup
;
3430 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3433 gimple_wce_cleanup_eh_only (const_gimple gs
)
3435 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3436 return gs
->gsbase
.subcode
!= 0;
3440 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3443 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3445 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3446 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3450 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3452 static inline unsigned
3453 gimple_phi_capacity (const_gimple gs
)
3455 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3456 return gs
->gimple_phi
.capacity
;
3460 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3461 be exactly the number of incoming edges for the basic block holding
3464 static inline unsigned
3465 gimple_phi_num_args (const_gimple gs
)
3467 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3468 return gs
->gimple_phi
.nargs
;
3472 /* Return the SSA name created by GIMPLE_PHI GS. */
3475 gimple_phi_result (const_gimple gs
)
3477 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3478 return gs
->gimple_phi
.result
;
3481 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3483 static inline tree
*
3484 gimple_phi_result_ptr (gimple gs
)
3486 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3487 return &gs
->gimple_phi
.result
;
3490 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3493 gimple_phi_set_result (gimple gs
, tree result
)
3495 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3496 gs
->gimple_phi
.result
= result
;
3500 /* Return the PHI argument corresponding to incoming edge INDEX for
3503 static inline struct phi_arg_d
*
3504 gimple_phi_arg (gimple gs
, unsigned index
)
3506 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3507 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.capacity
);
3508 return &(gs
->gimple_phi
.args
[index
]);
3511 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3512 for GIMPLE_PHI GS. */
3515 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3517 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3518 gcc_gimple_checking_assert (index
<= gs
->gimple_phi
.nargs
);
3519 gs
->gimple_phi
.args
[index
] = *phiarg
;
3522 /* Return the region number for GIMPLE_RESX GS. */
3525 gimple_resx_region (const_gimple gs
)
3527 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3528 return gs
->gimple_eh_ctrl
.region
;
3531 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3534 gimple_resx_set_region (gimple gs
, int region
)
3536 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3537 gs
->gimple_eh_ctrl
.region
= region
;
3540 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3543 gimple_eh_dispatch_region (const_gimple gs
)
3545 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3546 return gs
->gimple_eh_ctrl
.region
;
3549 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3552 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3554 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3555 gs
->gimple_eh_ctrl
.region
= region
;
3558 /* Return the number of labels associated with the switch statement GS. */
3560 static inline unsigned
3561 gimple_switch_num_labels (const_gimple gs
)
3564 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3565 num_ops
= gimple_num_ops (gs
);
3566 gcc_gimple_checking_assert (num_ops
> 1);
3571 /* Set NLABELS to be the number of labels for the switch statement GS. */
3574 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3576 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3577 gimple_set_num_ops (g
, nlabels
+ 1);
3581 /* Return the index variable used by the switch statement GS. */
3584 gimple_switch_index (const_gimple gs
)
3586 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3587 return gimple_op (gs
, 0);
3591 /* Return a pointer to the index variable for the switch statement GS. */
3593 static inline tree
*
3594 gimple_switch_index_ptr (const_gimple gs
)
3596 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3597 return gimple_op_ptr (gs
, 0);
3601 /* Set INDEX to be the index variable for switch statement GS. */
3604 gimple_switch_set_index (gimple gs
, tree index
)
3606 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3607 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3608 gimple_set_op (gs
, 0, index
);
3612 /* Return the label numbered INDEX. The default label is 0, followed by any
3613 labels in a switch statement. */
3616 gimple_switch_label (const_gimple gs
, unsigned index
)
3618 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3619 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
3620 return gimple_op (gs
, index
+ 1);
3623 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3626 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3628 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3629 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
3630 && (label
== NULL_TREE
3631 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
3632 gimple_set_op (gs
, index
+ 1, label
);
3635 /* Return the default label for a switch statement. */
3638 gimple_switch_default_label (const_gimple gs
)
3640 return gimple_switch_label (gs
, 0);
3643 /* Set the default label for a switch statement. */
3646 gimple_switch_set_default_label (gimple gs
, tree label
)
3648 gimple_switch_set_label (gs
, 0, label
);
3651 /* Return true if GS is a GIMPLE_DEBUG statement. */
3654 is_gimple_debug (const_gimple gs
)
3656 return gimple_code (gs
) == GIMPLE_DEBUG
;
3659 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3662 gimple_debug_bind_p (const_gimple s
)
3664 if (is_gimple_debug (s
))
3665 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3670 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3673 gimple_debug_bind_get_var (gimple dbg
)
3675 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3676 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3677 return gimple_op (dbg
, 0);
3680 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3684 gimple_debug_bind_get_value (gimple dbg
)
3686 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3687 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3688 return gimple_op (dbg
, 1);
3691 /* Return a pointer to the value bound to the variable in a
3692 GIMPLE_DEBUG bind statement. */
3694 static inline tree
*
3695 gimple_debug_bind_get_value_ptr (gimple dbg
)
3697 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3698 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3699 return gimple_op_ptr (dbg
, 1);
3702 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3705 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3707 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3708 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3709 gimple_set_op (dbg
, 0, var
);
3712 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3716 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3718 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3719 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3720 gimple_set_op (dbg
, 1, value
);
3723 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3725 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3727 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3731 gimple_debug_bind_reset_value (gimple dbg
)
3733 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3734 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3735 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3738 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3742 gimple_debug_bind_has_value_p (gimple dbg
)
3744 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3745 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
3746 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3749 #undef GIMPLE_DEBUG_BIND_NOVALUE
3751 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3754 gimple_debug_source_bind_p (const_gimple s
)
3756 if (is_gimple_debug (s
))
3757 return s
->gsbase
.subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
3762 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3765 gimple_debug_source_bind_get_var (gimple dbg
)
3767 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3768 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3769 return gimple_op (dbg
, 0);
3772 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3776 gimple_debug_source_bind_get_value (gimple dbg
)
3778 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3779 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3780 return gimple_op (dbg
, 1);
3783 /* Return a pointer to the value bound to the variable in a
3784 GIMPLE_DEBUG source bind statement. */
3786 static inline tree
*
3787 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
3789 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3790 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3791 return gimple_op_ptr (dbg
, 1);
3794 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3797 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
3799 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3800 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3801 gimple_set_op (dbg
, 0, var
);
3804 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3808 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
3810 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3811 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
3812 gimple_set_op (dbg
, 1, value
);
3815 /* Return a pointer to the body for the OMP statement GS. */
3817 static inline gimple_seq
*
3818 gimple_omp_body_ptr (gimple gs
)
3820 return &gs
->omp
.body
;
3823 /* Return the body for the OMP statement GS. */
3825 static inline gimple_seq
3826 gimple_omp_body (gimple gs
)
3828 return *gimple_omp_body_ptr (gs
);
3831 /* Set BODY to be the body for the OMP statement GS. */
3834 gimple_omp_set_body (gimple gs
, gimple_seq body
)
3836 gs
->omp
.body
= body
;
3840 /* Return the name associated with OMP_CRITICAL statement GS. */
3843 gimple_omp_critical_name (const_gimple gs
)
3845 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3846 return gs
->gimple_omp_critical
.name
;
3850 /* Return a pointer to the name associated with OMP critical statement GS. */
3852 static inline tree
*
3853 gimple_omp_critical_name_ptr (gimple gs
)
3855 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3856 return &gs
->gimple_omp_critical
.name
;
3860 /* Set NAME to be the name associated with OMP critical statement GS. */
3863 gimple_omp_critical_set_name (gimple gs
, tree name
)
3865 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3866 gs
->gimple_omp_critical
.name
= name
;
3870 /* Return the clauses associated with OMP_FOR GS. */
3873 gimple_omp_for_clauses (const_gimple gs
)
3875 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3876 return gs
->gimple_omp_for
.clauses
;
3880 /* Return a pointer to the OMP_FOR GS. */
3882 static inline tree
*
3883 gimple_omp_for_clauses_ptr (gimple gs
)
3885 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3886 return &gs
->gimple_omp_for
.clauses
;
3890 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3893 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
3895 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3896 gs
->gimple_omp_for
.clauses
= clauses
;
3900 /* Get the collapse count of OMP_FOR GS. */
3902 static inline size_t
3903 gimple_omp_for_collapse (gimple gs
)
3905 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3906 return gs
->gimple_omp_for
.collapse
;
3910 /* Return the index variable for OMP_FOR GS. */
3913 gimple_omp_for_index (const_gimple gs
, size_t i
)
3915 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3916 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3917 return gs
->gimple_omp_for
.iter
[i
].index
;
3921 /* Return a pointer to the index variable for OMP_FOR GS. */
3923 static inline tree
*
3924 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
3926 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3927 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3928 return &gs
->gimple_omp_for
.iter
[i
].index
;
3932 /* Set INDEX to be the index variable for OMP_FOR GS. */
3935 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
3937 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3938 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3939 gs
->gimple_omp_for
.iter
[i
].index
= index
;
3943 /* Return the initial value for OMP_FOR GS. */
3946 gimple_omp_for_initial (const_gimple gs
, size_t i
)
3948 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3949 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3950 return gs
->gimple_omp_for
.iter
[i
].initial
;
3954 /* Return a pointer to the initial value for OMP_FOR GS. */
3956 static inline tree
*
3957 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
3959 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3960 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3961 return &gs
->gimple_omp_for
.iter
[i
].initial
;
3965 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3968 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
3970 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3971 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3972 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
3976 /* Return the final value for OMP_FOR GS. */
3979 gimple_omp_for_final (const_gimple gs
, size_t i
)
3981 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3982 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3983 return gs
->gimple_omp_for
.iter
[i
].final
;
3987 /* Return a pointer to the final value for OMP_FOR GS. */
3989 static inline tree
*
3990 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
3992 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3993 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
3994 return &gs
->gimple_omp_for
.iter
[i
].final
;
3998 /* Set FINAL to be the final value for OMP_FOR GS. */
4001 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4003 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4004 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4005 gs
->gimple_omp_for
.iter
[i
].final
= final
;
4009 /* Return the increment value for OMP_FOR GS. */
4012 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4014 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4015 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4016 return gs
->gimple_omp_for
.iter
[i
].incr
;
4020 /* Return a pointer to the increment value for OMP_FOR GS. */
4022 static inline tree
*
4023 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4025 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4026 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4027 return &gs
->gimple_omp_for
.iter
[i
].incr
;
4031 /* Set INCR to be the increment value for OMP_FOR GS. */
4034 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4036 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4037 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4038 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
4042 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4043 statement GS starts. */
4045 static inline gimple_seq
*
4046 gimple_omp_for_pre_body_ptr (gimple gs
)
4048 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4049 return &gs
->gimple_omp_for
.pre_body
;
4053 /* Return the sequence of statements to execute before the OMP_FOR
4054 statement GS starts. */
4056 static inline gimple_seq
4057 gimple_omp_for_pre_body (gimple gs
)
4059 return *gimple_omp_for_pre_body_ptr (gs
);
4063 /* Set PRE_BODY to be the sequence of statements to execute before the
4064 OMP_FOR statement GS starts. */
4067 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4069 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4070 gs
->gimple_omp_for
.pre_body
= pre_body
;
4074 /* Return the clauses associated with OMP_PARALLEL GS. */
4077 gimple_omp_parallel_clauses (const_gimple gs
)
4079 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4080 return gs
->gimple_omp_parallel
.clauses
;
4084 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4086 static inline tree
*
4087 gimple_omp_parallel_clauses_ptr (gimple gs
)
4089 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4090 return &gs
->gimple_omp_parallel
.clauses
;
4094 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4098 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4100 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4101 gs
->gimple_omp_parallel
.clauses
= clauses
;
4105 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4108 gimple_omp_parallel_child_fn (const_gimple gs
)
4110 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4111 return gs
->gimple_omp_parallel
.child_fn
;
4114 /* Return a pointer to the child function used to hold the body of
4117 static inline tree
*
4118 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4120 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4121 return &gs
->gimple_omp_parallel
.child_fn
;
4125 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4128 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4130 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4131 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4135 /* Return the artificial argument used to send variables and values
4136 from the parent to the children threads in OMP_PARALLEL GS. */
4139 gimple_omp_parallel_data_arg (const_gimple gs
)
4141 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4142 return gs
->gimple_omp_parallel
.data_arg
;
4146 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4148 static inline tree
*
4149 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4151 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4152 return &gs
->gimple_omp_parallel
.data_arg
;
4156 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4159 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4161 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
4162 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4166 /* Return the clauses associated with OMP_TASK GS. */
4169 gimple_omp_task_clauses (const_gimple gs
)
4171 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4172 return gs
->gimple_omp_parallel
.clauses
;
4176 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4178 static inline tree
*
4179 gimple_omp_task_clauses_ptr (gimple gs
)
4181 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4182 return &gs
->gimple_omp_parallel
.clauses
;
4186 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4190 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4192 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4193 gs
->gimple_omp_parallel
.clauses
= clauses
;
4197 /* Return the child function used to hold the body of OMP_TASK GS. */
4200 gimple_omp_task_child_fn (const_gimple gs
)
4202 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4203 return gs
->gimple_omp_parallel
.child_fn
;
4206 /* Return a pointer to the child function used to hold the body of
4209 static inline tree
*
4210 gimple_omp_task_child_fn_ptr (gimple gs
)
4212 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4213 return &gs
->gimple_omp_parallel
.child_fn
;
4217 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4220 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4222 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4223 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4227 /* Return the artificial argument used to send variables and values
4228 from the parent to the children threads in OMP_TASK GS. */
4231 gimple_omp_task_data_arg (const_gimple gs
)
4233 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4234 return gs
->gimple_omp_parallel
.data_arg
;
4238 /* Return a pointer to the data argument for OMP_TASK GS. */
4240 static inline tree
*
4241 gimple_omp_task_data_arg_ptr (gimple gs
)
4243 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4244 return &gs
->gimple_omp_parallel
.data_arg
;
4248 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4251 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4253 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4254 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4258 /* Return the clauses associated with OMP_TASK GS. */
4261 gimple_omp_taskreg_clauses (const_gimple gs
)
4263 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4264 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4265 return gs
->gimple_omp_parallel
.clauses
;
4269 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4271 static inline tree
*
4272 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4274 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4275 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4276 return &gs
->gimple_omp_parallel
.clauses
;
4280 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4284 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4286 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4287 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4288 gs
->gimple_omp_parallel
.clauses
= clauses
;
4292 /* Return the child function used to hold the body of OMP_TASK GS. */
4295 gimple_omp_taskreg_child_fn (const_gimple gs
)
4297 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4298 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4299 return gs
->gimple_omp_parallel
.child_fn
;
4302 /* Return a pointer to the child function used to hold the body of
4305 static inline tree
*
4306 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4308 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4309 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4310 return &gs
->gimple_omp_parallel
.child_fn
;
4314 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4317 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4319 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4320 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4321 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
4325 /* Return the artificial argument used to send variables and values
4326 from the parent to the children threads in OMP_TASK GS. */
4329 gimple_omp_taskreg_data_arg (const_gimple gs
)
4331 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4332 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4333 return gs
->gimple_omp_parallel
.data_arg
;
4337 /* Return a pointer to the data argument for OMP_TASK GS. */
4339 static inline tree
*
4340 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4342 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4343 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4344 return &gs
->gimple_omp_parallel
.data_arg
;
4348 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4351 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4353 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
4354 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4355 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
4359 /* Return the copy function used to hold the body of OMP_TASK GS. */
4362 gimple_omp_task_copy_fn (const_gimple gs
)
4364 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4365 return gs
->gimple_omp_task
.copy_fn
;
4368 /* Return a pointer to the copy function used to hold the body of
4371 static inline tree
*
4372 gimple_omp_task_copy_fn_ptr (gimple gs
)
4374 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4375 return &gs
->gimple_omp_task
.copy_fn
;
4379 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4382 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4384 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4385 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
4389 /* Return size of the data block in bytes in OMP_TASK GS. */
4392 gimple_omp_task_arg_size (const_gimple gs
)
4394 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4395 return gs
->gimple_omp_task
.arg_size
;
4399 /* Return a pointer to the data block size for OMP_TASK GS. */
4401 static inline tree
*
4402 gimple_omp_task_arg_size_ptr (gimple gs
)
4404 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4405 return &gs
->gimple_omp_task
.arg_size
;
4409 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4412 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4414 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4415 gs
->gimple_omp_task
.arg_size
= arg_size
;
4419 /* Return align of the data block in bytes in OMP_TASK GS. */
4422 gimple_omp_task_arg_align (const_gimple gs
)
4424 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4425 return gs
->gimple_omp_task
.arg_align
;
4429 /* Return a pointer to the data block align for OMP_TASK GS. */
4431 static inline tree
*
4432 gimple_omp_task_arg_align_ptr (gimple gs
)
4434 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4435 return &gs
->gimple_omp_task
.arg_align
;
4439 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4442 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
4444 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
4445 gs
->gimple_omp_task
.arg_align
= arg_align
;
4449 /* Return the clauses associated with OMP_SINGLE GS. */
4452 gimple_omp_single_clauses (const_gimple gs
)
4454 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4455 return gs
->gimple_omp_single
.clauses
;
4459 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4461 static inline tree
*
4462 gimple_omp_single_clauses_ptr (gimple gs
)
4464 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4465 return &gs
->gimple_omp_single
.clauses
;
4469 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4472 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
4474 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4475 gs
->gimple_omp_single
.clauses
= clauses
;
4479 /* Return the clauses associated with OMP_SECTIONS GS. */
4482 gimple_omp_sections_clauses (const_gimple gs
)
4484 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4485 return gs
->gimple_omp_sections
.clauses
;
4489 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4491 static inline tree
*
4492 gimple_omp_sections_clauses_ptr (gimple gs
)
4494 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4495 return &gs
->gimple_omp_sections
.clauses
;
4499 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4503 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4505 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4506 gs
->gimple_omp_sections
.clauses
= clauses
;
4510 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4514 gimple_omp_sections_control (const_gimple gs
)
4516 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4517 return gs
->gimple_omp_sections
.control
;
4521 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4524 static inline tree
*
4525 gimple_omp_sections_control_ptr (gimple gs
)
4527 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4528 return &gs
->gimple_omp_sections
.control
;
4532 /* Set CONTROL to be the set of clauses associated with the
4533 GIMPLE_OMP_SECTIONS in GS. */
4536 gimple_omp_sections_set_control (gimple gs
, tree control
)
4538 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4539 gs
->gimple_omp_sections
.control
= control
;
4543 /* Set COND to be the condition code for OMP_FOR GS. */
4546 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4548 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4549 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4550 && i
< gs
->gimple_omp_for
.collapse
);
4551 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4555 /* Return the condition code associated with OMP_FOR GS. */
4557 static inline enum tree_code
4558 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4560 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4561 gcc_gimple_checking_assert (i
< gs
->gimple_omp_for
.collapse
);
4562 return gs
->gimple_omp_for
.iter
[i
].cond
;
4566 /* Set the value being stored in an atomic store. */
4569 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4571 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4572 g
->gimple_omp_atomic_store
.val
= val
;
4576 /* Return the value being stored in an atomic store. */
4579 gimple_omp_atomic_store_val (const_gimple g
)
4581 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4582 return g
->gimple_omp_atomic_store
.val
;
4586 /* Return a pointer to the value being stored in an atomic store. */
4588 static inline tree
*
4589 gimple_omp_atomic_store_val_ptr (gimple g
)
4591 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4592 return &g
->gimple_omp_atomic_store
.val
;
4596 /* Set the LHS of an atomic load. */
4599 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
4601 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4602 g
->gimple_omp_atomic_load
.lhs
= lhs
;
4606 /* Get the LHS of an atomic load. */
4609 gimple_omp_atomic_load_lhs (const_gimple g
)
4611 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4612 return g
->gimple_omp_atomic_load
.lhs
;
4616 /* Return a pointer to the LHS of an atomic load. */
4618 static inline tree
*
4619 gimple_omp_atomic_load_lhs_ptr (gimple g
)
4621 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4622 return &g
->gimple_omp_atomic_load
.lhs
;
4626 /* Set the RHS of an atomic load. */
4629 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
4631 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4632 g
->gimple_omp_atomic_load
.rhs
= rhs
;
4636 /* Get the RHS of an atomic load. */
4639 gimple_omp_atomic_load_rhs (const_gimple g
)
4641 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4642 return g
->gimple_omp_atomic_load
.rhs
;
4646 /* Return a pointer to the RHS of an atomic load. */
4648 static inline tree
*
4649 gimple_omp_atomic_load_rhs_ptr (gimple g
)
4651 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4652 return &g
->gimple_omp_atomic_load
.rhs
;
4656 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4659 gimple_omp_continue_control_def (const_gimple g
)
4661 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4662 return g
->gimple_omp_continue
.control_def
;
4665 /* The same as above, but return the address. */
4667 static inline tree
*
4668 gimple_omp_continue_control_def_ptr (gimple g
)
4670 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4671 return &g
->gimple_omp_continue
.control_def
;
4674 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4677 gimple_omp_continue_set_control_def (gimple g
, tree def
)
4679 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4680 g
->gimple_omp_continue
.control_def
= def
;
4684 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4687 gimple_omp_continue_control_use (const_gimple g
)
4689 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4690 return g
->gimple_omp_continue
.control_use
;
4694 /* The same as above, but return the address. */
4696 static inline tree
*
4697 gimple_omp_continue_control_use_ptr (gimple g
)
4699 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4700 return &g
->gimple_omp_continue
.control_use
;
4704 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4707 gimple_omp_continue_set_control_use (gimple g
, tree use
)
4709 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4710 g
->gimple_omp_continue
.control_use
= use
;
4713 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
4715 static inline gimple_seq
*
4716 gimple_transaction_body_ptr (gimple gs
)
4718 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4719 return &gs
->gimple_transaction
.body
;
4722 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4724 static inline gimple_seq
4725 gimple_transaction_body (gimple gs
)
4727 return *gimple_transaction_body_ptr (gs
);
4730 /* Return the label associated with a GIMPLE_TRANSACTION. */
4733 gimple_transaction_label (const_gimple gs
)
4735 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4736 return gs
->gimple_transaction
.label
;
4739 static inline tree
*
4740 gimple_transaction_label_ptr (gimple gs
)
4742 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4743 return &gs
->gimple_transaction
.label
;
4746 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4748 static inline unsigned int
4749 gimple_transaction_subcode (const_gimple gs
)
4751 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4752 return gs
->gsbase
.subcode
;
4755 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4758 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
4760 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4761 gs
->gimple_transaction
.body
= body
;
4764 /* Set the label associated with a GIMPLE_TRANSACTION. */
4767 gimple_transaction_set_label (gimple gs
, tree label
)
4769 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4770 gs
->gimple_transaction
.label
= label
;
4773 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4776 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
4778 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
4779 gs
->gsbase
.subcode
= subcode
;
4783 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4785 static inline tree
*
4786 gimple_return_retval_ptr (const_gimple gs
)
4788 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4789 return gimple_op_ptr (gs
, 0);
4792 /* Return the return value for GIMPLE_RETURN GS. */
4795 gimple_return_retval (const_gimple gs
)
4797 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4798 return gimple_op (gs
, 0);
4802 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4805 gimple_return_set_retval (gimple gs
, tree retval
)
4807 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4808 gimple_set_op (gs
, 0, retval
);
4812 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
4814 #define CASE_GIMPLE_OMP \
4815 case GIMPLE_OMP_PARALLEL: \
4816 case GIMPLE_OMP_TASK: \
4817 case GIMPLE_OMP_FOR: \
4818 case GIMPLE_OMP_SECTIONS: \
4819 case GIMPLE_OMP_SECTIONS_SWITCH: \
4820 case GIMPLE_OMP_SINGLE: \
4821 case GIMPLE_OMP_SECTION: \
4822 case GIMPLE_OMP_MASTER: \
4823 case GIMPLE_OMP_ORDERED: \
4824 case GIMPLE_OMP_CRITICAL: \
4825 case GIMPLE_OMP_RETURN: \
4826 case GIMPLE_OMP_ATOMIC_LOAD: \
4827 case GIMPLE_OMP_ATOMIC_STORE: \
4828 case GIMPLE_OMP_CONTINUE
4831 is_gimple_omp (const_gimple stmt
)
4833 switch (gimple_code (stmt
))
4843 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4846 gimple_nop_p (const_gimple g
)
4848 return gimple_code (g
) == GIMPLE_NOP
;
4852 /* Return true if GS is a GIMPLE_RESX. */
4855 is_gimple_resx (const_gimple gs
)
4857 return gimple_code (gs
) == GIMPLE_RESX
;
4860 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4862 static inline enum br_predictor
4863 gimple_predict_predictor (gimple gs
)
4865 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4866 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
4870 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4873 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
4875 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4876 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
4877 | (unsigned) predictor
;
4881 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4883 static inline enum prediction
4884 gimple_predict_outcome (gimple gs
)
4886 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4887 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
4891 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4894 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
4896 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4897 if (outcome
== TAKEN
)
4898 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
4900 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
4904 /* Return the type of the main expression computed by STMT. Return
4905 void_type_node if the statement computes nothing. */
4908 gimple_expr_type (const_gimple stmt
)
4910 enum gimple_code code
= gimple_code (stmt
);
4912 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
4915 /* In general we want to pass out a type that can be substituted
4916 for both the RHS and the LHS types if there is a possibly
4917 useless conversion involved. That means returning the
4918 original RHS type as far as we can reconstruct it. */
4919 if (code
== GIMPLE_CALL
)
4920 type
= gimple_call_return_type (stmt
);
4922 switch (gimple_assign_rhs_code (stmt
))
4924 case POINTER_PLUS_EXPR
:
4925 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
4929 /* As fallback use the type of the LHS. */
4930 type
= TREE_TYPE (gimple_get_lhs (stmt
));
4935 else if (code
== GIMPLE_COND
)
4936 return boolean_type_node
;
4938 return void_type_node
;
4941 /* Return true if TYPE is a suitable type for a scalar register variable. */
4944 is_gimple_reg_type (tree type
)
4946 return !AGGREGATE_TYPE_P (type
);
4949 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4951 static inline gimple_stmt_iterator
4952 gsi_start_1 (gimple_seq
*seq
)
4954 gimple_stmt_iterator i
;
4956 i
.ptr
= gimple_seq_first (*seq
);
4958 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
4963 #define gsi_start(x) gsi_start_1(&(x))
4965 static inline gimple_stmt_iterator
4968 gimple_stmt_iterator i
;
4975 /* Return a new iterator pointing to the first statement in basic block BB. */
4977 static inline gimple_stmt_iterator
4978 gsi_start_bb (basic_block bb
)
4980 gimple_stmt_iterator i
;
4983 seq
= bb_seq_addr (bb
);
4984 i
.ptr
= gimple_seq_first (*seq
);
4992 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4994 static inline gimple_stmt_iterator
4995 gsi_last_1 (gimple_seq
*seq
)
4997 gimple_stmt_iterator i
;
4999 i
.ptr
= gimple_seq_last (*seq
);
5001 i
.bb
= i
.ptr
? gimple_bb (i
.ptr
) : NULL
;
5006 #define gsi_last(x) gsi_last_1(&(x))
5008 /* Return a new iterator pointing to the last statement in basic block BB. */
5010 static inline gimple_stmt_iterator
5011 gsi_last_bb (basic_block bb
)
5013 gimple_stmt_iterator i
;
5016 seq
= bb_seq_addr (bb
);
5017 i
.ptr
= gimple_seq_last (*seq
);
5025 /* Return true if I is at the end of its sequence. */
5028 gsi_end_p (gimple_stmt_iterator i
)
5030 return i
.ptr
== NULL
;
5034 /* Return true if I is one statement before the end of its sequence. */
5037 gsi_one_before_end_p (gimple_stmt_iterator i
)
5039 return i
.ptr
!= NULL
&& i
.ptr
->gsbase
.next
== NULL
;
5043 /* Advance the iterator to the next gimple statement. */
5046 gsi_next (gimple_stmt_iterator
*i
)
5048 i
->ptr
= i
->ptr
->gsbase
.next
;
5051 /* Advance the iterator to the previous gimple statement. */
5054 gsi_prev (gimple_stmt_iterator
*i
)
5056 gimple prev
= i
->ptr
->gsbase
.prev
;
5057 if (prev
->gsbase
.next
)
5063 /* Return the current stmt. */
5065 static inline gimple
5066 gsi_stmt (gimple_stmt_iterator i
)
5071 /* Return a block statement iterator that points to the first non-label
5072 statement in block BB. */
5074 static inline gimple_stmt_iterator
5075 gsi_after_labels (basic_block bb
)
5077 gimple_stmt_iterator gsi
= gsi_start_bb (bb
);
5079 while (!gsi_end_p (gsi
) && gimple_code (gsi_stmt (gsi
)) == GIMPLE_LABEL
)
5085 /* Advance the iterator to the next non-debug gimple statement. */
5088 gsi_next_nondebug (gimple_stmt_iterator
*i
)
5094 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5097 /* Advance the iterator to the next non-debug gimple statement. */
5100 gsi_prev_nondebug (gimple_stmt_iterator
*i
)
5106 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
5109 /* Return a new iterator pointing to the first non-debug statement in
5112 static inline gimple_stmt_iterator
5113 gsi_start_nondebug_bb (basic_block bb
)
5115 gimple_stmt_iterator i
= gsi_start_bb (bb
);
5117 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5118 gsi_next_nondebug (&i
);
5123 /* Return a new iterator pointing to the last non-debug statement in
5126 static inline gimple_stmt_iterator
5127 gsi_last_nondebug_bb (basic_block bb
)
5129 gimple_stmt_iterator i
= gsi_last_bb (bb
);
5131 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
5132 gsi_prev_nondebug (&i
);
5138 /* Return the basic block associated with this iterator. */
5140 static inline basic_block
5141 gsi_bb (gimple_stmt_iterator i
)
5147 /* Return the sequence associated with this iterator. */
5149 static inline gimple_seq
5150 gsi_seq (gimple_stmt_iterator i
)
5156 enum gsi_iterator_update
5158 GSI_NEW_STMT
, /* Only valid when single statement is added, move
5160 GSI_SAME_STMT
, /* Leave the iterator at the same statement. */
5161 GSI_CONTINUE_LINKING
/* Move iterator to whatever position is suitable
5162 for linking other statements in the same
5166 /* In gimple-iterator.c */
5167 gimple_stmt_iterator
gsi_start_phis (basic_block
);
5168 gimple_seq
gsi_split_seq_after (gimple_stmt_iterator
);
5169 void gsi_split_seq_before (gimple_stmt_iterator
*, gimple_seq
*);
5170 void gsi_set_stmt (gimple_stmt_iterator
*, gimple
);
5171 void gsi_replace (gimple_stmt_iterator
*, gimple
, bool);
5172 void gsi_replace_with_seq (gimple_stmt_iterator
*, gimple_seq
, bool);
5173 void gsi_insert_before (gimple_stmt_iterator
*, gimple
,
5174 enum gsi_iterator_update
);
5175 void gsi_insert_before_without_update (gimple_stmt_iterator
*, gimple
,
5176 enum gsi_iterator_update
);
5177 void gsi_insert_seq_before (gimple_stmt_iterator
*, gimple_seq
,
5178 enum gsi_iterator_update
);
5179 void gsi_insert_seq_before_without_update (gimple_stmt_iterator
*, gimple_seq
,
5180 enum gsi_iterator_update
);
5181 void gsi_insert_after (gimple_stmt_iterator
*, gimple
,
5182 enum gsi_iterator_update
);
5183 void gsi_insert_after_without_update (gimple_stmt_iterator
*, gimple
,
5184 enum gsi_iterator_update
);
5185 void gsi_insert_seq_after (gimple_stmt_iterator
*, gimple_seq
,
5186 enum gsi_iterator_update
);
5187 void gsi_insert_seq_after_without_update (gimple_stmt_iterator
*, gimple_seq
,
5188 enum gsi_iterator_update
);
5189 bool gsi_remove (gimple_stmt_iterator
*, bool);
5190 gimple_stmt_iterator
gsi_for_stmt (gimple
);
5191 void gsi_move_after (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5192 void gsi_move_before (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
5193 void gsi_move_to_bb_end (gimple_stmt_iterator
*, struct basic_block_def
*);
5194 void gsi_insert_on_edge (edge
, gimple
);
5195 void gsi_insert_seq_on_edge (edge
, gimple_seq
);
5196 basic_block
gsi_insert_on_edge_immediate (edge
, gimple
);
5197 basic_block
gsi_insert_seq_on_edge_immediate (edge
, gimple_seq
);
5198 void gsi_commit_one_edge_insert (edge
, basic_block
*);
5199 void gsi_commit_edge_inserts (void);
5200 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
5203 /* Convenience routines to walk all statements of a gimple function.
5204 Note that this is useful exclusively before the code is converted
5205 into SSA form. Once the program is in SSA form, the standard
5206 operand interface should be used to analyze/modify statements. */
5207 struct walk_stmt_info
5209 /* Points to the current statement being walked. */
5210 gimple_stmt_iterator gsi
;
5212 /* Additional data that the callback functions may want to carry
5213 through the recursion. */
5216 /* Pointer map used to mark visited tree nodes when calling
5217 walk_tree on each operand. If set to NULL, duplicate tree nodes
5218 will be visited more than once. */
5219 struct pointer_set_t
*pset
;
5221 /* Operand returned by the callbacks. This is set when calling
5222 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5223 returns non-NULL, this field will contain the tree returned by
5224 the last callback. */
5225 tree callback_result
;
5227 /* Indicates whether the operand being examined may be replaced
5228 with something that matches is_gimple_val (if true) or something
5229 slightly more complicated (if false). "Something" technically
5230 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5231 but we never try to form anything more complicated than that, so
5232 we don't bother checking.
5234 Also note that CALLBACK should update this flag while walking the
5235 sub-expressions of a statement. For instance, when walking the
5236 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5237 to true, however, when walking &var, the operand of that
5238 ADDR_EXPR does not need to be a GIMPLE value. */
5239 BOOL_BITFIELD val_only
: 1;
5241 /* True if we are currently walking the LHS of an assignment. */
5242 BOOL_BITFIELD is_lhs
: 1;
5244 /* Optional. Set to true by the callback functions if they made any
5246 BOOL_BITFIELD changed
: 1;
5248 /* True if we're interested in location information. */
5249 BOOL_BITFIELD want_locations
: 1;
5251 /* True if we've removed the statement that was processed. */
5252 BOOL_BITFIELD removed_stmt
: 1;
5255 /* Callback for walk_gimple_stmt. Called for every statement found
5256 during traversal. The first argument points to the statement to
5257 walk. The second argument is a flag that the callback sets to
5258 'true' if it the callback handled all the operands and
5259 sub-statements of the statement (the default value of this flag is
5260 'false'). The third argument is an anonymous pointer to data
5261 to be used by the callback. */
5262 typedef tree (*walk_stmt_fn
) (gimple_stmt_iterator
*, bool *,
5263 struct walk_stmt_info
*);
5265 gimple
walk_gimple_seq (gimple_seq
, walk_stmt_fn
, walk_tree_fn
,
5266 struct walk_stmt_info
*);
5267 gimple
walk_gimple_seq_mod (gimple_seq
*, walk_stmt_fn
, walk_tree_fn
,
5268 struct walk_stmt_info
*);
5269 tree
walk_gimple_stmt (gimple_stmt_iterator
*, walk_stmt_fn
, walk_tree_fn
,
5270 struct walk_stmt_info
*);
5271 tree
walk_gimple_op (gimple
, walk_tree_fn
, struct walk_stmt_info
*);
5273 #ifdef GATHER_STATISTICS
5274 /* Enum and arrays used for allocation stats. Keep in sync with
5275 gimple.c:gimple_alloc_kind_names. */
5276 enum gimple_alloc_kind
5278 gimple_alloc_kind_assign
, /* Assignments. */
5279 gimple_alloc_kind_phi
, /* PHI nodes. */
5280 gimple_alloc_kind_cond
, /* Conditionals. */
5281 gimple_alloc_kind_rest
, /* Everything else. */
5282 gimple_alloc_kind_all
5285 extern int gimple_alloc_counts
[];
5286 extern int gimple_alloc_sizes
[];
5288 /* Return the allocation kind for a given stmt CODE. */
5289 static inline enum gimple_alloc_kind
5290 gimple_alloc_kind (enum gimple_code code
)
5295 return gimple_alloc_kind_assign
;
5297 return gimple_alloc_kind_phi
;
5299 return gimple_alloc_kind_cond
;
5301 return gimple_alloc_kind_rest
;
5304 #endif /* GATHER_STATISTICS */
5306 extern void dump_gimple_statistics (void);
5308 /* In gimple-fold.c. */
5309 void gimplify_and_update_call_from_tree (gimple_stmt_iterator
*, tree
);
5310 tree
gimple_fold_builtin (gimple
);
5311 bool fold_stmt (gimple_stmt_iterator
*);
5312 bool fold_stmt_inplace (gimple_stmt_iterator
*);
5313 tree
get_symbol_constant_value (tree
);
5314 tree
canonicalize_constructor_val (tree
, tree
);
5315 extern tree
maybe_fold_and_comparisons (enum tree_code
, tree
, tree
,
5316 enum tree_code
, tree
, tree
);
5317 extern tree
maybe_fold_or_comparisons (enum tree_code
, tree
, tree
,
5318 enum tree_code
, tree
, tree
);
5320 bool gimple_val_nonnegative_real_p (tree
);
5321 #endif /* GCC_GIMPLE_H */