1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010, 2011 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 /* Padding to get subcode to 16 bit alignment. */
311 /* The SUBCODE field can be used for tuple-specific flags for tuples
312 that do not require subcodes. Note that SUBCODE should be at
313 least as wide as tree codes, as several tuples store tree codes
315 unsigned int subcode : 16;
317 /* UID of this statement. This is used by passes that want to
318 assign IDs to statements. It must be assigned and used by each
319 pass. By default it should be assumed to contain garbage. */
323 Locus information for debug info. */
326 /* Number of operands in this tuple. */
330 Basic block holding this statement. */
331 struct basic_block_def *bb;
334 Lexical block holding this statement. */
339 /* Base structure for tuples with operands. */
341 struct GTY(()) gimple_statement_with_ops_base
344 struct gimple_statement_base gsbase;
347 SSA operand vectors. NOTE: It should be possible to
348 amalgamate these vectors with the operand vector OP. However,
349 the SSA operand vectors are organized differently and contain
350 more information (like immediate use chaining). */
351 struct def_optype_d GTY((skip (""))) *def_ops;
352 struct use_optype_d GTY((skip (""))) *use_ops;
356 /* Statements that take register operands. */
358 struct GTY(()) gimple_statement_with_ops
361 struct gimple_statement_with_ops_base opbase;
364 Operand vector. NOTE! This must always be the last field
365 of this structure. In particular, this means that this
366 structure cannot be embedded inside another one. */
367 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
371 /* Base for statements that take both memory and register operands. */
373 struct GTY(()) gimple_statement_with_memory_ops_base
376 struct gimple_statement_with_ops_base opbase;
379 Virtual operands for this statement. The GC will pick them
380 up via the ssa_names array. */
381 tree GTY((skip (""))) vdef;
382 tree GTY((skip (""))) vuse;
386 /* Statements that take both memory and register operands. */
388 struct GTY(()) gimple_statement_with_memory_ops
391 struct gimple_statement_with_memory_ops_base membase;
394 Operand vector. NOTE! This must always be the last field
395 of this structure. In particular, this means that this
396 structure cannot be embedded inside another one. */
397 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
401 /* Call statements that take both memory and register operands. */
403 struct GTY(()) gimple_statement_call
406 struct gimple_statement_with_memory_ops_base membase;
409 struct pt_solution call_used;
410 struct pt_solution call_clobbered;
413 union GTY ((desc ("%1.membase.opbase.gsbase.subcode & GF_CALL_INTERNAL"))) {
414 tree GTY ((tag ("0"))) fntype;
415 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
419 Operand vector. NOTE! This must always be the last field
420 of this structure. In particular, this means that this
421 structure cannot be embedded inside another one. */
422 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
426 /* OpenMP statements (#pragma omp). */
428 struct GTY(()) gimple_statement_omp {
430 struct gimple_statement_base gsbase;
439 struct GTY(()) gimple_statement_bind {
441 struct gimple_statement_base gsbase;
444 Variables declared in this scope. */
448 This is different than the BLOCK field in gimple_statement_base,
449 which is analogous to TREE_BLOCK (i.e., the lexical block holding
450 this statement). This field is the equivalent of BIND_EXPR_BLOCK
451 in tree land (i.e., the lexical scope defined by this bind). See
462 struct GTY(()) gimple_statement_catch {
464 struct gimple_statement_base gsbase;
474 /* GIMPLE_EH_FILTER */
476 struct GTY(()) gimple_statement_eh_filter {
478 struct gimple_statement_base gsbase;
491 struct GTY(()) gimple_statement_eh_else {
493 struct gimple_statement_base gsbase;
496 gimple_seq n_body, e_body;
499 /* GIMPLE_EH_MUST_NOT_THROW */
501 struct GTY(()) gimple_statement_eh_mnt {
503 struct gimple_statement_base gsbase;
505 /* [ WORD 5 ] Abort function decl. */
511 struct GTY(()) gimple_statement_phi {
513 struct gimple_statement_base gsbase;
523 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
527 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
529 struct GTY(()) gimple_statement_eh_ctrl
532 struct gimple_statement_base gsbase;
535 Exception region number. */
542 struct GTY(()) gimple_statement_try {
544 struct gimple_statement_base gsbase;
547 Expression to evaluate. */
551 Cleanup expression. */
555 /* Kind of GIMPLE_TRY statements. */
556 enum gimple_try_flags
559 GIMPLE_TRY_CATCH = 1 << 0,
562 GIMPLE_TRY_FINALLY = 1 << 1,
563 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
565 /* Analogous to TRY_CATCH_IS_CLEANUP. */
566 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
569 /* GIMPLE_WITH_CLEANUP_EXPR */
571 struct GTY(()) gimple_statement_wce {
573 struct gimple_statement_base gsbase;
575 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
576 executed if an exception is thrown, not on normal exit of its
577 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
581 Cleanup expression. */
588 struct GTY(()) gimple_statement_asm
591 struct gimple_statement_with_memory_ops_base membase;
594 __asm__ statement. */
598 Number of inputs, outputs, clobbers, labels. */
605 Operand vector. NOTE! This must always be the last field
606 of this structure. In particular, this means that this
607 structure cannot be embedded inside another one. */
608 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
611 /* GIMPLE_OMP_CRITICAL */
613 struct GTY(()) gimple_statement_omp_critical {
615 struct gimple_statement_omp omp;
618 Critical section name. */
623 struct GTY(()) gimple_omp_for_iter {
624 /* Condition code. */
627 /* Index variable. */
642 struct GTY(()) gimple_statement_omp_for {
644 struct gimple_statement_omp omp;
650 Number of elements in iter array. */
654 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
657 Pre-body evaluated before the loop body begins. */
662 /* GIMPLE_OMP_PARALLEL */
664 struct GTY(()) gimple_statement_omp_parallel {
666 struct gimple_statement_omp omp;
673 Child function holding the body of the parallel region. */
677 Shared data argument. */
682 /* GIMPLE_OMP_TASK */
684 struct GTY(()) gimple_statement_omp_task {
686 struct gimple_statement_omp_parallel par;
689 Child function holding firstprivate initialization if needed. */
693 Size and alignment in bytes of the argument data block. */
699 /* GIMPLE_OMP_SECTION */
700 /* Uses struct gimple_statement_omp. */
703 /* GIMPLE_OMP_SECTIONS */
705 struct GTY(()) gimple_statement_omp_sections {
707 struct gimple_statement_omp omp;
713 The control variable used for deciding which of the sections to
718 /* GIMPLE_OMP_CONTINUE.
720 Note: This does not inherit from gimple_statement_omp, because we
721 do not need the body field. */
723 struct GTY(()) gimple_statement_omp_continue {
725 struct gimple_statement_base gsbase;
734 /* GIMPLE_OMP_SINGLE */
736 struct GTY(()) gimple_statement_omp_single {
738 struct gimple_statement_omp omp;
745 /* GIMPLE_OMP_ATOMIC_LOAD.
746 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
747 contains a sequence, which we don't need here. */
749 struct GTY(()) gimple_statement_omp_atomic_load {
751 struct gimple_statement_base gsbase;
757 /* GIMPLE_OMP_ATOMIC_STORE.
758 See note on GIMPLE_OMP_ATOMIC_LOAD. */
760 struct GTY(()) gimple_statement_omp_atomic_store {
762 struct gimple_statement_base gsbase;
768 /* GIMPLE_TRANSACTION. */
770 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
772 /* The __transaction_atomic was declared [[outer]] or it is
773 __transaction_relaxed. */
774 #define GTMA_IS_OUTER (1u << 0)
775 #define GTMA_IS_RELAXED (1u << 1)
776 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
778 /* The transaction is seen to not have an abort. */
779 #define GTMA_HAVE_ABORT (1u << 2)
780 /* The transaction is seen to have loads or stores. */
781 #define GTMA_HAVE_LOAD (1u << 3)
782 #define GTMA_HAVE_STORE (1u << 4)
783 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
784 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
785 /* The transaction WILL enter serial irrevocable mode.
786 An irrevocable block post-dominates the entire transaction, such
787 that all invocations of the transaction will go serial-irrevocable.
788 In such case, we don't bother instrumenting the transaction, and
789 tell the runtime that it should begin the transaction in
790 serial-irrevocable mode. */
791 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
793 struct GTY(()) gimple_statement_transaction
796 struct gimple_statement_with_memory_ops_base gsbase;
805 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
806 enum gimple_statement_structure_enum {
807 #include "gsstruct.def"
813 /* Define the overall contents of a gimple tuple. It may be any of the
814 structures declared above for various types of tuples. */
816 union GTY ((desc ("gimple_statement_structure (&%h)"), variable_size)) gimple_statement_d {
817 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
818 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
819 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
820 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
821 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
822 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
823 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
824 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
825 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
826 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
827 struct gimple_statement_eh_else GTY ((tag ("GSS_EH_ELSE"))) gimple_eh_else;
828 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
829 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
830 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
831 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
832 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
833 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
834 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
835 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
836 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
837 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
838 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
839 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
840 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
841 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
842 struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
847 /* Offset in bytes to the location of the operand vector.
848 Zero if there is no operand vector for this tuple structure. */
849 extern size_t const gimple_ops_offset_[];
851 /* Map GIMPLE codes to GSS codes. */
852 extern enum gimple_statement_structure_enum const gss_for_code_[];
854 /* This variable holds the currently expanded gimple statement for purposes
855 of comminucating the profile info to the builtin expanders. */
856 extern gimple currently_expanding_gimple_stmt;
858 gimple gimple_build_return (tree);
860 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
861 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
863 void extract_ops_from_tree_1 (tree, enum tree_code *, tree *, tree *, tree *);
865 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
866 tree, tree MEM_STAT_DECL);
867 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
868 gimple_build_assign_with_ops_stat (c, o1, o2, o3, NULL_TREE MEM_STAT_INFO)
869 #define gimple_build_assign_with_ops3(c,o1,o2,o3,o4) \
870 gimple_build_assign_with_ops_stat (c, o1, o2, o3, o4 MEM_STAT_INFO)
872 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
873 #define gimple_build_debug_bind(var,val,stmt) \
874 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
875 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
876 #define gimple_build_debug_source_bind(var,val,stmt) \
877 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
879 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
880 gimple gimple_build_call (tree, unsigned, ...);
881 gimple gimple_build_call_valist (tree, unsigned, va_list);
882 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
883 gimple gimple_build_call_internal_vec (enum internal_fn, VEC(tree, heap) *);
884 gimple gimple_build_call_from_tree (tree);
885 gimple gimplify_assign (tree, tree, gimple_seq *);
886 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
887 gimple gimple_build_label (tree label);
888 gimple gimple_build_goto (tree dest);
889 gimple gimple_build_nop (void);
890 gimple gimple_build_bind (tree, gimple_seq, tree);
891 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
892 VEC(tree,gc) *, VEC(tree,gc) *);
893 gimple gimple_build_catch (tree, gimple_seq);
894 gimple gimple_build_eh_filter (tree, gimple_seq);
895 gimple gimple_build_eh_must_not_throw (tree);
896 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
897 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
898 gimple gimple_build_wce (gimple_seq);
899 gimple gimple_build_resx (int);
900 gimple gimple_build_eh_dispatch (int);
901 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
902 gimple gimple_build_switch (unsigned, tree, tree, ...);
903 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
904 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
905 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
906 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
907 gimple gimple_build_omp_critical (gimple_seq, tree);
908 gimple gimple_build_omp_section (gimple_seq);
909 gimple gimple_build_omp_continue (tree, tree);
910 gimple gimple_build_omp_master (gimple_seq);
911 gimple gimple_build_omp_return (bool);
912 gimple gimple_build_omp_ordered (gimple_seq);
913 gimple gimple_build_omp_sections (gimple_seq, tree);
914 gimple gimple_build_omp_sections_switch (void);
915 gimple gimple_build_omp_single (gimple_seq, tree);
916 gimple gimple_build_cdt (tree, tree);
917 gimple gimple_build_omp_atomic_load (tree, tree);
918 gimple gimple_build_omp_atomic_store (tree);
919 gimple gimple_build_transaction (gimple_seq, tree);
920 gimple gimple_build_predict (enum br_predictor, enum prediction);
921 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
922 void sort_case_labels (VEC(tree,heap) *);
923 void gimple_set_body (tree, gimple_seq);
924 gimple_seq gimple_body (tree);
925 bool gimple_has_body_p (tree);
926 gimple_seq gimple_seq_alloc (void);
927 void gimple_seq_free (gimple_seq);
928 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
929 gimple_seq gimple_seq_copy (gimple_seq);
930 bool gimple_call_same_target_p (const_gimple, const_gimple);
931 int gimple_call_flags (const_gimple);
932 int gimple_call_return_flags (const_gimple);
933 int gimple_call_arg_flags (const_gimple, unsigned);
934 void gimple_call_reset_alias_info (gimple);
935 bool gimple_assign_copy_p (gimple);
936 bool gimple_assign_ssa_name_copy_p (gimple);
937 bool gimple_assign_unary_nop_p (gimple);
938 void gimple_set_bb (gimple, struct basic_block_def *);
939 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
940 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
942 tree gimple_get_lhs (const_gimple);
943 void gimple_set_lhs (gimple, tree);
944 void gimple_replace_lhs (gimple, tree);
945 gimple gimple_copy (gimple);
946 void gimple_set_modified (gimple, bool);
947 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
948 gimple gimple_build_cond_from_tree (tree, tree, tree);
949 void gimple_cond_set_condition_from_tree (gimple, tree);
950 bool gimple_has_side_effects (const_gimple);
951 bool gimple_could_trap_p (gimple);
952 bool gimple_could_trap_p_1 (gimple, bool, bool);
953 bool gimple_assign_rhs_could_trap_p (gimple);
954 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
955 bool empty_body_p (gimple_seq);
956 unsigned get_gimple_rhs_num_ops (enum tree_code);
957 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
958 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
959 const char *gimple_decl_printable_name (tree, int);
960 tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree);
961 void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree);
962 tree gimple_extract_devirt_binfo_from_cst (tree);
963 /* Returns true iff T is a valid GIMPLE statement. */
964 extern bool is_gimple_stmt (tree);
966 /* Returns true iff TYPE is a valid type for a scalar register variable. */
967 extern bool is_gimple_reg_type (tree);
968 /* Returns true iff T is a scalar register variable. */
969 extern bool is_gimple_reg (tree);
970 /* Returns true iff T is any sort of variable. */
971 extern bool is_gimple_variable (tree);
972 /* Returns true iff T is any sort of symbol. */
973 extern bool is_gimple_id (tree);
974 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
975 extern bool is_gimple_min_lval (tree);
976 /* Returns true iff T is something whose address can be taken. */
977 extern bool is_gimple_addressable (tree);
978 /* Returns true iff T is any valid GIMPLE lvalue. */
979 extern bool is_gimple_lvalue (tree);
981 /* Returns true iff T is a GIMPLE address. */
982 bool is_gimple_address (const_tree);
983 /* Returns true iff T is a GIMPLE invariant address. */
984 bool is_gimple_invariant_address (const_tree);
985 /* Returns true iff T is a GIMPLE invariant address at interprocedural
987 bool is_gimple_ip_invariant_address (const_tree);
988 /* Returns true iff T is a valid GIMPLE constant. */
989 bool is_gimple_constant (const_tree);
990 /* Returns true iff T is a GIMPLE restricted function invariant. */
991 extern bool is_gimple_min_invariant (const_tree);
992 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
993 extern bool is_gimple_ip_invariant (const_tree);
994 /* Returns true iff T is a GIMPLE rvalue. */
995 extern bool is_gimple_val (tree);
996 /* Returns true iff T is a GIMPLE asm statement input. */
997 extern bool is_gimple_asm_val (tree);
998 /* Returns true iff T is a valid address operand of a MEM_REF. */
999 bool is_gimple_mem_ref_addr (tree);
1000 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
1001 GIMPLE temporary, a renamed user variable, or something else,
1003 extern bool is_gimple_reg_rhs (tree);
1004 extern bool is_gimple_mem_rhs (tree);
1006 /* Returns true iff T is a valid if-statement condition. */
1007 extern bool is_gimple_condexpr (tree);
1009 /* Returns true iff T is a variable that does not need to live in memory. */
1010 extern bool is_gimple_non_addressable (tree t);
1012 /* Returns true iff T is a valid call address expression. */
1013 extern bool is_gimple_call_addr (tree);
1015 extern void recalculate_side_effects (tree);
1016 extern bool gimple_compare_field_offset (tree, tree);
1017 extern tree gimple_register_type (tree);
1018 extern tree gimple_register_canonical_type (tree);
1019 extern void print_gimple_types_stats (void);
1020 extern void free_gimple_type_tables (void);
1021 extern tree gimple_unsigned_type (tree);
1022 extern tree gimple_signed_type (tree);
1023 extern alias_set_type gimple_get_alias_set (tree);
1024 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
1026 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
1027 bool (*)(gimple, tree, void *),
1028 bool (*)(gimple, tree, void *),
1029 bool (*)(gimple, tree, void *));
1030 extern bool walk_stmt_load_store_ops (gimple, void *,
1031 bool (*)(gimple, tree, void *),
1032 bool (*)(gimple, tree, void *));
1033 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1034 extern bool gimple_call_builtin_p (gimple, enum built_in_function);
1035 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1038 extern tree create_tmp_var_raw (tree, const char *);
1039 extern tree create_tmp_var_name (const char *);
1040 extern tree create_tmp_var (tree, const char *);
1041 extern tree create_tmp_reg (tree, const char *);
1042 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
1043 extern tree get_formal_tmp_var (tree, gimple_seq *);
1044 extern void declare_vars (tree, gimple, bool);
1045 extern void annotate_all_with_location (gimple_seq, location_t);
1047 /* Validation of GIMPLE expressions. Note that these predicates only check
1048 the basic form of the expression, they don't recurse to make sure that
1049 underlying nodes are also of the right form. */
1050 typedef bool (*gimple_predicate)(tree);
1053 /* FIXME we should deduce this from the predicate. */
1055 fb_none = 0, /* Do not generate a temporary. */
1057 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
1058 gimplified expression. */
1060 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
1061 gimplified expression. */
1063 fb_mayfail = 4, /* Gimplification may fail. Error issued
1065 fb_either= fb_rvalue | fb_lvalue
1068 typedef int fallback_t;
1070 enum gimplify_status {
1071 GS_ERROR = -2, /* Something Bad Seen. */
1072 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1073 GS_OK = 0, /* We did something, maybe more to do. */
1074 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1079 struct gimplify_ctx *prev_context;
1081 VEC(gimple,heap) *bind_expr_stack;
1083 gimple_seq conditional_cleanups;
1087 VEC(tree,heap) *case_labels;
1088 /* The formal temporary table. Should this be persistent? */
1094 bool allow_rhs_cond_expr;
1097 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1098 bool (*) (tree), fallback_t);
1099 extern void gimplify_type_sizes (tree, gimple_seq *);
1100 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1101 extern bool gimplify_stmt (tree *, gimple_seq *);
1102 extern gimple gimplify_body (tree *, tree, bool);
1103 extern void push_gimplify_context (struct gimplify_ctx *);
1104 extern void pop_gimplify_context (gimple);
1105 extern void gimplify_and_add (tree, gimple_seq *);
1107 /* Miscellaneous helpers. */
1108 extern void gimple_add_tmp_var (tree);
1109 extern gimple gimple_current_bind_expr (void);
1110 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1111 extern tree voidify_wrapper_expr (tree, tree);
1112 extern tree build_and_jump (tree *);
1113 extern tree force_labels_r (tree *, int *, void *);
1114 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1116 struct gimplify_omp_ctx;
1117 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1118 extern tree gimple_boolify (tree);
1119 extern gimple_predicate rhs_predicate_for (tree);
1120 extern tree canonicalize_cond_expr_cond (tree);
1123 extern tree omp_reduction_init (tree, tree);
1125 /* In trans-mem.c. */
1126 extern void diagnose_tm_safe_errors (tree);
1128 /* In tree-nested.c. */
1129 extern void lower_nested_functions (tree);
1130 extern void insert_field_into_struct (tree, tree);
1132 /* In gimplify.c. */
1133 extern void gimplify_function_tree (tree);
1135 /* In cfgexpand.c. */
1136 extern tree gimple_assign_rhs_to_tree (gimple);
1139 extern bool validate_gimple_arglist (const_gimple, ...);
1142 extern bool tree_ssa_useless_type_conversion (tree);
1143 extern tree tree_ssa_strip_useless_type_conversions (tree);
1144 extern bool useless_type_conversion_p (tree, tree);
1145 extern bool types_compatible_p (tree, tree);
1147 /* Return the code for GIMPLE statement G. */
1149 static inline enum gimple_code
1150 gimple_code (const_gimple g)
1152 return g->gsbase.code;
1156 /* Return the GSS code used by a GIMPLE code. */
1158 static inline enum gimple_statement_structure_enum
1159 gss_for_code (enum gimple_code code)
1161 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1162 return gss_for_code_[code];
1166 /* Return which GSS code is used by GS. */
1168 static inline enum gimple_statement_structure_enum
1169 gimple_statement_structure (gimple gs)
1171 return gss_for_code (gimple_code (gs));
1175 /* Return true if statement G has sub-statements. This is only true for
1176 High GIMPLE statements. */
1179 gimple_has_substatements (gimple g)
1181 switch (gimple_code (g))
1185 case GIMPLE_EH_FILTER:
1186 case GIMPLE_EH_ELSE:
1188 case GIMPLE_OMP_FOR:
1189 case GIMPLE_OMP_MASTER:
1190 case GIMPLE_OMP_ORDERED:
1191 case GIMPLE_OMP_SECTION:
1192 case GIMPLE_OMP_PARALLEL:
1193 case GIMPLE_OMP_TASK:
1194 case GIMPLE_OMP_SECTIONS:
1195 case GIMPLE_OMP_SINGLE:
1196 case GIMPLE_OMP_CRITICAL:
1197 case GIMPLE_WITH_CLEANUP_EXPR:
1198 case GIMPLE_TRANSACTION:
1207 /* Return the basic block holding statement G. */
1209 static inline struct basic_block_def *
1210 gimple_bb (const_gimple g)
1212 return g->gsbase.bb;
1216 /* Return the lexical scope block holding statement G. */
1219 gimple_block (const_gimple g)
1221 return g->gsbase.block;
1225 /* Set BLOCK to be the lexical scope block holding statement G. */
1228 gimple_set_block (gimple g, tree block)
1230 g->gsbase.block = block;
1234 /* Return location information for statement G. */
1236 static inline location_t
1237 gimple_location (const_gimple g)
1239 return g->gsbase.location;
1242 /* Return pointer to location information for statement G. */
1244 static inline const location_t *
1245 gimple_location_ptr (const_gimple g)
1247 return &g->gsbase.location;
1251 /* Set location information for statement G. */
1254 gimple_set_location (gimple g, location_t location)
1256 g->gsbase.location = location;
1260 /* Return true if G contains location information. */
1263 gimple_has_location (const_gimple g)
1265 return gimple_location (g) != UNKNOWN_LOCATION;
1269 /* Return the file name of the location of STMT. */
1271 static inline const char *
1272 gimple_filename (const_gimple stmt)
1274 return LOCATION_FILE (gimple_location (stmt));
1278 /* Return the line number of the location of STMT. */
1281 gimple_lineno (const_gimple stmt)
1283 return LOCATION_LINE (gimple_location (stmt));
1287 /* Determine whether SEQ is a singleton. */
1290 gimple_seq_singleton_p (gimple_seq seq)
1292 return ((gimple_seq_first (seq) != NULL)
1293 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1296 /* Return true if no warnings should be emitted for statement STMT. */
1299 gimple_no_warning_p (const_gimple stmt)
1301 return stmt->gsbase.no_warning;
1304 /* Set the no_warning flag of STMT to NO_WARNING. */
1307 gimple_set_no_warning (gimple stmt, bool no_warning)
1309 stmt->gsbase.no_warning = (unsigned) no_warning;
1312 /* Set the visited status on statement STMT to VISITED_P. */
1315 gimple_set_visited (gimple stmt, bool visited_p)
1317 stmt->gsbase.visited = (unsigned) visited_p;
1321 /* Return the visited status for statement STMT. */
1324 gimple_visited_p (gimple stmt)
1326 return stmt->gsbase.visited;
1330 /* Set pass local flag PLF on statement STMT to VAL_P. */
1333 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1336 stmt->gsbase.plf |= (unsigned int) plf;
1338 stmt->gsbase.plf &= ~((unsigned int) plf);
1342 /* Return the value of pass local flag PLF on statement STMT. */
1344 static inline unsigned int
1345 gimple_plf (gimple stmt, enum plf_mask plf)
1347 return stmt->gsbase.plf & ((unsigned int) plf);
1351 /* Set the UID of statement. */
1354 gimple_set_uid (gimple g, unsigned uid)
1356 g->gsbase.uid = uid;
1360 /* Return the UID of statement. */
1362 static inline unsigned
1363 gimple_uid (const_gimple g)
1365 return g->gsbase.uid;
1369 /* Return true if GIMPLE statement G has register or memory operands. */
1372 gimple_has_ops (const_gimple g)
1374 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1378 /* Return true if GIMPLE statement G has memory operands. */
1381 gimple_has_mem_ops (const_gimple g)
1383 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1387 /* Return the set of DEF operands for statement G. */
1389 static inline struct def_optype_d *
1390 gimple_def_ops (const_gimple g)
1392 if (!gimple_has_ops (g))
1394 return g->gsops.opbase.def_ops;
1398 /* Set DEF to be the set of DEF operands for statement G. */
1401 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1403 gcc_gimple_checking_assert (gimple_has_ops (g));
1404 g->gsops.opbase.def_ops = def;
1408 /* Return the set of USE operands for statement G. */
1410 static inline struct use_optype_d *
1411 gimple_use_ops (const_gimple g)
1413 if (!gimple_has_ops (g))
1415 return g->gsops.opbase.use_ops;
1419 /* Set USE to be the set of USE operands for statement G. */
1422 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1424 gcc_gimple_checking_assert (gimple_has_ops (g));
1425 g->gsops.opbase.use_ops = use;
1429 /* Return the set of VUSE operand for statement G. */
1431 static inline use_operand_p
1432 gimple_vuse_op (const_gimple g)
1434 struct use_optype_d *ops;
1435 if (!gimple_has_mem_ops (g))
1436 return NULL_USE_OPERAND_P;
1437 ops = g->gsops.opbase.use_ops;
1439 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1440 return USE_OP_PTR (ops);
1441 return NULL_USE_OPERAND_P;
1444 /* Return the set of VDEF operand for statement G. */
1446 static inline def_operand_p
1447 gimple_vdef_op (const_gimple g)
1449 struct def_optype_d *ops;
1450 if (!gimple_has_mem_ops (g))
1451 return NULL_DEF_OPERAND_P;
1452 ops = g->gsops.opbase.def_ops;
1454 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1455 return DEF_OP_PTR (ops);
1456 return NULL_DEF_OPERAND_P;
1460 /* Return the single VUSE operand of the statement G. */
1463 gimple_vuse (const_gimple g)
1465 if (!gimple_has_mem_ops (g))
1467 return g->gsmembase.vuse;
1470 /* Return the single VDEF operand of the statement G. */
1473 gimple_vdef (const_gimple g)
1475 if (!gimple_has_mem_ops (g))
1477 return g->gsmembase.vdef;
1480 /* Return the single VUSE operand of the statement G. */
1482 static inline tree *
1483 gimple_vuse_ptr (gimple g)
1485 if (!gimple_has_mem_ops (g))
1487 return &g->gsmembase.vuse;
1490 /* Return the single VDEF operand of the statement G. */
1492 static inline tree *
1493 gimple_vdef_ptr (gimple g)
1495 if (!gimple_has_mem_ops (g))
1497 return &g->gsmembase.vdef;
1500 /* Set the single VUSE operand of the statement G. */
1503 gimple_set_vuse (gimple g, tree vuse)
1505 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1506 g->gsmembase.vuse = vuse;
1509 /* Set the single VDEF operand of the statement G. */
1512 gimple_set_vdef (gimple g, tree vdef)
1514 gcc_gimple_checking_assert (gimple_has_mem_ops (g));
1515 g->gsmembase.vdef = vdef;
1519 /* Return true if statement G has operands and the modified field has
1523 gimple_modified_p (const_gimple g)
1525 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1529 /* Return the tree code for the expression computed by STMT. This is
1530 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1531 GIMPLE_CALL, return CALL_EXPR as the expression code for
1532 consistency. This is useful when the caller needs to deal with the
1533 three kinds of computation that GIMPLE supports. */
1535 static inline enum tree_code
1536 gimple_expr_code (const_gimple stmt)
1538 enum gimple_code code = gimple_code (stmt);
1539 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1540 return (enum tree_code) stmt->gsbase.subcode;
1543 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1549 /* Mark statement S as modified, and update it. */
1552 update_stmt (gimple s)
1554 if (gimple_has_ops (s))
1556 gimple_set_modified (s, true);
1557 update_stmt_operands (s);
1561 /* Update statement S if it has been optimized. */
1564 update_stmt_if_modified (gimple s)
1566 if (gimple_modified_p (s))
1567 update_stmt_operands (s);
1570 /* Return true if statement STMT contains volatile operands. */
1573 gimple_has_volatile_ops (const_gimple stmt)
1575 if (gimple_has_mem_ops (stmt))
1576 return stmt->gsbase.has_volatile_ops;
1582 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1585 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1587 if (gimple_has_mem_ops (stmt))
1588 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1592 /* Return true if statement STMT may access memory. */
1595 gimple_references_memory_p (gimple stmt)
1597 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1601 /* Return the subcode for OMP statement S. */
1603 static inline unsigned
1604 gimple_omp_subcode (const_gimple s)
1606 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1607 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1608 return s->gsbase.subcode;
1611 /* Set the subcode for OMP statement S to SUBCODE. */
1614 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1616 /* We only have 16 bits for the subcode. Assert that we are not
1618 gcc_gimple_checking_assert (subcode < (1 << 16));
1619 s->gsbase.subcode = subcode;
1622 /* Set the nowait flag on OMP_RETURN statement S. */
1625 gimple_omp_return_set_nowait (gimple s)
1627 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1628 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1632 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1636 gimple_omp_return_nowait_p (const_gimple g)
1638 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1639 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1643 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1647 gimple_omp_section_last_p (const_gimple g)
1649 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1650 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1654 /* Set the GF_OMP_SECTION_LAST flag on G. */
1657 gimple_omp_section_set_last (gimple g)
1659 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1660 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1664 /* Return true if OMP parallel statement G has the
1665 GF_OMP_PARALLEL_COMBINED flag set. */
1668 gimple_omp_parallel_combined_p (const_gimple g)
1670 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1671 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1675 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1676 value of COMBINED_P. */
1679 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1681 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1683 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1685 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1689 /* Return true if OMP atomic load/store statement G has the
1690 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1693 gimple_omp_atomic_need_value_p (const_gimple g)
1695 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1696 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1697 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1701 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1704 gimple_omp_atomic_set_need_value (gimple g)
1706 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1707 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1708 g->gsbase.subcode |= GF_OMP_ATOMIC_NEED_VALUE;
1712 /* Return the number of operands for statement GS. */
1714 static inline unsigned
1715 gimple_num_ops (const_gimple gs)
1717 return gs->gsbase.num_ops;
1721 /* Set the number of operands for statement GS. */
1724 gimple_set_num_ops (gimple gs, unsigned num_ops)
1726 gs->gsbase.num_ops = num_ops;
1730 /* Return the array of operands for statement GS. */
1732 static inline tree *
1733 gimple_ops (gimple gs)
1737 /* All the tuples have their operand vector at the very bottom
1738 of the structure. Note that those structures that do not
1739 have an operand vector have a zero offset. */
1740 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1741 gcc_gimple_checking_assert (off != 0);
1743 return (tree *) ((char *) gs + off);
1747 /* Return operand I for statement GS. */
1750 gimple_op (const_gimple gs, unsigned i)
1752 if (gimple_has_ops (gs))
1754 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1755 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1761 /* Return a pointer to operand I for statement GS. */
1763 static inline tree *
1764 gimple_op_ptr (const_gimple gs, unsigned i)
1766 if (gimple_has_ops (gs))
1768 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
1769 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1775 /* Set operand I of statement GS to OP. */
1778 gimple_set_op (gimple gs, unsigned i, tree op)
1780 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1782 /* Note. It may be tempting to assert that OP matches
1783 is_gimple_operand, but that would be wrong. Different tuples
1784 accept slightly different sets of tree operands. Each caller
1785 should perform its own validation. */
1786 gimple_ops (gs)[i] = op;
1789 /* Return true if GS is a GIMPLE_ASSIGN. */
1792 is_gimple_assign (const_gimple gs)
1794 return gimple_code (gs) == GIMPLE_ASSIGN;
1797 /* Determine if expression CODE is one of the valid expressions that can
1798 be used on the RHS of GIMPLE assignments. */
1800 static inline enum gimple_rhs_class
1801 get_gimple_rhs_class (enum tree_code code)
1803 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1806 /* Return the LHS of assignment statement GS. */
1809 gimple_assign_lhs (const_gimple gs)
1811 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1812 return gimple_op (gs, 0);
1816 /* Return a pointer to the LHS of assignment statement GS. */
1818 static inline tree *
1819 gimple_assign_lhs_ptr (const_gimple gs)
1821 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1822 return gimple_op_ptr (gs, 0);
1826 /* Set LHS to be the LHS operand of assignment statement GS. */
1829 gimple_assign_set_lhs (gimple gs, tree lhs)
1831 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1832 gimple_set_op (gs, 0, lhs);
1834 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1835 SSA_NAME_DEF_STMT (lhs) = gs;
1839 /* Return the first operand on the RHS of assignment statement GS. */
1842 gimple_assign_rhs1 (const_gimple gs)
1844 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1845 return gimple_op (gs, 1);
1849 /* Return a pointer to the first operand on the RHS of assignment
1852 static inline tree *
1853 gimple_assign_rhs1_ptr (const_gimple gs)
1855 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1856 return gimple_op_ptr (gs, 1);
1859 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1862 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1864 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1866 gimple_set_op (gs, 1, rhs);
1870 /* Return the second operand on the RHS of assignment statement GS.
1871 If GS does not have two operands, NULL is returned instead. */
1874 gimple_assign_rhs2 (const_gimple gs)
1876 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1878 if (gimple_num_ops (gs) >= 3)
1879 return gimple_op (gs, 2);
1885 /* Return a pointer to the second operand on the RHS of assignment
1888 static inline tree *
1889 gimple_assign_rhs2_ptr (const_gimple gs)
1891 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1892 return gimple_op_ptr (gs, 2);
1896 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1899 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1901 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1903 gimple_set_op (gs, 2, rhs);
1906 /* Return the third operand on the RHS of assignment statement GS.
1907 If GS does not have two operands, NULL is returned instead. */
1910 gimple_assign_rhs3 (const_gimple gs)
1912 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1914 if (gimple_num_ops (gs) >= 4)
1915 return gimple_op (gs, 3);
1920 /* Return a pointer to the third operand on the RHS of assignment
1923 static inline tree *
1924 gimple_assign_rhs3_ptr (const_gimple gs)
1926 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1927 return gimple_op_ptr (gs, 3);
1931 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
1934 gimple_assign_set_rhs3 (gimple gs, tree rhs)
1936 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1938 gimple_set_op (gs, 3, rhs);
1941 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
1942 to see only a maximum of two operands. */
1945 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
1948 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
1951 /* A wrapper around extract_ops_from_tree_1, for callers which expect
1952 to see only a maximum of two operands. */
1955 extract_ops_from_tree (tree expr, enum tree_code *code, tree *op0,
1959 extract_ops_from_tree_1 (expr, code, op0, op1, &op2);
1960 gcc_assert (op2 == NULL_TREE);
1963 /* Returns true if GS is a nontemporal move. */
1966 gimple_assign_nontemporal_move_p (const_gimple gs)
1968 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1969 return gs->gsbase.nontemporal_move;
1972 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1975 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1977 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1978 gs->gsbase.nontemporal_move = nontemporal;
1982 /* Return the code of the expression computed on the rhs of assignment
1983 statement GS. In case that the RHS is a single object, returns the
1984 tree code of the object. */
1986 static inline enum tree_code
1987 gimple_assign_rhs_code (const_gimple gs)
1989 enum tree_code code;
1990 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1992 code = (enum tree_code) gs->gsbase.subcode;
1993 /* While we initially set subcode to the TREE_CODE of the rhs for
1994 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
1995 in sync when we rewrite stmts into SSA form or do SSA propagations. */
1996 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1997 code = TREE_CODE (gimple_assign_rhs1 (gs));
2003 /* Set CODE to be the code for the expression computed on the RHS of
2007 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2009 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2010 s->gsbase.subcode = code;
2014 /* Return the gimple rhs class of the code of the expression computed on
2015 the rhs of assignment statement GS.
2016 This will never return GIMPLE_INVALID_RHS. */
2018 static inline enum gimple_rhs_class
2019 gimple_assign_rhs_class (const_gimple gs)
2021 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2024 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2025 there is no operator associated with the assignment itself.
2026 Unlike gimple_assign_copy_p, this predicate returns true for
2027 any RHS operand, including those that perform an operation
2028 and do not have the semantics of a copy, such as COND_EXPR. */
2031 gimple_assign_single_p (gimple gs)
2033 return (is_gimple_assign (gs)
2034 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2038 /* Return true if S is a type-cast assignment. */
2041 gimple_assign_cast_p (gimple s)
2043 if (is_gimple_assign (s))
2045 enum tree_code sc = gimple_assign_rhs_code (s);
2046 return CONVERT_EXPR_CODE_P (sc)
2047 || sc == VIEW_CONVERT_EXPR
2048 || sc == FIX_TRUNC_EXPR;
2054 /* Return true if S is a clobber statement. */
2057 gimple_clobber_p (gimple s)
2059 return gimple_assign_single_p (s)
2060 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2063 /* Return true if GS is a GIMPLE_CALL. */
2066 is_gimple_call (const_gimple gs)
2068 return gimple_code (gs) == GIMPLE_CALL;
2071 /* Return the LHS of call statement GS. */
2074 gimple_call_lhs (const_gimple gs)
2076 GIMPLE_CHECK (gs, GIMPLE_CALL);
2077 return gimple_op (gs, 0);
2081 /* Return a pointer to the LHS of call statement GS. */
2083 static inline tree *
2084 gimple_call_lhs_ptr (const_gimple gs)
2086 GIMPLE_CHECK (gs, GIMPLE_CALL);
2087 return gimple_op_ptr (gs, 0);
2091 /* Set LHS to be the LHS operand of call statement GS. */
2094 gimple_call_set_lhs (gimple gs, tree lhs)
2096 GIMPLE_CHECK (gs, GIMPLE_CALL);
2097 gimple_set_op (gs, 0, lhs);
2098 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2099 SSA_NAME_DEF_STMT (lhs) = gs;
2103 /* Return true if call GS calls an internal-only function, as enumerated
2107 gimple_call_internal_p (const_gimple gs)
2109 GIMPLE_CHECK (gs, GIMPLE_CALL);
2110 return (gs->gsbase.subcode & GF_CALL_INTERNAL) != 0;
2114 /* Return the target of internal call GS. */
2116 static inline enum internal_fn
2117 gimple_call_internal_fn (const_gimple gs)
2119 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2120 return gs->gimple_call.u.internal_fn;
2124 /* Return the function type of the function called by GS. */
2127 gimple_call_fntype (const_gimple gs)
2129 GIMPLE_CHECK (gs, GIMPLE_CALL);
2130 if (gimple_call_internal_p (gs))
2132 return gs->gimple_call.u.fntype;
2135 /* Set the type of the function called by GS to FNTYPE. */
2138 gimple_call_set_fntype (gimple gs, tree fntype)
2140 GIMPLE_CHECK (gs, GIMPLE_CALL);
2141 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2142 gs->gimple_call.u.fntype = fntype;
2146 /* Return the tree node representing the function called by call
2150 gimple_call_fn (const_gimple gs)
2152 GIMPLE_CHECK (gs, GIMPLE_CALL);
2153 return gimple_op (gs, 1);
2156 /* Return a pointer to the tree node representing the function called by call
2159 static inline tree *
2160 gimple_call_fn_ptr (const_gimple gs)
2162 GIMPLE_CHECK (gs, GIMPLE_CALL);
2163 return gimple_op_ptr (gs, 1);
2167 /* Set FN to be the function called by call statement GS. */
2170 gimple_call_set_fn (gimple gs, tree fn)
2172 GIMPLE_CHECK (gs, GIMPLE_CALL);
2173 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2174 gimple_set_op (gs, 1, fn);
2178 /* Set FNDECL to be the function called by call statement GS. */
2181 gimple_call_set_fndecl (gimple gs, tree decl)
2183 GIMPLE_CHECK (gs, GIMPLE_CALL);
2184 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2185 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2189 /* Set internal function FN to be the function called by call statement GS. */
2192 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2194 GIMPLE_CHECK (gs, GIMPLE_CALL);
2195 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2196 gs->gimple_call.u.internal_fn = fn;
2200 /* Given a valid GIMPLE_CALL function address return the FUNCTION_DECL
2201 associated with the callee if known. Otherwise return NULL_TREE. */
2204 gimple_call_addr_fndecl (const_tree fn)
2206 if (fn && TREE_CODE (fn) == ADDR_EXPR)
2208 tree fndecl = TREE_OPERAND (fn, 0);
2209 if (TREE_CODE (fndecl) == MEM_REF
2210 && TREE_CODE (TREE_OPERAND (fndecl, 0)) == ADDR_EXPR
2211 && integer_zerop (TREE_OPERAND (fndecl, 1)))
2212 fndecl = TREE_OPERAND (TREE_OPERAND (fndecl, 0), 0);
2213 if (TREE_CODE (fndecl) == FUNCTION_DECL)
2219 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2220 Otherwise return NULL. This function is analogous to
2221 get_callee_fndecl in tree land. */
2224 gimple_call_fndecl (const_gimple gs)
2226 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2230 /* Return the type returned by call statement GS. */
2233 gimple_call_return_type (const_gimple gs)
2235 tree type = gimple_call_fntype (gs);
2237 if (type == NULL_TREE)
2238 return TREE_TYPE (gimple_call_lhs (gs));
2240 /* The type returned by a function is the type of its
2242 return TREE_TYPE (type);
2246 /* Return the static chain for call statement GS. */
2249 gimple_call_chain (const_gimple gs)
2251 GIMPLE_CHECK (gs, GIMPLE_CALL);
2252 return gimple_op (gs, 2);
2256 /* Return a pointer to the static chain for call statement GS. */
2258 static inline tree *
2259 gimple_call_chain_ptr (const_gimple gs)
2261 GIMPLE_CHECK (gs, GIMPLE_CALL);
2262 return gimple_op_ptr (gs, 2);
2265 /* Set CHAIN to be the static chain for call statement GS. */
2268 gimple_call_set_chain (gimple gs, tree chain)
2270 GIMPLE_CHECK (gs, GIMPLE_CALL);
2272 gimple_set_op (gs, 2, chain);
2276 /* Return the number of arguments used by call statement GS. */
2278 static inline unsigned
2279 gimple_call_num_args (const_gimple gs)
2282 GIMPLE_CHECK (gs, GIMPLE_CALL);
2283 num_ops = gimple_num_ops (gs);
2288 /* Return the argument at position INDEX for call statement GS. */
2291 gimple_call_arg (const_gimple gs, unsigned index)
2293 GIMPLE_CHECK (gs, GIMPLE_CALL);
2294 return gimple_op (gs, index + 3);
2298 /* Return a pointer to the argument at position INDEX for call
2301 static inline tree *
2302 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2304 GIMPLE_CHECK (gs, GIMPLE_CALL);
2305 return gimple_op_ptr (gs, index + 3);
2309 /* Set ARG to be the argument at position INDEX for call statement GS. */
2312 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2314 GIMPLE_CHECK (gs, GIMPLE_CALL);
2315 gimple_set_op (gs, index + 3, arg);
2319 /* If TAIL_P is true, mark call statement S as being a tail call
2320 (i.e., a call just before the exit of a function). These calls are
2321 candidate for tail call optimization. */
2324 gimple_call_set_tail (gimple s, bool tail_p)
2326 GIMPLE_CHECK (s, GIMPLE_CALL);
2328 s->gsbase.subcode |= GF_CALL_TAILCALL;
2330 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2334 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2337 gimple_call_tail_p (gimple s)
2339 GIMPLE_CHECK (s, GIMPLE_CALL);
2340 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2344 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2345 slot optimization. This transformation uses the target of the call
2346 expansion as the return slot for calls that return in memory. */
2349 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2351 GIMPLE_CHECK (s, GIMPLE_CALL);
2352 if (return_slot_opt_p)
2353 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2355 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2359 /* Return true if S is marked for return slot optimization. */
2362 gimple_call_return_slot_opt_p (gimple s)
2364 GIMPLE_CHECK (s, GIMPLE_CALL);
2365 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2369 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2370 thunk to the thunked-to function. */
2373 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2375 GIMPLE_CHECK (s, GIMPLE_CALL);
2377 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2379 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2383 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2386 gimple_call_from_thunk_p (gimple s)
2388 GIMPLE_CHECK (s, GIMPLE_CALL);
2389 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2393 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2394 argument pack in its argument list. */
2397 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2399 GIMPLE_CHECK (s, GIMPLE_CALL);
2400 if (pass_arg_pack_p)
2401 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2403 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2407 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2408 argument pack in its argument list. */
2411 gimple_call_va_arg_pack_p (gimple s)
2413 GIMPLE_CHECK (s, GIMPLE_CALL);
2414 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2418 /* Return true if S is a noreturn call. */
2421 gimple_call_noreturn_p (gimple s)
2423 GIMPLE_CHECK (s, GIMPLE_CALL);
2424 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2428 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2429 even if the called function can throw in other cases. */
2432 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2434 GIMPLE_CHECK (s, GIMPLE_CALL);
2436 s->gsbase.subcode |= GF_CALL_NOTHROW;
2438 s->gsbase.subcode &= ~GF_CALL_NOTHROW;
2441 /* Return true if S is a nothrow call. */
2444 gimple_call_nothrow_p (gimple s)
2446 GIMPLE_CHECK (s, GIMPLE_CALL);
2447 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2450 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2451 is known to be emitted for VLA objects. Those are wrapped by
2452 stack_save/stack_restore calls and hence can't lead to unbounded
2453 stack growth even when they occur in loops. */
2456 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2458 GIMPLE_CHECK (s, GIMPLE_CALL);
2460 s->gsbase.subcode |= GF_CALL_ALLOCA_FOR_VAR;
2462 s->gsbase.subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2465 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2468 gimple_call_alloca_for_var_p (gimple s)
2470 GIMPLE_CHECK (s, GIMPLE_CALL);
2471 return (s->gsbase.subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2474 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2477 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2479 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2480 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2481 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2485 /* Return a pointer to the points-to solution for the set of call-used
2486 variables of the call CALL. */
2488 static inline struct pt_solution *
2489 gimple_call_use_set (gimple call)
2491 GIMPLE_CHECK (call, GIMPLE_CALL);
2492 return &call->gimple_call.call_used;
2496 /* Return a pointer to the points-to solution for the set of call-used
2497 variables of the call CALL. */
2499 static inline struct pt_solution *
2500 gimple_call_clobber_set (gimple call)
2502 GIMPLE_CHECK (call, GIMPLE_CALL);
2503 return &call->gimple_call.call_clobbered;
2507 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2511 gimple_has_lhs (gimple stmt)
2513 return (is_gimple_assign (stmt)
2514 || (is_gimple_call (stmt)
2515 && gimple_call_lhs (stmt) != NULL_TREE));
2519 /* Return the code of the predicate computed by conditional statement GS. */
2521 static inline enum tree_code
2522 gimple_cond_code (const_gimple gs)
2524 GIMPLE_CHECK (gs, GIMPLE_COND);
2525 return (enum tree_code) gs->gsbase.subcode;
2529 /* Set CODE to be the predicate code for the conditional statement GS. */
2532 gimple_cond_set_code (gimple gs, enum tree_code code)
2534 GIMPLE_CHECK (gs, GIMPLE_COND);
2535 gs->gsbase.subcode = code;
2539 /* Return the LHS of the predicate computed by conditional statement GS. */
2542 gimple_cond_lhs (const_gimple gs)
2544 GIMPLE_CHECK (gs, GIMPLE_COND);
2545 return gimple_op (gs, 0);
2548 /* Return the pointer to the LHS of the predicate computed by conditional
2551 static inline tree *
2552 gimple_cond_lhs_ptr (const_gimple gs)
2554 GIMPLE_CHECK (gs, GIMPLE_COND);
2555 return gimple_op_ptr (gs, 0);
2558 /* Set LHS to be the LHS operand of the predicate computed by
2559 conditional statement GS. */
2562 gimple_cond_set_lhs (gimple gs, tree lhs)
2564 GIMPLE_CHECK (gs, GIMPLE_COND);
2565 gimple_set_op (gs, 0, lhs);
2569 /* Return the RHS operand of the predicate computed by conditional GS. */
2572 gimple_cond_rhs (const_gimple gs)
2574 GIMPLE_CHECK (gs, GIMPLE_COND);
2575 return gimple_op (gs, 1);
2578 /* Return the pointer to the RHS operand of the predicate computed by
2581 static inline tree *
2582 gimple_cond_rhs_ptr (const_gimple gs)
2584 GIMPLE_CHECK (gs, GIMPLE_COND);
2585 return gimple_op_ptr (gs, 1);
2589 /* Set RHS to be the RHS operand of the predicate computed by
2590 conditional statement GS. */
2593 gimple_cond_set_rhs (gimple gs, tree rhs)
2595 GIMPLE_CHECK (gs, GIMPLE_COND);
2596 gimple_set_op (gs, 1, rhs);
2600 /* Return the label used by conditional statement GS when its
2601 predicate evaluates to true. */
2604 gimple_cond_true_label (const_gimple gs)
2606 GIMPLE_CHECK (gs, GIMPLE_COND);
2607 return gimple_op (gs, 2);
2611 /* Set LABEL to be the label used by conditional statement GS when its
2612 predicate evaluates to true. */
2615 gimple_cond_set_true_label (gimple gs, tree label)
2617 GIMPLE_CHECK (gs, GIMPLE_COND);
2618 gimple_set_op (gs, 2, label);
2622 /* Set LABEL to be the label used by conditional statement GS when its
2623 predicate evaluates to false. */
2626 gimple_cond_set_false_label (gimple gs, tree label)
2628 GIMPLE_CHECK (gs, GIMPLE_COND);
2629 gimple_set_op (gs, 3, label);
2633 /* Return the label used by conditional statement GS when its
2634 predicate evaluates to false. */
2637 gimple_cond_false_label (const_gimple gs)
2639 GIMPLE_CHECK (gs, GIMPLE_COND);
2640 return gimple_op (gs, 3);
2644 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2647 gimple_cond_make_false (gimple gs)
2649 gimple_cond_set_lhs (gs, boolean_true_node);
2650 gimple_cond_set_rhs (gs, boolean_false_node);
2651 gs->gsbase.subcode = EQ_EXPR;
2655 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2658 gimple_cond_make_true (gimple gs)
2660 gimple_cond_set_lhs (gs, boolean_true_node);
2661 gimple_cond_set_rhs (gs, boolean_true_node);
2662 gs->gsbase.subcode = EQ_EXPR;
2665 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2666 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2669 gimple_cond_true_p (const_gimple gs)
2671 tree lhs = gimple_cond_lhs (gs);
2672 tree rhs = gimple_cond_rhs (gs);
2673 enum tree_code code = gimple_cond_code (gs);
2675 if (lhs != boolean_true_node && lhs != boolean_false_node)
2678 if (rhs != boolean_true_node && rhs != boolean_false_node)
2681 if (code == NE_EXPR && lhs != rhs)
2684 if (code == EQ_EXPR && lhs == rhs)
2690 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2691 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2694 gimple_cond_false_p (const_gimple gs)
2696 tree lhs = gimple_cond_lhs (gs);
2697 tree rhs = gimple_cond_rhs (gs);
2698 enum tree_code code = gimple_cond_code (gs);
2700 if (lhs != boolean_true_node && lhs != boolean_false_node)
2703 if (rhs != boolean_true_node && rhs != boolean_false_node)
2706 if (code == NE_EXPR && lhs == rhs)
2709 if (code == EQ_EXPR && lhs != rhs)
2715 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2719 gimple_cond_single_var_p (gimple gs)
2721 if (gimple_cond_code (gs) == NE_EXPR
2722 && gimple_cond_rhs (gs) == boolean_false_node)
2725 if (gimple_cond_code (gs) == EQ_EXPR
2726 && gimple_cond_rhs (gs) == boolean_true_node)
2732 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2735 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2737 gimple_cond_set_code (stmt, code);
2738 gimple_cond_set_lhs (stmt, lhs);
2739 gimple_cond_set_rhs (stmt, rhs);
2742 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2745 gimple_label_label (const_gimple gs)
2747 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2748 return gimple_op (gs, 0);
2752 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2756 gimple_label_set_label (gimple gs, tree label)
2758 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2759 gimple_set_op (gs, 0, label);
2763 /* Return the destination of the unconditional jump GS. */
2766 gimple_goto_dest (const_gimple gs)
2768 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2769 return gimple_op (gs, 0);
2773 /* Set DEST to be the destination of the unconditonal jump GS. */
2776 gimple_goto_set_dest (gimple gs, tree dest)
2778 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2779 gimple_set_op (gs, 0, dest);
2783 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2786 gimple_bind_vars (const_gimple gs)
2788 GIMPLE_CHECK (gs, GIMPLE_BIND);
2789 return gs->gimple_bind.vars;
2793 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2797 gimple_bind_set_vars (gimple gs, tree vars)
2799 GIMPLE_CHECK (gs, GIMPLE_BIND);
2800 gs->gimple_bind.vars = vars;
2804 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2808 gimple_bind_append_vars (gimple gs, tree vars)
2810 GIMPLE_CHECK (gs, GIMPLE_BIND);
2811 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2815 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2817 static inline gimple_seq
2818 gimple_bind_body (gimple gs)
2820 GIMPLE_CHECK (gs, GIMPLE_BIND);
2821 return gs->gimple_bind.body;
2825 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2829 gimple_bind_set_body (gimple gs, gimple_seq seq)
2831 GIMPLE_CHECK (gs, GIMPLE_BIND);
2832 gs->gimple_bind.body = seq;
2836 /* Append a statement to the end of a GIMPLE_BIND's body. */
2839 gimple_bind_add_stmt (gimple gs, gimple stmt)
2841 GIMPLE_CHECK (gs, GIMPLE_BIND);
2842 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2846 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2849 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2851 GIMPLE_CHECK (gs, GIMPLE_BIND);
2852 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2856 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2857 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2860 gimple_bind_block (const_gimple gs)
2862 GIMPLE_CHECK (gs, GIMPLE_BIND);
2863 return gs->gimple_bind.block;
2867 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2871 gimple_bind_set_block (gimple gs, tree block)
2873 GIMPLE_CHECK (gs, GIMPLE_BIND);
2874 gcc_gimple_checking_assert (block == NULL_TREE
2875 || TREE_CODE (block) == BLOCK);
2876 gs->gimple_bind.block = block;
2880 /* Return the number of input operands for GIMPLE_ASM GS. */
2882 static inline unsigned
2883 gimple_asm_ninputs (const_gimple gs)
2885 GIMPLE_CHECK (gs, GIMPLE_ASM);
2886 return gs->gimple_asm.ni;
2890 /* Return the number of output operands for GIMPLE_ASM GS. */
2892 static inline unsigned
2893 gimple_asm_noutputs (const_gimple gs)
2895 GIMPLE_CHECK (gs, GIMPLE_ASM);
2896 return gs->gimple_asm.no;
2900 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2902 static inline unsigned
2903 gimple_asm_nclobbers (const_gimple gs)
2905 GIMPLE_CHECK (gs, GIMPLE_ASM);
2906 return gs->gimple_asm.nc;
2909 /* Return the number of label operands for GIMPLE_ASM GS. */
2911 static inline unsigned
2912 gimple_asm_nlabels (const_gimple gs)
2914 GIMPLE_CHECK (gs, GIMPLE_ASM);
2915 return gs->gimple_asm.nl;
2918 /* Return input operand INDEX of GIMPLE_ASM GS. */
2921 gimple_asm_input_op (const_gimple gs, unsigned index)
2923 GIMPLE_CHECK (gs, GIMPLE_ASM);
2924 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2925 return gimple_op (gs, index);
2928 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2930 static inline tree *
2931 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2933 GIMPLE_CHECK (gs, GIMPLE_ASM);
2934 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni);
2935 return gimple_op_ptr (gs, index);
2939 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2942 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2944 GIMPLE_CHECK (gs, GIMPLE_ASM);
2945 gcc_gimple_checking_assert (index <= gs->gimple_asm.ni
2946 && TREE_CODE (in_op) == TREE_LIST);
2947 gimple_set_op (gs, index, in_op);
2951 /* Return output operand INDEX of GIMPLE_ASM GS. */
2954 gimple_asm_output_op (const_gimple gs, unsigned index)
2956 GIMPLE_CHECK (gs, GIMPLE_ASM);
2957 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2958 return gimple_op (gs, index + gs->gimple_asm.ni);
2961 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2963 static inline tree *
2964 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2966 GIMPLE_CHECK (gs, GIMPLE_ASM);
2967 gcc_gimple_checking_assert (index <= gs->gimple_asm.no);
2968 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2972 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2975 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2977 GIMPLE_CHECK (gs, GIMPLE_ASM);
2978 gcc_gimple_checking_assert (index <= gs->gimple_asm.no
2979 && TREE_CODE (out_op) == TREE_LIST);
2980 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2984 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2987 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2989 GIMPLE_CHECK (gs, GIMPLE_ASM);
2990 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc);
2991 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2995 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2998 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3000 GIMPLE_CHECK (gs, GIMPLE_ASM);
3001 gcc_gimple_checking_assert (index <= gs->gimple_asm.nc
3002 && TREE_CODE (clobber_op) == TREE_LIST);
3003 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
3006 /* Return label operand INDEX of GIMPLE_ASM GS. */
3009 gimple_asm_label_op (const_gimple gs, unsigned index)
3011 GIMPLE_CHECK (gs, GIMPLE_ASM);
3012 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl);
3013 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
3016 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3019 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3021 GIMPLE_CHECK (gs, GIMPLE_ASM);
3022 gcc_gimple_checking_assert (index <= gs->gimple_asm.nl
3023 && TREE_CODE (label_op) == TREE_LIST);
3024 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
3027 /* Return the string representing the assembly instruction in
3030 static inline const char *
3031 gimple_asm_string (const_gimple gs)
3033 GIMPLE_CHECK (gs, GIMPLE_ASM);
3034 return gs->gimple_asm.string;
3038 /* Return true if GS is an asm statement marked volatile. */
3041 gimple_asm_volatile_p (const_gimple gs)
3043 GIMPLE_CHECK (gs, GIMPLE_ASM);
3044 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
3048 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3051 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3053 GIMPLE_CHECK (gs, GIMPLE_ASM);
3055 gs->gsbase.subcode |= GF_ASM_VOLATILE;
3057 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
3061 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3064 gimple_asm_set_input (gimple gs, bool input_p)
3066 GIMPLE_CHECK (gs, GIMPLE_ASM);
3068 gs->gsbase.subcode |= GF_ASM_INPUT;
3070 gs->gsbase.subcode &= ~GF_ASM_INPUT;
3074 /* Return true if asm GS is an ASM_INPUT. */
3077 gimple_asm_input_p (const_gimple gs)
3079 GIMPLE_CHECK (gs, GIMPLE_ASM);
3080 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
3084 /* Return the types handled by GIMPLE_CATCH statement GS. */
3087 gimple_catch_types (const_gimple gs)
3089 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3090 return gs->gimple_catch.types;
3094 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3096 static inline tree *
3097 gimple_catch_types_ptr (gimple gs)
3099 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3100 return &gs->gimple_catch.types;
3104 /* Return the GIMPLE sequence representing the body of the handler of
3105 GIMPLE_CATCH statement GS. */
3107 static inline gimple_seq
3108 gimple_catch_handler (gimple gs)
3110 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3111 return gs->gimple_catch.handler;
3115 /* Return a pointer to the GIMPLE sequence representing the body of
3116 the handler of GIMPLE_CATCH statement GS. */
3118 static inline gimple_seq *
3119 gimple_catch_handler_ptr (gimple gs)
3121 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3122 return &gs->gimple_catch.handler;
3126 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3129 gimple_catch_set_types (gimple gs, tree t)
3131 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3132 gs->gimple_catch.types = t;
3136 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3139 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3141 GIMPLE_CHECK (gs, GIMPLE_CATCH);
3142 gs->gimple_catch.handler = handler;
3146 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3149 gimple_eh_filter_types (const_gimple gs)
3151 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3152 return gs->gimple_eh_filter.types;
3156 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3159 static inline tree *
3160 gimple_eh_filter_types_ptr (gimple gs)
3162 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3163 return &gs->gimple_eh_filter.types;
3167 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3170 static inline gimple_seq
3171 gimple_eh_filter_failure (gimple gs)
3173 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3174 return gs->gimple_eh_filter.failure;
3178 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3181 gimple_eh_filter_set_types (gimple gs, tree types)
3183 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3184 gs->gimple_eh_filter.types = types;
3188 /* Set FAILURE to be the sequence of statements to execute on failure
3189 for GIMPLE_EH_FILTER GS. */
3192 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3194 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
3195 gs->gimple_eh_filter.failure = failure;
3198 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3201 gimple_eh_must_not_throw_fndecl (gimple gs)
3203 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3204 return gs->gimple_eh_mnt.fndecl;
3207 /* Set the function decl to be called by GS to DECL. */
3210 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3212 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
3213 gs->gimple_eh_mnt.fndecl = decl;
3216 /* GIMPLE_EH_ELSE accessors. */
3218 static inline gimple_seq
3219 gimple_eh_else_n_body (gimple gs)
3221 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3222 return gs->gimple_eh_else.n_body;
3225 static inline gimple_seq
3226 gimple_eh_else_e_body (gimple gs)
3228 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3229 return gs->gimple_eh_else.e_body;
3233 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3235 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3236 gs->gimple_eh_else.n_body = seq;
3240 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3242 GIMPLE_CHECK (gs, GIMPLE_EH_ELSE);
3243 gs->gimple_eh_else.e_body = seq;
3246 /* GIMPLE_TRY accessors. */
3248 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3249 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3251 static inline enum gimple_try_flags
3252 gimple_try_kind (const_gimple gs)
3254 GIMPLE_CHECK (gs, GIMPLE_TRY);
3255 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
3259 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3262 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3264 GIMPLE_CHECK (gs, GIMPLE_TRY);
3265 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3266 || kind == GIMPLE_TRY_FINALLY);
3267 if (gimple_try_kind (gs) != kind)
3268 gs->gsbase.subcode = (unsigned int) kind;
3272 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3275 gimple_try_catch_is_cleanup (const_gimple gs)
3277 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3278 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3282 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3284 static inline gimple_seq
3285 gimple_try_eval (gimple gs)
3287 GIMPLE_CHECK (gs, GIMPLE_TRY);
3288 return gs->gimple_try.eval;
3292 /* Return the sequence of statements used as the cleanup body for
3295 static inline gimple_seq
3296 gimple_try_cleanup (gimple gs)
3298 GIMPLE_CHECK (gs, GIMPLE_TRY);
3299 return gs->gimple_try.cleanup;
3303 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3306 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3308 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3309 if (catch_is_cleanup)
3310 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3312 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3316 /* Set EVAL to be the sequence of statements to use as the body for
3320 gimple_try_set_eval (gimple gs, gimple_seq eval)
3322 GIMPLE_CHECK (gs, GIMPLE_TRY);
3323 gs->gimple_try.eval = eval;
3327 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3328 body for GIMPLE_TRY GS. */
3331 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3333 GIMPLE_CHECK (gs, GIMPLE_TRY);
3334 gs->gimple_try.cleanup = cleanup;
3338 /* Return the cleanup sequence for cleanup statement GS. */
3340 static inline gimple_seq
3341 gimple_wce_cleanup (gimple gs)
3343 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3344 return gs->gimple_wce.cleanup;
3348 /* Set CLEANUP to be the cleanup sequence for GS. */
3351 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3353 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3354 gs->gimple_wce.cleanup = cleanup;
3358 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3361 gimple_wce_cleanup_eh_only (const_gimple gs)
3363 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3364 return gs->gsbase.subcode != 0;
3368 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3371 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3373 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3374 gs->gsbase.subcode = (unsigned int) eh_only_p;
3378 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3380 static inline unsigned
3381 gimple_phi_capacity (const_gimple gs)
3383 GIMPLE_CHECK (gs, GIMPLE_PHI);
3384 return gs->gimple_phi.capacity;
3388 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3389 be exactly the number of incoming edges for the basic block holding
3392 static inline unsigned
3393 gimple_phi_num_args (const_gimple gs)
3395 GIMPLE_CHECK (gs, GIMPLE_PHI);
3396 return gs->gimple_phi.nargs;
3400 /* Return the SSA name created by GIMPLE_PHI GS. */
3403 gimple_phi_result (const_gimple gs)
3405 GIMPLE_CHECK (gs, GIMPLE_PHI);
3406 return gs->gimple_phi.result;
3409 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3411 static inline tree *
3412 gimple_phi_result_ptr (gimple gs)
3414 GIMPLE_CHECK (gs, GIMPLE_PHI);
3415 return &gs->gimple_phi.result;
3418 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3421 gimple_phi_set_result (gimple gs, tree result)
3423 GIMPLE_CHECK (gs, GIMPLE_PHI);
3424 gs->gimple_phi.result = result;
3428 /* Return the PHI argument corresponding to incoming edge INDEX for
3431 static inline struct phi_arg_d *
3432 gimple_phi_arg (gimple gs, unsigned index)
3434 GIMPLE_CHECK (gs, GIMPLE_PHI);
3435 gcc_gimple_checking_assert (index <= gs->gimple_phi.capacity);
3436 return &(gs->gimple_phi.args[index]);
3439 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3440 for GIMPLE_PHI GS. */
3443 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3445 GIMPLE_CHECK (gs, GIMPLE_PHI);
3446 gcc_gimple_checking_assert (index <= gs->gimple_phi.nargs);
3447 gs->gimple_phi.args[index] = *phiarg;
3450 /* Return the region number for GIMPLE_RESX GS. */
3453 gimple_resx_region (const_gimple gs)
3455 GIMPLE_CHECK (gs, GIMPLE_RESX);
3456 return gs->gimple_eh_ctrl.region;
3459 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3462 gimple_resx_set_region (gimple gs, int region)
3464 GIMPLE_CHECK (gs, GIMPLE_RESX);
3465 gs->gimple_eh_ctrl.region = region;
3468 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3471 gimple_eh_dispatch_region (const_gimple gs)
3473 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3474 return gs->gimple_eh_ctrl.region;
3477 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3480 gimple_eh_dispatch_set_region (gimple gs, int region)
3482 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3483 gs->gimple_eh_ctrl.region = region;
3486 /* Return the number of labels associated with the switch statement GS. */
3488 static inline unsigned
3489 gimple_switch_num_labels (const_gimple gs)
3492 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3493 num_ops = gimple_num_ops (gs);
3494 gcc_gimple_checking_assert (num_ops > 1);
3499 /* Set NLABELS to be the number of labels for the switch statement GS. */
3502 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3504 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3505 gimple_set_num_ops (g, nlabels + 1);
3509 /* Return the index variable used by the switch statement GS. */
3512 gimple_switch_index (const_gimple gs)
3514 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3515 return gimple_op (gs, 0);
3519 /* Return a pointer to the index variable for the switch statement GS. */
3521 static inline tree *
3522 gimple_switch_index_ptr (const_gimple gs)
3524 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3525 return gimple_op_ptr (gs, 0);
3529 /* Set INDEX to be the index variable for switch statement GS. */
3532 gimple_switch_set_index (gimple gs, tree index)
3534 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3535 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3536 gimple_set_op (gs, 0, index);
3540 /* Return the label numbered INDEX. The default label is 0, followed by any
3541 labels in a switch statement. */
3544 gimple_switch_label (const_gimple gs, unsigned index)
3546 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3547 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
3548 return gimple_op (gs, index + 1);
3551 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3554 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3556 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3557 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
3558 && (label == NULL_TREE
3559 || TREE_CODE (label) == CASE_LABEL_EXPR));
3560 gimple_set_op (gs, index + 1, label);
3563 /* Return the default label for a switch statement. */
3566 gimple_switch_default_label (const_gimple gs)
3568 return gimple_switch_label (gs, 0);
3571 /* Set the default label for a switch statement. */
3574 gimple_switch_set_default_label (gimple gs, tree label)
3576 gimple_switch_set_label (gs, 0, label);
3579 /* Return true if GS is a GIMPLE_DEBUG statement. */
3582 is_gimple_debug (const_gimple gs)
3584 return gimple_code (gs) == GIMPLE_DEBUG;
3587 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3590 gimple_debug_bind_p (const_gimple s)
3592 if (is_gimple_debug (s))
3593 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3598 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3601 gimple_debug_bind_get_var (gimple dbg)
3603 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3604 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3605 return gimple_op (dbg, 0);
3608 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3612 gimple_debug_bind_get_value (gimple dbg)
3614 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3615 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3616 return gimple_op (dbg, 1);
3619 /* Return a pointer to the value bound to the variable in a
3620 GIMPLE_DEBUG bind statement. */
3622 static inline tree *
3623 gimple_debug_bind_get_value_ptr (gimple dbg)
3625 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3626 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3627 return gimple_op_ptr (dbg, 1);
3630 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3633 gimple_debug_bind_set_var (gimple dbg, tree var)
3635 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3636 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3637 gimple_set_op (dbg, 0, var);
3640 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3644 gimple_debug_bind_set_value (gimple dbg, tree value)
3646 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3647 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3648 gimple_set_op (dbg, 1, value);
3651 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3653 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3655 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3659 gimple_debug_bind_reset_value (gimple dbg)
3661 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3662 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3663 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3666 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3670 gimple_debug_bind_has_value_p (gimple dbg)
3672 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3673 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
3674 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3677 #undef GIMPLE_DEBUG_BIND_NOVALUE
3679 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
3682 gimple_debug_source_bind_p (const_gimple s)
3684 if (is_gimple_debug (s))
3685 return s->gsbase.subcode == GIMPLE_DEBUG_SOURCE_BIND;
3690 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
3693 gimple_debug_source_bind_get_var (gimple dbg)
3695 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3696 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3697 return gimple_op (dbg, 0);
3700 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
3704 gimple_debug_source_bind_get_value (gimple dbg)
3706 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3707 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3708 return gimple_op (dbg, 1);
3711 /* Return a pointer to the value bound to the variable in a
3712 GIMPLE_DEBUG source bind statement. */
3714 static inline tree *
3715 gimple_debug_source_bind_get_value_ptr (gimple dbg)
3717 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3718 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3719 return gimple_op_ptr (dbg, 1);
3722 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
3725 gimple_debug_source_bind_set_var (gimple dbg, tree var)
3727 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3728 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3729 gimple_set_op (dbg, 0, var);
3732 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
3736 gimple_debug_source_bind_set_value (gimple dbg, tree value)
3738 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3739 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
3740 gimple_set_op (dbg, 1, value);
3743 /* Return the body for the OMP statement GS. */
3745 static inline gimple_seq
3746 gimple_omp_body (gimple gs)
3748 return gs->omp.body;
3751 /* Set BODY to be the body for the OMP statement GS. */
3754 gimple_omp_set_body (gimple gs, gimple_seq body)
3756 gs->omp.body = body;
3760 /* Return the name associated with OMP_CRITICAL statement GS. */
3763 gimple_omp_critical_name (const_gimple gs)
3765 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3766 return gs->gimple_omp_critical.name;
3770 /* Return a pointer to the name associated with OMP critical statement GS. */
3772 static inline tree *
3773 gimple_omp_critical_name_ptr (gimple gs)
3775 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3776 return &gs->gimple_omp_critical.name;
3780 /* Set NAME to be the name associated with OMP critical statement GS. */
3783 gimple_omp_critical_set_name (gimple gs, tree name)
3785 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3786 gs->gimple_omp_critical.name = name;
3790 /* Return the clauses associated with OMP_FOR GS. */
3793 gimple_omp_for_clauses (const_gimple gs)
3795 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3796 return gs->gimple_omp_for.clauses;
3800 /* Return a pointer to the OMP_FOR GS. */
3802 static inline tree *
3803 gimple_omp_for_clauses_ptr (gimple gs)
3805 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3806 return &gs->gimple_omp_for.clauses;
3810 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3813 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3815 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3816 gs->gimple_omp_for.clauses = clauses;
3820 /* Get the collapse count of OMP_FOR GS. */
3822 static inline size_t
3823 gimple_omp_for_collapse (gimple gs)
3825 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3826 return gs->gimple_omp_for.collapse;
3830 /* Return the index variable for OMP_FOR GS. */
3833 gimple_omp_for_index (const_gimple gs, size_t i)
3835 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3836 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3837 return gs->gimple_omp_for.iter[i].index;
3841 /* Return a pointer to the index variable for OMP_FOR GS. */
3843 static inline tree *
3844 gimple_omp_for_index_ptr (gimple gs, size_t i)
3846 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3847 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3848 return &gs->gimple_omp_for.iter[i].index;
3852 /* Set INDEX to be the index variable for OMP_FOR GS. */
3855 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3857 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3858 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3859 gs->gimple_omp_for.iter[i].index = index;
3863 /* Return the initial value for OMP_FOR GS. */
3866 gimple_omp_for_initial (const_gimple gs, size_t i)
3868 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3869 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3870 return gs->gimple_omp_for.iter[i].initial;
3874 /* Return a pointer to the initial value for OMP_FOR GS. */
3876 static inline tree *
3877 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3879 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3880 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3881 return &gs->gimple_omp_for.iter[i].initial;
3885 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3888 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3890 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3891 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3892 gs->gimple_omp_for.iter[i].initial = initial;
3896 /* Return the final value for OMP_FOR GS. */
3899 gimple_omp_for_final (const_gimple gs, size_t i)
3901 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3902 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3903 return gs->gimple_omp_for.iter[i].final;
3907 /* Return a pointer to the final value for OMP_FOR GS. */
3909 static inline tree *
3910 gimple_omp_for_final_ptr (gimple gs, size_t i)
3912 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3913 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3914 return &gs->gimple_omp_for.iter[i].final;
3918 /* Set FINAL to be the final value for OMP_FOR GS. */
3921 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3923 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3924 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3925 gs->gimple_omp_for.iter[i].final = final;
3929 /* Return the increment value for OMP_FOR GS. */
3932 gimple_omp_for_incr (const_gimple gs, size_t i)
3934 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3935 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3936 return gs->gimple_omp_for.iter[i].incr;
3940 /* Return a pointer to the increment value for OMP_FOR GS. */
3942 static inline tree *
3943 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3945 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3946 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3947 return &gs->gimple_omp_for.iter[i].incr;
3951 /* Set INCR to be the increment value for OMP_FOR GS. */
3954 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3956 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3957 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
3958 gs->gimple_omp_for.iter[i].incr = incr;
3962 /* Return the sequence of statements to execute before the OMP_FOR
3963 statement GS starts. */
3965 static inline gimple_seq
3966 gimple_omp_for_pre_body (gimple gs)
3968 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3969 return gs->gimple_omp_for.pre_body;
3973 /* Set PRE_BODY to be the sequence of statements to execute before the
3974 OMP_FOR statement GS starts. */
3977 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3979 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3980 gs->gimple_omp_for.pre_body = pre_body;
3984 /* Return the clauses associated with OMP_PARALLEL GS. */
3987 gimple_omp_parallel_clauses (const_gimple gs)
3989 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3990 return gs->gimple_omp_parallel.clauses;
3994 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3996 static inline tree *
3997 gimple_omp_parallel_clauses_ptr (gimple gs)
3999 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4000 return &gs->gimple_omp_parallel.clauses;
4004 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4008 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4010 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4011 gs->gimple_omp_parallel.clauses = clauses;
4015 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4018 gimple_omp_parallel_child_fn (const_gimple gs)
4020 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4021 return gs->gimple_omp_parallel.child_fn;
4024 /* Return a pointer to the child function used to hold the body of
4027 static inline tree *
4028 gimple_omp_parallel_child_fn_ptr (gimple gs)
4030 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4031 return &gs->gimple_omp_parallel.child_fn;
4035 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4038 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4040 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4041 gs->gimple_omp_parallel.child_fn = child_fn;
4045 /* Return the artificial argument used to send variables and values
4046 from the parent to the children threads in OMP_PARALLEL GS. */
4049 gimple_omp_parallel_data_arg (const_gimple gs)
4051 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4052 return gs->gimple_omp_parallel.data_arg;
4056 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4058 static inline tree *
4059 gimple_omp_parallel_data_arg_ptr (gimple gs)
4061 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4062 return &gs->gimple_omp_parallel.data_arg;
4066 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4069 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4071 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
4072 gs->gimple_omp_parallel.data_arg = data_arg;
4076 /* Return the clauses associated with OMP_TASK GS. */
4079 gimple_omp_task_clauses (const_gimple gs)
4081 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4082 return gs->gimple_omp_parallel.clauses;
4086 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4088 static inline tree *
4089 gimple_omp_task_clauses_ptr (gimple gs)
4091 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4092 return &gs->gimple_omp_parallel.clauses;
4096 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4100 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4102 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4103 gs->gimple_omp_parallel.clauses = clauses;
4107 /* Return the child function used to hold the body of OMP_TASK GS. */
4110 gimple_omp_task_child_fn (const_gimple gs)
4112 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4113 return gs->gimple_omp_parallel.child_fn;
4116 /* Return a pointer to the child function used to hold the body of
4119 static inline tree *
4120 gimple_omp_task_child_fn_ptr (gimple gs)
4122 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4123 return &gs->gimple_omp_parallel.child_fn;
4127 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4130 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4132 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4133 gs->gimple_omp_parallel.child_fn = child_fn;
4137 /* Return the artificial argument used to send variables and values
4138 from the parent to the children threads in OMP_TASK GS. */
4141 gimple_omp_task_data_arg (const_gimple gs)
4143 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4144 return gs->gimple_omp_parallel.data_arg;
4148 /* Return a pointer to the data argument for OMP_TASK GS. */
4150 static inline tree *
4151 gimple_omp_task_data_arg_ptr (gimple gs)
4153 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4154 return &gs->gimple_omp_parallel.data_arg;
4158 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4161 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4163 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4164 gs->gimple_omp_parallel.data_arg = data_arg;
4168 /* Return the clauses associated with OMP_TASK GS. */
4171 gimple_omp_taskreg_clauses (const_gimple gs)
4173 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4174 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4175 return gs->gimple_omp_parallel.clauses;
4179 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4181 static inline tree *
4182 gimple_omp_taskreg_clauses_ptr (gimple gs)
4184 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4185 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4186 return &gs->gimple_omp_parallel.clauses;
4190 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4194 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4196 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4197 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4198 gs->gimple_omp_parallel.clauses = clauses;
4202 /* Return the child function used to hold the body of OMP_TASK GS. */
4205 gimple_omp_taskreg_child_fn (const_gimple gs)
4207 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4208 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4209 return gs->gimple_omp_parallel.child_fn;
4212 /* Return a pointer to the child function used to hold the body of
4215 static inline tree *
4216 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4218 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4219 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4220 return &gs->gimple_omp_parallel.child_fn;
4224 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4227 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4229 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4230 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4231 gs->gimple_omp_parallel.child_fn = child_fn;
4235 /* Return the artificial argument used to send variables and values
4236 from the parent to the children threads in OMP_TASK GS. */
4239 gimple_omp_taskreg_data_arg (const_gimple gs)
4241 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4242 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4243 return gs->gimple_omp_parallel.data_arg;
4247 /* Return a pointer to the data argument for OMP_TASK GS. */
4249 static inline tree *
4250 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4252 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4253 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4254 return &gs->gimple_omp_parallel.data_arg;
4258 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4261 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4263 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
4264 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4265 gs->gimple_omp_parallel.data_arg = data_arg;
4269 /* Return the copy function used to hold the body of OMP_TASK GS. */
4272 gimple_omp_task_copy_fn (const_gimple gs)
4274 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4275 return gs->gimple_omp_task.copy_fn;
4278 /* Return a pointer to the copy function used to hold the body of
4281 static inline tree *
4282 gimple_omp_task_copy_fn_ptr (gimple gs)
4284 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4285 return &gs->gimple_omp_task.copy_fn;
4289 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4292 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4294 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4295 gs->gimple_omp_task.copy_fn = copy_fn;
4299 /* Return size of the data block in bytes in OMP_TASK GS. */
4302 gimple_omp_task_arg_size (const_gimple gs)
4304 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4305 return gs->gimple_omp_task.arg_size;
4309 /* Return a pointer to the data block size for OMP_TASK GS. */
4311 static inline tree *
4312 gimple_omp_task_arg_size_ptr (gimple gs)
4314 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4315 return &gs->gimple_omp_task.arg_size;
4319 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4322 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4324 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4325 gs->gimple_omp_task.arg_size = arg_size;
4329 /* Return align of the data block in bytes in OMP_TASK GS. */
4332 gimple_omp_task_arg_align (const_gimple gs)
4334 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4335 return gs->gimple_omp_task.arg_align;
4339 /* Return a pointer to the data block align for OMP_TASK GS. */
4341 static inline tree *
4342 gimple_omp_task_arg_align_ptr (gimple gs)
4344 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4345 return &gs->gimple_omp_task.arg_align;
4349 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4352 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4354 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4355 gs->gimple_omp_task.arg_align = arg_align;
4359 /* Return the clauses associated with OMP_SINGLE GS. */
4362 gimple_omp_single_clauses (const_gimple gs)
4364 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4365 return gs->gimple_omp_single.clauses;
4369 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4371 static inline tree *
4372 gimple_omp_single_clauses_ptr (gimple gs)
4374 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4375 return &gs->gimple_omp_single.clauses;
4379 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4382 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4384 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4385 gs->gimple_omp_single.clauses = clauses;
4389 /* Return the clauses associated with OMP_SECTIONS GS. */
4392 gimple_omp_sections_clauses (const_gimple gs)
4394 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4395 return gs->gimple_omp_sections.clauses;
4399 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4401 static inline tree *
4402 gimple_omp_sections_clauses_ptr (gimple gs)
4404 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4405 return &gs->gimple_omp_sections.clauses;
4409 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4413 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4415 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4416 gs->gimple_omp_sections.clauses = clauses;
4420 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4424 gimple_omp_sections_control (const_gimple gs)
4426 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4427 return gs->gimple_omp_sections.control;
4431 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4434 static inline tree *
4435 gimple_omp_sections_control_ptr (gimple gs)
4437 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4438 return &gs->gimple_omp_sections.control;
4442 /* Set CONTROL to be the set of clauses associated with the
4443 GIMPLE_OMP_SECTIONS in GS. */
4446 gimple_omp_sections_set_control (gimple gs, tree control)
4448 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4449 gs->gimple_omp_sections.control = control;
4453 /* Set COND to be the condition code for OMP_FOR GS. */
4456 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4458 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4459 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4460 && i < gs->gimple_omp_for.collapse);
4461 gs->gimple_omp_for.iter[i].cond = cond;
4465 /* Return the condition code associated with OMP_FOR GS. */
4467 static inline enum tree_code
4468 gimple_omp_for_cond (const_gimple gs, size_t i)
4470 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4471 gcc_gimple_checking_assert (i < gs->gimple_omp_for.collapse);
4472 return gs->gimple_omp_for.iter[i].cond;
4476 /* Set the value being stored in an atomic store. */
4479 gimple_omp_atomic_store_set_val (gimple g, tree val)
4481 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4482 g->gimple_omp_atomic_store.val = val;
4486 /* Return the value being stored in an atomic store. */
4489 gimple_omp_atomic_store_val (const_gimple g)
4491 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4492 return g->gimple_omp_atomic_store.val;
4496 /* Return a pointer to the value being stored in an atomic store. */
4498 static inline tree *
4499 gimple_omp_atomic_store_val_ptr (gimple g)
4501 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4502 return &g->gimple_omp_atomic_store.val;
4506 /* Set the LHS of an atomic load. */
4509 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4511 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4512 g->gimple_omp_atomic_load.lhs = lhs;
4516 /* Get the LHS of an atomic load. */
4519 gimple_omp_atomic_load_lhs (const_gimple g)
4521 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4522 return g->gimple_omp_atomic_load.lhs;
4526 /* Return a pointer to the LHS of an atomic load. */
4528 static inline tree *
4529 gimple_omp_atomic_load_lhs_ptr (gimple g)
4531 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4532 return &g->gimple_omp_atomic_load.lhs;
4536 /* Set the RHS of an atomic load. */
4539 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4541 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4542 g->gimple_omp_atomic_load.rhs = rhs;
4546 /* Get the RHS of an atomic load. */
4549 gimple_omp_atomic_load_rhs (const_gimple g)
4551 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4552 return g->gimple_omp_atomic_load.rhs;
4556 /* Return a pointer to the RHS of an atomic load. */
4558 static inline tree *
4559 gimple_omp_atomic_load_rhs_ptr (gimple g)
4561 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4562 return &g->gimple_omp_atomic_load.rhs;
4566 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4569 gimple_omp_continue_control_def (const_gimple g)
4571 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4572 return g->gimple_omp_continue.control_def;
4575 /* The same as above, but return the address. */
4577 static inline tree *
4578 gimple_omp_continue_control_def_ptr (gimple g)
4580 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4581 return &g->gimple_omp_continue.control_def;
4584 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4587 gimple_omp_continue_set_control_def (gimple g, tree def)
4589 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4590 g->gimple_omp_continue.control_def = def;
4594 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4597 gimple_omp_continue_control_use (const_gimple g)
4599 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4600 return g->gimple_omp_continue.control_use;
4604 /* The same as above, but return the address. */
4606 static inline tree *
4607 gimple_omp_continue_control_use_ptr (gimple g)
4609 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4610 return &g->gimple_omp_continue.control_use;
4614 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4617 gimple_omp_continue_set_control_use (gimple g, tree use)
4619 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4620 g->gimple_omp_continue.control_use = use;
4623 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
4625 static inline gimple_seq
4626 gimple_transaction_body (gimple gs)
4628 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4629 return gs->gimple_transaction.body;
4632 /* Return the label associated with a GIMPLE_TRANSACTION. */
4635 gimple_transaction_label (const_gimple gs)
4637 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4638 return gs->gimple_transaction.label;
4641 static inline tree *
4642 gimple_transaction_label_ptr (gimple gs)
4644 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4645 return &gs->gimple_transaction.label;
4648 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
4650 static inline unsigned int
4651 gimple_transaction_subcode (const_gimple gs)
4653 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4654 return gs->gsbase.subcode;
4657 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
4660 gimple_transaction_set_body (gimple gs, gimple_seq body)
4662 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4663 gs->gimple_transaction.body = body;
4666 /* Set the label associated with a GIMPLE_TRANSACTION. */
4669 gimple_transaction_set_label (gimple gs, tree label)
4671 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4672 gs->gimple_transaction.label = label;
4675 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
4678 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
4680 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
4681 gs->gsbase.subcode = subcode;
4685 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4687 static inline tree *
4688 gimple_return_retval_ptr (const_gimple gs)
4690 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4691 return gimple_op_ptr (gs, 0);
4694 /* Return the return value for GIMPLE_RETURN GS. */
4697 gimple_return_retval (const_gimple gs)
4699 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4700 return gimple_op (gs, 0);
4704 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4707 gimple_return_set_retval (gimple gs, tree retval)
4709 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4710 gimple_set_op (gs, 0, retval);
4714 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4716 #define CASE_GIMPLE_OMP \
4717 case GIMPLE_OMP_PARALLEL: \
4718 case GIMPLE_OMP_TASK: \
4719 case GIMPLE_OMP_FOR: \
4720 case GIMPLE_OMP_SECTIONS: \
4721 case GIMPLE_OMP_SECTIONS_SWITCH: \
4722 case GIMPLE_OMP_SINGLE: \
4723 case GIMPLE_OMP_SECTION: \
4724 case GIMPLE_OMP_MASTER: \
4725 case GIMPLE_OMP_ORDERED: \
4726 case GIMPLE_OMP_CRITICAL: \
4727 case GIMPLE_OMP_RETURN: \
4728 case GIMPLE_OMP_ATOMIC_LOAD: \
4729 case GIMPLE_OMP_ATOMIC_STORE: \
4730 case GIMPLE_OMP_CONTINUE
4733 is_gimple_omp (const_gimple stmt)
4735 switch (gimple_code (stmt))
4745 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4748 gimple_nop_p (const_gimple g)
4750 return gimple_code (g) == GIMPLE_NOP;
4754 /* Return true if GS is a GIMPLE_RESX. */
4757 is_gimple_resx (const_gimple gs)
4759 return gimple_code (gs) == GIMPLE_RESX;
4762 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4764 static inline enum br_predictor
4765 gimple_predict_predictor (gimple gs)
4767 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4768 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4772 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4775 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4777 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4778 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4779 | (unsigned) predictor;
4783 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4785 static inline enum prediction
4786 gimple_predict_outcome (gimple gs)
4788 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4789 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4793 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4796 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4798 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4799 if (outcome == TAKEN)
4800 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4802 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4806 /* Return the type of the main expression computed by STMT. Return
4807 void_type_node if the statement computes nothing. */
4810 gimple_expr_type (const_gimple stmt)
4812 enum gimple_code code = gimple_code (stmt);
4814 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4817 /* In general we want to pass out a type that can be substituted
4818 for both the RHS and the LHS types if there is a possibly
4819 useless conversion involved. That means returning the
4820 original RHS type as far as we can reconstruct it. */
4821 if (code == GIMPLE_CALL)
4822 type = gimple_call_return_type (stmt);
4824 switch (gimple_assign_rhs_code (stmt))
4826 case POINTER_PLUS_EXPR:
4827 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4831 /* As fallback use the type of the LHS. */
4832 type = TREE_TYPE (gimple_get_lhs (stmt));
4837 else if (code == GIMPLE_COND)
4838 return boolean_type_node;
4840 return void_type_node;
4844 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4846 static inline gimple_stmt_iterator
4847 gsi_start (gimple_seq seq)
4849 gimple_stmt_iterator i;
4851 i.ptr = gimple_seq_first (seq);
4853 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4859 /* Return a new iterator pointing to the first statement in basic block BB. */
4861 static inline gimple_stmt_iterator
4862 gsi_start_bb (basic_block bb)
4864 gimple_stmt_iterator i;
4868 i.ptr = gimple_seq_first (seq);
4876 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4878 static inline gimple_stmt_iterator
4879 gsi_last (gimple_seq seq)
4881 gimple_stmt_iterator i;
4883 i.ptr = gimple_seq_last (seq);
4885 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4891 /* Return a new iterator pointing to the last statement in basic block BB. */
4893 static inline gimple_stmt_iterator
4894 gsi_last_bb (basic_block bb)
4896 gimple_stmt_iterator i;
4900 i.ptr = gimple_seq_last (seq);
4908 /* Return true if I is at the end of its sequence. */
4911 gsi_end_p (gimple_stmt_iterator i)
4913 return i.ptr == NULL;
4917 /* Return true if I is one statement before the end of its sequence. */
4920 gsi_one_before_end_p (gimple_stmt_iterator i)
4922 return i.ptr != NULL && i.ptr->next == NULL;
4926 /* Advance the iterator to the next gimple statement. */
4929 gsi_next (gimple_stmt_iterator *i)
4931 i->ptr = i->ptr->next;
4934 /* Advance the iterator to the previous gimple statement. */
4937 gsi_prev (gimple_stmt_iterator *i)
4939 i->ptr = i->ptr->prev;
4942 /* Return the current stmt. */
4944 static inline gimple
4945 gsi_stmt (gimple_stmt_iterator i)
4950 /* Return a block statement iterator that points to the first non-label
4951 statement in block BB. */
4953 static inline gimple_stmt_iterator
4954 gsi_after_labels (basic_block bb)
4956 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4958 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4964 /* Advance the iterator to the next non-debug gimple statement. */
4967 gsi_next_nondebug (gimple_stmt_iterator *i)
4973 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4976 /* Advance the iterator to the next non-debug gimple statement. */
4979 gsi_prev_nondebug (gimple_stmt_iterator *i)
4985 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4988 /* Return a new iterator pointing to the first non-debug statement in
4991 static inline gimple_stmt_iterator
4992 gsi_start_nondebug_bb (basic_block bb)
4994 gimple_stmt_iterator i = gsi_start_bb (bb);
4996 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4997 gsi_next_nondebug (&i);
5002 /* Return a new iterator pointing to the last non-debug statement in
5005 static inline gimple_stmt_iterator
5006 gsi_last_nondebug_bb (basic_block bb)
5008 gimple_stmt_iterator i = gsi_last_bb (bb);
5010 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
5011 gsi_prev_nondebug (&i);
5016 /* Return a pointer to the current stmt.
5018 NOTE: You may want to use gsi_replace on the iterator itself,
5019 as this performs additional bookkeeping that will not be done
5020 if you simply assign through a pointer returned by gsi_stmt_ptr. */
5022 static inline gimple *
5023 gsi_stmt_ptr (gimple_stmt_iterator *i)
5025 return &i->ptr->stmt;
5029 /* Return the basic block associated with this iterator. */
5031 static inline basic_block
5032 gsi_bb (gimple_stmt_iterator i)
5038 /* Return the sequence associated with this iterator. */
5040 static inline gimple_seq
5041 gsi_seq (gimple_stmt_iterator i)
5047 enum gsi_iterator_update
5049 GSI_NEW_STMT, /* Only valid when single statement is added, move
5051 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
5052 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
5053 for linking other statements in the same
5057 /* In gimple-iterator.c */
5058 gimple_stmt_iterator gsi_start_phis (basic_block);
5059 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
5060 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
5061 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
5062 void gsi_insert_before (gimple_stmt_iterator *, gimple,
5063 enum gsi_iterator_update);
5064 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
5065 enum gsi_iterator_update);
5066 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
5067 enum gsi_iterator_update);
5068 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
5069 enum gsi_iterator_update);
5070 void gsi_insert_after (gimple_stmt_iterator *, gimple,
5071 enum gsi_iterator_update);
5072 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
5073 enum gsi_iterator_update);
5074 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
5075 enum gsi_iterator_update);
5076 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
5077 enum gsi_iterator_update);
5078 void gsi_remove (gimple_stmt_iterator *, bool);
5079 gimple_stmt_iterator gsi_for_stmt (gimple);
5080 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
5081 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
5082 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
5083 void gsi_insert_on_edge (edge, gimple);
5084 void gsi_insert_seq_on_edge (edge, gimple_seq);
5085 basic_block gsi_insert_on_edge_immediate (edge, gimple);
5086 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
5087 void gsi_commit_one_edge_insert (edge, basic_block *);
5088 void gsi_commit_edge_inserts (void);
5089 gimple gimple_call_copy_skip_args (gimple, bitmap);
5092 /* Convenience routines to walk all statements of a gimple function.
5093 Note that this is useful exclusively before the code is converted
5094 into SSA form. Once the program is in SSA form, the standard
5095 operand interface should be used to analyze/modify statements. */
5096 struct walk_stmt_info
5098 /* Points to the current statement being walked. */
5099 gimple_stmt_iterator gsi;
5101 /* Additional data that the callback functions may want to carry
5102 through the recursion. */
5105 /* Pointer map used to mark visited tree nodes when calling
5106 walk_tree on each operand. If set to NULL, duplicate tree nodes
5107 will be visited more than once. */
5108 struct pointer_set_t *pset;
5110 /* Operand returned by the callbacks. This is set when calling
5111 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
5112 returns non-NULL, this field will contain the tree returned by
5113 the last callback. */
5114 tree callback_result;
5116 /* Indicates whether the operand being examined may be replaced
5117 with something that matches is_gimple_val (if true) or something
5118 slightly more complicated (if false). "Something" technically
5119 means the common subset of is_gimple_lvalue and is_gimple_rhs,
5120 but we never try to form anything more complicated than that, so
5121 we don't bother checking.
5123 Also note that CALLBACK should update this flag while walking the
5124 sub-expressions of a statement. For instance, when walking the
5125 statement 'foo (&var)', the flag VAL_ONLY will initially be set
5126 to true, however, when walking &var, the operand of that
5127 ADDR_EXPR does not need to be a GIMPLE value. */
5128 BOOL_BITFIELD val_only : 1;
5130 /* True if we are currently walking the LHS of an assignment. */
5131 BOOL_BITFIELD is_lhs : 1;
5133 /* Optional. Set to true by the callback functions if they made any
5135 BOOL_BITFIELD changed : 1;
5137 /* True if we're interested in location information. */
5138 BOOL_BITFIELD want_locations : 1;
5140 /* True if we've removed the statement that was processed. */
5141 BOOL_BITFIELD removed_stmt : 1;
5144 /* Callback for walk_gimple_stmt. Called for every statement found
5145 during traversal. The first argument points to the statement to
5146 walk. The second argument is a flag that the callback sets to
5147 'true' if it the callback handled all the operands and
5148 sub-statements of the statement (the default value of this flag is
5149 'false'). The third argument is an anonymous pointer to data
5150 to be used by the callback. */
5151 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
5152 struct walk_stmt_info *);
5154 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
5155 struct walk_stmt_info *);
5156 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
5157 struct walk_stmt_info *);
5158 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
5160 #ifdef GATHER_STATISTICS
5161 /* Enum and arrays used for allocation stats. Keep in sync with
5162 gimple.c:gimple_alloc_kind_names. */
5163 enum gimple_alloc_kind
5165 gimple_alloc_kind_assign, /* Assignments. */
5166 gimple_alloc_kind_phi, /* PHI nodes. */
5167 gimple_alloc_kind_cond, /* Conditionals. */
5168 gimple_alloc_kind_seq, /* Sequences. */
5169 gimple_alloc_kind_rest, /* Everything else. */
5170 gimple_alloc_kind_all
5173 extern int gimple_alloc_counts[];
5174 extern int gimple_alloc_sizes[];
5176 /* Return the allocation kind for a given stmt CODE. */
5177 static inline enum gimple_alloc_kind
5178 gimple_alloc_kind (enum gimple_code code)
5183 return gimple_alloc_kind_assign;
5185 return gimple_alloc_kind_phi;
5187 return gimple_alloc_kind_cond;
5189 return gimple_alloc_kind_rest;
5192 #endif /* GATHER_STATISTICS */
5194 extern void dump_gimple_statistics (void);
5196 /* In gimple-fold.c. */
5197 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
5198 tree gimple_fold_builtin (gimple);
5199 bool fold_stmt (gimple_stmt_iterator *);
5200 bool fold_stmt_inplace (gimple_stmt_iterator *);
5201 tree get_symbol_constant_value (tree);
5202 tree canonicalize_constructor_val (tree);
5203 extern tree maybe_fold_and_comparisons (enum tree_code, tree, tree,
5204 enum tree_code, tree, tree);
5205 extern tree maybe_fold_or_comparisons (enum tree_code, tree, tree,
5206 enum tree_code, tree, tree);
5208 bool gimple_val_nonnegative_real_p (tree);
5209 #endif /* GCC_GIMPLE_H */