1 /* Gimple IR definitions.
3 Copyright 2007, 2008, 2009 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"
34 DEF_VEC_ALLOC_P(gimple
,heap
);
35 DEF_VEC_ALLOC_P(gimple
,gc
);
37 typedef gimple
*gimple_p
;
39 DEF_VEC_ALLOC_P(gimple_p
,heap
);
41 DEF_VEC_P(gimple_seq
);
42 DEF_VEC_ALLOC_P(gimple_seq
,gc
);
43 DEF_VEC_ALLOC_P(gimple_seq
,heap
);
45 /* For each block, the PHI nodes that need to be rewritten are stored into
47 typedef VEC(gimple
, heap
) *gimple_vec
;
48 DEF_VEC_P (gimple_vec
);
49 DEF_VEC_ALLOC_P (gimple_vec
, heap
);
52 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
55 LAST_AND_UNUSED_GIMPLE_CODE
58 extern const char *const gimple_code_name
[];
59 extern const unsigned char gimple_rhs_class_table
[];
61 /* Error out if a gimple tuple is addressed incorrectly. */
62 #if defined ENABLE_GIMPLE_CHECKING
63 extern void gimple_check_failed (const_gimple
, const char *, int, \
64 const char *, enum gimple_code
, \
65 enum tree_code
) ATTRIBUTE_NORETURN
;
67 #define GIMPLE_CHECK(GS, CODE) \
69 const_gimple __gs = (GS); \
70 if (gimple_code (__gs) != (CODE)) \
71 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
72 (CODE), ERROR_MARK); \
74 #else /* not ENABLE_GIMPLE_CHECKING */
75 #define GIMPLE_CHECK(GS, CODE) (void)0
78 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
79 get_gimple_rhs_class. */
82 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
83 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
84 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
85 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
86 name, a _DECL, a _REF, etc. */
89 /* Specific flags for individual GIMPLE statements. These flags are
90 always stored in gimple_statement_base.subcode and they may only be
91 defined for statement codes that do not use sub-codes.
93 Values for the masks can overlap as long as the overlapping values
94 are never used in the same statement class.
96 The maximum mask value that can be defined is 1 << 15 (i.e., each
97 statement code can hold up to 16 bitflags).
99 Keep this list sorted. */
101 GF_ASM_INPUT
= 1 << 0,
102 GF_ASM_VOLATILE
= 1 << 1,
103 GF_CALL_CANNOT_INLINE
= 1 << 0,
104 GF_CALL_FROM_THUNK
= 1 << 1,
105 GF_CALL_RETURN_SLOT_OPT
= 1 << 2,
106 GF_CALL_TAILCALL
= 1 << 3,
107 GF_CALL_VA_ARG_PACK
= 1 << 4,
108 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
110 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
111 a thread synchronization via some sort of barrier. The exact barrier
112 that would otherwise be emitted is dependent on the OMP statement with
113 which this return is associated. */
114 GF_OMP_RETURN_NOWAIT
= 1 << 0,
116 GF_OMP_SECTION_LAST
= 1 << 0,
117 GF_PREDICT_TAKEN
= 1 << 15
120 /* Currently, there's only one type of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124 enum gimple_debug_subcode
{
125 GIMPLE_DEBUG_BIND
= 0
128 /* Masks for selecting a pass local flag (PLF) to work on. These
129 masks are used by gimple_set_plf and gimple_plf. */
135 /* A node in a gimple_seq_d. */
136 struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) gimple_seq_node_d
{
138 struct gimple_seq_node_d
*prev
;
139 struct gimple_seq_node_d
*next
;
142 /* A double-linked sequence of gimple statements. */
143 struct GTY ((chain_next ("%h.next_free"))) gimple_seq_d
{
144 /* First and last statements in the sequence. */
145 gimple_seq_node first
;
146 gimple_seq_node last
;
148 /* Sequences are created/destroyed frequently. To minimize
149 allocation activity, deallocated sequences are kept in a pool of
150 available sequences. This is the pointer to the next free
151 sequence in the pool. */
152 gimple_seq next_free
;
156 /* Return the first node in GIMPLE sequence S. */
158 static inline gimple_seq_node
159 gimple_seq_first (const_gimple_seq s
)
161 return s
? s
->first
: NULL
;
165 /* Return the first statement in GIMPLE sequence S. */
168 gimple_seq_first_stmt (const_gimple_seq s
)
170 gimple_seq_node n
= gimple_seq_first (s
);
171 return (n
) ? n
->stmt
: NULL
;
175 /* Return the last node in GIMPLE sequence S. */
177 static inline gimple_seq_node
178 gimple_seq_last (const_gimple_seq s
)
180 return s
? s
->last
: NULL
;
184 /* Return the last statement in GIMPLE sequence S. */
187 gimple_seq_last_stmt (const_gimple_seq s
)
189 gimple_seq_node n
= gimple_seq_last (s
);
190 return (n
) ? n
->stmt
: NULL
;
194 /* Set the last node in GIMPLE sequence S to LAST. */
197 gimple_seq_set_last (gimple_seq s
, gimple_seq_node last
)
203 /* Set the first node in GIMPLE sequence S to FIRST. */
206 gimple_seq_set_first (gimple_seq s
, gimple_seq_node first
)
212 /* Return true if GIMPLE sequence S is empty. */
215 gimple_seq_empty_p (const_gimple_seq s
)
217 return s
== NULL
|| s
->first
== NULL
;
221 void gimple_seq_add_stmt (gimple_seq
*, gimple
);
223 /* Allocate a new sequence and initialize its first element with STMT. */
225 static inline gimple_seq
226 gimple_seq_alloc_with_stmt (gimple stmt
)
228 gimple_seq seq
= NULL
;
229 gimple_seq_add_stmt (&seq
, stmt
);
234 /* Returns the sequence of statements in BB. */
236 static inline gimple_seq
237 bb_seq (const_basic_block bb
)
239 return (!(bb
->flags
& BB_RTL
) && bb
->il
.gimple
) ? bb
->il
.gimple
->seq
: NULL
;
243 /* Sets the sequence of statements in BB to SEQ. */
246 set_bb_seq (basic_block bb
, gimple_seq seq
)
248 gcc_assert (!(bb
->flags
& BB_RTL
));
249 bb
->il
.gimple
->seq
= seq
;
252 /* Iterator object for GIMPLE statement sequences. */
256 /* Sequence node holding the current statement. */
259 /* Sequence and basic block holding the statement. These fields
260 are necessary to handle edge cases such as when statement is
261 added to an empty basic block or when the last statement of a
262 block/sequence is removed. */
265 } gimple_stmt_iterator
;
268 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
269 are for 64 bit hosts. */
271 struct GTY(()) gimple_statement_base
{
273 Main identifying code for a tuple. */
274 ENUM_BITFIELD(gimple_code
) code
: 8;
276 /* Nonzero if a warning should not be emitted on this tuple. */
277 unsigned int no_warning
: 1;
279 /* Nonzero if this tuple has been visited. Passes are responsible
280 for clearing this bit before using it. */
281 unsigned int visited
: 1;
283 /* Nonzero if this tuple represents a non-temporal move. */
284 unsigned int nontemporal_move
: 1;
286 /* Pass local flags. These flags are free for any pass to use as
287 they see fit. Passes should not assume that these flags contain
288 any useful value when the pass starts. Any initial state that
289 the pass requires should be set on entry to the pass. See
290 gimple_set_plf and gimple_plf for usage. */
291 unsigned int plf
: 2;
293 /* Nonzero if this statement has been modified and needs to have its
294 operands rescanned. */
295 unsigned modified
: 1;
297 /* Nonzero if this statement contains volatile operands. */
298 unsigned has_volatile_ops
: 1;
300 /* Padding to get subcode to 16 bit alignment. */
303 /* The SUBCODE field can be used for tuple-specific flags for tuples
304 that do not require subcodes. Note that SUBCODE should be at
305 least as wide as tree codes, as several tuples store tree codes
307 unsigned int subcode
: 16;
309 /* UID of this statement. This is used by passes that want to
310 assign IDs to statements. It must be assigned and used by each
311 pass. By default it should be assumed to contain garbage. */
315 Locus information for debug info. */
318 /* Number of operands in this tuple. */
322 Basic block holding this statement. */
323 struct basic_block_def
*bb
;
326 Lexical block holding this statement. */
331 /* Base structure for tuples with operands. */
333 struct GTY(()) gimple_statement_with_ops_base
336 struct gimple_statement_base gsbase
;
339 SSA operand vectors. NOTE: It should be possible to
340 amalgamate these vectors with the operand vector OP. However,
341 the SSA operand vectors are organized differently and contain
342 more information (like immediate use chaining). */
343 struct def_optype_d
GTY((skip (""))) *def_ops
;
344 struct use_optype_d
GTY((skip (""))) *use_ops
;
348 /* Statements that take register operands. */
350 struct GTY(()) gimple_statement_with_ops
353 struct gimple_statement_with_ops_base opbase
;
356 Operand vector. NOTE! This must always be the last field
357 of this structure. In particular, this means that this
358 structure cannot be embedded inside another one. */
359 tree
GTY((length ("%h.opbase.gsbase.num_ops"))) op
[1];
363 /* Base for statements that take both memory and register operands. */
365 struct GTY(()) gimple_statement_with_memory_ops_base
368 struct gimple_statement_with_ops_base opbase
;
371 Virtual operands for this statement. The GC will pick them
372 up via the ssa_names array. */
373 tree
GTY((skip (""))) vdef
;
374 tree
GTY((skip (""))) vuse
;
378 /* Statements that take both memory and register operands. */
380 struct GTY(()) gimple_statement_with_memory_ops
383 struct gimple_statement_with_memory_ops_base membase
;
386 Operand vector. NOTE! This must always be the last field
387 of this structure. In particular, this means that this
388 structure cannot be embedded inside another one. */
389 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
393 /* OpenMP statements (#pragma omp). */
395 struct GTY(()) gimple_statement_omp
{
397 struct gimple_statement_base gsbase
;
406 struct GTY(()) gimple_statement_bind
{
408 struct gimple_statement_base gsbase
;
411 Variables declared in this scope. */
415 This is different than the BLOCK field in gimple_statement_base,
416 which is analogous to TREE_BLOCK (i.e., the lexical block holding
417 this statement). This field is the equivalent of BIND_EXPR_BLOCK
418 in tree land (i.e., the lexical scope defined by this bind). See
429 struct GTY(()) gimple_statement_catch
{
431 struct gimple_statement_base gsbase
;
441 /* GIMPLE_EH_FILTER */
443 struct GTY(()) gimple_statement_eh_filter
{
445 struct gimple_statement_base gsbase
;
457 /* GIMPLE_EH_MUST_NOT_THROW */
459 struct GTY(()) gimple_statement_eh_mnt
{
461 struct gimple_statement_base gsbase
;
463 /* [ WORD 5 ] Abort function decl. */
469 struct GTY(()) gimple_statement_phi
{
471 struct gimple_statement_base gsbase
;
481 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
485 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
487 struct GTY(()) gimple_statement_eh_ctrl
490 struct gimple_statement_base gsbase
;
493 Exception region number. */
500 struct GTY(()) gimple_statement_try
{
502 struct gimple_statement_base gsbase
;
505 Expression to evaluate. */
509 Cleanup expression. */
513 /* Kind of GIMPLE_TRY statements. */
514 enum gimple_try_flags
517 GIMPLE_TRY_CATCH
= 1 << 0,
520 GIMPLE_TRY_FINALLY
= 1 << 1,
521 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
523 /* Analogous to TRY_CATCH_IS_CLEANUP. */
524 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
527 /* GIMPLE_WITH_CLEANUP_EXPR */
529 struct GTY(()) gimple_statement_wce
{
531 struct gimple_statement_base gsbase
;
533 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
534 executed if an exception is thrown, not on normal exit of its
535 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
539 Cleanup expression. */
546 struct GTY(()) gimple_statement_asm
549 struct gimple_statement_with_memory_ops_base membase
;
552 __asm__ statement. */
556 Number of inputs, outputs, clobbers, labels. */
563 Operand vector. NOTE! This must always be the last field
564 of this structure. In particular, this means that this
565 structure cannot be embedded inside another one. */
566 tree
GTY((length ("%h.membase.opbase.gsbase.num_ops"))) op
[1];
569 /* GIMPLE_OMP_CRITICAL */
571 struct GTY(()) gimple_statement_omp_critical
{
573 struct gimple_statement_omp omp
;
576 Critical section name. */
581 struct GTY(()) gimple_omp_for_iter
{
582 /* Condition code. */
585 /* Index variable. */
600 struct GTY(()) gimple_statement_omp_for
{
602 struct gimple_statement_omp omp
;
608 Number of elements in iter array. */
612 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
615 Pre-body evaluated before the loop body begins. */
620 /* GIMPLE_OMP_PARALLEL */
622 struct GTY(()) gimple_statement_omp_parallel
{
624 struct gimple_statement_omp omp
;
631 Child function holding the body of the parallel region. */
635 Shared data argument. */
640 /* GIMPLE_OMP_TASK */
642 struct GTY(()) gimple_statement_omp_task
{
644 struct gimple_statement_omp_parallel par
;
647 Child function holding firstprivate initialization if needed. */
651 Size and alignment in bytes of the argument data block. */
657 /* GIMPLE_OMP_SECTION */
658 /* Uses struct gimple_statement_omp. */
661 /* GIMPLE_OMP_SECTIONS */
663 struct GTY(()) gimple_statement_omp_sections
{
665 struct gimple_statement_omp omp
;
671 The control variable used for deciding which of the sections to
676 /* GIMPLE_OMP_CONTINUE.
678 Note: This does not inherit from gimple_statement_omp, because we
679 do not need the body field. */
681 struct GTY(()) gimple_statement_omp_continue
{
683 struct gimple_statement_base gsbase
;
692 /* GIMPLE_OMP_SINGLE */
694 struct GTY(()) gimple_statement_omp_single
{
696 struct gimple_statement_omp omp
;
703 /* GIMPLE_OMP_ATOMIC_LOAD.
704 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
705 contains a sequence, which we don't need here. */
707 struct GTY(()) gimple_statement_omp_atomic_load
{
709 struct gimple_statement_base gsbase
;
715 /* GIMPLE_OMP_ATOMIC_STORE.
716 See note on GIMPLE_OMP_ATOMIC_LOAD. */
718 struct GTY(()) gimple_statement_omp_atomic_store
{
720 struct gimple_statement_base gsbase
;
726 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
727 enum gimple_statement_structure_enum
{
728 #include "gsstruct.def"
734 /* Define the overall contents of a gimple tuple. It may be any of the
735 structures declared above for various types of tuples. */
737 union GTY ((desc ("gimple_statement_structure (&%h)"))) gimple_statement_d
{
738 struct gimple_statement_base
GTY ((tag ("GSS_BASE"))) gsbase
;
739 struct gimple_statement_with_ops
GTY ((tag ("GSS_WITH_OPS"))) gsops
;
740 struct gimple_statement_with_memory_ops_base
GTY ((tag ("GSS_WITH_MEM_OPS_BASE"))) gsmembase
;
741 struct gimple_statement_with_memory_ops
GTY ((tag ("GSS_WITH_MEM_OPS"))) gsmem
;
742 struct gimple_statement_omp
GTY ((tag ("GSS_OMP"))) omp
;
743 struct gimple_statement_bind
GTY ((tag ("GSS_BIND"))) gimple_bind
;
744 struct gimple_statement_catch
GTY ((tag ("GSS_CATCH"))) gimple_catch
;
745 struct gimple_statement_eh_filter
GTY ((tag ("GSS_EH_FILTER"))) gimple_eh_filter
;
746 struct gimple_statement_eh_mnt
GTY ((tag ("GSS_EH_MNT"))) gimple_eh_mnt
;
747 struct gimple_statement_phi
GTY ((tag ("GSS_PHI"))) gimple_phi
;
748 struct gimple_statement_eh_ctrl
GTY ((tag ("GSS_EH_CTRL"))) gimple_eh_ctrl
;
749 struct gimple_statement_try
GTY ((tag ("GSS_TRY"))) gimple_try
;
750 struct gimple_statement_wce
GTY ((tag ("GSS_WCE"))) gimple_wce
;
751 struct gimple_statement_asm
GTY ((tag ("GSS_ASM"))) gimple_asm
;
752 struct gimple_statement_omp_critical
GTY ((tag ("GSS_OMP_CRITICAL"))) gimple_omp_critical
;
753 struct gimple_statement_omp_for
GTY ((tag ("GSS_OMP_FOR"))) gimple_omp_for
;
754 struct gimple_statement_omp_parallel
GTY ((tag ("GSS_OMP_PARALLEL"))) gimple_omp_parallel
;
755 struct gimple_statement_omp_task
GTY ((tag ("GSS_OMP_TASK"))) gimple_omp_task
;
756 struct gimple_statement_omp_sections
GTY ((tag ("GSS_OMP_SECTIONS"))) gimple_omp_sections
;
757 struct gimple_statement_omp_single
GTY ((tag ("GSS_OMP_SINGLE"))) gimple_omp_single
;
758 struct gimple_statement_omp_continue
GTY ((tag ("GSS_OMP_CONTINUE"))) gimple_omp_continue
;
759 struct gimple_statement_omp_atomic_load
GTY ((tag ("GSS_OMP_ATOMIC_LOAD"))) gimple_omp_atomic_load
;
760 struct gimple_statement_omp_atomic_store
GTY ((tag ("GSS_OMP_ATOMIC_STORE"))) gimple_omp_atomic_store
;
765 /* Offset in bytes to the location of the operand vector.
766 Zero if there is no operand vector for this tuple structure. */
767 extern size_t const gimple_ops_offset_
[];
769 /* Map GIMPLE codes to GSS codes. */
770 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
772 /* This variable holds the currently expanded gimple statement for purposes
773 of comminucating the profile info to the builtin expanders. */
774 extern gimple currently_expanding_gimple_stmt
;
776 gimple
gimple_build_return (tree
);
778 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
779 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
781 void extract_ops_from_tree (tree
, enum tree_code
*, tree
*, tree
*);
783 gimple
gimple_build_assign_with_ops_stat (enum tree_code
, tree
, tree
,
785 #define gimple_build_assign_with_ops(c,o1,o2,o3) \
786 gimple_build_assign_with_ops_stat (c, o1, o2, o3 MEM_STAT_INFO)
788 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
789 #define gimple_build_debug_bind(var,val,stmt) \
790 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
792 gimple
gimple_build_call_vec (tree
, VEC(tree
, heap
) *);
793 gimple
gimple_build_call (tree
, unsigned, ...);
794 gimple
gimple_build_call_from_tree (tree
);
795 gimple
gimplify_assign (tree
, tree
, gimple_seq
*);
796 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
797 gimple
gimple_build_label (tree label
);
798 gimple
gimple_build_goto (tree dest
);
799 gimple
gimple_build_nop (void);
800 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
801 gimple
gimple_build_asm_vec (const char *, VEC(tree
,gc
) *, VEC(tree
,gc
) *,
802 VEC(tree
,gc
) *, VEC(tree
,gc
) *);
803 gimple
gimple_build_catch (tree
, gimple_seq
);
804 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
805 gimple
gimple_build_eh_must_not_throw (tree
);
806 gimple
gimple_build_try (gimple_seq
, gimple_seq
, enum gimple_try_flags
);
807 gimple
gimple_build_wce (gimple_seq
);
808 gimple
gimple_build_resx (int);
809 gimple
gimple_build_eh_dispatch (int);
810 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
811 gimple
gimple_build_switch (unsigned, tree
, tree
, ...);
812 gimple
gimple_build_switch_vec (tree
, tree
, VEC(tree
,heap
) *);
813 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
814 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
815 gimple
gimple_build_omp_for (gimple_seq
, tree
, size_t, gimple_seq
);
816 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
817 gimple
gimple_build_omp_section (gimple_seq
);
818 gimple
gimple_build_omp_continue (tree
, tree
);
819 gimple
gimple_build_omp_master (gimple_seq
);
820 gimple
gimple_build_omp_return (bool);
821 gimple
gimple_build_omp_ordered (gimple_seq
);
822 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
823 gimple
gimple_build_omp_sections_switch (void);
824 gimple
gimple_build_omp_single (gimple_seq
, tree
);
825 gimple
gimple_build_cdt (tree
, tree
);
826 gimple
gimple_build_omp_atomic_load (tree
, tree
);
827 gimple
gimple_build_omp_atomic_store (tree
);
828 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
829 enum gimple_statement_structure_enum
gss_for_assign (enum tree_code
);
830 void sort_case_labels (VEC(tree
,heap
) *);
831 void gimple_set_body (tree
, gimple_seq
);
832 gimple_seq
gimple_body (tree
);
833 bool gimple_has_body_p (tree
);
834 gimple_seq
gimple_seq_alloc (void);
835 void gimple_seq_free (gimple_seq
);
836 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
837 gimple_seq
gimple_seq_copy (gimple_seq
);
838 int gimple_call_flags (const_gimple
);
839 bool gimple_assign_copy_p (gimple
);
840 bool gimple_assign_ssa_name_copy_p (gimple
);
841 bool gimple_assign_single_p (gimple
);
842 bool gimple_assign_unary_nop_p (gimple
);
843 void gimple_set_bb (gimple
, struct basic_block_def
*);
844 tree
gimple_fold (const_gimple
);
845 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
846 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*, enum tree_code
,
848 tree
gimple_get_lhs (const_gimple
);
849 void gimple_set_lhs (gimple
, tree
);
850 void gimple_replace_lhs (gimple
, tree
);
851 gimple
gimple_copy (gimple
);
852 bool is_gimple_operand (const_tree
);
853 void gimple_set_modified (gimple
, bool);
854 void gimple_cond_get_ops_from_tree (tree
, enum tree_code
*, tree
*, tree
*);
855 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
856 void gimple_cond_set_condition_from_tree (gimple
, tree
);
857 bool gimple_has_side_effects (const_gimple
);
858 bool gimple_rhs_has_side_effects (const_gimple
);
859 bool gimple_could_trap_p (gimple
);
860 bool gimple_assign_rhs_could_trap_p (gimple
);
861 void gimple_regimplify_operands (gimple
, gimple_stmt_iterator
*);
862 bool empty_body_p (gimple_seq
);
863 unsigned get_gimple_rhs_num_ops (enum tree_code
);
864 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
865 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
866 const char *gimple_decl_printable_name (tree
, int);
867 tree
gimple_fold_obj_type_ref (tree
, tree
);
869 /* Returns true iff T is a valid GIMPLE statement. */
870 extern bool is_gimple_stmt (tree
);
872 /* Returns true iff TYPE is a valid type for a scalar register variable. */
873 extern bool is_gimple_reg_type (tree
);
874 /* Returns true iff T is a scalar register variable. */
875 extern bool is_gimple_reg (tree
);
876 /* Returns true iff T is any sort of variable. */
877 extern bool is_gimple_variable (tree
);
878 /* Returns true iff T is any sort of symbol. */
879 extern bool is_gimple_id (tree
);
880 /* Returns true iff T is a variable or an INDIRECT_REF (of a variable). */
881 extern bool is_gimple_min_lval (tree
);
882 /* Returns true iff T is something whose address can be taken. */
883 extern bool is_gimple_addressable (tree
);
884 /* Returns true iff T is any valid GIMPLE lvalue. */
885 extern bool is_gimple_lvalue (tree
);
887 /* Returns true iff T is a GIMPLE address. */
888 bool is_gimple_address (const_tree
);
889 /* Returns true iff T is a GIMPLE invariant address. */
890 bool is_gimple_invariant_address (const_tree
);
891 /* Returns true iff T is a GIMPLE invariant address at interprocedural
893 bool is_gimple_ip_invariant_address (const_tree
);
894 /* Returns true iff T is a valid GIMPLE constant. */
895 bool is_gimple_constant (const_tree
);
896 /* Returns true iff T is a GIMPLE restricted function invariant. */
897 extern bool is_gimple_min_invariant (const_tree
);
898 /* Returns true iff T is a GIMPLE restricted interprecodural invariant. */
899 extern bool is_gimple_ip_invariant (const_tree
);
900 /* Returns true iff T is a GIMPLE rvalue. */
901 extern bool is_gimple_val (tree
);
902 /* Returns true iff T is a GIMPLE asm statement input. */
903 extern bool is_gimple_asm_val (tree
);
904 /* Returns true iff T is a valid rhs for a MODIFY_EXPR where the LHS is a
905 GIMPLE temporary, a renamed user variable, or something else,
907 extern bool is_gimple_reg_rhs (tree
);
908 extern bool is_gimple_mem_rhs (tree
);
910 /* Returns true iff T is a valid if-statement condition. */
911 extern bool is_gimple_condexpr (tree
);
913 /* Returns true iff T is a type conversion. */
914 extern bool is_gimple_cast (tree
);
915 /* Returns true iff T is a variable that does not need to live in memory. */
916 extern bool is_gimple_non_addressable (tree t
);
918 /* Returns true iff T is a valid call address expression. */
919 extern bool is_gimple_call_addr (tree
);
920 /* If T makes a function call, returns the CALL_EXPR operand. */
921 extern tree
get_call_expr_in (tree t
);
923 extern void recalculate_side_effects (tree
);
924 extern bool compare_field_offset (tree
, tree
);
925 extern tree
gimple_register_type (tree
);
926 extern void print_gimple_types_stats (void);
927 extern void free_gimple_type_tables (void);
928 extern tree
gimple_unsigned_type (tree
);
929 extern tree
gimple_signed_type (tree
);
930 extern alias_set_type
gimple_get_alias_set (tree
);
931 extern void count_uses_and_derefs (tree
, gimple
, unsigned *, unsigned *,
933 extern bool walk_stmt_load_store_addr_ops (gimple
, void *,
934 bool (*)(gimple
, tree
, void *),
935 bool (*)(gimple
, tree
, void *),
936 bool (*)(gimple
, tree
, void *));
937 extern bool walk_stmt_load_store_ops (gimple
, void *,
938 bool (*)(gimple
, tree
, void *),
939 bool (*)(gimple
, tree
, void *));
940 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
943 extern tree
create_tmp_var_raw (tree
, const char *);
944 extern tree
create_tmp_var_name (const char *);
945 extern tree
create_tmp_var (tree
, const char *);
946 extern tree
get_initialized_tmp_var (tree
, gimple_seq
*, gimple_seq
*);
947 extern tree
get_formal_tmp_var (tree
, gimple_seq
*);
948 extern void declare_vars (tree
, gimple
, bool);
949 extern void annotate_all_with_location (gimple_seq
, location_t
);
951 /* Validation of GIMPLE expressions. Note that these predicates only check
952 the basic form of the expression, they don't recurse to make sure that
953 underlying nodes are also of the right form. */
954 typedef bool (*gimple_predicate
)(tree
);
957 /* FIXME we should deduce this from the predicate. */
959 fb_none
= 0, /* Do not generate a temporary. */
961 fb_rvalue
= 1, /* Generate an rvalue to hold the result of a
962 gimplified expression. */
964 fb_lvalue
= 2, /* Generate an lvalue to hold the result of a
965 gimplified expression. */
967 fb_mayfail
= 4, /* Gimplification may fail. Error issued
969 fb_either
= fb_rvalue
| fb_lvalue
972 typedef int fallback_t
;
974 enum gimplify_status
{
975 GS_ERROR
= -2, /* Something Bad Seen. */
976 GS_UNHANDLED
= -1, /* A langhook result for "I dunno". */
977 GS_OK
= 0, /* We did something, maybe more to do. */
978 GS_ALL_DONE
= 1 /* The expression is fully gimplified. */
983 struct gimplify_ctx
*prev_context
;
985 VEC(gimple
,heap
) *bind_expr_stack
;
987 gimple_seq conditional_cleanups
;
991 VEC(tree
,heap
) *case_labels
;
992 /* The formal temporary table. Should this be persistent? */
998 bool allow_rhs_cond_expr
;
1001 extern enum gimplify_status
gimplify_expr (tree
*, gimple_seq
*, gimple_seq
*,
1002 bool (*) (tree
), fallback_t
);
1003 extern void gimplify_type_sizes (tree
, gimple_seq
*);
1004 extern void gimplify_one_sizepos (tree
*, gimple_seq
*);
1005 extern bool gimplify_stmt (tree
*, gimple_seq
*);
1006 extern gimple
gimplify_body (tree
*, tree
, bool);
1007 extern void push_gimplify_context (struct gimplify_ctx
*);
1008 extern void pop_gimplify_context (gimple
);
1009 extern void gimplify_and_add (tree
, gimple_seq
*);
1011 /* Miscellaneous helpers. */
1012 extern void gimple_add_tmp_var (tree
);
1013 extern gimple
gimple_current_bind_expr (void);
1014 extern VEC(gimple
, heap
) *gimple_bind_expr_stack (void);
1015 extern tree
voidify_wrapper_expr (tree
, tree
);
1016 extern tree
build_and_jump (tree
*);
1017 extern tree
alloc_stmt_list (void);
1018 extern void free_stmt_list (tree
);
1019 extern tree
force_labels_r (tree
*, int *, void *);
1020 extern enum gimplify_status
gimplify_va_arg_expr (tree
*, gimple_seq
*,
1022 struct gimplify_omp_ctx
;
1023 extern void omp_firstprivatize_variable (struct gimplify_omp_ctx
*, tree
);
1024 extern tree
gimple_boolify (tree
);
1025 extern gimple_predicate
rhs_predicate_for (tree
);
1026 extern tree
canonicalize_cond_expr_cond (tree
);
1029 extern tree
omp_reduction_init (tree
, tree
);
1031 /* In tree-nested.c. */
1032 extern void lower_nested_functions (tree
);
1033 extern void insert_field_into_struct (tree
, tree
);
1035 /* In gimplify.c. */
1036 extern void gimplify_function_tree (tree
);
1038 /* In cfgexpand.c. */
1039 extern tree
gimple_assign_rhs_to_tree (gimple
);
1042 extern bool validate_gimple_arglist (const_gimple
, ...);
1045 extern bool tree_ssa_useless_type_conversion (tree
);
1046 extern tree
tree_ssa_strip_useless_type_conversions (tree
);
1047 extern bool useless_type_conversion_p (tree
, tree
);
1048 extern bool types_compatible_p (tree
, tree
);
1050 /* Return the code for GIMPLE statement G. */
1052 static inline enum gimple_code
1053 gimple_code (const_gimple g
)
1055 return g
->gsbase
.code
;
1059 /* Return the GSS code used by a GIMPLE code. */
1061 static inline enum gimple_statement_structure_enum
1062 gss_for_code (enum gimple_code code
)
1064 #ifdef ENABLE_CHECKING
1065 gcc_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1067 return gss_for_code_
[code
];
1071 /* Return which GSS code is used by GS. */
1073 static inline enum gimple_statement_structure_enum
1074 gimple_statement_structure (gimple gs
)
1076 return gss_for_code (gimple_code (gs
));
1080 /* Return true if statement G has sub-statements. This is only true for
1081 High GIMPLE statements. */
1084 gimple_has_substatements (gimple g
)
1086 switch (gimple_code (g
))
1090 case GIMPLE_EH_FILTER
:
1092 case GIMPLE_OMP_FOR
:
1093 case GIMPLE_OMP_MASTER
:
1094 case GIMPLE_OMP_ORDERED
:
1095 case GIMPLE_OMP_SECTION
:
1096 case GIMPLE_OMP_PARALLEL
:
1097 case GIMPLE_OMP_TASK
:
1098 case GIMPLE_OMP_SECTIONS
:
1099 case GIMPLE_OMP_SINGLE
:
1100 case GIMPLE_OMP_CRITICAL
:
1101 case GIMPLE_WITH_CLEANUP_EXPR
:
1110 /* Return the basic block holding statement G. */
1112 static inline struct basic_block_def
*
1113 gimple_bb (const_gimple g
)
1115 return g
->gsbase
.bb
;
1119 /* Return the lexical scope block holding statement G. */
1122 gimple_block (const_gimple g
)
1124 return g
->gsbase
.block
;
1128 /* Set BLOCK to be the lexical scope block holding statement G. */
1131 gimple_set_block (gimple g
, tree block
)
1133 g
->gsbase
.block
= block
;
1137 /* Return location information for statement G. */
1139 static inline location_t
1140 gimple_location (const_gimple g
)
1142 return g
->gsbase
.location
;
1145 /* Return pointer to location information for statement G. */
1147 static inline const location_t
*
1148 gimple_location_ptr (const_gimple g
)
1150 return &g
->gsbase
.location
;
1154 /* Set location information for statement G. */
1157 gimple_set_location (gimple g
, location_t location
)
1159 g
->gsbase
.location
= location
;
1163 /* Return true if G contains location information. */
1166 gimple_has_location (const_gimple g
)
1168 return gimple_location (g
) != UNKNOWN_LOCATION
;
1172 /* Return the file name of the location of STMT. */
1174 static inline const char *
1175 gimple_filename (const_gimple stmt
)
1177 return LOCATION_FILE (gimple_location (stmt
));
1181 /* Return the line number of the location of STMT. */
1184 gimple_lineno (const_gimple stmt
)
1186 return LOCATION_LINE (gimple_location (stmt
));
1190 /* Determine whether SEQ is a singleton. */
1193 gimple_seq_singleton_p (gimple_seq seq
)
1195 return ((gimple_seq_first (seq
) != NULL
)
1196 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1199 /* Return true if no warnings should be emitted for statement STMT. */
1202 gimple_no_warning_p (const_gimple stmt
)
1204 return stmt
->gsbase
.no_warning
;
1207 /* Set the no_warning flag of STMT to NO_WARNING. */
1210 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1212 stmt
->gsbase
.no_warning
= (unsigned) no_warning
;
1215 /* Set the visited status on statement STMT to VISITED_P. */
1218 gimple_set_visited (gimple stmt
, bool visited_p
)
1220 stmt
->gsbase
.visited
= (unsigned) visited_p
;
1224 /* Return the visited status for statement STMT. */
1227 gimple_visited_p (gimple stmt
)
1229 return stmt
->gsbase
.visited
;
1233 /* Set pass local flag PLF on statement STMT to VAL_P. */
1236 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1239 stmt
->gsbase
.plf
|= (unsigned int) plf
;
1241 stmt
->gsbase
.plf
&= ~((unsigned int) plf
);
1245 /* Return the value of pass local flag PLF on statement STMT. */
1247 static inline unsigned int
1248 gimple_plf (gimple stmt
, enum plf_mask plf
)
1250 return stmt
->gsbase
.plf
& ((unsigned int) plf
);
1254 /* Set the UID of statement. */
1257 gimple_set_uid (gimple g
, unsigned uid
)
1259 g
->gsbase
.uid
= uid
;
1263 /* Return the UID of statement. */
1265 static inline unsigned
1266 gimple_uid (const_gimple g
)
1268 return g
->gsbase
.uid
;
1272 /* Return true if GIMPLE statement G has register or memory operands. */
1275 gimple_has_ops (const_gimple g
)
1277 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1281 /* Return true if GIMPLE statement G has memory operands. */
1284 gimple_has_mem_ops (const_gimple g
)
1286 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1290 /* Return the set of DEF operands for statement G. */
1292 static inline struct def_optype_d
*
1293 gimple_def_ops (const_gimple g
)
1295 if (!gimple_has_ops (g
))
1297 return g
->gsops
.opbase
.def_ops
;
1301 /* Set DEF to be the set of DEF operands for statement G. */
1304 gimple_set_def_ops (gimple g
, struct def_optype_d
*def
)
1306 gcc_assert (gimple_has_ops (g
));
1307 g
->gsops
.opbase
.def_ops
= def
;
1311 /* Return the set of USE operands for statement G. */
1313 static inline struct use_optype_d
*
1314 gimple_use_ops (const_gimple g
)
1316 if (!gimple_has_ops (g
))
1318 return g
->gsops
.opbase
.use_ops
;
1322 /* Set USE to be the set of USE operands for statement G. */
1325 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1327 gcc_assert (gimple_has_ops (g
));
1328 g
->gsops
.opbase
.use_ops
= use
;
1332 /* Return the set of VUSE operand for statement G. */
1334 static inline use_operand_p
1335 gimple_vuse_op (const_gimple g
)
1337 struct use_optype_d
*ops
;
1338 if (!gimple_has_mem_ops (g
))
1339 return NULL_USE_OPERAND_P
;
1340 ops
= g
->gsops
.opbase
.use_ops
;
1342 && USE_OP_PTR (ops
)->use
== &g
->gsmembase
.vuse
)
1343 return USE_OP_PTR (ops
);
1344 return NULL_USE_OPERAND_P
;
1347 /* Return the set of VDEF operand for statement G. */
1349 static inline def_operand_p
1350 gimple_vdef_op (const_gimple g
)
1352 struct def_optype_d
*ops
;
1353 if (!gimple_has_mem_ops (g
))
1354 return NULL_DEF_OPERAND_P
;
1355 ops
= g
->gsops
.opbase
.def_ops
;
1357 && DEF_OP_PTR (ops
) == &g
->gsmembase
.vdef
)
1358 return DEF_OP_PTR (ops
);
1359 return NULL_DEF_OPERAND_P
;
1363 /* Return the single VUSE operand of the statement G. */
1366 gimple_vuse (const_gimple g
)
1368 if (!gimple_has_mem_ops (g
))
1370 return g
->gsmembase
.vuse
;
1373 /* Return the single VDEF operand of the statement G. */
1376 gimple_vdef (const_gimple g
)
1378 if (!gimple_has_mem_ops (g
))
1380 return g
->gsmembase
.vdef
;
1383 /* Return the single VUSE operand of the statement G. */
1385 static inline tree
*
1386 gimple_vuse_ptr (gimple g
)
1388 if (!gimple_has_mem_ops (g
))
1390 return &g
->gsmembase
.vuse
;
1393 /* Return the single VDEF operand of the statement G. */
1395 static inline tree
*
1396 gimple_vdef_ptr (gimple g
)
1398 if (!gimple_has_mem_ops (g
))
1400 return &g
->gsmembase
.vdef
;
1403 /* Set the single VUSE operand of the statement G. */
1406 gimple_set_vuse (gimple g
, tree vuse
)
1408 gcc_assert (gimple_has_mem_ops (g
));
1409 g
->gsmembase
.vuse
= vuse
;
1412 /* Set the single VDEF operand of the statement G. */
1415 gimple_set_vdef (gimple g
, tree vdef
)
1417 gcc_assert (gimple_has_mem_ops (g
));
1418 g
->gsmembase
.vdef
= vdef
;
1422 /* Return true if statement G has operands and the modified field has
1426 gimple_modified_p (const_gimple g
)
1428 return (gimple_has_ops (g
)) ? (bool) g
->gsbase
.modified
: false;
1432 /* Return the tree code for the expression computed by STMT. This is
1433 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1434 GIMPLE_CALL, return CALL_EXPR as the expression code for
1435 consistency. This is useful when the caller needs to deal with the
1436 three kinds of computation that GIMPLE supports. */
1438 static inline enum tree_code
1439 gimple_expr_code (const_gimple stmt
)
1441 enum gimple_code code
= gimple_code (stmt
);
1442 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1443 return (enum tree_code
) stmt
->gsbase
.subcode
;
1444 else if (code
== GIMPLE_CALL
)
1451 /* Mark statement S as modified, and update it. */
1454 update_stmt (gimple s
)
1456 if (gimple_has_ops (s
))
1458 gimple_set_modified (s
, true);
1459 update_stmt_operands (s
);
1463 /* Update statement S if it has been optimized. */
1466 update_stmt_if_modified (gimple s
)
1468 if (gimple_modified_p (s
))
1469 update_stmt_operands (s
);
1472 /* Return true if statement STMT contains volatile operands. */
1475 gimple_has_volatile_ops (const_gimple stmt
)
1477 if (gimple_has_mem_ops (stmt
))
1478 return stmt
->gsbase
.has_volatile_ops
;
1484 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1487 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1489 if (gimple_has_mem_ops (stmt
))
1490 stmt
->gsbase
.has_volatile_ops
= (unsigned) volatilep
;
1494 /* Return true if statement STMT may access memory. */
1497 gimple_references_memory_p (gimple stmt
)
1499 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1503 /* Return the subcode for OMP statement S. */
1505 static inline unsigned
1506 gimple_omp_subcode (const_gimple s
)
1508 gcc_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1509 && gimple_code (s
) <= GIMPLE_OMP_SINGLE
);
1510 return s
->gsbase
.subcode
;
1513 /* Set the subcode for OMP statement S to SUBCODE. */
1516 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1518 /* We only have 16 bits for the subcode. Assert that we are not
1520 gcc_assert (subcode
< (1 << 16));
1521 s
->gsbase
.subcode
= subcode
;
1524 /* Set the nowait flag on OMP_RETURN statement S. */
1527 gimple_omp_return_set_nowait (gimple s
)
1529 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1530 s
->gsbase
.subcode
|= GF_OMP_RETURN_NOWAIT
;
1534 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1538 gimple_omp_return_nowait_p (const_gimple g
)
1540 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1541 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1545 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1549 gimple_omp_section_last_p (const_gimple g
)
1551 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1552 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1556 /* Set the GF_OMP_SECTION_LAST flag on G. */
1559 gimple_omp_section_set_last (gimple g
)
1561 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1562 g
->gsbase
.subcode
|= GF_OMP_SECTION_LAST
;
1566 /* Return true if OMP parallel statement G has the
1567 GF_OMP_PARALLEL_COMBINED flag set. */
1570 gimple_omp_parallel_combined_p (const_gimple g
)
1572 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1573 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1577 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1578 value of COMBINED_P. */
1581 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1583 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1585 g
->gsbase
.subcode
|= GF_OMP_PARALLEL_COMBINED
;
1587 g
->gsbase
.subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1591 /* Return the number of operands for statement GS. */
1593 static inline unsigned
1594 gimple_num_ops (const_gimple gs
)
1596 return gs
->gsbase
.num_ops
;
1600 /* Set the number of operands for statement GS. */
1603 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
1605 gs
->gsbase
.num_ops
= num_ops
;
1609 /* Return the array of operands for statement GS. */
1611 static inline tree
*
1612 gimple_ops (gimple gs
)
1616 /* All the tuples have their operand vector at the very bottom
1617 of the structure. Note that those structures that do not
1618 have an operand vector have a zero offset. */
1619 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
1620 gcc_assert (off
!= 0);
1622 return (tree
*) ((char *) gs
+ off
);
1626 /* Return operand I for statement GS. */
1629 gimple_op (const_gimple gs
, unsigned i
)
1631 if (gimple_has_ops (gs
))
1633 #ifdef ENABLE_CHECKING
1634 gcc_assert (i
< gimple_num_ops (gs
));
1636 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
1642 /* Return a pointer to operand I for statement GS. */
1644 static inline tree
*
1645 gimple_op_ptr (const_gimple gs
, unsigned i
)
1647 if (gimple_has_ops (gs
))
1649 #ifdef ENABLE_CHECKING
1650 gcc_assert (i
< gimple_num_ops (gs
));
1652 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
1658 /* Set operand I of statement GS to OP. */
1661 gimple_set_op (gimple gs
, unsigned i
, tree op
)
1663 gcc_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
1665 /* Note. It may be tempting to assert that OP matches
1666 is_gimple_operand, but that would be wrong. Different tuples
1667 accept slightly different sets of tree operands. Each caller
1668 should perform its own validation. */
1669 gimple_ops (gs
)[i
] = op
;
1672 /* Return true if GS is a GIMPLE_ASSIGN. */
1675 is_gimple_assign (const_gimple gs
)
1677 return gimple_code (gs
) == GIMPLE_ASSIGN
;
1680 /* Determine if expression CODE is one of the valid expressions that can
1681 be used on the RHS of GIMPLE assignments. */
1683 static inline enum gimple_rhs_class
1684 get_gimple_rhs_class (enum tree_code code
)
1686 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
1689 /* Return the LHS of assignment statement GS. */
1692 gimple_assign_lhs (const_gimple gs
)
1694 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1695 return gimple_op (gs
, 0);
1699 /* Return a pointer to the LHS of assignment statement GS. */
1701 static inline tree
*
1702 gimple_assign_lhs_ptr (const_gimple gs
)
1704 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1705 return gimple_op_ptr (gs
, 0);
1709 /* Set LHS to be the LHS operand of assignment statement GS. */
1712 gimple_assign_set_lhs (gimple gs
, tree lhs
)
1714 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1715 gimple_set_op (gs
, 0, lhs
);
1717 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1718 SSA_NAME_DEF_STMT (lhs
) = gs
;
1722 /* Return the first operand on the RHS of assignment statement GS. */
1725 gimple_assign_rhs1 (const_gimple gs
)
1727 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1728 return gimple_op (gs
, 1);
1732 /* Return a pointer to the first operand on the RHS of assignment
1735 static inline tree
*
1736 gimple_assign_rhs1_ptr (const_gimple gs
)
1738 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1739 return gimple_op_ptr (gs
, 1);
1742 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1745 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
1747 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1749 gimple_set_op (gs
, 1, rhs
);
1753 /* Return the second operand on the RHS of assignment statement GS.
1754 If GS does not have two operands, NULL is returned instead. */
1757 gimple_assign_rhs2 (const_gimple gs
)
1759 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1761 if (gimple_num_ops (gs
) >= 3)
1762 return gimple_op (gs
, 2);
1768 /* Return a pointer to the second operand on the RHS of assignment
1771 static inline tree
*
1772 gimple_assign_rhs2_ptr (const_gimple gs
)
1774 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1775 return gimple_op_ptr (gs
, 2);
1779 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1782 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
1784 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1786 gimple_set_op (gs
, 2, rhs
);
1789 /* Returns true if GS is a nontemporal move. */
1792 gimple_assign_nontemporal_move_p (const_gimple gs
)
1794 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1795 return gs
->gsbase
.nontemporal_move
;
1798 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1801 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
1803 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1804 gs
->gsbase
.nontemporal_move
= nontemporal
;
1808 /* Return the code of the expression computed on the rhs of assignment
1809 statement GS. In case that the RHS is a single object, returns the
1810 tree code of the object. */
1812 static inline enum tree_code
1813 gimple_assign_rhs_code (const_gimple gs
)
1815 enum tree_code code
;
1816 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
1818 code
= gimple_expr_code (gs
);
1819 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
1820 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
1826 /* Set CODE to be the code for the expression computed on the RHS of
1830 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
1832 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
1833 s
->gsbase
.subcode
= code
;
1837 /* Return the gimple rhs class of the code of the expression computed on
1838 the rhs of assignment statement GS.
1839 This will never return GIMPLE_INVALID_RHS. */
1841 static inline enum gimple_rhs_class
1842 gimple_assign_rhs_class (const_gimple gs
)
1844 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
1848 /* Return true if S is a type-cast assignment. */
1851 gimple_assign_cast_p (gimple s
)
1853 if (is_gimple_assign (s
))
1855 enum tree_code sc
= gimple_assign_rhs_code (s
);
1856 return CONVERT_EXPR_CODE_P (sc
)
1857 || sc
== VIEW_CONVERT_EXPR
1858 || sc
== FIX_TRUNC_EXPR
;
1865 /* Return true if GS is a GIMPLE_CALL. */
1868 is_gimple_call (const_gimple gs
)
1870 return gimple_code (gs
) == GIMPLE_CALL
;
1873 /* Return the LHS of call statement GS. */
1876 gimple_call_lhs (const_gimple gs
)
1878 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1879 return gimple_op (gs
, 0);
1883 /* Return a pointer to the LHS of call statement GS. */
1885 static inline tree
*
1886 gimple_call_lhs_ptr (const_gimple gs
)
1888 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1889 return gimple_op_ptr (gs
, 0);
1893 /* Set LHS to be the LHS operand of call statement GS. */
1896 gimple_call_set_lhs (gimple gs
, tree lhs
)
1898 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1899 gimple_set_op (gs
, 0, lhs
);
1900 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
1901 SSA_NAME_DEF_STMT (lhs
) = gs
;
1905 /* Return the tree node representing the function called by call
1909 gimple_call_fn (const_gimple gs
)
1911 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1912 return gimple_op (gs
, 1);
1916 /* Return a pointer to the tree node representing the function called by call
1919 static inline tree
*
1920 gimple_call_fn_ptr (const_gimple gs
)
1922 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1923 return gimple_op_ptr (gs
, 1);
1927 /* Set FN to be the function called by call statement GS. */
1930 gimple_call_set_fn (gimple gs
, tree fn
)
1932 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1933 gimple_set_op (gs
, 1, fn
);
1937 /* Set FNDECL to be the function called by call statement GS. */
1940 gimple_call_set_fndecl (gimple gs
, tree decl
)
1942 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1943 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
1947 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1948 Otherwise return NULL. This function is analogous to
1949 get_callee_fndecl in tree land. */
1952 gimple_call_fndecl (const_gimple gs
)
1954 tree addr
= gimple_call_fn (gs
);
1955 if (TREE_CODE (addr
) == ADDR_EXPR
)
1956 return TREE_OPERAND (addr
, 0);
1961 /* Return the type returned by call statement GS. */
1964 gimple_call_return_type (const_gimple gs
)
1966 tree fn
= gimple_call_fn (gs
);
1967 tree type
= TREE_TYPE (fn
);
1969 /* See through the pointer. */
1970 type
= TREE_TYPE (type
);
1972 /* The type returned by a FUNCTION_DECL is the type of its
1974 return TREE_TYPE (type
);
1978 /* Return the static chain for call statement GS. */
1981 gimple_call_chain (const_gimple gs
)
1983 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1984 return gimple_op (gs
, 2);
1988 /* Return a pointer to the static chain for call statement GS. */
1990 static inline tree
*
1991 gimple_call_chain_ptr (const_gimple gs
)
1993 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
1994 return gimple_op_ptr (gs
, 2);
1997 /* Set CHAIN to be the static chain for call statement GS. */
2000 gimple_call_set_chain (gimple gs
, tree chain
)
2002 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2004 gimple_set_op (gs
, 2, chain
);
2008 /* Return the number of arguments used by call statement GS. */
2010 static inline unsigned
2011 gimple_call_num_args (const_gimple gs
)
2014 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2015 num_ops
= gimple_num_ops (gs
);
2020 /* Return the argument at position INDEX for call statement GS. */
2023 gimple_call_arg (const_gimple gs
, unsigned index
)
2025 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2026 return gimple_op (gs
, index
+ 3);
2030 /* Return a pointer to the argument at position INDEX for call
2033 static inline tree
*
2034 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2036 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2037 return gimple_op_ptr (gs
, index
+ 3);
2041 /* Set ARG to be the argument at position INDEX for call statement GS. */
2044 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2046 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2047 gimple_set_op (gs
, index
+ 3, arg
);
2051 /* If TAIL_P is true, mark call statement S as being a tail call
2052 (i.e., a call just before the exit of a function). These calls are
2053 candidate for tail call optimization. */
2056 gimple_call_set_tail (gimple s
, bool tail_p
)
2058 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2060 s
->gsbase
.subcode
|= GF_CALL_TAILCALL
;
2062 s
->gsbase
.subcode
&= ~GF_CALL_TAILCALL
;
2066 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2069 gimple_call_tail_p (gimple s
)
2071 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2072 return (s
->gsbase
.subcode
& GF_CALL_TAILCALL
) != 0;
2076 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2079 gimple_call_set_cannot_inline (gimple s
, bool inlinable_p
)
2081 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2083 s
->gsbase
.subcode
|= GF_CALL_CANNOT_INLINE
;
2085 s
->gsbase
.subcode
&= ~GF_CALL_CANNOT_INLINE
;
2089 /* Return true if GIMPLE_CALL S cannot be inlined. */
2092 gimple_call_cannot_inline_p (gimple s
)
2094 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2095 return (s
->gsbase
.subcode
& GF_CALL_CANNOT_INLINE
) != 0;
2099 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2100 slot optimization. This transformation uses the target of the call
2101 expansion as the return slot for calls that return in memory. */
2104 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2106 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2107 if (return_slot_opt_p
)
2108 s
->gsbase
.subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2110 s
->gsbase
.subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2114 /* Return true if S is marked for return slot optimization. */
2117 gimple_call_return_slot_opt_p (gimple s
)
2119 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2120 return (s
->gsbase
.subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2124 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2125 thunk to the thunked-to function. */
2128 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2130 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2132 s
->gsbase
.subcode
|= GF_CALL_FROM_THUNK
;
2134 s
->gsbase
.subcode
&= ~GF_CALL_FROM_THUNK
;
2138 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2141 gimple_call_from_thunk_p (gimple s
)
2143 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2144 return (s
->gsbase
.subcode
& GF_CALL_FROM_THUNK
) != 0;
2148 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2149 argument pack in its argument list. */
2152 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2154 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2155 if (pass_arg_pack_p
)
2156 s
->gsbase
.subcode
|= GF_CALL_VA_ARG_PACK
;
2158 s
->gsbase
.subcode
&= ~GF_CALL_VA_ARG_PACK
;
2162 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2163 argument pack in its argument list. */
2166 gimple_call_va_arg_pack_p (gimple s
)
2168 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2169 return (s
->gsbase
.subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2173 /* Return true if S is a noreturn call. */
2176 gimple_call_noreturn_p (gimple s
)
2178 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2179 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2183 /* Return true if S is a nothrow call. */
2186 gimple_call_nothrow_p (gimple s
)
2188 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2189 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2193 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2196 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2198 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2199 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2200 dest_call
->gsbase
.subcode
= orig_call
->gsbase
.subcode
;
2204 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2208 gimple_has_lhs (gimple stmt
)
2210 return (is_gimple_assign (stmt
)
2211 || (is_gimple_call (stmt
)
2212 && gimple_call_lhs (stmt
) != NULL_TREE
));
2216 /* Return the code of the predicate computed by conditional statement GS. */
2218 static inline enum tree_code
2219 gimple_cond_code (const_gimple gs
)
2221 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2222 return (enum tree_code
) gs
->gsbase
.subcode
;
2226 /* Set CODE to be the predicate code for the conditional statement GS. */
2229 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2231 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2232 gs
->gsbase
.subcode
= code
;
2236 /* Return the LHS of the predicate computed by conditional statement GS. */
2239 gimple_cond_lhs (const_gimple gs
)
2241 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2242 return gimple_op (gs
, 0);
2245 /* Return the pointer to the LHS of the predicate computed by conditional
2248 static inline tree
*
2249 gimple_cond_lhs_ptr (const_gimple gs
)
2251 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2252 return gimple_op_ptr (gs
, 0);
2255 /* Set LHS to be the LHS operand of the predicate computed by
2256 conditional statement GS. */
2259 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2261 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2262 gimple_set_op (gs
, 0, lhs
);
2266 /* Return the RHS operand of the predicate computed by conditional GS. */
2269 gimple_cond_rhs (const_gimple gs
)
2271 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2272 return gimple_op (gs
, 1);
2275 /* Return the pointer to the RHS operand of the predicate computed by
2278 static inline tree
*
2279 gimple_cond_rhs_ptr (const_gimple gs
)
2281 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2282 return gimple_op_ptr (gs
, 1);
2286 /* Set RHS to be the RHS operand of the predicate computed by
2287 conditional statement GS. */
2290 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2292 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2293 gimple_set_op (gs
, 1, rhs
);
2297 /* Return the label used by conditional statement GS when its
2298 predicate evaluates to true. */
2301 gimple_cond_true_label (const_gimple gs
)
2303 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2304 return gimple_op (gs
, 2);
2308 /* Set LABEL to be the label used by conditional statement GS when its
2309 predicate evaluates to true. */
2312 gimple_cond_set_true_label (gimple gs
, tree label
)
2314 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2315 gimple_set_op (gs
, 2, label
);
2319 /* Set LABEL to be the label used by conditional statement GS when its
2320 predicate evaluates to false. */
2323 gimple_cond_set_false_label (gimple gs
, tree label
)
2325 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2326 gimple_set_op (gs
, 3, label
);
2330 /* Return the label used by conditional statement GS when its
2331 predicate evaluates to false. */
2334 gimple_cond_false_label (const_gimple gs
)
2336 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2337 return gimple_op (gs
, 3);
2341 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2344 gimple_cond_make_false (gimple gs
)
2346 gimple_cond_set_lhs (gs
, boolean_true_node
);
2347 gimple_cond_set_rhs (gs
, boolean_false_node
);
2348 gs
->gsbase
.subcode
= EQ_EXPR
;
2352 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2355 gimple_cond_make_true (gimple gs
)
2357 gimple_cond_set_lhs (gs
, boolean_true_node
);
2358 gimple_cond_set_rhs (gs
, boolean_true_node
);
2359 gs
->gsbase
.subcode
= EQ_EXPR
;
2362 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2363 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2366 gimple_cond_true_p (const_gimple gs
)
2368 tree lhs
= gimple_cond_lhs (gs
);
2369 tree rhs
= gimple_cond_rhs (gs
);
2370 enum tree_code code
= gimple_cond_code (gs
);
2372 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2375 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2378 if (code
== NE_EXPR
&& lhs
!= rhs
)
2381 if (code
== EQ_EXPR
&& lhs
== rhs
)
2387 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2388 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2391 gimple_cond_false_p (const_gimple gs
)
2393 tree lhs
= gimple_cond_lhs (gs
);
2394 tree rhs
= gimple_cond_rhs (gs
);
2395 enum tree_code code
= gimple_cond_code (gs
);
2397 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
2400 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
2403 if (code
== NE_EXPR
&& lhs
== rhs
)
2406 if (code
== EQ_EXPR
&& lhs
!= rhs
)
2412 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2416 gimple_cond_single_var_p (gimple gs
)
2418 if (gimple_cond_code (gs
) == NE_EXPR
2419 && gimple_cond_rhs (gs
) == boolean_false_node
)
2422 if (gimple_cond_code (gs
) == EQ_EXPR
2423 && gimple_cond_rhs (gs
) == boolean_true_node
)
2429 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2432 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
2434 gimple_cond_set_code (stmt
, code
);
2435 gimple_cond_set_lhs (stmt
, lhs
);
2436 gimple_cond_set_rhs (stmt
, rhs
);
2439 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2442 gimple_label_label (const_gimple gs
)
2444 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2445 return gimple_op (gs
, 0);
2449 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2453 gimple_label_set_label (gimple gs
, tree label
)
2455 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
2456 gimple_set_op (gs
, 0, label
);
2460 /* Return the destination of the unconditional jump GS. */
2463 gimple_goto_dest (const_gimple gs
)
2465 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2466 return gimple_op (gs
, 0);
2470 /* Set DEST to be the destination of the unconditonal jump GS. */
2473 gimple_goto_set_dest (gimple gs
, tree dest
)
2475 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
2476 gimple_set_op (gs
, 0, dest
);
2480 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2483 gimple_bind_vars (const_gimple gs
)
2485 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2486 return gs
->gimple_bind
.vars
;
2490 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2494 gimple_bind_set_vars (gimple gs
, tree vars
)
2496 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2497 gs
->gimple_bind
.vars
= vars
;
2501 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2505 gimple_bind_append_vars (gimple gs
, tree vars
)
2507 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2508 gs
->gimple_bind
.vars
= chainon (gs
->gimple_bind
.vars
, vars
);
2512 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2514 static inline gimple_seq
2515 gimple_bind_body (gimple gs
)
2517 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2518 return gs
->gimple_bind
.body
;
2522 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2526 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
2528 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2529 gs
->gimple_bind
.body
= seq
;
2533 /* Append a statement to the end of a GIMPLE_BIND's body. */
2536 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
2538 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2539 gimple_seq_add_stmt (&gs
->gimple_bind
.body
, stmt
);
2543 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2546 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
2548 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2549 gimple_seq_add_seq (&gs
->gimple_bind
.body
, seq
);
2553 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2554 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2557 gimple_bind_block (const_gimple gs
)
2559 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2560 return gs
->gimple_bind
.block
;
2564 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2568 gimple_bind_set_block (gimple gs
, tree block
)
2570 GIMPLE_CHECK (gs
, GIMPLE_BIND
);
2571 gcc_assert (block
== NULL_TREE
|| TREE_CODE (block
) == BLOCK
);
2572 gs
->gimple_bind
.block
= block
;
2576 /* Return the number of input operands for GIMPLE_ASM GS. */
2578 static inline unsigned
2579 gimple_asm_ninputs (const_gimple gs
)
2581 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2582 return gs
->gimple_asm
.ni
;
2586 /* Return the number of output operands for GIMPLE_ASM GS. */
2588 static inline unsigned
2589 gimple_asm_noutputs (const_gimple gs
)
2591 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2592 return gs
->gimple_asm
.no
;
2596 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2598 static inline unsigned
2599 gimple_asm_nclobbers (const_gimple gs
)
2601 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2602 return gs
->gimple_asm
.nc
;
2605 /* Return the number of label operands for GIMPLE_ASM GS. */
2607 static inline unsigned
2608 gimple_asm_nlabels (const_gimple gs
)
2610 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2611 return gs
->gimple_asm
.nl
;
2614 /* Return input operand INDEX of GIMPLE_ASM GS. */
2617 gimple_asm_input_op (const_gimple gs
, unsigned index
)
2619 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2620 gcc_assert (index
<= gs
->gimple_asm
.ni
);
2621 return gimple_op (gs
, index
);
2624 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2626 static inline tree
*
2627 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
2629 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2630 gcc_assert (index
<= gs
->gimple_asm
.ni
);
2631 return gimple_op_ptr (gs
, index
);
2635 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2638 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
2640 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2641 gcc_assert (index
<= gs
->gimple_asm
.ni
);
2642 gcc_assert (TREE_CODE (in_op
) == TREE_LIST
);
2643 gimple_set_op (gs
, index
, in_op
);
2647 /* Return output operand INDEX of GIMPLE_ASM GS. */
2650 gimple_asm_output_op (const_gimple gs
, unsigned index
)
2652 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2653 gcc_assert (index
<= gs
->gimple_asm
.no
);
2654 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
);
2657 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2659 static inline tree
*
2660 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
2662 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2663 gcc_assert (index
<= gs
->gimple_asm
.no
);
2664 return gimple_op_ptr (gs
, index
+ gs
->gimple_asm
.ni
);
2668 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2671 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
2673 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2674 gcc_assert (index
<= gs
->gimple_asm
.no
);
2675 gcc_assert (TREE_CODE (out_op
) == TREE_LIST
);
2676 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
, out_op
);
2680 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2683 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
2685 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2686 gcc_assert (index
<= gs
->gimple_asm
.nc
);
2687 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
);
2691 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2694 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
2696 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2697 gcc_assert (index
<= gs
->gimple_asm
.nc
);
2698 gcc_assert (TREE_CODE (clobber_op
) == TREE_LIST
);
2699 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.no
, clobber_op
);
2702 /* Return label operand INDEX of GIMPLE_ASM GS. */
2705 gimple_asm_label_op (const_gimple gs
, unsigned index
)
2707 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2708 gcc_assert (index
<= gs
->gimple_asm
.nl
);
2709 return gimple_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
);
2712 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
2715 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
2717 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2718 gcc_assert (index
<= gs
->gimple_asm
.nl
);
2719 gcc_assert (TREE_CODE (label_op
) == TREE_LIST
);
2720 gimple_set_op (gs
, index
+ gs
->gimple_asm
.ni
+ gs
->gimple_asm
.nc
, label_op
);
2723 /* Return the string representing the assembly instruction in
2726 static inline const char *
2727 gimple_asm_string (const_gimple gs
)
2729 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2730 return gs
->gimple_asm
.string
;
2734 /* Return true if GS is an asm statement marked volatile. */
2737 gimple_asm_volatile_p (const_gimple gs
)
2739 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2740 return (gs
->gsbase
.subcode
& GF_ASM_VOLATILE
) != 0;
2744 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2747 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
2749 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2751 gs
->gsbase
.subcode
|= GF_ASM_VOLATILE
;
2753 gs
->gsbase
.subcode
&= ~GF_ASM_VOLATILE
;
2757 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2760 gimple_asm_set_input (gimple gs
, bool input_p
)
2762 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2764 gs
->gsbase
.subcode
|= GF_ASM_INPUT
;
2766 gs
->gsbase
.subcode
&= ~GF_ASM_INPUT
;
2770 /* Return true if asm GS is an ASM_INPUT. */
2773 gimple_asm_input_p (const_gimple gs
)
2775 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
2776 return (gs
->gsbase
.subcode
& GF_ASM_INPUT
) != 0;
2780 /* Return the types handled by GIMPLE_CATCH statement GS. */
2783 gimple_catch_types (const_gimple gs
)
2785 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2786 return gs
->gimple_catch
.types
;
2790 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2792 static inline tree
*
2793 gimple_catch_types_ptr (gimple gs
)
2795 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2796 return &gs
->gimple_catch
.types
;
2800 /* Return the GIMPLE sequence representing the body of the handler of
2801 GIMPLE_CATCH statement GS. */
2803 static inline gimple_seq
2804 gimple_catch_handler (gimple gs
)
2806 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2807 return gs
->gimple_catch
.handler
;
2811 /* Return a pointer to the GIMPLE sequence representing the body of
2812 the handler of GIMPLE_CATCH statement GS. */
2814 static inline gimple_seq
*
2815 gimple_catch_handler_ptr (gimple gs
)
2817 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2818 return &gs
->gimple_catch
.handler
;
2822 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2825 gimple_catch_set_types (gimple gs
, tree t
)
2827 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2828 gs
->gimple_catch
.types
= t
;
2832 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2835 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
2837 GIMPLE_CHECK (gs
, GIMPLE_CATCH
);
2838 gs
->gimple_catch
.handler
= handler
;
2842 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2845 gimple_eh_filter_types (const_gimple gs
)
2847 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
2848 return gs
->gimple_eh_filter
.types
;
2852 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2855 static inline tree
*
2856 gimple_eh_filter_types_ptr (gimple gs
)
2858 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
2859 return &gs
->gimple_eh_filter
.types
;
2863 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2866 static inline gimple_seq
2867 gimple_eh_filter_failure (gimple gs
)
2869 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
2870 return gs
->gimple_eh_filter
.failure
;
2874 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2877 gimple_eh_filter_set_types (gimple gs
, tree types
)
2879 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
2880 gs
->gimple_eh_filter
.types
= types
;
2884 /* Set FAILURE to be the sequence of statements to execute on failure
2885 for GIMPLE_EH_FILTER GS. */
2888 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
2890 GIMPLE_CHECK (gs
, GIMPLE_EH_FILTER
);
2891 gs
->gimple_eh_filter
.failure
= failure
;
2894 /* Get the function decl to be called by the MUST_NOT_THROW region. */
2897 gimple_eh_must_not_throw_fndecl (gimple gs
)
2899 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
2900 return gs
->gimple_eh_mnt
.fndecl
;
2903 /* Set the function decl to be called by GS to DECL. */
2906 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
2908 GIMPLE_CHECK (gs
, GIMPLE_EH_MUST_NOT_THROW
);
2909 gs
->gimple_eh_mnt
.fndecl
= decl
;
2913 /* GIMPLE_TRY accessors. */
2915 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2916 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2918 static inline enum gimple_try_flags
2919 gimple_try_kind (const_gimple gs
)
2921 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
2922 return (enum gimple_try_flags
) (gs
->gsbase
.subcode
& GIMPLE_TRY_KIND
);
2926 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2929 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
2931 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
2932 gcc_assert (kind
== GIMPLE_TRY_CATCH
|| kind
== GIMPLE_TRY_FINALLY
);
2933 if (gimple_try_kind (gs
) != kind
)
2934 gs
->gsbase
.subcode
= (unsigned int) kind
;
2938 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2941 gimple_try_catch_is_cleanup (const_gimple gs
)
2943 gcc_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
2944 return (gs
->gsbase
.subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
2948 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2950 static inline gimple_seq
2951 gimple_try_eval (gimple gs
)
2953 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
2954 return gs
->gimple_try
.eval
;
2958 /* Return the sequence of statements used as the cleanup body for
2961 static inline gimple_seq
2962 gimple_try_cleanup (gimple gs
)
2964 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
2965 return gs
->gimple_try
.cleanup
;
2969 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2972 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
2974 gcc_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
2975 if (catch_is_cleanup
)
2976 g
->gsbase
.subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
2978 g
->gsbase
.subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
2982 /* Set EVAL to be the sequence of statements to use as the body for
2986 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
2988 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
2989 gs
->gimple_try
.eval
= eval
;
2993 /* Set CLEANUP to be the sequence of statements to use as the cleanup
2994 body for GIMPLE_TRY GS. */
2997 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
2999 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3000 gs
->gimple_try
.cleanup
= cleanup
;
3004 /* Return the cleanup sequence for cleanup statement GS. */
3006 static inline gimple_seq
3007 gimple_wce_cleanup (gimple gs
)
3009 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3010 return gs
->gimple_wce
.cleanup
;
3014 /* Set CLEANUP to be the cleanup sequence for GS. */
3017 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3019 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3020 gs
->gimple_wce
.cleanup
= cleanup
;
3024 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3027 gimple_wce_cleanup_eh_only (const_gimple gs
)
3029 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3030 return gs
->gsbase
.subcode
!= 0;
3034 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3037 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3039 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3040 gs
->gsbase
.subcode
= (unsigned int) eh_only_p
;
3044 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3046 static inline unsigned
3047 gimple_phi_capacity (const_gimple gs
)
3049 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3050 return gs
->gimple_phi
.capacity
;
3054 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3055 be exactly the number of incoming edges for the basic block holding
3058 static inline unsigned
3059 gimple_phi_num_args (const_gimple gs
)
3061 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3062 return gs
->gimple_phi
.nargs
;
3066 /* Return the SSA name created by GIMPLE_PHI GS. */
3069 gimple_phi_result (const_gimple gs
)
3071 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3072 return gs
->gimple_phi
.result
;
3075 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3077 static inline tree
*
3078 gimple_phi_result_ptr (gimple gs
)
3080 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3081 return &gs
->gimple_phi
.result
;
3084 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3087 gimple_phi_set_result (gimple gs
, tree result
)
3089 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3090 gs
->gimple_phi
.result
= result
;
3094 /* Return the PHI argument corresponding to incoming edge INDEX for
3097 static inline struct phi_arg_d
*
3098 gimple_phi_arg (gimple gs
, unsigned index
)
3100 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3101 gcc_assert (index
<= gs
->gimple_phi
.capacity
);
3102 return &(gs
->gimple_phi
.args
[index
]);
3105 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3106 for GIMPLE_PHI GS. */
3109 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3111 GIMPLE_CHECK (gs
, GIMPLE_PHI
);
3112 gcc_assert (index
<= gs
->gimple_phi
.nargs
);
3113 memcpy (gs
->gimple_phi
.args
+ index
, phiarg
, sizeof (struct phi_arg_d
));
3116 /* Return the region number for GIMPLE_RESX GS. */
3119 gimple_resx_region (const_gimple gs
)
3121 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3122 return gs
->gimple_eh_ctrl
.region
;
3125 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3128 gimple_resx_set_region (gimple gs
, int region
)
3130 GIMPLE_CHECK (gs
, GIMPLE_RESX
);
3131 gs
->gimple_eh_ctrl
.region
= region
;
3134 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3137 gimple_eh_dispatch_region (const_gimple gs
)
3139 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3140 return gs
->gimple_eh_ctrl
.region
;
3143 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3146 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3148 GIMPLE_CHECK (gs
, GIMPLE_EH_DISPATCH
);
3149 gs
->gimple_eh_ctrl
.region
= region
;
3152 /* Return the number of labels associated with the switch statement GS. */
3154 static inline unsigned
3155 gimple_switch_num_labels (const_gimple gs
)
3158 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3159 num_ops
= gimple_num_ops (gs
);
3160 gcc_assert (num_ops
> 1);
3165 /* Set NLABELS to be the number of labels for the switch statement GS. */
3168 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
3170 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
3171 gimple_set_num_ops (g
, nlabels
+ 1);
3175 /* Return the index variable used by the switch statement GS. */
3178 gimple_switch_index (const_gimple gs
)
3180 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3181 return gimple_op (gs
, 0);
3185 /* Return a pointer to the index variable for the switch statement GS. */
3187 static inline tree
*
3188 gimple_switch_index_ptr (const_gimple gs
)
3190 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3191 return gimple_op_ptr (gs
, 0);
3195 /* Set INDEX to be the index variable for switch statement GS. */
3198 gimple_switch_set_index (gimple gs
, tree index
)
3200 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3201 gcc_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
3202 gimple_set_op (gs
, 0, index
);
3206 /* Return the label numbered INDEX. The default label is 0, followed by any
3207 labels in a switch statement. */
3210 gimple_switch_label (const_gimple gs
, unsigned index
)
3212 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3213 gcc_assert (gimple_num_ops (gs
) > index
+ 1);
3214 return gimple_op (gs
, index
+ 1);
3217 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3220 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
3222 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
3223 gcc_assert (gimple_num_ops (gs
) > index
+ 1);
3224 gcc_assert (label
== NULL_TREE
|| TREE_CODE (label
) == CASE_LABEL_EXPR
);
3225 gimple_set_op (gs
, index
+ 1, label
);
3228 /* Return the default label for a switch statement. */
3231 gimple_switch_default_label (const_gimple gs
)
3233 return gimple_switch_label (gs
, 0);
3236 /* Set the default label for a switch statement. */
3239 gimple_switch_set_default_label (gimple gs
, tree label
)
3241 gimple_switch_set_label (gs
, 0, label
);
3244 /* Return true if GS is a GIMPLE_DEBUG statement. */
3247 is_gimple_debug (const_gimple gs
)
3249 return gimple_code (gs
) == GIMPLE_DEBUG
;
3252 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
3255 gimple_debug_bind_p (const_gimple s
)
3257 if (is_gimple_debug (s
))
3258 return s
->gsbase
.subcode
== GIMPLE_DEBUG_BIND
;
3263 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
3266 gimple_debug_bind_get_var (gimple dbg
)
3268 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3269 #ifdef ENABLE_CHECKING
3270 gcc_assert (gimple_debug_bind_p (dbg
));
3272 return gimple_op (dbg
, 0);
3275 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
3279 gimple_debug_bind_get_value (gimple dbg
)
3281 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3282 #ifdef ENABLE_CHECKING
3283 gcc_assert (gimple_debug_bind_p (dbg
));
3285 return gimple_op (dbg
, 1);
3288 /* Return a pointer to the value bound to the variable in a
3289 GIMPLE_DEBUG bind statement. */
3291 static inline tree
*
3292 gimple_debug_bind_get_value_ptr (gimple dbg
)
3294 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3295 #ifdef ENABLE_CHECKING
3296 gcc_assert (gimple_debug_bind_p (dbg
));
3298 return gimple_op_ptr (dbg
, 1);
3301 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
3304 gimple_debug_bind_set_var (gimple dbg
, tree var
)
3306 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3307 #ifdef ENABLE_CHECKING
3308 gcc_assert (gimple_debug_bind_p (dbg
));
3310 gimple_set_op (dbg
, 0, var
);
3313 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
3317 gimple_debug_bind_set_value (gimple dbg
, tree value
)
3319 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3320 #ifdef ENABLE_CHECKING
3321 gcc_assert (gimple_debug_bind_p (dbg
));
3323 gimple_set_op (dbg
, 1, value
);
3326 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
3328 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
3330 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
3334 gimple_debug_bind_reset_value (gimple dbg
)
3336 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3337 #ifdef ENABLE_CHECKING
3338 gcc_assert (gimple_debug_bind_p (dbg
));
3340 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
3343 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
3347 gimple_debug_bind_has_value_p (gimple dbg
)
3349 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
3350 #ifdef ENABLE_CHECKING
3351 gcc_assert (gimple_debug_bind_p (dbg
));
3353 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
3356 #undef GIMPLE_DEBUG_BIND_NOVALUE
3358 /* Return the body for the OMP statement GS. */
3360 static inline gimple_seq
3361 gimple_omp_body (gimple gs
)
3363 return gs
->omp
.body
;
3366 /* Set BODY to be the body for the OMP statement GS. */
3369 gimple_omp_set_body (gimple gs
, gimple_seq body
)
3371 gs
->omp
.body
= body
;
3375 /* Return the name associated with OMP_CRITICAL statement GS. */
3378 gimple_omp_critical_name (const_gimple gs
)
3380 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3381 return gs
->gimple_omp_critical
.name
;
3385 /* Return a pointer to the name associated with OMP critical statement GS. */
3387 static inline tree
*
3388 gimple_omp_critical_name_ptr (gimple gs
)
3390 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3391 return &gs
->gimple_omp_critical
.name
;
3395 /* Set NAME to be the name associated with OMP critical statement GS. */
3398 gimple_omp_critical_set_name (gimple gs
, tree name
)
3400 GIMPLE_CHECK (gs
, GIMPLE_OMP_CRITICAL
);
3401 gs
->gimple_omp_critical
.name
= name
;
3405 /* Return the clauses associated with OMP_FOR GS. */
3408 gimple_omp_for_clauses (const_gimple gs
)
3410 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3411 return gs
->gimple_omp_for
.clauses
;
3415 /* Return a pointer to the OMP_FOR GS. */
3417 static inline tree
*
3418 gimple_omp_for_clauses_ptr (gimple gs
)
3420 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3421 return &gs
->gimple_omp_for
.clauses
;
3425 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3428 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
3430 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3431 gs
->gimple_omp_for
.clauses
= clauses
;
3435 /* Get the collapse count of OMP_FOR GS. */
3437 static inline size_t
3438 gimple_omp_for_collapse (gimple gs
)
3440 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3441 return gs
->gimple_omp_for
.collapse
;
3445 /* Return the index variable for OMP_FOR GS. */
3448 gimple_omp_for_index (const_gimple gs
, size_t i
)
3450 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3451 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3452 return gs
->gimple_omp_for
.iter
[i
].index
;
3456 /* Return a pointer to the index variable for OMP_FOR GS. */
3458 static inline tree
*
3459 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
3461 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3462 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3463 return &gs
->gimple_omp_for
.iter
[i
].index
;
3467 /* Set INDEX to be the index variable for OMP_FOR GS. */
3470 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
3472 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3473 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3474 gs
->gimple_omp_for
.iter
[i
].index
= index
;
3478 /* Return the initial value for OMP_FOR GS. */
3481 gimple_omp_for_initial (const_gimple gs
, size_t i
)
3483 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3484 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3485 return gs
->gimple_omp_for
.iter
[i
].initial
;
3489 /* Return a pointer to the initial value for OMP_FOR GS. */
3491 static inline tree
*
3492 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
3494 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3495 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3496 return &gs
->gimple_omp_for
.iter
[i
].initial
;
3500 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3503 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
3505 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3506 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3507 gs
->gimple_omp_for
.iter
[i
].initial
= initial
;
3511 /* Return the final value for OMP_FOR GS. */
3514 gimple_omp_for_final (const_gimple gs
, size_t i
)
3516 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3517 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3518 return gs
->gimple_omp_for
.iter
[i
].final
;
3522 /* Return a pointer to the final value for OMP_FOR GS. */
3524 static inline tree
*
3525 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
3527 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3528 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3529 return &gs
->gimple_omp_for
.iter
[i
].final
;
3533 /* Set FINAL to be the final value for OMP_FOR GS. */
3536 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
3538 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3539 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3540 gs
->gimple_omp_for
.iter
[i
].final
= final
;
3544 /* Return the increment value for OMP_FOR GS. */
3547 gimple_omp_for_incr (const_gimple gs
, size_t i
)
3549 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3550 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3551 return gs
->gimple_omp_for
.iter
[i
].incr
;
3555 /* Return a pointer to the increment value for OMP_FOR GS. */
3557 static inline tree
*
3558 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
3560 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3561 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3562 return &gs
->gimple_omp_for
.iter
[i
].incr
;
3566 /* Set INCR to be the increment value for OMP_FOR GS. */
3569 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
3571 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3572 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
3573 gs
->gimple_omp_for
.iter
[i
].incr
= incr
;
3577 /* Return the sequence of statements to execute before the OMP_FOR
3578 statement GS starts. */
3580 static inline gimple_seq
3581 gimple_omp_for_pre_body (gimple gs
)
3583 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3584 return gs
->gimple_omp_for
.pre_body
;
3588 /* Set PRE_BODY to be the sequence of statements to execute before the
3589 OMP_FOR statement GS starts. */
3592 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
3594 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
3595 gs
->gimple_omp_for
.pre_body
= pre_body
;
3599 /* Return the clauses associated with OMP_PARALLEL GS. */
3602 gimple_omp_parallel_clauses (const_gimple gs
)
3604 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3605 return gs
->gimple_omp_parallel
.clauses
;
3609 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3611 static inline tree
*
3612 gimple_omp_parallel_clauses_ptr (gimple gs
)
3614 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3615 return &gs
->gimple_omp_parallel
.clauses
;
3619 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3623 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
3625 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3626 gs
->gimple_omp_parallel
.clauses
= clauses
;
3630 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3633 gimple_omp_parallel_child_fn (const_gimple gs
)
3635 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3636 return gs
->gimple_omp_parallel
.child_fn
;
3639 /* Return a pointer to the child function used to hold the body of
3642 static inline tree
*
3643 gimple_omp_parallel_child_fn_ptr (gimple gs
)
3645 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3646 return &gs
->gimple_omp_parallel
.child_fn
;
3650 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3653 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
3655 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3656 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
3660 /* Return the artificial argument used to send variables and values
3661 from the parent to the children threads in OMP_PARALLEL GS. */
3664 gimple_omp_parallel_data_arg (const_gimple gs
)
3666 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3667 return gs
->gimple_omp_parallel
.data_arg
;
3671 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3673 static inline tree
*
3674 gimple_omp_parallel_data_arg_ptr (gimple gs
)
3676 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3677 return &gs
->gimple_omp_parallel
.data_arg
;
3681 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3684 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
3686 GIMPLE_CHECK (gs
, GIMPLE_OMP_PARALLEL
);
3687 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
3691 /* Return the clauses associated with OMP_TASK GS. */
3694 gimple_omp_task_clauses (const_gimple gs
)
3696 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3697 return gs
->gimple_omp_parallel
.clauses
;
3701 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3703 static inline tree
*
3704 gimple_omp_task_clauses_ptr (gimple gs
)
3706 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3707 return &gs
->gimple_omp_parallel
.clauses
;
3711 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3715 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
3717 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3718 gs
->gimple_omp_parallel
.clauses
= clauses
;
3722 /* Return the child function used to hold the body of OMP_TASK GS. */
3725 gimple_omp_task_child_fn (const_gimple gs
)
3727 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3728 return gs
->gimple_omp_parallel
.child_fn
;
3731 /* Return a pointer to the child function used to hold the body of
3734 static inline tree
*
3735 gimple_omp_task_child_fn_ptr (gimple gs
)
3737 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3738 return &gs
->gimple_omp_parallel
.child_fn
;
3742 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3745 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
3747 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3748 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
3752 /* Return the artificial argument used to send variables and values
3753 from the parent to the children threads in OMP_TASK GS. */
3756 gimple_omp_task_data_arg (const_gimple gs
)
3758 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3759 return gs
->gimple_omp_parallel
.data_arg
;
3763 /* Return a pointer to the data argument for OMP_TASK GS. */
3765 static inline tree
*
3766 gimple_omp_task_data_arg_ptr (gimple gs
)
3768 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3769 return &gs
->gimple_omp_parallel
.data_arg
;
3773 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3776 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
3778 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3779 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
3783 /* Return the clauses associated with OMP_TASK GS. */
3786 gimple_omp_taskreg_clauses (const_gimple gs
)
3788 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3789 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3790 return gs
->gimple_omp_parallel
.clauses
;
3794 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3796 static inline tree
*
3797 gimple_omp_taskreg_clauses_ptr (gimple gs
)
3799 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3800 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3801 return &gs
->gimple_omp_parallel
.clauses
;
3805 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3809 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
3811 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3812 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3813 gs
->gimple_omp_parallel
.clauses
= clauses
;
3817 /* Return the child function used to hold the body of OMP_TASK GS. */
3820 gimple_omp_taskreg_child_fn (const_gimple gs
)
3822 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3823 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3824 return gs
->gimple_omp_parallel
.child_fn
;
3827 /* Return a pointer to the child function used to hold the body of
3830 static inline tree
*
3831 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
3833 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3834 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3835 return &gs
->gimple_omp_parallel
.child_fn
;
3839 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3842 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
3844 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3845 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3846 gs
->gimple_omp_parallel
.child_fn
= child_fn
;
3850 /* Return the artificial argument used to send variables and values
3851 from the parent to the children threads in OMP_TASK GS. */
3854 gimple_omp_taskreg_data_arg (const_gimple gs
)
3856 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3857 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3858 return gs
->gimple_omp_parallel
.data_arg
;
3862 /* Return a pointer to the data argument for OMP_TASK GS. */
3864 static inline tree
*
3865 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
3867 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3868 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3869 return &gs
->gimple_omp_parallel
.data_arg
;
3873 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3876 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
3878 if (gimple_code (gs
) != GIMPLE_OMP_PARALLEL
)
3879 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3880 gs
->gimple_omp_parallel
.data_arg
= data_arg
;
3884 /* Return the copy function used to hold the body of OMP_TASK GS. */
3887 gimple_omp_task_copy_fn (const_gimple gs
)
3889 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3890 return gs
->gimple_omp_task
.copy_fn
;
3893 /* Return a pointer to the copy function used to hold the body of
3896 static inline tree
*
3897 gimple_omp_task_copy_fn_ptr (gimple gs
)
3899 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3900 return &gs
->gimple_omp_task
.copy_fn
;
3904 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3907 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
3909 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3910 gs
->gimple_omp_task
.copy_fn
= copy_fn
;
3914 /* Return size of the data block in bytes in OMP_TASK GS. */
3917 gimple_omp_task_arg_size (const_gimple gs
)
3919 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3920 return gs
->gimple_omp_task
.arg_size
;
3924 /* Return a pointer to the data block size for OMP_TASK GS. */
3926 static inline tree
*
3927 gimple_omp_task_arg_size_ptr (gimple gs
)
3929 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3930 return &gs
->gimple_omp_task
.arg_size
;
3934 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3937 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
3939 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3940 gs
->gimple_omp_task
.arg_size
= arg_size
;
3944 /* Return align of the data block in bytes in OMP_TASK GS. */
3947 gimple_omp_task_arg_align (const_gimple gs
)
3949 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3950 return gs
->gimple_omp_task
.arg_align
;
3954 /* Return a pointer to the data block align for OMP_TASK GS. */
3956 static inline tree
*
3957 gimple_omp_task_arg_align_ptr (gimple gs
)
3959 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3960 return &gs
->gimple_omp_task
.arg_align
;
3964 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
3967 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
3969 GIMPLE_CHECK (gs
, GIMPLE_OMP_TASK
);
3970 gs
->gimple_omp_task
.arg_align
= arg_align
;
3974 /* Return the clauses associated with OMP_SINGLE GS. */
3977 gimple_omp_single_clauses (const_gimple gs
)
3979 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
3980 return gs
->gimple_omp_single
.clauses
;
3984 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
3986 static inline tree
*
3987 gimple_omp_single_clauses_ptr (gimple gs
)
3989 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
3990 return &gs
->gimple_omp_single
.clauses
;
3994 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
3997 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
3999 GIMPLE_CHECK (gs
, GIMPLE_OMP_SINGLE
);
4000 gs
->gimple_omp_single
.clauses
= clauses
;
4004 /* Return the clauses associated with OMP_SECTIONS GS. */
4007 gimple_omp_sections_clauses (const_gimple gs
)
4009 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4010 return gs
->gimple_omp_sections
.clauses
;
4014 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
4016 static inline tree
*
4017 gimple_omp_sections_clauses_ptr (gimple gs
)
4019 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4020 return &gs
->gimple_omp_sections
.clauses
;
4024 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
4028 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
4030 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4031 gs
->gimple_omp_sections
.clauses
= clauses
;
4035 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
4039 gimple_omp_sections_control (const_gimple gs
)
4041 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4042 return gs
->gimple_omp_sections
.control
;
4046 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
4049 static inline tree
*
4050 gimple_omp_sections_control_ptr (gimple gs
)
4052 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4053 return &gs
->gimple_omp_sections
.control
;
4057 /* Set CONTROL to be the set of clauses associated with the
4058 GIMPLE_OMP_SECTIONS in GS. */
4061 gimple_omp_sections_set_control (gimple gs
, tree control
)
4063 GIMPLE_CHECK (gs
, GIMPLE_OMP_SECTIONS
);
4064 gs
->gimple_omp_sections
.control
= control
;
4068 /* Set COND to be the condition code for OMP_FOR GS. */
4071 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4073 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4074 gcc_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
);
4075 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
4076 gs
->gimple_omp_for
.iter
[i
].cond
= cond
;
4080 /* Return the condition code associated with OMP_FOR GS. */
4082 static inline enum tree_code
4083 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4085 GIMPLE_CHECK (gs
, GIMPLE_OMP_FOR
);
4086 gcc_assert (i
< gs
->gimple_omp_for
.collapse
);
4087 return gs
->gimple_omp_for
.iter
[i
].cond
;
4091 /* Set the value being stored in an atomic store. */
4094 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
4096 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4097 g
->gimple_omp_atomic_store
.val
= val
;
4101 /* Return the value being stored in an atomic store. */
4104 gimple_omp_atomic_store_val (const_gimple g
)
4106 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4107 return g
->gimple_omp_atomic_store
.val
;
4111 /* Return a pointer to the value being stored in an atomic store. */
4113 static inline tree
*
4114 gimple_omp_atomic_store_val_ptr (gimple g
)
4116 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
4117 return &g
->gimple_omp_atomic_store
.val
;
4121 /* Set the LHS of an atomic load. */
4124 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
4126 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4127 g
->gimple_omp_atomic_load
.lhs
= lhs
;
4131 /* Get the LHS of an atomic load. */
4134 gimple_omp_atomic_load_lhs (const_gimple g
)
4136 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4137 return g
->gimple_omp_atomic_load
.lhs
;
4141 /* Return a pointer to the LHS of an atomic load. */
4143 static inline tree
*
4144 gimple_omp_atomic_load_lhs_ptr (gimple g
)
4146 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4147 return &g
->gimple_omp_atomic_load
.lhs
;
4151 /* Set the RHS of an atomic load. */
4154 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
4156 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4157 g
->gimple_omp_atomic_load
.rhs
= rhs
;
4161 /* Get the RHS of an atomic load. */
4164 gimple_omp_atomic_load_rhs (const_gimple g
)
4166 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4167 return g
->gimple_omp_atomic_load
.rhs
;
4171 /* Return a pointer to the RHS of an atomic load. */
4173 static inline tree
*
4174 gimple_omp_atomic_load_rhs_ptr (gimple g
)
4176 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_LOAD
);
4177 return &g
->gimple_omp_atomic_load
.rhs
;
4181 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4184 gimple_omp_continue_control_def (const_gimple g
)
4186 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4187 return g
->gimple_omp_continue
.control_def
;
4190 /* The same as above, but return the address. */
4192 static inline tree
*
4193 gimple_omp_continue_control_def_ptr (gimple g
)
4195 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4196 return &g
->gimple_omp_continue
.control_def
;
4199 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4202 gimple_omp_continue_set_control_def (gimple g
, tree def
)
4204 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4205 g
->gimple_omp_continue
.control_def
= def
;
4209 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4212 gimple_omp_continue_control_use (const_gimple g
)
4214 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4215 return g
->gimple_omp_continue
.control_use
;
4219 /* The same as above, but return the address. */
4221 static inline tree
*
4222 gimple_omp_continue_control_use_ptr (gimple g
)
4224 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4225 return &g
->gimple_omp_continue
.control_use
;
4229 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4232 gimple_omp_continue_set_control_use (gimple g
, tree use
)
4234 GIMPLE_CHECK (g
, GIMPLE_OMP_CONTINUE
);
4235 g
->gimple_omp_continue
.control_use
= use
;
4239 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4241 static inline tree
*
4242 gimple_return_retval_ptr (const_gimple gs
)
4244 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4245 return gimple_op_ptr (gs
, 0);
4248 /* Return the return value for GIMPLE_RETURN GS. */
4251 gimple_return_retval (const_gimple gs
)
4253 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4254 return gimple_op (gs
, 0);
4258 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4261 gimple_return_set_retval (gimple gs
, tree retval
)
4263 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
4264 gimple_set_op (gs
, 0, retval
);
4268 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4270 #define CASE_GIMPLE_OMP \
4271 case GIMPLE_OMP_PARALLEL: \
4272 case GIMPLE_OMP_TASK: \
4273 case GIMPLE_OMP_FOR: \
4274 case GIMPLE_OMP_SECTIONS: \
4275 case GIMPLE_OMP_SECTIONS_SWITCH: \
4276 case GIMPLE_OMP_SINGLE: \
4277 case GIMPLE_OMP_SECTION: \
4278 case GIMPLE_OMP_MASTER: \
4279 case GIMPLE_OMP_ORDERED: \
4280 case GIMPLE_OMP_CRITICAL: \
4281 case GIMPLE_OMP_RETURN: \
4282 case GIMPLE_OMP_ATOMIC_LOAD: \
4283 case GIMPLE_OMP_ATOMIC_STORE: \
4284 case GIMPLE_OMP_CONTINUE
4287 is_gimple_omp (const_gimple stmt
)
4289 switch (gimple_code (stmt
))
4299 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4302 gimple_nop_p (const_gimple g
)
4304 return gimple_code (g
) == GIMPLE_NOP
;
4308 /* Return true if GS is a GIMPLE_RESX. */
4311 is_gimple_resx (const_gimple gs
)
4313 return gimple_code (gs
) == GIMPLE_RESX
;
4316 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4318 static inline enum br_predictor
4319 gimple_predict_predictor (gimple gs
)
4321 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4322 return (enum br_predictor
) (gs
->gsbase
.subcode
& ~GF_PREDICT_TAKEN
);
4326 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4329 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
4331 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4332 gs
->gsbase
.subcode
= (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
)
4333 | (unsigned) predictor
;
4337 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4339 static inline enum prediction
4340 gimple_predict_outcome (gimple gs
)
4342 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4343 return (gs
->gsbase
.subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
4347 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4350 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
4352 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
4353 if (outcome
== TAKEN
)
4354 gs
->gsbase
.subcode
|= GF_PREDICT_TAKEN
;
4356 gs
->gsbase
.subcode
&= ~GF_PREDICT_TAKEN
;
4360 /* Return the type of the main expression computed by STMT. Return
4361 void_type_node if the statement computes nothing. */
4364 gimple_expr_type (const_gimple stmt
)
4366 enum gimple_code code
= gimple_code (stmt
);
4368 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
4371 /* In general we want to pass out a type that can be substituted
4372 for both the RHS and the LHS types if there is a possibly
4373 useless conversion involved. That means returning the
4374 original RHS type as far as we can reconstruct it. */
4375 if (code
== GIMPLE_CALL
)
4376 type
= gimple_call_return_type (stmt
);
4378 switch (gimple_assign_rhs_code (stmt
))
4380 case POINTER_PLUS_EXPR
:
4381 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
4385 /* As fallback use the type of the LHS. */
4386 type
= TREE_TYPE (gimple_get_lhs (stmt
));
4391 else if (code
== GIMPLE_COND
)
4392 return boolean_type_node
;
4394 return void_type_node
;
4398 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4400 static inline gimple_stmt_iterator
4401 gsi_start (gimple_seq seq
)
4403 gimple_stmt_iterator i
;
4405 i
.ptr
= gimple_seq_first (seq
);
4407 i
.bb
= (i
.ptr
&& i
.ptr
->stmt
) ? gimple_bb (i
.ptr
->stmt
) : NULL
;
4413 /* Return a new iterator pointing to the first statement in basic block BB. */
4415 static inline gimple_stmt_iterator
4416 gsi_start_bb (basic_block bb
)
4418 gimple_stmt_iterator i
;
4422 i
.ptr
= gimple_seq_first (seq
);
4430 /* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
4432 static inline gimple_stmt_iterator
4433 gsi_last (gimple_seq seq
)
4435 gimple_stmt_iterator i
;
4437 i
.ptr
= gimple_seq_last (seq
);
4439 i
.bb
= (i
.ptr
&& i
.ptr
->stmt
) ? gimple_bb (i
.ptr
->stmt
) : NULL
;
4445 /* Return a new iterator pointing to the last statement in basic block BB. */
4447 static inline gimple_stmt_iterator
4448 gsi_last_bb (basic_block bb
)
4450 gimple_stmt_iterator i
;
4454 i
.ptr
= gimple_seq_last (seq
);
4462 /* Return true if I is at the end of its sequence. */
4465 gsi_end_p (gimple_stmt_iterator i
)
4467 return i
.ptr
== NULL
;
4471 /* Return true if I is one statement before the end of its sequence. */
4474 gsi_one_before_end_p (gimple_stmt_iterator i
)
4476 return i
.ptr
!= NULL
&& i
.ptr
->next
== NULL
;
4480 /* Advance the iterator to the next gimple statement. */
4483 gsi_next (gimple_stmt_iterator
*i
)
4485 i
->ptr
= i
->ptr
->next
;
4488 /* Advance the iterator to the previous gimple statement. */
4491 gsi_prev (gimple_stmt_iterator
*i
)
4493 i
->ptr
= i
->ptr
->prev
;
4496 /* Return the current stmt. */
4498 static inline gimple
4499 gsi_stmt (gimple_stmt_iterator i
)
4504 /* Return a block statement iterator that points to the first non-label
4505 statement in block BB. */
4507 static inline gimple_stmt_iterator
4508 gsi_after_labels (basic_block bb
)
4510 gimple_stmt_iterator gsi
= gsi_start_bb (bb
);
4512 while (!gsi_end_p (gsi
) && gimple_code (gsi_stmt (gsi
)) == GIMPLE_LABEL
)
4518 /* Advance the iterator to the next non-debug gimple statement. */
4521 gsi_next_nondebug (gimple_stmt_iterator
*i
)
4527 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
4530 /* Advance the iterator to the next non-debug gimple statement. */
4533 gsi_prev_nondebug (gimple_stmt_iterator
*i
)
4539 while (!gsi_end_p (*i
) && is_gimple_debug (gsi_stmt (*i
)));
4542 /* Return a new iterator pointing to the first non-debug statement in
4545 static inline gimple_stmt_iterator
4546 gsi_start_nondebug_bb (basic_block bb
)
4548 gimple_stmt_iterator i
= gsi_start_bb (bb
);
4550 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
4551 gsi_next_nondebug (&i
);
4556 /* Return a new iterator pointing to the last non-debug statement in
4559 static inline gimple_stmt_iterator
4560 gsi_last_nondebug_bb (basic_block bb
)
4562 gimple_stmt_iterator i
= gsi_last_bb (bb
);
4564 if (!gsi_end_p (i
) && is_gimple_debug (gsi_stmt (i
)))
4565 gsi_prev_nondebug (&i
);
4570 /* Return a pointer to the current stmt.
4572 NOTE: You may want to use gsi_replace on the iterator itself,
4573 as this performs additional bookkeeping that will not be done
4574 if you simply assign through a pointer returned by gsi_stmt_ptr. */
4576 static inline gimple
*
4577 gsi_stmt_ptr (gimple_stmt_iterator
*i
)
4579 return &i
->ptr
->stmt
;
4583 /* Return the basic block associated with this iterator. */
4585 static inline basic_block
4586 gsi_bb (gimple_stmt_iterator i
)
4592 /* Return the sequence associated with this iterator. */
4594 static inline gimple_seq
4595 gsi_seq (gimple_stmt_iterator i
)
4601 enum gsi_iterator_update
4603 GSI_NEW_STMT
, /* Only valid when single statement is added, move
4605 GSI_SAME_STMT
, /* Leave the iterator at the same statement. */
4606 GSI_CONTINUE_LINKING
/* Move iterator to whatever position is suitable
4607 for linking other statements in the same
4611 /* In gimple-iterator.c */
4612 gimple_stmt_iterator
gsi_start_phis (basic_block
);
4613 gimple_seq
gsi_split_seq_after (gimple_stmt_iterator
);
4614 gimple_seq
gsi_split_seq_before (gimple_stmt_iterator
*);
4615 void gsi_replace (gimple_stmt_iterator
*, gimple
, bool);
4616 void gsi_insert_before (gimple_stmt_iterator
*, gimple
,
4617 enum gsi_iterator_update
);
4618 void gsi_insert_before_without_update (gimple_stmt_iterator
*, gimple
,
4619 enum gsi_iterator_update
);
4620 void gsi_insert_seq_before (gimple_stmt_iterator
*, gimple_seq
,
4621 enum gsi_iterator_update
);
4622 void gsi_insert_seq_before_without_update (gimple_stmt_iterator
*, gimple_seq
,
4623 enum gsi_iterator_update
);
4624 void gsi_insert_after (gimple_stmt_iterator
*, gimple
,
4625 enum gsi_iterator_update
);
4626 void gsi_insert_after_without_update (gimple_stmt_iterator
*, gimple
,
4627 enum gsi_iterator_update
);
4628 void gsi_insert_seq_after (gimple_stmt_iterator
*, gimple_seq
,
4629 enum gsi_iterator_update
);
4630 void gsi_insert_seq_after_without_update (gimple_stmt_iterator
*, gimple_seq
,
4631 enum gsi_iterator_update
);
4632 void gsi_remove (gimple_stmt_iterator
*, bool);
4633 gimple_stmt_iterator
gsi_for_stmt (gimple
);
4634 void gsi_move_after (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
4635 void gsi_move_before (gimple_stmt_iterator
*, gimple_stmt_iterator
*);
4636 void gsi_move_to_bb_end (gimple_stmt_iterator
*, struct basic_block_def
*);
4637 void gsi_insert_on_edge (edge
, gimple
);
4638 void gsi_insert_seq_on_edge (edge
, gimple_seq
);
4639 basic_block
gsi_insert_on_edge_immediate (edge
, gimple
);
4640 basic_block
gsi_insert_seq_on_edge_immediate (edge
, gimple_seq
);
4641 void gsi_commit_one_edge_insert (edge
, basic_block
*);
4642 void gsi_commit_edge_inserts (void);
4643 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
4646 /* Convenience routines to walk all statements of a gimple function.
4647 Note that this is useful exclusively before the code is converted
4648 into SSA form. Once the program is in SSA form, the standard
4649 operand interface should be used to analyze/modify statements. */
4650 struct walk_stmt_info
4652 /* Points to the current statement being walked. */
4653 gimple_stmt_iterator gsi
;
4655 /* Additional data that the callback functions may want to carry
4656 through the recursion. */
4659 /* Pointer map used to mark visited tree nodes when calling
4660 walk_tree on each operand. If set to NULL, duplicate tree nodes
4661 will be visited more than once. */
4662 struct pointer_set_t
*pset
;
4664 /* Indicates whether the operand being examined may be replaced
4665 with something that matches is_gimple_val (if true) or something
4666 slightly more complicated (if false). "Something" technically
4667 means the common subset of is_gimple_lvalue and is_gimple_rhs,
4668 but we never try to form anything more complicated than that, so
4669 we don't bother checking.
4671 Also note that CALLBACK should update this flag while walking the
4672 sub-expressions of a statement. For instance, when walking the
4673 statement 'foo (&var)', the flag VAL_ONLY will initially be set
4674 to true, however, when walking &var, the operand of that
4675 ADDR_EXPR does not need to be a GIMPLE value. */
4678 /* True if we are currently walking the LHS of an assignment. */
4681 /* Optional. Set to true by the callback functions if they made any
4685 /* True if we're interested in location information. */
4686 bool want_locations
;
4688 /* Operand returned by the callbacks. This is set when calling
4689 walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
4690 returns non-NULL, this field will contain the tree returned by
4691 the last callback. */
4692 tree callback_result
;
4695 /* Callback for walk_gimple_stmt. Called for every statement found
4696 during traversal. The first argument points to the statement to
4697 walk. The second argument is a flag that the callback sets to
4698 'true' if it the callback handled all the operands and
4699 sub-statements of the statement (the default value of this flag is
4700 'false'). The third argument is an anonymous pointer to data
4701 to be used by the callback. */
4702 typedef tree (*walk_stmt_fn
) (gimple_stmt_iterator
*, bool *,
4703 struct walk_stmt_info
*);
4705 gimple
walk_gimple_seq (gimple_seq
, walk_stmt_fn
, walk_tree_fn
,
4706 struct walk_stmt_info
*);
4707 tree
walk_gimple_stmt (gimple_stmt_iterator
*, walk_stmt_fn
, walk_tree_fn
,
4708 struct walk_stmt_info
*);
4709 tree
walk_gimple_op (gimple
, walk_tree_fn
, struct walk_stmt_info
*);
4711 #ifdef GATHER_STATISTICS
4712 /* Enum and arrays used for allocation stats. Keep in sync with
4713 gimple.c:gimple_alloc_kind_names. */
4714 enum gimple_alloc_kind
4716 gimple_alloc_kind_assign
, /* Assignments. */
4717 gimple_alloc_kind_phi
, /* PHI nodes. */
4718 gimple_alloc_kind_cond
, /* Conditionals. */
4719 gimple_alloc_kind_seq
, /* Sequences. */
4720 gimple_alloc_kind_rest
, /* Everything else. */
4721 gimple_alloc_kind_all
4724 extern int gimple_alloc_counts
[];
4725 extern int gimple_alloc_sizes
[];
4727 /* Return the allocation kind for a given stmt CODE. */
4728 static inline enum gimple_alloc_kind
4729 gimple_alloc_kind (enum gimple_code code
)
4734 return gimple_alloc_kind_assign
;
4736 return gimple_alloc_kind_phi
;
4738 return gimple_alloc_kind_cond
;
4740 return gimple_alloc_kind_rest
;
4743 #endif /* GATHER_STATISTICS */
4745 extern void dump_gimple_statistics (void);
4747 #endif /* GCC_GIMPLE_H */