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 struct gimple_seq_node_d;
36 typedef struct gimple_seq_node_d *gimple_seq_node;
37 typedef const struct gimple_seq_node_d *const_gimple_seq_node;
39 /* For each block, the PHI nodes that need to be rewritten are stored into
41 typedef VEC(gimple, heap) *gimple_vec;
42 DEF_VEC_P (gimple_vec);
43 DEF_VEC_ALLOC_P (gimple_vec, heap);
46 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
49 LAST_AND_UNUSED_GIMPLE_CODE
52 extern const char *const gimple_code_name[];
53 extern const unsigned char gimple_rhs_class_table[];
55 /* Error out if a gimple tuple is addressed incorrectly. */
56 #if defined ENABLE_GIMPLE_CHECKING
57 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
58 extern void gimple_check_failed (const_gimple, const char *, int, \
59 const char *, enum gimple_code, \
60 enum tree_code) ATTRIBUTE_NORETURN;
62 #define GIMPLE_CHECK(GS, CODE) \
64 const_gimple __gs = (GS); \
65 if (gimple_code (__gs) != (CODE)) \
66 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
67 (CODE), ERROR_MARK); \
69 #else /* not ENABLE_GIMPLE_CHECKING */
70 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
71 #define GIMPLE_CHECK(GS, CODE) (void)0
74 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
75 get_gimple_rhs_class. */
78 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
79 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
80 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
81 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
82 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
83 name, a _DECL, a _REF, etc. */
86 /* Specific flags for individual GIMPLE statements. These flags are
87 always stored in gimple_statement_base.subcode and they may only be
88 defined for statement codes that do not use sub-codes.
90 Values for the masks can overlap as long as the overlapping values
91 are never used in the same statement class.
93 The maximum mask value that can be defined is 1 << 15 (i.e., each
94 statement code can hold up to 16 bitflags).
96 Keep this list sorted. */
98 GF_ASM_INPUT = 1 << 0,
99 GF_ASM_VOLATILE = 1 << 1,
100 GF_CALL_FROM_THUNK = 1 << 0,
101 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
102 GF_CALL_TAILCALL = 1 << 2,
103 GF_CALL_VA_ARG_PACK = 1 << 3,
104 GF_CALL_NOTHROW = 1 << 4,
105 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
106 GF_CALL_INTERNAL = 1 << 6,
107 GF_OMP_PARALLEL_COMBINED = 1 << 0,
109 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
110 a thread synchronization via some sort of barrier. The exact barrier
111 that would otherwise be emitted is dependent on the OMP statement with
112 which this return is associated. */
113 GF_OMP_RETURN_NOWAIT = 1 << 0,
115 GF_OMP_SECTION_LAST = 1 << 0,
116 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
117 GF_PREDICT_TAKEN = 1 << 15
120 /* Currently, there are only two types of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124 enum gimple_debug_subcode {
125 GIMPLE_DEBUG_BIND = 0,
126 GIMPLE_DEBUG_SOURCE_BIND = 1
129 /* Masks for selecting a pass local flag (PLF) to work on. These
130 masks are used by gimple_set_plf and gimple_plf. */
136 /* A node in a gimple_seq_d. */
137 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d {
139 struct gimple_seq_node_d *prev;
140 struct gimple_seq_node_d *next;
143 /* A double-linked sequence of gimple statements. */
144 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d {
145 /* First and last statements in the sequence. */
146 gimple_seq_node first;
147 gimple_seq_node last;
149 /* Sequences are created/destroyed frequently. To minimize
150 allocation activity, deallocated sequences are kept in a pool of
151 available sequences. This is the pointer to the next free
152 sequence in the pool. */
153 gimple_seq next_free;
157 /* Return the first node in GIMPLE sequence S. */
159 static inline gimple_seq_node
160 gimple_seq_first (const_gimple_seq s)
162 return s ? s->first : NULL;
166 /* Return the first statement in GIMPLE sequence S. */
169 gimple_seq_first_stmt (const_gimple_seq s)
171 gimple_seq_node n = gimple_seq_first (s);
172 return (n) ? n->stmt : NULL;
176 /* Return the last node in GIMPLE sequence S. */
178 static inline gimple_seq_node
179 gimple_seq_last (const_gimple_seq s)
181 return s ? s->last : NULL;
185 /* Return the last statement in GIMPLE sequence S. */
188 gimple_seq_last_stmt (const_gimple_seq s)
190 gimple_seq_node n = gimple_seq_last (s);
191 return (n) ? n->stmt : NULL;
195 /* Set the last node in GIMPLE sequence S to LAST. */
198 gimple_seq_set_last (gimple_seq s, gimple_seq_node last)
204 /* Set the first node in GIMPLE sequence S to FIRST. */
207 gimple_seq_set_first (gimple_seq s, gimple_seq_node first)
213 /* Return true if GIMPLE sequence S is empty. */
216 gimple_seq_empty_p (const_gimple_seq s)
218 return s == NULL || s->first == NULL;
222 void gimple_seq_add_stmt (gimple_seq *, gimple);
224 /* Link gimple statement GS to the end of the sequence *SEQ_P. If
225 *SEQ_P is NULL, a new sequence is allocated. This function is
226 similar to gimple_seq_add_stmt, but does not scan the operands.
227 During gimplification, we need to manipulate statement sequences
228 before the def/use vectors have been constructed. */
229 void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
231 /* Allocate a new sequence and initialize its first element with STMT. */
233 static inline gimple_seq
234 gimple_seq_alloc_with_stmt (gimple stmt)
236 gimple_seq seq = NULL;
237 gimple_seq_add_stmt (&seq, stmt);
242 /* Returns the sequence of statements in BB. */
244 static inline gimple_seq
245 bb_seq (const_basic_block bb)
247 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
251 /* Sets the sequence of statements in BB to SEQ. */
254 set_bb_seq (basic_block bb, gimple_seq seq)
256 gcc_checking_assert (!(bb->flags & BB_RTL));
257 bb->il.gimple->seq = seq;
260 /* Iterator object for GIMPLE statement sequences. */
264 /* Sequence node holding the current statement. */
267 /* Sequence and basic block holding the statement. These fields
268 are necessary to handle edge cases such as when statement is
269 added to an empty basic block or when the last statement of a
270 block/sequence is removed. */
273 } gimple_stmt_iterator;
276 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
277 are for 64 bit hosts. */
279 struct GTY(()) gimple_statement_base {
281 Main identifying code for a tuple. */
282 ENUM_BITFIELD(gimple_code) code : 8;
284 /* Nonzero if a warning should not be emitted on this tuple. */
285 unsigned int no_warning : 1;
287 /* Nonzero if this tuple has been visited. Passes are responsible
288 for clearing this bit before using it. */
289 unsigned int visited : 1;
291 /* Nonzero if this tuple represents a non-temporal move. */
292 unsigned int nontemporal_move : 1;
294 /* Pass local flags. These flags are free for any pass to use as
295 they see fit. Passes should not assume that these flags contain
296 any useful value when the pass starts. Any initial state that
297 the pass requires should be set on entry to the pass. See
298 gimple_set_plf and gimple_plf for usage. */
299 unsigned int plf : 2;
301 /* Nonzero if this statement has been modified and needs to have its
302 operands rescanned. */
303 unsigned modified : 1;
305 /* Nonzero if this statement contains volatile operands. */
306 unsigned has_volatile_ops : 1;
308 /* The SUBCODE field can be used for tuple-specific flags for tuples
309 that do not require subcodes. Note that SUBCODE should be at
310 least as wide as tree codes, as several tuples store tree codes
312 unsigned int subcode : 16;
314 /* UID of this statement. This is used by passes that want to
315 assign IDs to statements. It must be assigned and used by each
316 pass. By default it should be assumed to contain garbage. */
320 Locus information for debug info. */
323 /* Number of operands in this tuple. */
327 Basic block holding this statement. */
328 struct basic_block_def *bb;
331 Lexical block holding this statement. */
336 /* Base structure for tuples with operands. */
338 struct GTY(()) gimple_statement_with_ops_base
341 struct gimple_statement_base gsbase;
344 SSA operand vectors. NOTE: It should be possible to
345 amalgamate these vectors with the operand vector OP. However,
346 the SSA operand vectors are organized differently and contain
347 more information (like immediate use chaining). */
348 struct def_optype_d GTY((skip (""))) *def_ops;
349 struct use_optype_d GTY((skip (""))) *use_ops;
353 /* Statements that take register operands. */
355 struct GTY(()) gimple_statement_with_ops
358 struct gimple_statement_with_ops_base opbase;
361 Operand vector. NOTE! This must always be the last field
362 of this structure. In particular, this means that this
363 structure cannot be embedded inside another one. */
364 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
368 /* Base for statements that take both memory and register operands. */
370 struct GTY(()) gimple_statement_with_memory_ops_base
373 struct gimple_statement_with_ops_base opbase;
376 Virtual operands for this statement. The GC will pick them
377 up via the ssa_names array. */
378 tree GTY((skip (""))) vdef;
379 tree GTY((skip (""))) vuse;
383 /* Statements that take both memory and register operands. */
385 struct GTY(()) gimple_statement_with_memory_ops
388 struct gimple_statement_with_memory_ops_base membase;
391 Operand vector. NOTE! This must always be the last field
392 of this structure. In particular, this means that this
393 structure cannot be embedded inside another one. */
394 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
398 /* Call statements that take both memory and register operands. */
400 struct GTY(()) gimple_statement_call
403 struct gimple_statement_with_memory_ops_base membase;
406 struct pt_solution call_used;
407 struct pt_solution call_clobbered;
410 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
411 tree GTY ((tag ("0"))) fntype;
412 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
416 Operand vector. NOTE! This must always be the last field
417 of this structure. In particular, this means that this
418 structure cannot be embedded inside another one. */
419 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
423 /* OpenMP statements (#pragma omp). */
425 struct GTY(()) gimple_statement_omp {
427 struct gimple_statement_base gsbase;
436 struct GTY(()) gimple_statement_bind {
438 struct gimple_statement_base gsbase;
441 Variables declared in this scope. */
445 This is different than the BLOCK field in gimple_statement_base,
446 which is analogous to TREE_BLOCK (i.e., the lexical block holding
447 this statement). This field is the equivalent of BIND_EXPR_BLOCK
448 in tree land (i.e., the lexical scope defined by this bind). See
459 struct GTY(()) gimple_statement_catch {
461 struct gimple_statement_base gsbase;
471 /* GIMPLE_EH_FILTER */
473 struct GTY(()) gimple_statement_eh_filter {
475 struct gimple_statement_base gsbase;
488 struct GTY(()) gimple_statement_eh_else {
490 struct gimple_statement_base gsbase;
493 gimple_seq n_body, e_body;
496 /* GIMPLE_EH_MUST_NOT_THROW */
498 struct GTY(()) gimple_statement_eh_mnt {
500 struct gimple_statement_base gsbase;
502 /* [ WORD 5 ] Abort function decl. */
508 struct GTY(()) gimple_statement_phi {
510 struct gimple_statement_base gsbase;
520 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
524 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
526 struct GTY(()) gimple_statement_eh_ctrl
529 struct gimple_statement_base gsbase;
532 Exception region number. */
539 struct GTY(()) gimple_statement_try {
541 struct gimple_statement_base gsbase;
544 Expression to evaluate. */
548 Cleanup expression. */
552 /* Kind of GIMPLE_TRY statements. */
553 enum gimple_try_flags
556 GIMPLE_TRY_CATCH = 1 << 0,
559 GIMPLE_TRY_FINALLY = 1 << 1,
560 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
562 /* Analogous to TRY_CATCH_IS_CLEANUP. */
563 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
566 /* GIMPLE_WITH_CLEANUP_EXPR */
568 struct GTY(()) gimple_statement_wce {
570 struct gimple_statement_base gsbase;
572 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
573 executed if an exception is thrown, not on normal exit of its
574 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
578 Cleanup expression. */
585 struct GTY(()) gimple_statement_asm
588 struct gimple_statement_with_memory_ops_base membase;
591 __asm__ statement. */
595 Number of inputs, outputs, clobbers, labels. */
602 Operand vector. NOTE! This must always be the last field
603 of this structure. In particular, this means that this
604 structure cannot be embedded inside another one. */
605 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
608 /* GIMPLE_OMP_CRITICAL */
610 struct GTY(()) gimple_statement_omp_critical {
612 struct gimple_statement_omp omp;
615 Critical section name. */
620 struct GTY(()) gimple_omp_for_iter {
621 /* Condition code. */
624 /* Index variable. */
639 struct GTY(()) gimple_statement_omp_for {
641 struct gimple_statement_omp omp;
647 Number of elements in iter array. */
651 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
654 Pre-body evaluated before the loop body begins. */
659 /* GIMPLE_OMP_PARALLEL */
661 struct GTY(()) gimple_statement_omp_parallel {
663 struct gimple_statement_omp omp;
670 Child function holding the body of the parallel region. */
674 Shared data argument. */
679 /* GIMPLE_OMP_TASK */
681 struct GTY(()) gimple_statement_omp_task {
683 struct gimple_statement_omp_parallel par;
686 Child function holding firstprivate initialization if needed. */
690 Size and alignment in bytes of the argument data block. */
696 /* GIMPLE_OMP_SECTION */
697 /* Uses struct gimple_statement_omp. */
700 /* GIMPLE_OMP_SECTIONS */
702 struct GTY(()) gimple_statement_omp_sections {
704 struct gimple_statement_omp omp;
710 The control variable used for deciding which of the sections to
715 /* GIMPLE_OMP_CONTINUE.
717 Note: This does not inherit from gimple_statement_omp, because we
718 do not need the body field. */
720 struct GTY(()) gimple_statement_omp_continue {
722 struct gimple_statement_base gsbase;
731 /* GIMPLE_OMP_SINGLE */
733 struct GTY(()) gimple_statement_omp_single {
735 struct gimple_statement_omp omp;
742 /* GIMPLE_OMP_ATOMIC_LOAD.
743 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
744 contains a sequence, which we don't need here. */
746 struct GTY(()) gimple_statement_omp_atomic_load {
748 struct gimple_statement_base gsbase;
754 /* GIMPLE_OMP_ATOMIC_STORE.
755 See note on GIMPLE_OMP_ATOMIC_LOAD. */
757 struct GTY(()) gimple_statement_omp_atomic_store {
759 struct gimple_statement_base gsbase;
765 /* GIMPLE_TRANSACTION. */
767 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
769 /* The __transaction_atomic was declared [[outer]] or it is
770 __transaction_relaxed. */
771 #define GTMA_IS_OUTER (1u << 0)
772 #define GTMA_IS_RELAXED (1u << 1)
773 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
775 /* The transaction is seen to not have an abort. */
776 #define GTMA_HAVE_ABORT (1u << 2)
777 /* The transaction is seen to have loads or stores. */
778 #define GTMA_HAVE_LOAD (1u << 3)
779 #define GTMA_HAVE_STORE (1u << 4)
780 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
781 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
782 /* The transaction WILL enter serial irrevocable mode.
783 An irrevocable block post-dominates the entire transaction, such
784 that all invocations of the transaction will go serial-irrevocable.
785 In such case, we don't bother instrumenting the transaction, and
786 tell the runtime that it should begin the transaction in
787 serial-irrevocable mode. */
788 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
790 struct GTY(()) gimple_statement_transaction
793 struct gimple_statement_with_memory_ops_base gsbase;
802 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
803 enum gimple_statement_structure_enum {
804 #include "gsstruct.def"
810 /* Define the overall contents of a gimple tuple. It may be any of the
811 structures declared above for various types of tuples. */
813 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
814 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
815 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
816 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
817 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
818 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
819 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
820 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
821 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
822 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
823 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
824 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
825 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
826 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
827 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
828 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
829 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
830 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
831 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
832 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
833 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
834 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
835 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
836 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
837 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
838 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
839 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
844 /* Offset in bytes to the location of the operand vector.
845 Zero if there is no operand vector for this tuple structure. */
846 extern size_t const gimple_ops_offset_[];
848 /* Map GIMPLE codes to GSS codes. */
849 extern enum gimple_statement_structure_enum const gss_for_code_[];
851 /* This variable holds the currently expanded gimple statement for purposes
852 of comminucating the profile info to the builtin expanders. */
853 extern gimple currently_expanding_gimple_stmt;
855 gimple gimple_build_return (tree);
857 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
858 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
860 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
862 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
863 tree, tree MEM_STAT_DECL);
864 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
865 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
866 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
867 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
869 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
870 #define gimple_build_debug_bind(var,val,stmt) \
871 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
872 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
873 #define gimple_build_debug_source_bind(var,val,stmt) \
874 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
876 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
877 gimple gimple_build_call (tree, unsigned, ...);
878 gimple gimple_build_call_valist (tree, unsigned, va_list);
879 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
880 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
881 gimple gimple_build_call_from_tree (tree);
882 gimple gimplify_assign (tree, tree, gimple_seq *);
883 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
884 gimple gimple_build_label (tree label);
885 gimple gimple_build_goto (tree dest);
886 gimple gimple_build_nop (void);
887 gimple gimple_build_bind (tree, gimple_seq, tree);
888 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
889 VEC(tree,gc) *, VEC(tree,gc) *);
890 gimple gimple_build_catch (tree, gimple_seq);
891 gimple gimple_build_eh_filter (tree, gimple_seq);
892 gimple gimple_build_eh_must_not_throw (tree);
893 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
894 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
895 gimple gimple_build_wce (gimple_seq);
896 gimple gimple_build_resx (int);
897 gimple gimple_build_eh_dispatch (int);
898 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
899 gimple gimple_build_switch (unsigned, tree, tree, ...);
900 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
901 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
902 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
903 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
904 gimple gimple_build_omp_critical (gimple_seq, tree);
905 gimple gimple_build_omp_section (gimple_seq);
906 gimple gimple_build_omp_continue (tree, tree);
907 gimple gimple_build_omp_master (gimple_seq);
908 gimple gimple_build_omp_return (bool);
909 gimple gimple_build_omp_ordered (gimple_seq);
910 gimple gimple_build_omp_sections (gimple_seq, tree);
911 gimple gimple_build_omp_sections_switch (void);
912 gimple gimple_build_omp_single (gimple_seq, tree);
913 gimple gimple_build_cdt (tree, tree);
914 gimple gimple_build_omp_atomic_load (tree, tree);
915 gimple gimple_build_omp_atomic_store (tree);
916 gimple gimple_build_transaction (gimple_seq, tree);
917 gimple gimple_build_predict (enum br_predictor, enum prediction);
918 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
919 void sort_case_labels (VEC(tree,heap) *);
920 void gimple_set_body (tree, gimple_seq);
921 gimple_seq gimple_body (tree);
922 bool gimple_has_body_p (tree);
923 gimple_seq gimple_seq_alloc (void);
924 void gimple_seq_free (gimple_seq);
925 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
926 gimple_seq gimple_seq_copy (gimple_seq);
927 bool gimple_call_same_target_p (const_gimple, const_gimple);
928 int gimple_call_flags (const_gimple);
929 int gimple_call_return_flags (const_gimple);
930 int gimple_call_arg_flags (const_gimple, unsigned);
931 void gimple_call_reset_alias_info (gimple);
932 bool gimple_assign_copy_p (gimple);
933 bool gimple_assign_ssa_name_copy_p (gimple);
934 bool gimple_assign_unary_nop_p (gimple);
935 void gimple_set_bb (gimple, struct basic_block_def *);
936 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
937 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
939 tree gimple_get_lhs (const_gimple);
940 void gimple_set_lhs (gimple, tree);
941 void gimple_replace_lhs (gimple, tree);
942 gimple gimple_copy (gimple);
943 void gimple_set_modified (gimple, bool);
944 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
945 gimple gimple_build_cond_from_tree (tree, tree, tree);
946 void gimple_cond_set_condition_from_tree (gimple, tree);
947 bool gimple_has_side_effects (const_gimple);
948 bool gimple_could_trap_p (gimple);
949 bool gimple_could_trap_p_1 (gimple, bool, bool);
950 bool gimple_assign_rhs_could_trap_p (gimple);
951 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
952 bool empty_body_p (gimple_seq);
953 unsigned get_gimple_rhs_num_ops (enum tree_code);
954 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
955 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
956 const char *gimple_decl_printable_name (tree, int);
957 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
958 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
959 tree gimple_extract_devirt_binfo_from_cst (tree);
960 /* Returns true iff T is a valid GIMPLE statement. */
961 extern bool is_gimple_stmt (tree);
963 /* Returns true iff T is a scalar register variable. */
964 extern bool is_gimple_reg (tree);
965 /* Returns true iff T is any sort of variable. */
966 extern bool is_gimple_variable (tree);
967 /* Returns true iff T is any sort of symbol. */
968 extern bool is_gimple_id (tree);
969 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
970 extern bool is_gimple_min_lval (tree);
971 /* Returns true iff T is something whose address can be taken. */
972 extern bool is_gimple_addressable (tree);
973 /* Returns true iff T is any valid GIMPLE lvalue. */
974 extern bool is_gimple_lvalue (tree);
976 /* Returns true iff T is a GIMPLE address. */
977 bool is_gimple_address (const_tree);
978 /* Returns true iff T is a GIMPLE invariant address. */
979 bool is_gimple_invariant_address (const_tree);
980 /* Returns true iff T is a GIMPLE invariant address at interprocedural
982 bool is_gimple_ip_invariant_address (const_tree);
983 /* Returns true iff T is a valid GIMPLE constant. */
984 bool is_gimple_constant (const_tree);
985 /* Returns true iff T is a GIMPLE restricted function invariant. */
986 extern bool is_gimple_min_invariant (const_tree);
987 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
988 extern bool is_gimple_ip_invariant (const_tree);
989 /* Returns true iff T is a GIMPLE rvalue. */
990 extern bool is_gimple_val (tree);
991 /* Returns true iff T is a GIMPLE asm statement input. */
992 extern bool is_gimple_asm_val (tree);
993 /* Returns true iff T is a valid address operand of a MEM_REF. */
994 bool is_gimple_mem_ref_addr (tree);
995 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
996 GIMPLE temporary, a renamed user variable, or something else,
998 extern bool is_gimple_reg_rhs (tree);
999 extern bool is_gimple_mem_rhs (tree);
1001 /* Returns true iff T is a valid if-statement condition. */
1002 extern bool is_gimple_condexpr (tree);
1004 /* Returns true iff T is a valid call address expression. */
1005 extern bool is_gimple_call_addr (tree);
1007 extern void recalculate_side_effects (tree);
1008 extern bool gimple_compare_field_offset (tree, tree);
1009 extern tree gimple_register_type (tree);
1010 extern tree gimple_register_canonical_type (tree);
1011 extern void print_gimple_types_stats (void);
1012 extern void free_gimple_type_tables (void);
1013 extern tree gimple_unsigned_type (tree);
1014 extern tree gimple_signed_type (tree);
1015 extern alias_set_type gimple_get_alias_set (tree);
1016 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1018 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1019 bool (*)(gimple, tree, void *),
1020 bool (*)(gimple, tree, void *),
1021 bool (*)(gimple, tree, void *));
1022 extern bool walk_stmt_load_store_ops (gimple, void *,
1023 bool (*)(gimple, tree, void *),
1024 bool (*)(gimple, tree, void *));
1025 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1026 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1027 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1030 extern tree create_tmp_var_raw (tree, const char *);
1031 extern tree create_tmp_var_name (const char *);
1032 extern tree create_tmp_var (tree, const char *);
1033 extern tree create_tmp_reg (tree, const char *);
1034 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1035 extern tree get_formal_tmp_var (tree, gimple_seq *);
1036 extern void declare_vars (tree, gimple, bool);
1037 extern void annotate_all_with_location (gimple_seq, location_t);
1039 /* Validation of GIMPLE expressions. Note that these predicates only check
1040 the basic form of the expression, they don't recurse to make sure that
1041 underlying nodes are also of the right form. */
1042 typedef bool (*gimple_predicate)(tree);
1045 /* FIXME we should deduce this from the predicate. */
1047 fb_none = 0, /* Do not generate a temporary. */
1049 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1050 gimplified expression. */
1052 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1053 gimplified expression. */
1055 fb_mayfail = 4, /* Gimplification may fail. Error issued
1057 fb_either= fb_rvalue | fb_lvalue
1060 typedef int fallback_t;
1062 enum gimplify_status {
1063 GS_ERROR = -2, /* Something Bad Seen. */
1064 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1065 GS_OK = 0, /* We did something, maybe more to do. */
1066 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1071 struct gimplify_ctx *prev_context;
1073 VEC(gimple,heap) *bind_expr_stack;
1075 gimple_seq conditional_cleanups;
1079 VEC(tree,heap) *case_labels;
1080 /* The formal temporary table. Should this be persistent? */
1086 bool allow_rhs_cond_expr;
1087 bool in_cleanup_point_expr;
1090 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1091 bool (*) (tree), fallback_t);
1092 extern void gimplify_type_sizes (tree, gimple_seq *);
1093 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1094 extern bool gimplify_stmt (tree *, gimple_seq *);
1095 extern gimple gimplify_body (tree, bool);
1096 extern void push_gimplify_context (struct gimplify_ctx *);
1097 extern void pop_gimplify_context (gimple);
1098 extern void gimplify_and_add (tree, gimple_seq *);
1100 /* Miscellaneous helpers. */
1101 extern void gimple_add_tmp_var (tree);
1102 extern gimple gimple_current_bind_expr (void);
1103 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1104 extern tree voidify_wrapper_expr (tree, tree);
1105 extern tree build_and_jump (tree *);
1106 extern tree force_labels_r (tree *, int *, void *);
1107 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1109 struct gimplify_omp_ctx;
1110 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1111 extern tree gimple_boolify (tree);
1112 extern gimple_predicate rhs_predicate_for (tree);
1113 extern tree canonicalize_cond_expr_cond (tree);
1116 extern tree omp_reduction_init (tree, tree);
1118 /* In trans-mem.c. */
1119 extern void diagnose_tm_safe_errors (tree);
1120 extern void compute_transaction_bits (void);
1122 /* In tree-nested.c. */
1123 extern void lower_nested_functions (tree);
1124 extern void insert_field_into_struct (tree, tree);
1126 /* In gimplify.c. */
1127 extern void gimplify_function_tree (tree);
1129 /* In cfgexpand.c. */
1130 extern tree gimple_assign_rhs_to_tree (gimple);
1133 extern bool validate_gimple_arglist (const_gimple, ...);
1136 extern bool tree_ssa_useless_type_conversion (tree);
1137 extern tree tree_ssa_strip_useless_type_conversions (tree);
1138 extern bool useless_type_conversion_p (tree, tree);
1139 extern bool types_compatible_p (tree, tree);
1141 /* Return the code for GIMPLE statement G. */
1143 static inline enum gimple_code
1144 gimple_code (const_gimple g)
1146 return g->gsbase.code;
1150 /* Return the GSS code used by a GIMPLE code. */
1152 static inline enum gimple_statement_structure_enum
1153 gss_for_code (enum gimple_code code)
1155 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1156 return gss_for_code_[code];
1160 /* Return which GSS code is used by GS. */
1162 static inline enum gimple_statement_structure_enum
1163 gimple_statement_structure (gimple gs)
1165 return gss_for_code (gimple_code (gs));
1169 /* Return true if statement G has sub-statements. This is only true for
1170 High GIMPLE statements. */
1173 gimple_has_substatements (gimple g)
1175 switch (gimple_code (g))
1179 case GIMPLE_EH_FILTER:
1180 case GIMPLE_EH_ELSE:
1182 case GIMPLE_OMP_FOR:
1183 case GIMPLE_OMP_MASTER:
1184 case GIMPLE_OMP_ORDERED:
1185 case GIMPLE_OMP_SECTION:
1186 case GIMPLE_OMP_PARALLEL:
1187 case GIMPLE_OMP_TASK:
1188 case GIMPLE_OMP_SECTIONS:
1189 case GIMPLE_OMP_SINGLE:
1190 case GIMPLE_OMP_CRITICAL:
1191 case GIMPLE_WITH_CLEANUP_EXPR:
1192 case GIMPLE_TRANSACTION:
1201 /* Return the basic block holding statement G. */
1203 static inline struct basic_block_def *
1204 gimple_bb (const_gimple g)
1206 return g->gsbase.bb;
1210 /* Return the lexical scope block holding statement G. */
1213 gimple_block (const_gimple g)
1215 return g->gsbase.block;
1219 /* Set BLOCK to be the lexical scope block holding statement G. */
1222 gimple_set_block (gimple g, tree block)
1224 g->gsbase.block = block;
1228 /* Return location information for statement G. */
1230 static inline location_t
1231 gimple_location (const_gimple g)
1233 return g->gsbase.location;
1236 /* Return pointer to location information for statement G. */
1238 static inline const location_t *
1239 gimple_location_ptr (const_gimple g)
1241 return &g->gsbase.location;
1245 /* Set location information for statement G. */
1248 gimple_set_location (gimple g, location_t location)
1250 g->gsbase.location = location;
1254 /* Return true if G contains location information. */
1257 gimple_has_location (const_gimple g)
1259 return gimple_location (g) != UNKNOWN_LOCATION;
1263 /* Return the file name of the location of STMT. */
1265 static inline const char *
1266 gimple_filename (const_gimple stmt)
1268 return LOCATION_FILE (gimple_location (stmt));
1272 /* Return the line number of the location of STMT. */
1275 gimple_lineno (const_gimple stmt)
1277 return LOCATION_LINE (gimple_location (stmt));
1281 /* Determine whether SEQ is a singleton. */
1284 gimple_seq_singleton_p (gimple_seq seq)
1286 return ((gimple_seq_first (seq) != NULL)
1287 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1290 /* Return true if no warnings should be emitted for statement STMT. */
1293 gimple_no_warning_p (const_gimple stmt)
1295 return stmt->gsbase.no_warning;
1298 /* Set the no_warning flag of STMT to NO_WARNING. */
1301 gimple_set_no_warning (gimple stmt, bool no_warning)
1303 stmt->gsbase.no_warning = (unsigned) no_warning;
1306 /* Set the visited status on statement STMT to VISITED_P. */
1309 gimple_set_visited (gimple stmt, bool visited_p)
1311 stmt->gsbase.visited = (unsigned) visited_p;
1315 /* Return the visited status for statement STMT. */
1318 gimple_visited_p (gimple stmt)
1320 return stmt->gsbase.visited;
1324 /* Set pass local flag PLF on statement STMT to VAL_P. */
1327 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1330 stmt->gsbase.plf |= (unsigned int) plf;
1332 stmt->gsbase.plf &= ~((unsigned int) plf);
1336 /* Return the value of pass local flag PLF on statement STMT. */
1338 static inline unsigned int
1339 gimple_plf (gimple stmt, enum plf_mask plf)
1341 return stmt->gsbase.plf & ((unsigned int) plf);
1345 /* Set the UID of statement. */
1348 gimple_set_uid (gimple g, unsigned uid)
1350 g->gsbase.uid = uid;
1354 /* Return the UID of statement. */
1356 static inline unsigned
1357 gimple_uid (const_gimple g)
1359 return g->gsbase.uid;
1363 /* Return true if GIMPLE statement G has register or memory operands. */
1366 gimple_has_ops (const_gimple g)
1368 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1372 /* Return true if GIMPLE statement G has memory operands. */
1375 gimple_has_mem_ops (const_gimple g)
1377 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1381 /* Return the set of DEF operands for statement G. */
1383 static inline struct def_optype_d *
1384 gimple_def_ops (const_gimple g)
1386 if (!gimple_has_ops (g))
1388 return g->gsops.opbase.def_ops;
1392 /* Set DEF to be the set of DEF operands for statement G. */
1395 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1397 gcc_gimple_checking_assert (gimple_has_ops (g));
1398 g->gsops.opbase.def_ops = def;
1402 /* Return the set of USE operands for statement G. */
1404 static inline struct use_optype_d *
1405 gimple_use_ops (const_gimple g)
1407 if (!gimple_has_ops (g))
1409 return g->gsops.opbase.use_ops;
1413 /* Set USE to be the set of USE operands for statement G. */
1416 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1418 gcc_gimple_checking_assert (gimple_has_ops (g));
1419 g->gsops.opbase.use_ops = use;
1423 /* Return the set of VUSE operand for statement G. */
1425 static inline use_operand_p
1426 gimple_vuse_op (const_gimple g)
1428 struct use_optype_d *ops;
1429 if (!gimple_has_mem_ops (g))
1430 return NULL_USE_OPERAND_P;
1431 ops = g->gsops.opbase.use_ops;
1433 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1434 return USE_OP_PTR (ops);
1435 return NULL_USE_OPERAND_P;
1438 /* Return the set of VDEF operand for statement G. */
1440 static inline def_operand_p
1441 gimple_vdef_op (const_gimple g)
1443 struct def_optype_d *ops;
1444 if (!gimple_has_mem_ops (g))
1445 return NULL_DEF_OPERAND_P;
1446 ops = g->gsops.opbase.def_ops;
1448 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1449 return DEF_OP_PTR (ops);
1450 return NULL_DEF_OPERAND_P;
1454 /* Return the single VUSE operand of the statement G. */
1457 gimple_vuse (const_gimple g)
1459 if (!gimple_has_mem_ops (g))
1461 return g->gsmembase.vuse;
1464 /* Return the single VDEF operand of the statement G. */
1467 gimple_vdef (const_gimple g)
1469 if (!gimple_has_mem_ops (g))
1471 return g->gsmembase.vdef;
1474 /* Return the single VUSE operand of the statement G. */
1476 static inline tree *
1477 gimple_vuse_ptr (gimple g)
1479 if (!gimple_has_mem_ops (g))
1481 return &g->gsmembase.vuse;
1484 /* Return the single VDEF operand of the statement G. */
1486 static inline tree *
1487 gimple_vdef_ptr (gimple g)
1489 if (!gimple_has_mem_ops (g))
1491 return &g->gsmembase.vdef;
1494 /* Set the single VUSE operand of the statement G. */
1497 gimple_set_vuse (gimple g, tree vuse)
1499 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1500 g->gsmembase.vuse = vuse;
1503 /* Set the single VDEF operand of the statement G. */
1506 gimple_set_vdef (gimple g, tree vdef)
1508 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1509 g->gsmembase.vdef = vdef;
1513 /* Return true if statement G has operands and the modified field has
1517 gimple_modified_p (const_gimple g)
1519 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1523 /* Return the tree code for the expression computed by STMT. This is
1524 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1525 GIMPLE_CALL, return CALL_EXPR as the expression code for
1526 consistency. This is useful when the caller needs to deal with the
1527 three kinds of computation that GIMPLE supports. */
1529 static inline enum tree_code
1530 gimple_expr_code (const_gimple stmt)
1532 enum gimple_code code = gimple_code (stmt);
1533 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1534 return (enum tree_code) stmt->gsbase.subcode;
1537 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1543 /* Mark statement S as modified, and update it. */
1546 update_stmt (gimple s)
1548 if (gimple_has_ops (s))
1550 gimple_set_modified (s, true);
1551 update_stmt_operands (s);
1555 /* Update statement S if it has been optimized. */
1558 update_stmt_if_modified (gimple s)
1560 if (gimple_modified_p (s))
1561 update_stmt_operands (s);
1564 /* Return true if statement STMT contains volatile operands. */
1567 gimple_has_volatile_ops (const_gimple stmt)
1569 if (gimple_has_mem_ops (stmt))
1570 return stmt->gsbase.has_volatile_ops;
1576 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1579 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1581 if (gimple_has_mem_ops (stmt))
1582 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1585 /* Return true if BB is in a transaction. */
1588 block_in_transaction (basic_block bb)
1590 return flag_tm && bb->flags & BB_IN_TRANSACTION;
1593 /* Return true if STMT is in a transaction. */
1596 gimple_in_transaction (gimple stmt)
1598 return block_in_transaction (gimple_bb (stmt));
1601 /* Return true if statement STMT may access memory. */
1604 gimple_references_memory_p (gimple stmt)
1606 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1610 /* Return the subcode for OMP statement S. */
1612 static inline unsigned
1613 gimple_omp_subcode (const_gimple s)
1615 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1616 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1617 return s->gsbase.subcode;
1620 /* Set the subcode for OMP statement S to SUBCODE. */
1623 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1625 /* We only have 16 bits for the subcode. Assert that we are not
1627 gcc_gimple_checking_assert (subcode < (1 << 16));
1628 s->gsbase.subcode = subcode;
1631 /* Set the nowait flag on OMP_RETURN statement S. */
1634 gimple_omp_return_set_nowait (gimple s)
1636 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1637 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1641 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1645 gimple_omp_return_nowait_p (const_gimple g)
1647 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1648 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1652 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1656 gimple_omp_section_last_p (const_gimple g)
1658 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1659 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1663 /* Set the GF_OMP_SECTION_LAST flag on G. */
1666 gimple_omp_section_set_last (gimple g)
1668 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1669 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1673 /* Return true if OMP parallel statement G has the
1674 GF_OMP_PARALLEL_COMBINED flag set. */
1677 gimple_omp_parallel_combined_p (const_gimple g)
1679 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1680 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1684 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1685 value of COMBINED_P. */
1688 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1690 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1692 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1694 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1698 /* Return true if OMP atomic load/store statement G has the
1699 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1702 gimple_omp_atomic_need_value_p (const_gimple g)
1704 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1705 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1706 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1710 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1713 gimple_omp_atomic_set_need_value (gimple g)
1715 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1716 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1717 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1721 /* Return the number of operands for statement GS. */
1723 static inline unsigned
1724 gimple_num_ops (const_gimple gs)
1726 return gs->gsbase.num_ops;
1730 /* Set the number of operands for statement GS. */
1733 gimple_set_num_ops (gimple gs, unsigned num_ops)
1735 gs->gsbase.num_ops = num_ops;
1739 /* Return the array of operands for statement GS. */
1741 static inline tree *
1742 gimple_ops (gimple gs)
1746 /* All the tuples have their operand vector at the very bottom
1747 of the structure. Note that those structures that do not
1748 have an operand vector have a zero offset. */
1749 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1750 gcc_gimple_checking_assert (off != 0);
1752 return (tree *) ((char *) gs + off);
1756 /* Return operand I for statement GS. */
1759 gimple_op (const_gimple gs, unsigned i)
1761 if (gimple_has_ops (gs))
1763 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1764 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1770 /* Return a pointer to operand I for statement GS. */
1772 static inline tree *
1773 gimple_op_ptr (const_gimple gs, unsigned i)
1775 if (gimple_has_ops (gs))
1777 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1778 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1784 /* Set operand I of statement GS to OP. */
1787 gimple_set_op (gimple gs, unsigned i, tree op)
1789 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1791 /* Note. It may be tempting to assert that OP matches
1792 is_gimple_operand, but that would be wrong. Different tuples
1793 accept slightly different sets of tree operands. Each caller
1794 should perform its own validation. */
1795 gimple_ops (gs)[i] = op;
1798 /* Return true if GS is a GIMPLE_ASSIGN. */
1801 is_gimple_assign (const_gimple gs)
1803 return gimple_code (gs) == GIMPLE_ASSIGN;
1806 /* Determine if expression CODE is one of the valid expressions that can
1807 be used on the RHS of GIMPLE assignments. */
1809 static inline enum gimple_rhs_class
1810 get_gimple_rhs_class (enum tree_code code)
1812 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1815 /* Return the LHS of assignment statement GS. */
1818 gimple_assign_lhs (const_gimple gs)
1820 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1821 return gimple_op (gs, 0);
1825 /* Return a pointer to the LHS of assignment statement GS. */
1827 static inline tree *
1828 gimple_assign_lhs_ptr (const_gimple gs)
1830 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1831 return gimple_op_ptr (gs, 0);
1835 /* Set LHS to be the LHS operand of assignment statement GS. */
1838 gimple_assign_set_lhs (gimple gs, tree lhs)
1840 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1841 gimple_set_op (gs, 0, lhs);
1843 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1844 SSA_NAME_DEF_STMT (lhs) = gs;
1848 /* Return the first operand on the RHS of assignment statement GS. */
1851 gimple_assign_rhs1 (const_gimple gs)
1853 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1854 return gimple_op (gs, 1);
1858 /* Return a pointer to the first operand on the RHS of assignment
1861 static inline tree *
1862 gimple_assign_rhs1_ptr (const_gimple gs)
1864 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1865 return gimple_op_ptr (gs, 1);
1868 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1871 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1873 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1875 gimple_set_op (gs, 1, rhs);
1879 /* Return the second operand on the RHS of assignment statement GS.
1880 If GS does not have two operands, NULL is returned instead. */
1883 gimple_assign_rhs2 (const_gimple gs)
1885 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1887 if (gimple_num_ops (gs) >= 3)
1888 return gimple_op (gs, 2);
1894 /* Return a pointer to the second operand on the RHS of assignment
1897 static inline tree *
1898 gimple_assign_rhs2_ptr (const_gimple gs)
1900 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1901 return gimple_op_ptr (gs, 2);
1905 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1908 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1910 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1912 gimple_set_op (gs, 2, rhs);
1915 /* Return the third operand on the RHS of assignment statement GS.
1916 If GS does not have two operands, NULL is returned instead. */
1919 gimple_assign_rhs3 (const_gimple gs)
1921 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1923 if (gimple_num_ops (gs) >= 4)
1924 return gimple_op (gs, 3);
1929 /* Return a pointer to the third operand on the RHS of assignment
1932 static inline tree *
1933 gimple_assign_rhs3_ptr (const_gimple gs)
1935 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1936 return gimple_op_ptr (gs, 3);
1940 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1943 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1945 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1947 gimple_set_op (gs, 3, rhs);
1950 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1951 to see only a maximum of two operands. */
1954 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1957 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1960 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1961 to see only a maximum of two operands. */
1964 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1968 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1969 gcc_assert (op2 == NULL_TREE);
1972 /* Returns true if GS is a nontemporal move. */
1975 gimple_assign_nontemporal_move_p (const_gimple gs)
1977 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1978 return gs->gsbase.nontemporal_move;
1981 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1984 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1986 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1987 gs->gsbase.nontemporal_move = nontemporal;
1991 /* Return the code of the expression computed on the rhs of assignment
1992 statement GS. In case that the RHS is a single object, returns the
1993 tree code of the object. */
1995 static inline enum tree_code
1996 gimple_assign_rhs_code (const_gimple gs)
1998 enum tree_code code;
1999 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2001 code = (enum tree_code) gs->gsbase.subcode;
2002 /* While we initially set subcode to the TREE_CODE of the rhs for
2003 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2004 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2005 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2006 code = TREE_CODE (gimple_assign_rhs1 (gs));
2012 /* Set CODE to be the code for the expression computed on the RHS of
2016 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2018 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2019 s->gsbase.subcode = code;
2023 /* Return the gimple rhs class of the code of the expression computed on
2024 the rhs of assignment statement GS.
2025 This will never return GIMPLE_INVALID_RHS. */
2027 static inline enum gimple_rhs_class
2028 gimple_assign_rhs_class (const_gimple gs)
2030 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2033 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2034 there is no operator associated with the assignment itself.
2035 Unlike gimple_assign_copy_p, this predicate returns true for
2036 any RHS operand, including those that perform an operation
2037 and do not have the semantics of a copy, such as COND_EXPR. */
2040 gimple_assign_single_p (gimple gs)
2042 return (is_gimple_assign (gs)
2043 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2047 /* Return true if S is a type-cast assignment. */
2050 gimple_assign_cast_p (gimple s)
2052 if (is_gimple_assign (s))
2054 enum tree_code sc = gimple_assign_rhs_code (s);
2055 return CONVERT_EXPR_CODE_P (sc)
2056 || sc == VIEW_CONVERT_EXPR
2057 || sc == FIX_TRUNC_EXPR;
2063 /* Return true if S is a clobber statement. */
2066 gimple_clobber_p (gimple s)
2068 return gimple_assign_single_p (s)
2069 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2072 /* Return true if GS is a GIMPLE_CALL. */
2075 is_gimple_call (const_gimple gs)
2077 return gimple_code (gs) == GIMPLE_CALL;
2080 /* Return the LHS of call statement GS. */
2083 gimple_call_lhs (const_gimple gs)
2085 GIMPLE_CHECK (gs, GIMPLE_CALL);
2086 return gimple_op (gs, 0);
2090 /* Return a pointer to the LHS of call statement GS. */
2092 static inline tree *
2093 gimple_call_lhs_ptr (const_gimple gs)
2095 GIMPLE_CHECK (gs, GIMPLE_CALL);
2096 return gimple_op_ptr (gs, 0);
2100 /* Set LHS to be the LHS operand of call statement GS. */
2103 gimple_call_set_lhs (gimple gs, tree lhs)
2105 GIMPLE_CHECK (gs, GIMPLE_CALL);
2106 gimple_set_op (gs, 0, lhs);
2107 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2108 SSA_NAME_DEF_STMT (lhs) = gs;
2112 /* Return true if call GS calls an internal-only function, as enumerated
2116 gimple_call_internal_p (const_gimple gs)
2118 GIMPLE_CHECK (gs, GIMPLE_CALL);
2119 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2123 /* Return the target of internal call GS. */
2125 static inline enum internal_fn
2126 gimple_call_internal_fn (const_gimple gs)
2128 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2129 return gs->gimple_call.u.internal_fn;
2133 /* Return the function type of the function called by GS. */
2136 gimple_call_fntype (const_gimple gs)
2138 GIMPLE_CHECK (gs, GIMPLE_CALL);
2139 if (gimple_call_internal_p (gs))
2141 return gs->gimple_call.u.fntype;
2144 /* Set the type of the function called by GS to FNTYPE. */
2147 gimple_call_set_fntype (gimple gs, tree fntype)
2149 GIMPLE_CHECK (gs, GIMPLE_CALL);
2150 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2151 gs->gimple_call.u.fntype = fntype;
2155 /* Return the tree node representing the function called by call
2159 gimple_call_fn (const_gimple gs)
2161 GIMPLE_CHECK (gs, GIMPLE_CALL);
2162 return gimple_op (gs, 1);
2165 /* Return a pointer to the tree node representing the function called by call
2168 static inline tree *
2169 gimple_call_fn_ptr (const_gimple gs)
2171 GIMPLE_CHECK (gs, GIMPLE_CALL);
2172 return gimple_op_ptr (gs, 1);
2176 /* Set FN to be the function called by call statement GS. */
2179 gimple_call_set_fn (gimple gs, tree fn)
2181 GIMPLE_CHECK (gs, GIMPLE_CALL);
2182 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2183 gimple_set_op (gs, 1, fn);
2187 /* Set FNDECL to be the function called by call statement GS. */
2190 gimple_call_set_fndecl (gimple gs, tree decl)
2192 GIMPLE_CHECK (gs, GIMPLE_CALL);
2193 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2194 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2198 /* Set internal function FN to be the function called by call statement GS. */
2201 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2203 GIMPLE_CHECK (gs, GIMPLE_CALL);
2204 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2205 gs->gimple_call.u.internal_fn = fn;
2209 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2210 associated with the callee if known. Otherwise return NULL_TREE. */
2213 gimple_call_addr_fndecl (const_tree fn)
2215 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2217 tree fndecl = TREE_OPERAND (fn, 0);
2218 if (TREE_CODE (fndecl) == MEM_REF
2219 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2220 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2221 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2222 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2228 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2229 Otherwise return NULL. This function is analogous to
2230 get_callee_fndecl in tree land. */
2233 gimple_call_fndecl (const_gimple gs)
2235 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2239 /* Return the type returned by call statement GS. */
2242 gimple_call_return_type (const_gimple gs)
2244 tree type = gimple_call_fntype (gs);
2246 if (type == NULL_TREE)
2247 return TREE_TYPE (gimple_call_lhs (gs));
2249 /* The type returned by a function is the type of its
2251 return TREE_TYPE (type);
2255 /* Return the static chain for call statement GS. */
2258 gimple_call_chain (const_gimple gs)
2260 GIMPLE_CHECK (gs, GIMPLE_CALL);
2261 return gimple_op (gs, 2);
2265 /* Return a pointer to the static chain for call statement GS. */
2267 static inline tree *
2268 gimple_call_chain_ptr (const_gimple gs)
2270 GIMPLE_CHECK (gs, GIMPLE_CALL);
2271 return gimple_op_ptr (gs, 2);
2274 /* Set CHAIN to be the static chain for call statement GS. */
2277 gimple_call_set_chain (gimple gs, tree chain)
2279 GIMPLE_CHECK (gs, GIMPLE_CALL);
2281 gimple_set_op (gs, 2, chain);
2285 /* Return the number of arguments used by call statement GS. */
2287 static inline unsigned
2288 gimple_call_num_args (const_gimple gs)
2291 GIMPLE_CHECK (gs, GIMPLE_CALL);
2292 num_ops = gimple_num_ops (gs);
2297 /* Return the argument at position INDEX for call statement GS. */
2300 gimple_call_arg (const_gimple gs, unsigned index)
2302 GIMPLE_CHECK (gs, GIMPLE_CALL);
2303 return gimple_op (gs, index + 3);
2307 /* Return a pointer to the argument at position INDEX for call
2310 static inline tree *
2311 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2313 GIMPLE_CHECK (gs, GIMPLE_CALL);
2314 return gimple_op_ptr (gs, index + 3);
2318 /* Set ARG to be the argument at position INDEX for call statement GS. */
2321 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2323 GIMPLE_CHECK (gs, GIMPLE_CALL);
2324 gimple_set_op (gs, index + 3, arg);
2328 /* If TAIL_P is true, mark call statement S as being a tail call
2329 (i.e., a call just before the exit of a function). These calls are
2330 candidate for tail call optimization. */
2333 gimple_call_set_tail (gimple s, bool tail_p)
2335 GIMPLE_CHECK (s, GIMPLE_CALL);
2337 s->gsbase.subcode |= GF_CALL_TAILCALL;
2339 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2343 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2346 gimple_call_tail_p (gimple s)
2348 GIMPLE_CHECK (s, GIMPLE_CALL);
2349 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2353 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2354 slot optimization. This transformation uses the target of the call
2355 expansion as the return slot for calls that return in memory. */
2358 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2360 GIMPLE_CHECK (s, GIMPLE_CALL);
2361 if (return_slot_opt_p)
2362 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2364 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2368 /* Return true if S is marked for return slot optimization. */
2371 gimple_call_return_slot_opt_p (gimple s)
2373 GIMPLE_CHECK (s, GIMPLE_CALL);
2374 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2378 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2379 thunk to the thunked-to function. */
2382 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2384 GIMPLE_CHECK (s, GIMPLE_CALL);
2386 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2388 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2392 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2395 gimple_call_from_thunk_p (gimple s)
2397 GIMPLE_CHECK (s, GIMPLE_CALL);
2398 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2402 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2403 argument pack in its argument list. */
2406 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2408 GIMPLE_CHECK (s, GIMPLE_CALL);
2409 if (pass_arg_pack_p)
2410 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2412 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2416 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2417 argument pack in its argument list. */
2420 gimple_call_va_arg_pack_p (gimple s)
2422 GIMPLE_CHECK (s, GIMPLE_CALL);
2423 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2427 /* Return true if S is a noreturn call. */
2430 gimple_call_noreturn_p (gimple s)
2432 GIMPLE_CHECK (s, GIMPLE_CALL);
2433 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2437 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2438 even if the called function can throw in other cases. */
2441 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2443 GIMPLE_CHECK (s, GIMPLE_CALL);
2445 s->gsbase.subcode |= GF_CALL_NOTHROW;
2447 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2450 /* Return true if S is a nothrow call. */
2453 gimple_call_nothrow_p (gimple s)
2455 GIMPLE_CHECK (s, GIMPLE_CALL);
2456 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2459 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2460 is known to be emitted for VLA objects. Those are wrapped by
2461 stack_save/stack_restore calls and hence can't lead to unbounded
2462 stack growth even when they occur in loops. */
2465 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2467 GIMPLE_CHECK (s, GIMPLE_CALL);
2469 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2471 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2474 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2477 gimple_call_alloca_for_var_p (gimple s)
2479 GIMPLE_CHECK (s, GIMPLE_CALL);
2480 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2483 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2486 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2488 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2489 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2490 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2494 /* Return a pointer to the points-to solution for the set of call-used
2495 variables of the call CALL. */
2497 static inline struct pt_solution *
2498 gimple_call_use_set (gimple call)
2500 GIMPLE_CHECK (call, GIMPLE_CALL);
2501 return &call->gimple_call.call_used;
2505 /* Return a pointer to the points-to solution for the set of call-used
2506 variables of the call CALL. */
2508 static inline struct pt_solution *
2509 gimple_call_clobber_set (gimple call)
2511 GIMPLE_CHECK (call, GIMPLE_CALL);
2512 return &call->gimple_call.call_clobbered;
2516 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2520 gimple_has_lhs (gimple stmt)
2522 return (is_gimple_assign (stmt)
2523 || (is_gimple_call (stmt)
2524 && gimple_call_lhs (stmt) != NULL_TREE));
2528 /* Return the code of the predicate computed by conditional statement GS. */
2530 static inline enum tree_code
2531 gimple_cond_code (const_gimple gs)
2533 GIMPLE_CHECK (gs, GIMPLE_COND);
2534 return (enum tree_code) gs->gsbase.subcode;
2538 /* Set CODE to be the predicate code for the conditional statement GS. */
2541 gimple_cond_set_code (gimple gs, enum tree_code code)
2543 GIMPLE_CHECK (gs, GIMPLE_COND);
2544 gs->gsbase.subcode = code;
2548 /* Return the LHS of the predicate computed by conditional statement GS. */
2551 gimple_cond_lhs (const_gimple gs)
2553 GIMPLE_CHECK (gs, GIMPLE_COND);
2554 return gimple_op (gs, 0);
2557 /* Return the pointer to the LHS of the predicate computed by conditional
2560 static inline tree *
2561 gimple_cond_lhs_ptr (const_gimple gs)
2563 GIMPLE_CHECK (gs, GIMPLE_COND);
2564 return gimple_op_ptr (gs, 0);
2567 /* Set LHS to be the LHS operand of the predicate computed by
2568 conditional statement GS. */
2571 gimple_cond_set_lhs (gimple gs, tree lhs)
2573 GIMPLE_CHECK (gs, GIMPLE_COND);
2574 gimple_set_op (gs, 0, lhs);
2578 /* Return the RHS operand of the predicate computed by conditional GS. */
2581 gimple_cond_rhs (const_gimple gs)
2583 GIMPLE_CHECK (gs, GIMPLE_COND);
2584 return gimple_op (gs, 1);
2587 /* Return the pointer to the RHS operand of the predicate computed by
2590 static inline tree *
2591 gimple_cond_rhs_ptr (const_gimple gs)
2593 GIMPLE_CHECK (gs, GIMPLE_COND);
2594 return gimple_op_ptr (gs, 1);
2598 /* Set RHS to be the RHS operand of the predicate computed by
2599 conditional statement GS. */
2602 gimple_cond_set_rhs (gimple gs, tree rhs)
2604 GIMPLE_CHECK (gs, GIMPLE_COND);
2605 gimple_set_op (gs, 1, rhs);
2609 /* Return the label used by conditional statement GS when its
2610 predicate evaluates to true. */
2613 gimple_cond_true_label (const_gimple gs)
2615 GIMPLE_CHECK (gs, GIMPLE_COND);
2616 return gimple_op (gs, 2);
2620 /* Set LABEL to be the label used by conditional statement GS when its
2621 predicate evaluates to true. */
2624 gimple_cond_set_true_label (gimple gs, tree label)
2626 GIMPLE_CHECK (gs, GIMPLE_COND);
2627 gimple_set_op (gs, 2, label);
2631 /* Set LABEL to be the label used by conditional statement GS when its
2632 predicate evaluates to false. */
2635 gimple_cond_set_false_label (gimple gs, tree label)
2637 GIMPLE_CHECK (gs, GIMPLE_COND);
2638 gimple_set_op (gs, 3, label);
2642 /* Return the label used by conditional statement GS when its
2643 predicate evaluates to false. */
2646 gimple_cond_false_label (const_gimple gs)
2648 GIMPLE_CHECK (gs, GIMPLE_COND);
2649 return gimple_op (gs, 3);
2653 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2656 gimple_cond_make_false (gimple gs)
2658 gimple_cond_set_lhs (gs, boolean_true_node);
2659 gimple_cond_set_rhs (gs, boolean_false_node);
2660 gs->gsbase.subcode = EQ_EXPR;
2664 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2667 gimple_cond_make_true (gimple gs)
2669 gimple_cond_set_lhs (gs, boolean_true_node);
2670 gimple_cond_set_rhs (gs, boolean_true_node);
2671 gs->gsbase.subcode = EQ_EXPR;
2674 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2675 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2678 gimple_cond_true_p (const_gimple gs)
2680 tree lhs = gimple_cond_lhs (gs);
2681 tree rhs = gimple_cond_rhs (gs);
2682 enum tree_code code = gimple_cond_code (gs);
2684 if (lhs != boolean_true_node && lhs != boolean_false_node)
2687 if (rhs != boolean_true_node && rhs != boolean_false_node)
2690 if (code == NE_EXPR && lhs != rhs)
2693 if (code == EQ_EXPR && lhs == rhs)
2699 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2700 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2703 gimple_cond_false_p (const_gimple gs)
2705 tree lhs = gimple_cond_lhs (gs);
2706 tree rhs = gimple_cond_rhs (gs);
2707 enum tree_code code = gimple_cond_code (gs);
2709 if (lhs != boolean_true_node && lhs != boolean_false_node)
2712 if (rhs != boolean_true_node && rhs != boolean_false_node)
2715 if (code == NE_EXPR && lhs == rhs)
2718 if (code == EQ_EXPR && lhs != rhs)
2724 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2728 gimple_cond_single_var_p (gimple gs)
2730 if (gimple_cond_code (gs) == NE_EXPR
2731 && gimple_cond_rhs (gs) == boolean_false_node)
2734 if (gimple_cond_code (gs) == EQ_EXPR
2735 && gimple_cond_rhs (gs) == boolean_true_node)
2741 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2744 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2746 gimple_cond_set_code (stmt, code);
2747 gimple_cond_set_lhs (stmt, lhs);
2748 gimple_cond_set_rhs (stmt, rhs);
2751 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2754 gimple_label_label (const_gimple gs)
2756 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2757 return gimple_op (gs, 0);
2761 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2765 gimple_label_set_label (gimple gs, tree label)
2767 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2768 gimple_set_op (gs, 0, label);
2772 /* Return the destination of the unconditional jump GS. */
2775 gimple_goto_dest (const_gimple gs)
2777 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2778 return gimple_op (gs, 0);
2782 /* Set DEST to be the destination of the unconditonal jump GS. */
2785 gimple_goto_set_dest (gimple gs, tree dest)
2787 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2788 gimple_set_op (gs, 0, dest);
2792 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2795 gimple_bind_vars (const_gimple gs)
2797 GIMPLE_CHECK (gs, GIMPLE_BIND);
2798 return gs->gimple_bind.vars;
2802 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2806 gimple_bind_set_vars (gimple gs, tree vars)
2808 GIMPLE_CHECK (gs, GIMPLE_BIND);
2809 gs->gimple_bind.vars = vars;
2813 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2817 gimple_bind_append_vars (gimple gs, tree vars)
2819 GIMPLE_CHECK (gs, GIMPLE_BIND);
2820 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2824 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2826 static inline gimple_seq
2827 gimple_bind_body (gimple gs)
2829 GIMPLE_CHECK (gs, GIMPLE_BIND);
2830 return gs->gimple_bind.body;
2834 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2838 gimple_bind_set_body (gimple gs, gimple_seq seq)
2840 GIMPLE_CHECK (gs, GIMPLE_BIND);
2841 gs->gimple_bind.body = seq;
2845 /* Append a statement to the end of a GIMPLE_BIND's body. */
2848 gimple_bind_add_stmt (gimple gs, gimple stmt)
2850 GIMPLE_CHECK (gs, GIMPLE_BIND);
2851 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2855 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2858 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2860 GIMPLE_CHECK (gs, GIMPLE_BIND);
2861 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2865 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2866 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2869 gimple_bind_block (const_gimple gs)
2871 GIMPLE_CHECK (gs, GIMPLE_BIND);
2872 return gs->gimple_bind.block;
2876 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2880 gimple_bind_set_block (gimple gs, tree block)
2882 GIMPLE_CHECK (gs, GIMPLE_BIND);
2883 gcc_gimple_checking_assert (block == NULL_TREE
2884 || TREE_CODE (block) == BLOCK);
2885 gs->gimple_bind.block = block;
2889 /* Return the number of input operands for GIMPLE_ASM GS. */
2891 static inline unsigned
2892 gimple_asm_ninputs (const_gimple gs)
2894 GIMPLE_CHECK (gs, GIMPLE_ASM);
2895 return gs->gimple_asm.ni;
2899 /* Return the number of output operands for GIMPLE_ASM GS. */
2901 static inline unsigned
2902 gimple_asm_noutputs (const_gimple gs)
2904 GIMPLE_CHECK (gs, GIMPLE_ASM);
2905 return gs->gimple_asm.no;
2909 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2911 static inline unsigned
2912 gimple_asm_nclobbers (const_gimple gs)
2914 GIMPLE_CHECK (gs, GIMPLE_ASM);
2915 return gs->gimple_asm.nc;
2918 /* Return the number of label operands for GIMPLE_ASM GS. */
2920 static inline unsigned
2921 gimple_asm_nlabels (const_gimple gs)
2923 GIMPLE_CHECK (gs, GIMPLE_ASM);
2924 return gs->gimple_asm.nl;
2927 /* Return input operand INDEX of GIMPLE_ASM GS. */
2930 gimple_asm_input_op (const_gimple gs, unsigned index)
2932 GIMPLE_CHECK (gs, GIMPLE_ASM);
2933 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2934 return gimple_op (gs, index);
2937 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2939 static inline tree *
2940 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2942 GIMPLE_CHECK (gs, GIMPLE_ASM);
2943 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2944 return gimple_op_ptr (gs, index);
2948 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2951 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2953 GIMPLE_CHECK (gs, GIMPLE_ASM);
2954 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2955 && TREE_CODE (in_op) == TREE_LIST);
2956 gimple_set_op (gs, index, in_op);
2960 /* Return output operand INDEX of GIMPLE_ASM GS. */
2963 gimple_asm_output_op (const_gimple gs, unsigned index)
2965 GIMPLE_CHECK (gs, GIMPLE_ASM);
2966 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2967 return gimple_op (gs, index + gs->gimple_asm.ni);
2970 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2972 static inline tree *
2973 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2975 GIMPLE_CHECK (gs, GIMPLE_ASM);
2976 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2977 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2981 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2984 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2986 GIMPLE_CHECK (gs, GIMPLE_ASM);
2987 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2988 && TREE_CODE (out_op) == TREE_LIST);
2989 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2993 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2996 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2998 GIMPLE_CHECK (gs, GIMPLE_ASM);
2999 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
3000 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
3004 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3007 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3009 GIMPLE_CHECK (gs, GIMPLE_ASM);
3010 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3011 && TREE_CODE (clobber_op) == TREE_LIST);
3012 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3015 /* Return label operand INDEX of GIMPLE_ASM GS. */
3018 gimple_asm_label_op (const_gimple gs, unsigned index)
3020 GIMPLE_CHECK (gs, GIMPLE_ASM);
3021 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3022 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3025 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3028 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3030 GIMPLE_CHECK (gs, GIMPLE_ASM);
3031 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3032 && TREE_CODE (label_op) == TREE_LIST);
3033 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3036 /* Return the string representing the assembly instruction in
3039 static inline const char *
3040 gimple_asm_string (const_gimple gs)
3042 GIMPLE_CHECK (gs, GIMPLE_ASM);
3043 return gs->gimple_asm.string;
3047 /* Return true if GS is an asm statement marked volatile. */
3050 gimple_asm_volatile_p (const_gimple gs)
3052 GIMPLE_CHECK (gs, GIMPLE_ASM);
3053 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3057 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3060 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3062 GIMPLE_CHECK (gs, GIMPLE_ASM);
3064 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3066 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3070 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3073 gimple_asm_set_input (gimple gs, bool input_p)
3075 GIMPLE_CHECK (gs, GIMPLE_ASM);
3077 gs->gsbase.subcode |= GF_ASM_INPUT;
3079 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3083 /* Return true if asm GS is an ASM_INPUT. */
3086 gimple_asm_input_p (const_gimple gs)
3088 GIMPLE_CHECK (gs, GIMPLE_ASM);
3089 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3093 /* Return the types handled by GIMPLE_CATCH statement GS. */
3096 gimple_catch_types (const_gimple gs)
3098 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3099 return gs->gimple_catch.types;
3103 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3105 static inline tree *
3106 gimple_catch_types_ptr (gimple gs)
3108 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3109 return &gs->gimple_catch.types;
3113 /* Return the GIMPLE sequence representing the body of the handler of
3114 GIMPLE_CATCH statement GS. */
3116 static inline gimple_seq
3117 gimple_catch_handler (gimple gs)
3119 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3120 return gs->gimple_catch.handler;
3124 /* Return a pointer to the GIMPLE sequence representing the body of
3125 the handler of GIMPLE_CATCH statement GS. */
3127 static inline gimple_seq *
3128 gimple_catch_handler_ptr (gimple gs)
3130 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3131 return &gs->gimple_catch.handler;
3135 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3138 gimple_catch_set_types (gimple gs, tree t)
3140 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3141 gs->gimple_catch.types = t;
3145 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3148 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3150 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3151 gs->gimple_catch.handler = handler;
3155 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3158 gimple_eh_filter_types (const_gimple gs)
3160 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3161 return gs->gimple_eh_filter.types;
3165 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3168 static inline tree *
3169 gimple_eh_filter_types_ptr (gimple gs)
3171 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3172 return &gs->gimple_eh_filter.types;
3176 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3179 static inline gimple_seq
3180 gimple_eh_filter_failure (gimple gs)
3182 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3183 return gs->gimple_eh_filter.failure;
3187 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3190 gimple_eh_filter_set_types (gimple gs, tree types)
3192 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3193 gs->gimple_eh_filter.types = types;
3197 /* Set FAILURE to be the sequence of statements to execute on failure
3198 for GIMPLE_EH_FILTER GS. */
3201 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3203 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3204 gs->gimple_eh_filter.failure = failure;
3207 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3210 gimple_eh_must_not_throw_fndecl (gimple gs)
3212 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3213 return gs->gimple_eh_mnt.fndecl;
3216 /* Set the function decl to be called by GS to DECL. */
3219 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3221 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3222 gs->gimple_eh_mnt.fndecl = decl;
3225 /* GIMPLE_EH_ELSE accessors. */
3227 static inline gimple_seq
3228 gimple_eh_else_n_body (gimple gs)
3230 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3231 return gs->gimple_eh_else.n_body;
3234 static inline gimple_seq
3235 gimple_eh_else_e_body (gimple gs)
3237 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3238 return gs->gimple_eh_else.e_body;
3242 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3244 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3245 gs->gimple_eh_else.n_body = seq;
3249 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3251 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3252 gs->gimple_eh_else.e_body = seq;
3255 /* GIMPLE_TRY accessors. */
3257 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3258 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3260 static inline enum gimple_try_flags
3261 gimple_try_kind (const_gimple gs)
3263 GIMPLE_CHECK (gs, GIMPLE_TRY);
3264 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3268 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3271 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3273 GIMPLE_CHECK (gs, GIMPLE_TRY);
3274 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3275 || kind == GIMPLE_TRY_FINALLY);
3276 if (gimple_try_kind (gs) != kind)
3277 gs->gsbase.subcode = (unsigned int) kind;
3281 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3284 gimple_try_catch_is_cleanup (const_gimple gs)
3286 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3287 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3291 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3293 static inline gimple_seq
3294 gimple_try_eval (gimple gs)
3296 GIMPLE_CHECK (gs, GIMPLE_TRY);
3297 return gs->gimple_try.eval;
3301 /* Return the sequence of statements used as the cleanup body for
3304 static inline gimple_seq
3305 gimple_try_cleanup (gimple gs)
3307 GIMPLE_CHECK (gs, GIMPLE_TRY);
3308 return gs->gimple_try.cleanup;
3312 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3315 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3317 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3318 if (catch_is_cleanup)
3319 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3321 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3325 /* Set EVAL to be the sequence of statements to use as the body for
3329 gimple_try_set_eval (gimple gs, gimple_seq eval)
3331 GIMPLE_CHECK (gs, GIMPLE_TRY);
3332 gs->gimple_try.eval = eval;
3336 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3337 body for GIMPLE_TRY GS. */
3340 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3342 GIMPLE_CHECK (gs, GIMPLE_TRY);
3343 gs->gimple_try.cleanup = cleanup;
3347 /* Return the cleanup sequence for cleanup statement GS. */
3349 static inline gimple_seq
3350 gimple_wce_cleanup (gimple gs)
3352 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3353 return gs->gimple_wce.cleanup;
3357 /* Set CLEANUP to be the cleanup sequence for GS. */
3360 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3362 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3363 gs->gimple_wce.cleanup = cleanup;
3367 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3370 gimple_wce_cleanup_eh_only (const_gimple gs)
3372 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3373 return gs->gsbase.subcode != 0;
3377 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3380 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3382 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3383 gs->gsbase.subcode = (unsigned int) eh_only_p;
3387 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3389 static inline unsigned
3390 gimple_phi_capacity (const_gimple gs)
3392 GIMPLE_CHECK (gs, GIMPLE_PHI);
3393 return gs->gimple_phi.capacity;
3397 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3398 be exactly the number of incoming edges for the basic block holding
3401 static inline unsigned
3402 gimple_phi_num_args (const_gimple gs)
3404 GIMPLE_CHECK (gs, GIMPLE_PHI);
3405 return gs->gimple_phi.nargs;
3409 /* Return the SSA name created by GIMPLE_PHI GS. */
3412 gimple_phi_result (const_gimple gs)
3414 GIMPLE_CHECK (gs, GIMPLE_PHI);
3415 return gs->gimple_phi.result;
3418 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3420 static inline tree *
3421 gimple_phi_result_ptr (gimple gs)
3423 GIMPLE_CHECK (gs, GIMPLE_PHI);
3424 return &gs->gimple_phi.result;
3427 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3430 gimple_phi_set_result (gimple gs, tree result)
3432 GIMPLE_CHECK (gs, GIMPLE_PHI);
3433 gs->gimple_phi.result = result;
3437 /* Return the PHI argument corresponding to incoming edge INDEX for
3440 static inline struct phi_arg_d *
3441 gimple_phi_arg (gimple gs, unsigned index)
3443 GIMPLE_CHECK (gs, GIMPLE_PHI);
3444 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3445 return &(gs->gimple_phi.args[index]);
3448 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3449 for GIMPLE_PHI GS. */
3452 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3454 GIMPLE_CHECK (gs, GIMPLE_PHI);
3455 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3456 gs->gimple_phi.args[index] = *phiarg;
3459 /* Return the region number for GIMPLE_RESX GS. */
3462 gimple_resx_region (const_gimple gs)
3464 GIMPLE_CHECK (gs, GIMPLE_RESX);
3465 return gs->gimple_eh_ctrl.region;
3468 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3471 gimple_resx_set_region (gimple gs, int region)
3473 GIMPLE_CHECK (gs, GIMPLE_RESX);
3474 gs->gimple_eh_ctrl.region = region;
3477 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3480 gimple_eh_dispatch_region (const_gimple gs)
3482 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3483 return gs->gimple_eh_ctrl.region;
3486 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3489 gimple_eh_dispatch_set_region (gimple gs, int region)
3491 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3492 gs->gimple_eh_ctrl.region = region;
3495 /* Return the number of labels associated with the switch statement GS. */
3497 static inline unsigned
3498 gimple_switch_num_labels (const_gimple gs)
3501 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3502 num_ops = gimple_num_ops (gs);
3503 gcc_gimple_checking_assert (num_ops > 1);
3508 /* Set NLABELS to be the number of labels for the switch statement GS. */
3511 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3513 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3514 gimple_set_num_ops (g, nlabels + 1);
3518 /* Return the index variable used by the switch statement GS. */
3521 gimple_switch_index (const_gimple gs)
3523 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3524 return gimple_op (gs, 0);
3528 /* Return a pointer to the index variable for the switch statement GS. */
3530 static inline tree *
3531 gimple_switch_index_ptr (const_gimple gs)
3533 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3534 return gimple_op_ptr (gs, 0);
3538 /* Set INDEX to be the index variable for switch statement GS. */
3541 gimple_switch_set_index (gimple gs, tree index)
3543 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3544 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3545 gimple_set_op (gs, 0, index);
3549 /* Return the label numbered INDEX. The default label is 0, followed by any
3550 labels in a switch statement. */
3553 gimple_switch_label (const_gimple gs, unsigned index)
3555 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3556 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3557 return gimple_op (gs, index + 1);
3560 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3563 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3565 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3566 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3567 && (label == NULL_TREE
3568 || TREE_CODE (label) == CASE_LABEL_EXPR));
3569 gimple_set_op (gs, index + 1, label);
3572 /* Return the default label for a switch statement. */
3575 gimple_switch_default_label (const_gimple gs)
3577 return gimple_switch_label (gs, 0);
3580 /* Set the default label for a switch statement. */
3583 gimple_switch_set_default_label (gimple gs, tree label)
3585 gimple_switch_set_label (gs, 0, label);
3588 /* Return true if GS is a GIMPLE_DEBUG statement. */
3591 is_gimple_debug (const_gimple gs)
3593 return gimple_code (gs) == GIMPLE_DEBUG;
3596 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3599 gimple_debug_bind_p (const_gimple s)
3601 if (is_gimple_debug (s))
3602 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3607 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3610 gimple_debug_bind_get_var (gimple dbg)
3612 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3613 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3614 return gimple_op (dbg, 0);
3617 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3621 gimple_debug_bind_get_value (gimple dbg)
3623 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3624 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3625 return gimple_op (dbg, 1);
3628 /* Return a pointer to the value bound to the variable in a
3629 GIMPLE_DEBUG bind statement. */
3631 static inline tree *
3632 gimple_debug_bind_get_value_ptr (gimple dbg)
3634 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3635 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3636 return gimple_op_ptr (dbg, 1);
3639 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3642 gimple_debug_bind_set_var (gimple dbg, tree var)
3644 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3645 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3646 gimple_set_op (dbg, 0, var);
3649 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3653 gimple_debug_bind_set_value (gimple dbg, tree value)
3655 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3656 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3657 gimple_set_op (dbg, 1, value);
3660 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3662 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3664 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3668 gimple_debug_bind_reset_value (gimple dbg)
3670 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3671 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3672 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3675 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3679 gimple_debug_bind_has_value_p (gimple dbg)
3681 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3682 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3683 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3686 #undef GIMPLE_DEBUG_BIND_NOVALUE
3688 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3691 gimple_debug_source_bind_p (const_gimple s)
3693 if (is_gimple_debug (s))
3694 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3699 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3702 gimple_debug_source_bind_get_var (gimple dbg)
3704 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3705 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3706 return gimple_op (dbg, 0);
3709 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3713 gimple_debug_source_bind_get_value (gimple dbg)
3715 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3716 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3717 return gimple_op (dbg, 1);
3720 /* Return a pointer to the value bound to the variable in a
3721 GIMPLE_DEBUG source bind statement. */
3723 static inline tree *
3724 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3726 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3727 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3728 return gimple_op_ptr (dbg, 1);
3731 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3734 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3736 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3737 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3738 gimple_set_op (dbg, 0, var);
3741 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3745 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3747 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3748 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3749 gimple_set_op (dbg, 1, value);
3752 /* Return the body for the OMP statement GS. */
3754 static inline gimple_seq
3755 gimple_omp_body (gimple gs)
3757 return gs->omp.body;
3760 /* Set BODY to be the body for the OMP statement GS. */
3763 gimple_omp_set_body (gimple gs, gimple_seq body)
3765 gs->omp.body = body;
3769 /* Return the name associated with OMP_CRITICAL statement GS. */
3772 gimple_omp_critical_name (const_gimple gs)
3774 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3775 return gs->gimple_omp_critical.name;
3779 /* Return a pointer to the name associated with OMP critical statement GS. */
3781 static inline tree *
3782 gimple_omp_critical_name_ptr (gimple gs)
3784 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3785 return &gs->gimple_omp_critical.name;
3789 /* Set NAME to be the name associated with OMP critical statement GS. */
3792 gimple_omp_critical_set_name (gimple gs, tree name)
3794 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3795 gs->gimple_omp_critical.name = name;
3799 /* Return the clauses associated with OMP_FOR GS. */
3802 gimple_omp_for_clauses (const_gimple gs)
3804 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3805 return gs->gimple_omp_for.clauses;
3809 /* Return a pointer to the OMP_FOR GS. */
3811 static inline tree *
3812 gimple_omp_for_clauses_ptr (gimple gs)
3814 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3815 return &gs->gimple_omp_for.clauses;
3819 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3822 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3824 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3825 gs->gimple_omp_for.clauses = clauses;
3829 /* Get the collapse count of OMP_FOR GS. */
3831 static inline size_t
3832 gimple_omp_for_collapse (gimple gs)
3834 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3835 return gs->gimple_omp_for.collapse;
3839 /* Return the index variable for OMP_FOR GS. */
3842 gimple_omp_for_index (const_gimple gs, size_t i)
3844 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3845 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3846 return gs->gimple_omp_for.iter[i].index;
3850 /* Return a pointer to the index variable for OMP_FOR GS. */
3852 static inline tree *
3853 gimple_omp_for_index_ptr (gimple gs, size_t i)
3855 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3856 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3857 return &gs->gimple_omp_for.iter[i].index;
3861 /* Set INDEX to be the index variable for OMP_FOR GS. */
3864 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3866 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3867 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3868 gs->gimple_omp_for.iter[i].index = index;
3872 /* Return the initial value for OMP_FOR GS. */
3875 gimple_omp_for_initial (const_gimple gs, size_t i)
3877 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3878 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3879 return gs->gimple_omp_for.iter[i].initial;
3883 /* Return a pointer to the initial value for OMP_FOR GS. */
3885 static inline tree *
3886 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3888 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3889 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3890 return &gs->gimple_omp_for.iter[i].initial;
3894 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3897 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3899 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3900 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3901 gs->gimple_omp_for.iter[i].initial = initial;
3905 /* Return the final value for OMP_FOR GS. */
3908 gimple_omp_for_final (const_gimple gs, size_t i)
3910 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3911 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3912 return gs->gimple_omp_for.iter[i].final;
3916 /* Return a pointer to the final value for OMP_FOR GS. */
3918 static inline tree *
3919 gimple_omp_for_final_ptr (gimple gs, size_t i)
3921 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3922 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3923 return &gs->gimple_omp_for.iter[i].final;
3927 /* Set FINAL to be the final value for OMP_FOR GS. */
3930 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3932 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3933 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3934 gs->gimple_omp_for.iter[i].final = final;
3938 /* Return the increment value for OMP_FOR GS. */
3941 gimple_omp_for_incr (const_gimple gs, size_t i)
3943 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3944 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3945 return gs->gimple_omp_for.iter[i].incr;
3949 /* Return a pointer to the increment value for OMP_FOR GS. */
3951 static inline tree *
3952 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3954 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3955 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3956 return &gs->gimple_omp_for.iter[i].incr;
3960 /* Set INCR to be the increment value for OMP_FOR GS. */
3963 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3965 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3966 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3967 gs->gimple_omp_for.iter[i].incr = incr;
3971 /* Return the sequence of statements to execute before the OMP_FOR
3972 statement GS starts. */
3974 static inline gimple_seq
3975 gimple_omp_for_pre_body (gimple gs)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3978 return gs->gimple_omp_for.pre_body;
3982 /* Set PRE_BODY to be the sequence of statements to execute before the
3983 OMP_FOR statement GS starts. */
3986 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3988 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3989 gs->gimple_omp_for.pre_body = pre_body;
3993 /* Return the clauses associated with OMP_PARALLEL GS. */
3996 gimple_omp_parallel_clauses (const_gimple gs)
3998 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3999 return gs->gimple_omp_parallel.clauses;
4003 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4005 static inline tree *
4006 gimple_omp_parallel_clauses_ptr (gimple gs)
4008 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4009 return &gs->gimple_omp_parallel.clauses;
4013 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4017 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4019 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4020 gs->gimple_omp_parallel.clauses = clauses;
4024 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4027 gimple_omp_parallel_child_fn (const_gimple gs)
4029 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4030 return gs->gimple_omp_parallel.child_fn;
4033 /* Return a pointer to the child function used to hold the body of
4036 static inline tree *
4037 gimple_omp_parallel_child_fn_ptr (gimple gs)
4039 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4040 return &gs->gimple_omp_parallel.child_fn;
4044 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4047 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4049 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4050 gs->gimple_omp_parallel.child_fn = child_fn;
4054 /* Return the artificial argument used to send variables and values
4055 from the parent to the children threads in OMP_PARALLEL GS. */
4058 gimple_omp_parallel_data_arg (const_gimple gs)
4060 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4061 return gs->gimple_omp_parallel.data_arg;
4065 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4067 static inline tree *
4068 gimple_omp_parallel_data_arg_ptr (gimple gs)
4070 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4071 return &gs->gimple_omp_parallel.data_arg;
4075 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4078 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4080 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4081 gs->gimple_omp_parallel.data_arg = data_arg;
4085 /* Return the clauses associated with OMP_TASK GS. */
4088 gimple_omp_task_clauses (const_gimple gs)
4090 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4091 return gs->gimple_omp_parallel.clauses;
4095 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4097 static inline tree *
4098 gimple_omp_task_clauses_ptr (gimple gs)
4100 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4101 return &gs->gimple_omp_parallel.clauses;
4105 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4109 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4111 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4112 gs->gimple_omp_parallel.clauses = clauses;
4116 /* Return the child function used to hold the body of OMP_TASK GS. */
4119 gimple_omp_task_child_fn (const_gimple gs)
4121 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4122 return gs->gimple_omp_parallel.child_fn;
4125 /* Return a pointer to the child function used to hold the body of
4128 static inline tree *
4129 gimple_omp_task_child_fn_ptr (gimple gs)
4131 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4132 return &gs->gimple_omp_parallel.child_fn;
4136 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4139 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4141 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4142 gs->gimple_omp_parallel.child_fn = child_fn;
4146 /* Return the artificial argument used to send variables and values
4147 from the parent to the children threads in OMP_TASK GS. */
4150 gimple_omp_task_data_arg (const_gimple gs)
4152 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4153 return gs->gimple_omp_parallel.data_arg;
4157 /* Return a pointer to the data argument for OMP_TASK GS. */
4159 static inline tree *
4160 gimple_omp_task_data_arg_ptr (gimple gs)
4162 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4163 return &gs->gimple_omp_parallel.data_arg;
4167 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4170 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4172 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4173 gs->gimple_omp_parallel.data_arg = data_arg;
4177 /* Return the clauses associated with OMP_TASK GS. */
4180 gimple_omp_taskreg_clauses (const_gimple gs)
4182 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4183 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4184 return gs->gimple_omp_parallel.clauses;
4188 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4190 static inline tree *
4191 gimple_omp_taskreg_clauses_ptr (gimple gs)
4193 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4194 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4195 return &gs->gimple_omp_parallel.clauses;
4199 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4203 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4205 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4206 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4207 gs->gimple_omp_parallel.clauses = clauses;
4211 /* Return the child function used to hold the body of OMP_TASK GS. */
4214 gimple_omp_taskreg_child_fn (const_gimple gs)
4216 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4217 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4218 return gs->gimple_omp_parallel.child_fn;
4221 /* Return a pointer to the child function used to hold the body of
4224 static inline tree *
4225 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4227 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4228 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4229 return &gs->gimple_omp_parallel.child_fn;
4233 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4236 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4238 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4239 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4240 gs->gimple_omp_parallel.child_fn = child_fn;
4244 /* Return the artificial argument used to send variables and values
4245 from the parent to the children threads in OMP_TASK GS. */
4248 gimple_omp_taskreg_data_arg (const_gimple gs)
4250 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4251 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4252 return gs->gimple_omp_parallel.data_arg;
4256 /* Return a pointer to the data argument for OMP_TASK GS. */
4258 static inline tree *
4259 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4261 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4262 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4263 return &gs->gimple_omp_parallel.data_arg;
4267 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4270 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4272 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4273 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4274 gs->gimple_omp_parallel.data_arg = data_arg;
4278 /* Return the copy function used to hold the body of OMP_TASK GS. */
4281 gimple_omp_task_copy_fn (const_gimple gs)
4283 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4284 return gs->gimple_omp_task.copy_fn;
4287 /* Return a pointer to the copy function used to hold the body of
4290 static inline tree *
4291 gimple_omp_task_copy_fn_ptr (gimple gs)
4293 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4294 return &gs->gimple_omp_task.copy_fn;
4298 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4301 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4303 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4304 gs->gimple_omp_task.copy_fn = copy_fn;
4308 /* Return size of the data block in bytes in OMP_TASK GS. */
4311 gimple_omp_task_arg_size (const_gimple gs)
4313 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4314 return gs->gimple_omp_task.arg_size;
4318 /* Return a pointer to the data block size for OMP_TASK GS. */
4320 static inline tree *
4321 gimple_omp_task_arg_size_ptr (gimple gs)
4323 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4324 return &gs->gimple_omp_task.arg_size;
4328 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4331 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4333 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4334 gs->gimple_omp_task.arg_size = arg_size;
4338 /* Return align of the data block in bytes in OMP_TASK GS. */
4341 gimple_omp_task_arg_align (const_gimple gs)
4343 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4344 return gs->gimple_omp_task.arg_align;
4348 /* Return a pointer to the data block align for OMP_TASK GS. */
4350 static inline tree *
4351 gimple_omp_task_arg_align_ptr (gimple gs)
4353 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4354 return &gs->gimple_omp_task.arg_align;
4358 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4361 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4363 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4364 gs->gimple_omp_task.arg_align = arg_align;
4368 /* Return the clauses associated with OMP_SINGLE GS. */
4371 gimple_omp_single_clauses (const_gimple gs)
4373 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4374 return gs->gimple_omp_single.clauses;
4378 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4380 static inline tree *
4381 gimple_omp_single_clauses_ptr (gimple gs)
4383 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4384 return &gs->gimple_omp_single.clauses;
4388 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4391 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4393 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4394 gs->gimple_omp_single.clauses = clauses;
4398 /* Return the clauses associated with OMP_SECTIONS GS. */
4401 gimple_omp_sections_clauses (const_gimple gs)
4403 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4404 return gs->gimple_omp_sections.clauses;
4408 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4410 static inline tree *
4411 gimple_omp_sections_clauses_ptr (gimple gs)
4413 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4414 return &gs->gimple_omp_sections.clauses;
4418 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4422 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4424 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4425 gs->gimple_omp_sections.clauses = clauses;
4429 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4433 gimple_omp_sections_control (const_gimple gs)
4435 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4436 return gs->gimple_omp_sections.control;
4440 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4443 static inline tree *
4444 gimple_omp_sections_control_ptr (gimple gs)
4446 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4447 return &gs->gimple_omp_sections.control;
4451 /* Set CONTROL to be the set of clauses associated with the
4452 GIMPLE_OMP_SECTIONS in GS. */
4455 gimple_omp_sections_set_control (gimple gs, tree control)
4457 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4458 gs->gimple_omp_sections.control = control;
4462 /* Set COND to be the condition code for OMP_FOR GS. */
4465 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4467 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4468 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4469 && i < gs->gimple_omp_for.collapse);
4470 gs->gimple_omp_for.iter[i].cond = cond;
4474 /* Return the condition code associated with OMP_FOR GS. */
4476 static inline enum tree_code
4477 gimple_omp_for_cond (const_gimple gs, size_t i)
4479 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4480 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4481 return gs->gimple_omp_for.iter[i].cond;
4485 /* Set the value being stored in an atomic store. */
4488 gimple_omp_atomic_store_set_val (gimple g, tree val)
4490 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4491 g->gimple_omp_atomic_store.val = val;
4495 /* Return the value being stored in an atomic store. */
4498 gimple_omp_atomic_store_val (const_gimple g)
4500 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4501 return g->gimple_omp_atomic_store.val;
4505 /* Return a pointer to the value being stored in an atomic store. */
4507 static inline tree *
4508 gimple_omp_atomic_store_val_ptr (gimple g)
4510 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4511 return &g->gimple_omp_atomic_store.val;
4515 /* Set the LHS of an atomic load. */
4518 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4520 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4521 g->gimple_omp_atomic_load.lhs = lhs;
4525 /* Get the LHS of an atomic load. */
4528 gimple_omp_atomic_load_lhs (const_gimple g)
4530 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4531 return g->gimple_omp_atomic_load.lhs;
4535 /* Return a pointer to the LHS of an atomic load. */
4537 static inline tree *
4538 gimple_omp_atomic_load_lhs_ptr (gimple g)
4540 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4541 return &g->gimple_omp_atomic_load.lhs;
4545 /* Set the RHS of an atomic load. */
4548 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4550 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4551 g->gimple_omp_atomic_load.rhs = rhs;
4555 /* Get the RHS of an atomic load. */
4558 gimple_omp_atomic_load_rhs (const_gimple g)
4560 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4561 return g->gimple_omp_atomic_load.rhs;
4565 /* Return a pointer to the RHS of an atomic load. */
4567 static inline tree *
4568 gimple_omp_atomic_load_rhs_ptr (gimple g)
4570 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4571 return &g->gimple_omp_atomic_load.rhs;
4575 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4578 gimple_omp_continue_control_def (const_gimple g)
4580 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4581 return g->gimple_omp_continue.control_def;
4584 /* The same as above, but return the address. */
4586 static inline tree *
4587 gimple_omp_continue_control_def_ptr (gimple g)
4589 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4590 return &g->gimple_omp_continue.control_def;
4593 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4596 gimple_omp_continue_set_control_def (gimple g, tree def)
4598 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4599 g->gimple_omp_continue.control_def = def;
4603 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4606 gimple_omp_continue_control_use (const_gimple g)
4608 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4609 return g->gimple_omp_continue.control_use;
4613 /* The same as above, but return the address. */
4615 static inline tree *
4616 gimple_omp_continue_control_use_ptr (gimple g)
4618 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4619 return &g->gimple_omp_continue.control_use;
4623 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4626 gimple_omp_continue_set_control_use (gimple g, tree use)
4628 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4629 g->gimple_omp_continue.control_use = use;
4632 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4634 static inline gimple_seq
4635 gimple_transaction_body (gimple gs)
4637 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4638 return gs->gimple_transaction.body;
4641 /* Return the label associated with a GIMPLE_TRANSACTION. */
4644 gimple_transaction_label (const_gimple gs)
4646 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4647 return gs->gimple_transaction.label;
4650 static inline tree *
4651 gimple_transaction_label_ptr (gimple gs)
4653 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4654 return &gs->gimple_transaction.label;
4657 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4659 static inline unsigned int
4660 gimple_transaction_subcode (const_gimple gs)
4662 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4663 return gs->gsbase.subcode;
4666 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4669 gimple_transaction_set_body (gimple gs, gimple_seq body)
4671 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4672 gs->gimple_transaction.body = body;
4675 /* Set the label associated with a GIMPLE_TRANSACTION. */
4678 gimple_transaction_set_label (gimple gs, tree label)
4680 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4681 gs->gimple_transaction.label = label;
4684 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4687 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4689 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4690 gs->gsbase.subcode = subcode;
4694 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4696 static inline tree *
4697 gimple_return_retval_ptr (const_gimple gs)
4699 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4700 return gimple_op_ptr (gs, 0);
4703 /* Return the return value for GIMPLE_RETURN GS. */
4706 gimple_return_retval (const_gimple gs)
4708 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4709 return gimple_op (gs, 0);
4713 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4716 gimple_return_set_retval (gimple gs, tree retval)
4718 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4719 gimple_set_op (gs, 0, retval);
4723 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4725 #define CASE_GIMPLE_OMP \
4726 case GIMPLE_OMP_PARALLEL: \
4727 case GIMPLE_OMP_TASK: \
4728 case GIMPLE_OMP_FOR: \
4729 case GIMPLE_OMP_SECTIONS: \
4730 case GIMPLE_OMP_SECTIONS_SWITCH: \
4731 case GIMPLE_OMP_SINGLE: \
4732 case GIMPLE_OMP_SECTION: \
4733 case GIMPLE_OMP_MASTER: \
4734 case GIMPLE_OMP_ORDERED: \
4735 case GIMPLE_OMP_CRITICAL: \
4736 case GIMPLE_OMP_RETURN: \
4737 case GIMPLE_OMP_ATOMIC_LOAD: \
4738 case GIMPLE_OMP_ATOMIC_STORE: \
4739 case GIMPLE_OMP_CONTINUE
4742 is_gimple_omp (const_gimple stmt)
4744 switch (gimple_code (stmt))
4754 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4757 gimple_nop_p (const_gimple g)
4759 return gimple_code (g) == GIMPLE_NOP;
4763 /* Return true if GS is a GIMPLE_RESX. */
4766 is_gimple_resx (const_gimple gs)
4768 return gimple_code (gs) == GIMPLE_RESX;
4771 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4773 static inline enum br_predictor
4774 gimple_predict_predictor (gimple gs)
4776 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4777 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4781 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4784 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4786 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4787 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4788 | (unsigned) predictor;
4792 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4794 static inline enum prediction
4795 gimple_predict_outcome (gimple gs)
4797 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4798 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4802 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4805 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4807 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4808 if (outcome == TAKEN)
4809 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4811 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4815 /* Return the type of the main expression computed by STMT. Return
4816 void_type_node if the statement computes nothing. */
4819 gimple_expr_type (const_gimple stmt)
4821 enum gimple_code code = gimple_code (stmt);
4823 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4826 /* In general we want to pass out a type that can be substituted
4827 for both the RHS and the LHS types if there is a possibly
4828 useless conversion involved. That means returning the
4829 original RHS type as far as we can reconstruct it. */
4830 if (code == GIMPLE_CALL)
4831 type = gimple_call_return_type (stmt);
4833 switch (gimple_assign_rhs_code (stmt))
4835 case POINTER_PLUS_EXPR:
4836 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4840 /* As fallback use the type of the LHS. */
4841 type = TREE_TYPE (gimple_get_lhs (stmt));
4846 else if (code == GIMPLE_COND)
4847 return boolean_type_node;
4849 return void_type_node;
4852 /* Return true if TYPE is a suitable type for a scalar register variable. */
4855 is_gimple_reg_type (tree type)
4857 return !AGGREGATE_TYPE_P (type);
4860 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4862 static inline gimple_stmt_iterator
4863 gsi_start (gimple_seq seq)
4865 gimple_stmt_iterator i;
4867 i.ptr = gimple_seq_first (seq);
4869 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4875 /* Return a new iterator pointing to the first statement in basic block BB. */
4877 static inline gimple_stmt_iterator
4878 gsi_start_bb (basic_block bb)
4880 gimple_stmt_iterator i;
4884 i.ptr = gimple_seq_first (seq);
4892 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4894 static inline gimple_stmt_iterator
4895 gsi_last (gimple_seq seq)
4897 gimple_stmt_iterator i;
4899 i.ptr = gimple_seq_last (seq);
4901 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4907 /* Return a new iterator pointing to the last statement in basic block BB. */
4909 static inline gimple_stmt_iterator
4910 gsi_last_bb (basic_block bb)
4912 gimple_stmt_iterator i;
4916 i.ptr = gimple_seq_last (seq);
4924 /* Return true if I is at the end of its sequence. */
4927 gsi_end_p (gimple_stmt_iterator i)
4929 return i.ptr == NULL;
4933 /* Return true if I is one statement before the end of its sequence. */
4936 gsi_one_before_end_p (gimple_stmt_iterator i)
4938 return i.ptr != NULL && i.ptr->next == NULL;
4942 /* Advance the iterator to the next gimple statement. */
4945 gsi_next (gimple_stmt_iterator *i)
4947 i->ptr = i->ptr->next;
4950 /* Advance the iterator to the previous gimple statement. */
4953 gsi_prev (gimple_stmt_iterator *i)
4955 i->ptr = i->ptr->prev;
4958 /* Return the current stmt. */
4960 static inline gimple
4961 gsi_stmt (gimple_stmt_iterator i)
4966 /* Return a block statement iterator that points to the first non-label
4967 statement in block BB. */
4969 static inline gimple_stmt_iterator
4970 gsi_after_labels (basic_block bb)
4972 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4974 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4980 /* Advance the iterator to the next non-debug gimple statement. */
4983 gsi_next_nondebug (gimple_stmt_iterator *i)
4989 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4992 /* Advance the iterator to the next non-debug gimple statement. */
4995 gsi_prev_nondebug (gimple_stmt_iterator *i)
5001 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
5004 /* Return a new iterator pointing to the first non-debug statement in
5007 static inline gimple_stmt_iterator
5008 gsi_start_nondebug_bb (basic_block bb)
5010 gimple_stmt_iterator i = gsi_start_bb (bb);
5012 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5013 gsi_next_nondebug (&i);
5018 /* Return a new iterator pointing to the last non-debug statement in
5021 static inline gimple_stmt_iterator
5022 gsi_last_nondebug_bb (basic_block bb)
5024 gimple_stmt_iterator i = gsi_last_bb (bb);
5026 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5027 gsi_prev_nondebug (&i);
5032 /* Return a pointer to the current stmt.
5034 NOTE: You may want to use gsi_replace on the iterator itself,
5035 as this performs additional bookkeeping that will not be done
5036 if you simply assign through a pointer returned by gsi_stmt_ptr. */
5038 static inline gimple *
5039 gsi_stmt_ptr (gimple_stmt_iterator *i)
5041 return &i->ptr->stmt;
5045 /* Return the basic block associated with this iterator. */
5047 static inline basic_block
5048 gsi_bb (gimple_stmt_iterator i)
5054 /* Return the sequence associated with this iterator. */
5056 static inline gimple_seq
5057 gsi_seq (gimple_stmt_iterator i)
5063 enum gsi_iterator_update
5065 GSI_NEW_STMT, /* Only valid when single statement is added, move
5067 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5068 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5069 for linking other statements in the same
5073 /* In gimple-iterator.c */
5074 gimple_stmt_iterator gsi_start_phis (basic_block);
5075 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5076 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
5077 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5078 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5079 enum gsi_iterator_update);
5080 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5081 enum gsi_iterator_update);
5082 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5083 enum gsi_iterator_update);
5084 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5085 enum gsi_iterator_update);
5086 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5087 enum gsi_iterator_update);
5088 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5089 enum gsi_iterator_update);
5090 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5091 enum gsi_iterator_update);
5092 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5093 enum gsi_iterator_update);
5094 void gsi_remove (gimple_stmt_iterator *, bool);
5095 gimple_stmt_iterator gsi_for_stmt (gimple);
5096 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5097 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5098 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
5099 void gsi_insert_on_edge (edge, gimple);
5100 void gsi_insert_seq_on_edge (edge, gimple_seq);
5101 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5102 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5103 void gsi_commit_one_edge_insert (edge, basic_block *);
5104 void gsi_commit_edge_inserts (void);
5105 gimple gimple_call_copy_skip_args (gimple, bitmap);
5108 /* Convenience routines to walk all statements of a gimple function.
5109 Note that this is useful exclusively before the code is converted
5110 into SSA form. Once the program is in SSA form, the standard
5111 operand interface should be used to analyze/modify statements. */
5112 struct walk_stmt_info
5114 /* Points to the current statement being walked. */
5115 gimple_stmt_iterator gsi;
5117 /* Additional data that the callback functions may want to carry
5118 through the recursion. */
5121 /* Pointer map used to mark visited tree nodes when calling
5122 walk_tree on each operand. If set to NULL, duplicate tree nodes
5123 will be visited more than once. */
5124 struct pointer_set_t *pset;
5126 /* Operand returned by the callbacks. This is set when calling
5127 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5128 returns non-NULL, this field will contain the tree returned by
5129 the last callback. */
5130 tree callback_result;
5132 /* Indicates whether the operand being examined may be replaced
5133 with something that matches is_gimple_val (if true) or something
5134 slightly more complicated (if false). "Something" technically
5135 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5136 but we never try to form anything more complicated than that, so
5137 we don't bother checking.
5139 Also note that CALLBACK should update this flag while walking the
5140 sub-expressions of a statement. For instance, when walking the
5141 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5142 to true, however, when walking &var, the operand of that
5143 ADDR_EXPR does not need to be a GIMPLE value. */
5144 BOOL_BITFIELD val_only : 1;
5146 /* True if we are currently walking the LHS of an assignment. */
5147 BOOL_BITFIELD is_lhs : 1;
5149 /* Optional. Set to true by the callback functions if they made any
5151 BOOL_BITFIELD changed : 1;
5153 /* True if we're interested in location information. */
5154 BOOL_BITFIELD want_locations : 1;
5156 /* True if we've removed the statement that was processed. */
5157 BOOL_BITFIELD removed_stmt : 1;
5160 /* Callback for walk_gimple_stmt. Called for every statement found
5161 during traversal. The first argument points to the statement to
5162 walk. The second argument is a flag that the callback sets to
5163 'true' if it the callback handled all the operands and
5164 sub-statements of the statement (the default value of this flag is
5165 'false'). The third argument is an anonymous pointer to data
5166 to be used by the callback. */
5167 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5168 struct walk_stmt_info *);
5170 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5171 struct walk_stmt_info *);
5172 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5173 struct walk_stmt_info *);
5174 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5176 #ifdef GATHER_STATISTICS
5177 /* Enum and arrays used for allocation stats. Keep in sync with
5178 gimple.c:gimple_alloc_kind_names. */
5179 enum gimple_alloc_kind
5181 gimple_alloc_kind_assign, /* Assignments. */
5182 gimple_alloc_kind_phi, /* PHI nodes. */
5183 gimple_alloc_kind_cond, /* Conditionals. */
5184 gimple_alloc_kind_seq, /* Sequences. */
5185 gimple_alloc_kind_rest, /* Everything else. */
5186 gimple_alloc_kind_all
5189 extern int gimple_alloc_counts[];
5190 extern int gimple_alloc_sizes[];
5192 /* Return the allocation kind for a given stmt CODE. */
5193 static inline enum gimple_alloc_kind
5194 gimple_alloc_kind (enum gimple_code code)
5199 return gimple_alloc_kind_assign;
5201 return gimple_alloc_kind_phi;
5203 return gimple_alloc_kind_cond;
5205 return gimple_alloc_kind_rest;
5208 #endif /* GATHER_STATISTICS */
5210 extern void dump_gimple_statistics (void);
5212 /* In gimple-fold.c. */
5213 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5214 tree gimple_fold_builtin (gimple);
5215 bool fold_stmt (gimple_stmt_iterator *);
5216 bool fold_stmt_inplace (gimple_stmt_iterator *);
5217 tree get_symbol_constant_value (tree);
5218 tree canonicalize_constructor_val (tree);
5219 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5220 enum tree_code, tree, tree);
5221 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5222 enum tree_code, tree, tree);
5224 bool gimple_val_nonnegative_real_p (tree);
5225 #endif /* GCC_GIMPLE_H */