1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009, 2010 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"
29 #include "hard-reg-set.h"
30 #include "basic-block.h"
31 #include "tree-ssa-operands.h"
32 #include "tree-ssa-alias.h"
35 DEF_VEC_ALLOC_P(gimple,heap);
36 DEF_VEC_ALLOC_P(gimple,gc);
38 typedef gimple *gimple_p;
40 DEF_VEC_ALLOC_P(gimple_p,heap);
42 DEF_VEC_P(gimple_seq);
43 DEF_VEC_ALLOC_P(gimple_seq,gc);
44 DEF_VEC_ALLOC_P(gimple_seq,heap);
46 /* For each block, the PHI nodes that need to be rewritten are stored into
48 typedef VEC(gimple, heap) *gimple_vec;
49 DEF_VEC_P (gimple_vec);
50 DEF_VEC_ALLOC_P (gimple_vec, heap);
53 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
56 LAST_AND_UNUSED_GIMPLE_CODE
59 extern const char *const gimple_code_name[];
60 extern const unsigned char gimple_rhs_class_table[];
62 /* Error out if a gimple tuple is addressed incorrectly. */
63 #if defined ENABLE_GIMPLE_CHECKING
64 extern void gimple_check_failed (const_gimple, const char *, int, \
65 const char *, enum gimple_code, \
66 enum tree_code) ATTRIBUTE_NORETURN;
68 #define GIMPLE_CHECK(GS, CODE) \
70 const_gimple __gs = (GS); \
71 if (gimple_code (__gs) != (CODE)) \
72 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
73 (CODE), ERROR_MARK); \
75 #else /* not ENABLE_GIMPLE_CHECKING */
76 #define GIMPLE_CHECK(GS, CODE) (void)0
79 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
80 get_gimple_rhs_class. */
83 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
84 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
85 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
86 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
87 name, a _DECL, a _REF, etc. */
90 /* Specific flags for individual GIMPLE statements. These flags are
91 always stored in gimple_statement_base.subcode and they may only be
92 defined for statement codes that do not use sub-codes.
94 Values for the masks can overlap as long as the overlapping values
95 are never used in the same statement class.
97 The maximum mask value that can be defined is 1 << 15 (i.e., each
98 statement code can hold up to 16 bitflags).
100 Keep this list sorted. */
102 GF_ASM_INPUT = 1 << 0,
103 GF_ASM_VOLATILE = 1 << 1,
104 GF_CALL_CANNOT_INLINE = 1 << 0,
105 GF_CALL_FROM_THUNK = 1 << 1,
106 GF_CALL_RETURN_SLOT_OPT = 1 << 2,
107 GF_CALL_TAILCALL = 1 << 3,
108 GF_CALL_VA_ARG_PACK = 1 << 4,
109 GF_OMP_PARALLEL_COMBINED = 1 << 0,
111 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
112 a thread synchronization via some sort of barrier. The exact barrier
113 that would otherwise be emitted is dependent on the OMP statement with
114 which this return is associated. */
115 GF_OMP_RETURN_NOWAIT = 1 << 0,
117 GF_OMP_SECTION_LAST = 1 << 0,
118 GF_PREDICT_TAKEN = 1 << 15
121 /* Currently, there's only one type of gimple debug stmt. Others are
122 envisioned, for example, to enable the generation of is_stmt notes
123 in line number information, to mark sequence points, etc. This
124 subcode is to be used to tell them apart. */
125 enum gimple_debug_subcode {
126 GIMPLE_DEBUG_BIND = 0
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 /* Allocate a new sequence and initialize its first element with STMT. */
226 static inline gimple_seq
227 gimple_seq_alloc_with_stmt (gimple stmt)
229 gimple_seq seq = NULL;
230 gimple_seq_add_stmt (&seq, stmt);
235 /* Returns the sequence of statements in BB. */
237 static inline gimple_seq
238 bb_seq (const_basic_block bb)
240 return (!(bb->flags & BB_RTL) && bb->il.gimple) ? bb->il.gimple->seq : NULL;
244 /* Sets the sequence of statements in BB to SEQ. */
247 set_bb_seq (basic_block bb, gimple_seq seq)
249 gcc_assert (!(bb->flags & BB_RTL));
250 bb->il.gimple->seq = seq;
253 /* Iterator object for GIMPLE statement sequences. */
257 /* Sequence node holding the current statement. */
260 /* Sequence and basic block holding the statement. These fields
261 are necessary to handle edge cases such as when statement is
262 added to an empty basic block or when the last statement of a
263 block/sequence is removed. */
266 } gimple_stmt_iterator;
269 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
270 are for 64 bit hosts. */
272 struct GTY(()) gimple_statement_base {
274 Main identifying code for a tuple. */
275 ENUM_BITFIELD(gimple_code) code : 8;
277 /* Nonzero if a warning should not be emitted on this tuple. */
278 unsigned int no_warning : 1;
280 /* Nonzero if this tuple has been visited. Passes are responsible
281 for clearing this bit before using it. */
282 unsigned int visited : 1;
284 /* Nonzero if this tuple represents a non-temporal move. */
285 unsigned int nontemporal_move : 1;
287 /* Pass local flags. These flags are free for any pass to use as
288 they see fit. Passes should not assume that these flags contain
289 any useful value when the pass starts. Any initial state that
290 the pass requires should be set on entry to the pass. See
291 gimple_set_plf and gimple_plf for usage. */
292 unsigned int plf : 2;
294 /* Nonzero if this statement has been modified and needs to have its
295 operands rescanned. */
296 unsigned modified : 1;
298 /* Nonzero if this statement contains volatile operands. */
299 unsigned has_volatile_ops : 1;
301 /* Padding to get subcode to 16 bit alignment. */
304 /* The SUBCODE field can be used for tuple-specific flags for tuples
305 that do not require subcodes. Note that SUBCODE should be at
306 least as wide as tree codes, as several tuples store tree codes
308 unsigned int subcode : 16;
310 /* UID of this statement. This is used by passes that want to
311 assign IDs to statements. It must be assigned and used by each
312 pass. By default it should be assumed to contain garbage. */
316 Locus information for debug info. */
319 /* Number of operands in this tuple. */
323 Basic block holding this statement. */
324 struct basic_block_def *bb;
327 Lexical block holding this statement. */
332 /* Base structure for tuples with operands. */
334 struct GTY(()) gimple_statement_with_ops_base
337 struct gimple_statement_base gsbase;
340 SSA operand vectors. NOTE: It should be possible to
341 amalgamate these vectors with the operand vector OP. However,
342 the SSA operand vectors are organized differently and contain
343 more information (like immediate use chaining). */
344 struct def_optype_d GTY((skip (""))) *def_ops;
345 struct use_optype_d GTY((skip (""))) *use_ops;
349 /* Statements that take register operands. */
351 struct GTY(()) gimple_statement_with_ops
354 struct gimple_statement_with_ops_base opbase;
357 Operand vector. NOTE! This must always be the last field
358 of this structure. In particular, this means that this
359 structure cannot be embedded inside another one. */
360 tree GTY((length ("%h.opbase.gsbase.num_ops"))) op[1];
364 /* Base for statements that take both memory and register operands. */
366 struct GTY(()) gimple_statement_with_memory_ops_base
369 struct gimple_statement_with_ops_base opbase;
372 Virtual operands for this statement. The GC will pick them
373 up via the ssa_names array. */
374 tree GTY((skip (""))) vdef;
375 tree GTY((skip (""))) vuse;
379 /* Statements that take both memory and register operands. */
381 struct GTY(()) gimple_statement_with_memory_ops
384 struct gimple_statement_with_memory_ops_base membase;
387 Operand vector. NOTE! This must always be the last field
388 of this structure. In particular, this means that this
389 structure cannot be embedded inside another one. */
390 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
394 /* Call statements that take both memory and register operands. */
396 struct GTY(()) gimple_statement_call
399 struct gimple_statement_with_memory_ops_base membase;
402 struct pt_solution call_used;
403 struct pt_solution call_clobbered;
406 Operand vector. NOTE! This must always be the last field
407 of this structure. In particular, this means that this
408 structure cannot be embedded inside another one. */
409 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
413 /* OpenMP statements (#pragma omp). */
415 struct GTY(()) gimple_statement_omp {
417 struct gimple_statement_base gsbase;
426 struct GTY(()) gimple_statement_bind {
428 struct gimple_statement_base gsbase;
431 Variables declared in this scope. */
435 This is different than the BLOCK field in gimple_statement_base,
436 which is analogous to TREE_BLOCK (i.e., the lexical block holding
437 this statement). This field is the equivalent of BIND_EXPR_BLOCK
438 in tree land (i.e., the lexical scope defined by this bind). See
449 struct GTY(()) gimple_statement_catch {
451 struct gimple_statement_base gsbase;
461 /* GIMPLE_EH_FILTER */
463 struct GTY(()) gimple_statement_eh_filter {
465 struct gimple_statement_base gsbase;
477 /* GIMPLE_EH_MUST_NOT_THROW */
479 struct GTY(()) gimple_statement_eh_mnt {
481 struct gimple_statement_base gsbase;
483 /* [ WORD 5 ] Abort function decl. */
489 struct GTY(()) gimple_statement_phi {
491 struct gimple_statement_base gsbase;
501 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
505 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
507 struct GTY(()) gimple_statement_eh_ctrl
510 struct gimple_statement_base gsbase;
513 Exception region number. */
520 struct GTY(()) gimple_statement_try {
522 struct gimple_statement_base gsbase;
525 Expression to evaluate. */
529 Cleanup expression. */
533 /* Kind of GIMPLE_TRY statements. */
534 enum gimple_try_flags
537 GIMPLE_TRY_CATCH = 1 << 0,
540 GIMPLE_TRY_FINALLY = 1 << 1,
541 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
543 /* Analogous to TRY_CATCH_IS_CLEANUP. */
544 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
547 /* GIMPLE_WITH_CLEANUP_EXPR */
549 struct GTY(()) gimple_statement_wce {
551 struct gimple_statement_base gsbase;
553 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
554 executed if an exception is thrown, not on normal exit of its
555 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
559 Cleanup expression. */
566 struct GTY(()) gimple_statement_asm
569 struct gimple_statement_with_memory_ops_base membase;
572 __asm__ statement. */
576 Number of inputs, outputs, clobbers, labels. */
583 Operand vector. NOTE! This must always be the last field
584 of this structure. In particular, this means that this
585 structure cannot be embedded inside another one. */
586 tree GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op[1];
589 /* GIMPLE_OMP_CRITICAL */
591 struct GTY(()) gimple_statement_omp_critical {
593 struct gimple_statement_omp omp;
596 Critical section name. */
601 struct GTY(()) gimple_omp_for_iter {
602 /* Condition code. */
605 /* Index variable. */
620 struct GTY(()) gimple_statement_omp_for {
622 struct gimple_statement_omp omp;
628 Number of elements in iter array. */
632 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
635 Pre-body evaluated before the loop body begins. */
640 /* GIMPLE_OMP_PARALLEL */
642 struct GTY(()) gimple_statement_omp_parallel {
644 struct gimple_statement_omp omp;
651 Child function holding the body of the parallel region. */
655 Shared data argument. */
660 /* GIMPLE_OMP_TASK */
662 struct GTY(()) gimple_statement_omp_task {
664 struct gimple_statement_omp_parallel par;
667 Child function holding firstprivate initialization if needed. */
671 Size and alignment in bytes of the argument data block. */
677 /* GIMPLE_OMP_SECTION */
678 /* Uses struct gimple_statement_omp. */
681 /* GIMPLE_OMP_SECTIONS */
683 struct GTY(()) gimple_statement_omp_sections {
685 struct gimple_statement_omp omp;
691 The control variable used for deciding which of the sections to
696 /* GIMPLE_OMP_CONTINUE.
698 Note: This does not inherit from gimple_statement_omp, because we
699 do not need the body field. */
701 struct GTY(()) gimple_statement_omp_continue {
703 struct gimple_statement_base gsbase;
712 /* GIMPLE_OMP_SINGLE */
714 struct GTY(()) gimple_statement_omp_single {
716 struct gimple_statement_omp omp;
723 /* GIMPLE_OMP_ATOMIC_LOAD.
724 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
725 contains a sequence, which we don't need here. */
727 struct GTY(()) gimple_statement_omp_atomic_load {
729 struct gimple_statement_base gsbase;
735 /* GIMPLE_OMP_ATOMIC_STORE.
736 See note on GIMPLE_OMP_ATOMIC_LOAD. */
738 struct GTY(()) gimple_statement_omp_atomic_store {
740 struct gimple_statement_base gsbase;
746 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
747 enum gimple_statement_structure_enum {
748 #include "gsstruct.def"
754 /* Define the overall contents of a gimple tuple. It may be any of the
755 structures declared above for various types of tuples. */
757 union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d {
758 struct gimple_statement_base GTY ((tag ("GSS_BASE"))) gsbase;
759 struct gimple_statement_with_ops GTY ((tag ("GSS_WITH_OPS"))) gsops;
760 struct gimple_statement_with_memory_ops_base GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase;
761 struct gimple_statement_with_memory_ops GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem;
762 struct gimple_statement_call GTY ((tag ("GSS_CALL"))) gimple_call;
763 struct gimple_statement_omp GTY ((tag ("GSS_OMP"))) omp;
764 struct gimple_statement_bind GTY ((tag ("GSS_BIND"))) gimple_bind;
765 struct gimple_statement_catch GTY ((tag ("GSS_CATCH"))) gimple_catch;
766 struct gimple_statement_eh_filter GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter;
767 struct gimple_statement_eh_mnt GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt;
768 struct gimple_statement_phi GTY ((tag ("GSS_PHI"))) gimple_phi;
769 struct gimple_statement_eh_ctrl GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl;
770 struct gimple_statement_try GTY ((tag ("GSS_TRY"))) gimple_try;
771 struct gimple_statement_wce GTY ((tag ("GSS_WCE"))) gimple_wce;
772 struct gimple_statement_asm GTY ((tag ("GSS_ASM"))) gimple_asm;
773 struct gimple_statement_omp_critical GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical;
774 struct gimple_statement_omp_for GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for;
775 struct gimple_statement_omp_parallel GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel;
776 struct gimple_statement_omp_task GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task;
777 struct gimple_statement_omp_sections GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections;
778 struct gimple_statement_omp_single GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single;
779 struct gimple_statement_omp_continue GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue;
780 struct gimple_statement_omp_atomic_load GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load;
781 struct gimple_statement_omp_atomic_store GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store;
786 /* Offset in bytes to the location of the operand vector.
787 Zero if there is no operand vector for this tuple structure. */
788 extern size_t const gimple_ops_offset_[];
790 /* Map GIMPLE codes to GSS codes. */
791 extern enum gimple_statement_structure_enum const gss_for_code_[];
793 /* This variable holds the currently expanded gimple statement for purposes
794 of comminucating the profile info to the builtin expanders. */
795 extern gimple currently_expanding_gimple_stmt;
797 gimple gimple_build_return (tree);
799 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
800 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
802 void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *);
804 gimple gimple_build_assign_with_ops_stat (enum tree_code, tree, tree,
806 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
807 gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
809 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
810 #define gimple_build_debug_bind(var,val,stmt) \
811 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
813 gimple gimple_build_call_vec (tree, VEC(tree, heap) *);
814 gimple gimple_build_call (tree, unsigned, ...);
815 gimple gimple_build_call_from_tree (tree);
816 gimple gimplify_assign (tree, tree, gimple_seq *);
817 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
818 gimple gimple_build_label (tree label);
819 gimple gimple_build_goto (tree dest);
820 gimple gimple_build_nop (void);
821 gimple gimple_build_bind (tree, gimple_seq, tree);
822 gimple gimple_build_asm_vec (const char *, VEC(tree,gc) *, VEC(tree,gc) *,
823 VEC(tree,gc) *, VEC(tree,gc) *);
824 gimple gimple_build_catch (tree, gimple_seq);
825 gimple gimple_build_eh_filter (tree, gimple_seq);
826 gimple gimple_build_eh_must_not_throw (tree);
827 gimple gimple_build_try (gimple_seq, gimple_seq, enum gimple_try_flags);
828 gimple gimple_build_wce (gimple_seq);
829 gimple gimple_build_resx (int);
830 gimple gimple_build_eh_dispatch (int);
831 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
832 gimple gimple_build_switch (unsigned, tree, tree, ...);
833 gimple gimple_build_switch_vec (tree, tree, VEC(tree,heap) *);
834 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
835 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
836 gimple gimple_build_omp_for (gimple_seq, tree, size_t, gimple_seq);
837 gimple gimple_build_omp_critical (gimple_seq, tree);
838 gimple gimple_build_omp_section (gimple_seq);
839 gimple gimple_build_omp_continue (tree, tree);
840 gimple gimple_build_omp_master (gimple_seq);
841 gimple gimple_build_omp_return (bool);
842 gimple gimple_build_omp_ordered (gimple_seq);
843 gimple gimple_build_omp_sections (gimple_seq, tree);
844 gimple gimple_build_omp_sections_switch (void);
845 gimple gimple_build_omp_single (gimple_seq, tree);
846 gimple gimple_build_cdt (tree, tree);
847 gimple gimple_build_omp_atomic_load (tree, tree);
848 gimple gimple_build_omp_atomic_store (tree);
849 gimple gimple_build_predict (enum br_predictor, enum prediction);
850 enum gimple_statement_structure_enum gss_for_assign (enum tree_code);
851 void sort_case_labels (VEC(tree,heap) *);
852 void gimple_set_body (tree, gimple_seq);
853 gimple_seq gimple_body (tree);
854 bool gimple_has_body_p (tree);
855 gimple_seq gimple_seq_alloc (void);
856 void gimple_seq_free (gimple_seq);
857 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
858 gimple_seq gimple_seq_copy (gimple_seq);
859 int gimple_call_flags (const_gimple);
860 int gimple_call_return_flags (const_gimple);
861 int gimple_call_arg_flags (const_gimple, unsigned);
862 void gimple_call_reset_alias_info (gimple);
863 bool gimple_assign_copy_p (gimple);
864 bool gimple_assign_ssa_name_copy_p (gimple);
865 bool gimple_assign_single_p (gimple);
866 bool gimple_assign_unary_nop_p (gimple);
867 void gimple_set_bb (gimple, struct basic_block_def *);
868 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
869 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
871 tree gimple_get_lhs (const_gimple);
872 void gimple_set_lhs (gimple, tree);
873 void gimple_replace_lhs (gimple, tree);
874 gimple gimple_copy (gimple);
875 bool is_gimple_operand (const_tree);
876 void gimple_set_modified (gimple, bool);
877 void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *);
878 gimple gimple_build_cond_from_tree (tree, tree, tree);
879 void gimple_cond_set_condition_from_tree (gimple, tree);
880 bool gimple_has_side_effects (const_gimple);
881 bool gimple_rhs_has_side_effects (const_gimple);
882 bool gimple_could_trap_p (gimple);
883 bool gimple_assign_rhs_could_trap_p (gimple);
884 void gimple_regimplify_operands (gimple, gimple_stmt_iterator *);
885 bool empty_body_p (gimple_seq);
886 unsigned get_gimple_rhs_num_ops (enum tree_code);
887 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
888 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
889 const char *gimple_decl_printable_name (tree, int);
890 tree gimple_fold_obj_type_ref (tree, tree);
891 tree gimple_get_relevant_ref_binfo (tree ref, tree known_binfo);
892 tree gimple_fold_obj_type_ref_known_binfo (HOST_WIDE_INT, tree);
894 /* Returns true iff T is a valid GIMPLE statement. */
895 extern bool is_gimple_stmt (tree);
897 /* Returns true iff TYPE is a valid type for a scalar register variable. */
898 extern bool is_gimple_reg_type (tree);
899 /* Returns true iff T is a scalar register variable. */
900 extern bool is_gimple_reg (tree);
901 /* Returns true iff T is any sort of variable. */
902 extern bool is_gimple_variable (tree);
903 /* Returns true iff T is any sort of symbol. */
904 extern bool is_gimple_id (tree);
905 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
906 extern bool is_gimple_min_lval (tree);
907 /* Returns true iff T is something whose address can be taken. */
908 extern bool is_gimple_addressable (tree);
909 /* Returns true iff T is any valid GIMPLE lvalue. */
910 extern bool is_gimple_lvalue (tree);
912 /* Returns true iff T is a GIMPLE address. */
913 bool is_gimple_address (const_tree);
914 /* Returns true iff T is a GIMPLE invariant address. */
915 bool is_gimple_invariant_address (const_tree);
916 /* Returns true iff T is a GIMPLE invariant address at interprocedural
918 bool is_gimple_ip_invariant_address (const_tree);
919 /* Returns true iff T is a valid GIMPLE constant. */
920 bool is_gimple_constant (const_tree);
921 /* Returns true iff T is a GIMPLE restricted function invariant. */
922 extern bool is_gimple_min_invariant (const_tree);
923 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
924 extern bool is_gimple_ip_invariant (const_tree);
925 /* Returns true iff T is a GIMPLE rvalue. */
926 extern bool is_gimple_val (tree);
927 /* Returns true iff T is a GIMPLE asm statement input. */
928 extern bool is_gimple_asm_val (tree);
929 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
930 GIMPLE temporary, a renamed user variable, or something else,
932 extern bool is_gimple_reg_rhs (tree);
933 extern bool is_gimple_mem_rhs (tree);
935 /* Returns true iff T is a valid if-statement condition. */
936 extern bool is_gimple_condexpr (tree);
938 /* Returns true iff T is a type conversion. */
939 extern bool is_gimple_cast (tree);
940 /* Returns true iff T is a variable that does not need to live in memory. */
941 extern bool is_gimple_non_addressable (tree t);
943 /* Returns true iff T is a valid call address expression. */
944 extern bool is_gimple_call_addr (tree);
945 /* If T makes a function call, returns the CALL_EXPR operand. */
946 extern tree get_call_expr_in (tree t);
948 extern void recalculate_side_effects (tree);
949 extern bool compare_field_offset (tree, tree);
950 extern tree gimple_register_type (tree);
951 extern void print_gimple_types_stats (void);
952 extern void free_gimple_type_tables (void);
953 extern tree gimple_unsigned_type (tree);
954 extern tree gimple_signed_type (tree);
955 extern alias_set_type gimple_get_alias_set (tree);
956 extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
958 extern bool walk_stmt_load_store_addr_ops (gimple, void *,
959 bool (*)(gimple, tree, void *),
960 bool (*)(gimple, tree, void *),
961 bool (*)(gimple, tree, void *));
962 extern bool walk_stmt_load_store_ops (gimple, void *,
963 bool (*)(gimple, tree, void *),
964 bool (*)(gimple, tree, void *));
965 extern bool gimple_ior_addresses_taken (bitmap, gimple);
968 extern tree create_tmp_var_raw (tree, const char *);
969 extern tree create_tmp_var_name (const char *);
970 extern tree create_tmp_var (tree, const char *);
971 extern tree create_tmp_reg (tree, const char *);
972 extern tree get_initialized_tmp_var (tree, gimple_seq *, gimple_seq *);
973 extern tree get_formal_tmp_var (tree, gimple_seq *);
974 extern void declare_vars (tree, gimple, bool);
975 extern void annotate_all_with_location (gimple_seq, location_t);
977 /* Validation of GIMPLE expressions. Note that these predicates only check
978 the basic form of the expression, they don't recurse to make sure that
979 underlying nodes are also of the right form. */
980 typedef bool (*gimple_predicate)(tree);
983 /* FIXME we should deduce this from the predicate. */
985 fb_none = 0, /* Do not generate a temporary. */
987 fb_rvalue = 1, /* Generate an rvalue to hold the result of a
988 gimplified expression. */
990 fb_lvalue = 2, /* Generate an lvalue to hold the result of a
991 gimplified expression. */
993 fb_mayfail = 4, /* Gimplification may fail. Error issued
995 fb_either= fb_rvalue | fb_lvalue
998 typedef int fallback_t;
1000 enum gimplify_status {
1001 GS_ERROR = -2, /* Something Bad Seen. */
1002 GS_UNHANDLED = -1, /* A langhook result for "I dunno". */
1003 GS_OK = 0, /* We did something, maybe more to do. */
1004 GS_ALL_DONE = 1 /* The expression is fully gimplified. */
1009 struct gimplify_ctx *prev_context;
1011 VEC(gimple,heap) *bind_expr_stack;
1013 gimple_seq conditional_cleanups;
1017 VEC(tree,heap) *case_labels;
1018 /* The formal temporary table. Should this be persistent? */
1024 bool allow_rhs_cond_expr;
1027 extern enum gimplify_status gimplify_expr (tree *, gimple_seq *, gimple_seq *,
1028 bool (*) (tree), fallback_t);
1029 extern void gimplify_type_sizes (tree, gimple_seq *);
1030 extern void gimplify_one_sizepos (tree *, gimple_seq *);
1031 extern bool gimplify_stmt (tree *, gimple_seq *);
1032 extern gimple gimplify_body (tree *, tree, bool);
1033 extern void push_gimplify_context (struct gimplify_ctx *);
1034 extern void pop_gimplify_context (gimple);
1035 extern void gimplify_and_add (tree, gimple_seq *);
1037 /* Miscellaneous helpers. */
1038 extern void gimple_add_tmp_var (tree);
1039 extern gimple gimple_current_bind_expr (void);
1040 extern VEC(gimple, heap) *gimple_bind_expr_stack (void);
1041 extern tree voidify_wrapper_expr (tree, tree);
1042 extern tree build_and_jump (tree *);
1043 extern tree alloc_stmt_list (void);
1044 extern void free_stmt_list (tree);
1045 extern tree force_labels_r (tree *, int *, void *);
1046 extern enum gimplify_status gimplify_va_arg_expr (tree *, gimple_seq *,
1048 struct gimplify_omp_ctx;
1049 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx *, tree);
1050 extern tree gimple_boolify (tree);
1051 extern gimple_predicate rhs_predicate_for (tree);
1052 extern tree canonicalize_cond_expr_cond (tree);
1055 extern tree omp_reduction_init (tree, tree);
1057 /* In tree-nested.c. */
1058 extern void lower_nested_functions (tree);
1059 extern void insert_field_into_struct (tree, tree);
1061 /* In gimplify.c. */
1062 extern void gimplify_function_tree (tree);
1064 /* In cfgexpand.c. */
1065 extern tree gimple_assign_rhs_to_tree (gimple);
1068 extern bool validate_gimple_arglist (const_gimple, ...);
1071 extern bool tree_ssa_useless_type_conversion (tree);
1072 extern tree tree_ssa_strip_useless_type_conversions (tree);
1073 extern bool useless_type_conversion_p (tree, tree);
1074 extern bool types_compatible_p (tree, tree);
1076 /* Return the code for GIMPLE statement G. */
1078 static inline enum gimple_code
1079 gimple_code (const_gimple g)
1081 return g->gsbase.code;
1085 /* Return the GSS code used by a GIMPLE code. */
1087 static inline enum gimple_statement_structure_enum
1088 gss_for_code (enum gimple_code code)
1090 #ifdef ENABLE_CHECKING
1091 gcc_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1093 return gss_for_code_[code];
1097 /* Return which GSS code is used by GS. */
1099 static inline enum gimple_statement_structure_enum
1100 gimple_statement_structure (gimple gs)
1102 return gss_for_code (gimple_code (gs));
1106 /* Return true if statement G has sub-statements. This is only true for
1107 High GIMPLE statements. */
1110 gimple_has_substatements (gimple g)
1112 switch (gimple_code (g))
1116 case GIMPLE_EH_FILTER:
1118 case GIMPLE_OMP_FOR:
1119 case GIMPLE_OMP_MASTER:
1120 case GIMPLE_OMP_ORDERED:
1121 case GIMPLE_OMP_SECTION:
1122 case GIMPLE_OMP_PARALLEL:
1123 case GIMPLE_OMP_TASK:
1124 case GIMPLE_OMP_SECTIONS:
1125 case GIMPLE_OMP_SINGLE:
1126 case GIMPLE_OMP_CRITICAL:
1127 case GIMPLE_WITH_CLEANUP_EXPR:
1136 /* Return the basic block holding statement G. */
1138 static inline struct basic_block_def *
1139 gimple_bb (const_gimple g)
1141 return g->gsbase.bb;
1145 /* Return the lexical scope block holding statement G. */
1148 gimple_block (const_gimple g)
1150 return g->gsbase.block;
1154 /* Set BLOCK to be the lexical scope block holding statement G. */
1157 gimple_set_block (gimple g, tree block)
1159 g->gsbase.block = block;
1163 /* Return location information for statement G. */
1165 static inline location_t
1166 gimple_location (const_gimple g)
1168 return g->gsbase.location;
1171 /* Return pointer to location information for statement G. */
1173 static inline const location_t *
1174 gimple_location_ptr (const_gimple g)
1176 return &g->gsbase.location;
1180 /* Set location information for statement G. */
1183 gimple_set_location (gimple g, location_t location)
1185 g->gsbase.location = location;
1189 /* Return true if G contains location information. */
1192 gimple_has_location (const_gimple g)
1194 return gimple_location (g) != UNKNOWN_LOCATION;
1198 /* Return the file name of the location of STMT. */
1200 static inline const char *
1201 gimple_filename (const_gimple stmt)
1203 return LOCATION_FILE (gimple_location (stmt));
1207 /* Return the line number of the location of STMT. */
1210 gimple_lineno (const_gimple stmt)
1212 return LOCATION_LINE (gimple_location (stmt));
1216 /* Determine whether SEQ is a singleton. */
1219 gimple_seq_singleton_p (gimple_seq seq)
1221 return ((gimple_seq_first (seq) != NULL)
1222 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1225 /* Return true if no warnings should be emitted for statement STMT. */
1228 gimple_no_warning_p (const_gimple stmt)
1230 return stmt->gsbase.no_warning;
1233 /* Set the no_warning flag of STMT to NO_WARNING. */
1236 gimple_set_no_warning (gimple stmt, bool no_warning)
1238 stmt->gsbase.no_warning = (unsigned) no_warning;
1241 /* Set the visited status on statement STMT to VISITED_P. */
1244 gimple_set_visited (gimple stmt, bool visited_p)
1246 stmt->gsbase.visited = (unsigned) visited_p;
1250 /* Return the visited status for statement STMT. */
1253 gimple_visited_p (gimple stmt)
1255 return stmt->gsbase.visited;
1259 /* Set pass local flag PLF on statement STMT to VAL_P. */
1262 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1265 stmt->gsbase.plf |= (unsigned int) plf;
1267 stmt->gsbase.plf &= ~((unsigned int) plf);
1271 /* Return the value of pass local flag PLF on statement STMT. */
1273 static inline unsigned int
1274 gimple_plf (gimple stmt, enum plf_mask plf)
1276 return stmt->gsbase.plf & ((unsigned int) plf);
1280 /* Set the UID of statement. */
1283 gimple_set_uid (gimple g, unsigned uid)
1285 g->gsbase.uid = uid;
1289 /* Return the UID of statement. */
1291 static inline unsigned
1292 gimple_uid (const_gimple g)
1294 return g->gsbase.uid;
1298 /* Return true if GIMPLE statement G has register or memory operands. */
1301 gimple_has_ops (const_gimple g)
1303 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1307 /* Return true if GIMPLE statement G has memory operands. */
1310 gimple_has_mem_ops (const_gimple g)
1312 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1316 /* Return the set of DEF operands for statement G. */
1318 static inline struct def_optype_d *
1319 gimple_def_ops (const_gimple g)
1321 if (!gimple_has_ops (g))
1323 return g->gsops.opbase.def_ops;
1327 /* Set DEF to be the set of DEF operands for statement G. */
1330 gimple_set_def_ops (gimple g, struct def_optype_d *def)
1332 gcc_assert (gimple_has_ops (g));
1333 g->gsops.opbase.def_ops = def;
1337 /* Return the set of USE operands for statement G. */
1339 static inline struct use_optype_d *
1340 gimple_use_ops (const_gimple g)
1342 if (!gimple_has_ops (g))
1344 return g->gsops.opbase.use_ops;
1348 /* Set USE to be the set of USE operands for statement G. */
1351 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1353 gcc_assert (gimple_has_ops (g));
1354 g->gsops.opbase.use_ops = use;
1358 /* Return the set of VUSE operand for statement G. */
1360 static inline use_operand_p
1361 gimple_vuse_op (const_gimple g)
1363 struct use_optype_d *ops;
1364 if (!gimple_has_mem_ops (g))
1365 return NULL_USE_OPERAND_P;
1366 ops = g->gsops.opbase.use_ops;
1368 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
1369 return USE_OP_PTR (ops);
1370 return NULL_USE_OPERAND_P;
1373 /* Return the set of VDEF operand for statement G. */
1375 static inline def_operand_p
1376 gimple_vdef_op (const_gimple g)
1378 struct def_optype_d *ops;
1379 if (!gimple_has_mem_ops (g))
1380 return NULL_DEF_OPERAND_P;
1381 ops = g->gsops.opbase.def_ops;
1383 && DEF_OP_PTR (ops) == &g->gsmembase.vdef)
1384 return DEF_OP_PTR (ops);
1385 return NULL_DEF_OPERAND_P;
1389 /* Return the single VUSE operand of the statement G. */
1392 gimple_vuse (const_gimple g)
1394 if (!gimple_has_mem_ops (g))
1396 return g->gsmembase.vuse;
1399 /* Return the single VDEF operand of the statement G. */
1402 gimple_vdef (const_gimple g)
1404 if (!gimple_has_mem_ops (g))
1406 return g->gsmembase.vdef;
1409 /* Return the single VUSE operand of the statement G. */
1411 static inline tree *
1412 gimple_vuse_ptr (gimple g)
1414 if (!gimple_has_mem_ops (g))
1416 return &g->gsmembase.vuse;
1419 /* Return the single VDEF operand of the statement G. */
1421 static inline tree *
1422 gimple_vdef_ptr (gimple g)
1424 if (!gimple_has_mem_ops (g))
1426 return &g->gsmembase.vdef;
1429 /* Set the single VUSE operand of the statement G. */
1432 gimple_set_vuse (gimple g, tree vuse)
1434 gcc_assert (gimple_has_mem_ops (g));
1435 g->gsmembase.vuse = vuse;
1438 /* Set the single VDEF operand of the statement G. */
1441 gimple_set_vdef (gimple g, tree vdef)
1443 gcc_assert (gimple_has_mem_ops (g));
1444 g->gsmembase.vdef = vdef;
1448 /* Return true if statement G has operands and the modified field has
1452 gimple_modified_p (const_gimple g)
1454 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1458 /* Return the tree code for the expression computed by STMT. This is
1459 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1460 GIMPLE_CALL, return CALL_EXPR as the expression code for
1461 consistency. This is useful when the caller needs to deal with the
1462 three kinds of computation that GIMPLE supports. */
1464 static inline enum tree_code
1465 gimple_expr_code (const_gimple stmt)
1467 enum gimple_code code = gimple_code (stmt);
1468 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1469 return (enum tree_code) stmt->gsbase.subcode;
1470 else if (code == GIMPLE_CALL)
1477 /* Mark statement S as modified, and update it. */
1480 update_stmt (gimple s)
1482 if (gimple_has_ops (s))
1484 gimple_set_modified (s, true);
1485 update_stmt_operands (s);
1489 /* Update statement S if it has been optimized. */
1492 update_stmt_if_modified (gimple s)
1494 if (gimple_modified_p (s))
1495 update_stmt_operands (s);
1498 /* Return true if statement STMT contains volatile operands. */
1501 gimple_has_volatile_ops (const_gimple stmt)
1503 if (gimple_has_mem_ops (stmt))
1504 return stmt->gsbase.has_volatile_ops;
1510 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1513 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1515 if (gimple_has_mem_ops (stmt))
1516 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1520 /* Return true if statement STMT may access memory. */
1523 gimple_references_memory_p (gimple stmt)
1525 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1529 /* Return the subcode for OMP statement S. */
1531 static inline unsigned
1532 gimple_omp_subcode (const_gimple s)
1534 gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1535 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1536 return s->gsbase.subcode;
1539 /* Set the subcode for OMP statement S to SUBCODE. */
1542 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1544 /* We only have 16 bits for the subcode. Assert that we are not
1546 gcc_assert (subcode < (1 << 16));
1547 s->gsbase.subcode = subcode;
1550 /* Set the nowait flag on OMP_RETURN statement S. */
1553 gimple_omp_return_set_nowait (gimple s)
1555 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1556 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1560 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1564 gimple_omp_return_nowait_p (const_gimple g)
1566 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1567 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1571 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1575 gimple_omp_section_last_p (const_gimple g)
1577 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1578 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1582 /* Set the GF_OMP_SECTION_LAST flag on G. */
1585 gimple_omp_section_set_last (gimple g)
1587 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1588 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1592 /* Return true if OMP parallel statement G has the
1593 GF_OMP_PARALLEL_COMBINED flag set. */
1596 gimple_omp_parallel_combined_p (const_gimple g)
1598 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1599 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1603 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1604 value of COMBINED_P. */
1607 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1609 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1611 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1613 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1617 /* Return the number of operands for statement GS. */
1619 static inline unsigned
1620 gimple_num_ops (const_gimple gs)
1622 return gs->gsbase.num_ops;
1626 /* Set the number of operands for statement GS. */
1629 gimple_set_num_ops (gimple gs, unsigned num_ops)
1631 gs->gsbase.num_ops = num_ops;
1635 /* Return the array of operands for statement GS. */
1637 static inline tree *
1638 gimple_ops (gimple gs)
1642 /* All the tuples have their operand vector at the very bottom
1643 of the structure. Note that those structures that do not
1644 have an operand vector have a zero offset. */
1645 off = gimple_ops_offset_[gimple_statement_structure (gs)];
1646 gcc_assert (off != 0);
1648 return (tree *) ((char *) gs + off);
1652 /* Return operand I for statement GS. */
1655 gimple_op (const_gimple gs, unsigned i)
1657 if (gimple_has_ops (gs))
1659 #ifdef ENABLE_CHECKING
1660 gcc_assert (i < gimple_num_ops (gs));
1662 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1668 /* Return a pointer to operand I for statement GS. */
1670 static inline tree *
1671 gimple_op_ptr (const_gimple gs, unsigned i)
1673 if (gimple_has_ops (gs))
1675 #ifdef ENABLE_CHECKING
1676 gcc_assert (i < gimple_num_ops (gs));
1678 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1684 /* Set operand I of statement GS to OP. */
1687 gimple_set_op (gimple gs, unsigned i, tree op)
1689 gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1691 /* Note. It may be tempting to assert that OP matches
1692 is_gimple_operand, but that would be wrong. Different tuples
1693 accept slightly different sets of tree operands. Each caller
1694 should perform its own validation. */
1695 gimple_ops (gs)[i] = op;
1698 /* Return true if GS is a GIMPLE_ASSIGN. */
1701 is_gimple_assign (const_gimple gs)
1703 return gimple_code (gs) == GIMPLE_ASSIGN;
1706 /* Determine if expression CODE is one of the valid expressions that can
1707 be used on the RHS of GIMPLE assignments. */
1709 static inline enum gimple_rhs_class
1710 get_gimple_rhs_class (enum tree_code code)
1712 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1715 /* Return the LHS of assignment statement GS. */
1718 gimple_assign_lhs (const_gimple gs)
1720 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1721 return gimple_op (gs, 0);
1725 /* Return a pointer to the LHS of assignment statement GS. */
1727 static inline tree *
1728 gimple_assign_lhs_ptr (const_gimple gs)
1730 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1731 return gimple_op_ptr (gs, 0);
1735 /* Set LHS to be the LHS operand of assignment statement GS. */
1738 gimple_assign_set_lhs (gimple gs, tree lhs)
1740 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1741 gimple_set_op (gs, 0, lhs);
1743 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1744 SSA_NAME_DEF_STMT (lhs) = gs;
1748 /* Return the first operand on the RHS of assignment statement GS. */
1751 gimple_assign_rhs1 (const_gimple gs)
1753 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1754 return gimple_op (gs, 1);
1758 /* Return a pointer to the first operand on the RHS of assignment
1761 static inline tree *
1762 gimple_assign_rhs1_ptr (const_gimple gs)
1764 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1765 return gimple_op_ptr (gs, 1);
1768 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1771 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1773 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1775 gimple_set_op (gs, 1, rhs);
1779 /* Return the second operand on the RHS of assignment statement GS.
1780 If GS does not have two operands, NULL is returned instead. */
1783 gimple_assign_rhs2 (const_gimple gs)
1785 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1787 if (gimple_num_ops (gs) >= 3)
1788 return gimple_op (gs, 2);
1794 /* Return a pointer to the second operand on the RHS of assignment
1797 static inline tree *
1798 gimple_assign_rhs2_ptr (const_gimple gs)
1800 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1801 return gimple_op_ptr (gs, 2);
1805 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1808 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1810 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1812 gimple_set_op (gs, 2, rhs);
1815 /* Returns true if GS is a nontemporal move. */
1818 gimple_assign_nontemporal_move_p (const_gimple gs)
1820 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1821 return gs->gsbase.nontemporal_move;
1824 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1827 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1829 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1830 gs->gsbase.nontemporal_move = nontemporal;
1834 /* Return the code of the expression computed on the rhs of assignment
1835 statement GS. In case that the RHS is a single object, returns the
1836 tree code of the object. */
1838 static inline enum tree_code
1839 gimple_assign_rhs_code (const_gimple gs)
1841 enum tree_code code;
1842 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1844 code = gimple_expr_code (gs);
1845 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1846 code = TREE_CODE (gimple_assign_rhs1 (gs));
1852 /* Set CODE to be the code for the expression computed on the RHS of
1856 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1858 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1859 s->gsbase.subcode = code;
1863 /* Return the gimple rhs class of the code of the expression computed on
1864 the rhs of assignment statement GS.
1865 This will never return GIMPLE_INVALID_RHS. */
1867 static inline enum gimple_rhs_class
1868 gimple_assign_rhs_class (const_gimple gs)
1870 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1874 /* Return true if S is a type-cast assignment. */
1877 gimple_assign_cast_p (gimple s)
1879 if (is_gimple_assign (s))
1881 enum tree_code sc = gimple_assign_rhs_code (s);
1882 return CONVERT_EXPR_CODE_P (sc)
1883 || sc == VIEW_CONVERT_EXPR
1884 || sc == FIX_TRUNC_EXPR;
1891 /* Return true if GS is a GIMPLE_CALL. */
1894 is_gimple_call (const_gimple gs)
1896 return gimple_code (gs) == GIMPLE_CALL;
1899 /* Return the LHS of call statement GS. */
1902 gimple_call_lhs (const_gimple gs)
1904 GIMPLE_CHECK (gs, GIMPLE_CALL);
1905 return gimple_op (gs, 0);
1909 /* Return a pointer to the LHS of call statement GS. */
1911 static inline tree *
1912 gimple_call_lhs_ptr (const_gimple gs)
1914 GIMPLE_CHECK (gs, GIMPLE_CALL);
1915 return gimple_op_ptr (gs, 0);
1919 /* Set LHS to be the LHS operand of call statement GS. */
1922 gimple_call_set_lhs (gimple gs, tree lhs)
1924 GIMPLE_CHECK (gs, GIMPLE_CALL);
1925 gimple_set_op (gs, 0, lhs);
1926 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1927 SSA_NAME_DEF_STMT (lhs) = gs;
1931 /* Return the tree node representing the function called by call
1935 gimple_call_fn (const_gimple gs)
1937 GIMPLE_CHECK (gs, GIMPLE_CALL);
1938 return gimple_op (gs, 1);
1942 /* Return a pointer to the tree node representing the function called by call
1945 static inline tree *
1946 gimple_call_fn_ptr (const_gimple gs)
1948 GIMPLE_CHECK (gs, GIMPLE_CALL);
1949 return gimple_op_ptr (gs, 1);
1953 /* Set FN to be the function called by call statement GS. */
1956 gimple_call_set_fn (gimple gs, tree fn)
1958 GIMPLE_CHECK (gs, GIMPLE_CALL);
1959 gimple_set_op (gs, 1, fn);
1963 /* Set FNDECL to be the function called by call statement GS. */
1966 gimple_call_set_fndecl (gimple gs, tree decl)
1968 GIMPLE_CHECK (gs, GIMPLE_CALL);
1969 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
1973 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1974 Otherwise return NULL. This function is analogous to
1975 get_callee_fndecl in tree land. */
1978 gimple_call_fndecl (const_gimple gs)
1980 tree addr = gimple_call_fn (gs);
1981 if (TREE_CODE (addr) == ADDR_EXPR)
1982 return TREE_OPERAND (addr, 0);
1987 /* Return the type returned by call statement GS. */
1990 gimple_call_return_type (const_gimple gs)
1992 tree fn = gimple_call_fn (gs);
1993 tree type = TREE_TYPE (fn);
1995 /* See through the pointer. */
1996 type = TREE_TYPE (type);
1998 /* The type returned by a FUNCTION_DECL is the type of its
2000 return TREE_TYPE (type);
2004 /* Return the static chain for call statement GS. */
2007 gimple_call_chain (const_gimple gs)
2009 GIMPLE_CHECK (gs, GIMPLE_CALL);
2010 return gimple_op (gs, 2);
2014 /* Return a pointer to the static chain for call statement GS. */
2016 static inline tree *
2017 gimple_call_chain_ptr (const_gimple gs)
2019 GIMPLE_CHECK (gs, GIMPLE_CALL);
2020 return gimple_op_ptr (gs, 2);
2023 /* Set CHAIN to be the static chain for call statement GS. */
2026 gimple_call_set_chain (gimple gs, tree chain)
2028 GIMPLE_CHECK (gs, GIMPLE_CALL);
2030 gimple_set_op (gs, 2, chain);
2034 /* Return the number of arguments used by call statement GS. */
2036 static inline unsigned
2037 gimple_call_num_args (const_gimple gs)
2040 GIMPLE_CHECK (gs, GIMPLE_CALL);
2041 num_ops = gimple_num_ops (gs);
2046 /* Return the argument at position INDEX for call statement GS. */
2049 gimple_call_arg (const_gimple gs, unsigned index)
2051 GIMPLE_CHECK (gs, GIMPLE_CALL);
2052 return gimple_op (gs, index + 3);
2056 /* Return a pointer to the argument at position INDEX for call
2059 static inline tree *
2060 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2062 GIMPLE_CHECK (gs, GIMPLE_CALL);
2063 return gimple_op_ptr (gs, index + 3);
2067 /* Set ARG to be the argument at position INDEX for call statement GS. */
2070 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2072 GIMPLE_CHECK (gs, GIMPLE_CALL);
2073 gimple_set_op (gs, index + 3, arg);
2077 /* If TAIL_P is true, mark call statement S as being a tail call
2078 (i.e., a call just before the exit of a function). These calls are
2079 candidate for tail call optimization. */
2082 gimple_call_set_tail (gimple s, bool tail_p)
2084 GIMPLE_CHECK (s, GIMPLE_CALL);
2086 s->gsbase.subcode |= GF_CALL_TAILCALL;
2088 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2092 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2095 gimple_call_tail_p (gimple s)
2097 GIMPLE_CHECK (s, GIMPLE_CALL);
2098 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2102 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2105 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2107 GIMPLE_CHECK (s, GIMPLE_CALL);
2109 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2111 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2115 /* Return true if GIMPLE_CALL S cannot be inlined. */
2118 gimple_call_cannot_inline_p (gimple s)
2120 GIMPLE_CHECK (s, GIMPLE_CALL);
2121 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2125 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2126 slot optimization. This transformation uses the target of the call
2127 expansion as the return slot for calls that return in memory. */
2130 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2132 GIMPLE_CHECK (s, GIMPLE_CALL);
2133 if (return_slot_opt_p)
2134 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2136 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2140 /* Return true if S is marked for return slot optimization. */
2143 gimple_call_return_slot_opt_p (gimple s)
2145 GIMPLE_CHECK (s, GIMPLE_CALL);
2146 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2150 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2151 thunk to the thunked-to function. */
2154 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2156 GIMPLE_CHECK (s, GIMPLE_CALL);
2158 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2160 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2164 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2167 gimple_call_from_thunk_p (gimple s)
2169 GIMPLE_CHECK (s, GIMPLE_CALL);
2170 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2174 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2175 argument pack in its argument list. */
2178 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2180 GIMPLE_CHECK (s, GIMPLE_CALL);
2181 if (pass_arg_pack_p)
2182 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2184 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2188 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2189 argument pack in its argument list. */
2192 gimple_call_va_arg_pack_p (gimple s)
2194 GIMPLE_CHECK (s, GIMPLE_CALL);
2195 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2199 /* Return true if S is a noreturn call. */
2202 gimple_call_noreturn_p (gimple s)
2204 GIMPLE_CHECK (s, GIMPLE_CALL);
2205 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2209 /* Return true if S is a nothrow call. */
2212 gimple_call_nothrow_p (gimple s)
2214 GIMPLE_CHECK (s, GIMPLE_CALL);
2215 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2219 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2222 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2224 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2225 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2226 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2230 /* Return a pointer to the points-to solution for the set of call-used
2231 variables of the call CALL. */
2233 static inline struct pt_solution *
2234 gimple_call_use_set (gimple call)
2236 GIMPLE_CHECK (call, GIMPLE_CALL);
2237 return &call->gimple_call.call_used;
2241 /* Return a pointer to the points-to solution for the set of call-used
2242 variables of the call CALL. */
2244 static inline struct pt_solution *
2245 gimple_call_clobber_set (gimple call)
2247 GIMPLE_CHECK (call, GIMPLE_CALL);
2248 return &call->gimple_call.call_clobbered;
2252 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2256 gimple_has_lhs (gimple stmt)
2258 return (is_gimple_assign (stmt)
2259 || (is_gimple_call (stmt)
2260 && gimple_call_lhs (stmt) != NULL_TREE));
2264 /* Return the code of the predicate computed by conditional statement GS. */
2266 static inline enum tree_code
2267 gimple_cond_code (const_gimple gs)
2269 GIMPLE_CHECK (gs, GIMPLE_COND);
2270 return (enum tree_code) gs->gsbase.subcode;
2274 /* Set CODE to be the predicate code for the conditional statement GS. */
2277 gimple_cond_set_code (gimple gs, enum tree_code code)
2279 GIMPLE_CHECK (gs, GIMPLE_COND);
2280 gs->gsbase.subcode = code;
2284 /* Return the LHS of the predicate computed by conditional statement GS. */
2287 gimple_cond_lhs (const_gimple gs)
2289 GIMPLE_CHECK (gs, GIMPLE_COND);
2290 return gimple_op (gs, 0);
2293 /* Return the pointer to the LHS of the predicate computed by conditional
2296 static inline tree *
2297 gimple_cond_lhs_ptr (const_gimple gs)
2299 GIMPLE_CHECK (gs, GIMPLE_COND);
2300 return gimple_op_ptr (gs, 0);
2303 /* Set LHS to be the LHS operand of the predicate computed by
2304 conditional statement GS. */
2307 gimple_cond_set_lhs (gimple gs, tree lhs)
2309 GIMPLE_CHECK (gs, GIMPLE_COND);
2310 gimple_set_op (gs, 0, lhs);
2314 /* Return the RHS operand of the predicate computed by conditional GS. */
2317 gimple_cond_rhs (const_gimple gs)
2319 GIMPLE_CHECK (gs, GIMPLE_COND);
2320 return gimple_op (gs, 1);
2323 /* Return the pointer to the RHS operand of the predicate computed by
2326 static inline tree *
2327 gimple_cond_rhs_ptr (const_gimple gs)
2329 GIMPLE_CHECK (gs, GIMPLE_COND);
2330 return gimple_op_ptr (gs, 1);
2334 /* Set RHS to be the RHS operand of the predicate computed by
2335 conditional statement GS. */
2338 gimple_cond_set_rhs (gimple gs, tree rhs)
2340 GIMPLE_CHECK (gs, GIMPLE_COND);
2341 gimple_set_op (gs, 1, rhs);
2345 /* Return the label used by conditional statement GS when its
2346 predicate evaluates to true. */
2349 gimple_cond_true_label (const_gimple gs)
2351 GIMPLE_CHECK (gs, GIMPLE_COND);
2352 return gimple_op (gs, 2);
2356 /* Set LABEL to be the label used by conditional statement GS when its
2357 predicate evaluates to true. */
2360 gimple_cond_set_true_label (gimple gs, tree label)
2362 GIMPLE_CHECK (gs, GIMPLE_COND);
2363 gimple_set_op (gs, 2, label);
2367 /* Set LABEL to be the label used by conditional statement GS when its
2368 predicate evaluates to false. */
2371 gimple_cond_set_false_label (gimple gs, tree label)
2373 GIMPLE_CHECK (gs, GIMPLE_COND);
2374 gimple_set_op (gs, 3, label);
2378 /* Return the label used by conditional statement GS when its
2379 predicate evaluates to false. */
2382 gimple_cond_false_label (const_gimple gs)
2384 GIMPLE_CHECK (gs, GIMPLE_COND);
2385 return gimple_op (gs, 3);
2389 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2392 gimple_cond_make_false (gimple gs)
2394 gimple_cond_set_lhs (gs, boolean_true_node);
2395 gimple_cond_set_rhs (gs, boolean_false_node);
2396 gs->gsbase.subcode = EQ_EXPR;
2400 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2403 gimple_cond_make_true (gimple gs)
2405 gimple_cond_set_lhs (gs, boolean_true_node);
2406 gimple_cond_set_rhs (gs, boolean_true_node);
2407 gs->gsbase.subcode = EQ_EXPR;
2410 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2411 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2414 gimple_cond_true_p (const_gimple gs)
2416 tree lhs = gimple_cond_lhs (gs);
2417 tree rhs = gimple_cond_rhs (gs);
2418 enum tree_code code = gimple_cond_code (gs);
2420 if (lhs != boolean_true_node && lhs != boolean_false_node)
2423 if (rhs != boolean_true_node && rhs != boolean_false_node)
2426 if (code == NE_EXPR && lhs != rhs)
2429 if (code == EQ_EXPR && lhs == rhs)
2435 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2436 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2439 gimple_cond_false_p (const_gimple gs)
2441 tree lhs = gimple_cond_lhs (gs);
2442 tree rhs = gimple_cond_rhs (gs);
2443 enum tree_code code = gimple_cond_code (gs);
2445 if (lhs != boolean_true_node && lhs != boolean_false_node)
2448 if (rhs != boolean_true_node && rhs != boolean_false_node)
2451 if (code == NE_EXPR && lhs == rhs)
2454 if (code == EQ_EXPR && lhs != rhs)
2460 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2464 gimple_cond_single_var_p (gimple gs)
2466 if (gimple_cond_code (gs) == NE_EXPR
2467 && gimple_cond_rhs (gs) == boolean_false_node)
2470 if (gimple_cond_code (gs) == EQ_EXPR
2471 && gimple_cond_rhs (gs) == boolean_true_node)
2477 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2480 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2482 gimple_cond_set_code (stmt, code);
2483 gimple_cond_set_lhs (stmt, lhs);
2484 gimple_cond_set_rhs (stmt, rhs);
2487 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2490 gimple_label_label (const_gimple gs)
2492 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2493 return gimple_op (gs, 0);
2497 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2501 gimple_label_set_label (gimple gs, tree label)
2503 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2504 gimple_set_op (gs, 0, label);
2508 /* Return the destination of the unconditional jump GS. */
2511 gimple_goto_dest (const_gimple gs)
2513 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2514 return gimple_op (gs, 0);
2518 /* Set DEST to be the destination of the unconditonal jump GS. */
2521 gimple_goto_set_dest (gimple gs, tree dest)
2523 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2524 gimple_set_op (gs, 0, dest);
2528 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2531 gimple_bind_vars (const_gimple gs)
2533 GIMPLE_CHECK (gs, GIMPLE_BIND);
2534 return gs->gimple_bind.vars;
2538 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2542 gimple_bind_set_vars (gimple gs, tree vars)
2544 GIMPLE_CHECK (gs, GIMPLE_BIND);
2545 gs->gimple_bind.vars = vars;
2549 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2553 gimple_bind_append_vars (gimple gs, tree vars)
2555 GIMPLE_CHECK (gs, GIMPLE_BIND);
2556 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2560 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2562 static inline gimple_seq
2563 gimple_bind_body (gimple gs)
2565 GIMPLE_CHECK (gs, GIMPLE_BIND);
2566 return gs->gimple_bind.body;
2570 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2574 gimple_bind_set_body (gimple gs, gimple_seq seq)
2576 GIMPLE_CHECK (gs, GIMPLE_BIND);
2577 gs->gimple_bind.body = seq;
2581 /* Append a statement to the end of a GIMPLE_BIND's body. */
2584 gimple_bind_add_stmt (gimple gs, gimple stmt)
2586 GIMPLE_CHECK (gs, GIMPLE_BIND);
2587 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2591 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2594 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2596 GIMPLE_CHECK (gs, GIMPLE_BIND);
2597 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2601 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2602 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2605 gimple_bind_block (const_gimple gs)
2607 GIMPLE_CHECK (gs, GIMPLE_BIND);
2608 return gs->gimple_bind.block;
2612 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2616 gimple_bind_set_block (gimple gs, tree block)
2618 GIMPLE_CHECK (gs, GIMPLE_BIND);
2619 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2620 gs->gimple_bind.block = block;
2624 /* Return the number of input operands for GIMPLE_ASM GS. */
2626 static inline unsigned
2627 gimple_asm_ninputs (const_gimple gs)
2629 GIMPLE_CHECK (gs, GIMPLE_ASM);
2630 return gs->gimple_asm.ni;
2634 /* Return the number of output operands for GIMPLE_ASM GS. */
2636 static inline unsigned
2637 gimple_asm_noutputs (const_gimple gs)
2639 GIMPLE_CHECK (gs, GIMPLE_ASM);
2640 return gs->gimple_asm.no;
2644 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2646 static inline unsigned
2647 gimple_asm_nclobbers (const_gimple gs)
2649 GIMPLE_CHECK (gs, GIMPLE_ASM);
2650 return gs->gimple_asm.nc;
2653 /* Return the number of label operands for GIMPLE_ASM GS. */
2655 static inline unsigned
2656 gimple_asm_nlabels (const_gimple gs)
2658 GIMPLE_CHECK (gs, GIMPLE_ASM);
2659 return gs->gimple_asm.nl;
2662 /* Return input operand INDEX of GIMPLE_ASM GS. */
2665 gimple_asm_input_op (const_gimple gs, unsigned index)
2667 GIMPLE_CHECK (gs, GIMPLE_ASM);
2668 gcc_assert (index <= gs->gimple_asm.ni);
2669 return gimple_op (gs, index);
2672 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2674 static inline tree *
2675 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2677 GIMPLE_CHECK (gs, GIMPLE_ASM);
2678 gcc_assert (index <= gs->gimple_asm.ni);
2679 return gimple_op_ptr (gs, index);
2683 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2686 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2688 GIMPLE_CHECK (gs, GIMPLE_ASM);
2689 gcc_assert (index <= gs->gimple_asm.ni);
2690 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2691 gimple_set_op (gs, index, in_op);
2695 /* Return output operand INDEX of GIMPLE_ASM GS. */
2698 gimple_asm_output_op (const_gimple gs, unsigned index)
2700 GIMPLE_CHECK (gs, GIMPLE_ASM);
2701 gcc_assert (index <= gs->gimple_asm.no);
2702 return gimple_op (gs, index + gs->gimple_asm.ni);
2705 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2707 static inline tree *
2708 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2710 GIMPLE_CHECK (gs, GIMPLE_ASM);
2711 gcc_assert (index <= gs->gimple_asm.no);
2712 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2716 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2719 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2721 GIMPLE_CHECK (gs, GIMPLE_ASM);
2722 gcc_assert (index <= gs->gimple_asm.no);
2723 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2724 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2728 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2731 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2733 GIMPLE_CHECK (gs, GIMPLE_ASM);
2734 gcc_assert (index <= gs->gimple_asm.nc);
2735 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2739 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2742 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2744 GIMPLE_CHECK (gs, GIMPLE_ASM);
2745 gcc_assert (index <= gs->gimple_asm.nc);
2746 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2747 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2750 /* Return label operand INDEX of GIMPLE_ASM GS. */
2753 gimple_asm_label_op (const_gimple gs, unsigned index)
2755 GIMPLE_CHECK (gs, GIMPLE_ASM);
2756 gcc_assert (index <= gs->gimple_asm.nl);
2757 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc);
2760 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2763 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
2765 GIMPLE_CHECK (gs, GIMPLE_ASM);
2766 gcc_assert (index <= gs->gimple_asm.nl);
2767 gcc_assert (TREE_CODE (label_op) == TREE_LIST);
2768 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.nc, label_op);
2771 /* Return the string representing the assembly instruction in
2774 static inline const char *
2775 gimple_asm_string (const_gimple gs)
2777 GIMPLE_CHECK (gs, GIMPLE_ASM);
2778 return gs->gimple_asm.string;
2782 /* Return true if GS is an asm statement marked volatile. */
2785 gimple_asm_volatile_p (const_gimple gs)
2787 GIMPLE_CHECK (gs, GIMPLE_ASM);
2788 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2792 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2795 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2797 GIMPLE_CHECK (gs, GIMPLE_ASM);
2799 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2801 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2805 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2808 gimple_asm_set_input (gimple gs, bool input_p)
2810 GIMPLE_CHECK (gs, GIMPLE_ASM);
2812 gs->gsbase.subcode |= GF_ASM_INPUT;
2814 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2818 /* Return true if asm GS is an ASM_INPUT. */
2821 gimple_asm_input_p (const_gimple gs)
2823 GIMPLE_CHECK (gs, GIMPLE_ASM);
2824 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2828 /* Return the types handled by GIMPLE_CATCH statement GS. */
2831 gimple_catch_types (const_gimple gs)
2833 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2834 return gs->gimple_catch.types;
2838 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2840 static inline tree *
2841 gimple_catch_types_ptr (gimple gs)
2843 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2844 return &gs->gimple_catch.types;
2848 /* Return the GIMPLE sequence representing the body of the handler of
2849 GIMPLE_CATCH statement GS. */
2851 static inline gimple_seq
2852 gimple_catch_handler (gimple gs)
2854 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2855 return gs->gimple_catch.handler;
2859 /* Return a pointer to the GIMPLE sequence representing the body of
2860 the handler of GIMPLE_CATCH statement GS. */
2862 static inline gimple_seq *
2863 gimple_catch_handler_ptr (gimple gs)
2865 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2866 return &gs->gimple_catch.handler;
2870 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2873 gimple_catch_set_types (gimple gs, tree t)
2875 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2876 gs->gimple_catch.types = t;
2880 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2883 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2885 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2886 gs->gimple_catch.handler = handler;
2890 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2893 gimple_eh_filter_types (const_gimple gs)
2895 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2896 return gs->gimple_eh_filter.types;
2900 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2903 static inline tree *
2904 gimple_eh_filter_types_ptr (gimple gs)
2906 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2907 return &gs->gimple_eh_filter.types;
2911 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2914 static inline gimple_seq
2915 gimple_eh_filter_failure (gimple gs)
2917 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2918 return gs->gimple_eh_filter.failure;
2922 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2925 gimple_eh_filter_set_types (gimple gs, tree types)
2927 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2928 gs->gimple_eh_filter.types = types;
2932 /* Set FAILURE to be the sequence of statements to execute on failure
2933 for GIMPLE_EH_FILTER GS. */
2936 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2938 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2939 gs->gimple_eh_filter.failure = failure;
2942 /* Get the function decl to be called by the MUST_NOT_THROW region. */
2945 gimple_eh_must_not_throw_fndecl (gimple gs)
2947 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2948 return gs->gimple_eh_mnt.fndecl;
2951 /* Set the function decl to be called by GS to DECL. */
2954 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
2956 GIMPLE_CHECK (gs, GIMPLE_EH_MUST_NOT_THROW);
2957 gs->gimple_eh_mnt.fndecl = decl;
2961 /* GIMPLE_TRY accessors. */
2963 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2964 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2966 static inline enum gimple_try_flags
2967 gimple_try_kind (const_gimple gs)
2969 GIMPLE_CHECK (gs, GIMPLE_TRY);
2970 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2974 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2977 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2979 GIMPLE_CHECK (gs, GIMPLE_TRY);
2980 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2981 if (gimple_try_kind (gs) != kind)
2982 gs->gsbase.subcode = (unsigned int) kind;
2986 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2989 gimple_try_catch_is_cleanup (const_gimple gs)
2991 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2992 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2996 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2998 static inline gimple_seq
2999 gimple_try_eval (gimple gs)
3001 GIMPLE_CHECK (gs, GIMPLE_TRY);
3002 return gs->gimple_try.eval;
3006 /* Return the sequence of statements used as the cleanup body for
3009 static inline gimple_seq
3010 gimple_try_cleanup (gimple gs)
3012 GIMPLE_CHECK (gs, GIMPLE_TRY);
3013 return gs->gimple_try.cleanup;
3017 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3020 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3022 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3023 if (catch_is_cleanup)
3024 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3026 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3030 /* Set EVAL to be the sequence of statements to use as the body for
3034 gimple_try_set_eval (gimple gs, gimple_seq eval)
3036 GIMPLE_CHECK (gs, GIMPLE_TRY);
3037 gs->gimple_try.eval = eval;
3041 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3042 body for GIMPLE_TRY GS. */
3045 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3047 GIMPLE_CHECK (gs, GIMPLE_TRY);
3048 gs->gimple_try.cleanup = cleanup;
3052 /* Return the cleanup sequence for cleanup statement GS. */
3054 static inline gimple_seq
3055 gimple_wce_cleanup (gimple gs)
3057 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3058 return gs->gimple_wce.cleanup;
3062 /* Set CLEANUP to be the cleanup sequence for GS. */
3065 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3067 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3068 gs->gimple_wce.cleanup = cleanup;
3072 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3075 gimple_wce_cleanup_eh_only (const_gimple gs)
3077 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3078 return gs->gsbase.subcode != 0;
3082 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3085 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3087 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3088 gs->gsbase.subcode = (unsigned int) eh_only_p;
3092 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3094 static inline unsigned
3095 gimple_phi_capacity (const_gimple gs)
3097 GIMPLE_CHECK (gs, GIMPLE_PHI);
3098 return gs->gimple_phi.capacity;
3102 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3103 be exactly the number of incoming edges for the basic block holding
3106 static inline unsigned
3107 gimple_phi_num_args (const_gimple gs)
3109 GIMPLE_CHECK (gs, GIMPLE_PHI);
3110 return gs->gimple_phi.nargs;
3114 /* Return the SSA name created by GIMPLE_PHI GS. */
3117 gimple_phi_result (const_gimple gs)
3119 GIMPLE_CHECK (gs, GIMPLE_PHI);
3120 return gs->gimple_phi.result;
3123 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3125 static inline tree *
3126 gimple_phi_result_ptr (gimple gs)
3128 GIMPLE_CHECK (gs, GIMPLE_PHI);
3129 return &gs->gimple_phi.result;
3132 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3135 gimple_phi_set_result (gimple gs, tree result)
3137 GIMPLE_CHECK (gs, GIMPLE_PHI);
3138 gs->gimple_phi.result = result;
3142 /* Return the PHI argument corresponding to incoming edge INDEX for
3145 static inline struct phi_arg_d *
3146 gimple_phi_arg (gimple gs, unsigned index)
3148 GIMPLE_CHECK (gs, GIMPLE_PHI);
3149 gcc_assert (index <= gs->gimple_phi.capacity);
3150 return &(gs->gimple_phi.args[index]);
3153 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3154 for GIMPLE_PHI GS. */
3157 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3159 GIMPLE_CHECK (gs, GIMPLE_PHI);
3160 gcc_assert (index <= gs->gimple_phi.nargs);
3161 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3164 /* Return the region number for GIMPLE_RESX GS. */
3167 gimple_resx_region (const_gimple gs)
3169 GIMPLE_CHECK (gs, GIMPLE_RESX);
3170 return gs->gimple_eh_ctrl.region;
3173 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3176 gimple_resx_set_region (gimple gs, int region)
3178 GIMPLE_CHECK (gs, GIMPLE_RESX);
3179 gs->gimple_eh_ctrl.region = region;
3182 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3185 gimple_eh_dispatch_region (const_gimple gs)
3187 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3188 return gs->gimple_eh_ctrl.region;
3191 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3194 gimple_eh_dispatch_set_region (gimple gs, int region)
3196 GIMPLE_CHECK (gs, GIMPLE_EH_DISPATCH);
3197 gs->gimple_eh_ctrl.region = region;
3200 /* Return the number of labels associated with the switch statement GS. */
3202 static inline unsigned
3203 gimple_switch_num_labels (const_gimple gs)
3206 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3207 num_ops = gimple_num_ops (gs);
3208 gcc_assert (num_ops > 1);
3213 /* Set NLABELS to be the number of labels for the switch statement GS. */
3216 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3218 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3219 gimple_set_num_ops (g, nlabels + 1);
3223 /* Return the index variable used by the switch statement GS. */
3226 gimple_switch_index (const_gimple gs)
3228 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3229 return gimple_op (gs, 0);
3233 /* Return a pointer to the index variable for the switch statement GS. */
3235 static inline tree *
3236 gimple_switch_index_ptr (const_gimple gs)
3238 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3239 return gimple_op_ptr (gs, 0);
3243 /* Set INDEX to be the index variable for switch statement GS. */
3246 gimple_switch_set_index (gimple gs, tree index)
3248 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3249 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3250 gimple_set_op (gs, 0, index);
3254 /* Return the label numbered INDEX. The default label is 0, followed by any
3255 labels in a switch statement. */
3258 gimple_switch_label (const_gimple gs, unsigned index)
3260 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3261 gcc_assert (gimple_num_ops (gs) > index + 1);
3262 return gimple_op (gs, index + 1);
3265 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3268 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3270 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3271 gcc_assert (gimple_num_ops (gs) > index + 1);
3272 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3273 gimple_set_op (gs, index + 1, label);
3276 /* Return the default label for a switch statement. */
3279 gimple_switch_default_label (const_gimple gs)
3281 return gimple_switch_label (gs, 0);
3284 /* Set the default label for a switch statement. */
3287 gimple_switch_set_default_label (gimple gs, tree label)
3289 gimple_switch_set_label (gs, 0, label);
3292 /* Return true if GS is a GIMPLE_DEBUG statement. */
3295 is_gimple_debug (const_gimple gs)
3297 return gimple_code (gs) == GIMPLE_DEBUG;
3300 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3303 gimple_debug_bind_p (const_gimple s)
3305 if (is_gimple_debug (s))
3306 return s->gsbase.subcode == GIMPLE_DEBUG_BIND;
3311 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3314 gimple_debug_bind_get_var (gimple dbg)
3316 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3317 #ifdef ENABLE_CHECKING
3318 gcc_assert (gimple_debug_bind_p (dbg));
3320 return gimple_op (dbg, 0);
3323 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3327 gimple_debug_bind_get_value (gimple dbg)
3329 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3330 #ifdef ENABLE_CHECKING
3331 gcc_assert (gimple_debug_bind_p (dbg));
3333 return gimple_op (dbg, 1);
3336 /* Return a pointer to the value bound to the variable in a
3337 GIMPLE_DEBUG bind statement. */
3339 static inline tree *
3340 gimple_debug_bind_get_value_ptr (gimple dbg)
3342 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3343 #ifdef ENABLE_CHECKING
3344 gcc_assert (gimple_debug_bind_p (dbg));
3346 return gimple_op_ptr (dbg, 1);
3349 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3352 gimple_debug_bind_set_var (gimple dbg, tree var)
3354 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3355 #ifdef ENABLE_CHECKING
3356 gcc_assert (gimple_debug_bind_p (dbg));
3358 gimple_set_op (dbg, 0, var);
3361 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3365 gimple_debug_bind_set_value (gimple dbg, tree value)
3367 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3368 #ifdef ENABLE_CHECKING
3369 gcc_assert (gimple_debug_bind_p (dbg));
3371 gimple_set_op (dbg, 1, value);
3374 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3376 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3378 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3382 gimple_debug_bind_reset_value (gimple dbg)
3384 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3385 #ifdef ENABLE_CHECKING
3386 gcc_assert (gimple_debug_bind_p (dbg));
3388 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
3391 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3395 gimple_debug_bind_has_value_p (gimple dbg)
3397 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
3398 #ifdef ENABLE_CHECKING
3399 gcc_assert (gimple_debug_bind_p (dbg));
3401 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
3404 #undef GIMPLE_DEBUG_BIND_NOVALUE
3406 /* Return the body for the OMP statement GS. */
3408 static inline gimple_seq
3409 gimple_omp_body (gimple gs)
3411 return gs->omp.body;
3414 /* Set BODY to be the body for the OMP statement GS. */
3417 gimple_omp_set_body (gimple gs, gimple_seq body)
3419 gs->omp.body = body;
3423 /* Return the name associated with OMP_CRITICAL statement GS. */
3426 gimple_omp_critical_name (const_gimple gs)
3428 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3429 return gs->gimple_omp_critical.name;
3433 /* Return a pointer to the name associated with OMP critical statement GS. */
3435 static inline tree *
3436 gimple_omp_critical_name_ptr (gimple gs)
3438 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3439 return &gs->gimple_omp_critical.name;
3443 /* Set NAME to be the name associated with OMP critical statement GS. */
3446 gimple_omp_critical_set_name (gimple gs, tree name)
3448 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3449 gs->gimple_omp_critical.name = name;
3453 /* Return the clauses associated with OMP_FOR GS. */
3456 gimple_omp_for_clauses (const_gimple gs)
3458 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3459 return gs->gimple_omp_for.clauses;
3463 /* Return a pointer to the OMP_FOR GS. */
3465 static inline tree *
3466 gimple_omp_for_clauses_ptr (gimple gs)
3468 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3469 return &gs->gimple_omp_for.clauses;
3473 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3476 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3478 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3479 gs->gimple_omp_for.clauses = clauses;
3483 /* Get the collapse count of OMP_FOR GS. */
3485 static inline size_t
3486 gimple_omp_for_collapse (gimple gs)
3488 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3489 return gs->gimple_omp_for.collapse;
3493 /* Return the index variable for OMP_FOR GS. */
3496 gimple_omp_for_index (const_gimple gs, size_t i)
3498 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3499 gcc_assert (i < gs->gimple_omp_for.collapse);
3500 return gs->gimple_omp_for.iter[i].index;
3504 /* Return a pointer to the index variable for OMP_FOR GS. */
3506 static inline tree *
3507 gimple_omp_for_index_ptr (gimple gs, size_t i)
3509 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3510 gcc_assert (i < gs->gimple_omp_for.collapse);
3511 return &gs->gimple_omp_for.iter[i].index;
3515 /* Set INDEX to be the index variable for OMP_FOR GS. */
3518 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3520 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3521 gcc_assert (i < gs->gimple_omp_for.collapse);
3522 gs->gimple_omp_for.iter[i].index = index;
3526 /* Return the initial value for OMP_FOR GS. */
3529 gimple_omp_for_initial (const_gimple gs, size_t i)
3531 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3532 gcc_assert (i < gs->gimple_omp_for.collapse);
3533 return gs->gimple_omp_for.iter[i].initial;
3537 /* Return a pointer to the initial value for OMP_FOR GS. */
3539 static inline tree *
3540 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3542 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3543 gcc_assert (i < gs->gimple_omp_for.collapse);
3544 return &gs->gimple_omp_for.iter[i].initial;
3548 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3551 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3553 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3554 gcc_assert (i < gs->gimple_omp_for.collapse);
3555 gs->gimple_omp_for.iter[i].initial = initial;
3559 /* Return the final value for OMP_FOR GS. */
3562 gimple_omp_for_final (const_gimple gs, size_t i)
3564 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3565 gcc_assert (i < gs->gimple_omp_for.collapse);
3566 return gs->gimple_omp_for.iter[i].final;
3570 /* Return a pointer to the final value for OMP_FOR GS. */
3572 static inline tree *
3573 gimple_omp_for_final_ptr (gimple gs, size_t i)
3575 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3576 gcc_assert (i < gs->gimple_omp_for.collapse);
3577 return &gs->gimple_omp_for.iter[i].final;
3581 /* Set FINAL to be the final value for OMP_FOR GS. */
3584 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3586 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3587 gcc_assert (i < gs->gimple_omp_for.collapse);
3588 gs->gimple_omp_for.iter[i].final = final;
3592 /* Return the increment value for OMP_FOR GS. */
3595 gimple_omp_for_incr (const_gimple gs, size_t i)
3597 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3598 gcc_assert (i < gs->gimple_omp_for.collapse);
3599 return gs->gimple_omp_for.iter[i].incr;
3603 /* Return a pointer to the increment value for OMP_FOR GS. */
3605 static inline tree *
3606 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3608 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3609 gcc_assert (i < gs->gimple_omp_for.collapse);
3610 return &gs->gimple_omp_for.iter[i].incr;
3614 /* Set INCR to be the increment value for OMP_FOR GS. */
3617 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3619 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3620 gcc_assert (i < gs->gimple_omp_for.collapse);
3621 gs->gimple_omp_for.iter[i].incr = incr;
3625 /* Return the sequence of statements to execute before the OMP_FOR
3626 statement GS starts. */
3628 static inline gimple_seq
3629 gimple_omp_for_pre_body (gimple gs)
3631 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3632 return gs->gimple_omp_for.pre_body;
3636 /* Set PRE_BODY to be the sequence of statements to execute before the
3637 OMP_FOR statement GS starts. */
3640 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3642 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3643 gs->gimple_omp_for.pre_body = pre_body;
3647 /* Return the clauses associated with OMP_PARALLEL GS. */
3650 gimple_omp_parallel_clauses (const_gimple gs)
3652 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3653 return gs->gimple_omp_parallel.clauses;
3657 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3659 static inline tree *
3660 gimple_omp_parallel_clauses_ptr (gimple gs)
3662 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3663 return &gs->gimple_omp_parallel.clauses;
3667 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3671 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3673 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3674 gs->gimple_omp_parallel.clauses = clauses;
3678 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3681 gimple_omp_parallel_child_fn (const_gimple gs)
3683 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3684 return gs->gimple_omp_parallel.child_fn;
3687 /* Return a pointer to the child function used to hold the body of
3690 static inline tree *
3691 gimple_omp_parallel_child_fn_ptr (gimple gs)
3693 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3694 return &gs->gimple_omp_parallel.child_fn;
3698 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3701 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3703 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3704 gs->gimple_omp_parallel.child_fn = child_fn;
3708 /* Return the artificial argument used to send variables and values
3709 from the parent to the children threads in OMP_PARALLEL GS. */
3712 gimple_omp_parallel_data_arg (const_gimple gs)
3714 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3715 return gs->gimple_omp_parallel.data_arg;
3719 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3721 static inline tree *
3722 gimple_omp_parallel_data_arg_ptr (gimple gs)
3724 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3725 return &gs->gimple_omp_parallel.data_arg;
3729 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3732 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3734 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3735 gs->gimple_omp_parallel.data_arg = data_arg;
3739 /* Return the clauses associated with OMP_TASK GS. */
3742 gimple_omp_task_clauses (const_gimple gs)
3744 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3745 return gs->gimple_omp_parallel.clauses;
3749 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3751 static inline tree *
3752 gimple_omp_task_clauses_ptr (gimple gs)
3754 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3755 return &gs->gimple_omp_parallel.clauses;
3759 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3763 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3765 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3766 gs->gimple_omp_parallel.clauses = clauses;
3770 /* Return the child function used to hold the body of OMP_TASK GS. */
3773 gimple_omp_task_child_fn (const_gimple gs)
3775 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3776 return gs->gimple_omp_parallel.child_fn;
3779 /* Return a pointer to the child function used to hold the body of
3782 static inline tree *
3783 gimple_omp_task_child_fn_ptr (gimple gs)
3785 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3786 return &gs->gimple_omp_parallel.child_fn;
3790 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3793 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3795 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3796 gs->gimple_omp_parallel.child_fn = child_fn;
3800 /* Return the artificial argument used to send variables and values
3801 from the parent to the children threads in OMP_TASK GS. */
3804 gimple_omp_task_data_arg (const_gimple gs)
3806 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3807 return gs->gimple_omp_parallel.data_arg;
3811 /* Return a pointer to the data argument for OMP_TASK GS. */
3813 static inline tree *
3814 gimple_omp_task_data_arg_ptr (gimple gs)
3816 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3817 return &gs->gimple_omp_parallel.data_arg;
3821 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3824 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3826 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3827 gs->gimple_omp_parallel.data_arg = data_arg;
3831 /* Return the clauses associated with OMP_TASK GS. */
3834 gimple_omp_taskreg_clauses (const_gimple gs)
3836 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3837 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3838 return gs->gimple_omp_parallel.clauses;
3842 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3844 static inline tree *
3845 gimple_omp_taskreg_clauses_ptr (gimple gs)
3847 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3848 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3849 return &gs->gimple_omp_parallel.clauses;
3853 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3857 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3859 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3860 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3861 gs->gimple_omp_parallel.clauses = clauses;
3865 /* Return the child function used to hold the body of OMP_TASK GS. */
3868 gimple_omp_taskreg_child_fn (const_gimple gs)
3870 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3871 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3872 return gs->gimple_omp_parallel.child_fn;
3875 /* Return a pointer to the child function used to hold the body of
3878 static inline tree *
3879 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3881 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3882 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3883 return &gs->gimple_omp_parallel.child_fn;
3887 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3890 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3892 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3893 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3894 gs->gimple_omp_parallel.child_fn = child_fn;
3898 /* Return the artificial argument used to send variables and values
3899 from the parent to the children threads in OMP_TASK GS. */
3902 gimple_omp_taskreg_data_arg (const_gimple gs)
3904 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3905 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3906 return gs->gimple_omp_parallel.data_arg;
3910 /* Return a pointer to the data argument for OMP_TASK GS. */
3912 static inline tree *
3913 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3915 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3916 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3917 return &gs->gimple_omp_parallel.data_arg;
3921 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3924 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3926 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3927 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3928 gs->gimple_omp_parallel.data_arg = data_arg;
3932 /* Return the copy function used to hold the body of OMP_TASK GS. */
3935 gimple_omp_task_copy_fn (const_gimple gs)
3937 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3938 return gs->gimple_omp_task.copy_fn;
3941 /* Return a pointer to the copy function used to hold the body of
3944 static inline tree *
3945 gimple_omp_task_copy_fn_ptr (gimple gs)
3947 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3948 return &gs->gimple_omp_task.copy_fn;
3952 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3955 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3957 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3958 gs->gimple_omp_task.copy_fn = copy_fn;
3962 /* Return size of the data block in bytes in OMP_TASK GS. */
3965 gimple_omp_task_arg_size (const_gimple gs)
3967 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3968 return gs->gimple_omp_task.arg_size;
3972 /* Return a pointer to the data block size for OMP_TASK GS. */
3974 static inline tree *
3975 gimple_omp_task_arg_size_ptr (gimple gs)
3977 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3978 return &gs->gimple_omp_task.arg_size;
3982 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3985 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3987 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3988 gs->gimple_omp_task.arg_size = arg_size;
3992 /* Return align of the data block in bytes in OMP_TASK GS. */
3995 gimple_omp_task_arg_align (const_gimple gs)
3997 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3998 return gs->gimple_omp_task.arg_align;
4002 /* Return a pointer to the data block align for OMP_TASK GS. */
4004 static inline tree *
4005 gimple_omp_task_arg_align_ptr (gimple gs)
4007 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4008 return &gs->gimple_omp_task.arg_align;
4012 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4015 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4017 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
4018 gs->gimple_omp_task.arg_align = arg_align;
4022 /* Return the clauses associated with OMP_SINGLE GS. */
4025 gimple_omp_single_clauses (const_gimple gs)
4027 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4028 return gs->gimple_omp_single.clauses;
4032 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4034 static inline tree *
4035 gimple_omp_single_clauses_ptr (gimple gs)
4037 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4038 return &gs->gimple_omp_single.clauses;
4042 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4045 gimple_omp_single_set_clauses (gimple gs, tree clauses)
4047 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
4048 gs->gimple_omp_single.clauses = clauses;
4052 /* Return the clauses associated with OMP_SECTIONS GS. */
4055 gimple_omp_sections_clauses (const_gimple gs)
4057 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4058 return gs->gimple_omp_sections.clauses;
4062 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4064 static inline tree *
4065 gimple_omp_sections_clauses_ptr (gimple gs)
4067 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4068 return &gs->gimple_omp_sections.clauses;
4072 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4076 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
4078 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4079 gs->gimple_omp_sections.clauses = clauses;
4083 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4087 gimple_omp_sections_control (const_gimple gs)
4089 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4090 return gs->gimple_omp_sections.control;
4094 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4097 static inline tree *
4098 gimple_omp_sections_control_ptr (gimple gs)
4100 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4101 return &gs->gimple_omp_sections.control;
4105 /* Set CONTROL to be the set of clauses associated with the
4106 GIMPLE_OMP_SECTIONS in GS. */
4109 gimple_omp_sections_set_control (gimple gs, tree control)
4111 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
4112 gs->gimple_omp_sections.control = control;
4116 /* Set COND to be the condition code for OMP_FOR GS. */
4119 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4121 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4122 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
4123 gcc_assert (i < gs->gimple_omp_for.collapse);
4124 gs->gimple_omp_for.iter[i].cond = cond;
4128 /* Return the condition code associated with OMP_FOR GS. */
4130 static inline enum tree_code
4131 gimple_omp_for_cond (const_gimple gs, size_t i)
4133 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
4134 gcc_assert (i < gs->gimple_omp_for.collapse);
4135 return gs->gimple_omp_for.iter[i].cond;
4139 /* Set the value being stored in an atomic store. */
4142 gimple_omp_atomic_store_set_val (gimple g, tree val)
4144 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4145 g->gimple_omp_atomic_store.val = val;
4149 /* Return the value being stored in an atomic store. */
4152 gimple_omp_atomic_store_val (const_gimple g)
4154 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4155 return g->gimple_omp_atomic_store.val;
4159 /* Return a pointer to the value being stored in an atomic store. */
4161 static inline tree *
4162 gimple_omp_atomic_store_val_ptr (gimple g)
4164 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
4165 return &g->gimple_omp_atomic_store.val;
4169 /* Set the LHS of an atomic load. */
4172 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4174 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4175 g->gimple_omp_atomic_load.lhs = lhs;
4179 /* Get the LHS of an atomic load. */
4182 gimple_omp_atomic_load_lhs (const_gimple g)
4184 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4185 return g->gimple_omp_atomic_load.lhs;
4189 /* Return a pointer to the LHS of an atomic load. */
4191 static inline tree *
4192 gimple_omp_atomic_load_lhs_ptr (gimple g)
4194 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4195 return &g->gimple_omp_atomic_load.lhs;
4199 /* Set the RHS of an atomic load. */
4202 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4204 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4205 g->gimple_omp_atomic_load.rhs = rhs;
4209 /* Get the RHS of an atomic load. */
4212 gimple_omp_atomic_load_rhs (const_gimple g)
4214 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4215 return g->gimple_omp_atomic_load.rhs;
4219 /* Return a pointer to the RHS of an atomic load. */
4221 static inline tree *
4222 gimple_omp_atomic_load_rhs_ptr (gimple g)
4224 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4225 return &g->gimple_omp_atomic_load.rhs;
4229 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4232 gimple_omp_continue_control_def (const_gimple g)
4234 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4235 return g->gimple_omp_continue.control_def;
4238 /* The same as above, but return the address. */
4240 static inline tree *
4241 gimple_omp_continue_control_def_ptr (gimple g)
4243 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4244 return &g->gimple_omp_continue.control_def;
4247 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4250 gimple_omp_continue_set_control_def (gimple g, tree def)
4252 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4253 g->gimple_omp_continue.control_def = def;
4257 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4260 gimple_omp_continue_control_use (const_gimple g)
4262 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4263 return g->gimple_omp_continue.control_use;
4267 /* The same as above, but return the address. */
4269 static inline tree *
4270 gimple_omp_continue_control_use_ptr (gimple g)
4272 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4273 return &g->gimple_omp_continue.control_use;
4277 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4280 gimple_omp_continue_set_control_use (gimple g, tree use)
4282 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4283 g->gimple_omp_continue.control_use = use;
4287 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4289 static inline tree *
4290 gimple_return_retval_ptr (const_gimple gs)
4292 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4293 return gimple_op_ptr (gs, 0);
4296 /* Return the return value for GIMPLE_RETURN GS. */
4299 gimple_return_retval (const_gimple gs)
4301 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4302 return gimple_op (gs, 0);
4306 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4309 gimple_return_set_retval (gimple gs, tree retval)
4311 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4312 gimple_set_op (gs, 0, retval);
4316 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4318 #define CASE_GIMPLE_OMP \
4319 case GIMPLE_OMP_PARALLEL: \
4320 case GIMPLE_OMP_TASK: \
4321 case GIMPLE_OMP_FOR: \
4322 case GIMPLE_OMP_SECTIONS: \
4323 case GIMPLE_OMP_SECTIONS_SWITCH: \
4324 case GIMPLE_OMP_SINGLE: \
4325 case GIMPLE_OMP_SECTION: \
4326 case GIMPLE_OMP_MASTER: \
4327 case GIMPLE_OMP_ORDERED: \
4328 case GIMPLE_OMP_CRITICAL: \
4329 case GIMPLE_OMP_RETURN: \
4330 case GIMPLE_OMP_ATOMIC_LOAD: \
4331 case GIMPLE_OMP_ATOMIC_STORE: \
4332 case GIMPLE_OMP_CONTINUE
4335 is_gimple_omp (const_gimple stmt)
4337 switch (gimple_code (stmt))
4347 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4350 gimple_nop_p (const_gimple g)
4352 return gimple_code (g) == GIMPLE_NOP;
4356 /* Return true if GS is a GIMPLE_RESX. */
4359 is_gimple_resx (const_gimple gs)
4361 return gimple_code (gs) == GIMPLE_RESX;
4364 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4366 static inline enum br_predictor
4367 gimple_predict_predictor (gimple gs)
4369 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4370 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4374 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4377 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4379 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4380 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4381 | (unsigned) predictor;
4385 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4387 static inline enum prediction
4388 gimple_predict_outcome (gimple gs)
4390 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4391 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4395 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4398 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4400 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4401 if (outcome == TAKEN)
4402 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4404 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4408 /* Return the type of the main expression computed by STMT. Return
4409 void_type_node if the statement computes nothing. */
4412 gimple_expr_type (const_gimple stmt)
4414 enum gimple_code code = gimple_code (stmt);
4416 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
4419 /* In general we want to pass out a type that can be substituted
4420 for both the RHS and the LHS types if there is a possibly
4421 useless conversion involved. That means returning the
4422 original RHS type as far as we can reconstruct it. */
4423 if (code == GIMPLE_CALL)
4424 type = gimple_call_return_type (stmt);
4426 switch (gimple_assign_rhs_code (stmt))
4428 case POINTER_PLUS_EXPR:
4429 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4433 /* As fallback use the type of the LHS. */
4434 type = TREE_TYPE (gimple_get_lhs (stmt));
4439 else if (code == GIMPLE_COND)
4440 return boolean_type_node;
4442 return void_type_node;
4446 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4448 static inline gimple_stmt_iterator
4449 gsi_start (gimple_seq seq)
4451 gimple_stmt_iterator i;
4453 i.ptr = gimple_seq_first (seq);
4455 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4461 /* Return a new iterator pointing to the first statement in basic block BB. */
4463 static inline gimple_stmt_iterator
4464 gsi_start_bb (basic_block bb)
4466 gimple_stmt_iterator i;
4470 i.ptr = gimple_seq_first (seq);
4478 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4480 static inline gimple_stmt_iterator
4481 gsi_last (gimple_seq seq)
4483 gimple_stmt_iterator i;
4485 i.ptr = gimple_seq_last (seq);
4487 i.bb = (i.ptr && i.ptr->stmt) ? gimple_bb (i.ptr->stmt) : NULL;
4493 /* Return a new iterator pointing to the last statement in basic block BB. */
4495 static inline gimple_stmt_iterator
4496 gsi_last_bb (basic_block bb)
4498 gimple_stmt_iterator i;
4502 i.ptr = gimple_seq_last (seq);
4510 /* Return true if I is at the end of its sequence. */
4513 gsi_end_p (gimple_stmt_iterator i)
4515 return i.ptr == NULL;
4519 /* Return true if I is one statement before the end of its sequence. */
4522 gsi_one_before_end_p (gimple_stmt_iterator i)
4524 return i.ptr != NULL && i.ptr->next == NULL;
4528 /* Advance the iterator to the next gimple statement. */
4531 gsi_next (gimple_stmt_iterator *i)
4533 i->ptr = i->ptr->next;
4536 /* Advance the iterator to the previous gimple statement. */
4539 gsi_prev (gimple_stmt_iterator *i)
4541 i->ptr = i->ptr->prev;
4544 /* Return the current stmt. */
4546 static inline gimple
4547 gsi_stmt (gimple_stmt_iterator i)
4552 /* Return a block statement iterator that points to the first non-label
4553 statement in block BB. */
4555 static inline gimple_stmt_iterator
4556 gsi_after_labels (basic_block bb)
4558 gimple_stmt_iterator gsi = gsi_start_bb (bb);
4560 while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
4566 /* Advance the iterator to the next non-debug gimple statement. */
4569 gsi_next_nondebug (gimple_stmt_iterator *i)
4575 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4578 /* Advance the iterator to the next non-debug gimple statement. */
4581 gsi_prev_nondebug (gimple_stmt_iterator *i)
4587 while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
4590 /* Return a new iterator pointing to the first non-debug statement in
4593 static inline gimple_stmt_iterator
4594 gsi_start_nondebug_bb (basic_block bb)
4596 gimple_stmt_iterator i = gsi_start_bb (bb);
4598 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4599 gsi_next_nondebug (&i);
4604 /* Return a new iterator pointing to the last non-debug statement in
4607 static inline gimple_stmt_iterator
4608 gsi_last_nondebug_bb (basic_block bb)
4610 gimple_stmt_iterator i = gsi_last_bb (bb);
4612 if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
4613 gsi_prev_nondebug (&i);
4618 /* Return a pointer to the current stmt.
4620 NOTE: You may want to use gsi_replace on the iterator itself,
4621 as this performs additional bookkeeping that will not be done
4622 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4624 static inline gimple *
4625 gsi_stmt_ptr (gimple_stmt_iterator *i)
4627 return &i->ptr->stmt;
4631 /* Return the basic block associated with this iterator. */
4633 static inline basic_block
4634 gsi_bb (gimple_stmt_iterator i)
4640 /* Return the sequence associated with this iterator. */
4642 static inline gimple_seq
4643 gsi_seq (gimple_stmt_iterator i)
4649 enum gsi_iterator_update
4651 GSI_NEW_STMT, /* Only valid when single statement is added, move
4653 GSI_SAME_STMT, /* Leave the iterator at the same statement. */
4654 GSI_CONTINUE_LINKING /* Move iterator to whatever position is suitable
4655 for linking other statements in the same
4659 /* In gimple-iterator.c */
4660 gimple_stmt_iterator gsi_start_phis (basic_block);
4661 gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
4662 gimple_seq gsi_split_seq_before (gimple_stmt_iterator *);
4663 void gsi_replace (gimple_stmt_iterator *, gimple, bool);
4664 void gsi_insert_before (gimple_stmt_iterator *, gimple,
4665 enum gsi_iterator_update);
4666 void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
4667 enum gsi_iterator_update);
4668 void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
4669 enum gsi_iterator_update);
4670 void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
4671 enum gsi_iterator_update);
4672 void gsi_insert_after (gimple_stmt_iterator *, gimple,
4673 enum gsi_iterator_update);
4674 void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
4675 enum gsi_iterator_update);
4676 void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
4677 enum gsi_iterator_update);
4678 void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
4679 enum gsi_iterator_update);
4680 void gsi_remove (gimple_stmt_iterator *, bool);
4681 gimple_stmt_iterator gsi_for_stmt (gimple);
4682 void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
4683 void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
4684 void gsi_move_to_bb_end (gimple_stmt_iterator *, struct basic_block_def *);
4685 void gsi_insert_on_edge (edge, gimple);
4686 void gsi_insert_seq_on_edge (edge, gimple_seq);
4687 basic_block gsi_insert_on_edge_immediate (edge, gimple);
4688 basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
4689 void gsi_commit_one_edge_insert (edge, basic_block *);
4690 void gsi_commit_edge_inserts (void);
4691 gimple gimple_call_copy_skip_args (gimple, bitmap);
4694 /* Convenience routines to walk all statements of a gimple function.
4695 Note that this is useful exclusively before the code is converted
4696 into SSA form. Once the program is in SSA form, the standard
4697 operand interface should be used to analyze/modify statements. */
4698 struct walk_stmt_info
4700 /* Points to the current statement being walked. */
4701 gimple_stmt_iterator gsi;
4703 /* Additional data that the callback functions may want to carry
4704 through the recursion. */
4707 /* Pointer map used to mark visited tree nodes when calling
4708 walk_tree on each operand. If set to NULL, duplicate tree nodes
4709 will be visited more than once. */
4710 struct pointer_set_t *pset;
4712 /* Indicates whether the operand being examined may be replaced
4713 with something that matches is_gimple_val (if true) or something
4714 slightly more complicated (if false). "Something" technically
4715 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4716 but we never try to form anything more complicated than that, so
4717 we don't bother checking.
4719 Also note that CALLBACK should update this flag while walking the
4720 sub-expressions of a statement. For instance, when walking the
4721 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4722 to true, however, when walking &var, the operand of that
4723 ADDR_EXPR does not need to be a GIMPLE value. */
4726 /* True if we are currently walking the LHS of an assignment. */
4729 /* Optional. Set to true by the callback functions if they made any
4733 /* True if we're interested in location information. */
4734 bool want_locations;
4736 /* Operand returned by the callbacks. This is set when calling
4737 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4738 returns non-NULL, this field will contain the tree returned by
4739 the last callback. */
4740 tree callback_result;
4743 /* Callback for walk_gimple_stmt. Called for every statement found
4744 during traversal. The first argument points to the statement to
4745 walk. The second argument is a flag that the callback sets to
4746 'true' if it the callback handled all the operands and
4747 sub-statements of the statement (the default value of this flag is
4748 'false'). The third argument is an anonymous pointer to data
4749 to be used by the callback. */
4750 typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
4751 struct walk_stmt_info *);
4753 gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
4754 struct walk_stmt_info *);
4755 tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
4756 struct walk_stmt_info *);
4757 tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
4759 #ifdef GATHER_STATISTICS
4760 /* Enum and arrays used for allocation stats. Keep in sync with
4761 gimple.c:gimple_alloc_kind_names. */
4762 enum gimple_alloc_kind
4764 gimple_alloc_kind_assign, /* Assignments. */
4765 gimple_alloc_kind_phi, /* PHI nodes. */
4766 gimple_alloc_kind_cond, /* Conditionals. */
4767 gimple_alloc_kind_seq, /* Sequences. */
4768 gimple_alloc_kind_rest, /* Everything else. */
4769 gimple_alloc_kind_all
4772 extern int gimple_alloc_counts[];
4773 extern int gimple_alloc_sizes[];
4775 /* Return the allocation kind for a given stmt CODE. */
4776 static inline enum gimple_alloc_kind
4777 gimple_alloc_kind (enum gimple_code code)
4782 return gimple_alloc_kind_assign;
4784 return gimple_alloc_kind_phi;
4786 return gimple_alloc_kind_cond;
4788 return gimple_alloc_kind_rest;
4791 #endif /* GATHER_STATISTICS */
4793 extern void dump_gimple_statistics (void);
4795 /* In gimple-fold.c. */
4796 void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree);
4797 tree gimple_fold_builtin (gimple);
4798 bool fold_stmt (gimple_stmt_iterator *);
4799 bool fold_stmt_inplace (gimple);
4800 tree maybe_fold_offset_to_reference (location_t, tree, tree, tree);
4801 tree maybe_fold_offset_to_address (location_t, tree, tree, tree);
4802 tree maybe_fold_stmt_addition (location_t, tree, tree, tree);
4803 tree get_symbol_constant_value (tree);
4804 bool may_propagate_address_into_dereference (tree, tree);
4807 #endif /* GCC_GIMPLE_H */