1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 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 typedef gimple gimple_seq_node
;
28 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
31 LAST_AND_UNUSED_GIMPLE_CODE
34 extern const char *const gimple_code_name
[];
35 extern const unsigned char gimple_rhs_class_table
[];
37 /* Error out if a gimple tuple is addressed incorrectly. */
38 #if defined ENABLE_GIMPLE_CHECKING
39 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
40 extern void gimple_check_failed (const_gimple
, const char *, int, \
41 const char *, enum gimple_code
, \
42 enum tree_code
) ATTRIBUTE_NORETURN
;
44 #define GIMPLE_CHECK(GS, CODE) \
46 const_gimple __gs = (GS); \
47 if (gimple_code (__gs) != (CODE)) \
48 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
49 (CODE), ERROR_MARK); \
51 #else /* not ENABLE_GIMPLE_CHECKING */
52 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
53 #define GIMPLE_CHECK(GS, CODE) (void)0
56 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
57 get_gimple_rhs_class. */
60 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
61 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
62 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
63 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
64 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
65 name, a _DECL, a _REF, etc. */
68 /* Specific flags for individual GIMPLE statements. These flags are
69 always stored in gimple_statement_base.subcode and they may only be
70 defined for statement codes that do not use subcodes.
72 Values for the masks can overlap as long as the overlapping values
73 are never used in the same statement class.
75 The maximum mask value that can be defined is 1 << 15 (i.e., each
76 statement code can hold up to 16 bitflags).
78 Keep this list sorted. */
80 GF_ASM_INPUT
= 1 << 0,
81 GF_ASM_VOLATILE
= 1 << 1,
82 GF_CALL_FROM_THUNK
= 1 << 0,
83 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
84 GF_CALL_TAILCALL
= 1 << 2,
85 GF_CALL_VA_ARG_PACK
= 1 << 3,
86 GF_CALL_NOTHROW
= 1 << 4,
87 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
88 GF_CALL_INTERNAL
= 1 << 6,
89 GF_CALL_CTRL_ALTERING
= 1 << 7,
90 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
91 GF_OMP_FOR_KIND_MASK
= 7 << 0,
92 GF_OMP_FOR_KIND_FOR
= 0,
93 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
94 GF_OMP_FOR_KIND_CILKFOR
= 2,
95 /* Flag for SIMD variants of OMP_FOR kinds. */
96 GF_OMP_FOR_SIMD
= 1 << 2,
97 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
98 GF_OMP_FOR_KIND_CILKSIMD
= GF_OMP_FOR_SIMD
| 1,
99 GF_OMP_FOR_COMBINED
= 1 << 3,
100 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
101 GF_OMP_TARGET_KIND_MASK
= (1 << 2) - 1,
102 GF_OMP_TARGET_KIND_REGION
= 0,
103 GF_OMP_TARGET_KIND_DATA
= 1,
104 GF_OMP_TARGET_KIND_UPDATE
= 2,
106 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
107 a thread synchronization via some sort of barrier. The exact barrier
108 that would otherwise be emitted is dependent on the OMP statement with
109 which this return is associated. */
110 GF_OMP_RETURN_NOWAIT
= 1 << 0,
112 GF_OMP_SECTION_LAST
= 1 << 0,
113 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
114 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
115 GF_PREDICT_TAKEN
= 1 << 15
118 /* Currently, there are only two types of gimple debug stmt. Others are
119 envisioned, for example, to enable the generation of is_stmt notes
120 in line number information, to mark sequence points, etc. This
121 subcode is to be used to tell them apart. */
122 enum gimple_debug_subcode
{
123 GIMPLE_DEBUG_BIND
= 0,
124 GIMPLE_DEBUG_SOURCE_BIND
= 1
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
134 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
135 are for 64 bit hosts. */
137 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
138 chain_next ("%h.next"), variable_size
))
139 gimple_statement_base
142 Main identifying code for a tuple. */
143 ENUM_BITFIELD(gimple_code
) code
: 8;
145 /* Nonzero if a warning should not be emitted on this tuple. */
146 unsigned int no_warning
: 1;
148 /* Nonzero if this tuple has been visited. Passes are responsible
149 for clearing this bit before using it. */
150 unsigned int visited
: 1;
152 /* Nonzero if this tuple represents a non-temporal move. */
153 unsigned int nontemporal_move
: 1;
155 /* Pass local flags. These flags are free for any pass to use as
156 they see fit. Passes should not assume that these flags contain
157 any useful value when the pass starts. Any initial state that
158 the pass requires should be set on entry to the pass. See
159 gimple_set_plf and gimple_plf for usage. */
160 unsigned int plf
: 2;
162 /* Nonzero if this statement has been modified and needs to have its
163 operands rescanned. */
164 unsigned modified
: 1;
166 /* Nonzero if this statement contains volatile operands. */
167 unsigned has_volatile_ops
: 1;
169 /* Padding to get subcode to 16 bit alignment. */
172 /* The SUBCODE field can be used for tuple-specific flags for tuples
173 that do not require subcodes. Note that SUBCODE should be at
174 least as wide as tree codes, as several tuples store tree codes
176 unsigned int subcode
: 16;
178 /* UID of this statement. This is used by passes that want to
179 assign IDs to statements. It must be assigned and used by each
180 pass. By default it should be assumed to contain garbage. */
184 Locus information for debug info. */
187 /* Number of operands in this tuple. */
191 Basic block holding this statement. */
195 Linked lists of gimple statements. The next pointers form
196 a NULL terminated list, the prev pointers are a cyclic list.
197 A gimple statement is hence also a double-ended list of
198 statements, with the pointer itself being the first element,
199 and the prev pointer being the last. */
201 gimple
GTY((skip
)) prev
;
206 /* Base structure for tuples with operands. */
208 /* This gimple subclass has no tag value. */
210 gimple_statement_with_ops_base
: public gimple_statement_base
212 /* [ WORD 1-6 ] : base class */
215 SSA operand vectors. NOTE: It should be possible to
216 amalgamate these vectors with the operand vector OP. However,
217 the SSA operand vectors are organized differently and contain
218 more information (like immediate use chaining). */
219 struct use_optype_d
GTY((skip (""))) *use_ops
;
223 /* Statements that take register operands. */
225 struct GTY((tag("GSS_WITH_OPS")))
226 gimple_statement_with_ops
: public gimple_statement_with_ops_base
228 /* [ WORD 1-7 ] : base class */
231 Operand vector. NOTE! This must always be the last field
232 of this structure. In particular, this means that this
233 structure cannot be embedded inside another one. */
234 tree
GTY((length ("%h.num_ops"))) op
[1];
238 /* Base for statements that take both memory and register operands. */
240 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
241 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
243 /* [ WORD 1-7 ] : base class */
246 Virtual operands for this statement. The GC will pick them
247 up via the ssa_names array. */
248 tree
GTY((skip (""))) vdef
;
249 tree
GTY((skip (""))) vuse
;
253 /* Statements that take both memory and register operands. */
255 struct GTY((tag("GSS_WITH_MEM_OPS")))
256 gimple_statement_with_memory_ops
:
257 public gimple_statement_with_memory_ops_base
259 /* [ WORD 1-9 ] : base class */
262 Operand vector. NOTE! This must always be the last field
263 of this structure. In particular, this means that this
264 structure cannot be embedded inside another one. */
265 tree
GTY((length ("%h.num_ops"))) op
[1];
269 /* Call statements that take both memory and register operands. */
271 struct GTY((tag("GSS_CALL")))
272 gimple_statement_call
: public gimple_statement_with_memory_ops_base
274 /* [ WORD 1-9 ] : base class */
277 struct pt_solution call_used
;
278 struct pt_solution call_clobbered
;
281 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
282 tree
GTY ((tag ("0"))) fntype
;
283 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
287 Operand vector. NOTE! This must always be the last field
288 of this structure. In particular, this means that this
289 structure cannot be embedded inside another one. */
290 tree
GTY((length ("%h.num_ops"))) op
[1];
294 /* OpenMP statements (#pragma omp). */
296 struct GTY((tag("GSS_OMP")))
297 gimple_statement_omp
: public gimple_statement_base
299 /* [ WORD 1-6 ] : base class */
308 struct GTY((tag("GSS_BIND")))
309 gimple_statement_bind
: public gimple_statement_base
311 /* [ WORD 1-6 ] : base class */
314 Variables declared in this scope. */
318 This is different than the BLOCK field in gimple_statement_base,
319 which is analogous to TREE_BLOCK (i.e., the lexical block holding
320 this statement). This field is the equivalent of BIND_EXPR_BLOCK
321 in tree land (i.e., the lexical scope defined by this bind). See
332 struct GTY((tag("GSS_CATCH")))
333 gimple_statement_catch
: public gimple_statement_base
335 /* [ WORD 1-6 ] : base class */
345 /* GIMPLE_EH_FILTER */
347 struct GTY((tag("GSS_EH_FILTER")))
348 gimple_statement_eh_filter
: public gimple_statement_base
350 /* [ WORD 1-6 ] : base class */
363 struct GTY((tag("GSS_EH_ELSE")))
364 gimple_statement_eh_else
: public gimple_statement_base
366 /* [ WORD 1-6 ] : base class */
369 gimple_seq n_body
, e_body
;
372 /* GIMPLE_EH_MUST_NOT_THROW */
374 struct GTY((tag("GSS_EH_MNT")))
375 gimple_statement_eh_mnt
: public gimple_statement_base
377 /* [ WORD 1-6 ] : base class */
379 /* [ WORD 7 ] Abort function decl. */
385 struct GTY((tag("GSS_PHI")))
386 gimple_statement_phi
: public gimple_statement_base
388 /* [ WORD 1-6 ] : base class */
398 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
402 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
404 struct GTY((tag("GSS_EH_CTRL")))
405 gimple_statement_eh_ctrl
: public gimple_statement_base
407 /* [ WORD 1-6 ] : base class */
410 Exception region number. */
414 struct GTY((tag("GSS_EH_CTRL")))
415 gimple_statement_resx
: public gimple_statement_eh_ctrl
417 /* No extra fields; adds invariant:
418 stmt->code == GIMPLE_RESX. */
421 struct GTY((tag("GSS_EH_CTRL")))
422 gimple_statement_eh_dispatch
: public gimple_statement_eh_ctrl
424 /* No extra fields; adds invariant:
425 stmt->code == GIMPLE_EH_DISPATH. */
431 struct GTY((tag("GSS_TRY")))
432 gimple_statement_try
: public gimple_statement_base
434 /* [ WORD 1-6 ] : base class */
437 Expression to evaluate. */
441 Cleanup expression. */
445 /* Kind of GIMPLE_TRY statements. */
446 enum gimple_try_flags
449 GIMPLE_TRY_CATCH
= 1 << 0,
452 GIMPLE_TRY_FINALLY
= 1 << 1,
453 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
455 /* Analogous to TRY_CATCH_IS_CLEANUP. */
456 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
459 /* GIMPLE_WITH_CLEANUP_EXPR */
461 struct GTY((tag("GSS_WCE")))
462 gimple_statement_wce
: public gimple_statement_base
464 /* [ WORD 1-6 ] : base class */
466 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
467 executed if an exception is thrown, not on normal exit of its
468 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
472 Cleanup expression. */
479 struct GTY((tag("GSS_ASM")))
480 gimple_statement_asm
: public gimple_statement_with_memory_ops_base
482 /* [ WORD 1-9 ] : base class */
485 __asm__ statement. */
489 Number of inputs, outputs, clobbers, labels. */
496 Operand vector. NOTE! This must always be the last field
497 of this structure. In particular, this means that this
498 structure cannot be embedded inside another one. */
499 tree
GTY((length ("%h.num_ops"))) op
[1];
502 /* GIMPLE_OMP_CRITICAL */
504 struct GTY((tag("GSS_OMP_CRITICAL")))
505 gimple_statement_omp_critical
: public gimple_statement_omp
507 /* [ WORD 1-7 ] : base class */
510 Critical section name. */
515 struct GTY(()) gimple_omp_for_iter
{
516 /* Condition code. */
519 /* Index variable. */
534 struct GTY((tag("GSS_OMP_FOR")))
535 gimple_statement_omp_for
: public gimple_statement_omp
537 /* [ WORD 1-7 ] : base class */
543 Number of elements in iter array. */
547 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
550 Pre-body evaluated before the loop body begins. */
555 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
556 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
557 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
559 /* [ WORD 1-7 ] : base class */
566 Child function holding the body of the parallel region. */
570 Shared data argument. */
574 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
575 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
576 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
578 /* No extra fields; adds invariant:
579 stmt->code == GIMPLE_OMP_PARALLEL
580 || stmt->code == GIMPLE_OMP_TASK. */
584 /* GIMPLE_OMP_PARALLEL */
585 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
586 gimple_statement_omp_parallel
: public gimple_statement_omp_taskreg
588 /* No extra fields; adds invariant:
589 stmt->code == GIMPLE_OMP_PARALLEL. */
592 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
593 gimple_statement_omp_target
: public gimple_statement_omp_parallel_layout
595 /* No extra fields; adds invariant:
596 stmt->code == GIMPLE_OMP_TARGET. */
599 /* GIMPLE_OMP_TASK */
601 struct GTY((tag("GSS_OMP_TASK")))
602 gimple_statement_omp_task
: public gimple_statement_omp_taskreg
604 /* [ WORD 1-10 ] : base class */
607 Child function holding firstprivate initialization if needed. */
611 Size and alignment in bytes of the argument data block. */
617 /* GIMPLE_OMP_SECTION */
618 /* Uses struct gimple_statement_omp. */
621 /* GIMPLE_OMP_SECTIONS */
623 struct GTY((tag("GSS_OMP_SECTIONS")))
624 gimple_statement_omp_sections
: public gimple_statement_omp
626 /* [ WORD 1-7 ] : base class */
632 The control variable used for deciding which of the sections to
637 /* GIMPLE_OMP_CONTINUE.
639 Note: This does not inherit from gimple_statement_omp, because we
640 do not need the body field. */
642 struct GTY((tag("GSS_OMP_CONTINUE")))
643 gimple_statement_omp_continue
: public gimple_statement_base
645 /* [ WORD 1-6 ] : base class */
654 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
656 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
657 gimple_statement_omp_single_layout
: public gimple_statement_omp
659 /* [ WORD 1-7 ] : base class */
665 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
666 gimple_statement_omp_single
: public gimple_statement_omp_single_layout
668 /* No extra fields; adds invariant:
669 stmt->code == GIMPLE_OMP_SINGLE. */
672 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
673 gimple_statement_omp_teams
: public gimple_statement_omp_single_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_TEAMS. */
680 /* GIMPLE_OMP_ATOMIC_LOAD.
681 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
682 contains a sequence, which we don't need here. */
684 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
685 gimple_statement_omp_atomic_load
: public gimple_statement_base
687 /* [ WORD 1-6 ] : base class */
693 /* GIMPLE_OMP_ATOMIC_STORE.
694 See note on GIMPLE_OMP_ATOMIC_LOAD. */
696 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
697 gimple_statement_omp_atomic_store_layout
: public gimple_statement_base
699 /* [ WORD 1-6 ] : base class */
705 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
706 gimple_statement_omp_atomic_store
:
707 public gimple_statement_omp_atomic_store_layout
709 /* No extra fields; adds invariant:
710 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
713 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
714 gimple_statement_omp_return
:
715 public gimple_statement_omp_atomic_store_layout
717 /* No extra fields; adds invariant:
718 stmt->code == GIMPLE_OMP_RETURN. */
721 /* GIMPLE_TRANSACTION. */
723 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
725 /* The __transaction_atomic was declared [[outer]] or it is
726 __transaction_relaxed. */
727 #define GTMA_IS_OUTER (1u << 0)
728 #define GTMA_IS_RELAXED (1u << 1)
729 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
731 /* The transaction is seen to not have an abort. */
732 #define GTMA_HAVE_ABORT (1u << 2)
733 /* The transaction is seen to have loads or stores. */
734 #define GTMA_HAVE_LOAD (1u << 3)
735 #define GTMA_HAVE_STORE (1u << 4)
736 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
737 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
738 /* The transaction WILL enter serial irrevocable mode.
739 An irrevocable block post-dominates the entire transaction, such
740 that all invocations of the transaction will go serial-irrevocable.
741 In such case, we don't bother instrumenting the transaction, and
742 tell the runtime that it should begin the transaction in
743 serial-irrevocable mode. */
744 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
745 /* The transaction contains no instrumentation code whatsover, most
746 likely because it is guaranteed to go irrevocable upon entry. */
747 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
749 struct GTY((tag("GSS_TRANSACTION")))
750 gimple_statement_transaction
: public gimple_statement_with_memory_ops_base
752 /* [ WORD 1-9 ] : base class */
761 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
762 enum gimple_statement_structure_enum
{
763 #include "gsstruct.def"
768 /* A statement with the invariant that
769 stmt->code == GIMPLE_COND
770 i.e. a conditional jump statement. */
772 struct GTY((tag("GSS_WITH_OPS")))
773 gimple_statement_cond
: public gimple_statement_with_ops
775 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
778 /* A statement with the invariant that
779 stmt->code == GIMPLE_DEBUG
780 i.e. a debug statement.
782 This type will normally be accessed via the gimple_debug and
783 const_gimple_debug typedefs (in coretypes.h), which are pointers to
786 struct GTY((tag("GSS_WITH_OPS")))
787 gimple_statement_debug
: public gimple_statement_with_ops
789 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
792 /* A statement with the invariant that
793 stmt->code == GIMPLE_GOTO
794 i.e. a goto statement.
796 This type will normally be accessed via the gimple_goto and
797 const_gimple_goto typedefs (in coretypes.h), which are pointers to
800 struct GTY((tag("GSS_WITH_OPS")))
801 gimple_statement_goto
: public gimple_statement_with_ops
803 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
806 /* A statement with the invariant that
807 stmt->code == GIMPLE_LABEL
808 i.e. a label statement.
810 This type will normally be accessed via the gimple_label and
811 const_gimple_label typedefs (in coretypes.h), which are pointers to
814 struct GTY((tag("GSS_WITH_OPS")))
815 gimple_statement_label
: public gimple_statement_with_ops
817 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
820 /* A statement with the invariant that
821 stmt->code == GIMPLE_SWITCH
822 i.e. a switch statement. */
824 struct GTY((tag("GSS_WITH_OPS")))
825 gimple_statement_switch
: public gimple_statement_with_ops
827 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
830 /* A statement with the invariant that
831 stmt->code == GIMPLE_ASSIGN
832 i.e. an assignment statement. */
834 struct GTY((tag("GSS_WITH_MEM_OPS")))
835 gimple_statement_assign
: public gimple_statement_with_memory_ops
837 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
840 /* A statement with the invariant that
841 stmt->code == GIMPLE_RETURN
842 i.e. a return statement. */
844 struct GTY((tag("GSS_WITH_MEM_OPS")))
845 gimple_statement_return
: public gimple_statement_with_memory_ops
847 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
853 is_a_helper
<gimple_statement_asm
*>::test (gimple gs
)
855 return gs
->code
== GIMPLE_ASM
;
861 is_a_helper
<gimple_statement_assign
*>::test (gimple gs
)
863 return gs
->code
== GIMPLE_ASSIGN
;
869 is_a_helper
<gimple_statement_bind
*>::test (gimple gs
)
871 return gs
->code
== GIMPLE_BIND
;
877 is_a_helper
<gimple_statement_call
*>::test (gimple gs
)
879 return gs
->code
== GIMPLE_CALL
;
885 is_a_helper
<gimple_statement_catch
*>::test (gimple gs
)
887 return gs
->code
== GIMPLE_CATCH
;
893 is_a_helper
<gimple_statement_cond
*>::test (gimple gs
)
895 return gs
->code
== GIMPLE_COND
;
901 is_a_helper
<gimple_statement_debug
*>::test (gimple gs
)
903 return gs
->code
== GIMPLE_DEBUG
;
909 is_a_helper
<gimple_statement_goto
*>::test (gimple gs
)
911 return gs
->code
== GIMPLE_GOTO
;
917 is_a_helper
<gimple_statement_label
*>::test (gimple gs
)
919 return gs
->code
== GIMPLE_LABEL
;
925 is_a_helper
<gimple_statement_resx
*>::test (gimple gs
)
927 return gs
->code
== GIMPLE_RESX
;
933 is_a_helper
<gimple_statement_eh_dispatch
*>::test (gimple gs
)
935 return gs
->code
== GIMPLE_EH_DISPATCH
;
941 is_a_helper
<gimple_statement_eh_else
*>::test (gimple gs
)
943 return gs
->code
== GIMPLE_EH_ELSE
;
949 is_a_helper
<gimple_statement_eh_filter
*>::test (gimple gs
)
951 return gs
->code
== GIMPLE_EH_FILTER
;
957 is_a_helper
<gimple_statement_eh_mnt
*>::test (gimple gs
)
959 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
965 is_a_helper
<gimple_statement_omp_atomic_load
*>::test (gimple gs
)
967 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
973 is_a_helper
<gimple_statement_omp_atomic_store
*>::test (gimple gs
)
975 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
981 is_a_helper
<gimple_statement_omp_return
*>::test (gimple gs
)
983 return gs
->code
== GIMPLE_OMP_RETURN
;
989 is_a_helper
<gimple_statement_omp_continue
*>::test (gimple gs
)
991 return gs
->code
== GIMPLE_OMP_CONTINUE
;
997 is_a_helper
<gimple_statement_omp_critical
*>::test (gimple gs
)
999 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1005 is_a_helper
<gimple_statement_omp_for
*>::test (gimple gs
)
1007 return gs
->code
== GIMPLE_OMP_FOR
;
1013 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple gs
)
1015 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1021 is_a_helper
<gimple_statement_omp_parallel
*>::test (gimple gs
)
1023 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1029 is_a_helper
<gimple_statement_omp_target
*>::test (gimple gs
)
1031 return gs
->code
== GIMPLE_OMP_TARGET
;
1037 is_a_helper
<gimple_statement_omp_sections
*>::test (gimple gs
)
1039 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1045 is_a_helper
<gimple_statement_omp_single
*>::test (gimple gs
)
1047 return gs
->code
== GIMPLE_OMP_SINGLE
;
1053 is_a_helper
<gimple_statement_omp_teams
*>::test (gimple gs
)
1055 return gs
->code
== GIMPLE_OMP_TEAMS
;
1061 is_a_helper
<gimple_statement_omp_task
*>::test (gimple gs
)
1063 return gs
->code
== GIMPLE_OMP_TASK
;
1069 is_a_helper
<gimple_statement_phi
*>::test (gimple gs
)
1071 return gs
->code
== GIMPLE_PHI
;
1077 is_a_helper
<gimple_statement_return
*>::test (gimple gs
)
1079 return gs
->code
== GIMPLE_RETURN
;
1085 is_a_helper
<gimple_statement_switch
*>::test (gimple gs
)
1087 return gs
->code
== GIMPLE_SWITCH
;
1093 is_a_helper
<gimple_statement_transaction
*>::test (gimple gs
)
1095 return gs
->code
== GIMPLE_TRANSACTION
;
1101 is_a_helper
<gimple_statement_try
*>::test (gimple gs
)
1103 return gs
->code
== GIMPLE_TRY
;
1109 is_a_helper
<gimple_statement_wce
*>::test (gimple gs
)
1111 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1117 is_a_helper
<const gimple_statement_asm
*>::test (const_gimple gs
)
1119 return gs
->code
== GIMPLE_ASM
;
1125 is_a_helper
<const gimple_statement_bind
*>::test (const_gimple gs
)
1127 return gs
->code
== GIMPLE_BIND
;
1133 is_a_helper
<const gimple_statement_call
*>::test (const_gimple gs
)
1135 return gs
->code
== GIMPLE_CALL
;
1141 is_a_helper
<const gimple_statement_catch
*>::test (const_gimple gs
)
1143 return gs
->code
== GIMPLE_CATCH
;
1149 is_a_helper
<const gimple_statement_resx
*>::test (const_gimple gs
)
1151 return gs
->code
== GIMPLE_RESX
;
1157 is_a_helper
<const gimple_statement_eh_dispatch
*>::test (const_gimple gs
)
1159 return gs
->code
== GIMPLE_EH_DISPATCH
;
1165 is_a_helper
<const gimple_statement_eh_filter
*>::test (const_gimple gs
)
1167 return gs
->code
== GIMPLE_EH_FILTER
;
1173 is_a_helper
<const gimple_statement_omp_atomic_load
*>::test (const_gimple gs
)
1175 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1181 is_a_helper
<const gimple_statement_omp_atomic_store
*>::test (const_gimple gs
)
1183 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1189 is_a_helper
<const gimple_statement_omp_return
*>::test (const_gimple gs
)
1191 return gs
->code
== GIMPLE_OMP_RETURN
;
1197 is_a_helper
<const gimple_statement_omp_continue
*>::test (const_gimple gs
)
1199 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1205 is_a_helper
<const gimple_statement_omp_critical
*>::test (const_gimple gs
)
1207 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1213 is_a_helper
<const gimple_statement_omp_for
*>::test (const_gimple gs
)
1215 return gs
->code
== GIMPLE_OMP_FOR
;
1221 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const_gimple gs
)
1223 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1229 is_a_helper
<const gimple_statement_omp_parallel
*>::test (const_gimple gs
)
1231 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1237 is_a_helper
<const gimple_statement_omp_target
*>::test (const_gimple gs
)
1239 return gs
->code
== GIMPLE_OMP_TARGET
;
1245 is_a_helper
<const gimple_statement_omp_sections
*>::test (const_gimple gs
)
1247 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1253 is_a_helper
<const gimple_statement_omp_single
*>::test (const_gimple gs
)
1255 return gs
->code
== GIMPLE_OMP_SINGLE
;
1261 is_a_helper
<const gimple_statement_omp_teams
*>::test (const_gimple gs
)
1263 return gs
->code
== GIMPLE_OMP_TEAMS
;
1269 is_a_helper
<const gimple_statement_omp_task
*>::test (const_gimple gs
)
1271 return gs
->code
== GIMPLE_OMP_TASK
;
1277 is_a_helper
<const gimple_statement_phi
*>::test (const_gimple gs
)
1279 return gs
->code
== GIMPLE_PHI
;
1285 is_a_helper
<const gimple_statement_transaction
*>::test (const_gimple gs
)
1287 return gs
->code
== GIMPLE_TRANSACTION
;
1290 /* Offset in bytes to the location of the operand vector.
1291 Zero if there is no operand vector for this tuple structure. */
1292 extern size_t const gimple_ops_offset_
[];
1294 /* Map GIMPLE codes to GSS codes. */
1295 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1297 /* This variable holds the currently expanded gimple statement for purposes
1298 of comminucating the profile info to the builtin expanders. */
1299 extern gimple currently_expanding_gimple_stmt
;
1301 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1302 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
1303 gimple_return
gimple_build_return (tree
);
1304 void gimple_call_reset_alias_info (gimple_call
);
1305 gimple_call
gimple_build_call_vec (tree
, vec
<tree
> );
1306 gimple_call
gimple_build_call (tree
, unsigned, ...);
1307 gimple_call
gimple_build_call_valist (tree
, unsigned, va_list);
1308 gimple_call
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1309 gimple_call
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1310 gimple_call
gimple_build_call_from_tree (tree
);
1311 gimple_assign
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
1312 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1313 gimple_assign
gimple_build_assign_with_ops (enum tree_code
, tree
,
1315 tree CXX_MEM_STAT_INFO
);
1316 gimple_assign
gimple_build_assign_with_ops (enum tree_code
, tree
,
1317 tree
, tree CXX_MEM_STAT_INFO
);
1318 gimple_cond
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1319 gimple_cond
gimple_build_cond_from_tree (tree
, tree
, tree
);
1320 void gimple_cond_set_condition_from_tree (gimple_cond
, tree
);
1321 gimple_label
gimple_build_label (tree label
);
1322 gimple_goto
gimple_build_goto (tree dest
);
1323 gimple
gimple_build_nop (void);
1324 gimple_bind
gimple_build_bind (tree
, gimple_seq
, tree
);
1325 gimple_asm
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1326 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1327 vec
<tree
, va_gc
> *);
1328 gimple_catch
gimple_build_catch (tree
, gimple_seq
);
1329 gimple_eh_filter
gimple_build_eh_filter (tree
, gimple_seq
);
1330 gimple_eh_must_not_throw
gimple_build_eh_must_not_throw (tree
);
1331 gimple_eh_else
gimple_build_eh_else (gimple_seq
, gimple_seq
);
1332 gimple_statement_try
*gimple_build_try (gimple_seq
, gimple_seq
,
1333 enum gimple_try_flags
);
1334 gimple
gimple_build_wce (gimple_seq
);
1335 gimple_resx
gimple_build_resx (int);
1336 gimple_switch
gimple_build_switch_nlabels (unsigned, tree
, tree
);
1337 gimple_switch
gimple_build_switch (tree
, tree
, vec
<tree
> );
1338 gimple_eh_dispatch
gimple_build_eh_dispatch (int);
1339 gimple_debug
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1340 #define gimple_build_debug_bind(var,val,stmt) \
1341 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1342 gimple_debug
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1343 #define gimple_build_debug_source_bind(var,val,stmt) \
1344 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1345 gimple_omp_critical
gimple_build_omp_critical (gimple_seq
, tree
);
1346 gimple_omp_for
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1347 gimple_omp_parallel
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1348 gimple_omp_task
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
,
1350 gimple
gimple_build_omp_section (gimple_seq
);
1351 gimple
gimple_build_omp_master (gimple_seq
);
1352 gimple
gimple_build_omp_taskgroup (gimple_seq
);
1353 gimple_omp_continue
gimple_build_omp_continue (tree
, tree
);
1354 gimple
gimple_build_omp_ordered (gimple_seq
);
1355 gimple
gimple_build_omp_return (bool);
1356 gimple_omp_sections
gimple_build_omp_sections (gimple_seq
, tree
);
1357 gimple
gimple_build_omp_sections_switch (void);
1358 gimple_omp_single
gimple_build_omp_single (gimple_seq
, tree
);
1359 gimple_omp_target
gimple_build_omp_target (gimple_seq
, int, tree
);
1360 gimple_omp_teams
gimple_build_omp_teams (gimple_seq
, tree
);
1361 gimple_omp_atomic_load
gimple_build_omp_atomic_load (tree
, tree
);
1362 gimple_omp_atomic_store
gimple_build_omp_atomic_store (tree
);
1363 gimple_transaction
gimple_build_transaction (gimple_seq
, tree
);
1364 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
1365 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1366 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1367 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1368 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1369 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1371 extern void annotate_all_with_location (gimple_seq
, location_t
);
1372 bool empty_body_p (gimple_seq
);
1373 gimple_seq
gimple_seq_copy (gimple_seq
);
1374 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
1375 int gimple_call_flags (const_gimple
);
1376 int gimple_call_arg_flags (const_gimple
, unsigned);
1377 int gimple_call_return_flags (const_gimple_call
);
1378 bool gimple_assign_copy_p (gimple
);
1379 bool gimple_assign_ssa_name_copy_p (gimple
);
1380 bool gimple_assign_unary_nop_p (gimple
);
1381 void gimple_set_bb (gimple
, basic_block
);
1382 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1383 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
1385 tree
gimple_get_lhs (const_gimple
);
1386 void gimple_set_lhs (gimple
, tree
);
1387 gimple
gimple_copy (gimple
);
1388 bool gimple_has_side_effects (const_gimple
);
1389 bool gimple_could_trap_p_1 (gimple
, bool, bool);
1390 bool gimple_could_trap_p (gimple
);
1391 bool gimple_assign_rhs_could_trap_p (gimple
);
1392 extern void dump_gimple_statistics (void);
1393 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1394 extern tree
canonicalize_cond_expr_cond (tree
);
1395 gimple_call
gimple_call_copy_skip_args (gimple_call
, bitmap
);
1396 extern bool gimple_compare_field_offset (tree
, tree
);
1397 extern tree
gimple_unsigned_type (tree
);
1398 extern tree
gimple_signed_type (tree
);
1399 extern alias_set_type
gimple_get_alias_set (tree
);
1400 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
1401 extern bool gimple_builtin_call_types_compatible_p (const_gimple
, tree
);
1402 extern bool gimple_call_builtin_p (const_gimple
);
1403 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_class
);
1404 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_function
);
1405 extern bool gimple_asm_clobbers_memory_p (const_gimple_asm
);
1406 extern void dump_decl_set (FILE *, bitmap
);
1407 extern bool nonfreeing_call_p (gimple
);
1408 extern bool infer_nonnull_range (gimple
, tree
, bool, bool);
1409 extern void sort_case_labels (vec
<tree
> );
1410 extern void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
1411 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1413 /* Formal (expression) temporary table handling: multiple occurrences of
1414 the same scalar expression are evaluated into the same temporary. */
1416 typedef struct gimple_temp_hash_elt
1419 tree temp
; /* Value */
1422 /* Get the number of the next statement uid to be allocated. */
1423 static inline unsigned int
1424 gimple_stmt_max_uid (struct function
*fn
)
1426 return fn
->last_stmt_uid
;
1429 /* Set the number of the next statement uid to be allocated. */
1431 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1433 fn
->last_stmt_uid
= maxid
;
1436 /* Set the number of the next statement uid to be allocated. */
1437 static inline unsigned int
1438 inc_gimple_stmt_max_uid (struct function
*fn
)
1440 return fn
->last_stmt_uid
++;
1443 /* Return the first node in GIMPLE sequence S. */
1445 static inline gimple_seq_node
1446 gimple_seq_first (gimple_seq s
)
1452 /* Return the first statement in GIMPLE sequence S. */
1454 static inline gimple
1455 gimple_seq_first_stmt (gimple_seq s
)
1457 gimple_seq_node n
= gimple_seq_first (s
);
1461 /* Return the first statement in GIMPLE sequence S as a gimple_bind,
1462 verifying that it has code GIMPLE_BIND in a checked build. */
1464 static inline gimple_bind
1465 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1467 gimple_seq_node n
= gimple_seq_first (s
);
1468 return as_a
<gimple_bind
> (n
);
1472 /* Return the last node in GIMPLE sequence S. */
1474 static inline gimple_seq_node
1475 gimple_seq_last (gimple_seq s
)
1477 return s
? s
->prev
: NULL
;
1481 /* Return the last statement in GIMPLE sequence S. */
1483 static inline gimple
1484 gimple_seq_last_stmt (gimple_seq s
)
1486 gimple_seq_node n
= gimple_seq_last (s
);
1491 /* Set the last node in GIMPLE sequence *PS to LAST. */
1494 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1500 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1503 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1509 /* Return true if GIMPLE sequence S is empty. */
1512 gimple_seq_empty_p (gimple_seq s
)
1517 /* Allocate a new sequence and initialize its first element with STMT. */
1519 static inline gimple_seq
1520 gimple_seq_alloc_with_stmt (gimple stmt
)
1522 gimple_seq seq
= NULL
;
1523 gimple_seq_add_stmt (&seq
, stmt
);
1528 /* Returns the sequence of statements in BB. */
1530 static inline gimple_seq
1531 bb_seq (const_basic_block bb
)
1533 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1536 static inline gimple_seq
*
1537 bb_seq_addr (basic_block bb
)
1539 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1542 /* Sets the sequence of statements in BB to SEQ. */
1545 set_bb_seq (basic_block bb
, gimple_seq seq
)
1547 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1548 bb
->il
.gimple
.seq
= seq
;
1552 /* Return the code for GIMPLE statement G. */
1554 static inline enum gimple_code
1555 gimple_code (const_gimple g
)
1561 /* Return the GSS code used by a GIMPLE code. */
1563 static inline enum gimple_statement_structure_enum
1564 gss_for_code (enum gimple_code code
)
1566 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1567 return gss_for_code_
[code
];
1571 /* Return which GSS code is used by GS. */
1573 static inline enum gimple_statement_structure_enum
1574 gimple_statement_structure (gimple gs
)
1576 return gss_for_code (gimple_code (gs
));
1580 /* Return true if statement G has sub-statements. This is only true for
1581 High GIMPLE statements. */
1584 gimple_has_substatements (gimple g
)
1586 switch (gimple_code (g
))
1590 case GIMPLE_EH_FILTER
:
1591 case GIMPLE_EH_ELSE
:
1593 case GIMPLE_OMP_FOR
:
1594 case GIMPLE_OMP_MASTER
:
1595 case GIMPLE_OMP_TASKGROUP
:
1596 case GIMPLE_OMP_ORDERED
:
1597 case GIMPLE_OMP_SECTION
:
1598 case GIMPLE_OMP_PARALLEL
:
1599 case GIMPLE_OMP_TASK
:
1600 case GIMPLE_OMP_SECTIONS
:
1601 case GIMPLE_OMP_SINGLE
:
1602 case GIMPLE_OMP_TARGET
:
1603 case GIMPLE_OMP_TEAMS
:
1604 case GIMPLE_OMP_CRITICAL
:
1605 case GIMPLE_WITH_CLEANUP_EXPR
:
1606 case GIMPLE_TRANSACTION
:
1615 /* Return the basic block holding statement G. */
1617 static inline basic_block
1618 gimple_bb (const_gimple g
)
1624 /* Return the lexical scope block holding statement G. */
1627 gimple_block (const_gimple g
)
1629 return LOCATION_BLOCK (g
->location
);
1633 /* Set BLOCK to be the lexical scope block holding statement G. */
1636 gimple_set_block (gimple g
, tree block
)
1640 COMBINE_LOCATION_DATA (line_table
, g
->location
, block
);
1642 g
->location
= LOCATION_LOCUS (g
->location
);
1646 /* Return location information for statement G. */
1648 static inline location_t
1649 gimple_location (const_gimple g
)
1654 /* Return location information for statement G if g is not NULL.
1655 Otherwise, UNKNOWN_LOCATION is returned. */
1657 static inline location_t
1658 gimple_location_safe (const_gimple g
)
1660 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1663 /* Return pointer to location information for statement G. */
1665 static inline const location_t
*
1666 gimple_location_ptr (const_gimple g
)
1668 return &g
->location
;
1672 /* Set location information for statement G. */
1675 gimple_set_location (gimple g
, location_t location
)
1677 g
->location
= location
;
1681 /* Return true if G contains location information. */
1684 gimple_has_location (const_gimple g
)
1686 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1690 /* Return the file name of the location of STMT. */
1692 static inline const char *
1693 gimple_filename (const_gimple stmt
)
1695 return LOCATION_FILE (gimple_location (stmt
));
1699 /* Return the line number of the location of STMT. */
1702 gimple_lineno (const_gimple stmt
)
1704 return LOCATION_LINE (gimple_location (stmt
));
1708 /* Determine whether SEQ is a singleton. */
1711 gimple_seq_singleton_p (gimple_seq seq
)
1713 return ((gimple_seq_first (seq
) != NULL
)
1714 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1717 /* Return true if no warnings should be emitted for statement STMT. */
1720 gimple_no_warning_p (const_gimple stmt
)
1722 return stmt
->no_warning
;
1725 /* Set the no_warning flag of STMT to NO_WARNING. */
1728 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1730 stmt
->no_warning
= (unsigned) no_warning
;
1733 /* Set the visited status on statement STMT to VISITED_P. */
1736 gimple_set_visited (gimple stmt
, bool visited_p
)
1738 stmt
->visited
= (unsigned) visited_p
;
1742 /* Return the visited status for statement STMT. */
1745 gimple_visited_p (gimple stmt
)
1747 return stmt
->visited
;
1751 /* Set pass local flag PLF on statement STMT to VAL_P. */
1754 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1757 stmt
->plf
|= (unsigned int) plf
;
1759 stmt
->plf
&= ~((unsigned int) plf
);
1763 /* Return the value of pass local flag PLF on statement STMT. */
1765 static inline unsigned int
1766 gimple_plf (gimple stmt
, enum plf_mask plf
)
1768 return stmt
->plf
& ((unsigned int) plf
);
1772 /* Set the UID of statement. */
1775 gimple_set_uid (gimple g
, unsigned uid
)
1781 /* Return the UID of statement. */
1783 static inline unsigned
1784 gimple_uid (const_gimple g
)
1790 /* Make statement G a singleton sequence. */
1793 gimple_init_singleton (gimple g
)
1800 /* Return true if GIMPLE statement G has register or memory operands. */
1803 gimple_has_ops (const_gimple g
)
1805 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1811 is_a_helper
<const gimple_statement_with_ops
*>::test (const_gimple gs
)
1813 return gimple_has_ops (gs
);
1819 is_a_helper
<gimple_statement_with_ops
*>::test (gimple gs
)
1821 return gimple_has_ops (gs
);
1824 /* Return true if GIMPLE statement G has memory operands. */
1827 gimple_has_mem_ops (const_gimple g
)
1829 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1835 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const_gimple gs
)
1837 return gimple_has_mem_ops (gs
);
1843 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple gs
)
1845 return gimple_has_mem_ops (gs
);
1848 /* Return the set of USE operands for statement G. */
1850 static inline struct use_optype_d
*
1851 gimple_use_ops (const_gimple g
)
1853 const gimple_statement_with_ops
*ops_stmt
=
1854 dyn_cast
<const gimple_statement_with_ops
*> (g
);
1857 return ops_stmt
->use_ops
;
1861 /* Set USE to be the set of USE operands for statement G. */
1864 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1866 gimple_statement_with_ops
*ops_stmt
=
1867 as_a
<gimple_statement_with_ops
*> (g
);
1868 ops_stmt
->use_ops
= use
;
1872 /* Return the single VUSE operand of the statement G. */
1875 gimple_vuse (const_gimple g
)
1877 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1878 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1881 return mem_ops_stmt
->vuse
;
1884 /* Return the single VDEF operand of the statement G. */
1887 gimple_vdef (const_gimple g
)
1889 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1890 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1893 return mem_ops_stmt
->vdef
;
1896 /* Return the single VUSE operand of the statement G. */
1898 static inline tree
*
1899 gimple_vuse_ptr (gimple g
)
1901 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1902 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1905 return &mem_ops_stmt
->vuse
;
1908 /* Return the single VDEF operand of the statement G. */
1910 static inline tree
*
1911 gimple_vdef_ptr (gimple g
)
1913 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1914 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1917 return &mem_ops_stmt
->vdef
;
1920 /* Set the single VUSE operand of the statement G. */
1923 gimple_set_vuse (gimple g
, tree vuse
)
1925 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1926 as_a
<gimple_statement_with_memory_ops
*> (g
);
1927 mem_ops_stmt
->vuse
= vuse
;
1930 /* Set the single VDEF operand of the statement G. */
1933 gimple_set_vdef (gimple g
, tree vdef
)
1935 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1936 as_a
<gimple_statement_with_memory_ops
*> (g
);
1937 mem_ops_stmt
->vdef
= vdef
;
1941 /* Return true if statement G has operands and the modified field has
1945 gimple_modified_p (const_gimple g
)
1947 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
1951 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1952 a MODIFIED field. */
1955 gimple_set_modified (gimple s
, bool modifiedp
)
1957 if (gimple_has_ops (s
))
1958 s
->modified
= (unsigned) modifiedp
;
1962 /* Return the tree code for the expression computed by STMT. This is
1963 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1964 GIMPLE_CALL, return CALL_EXPR as the expression code for
1965 consistency. This is useful when the caller needs to deal with the
1966 three kinds of computation that GIMPLE supports. */
1968 static inline enum tree_code
1969 gimple_expr_code (const_gimple stmt
)
1971 enum gimple_code code
= gimple_code (stmt
);
1972 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1973 return (enum tree_code
) stmt
->subcode
;
1976 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1982 /* Return true if statement STMT contains volatile operands. */
1985 gimple_has_volatile_ops (const_gimple stmt
)
1987 if (gimple_has_mem_ops (stmt
))
1988 return stmt
->has_volatile_ops
;
1994 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1997 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1999 if (gimple_has_mem_ops (stmt
))
2000 stmt
->has_volatile_ops
= (unsigned) volatilep
;
2003 /* Return true if STMT is in a transaction. */
2006 gimple_in_transaction (gimple stmt
)
2008 return bb_in_transaction (gimple_bb (stmt
));
2011 /* Return true if statement STMT may access memory. */
2014 gimple_references_memory_p (gimple stmt
)
2016 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
2020 /* Return the subcode for OMP statement S. */
2022 static inline unsigned
2023 gimple_omp_subcode (const_gimple s
)
2025 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
2026 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
2030 /* Set the subcode for OMP statement S to SUBCODE. */
2033 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
2035 /* We only have 16 bits for the subcode. Assert that we are not
2037 gcc_gimple_checking_assert (subcode
< (1 << 16));
2038 s
->subcode
= subcode
;
2041 /* Set the nowait flag on OMP_RETURN statement S. */
2044 gimple_omp_return_set_nowait (gimple s
)
2046 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2047 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2051 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2055 gimple_omp_return_nowait_p (const_gimple g
)
2057 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2058 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2062 /* Set the LHS of OMP return. */
2065 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
2067 gimple_statement_omp_return
*omp_return_stmt
=
2068 as_a
<gimple_statement_omp_return
*> (g
);
2069 omp_return_stmt
->val
= lhs
;
2073 /* Get the LHS of OMP return. */
2076 gimple_omp_return_lhs (const_gimple g
)
2078 const gimple_statement_omp_return
*omp_return_stmt
=
2079 as_a
<const gimple_statement_omp_return
*> (g
);
2080 return omp_return_stmt
->val
;
2084 /* Return a pointer to the LHS of OMP return. */
2086 static inline tree
*
2087 gimple_omp_return_lhs_ptr (gimple g
)
2089 gimple_statement_omp_return
*omp_return_stmt
=
2090 as_a
<gimple_statement_omp_return
*> (g
);
2091 return &omp_return_stmt
->val
;
2095 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2099 gimple_omp_section_last_p (const_gimple g
)
2101 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2102 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2106 /* Set the GF_OMP_SECTION_LAST flag on G. */
2109 gimple_omp_section_set_last (gimple g
)
2111 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2112 g
->subcode
|= GF_OMP_SECTION_LAST
;
2116 /* Return true if OMP parallel statement G has the
2117 GF_OMP_PARALLEL_COMBINED flag set. */
2120 gimple_omp_parallel_combined_p (const_gimple g
)
2122 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2123 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2127 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2128 value of COMBINED_P. */
2131 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
2133 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2135 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2137 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2141 /* Return true if OMP atomic load/store statement G has the
2142 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2145 gimple_omp_atomic_need_value_p (const_gimple g
)
2147 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2148 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2149 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2153 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2156 gimple_omp_atomic_set_need_value (gimple g
)
2158 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2159 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2160 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2164 /* Return true if OMP atomic load/store statement G has the
2165 GF_OMP_ATOMIC_SEQ_CST flag set. */
2168 gimple_omp_atomic_seq_cst_p (const_gimple g
)
2170 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2171 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2172 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2176 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2179 gimple_omp_atomic_set_seq_cst (gimple g
)
2181 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2182 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2183 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2187 /* Return the number of operands for statement GS. */
2189 static inline unsigned
2190 gimple_num_ops (const_gimple gs
)
2196 /* Set the number of operands for statement GS. */
2199 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
2201 gs
->num_ops
= num_ops
;
2205 /* Return the array of operands for statement GS. */
2207 static inline tree
*
2208 gimple_ops (gimple gs
)
2212 /* All the tuples have their operand vector at the very bottom
2213 of the structure. Note that those structures that do not
2214 have an operand vector have a zero offset. */
2215 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2216 gcc_gimple_checking_assert (off
!= 0);
2218 return (tree
*) ((char *) gs
+ off
);
2222 /* Return operand I for statement GS. */
2225 gimple_op (const_gimple gs
, unsigned i
)
2227 if (gimple_has_ops (gs
))
2229 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2230 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2236 /* Return a pointer to operand I for statement GS. */
2238 static inline tree
*
2239 gimple_op_ptr (const_gimple gs
, unsigned i
)
2241 if (gimple_has_ops (gs
))
2243 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2244 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
2250 /* Set operand I of statement GS to OP. */
2253 gimple_set_op (gimple gs
, unsigned i
, tree op
)
2255 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2257 /* Note. It may be tempting to assert that OP matches
2258 is_gimple_operand, but that would be wrong. Different tuples
2259 accept slightly different sets of tree operands. Each caller
2260 should perform its own validation. */
2261 gimple_ops (gs
)[i
] = op
;
2264 /* Return true if GS is a GIMPLE_ASSIGN. */
2267 is_gimple_assign (const_gimple gs
)
2269 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2272 /* Determine if expression CODE is one of the valid expressions that can
2273 be used on the RHS of GIMPLE assignments. */
2275 static inline enum gimple_rhs_class
2276 get_gimple_rhs_class (enum tree_code code
)
2278 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2281 /* Return the LHS of assignment statement GS. */
2284 gimple_assign_lhs (const_gimple gs
)
2286 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2287 return gimple_op (gs
, 0);
2291 /* Return a pointer to the LHS of assignment statement GS. */
2293 static inline tree
*
2294 gimple_assign_lhs_ptr (const_gimple gs
)
2296 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2297 return gimple_op_ptr (gs
, 0);
2301 /* Set LHS to be the LHS operand of assignment statement GS. */
2304 gimple_assign_set_lhs (gimple gs
, tree lhs
)
2306 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2307 gimple_set_op (gs
, 0, lhs
);
2309 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2310 SSA_NAME_DEF_STMT (lhs
) = gs
;
2314 /* Return the first operand on the RHS of assignment statement GS. */
2317 gimple_assign_rhs1 (const_gimple gs
)
2319 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2320 return gimple_op (gs
, 1);
2324 /* Return a pointer to the first operand on the RHS of assignment
2327 static inline tree
*
2328 gimple_assign_rhs1_ptr (const_gimple gs
)
2330 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2331 return gimple_op_ptr (gs
, 1);
2334 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2337 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
2339 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2341 gimple_set_op (gs
, 1, rhs
);
2345 /* Return the second operand on the RHS of assignment statement GS.
2346 If GS does not have two operands, NULL is returned instead. */
2349 gimple_assign_rhs2 (const_gimple gs
)
2351 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2353 if (gimple_num_ops (gs
) >= 3)
2354 return gimple_op (gs
, 2);
2360 /* Return a pointer to the second operand on the RHS of assignment
2363 static inline tree
*
2364 gimple_assign_rhs2_ptr (const_gimple gs
)
2366 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2367 return gimple_op_ptr (gs
, 2);
2371 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2374 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
2376 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2378 gimple_set_op (gs
, 2, rhs
);
2381 /* Return the third operand on the RHS of assignment statement GS.
2382 If GS does not have two operands, NULL is returned instead. */
2385 gimple_assign_rhs3 (const_gimple gs
)
2387 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2389 if (gimple_num_ops (gs
) >= 4)
2390 return gimple_op (gs
, 3);
2395 /* Return a pointer to the third operand on the RHS of assignment
2398 static inline tree
*
2399 gimple_assign_rhs3_ptr (const_gimple gs
)
2401 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2402 return gimple_op_ptr (gs
, 3);
2406 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2409 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
2411 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2413 gimple_set_op (gs
, 3, rhs
);
2416 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2417 to see only a maximum of two operands. */
2420 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2423 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
2426 /* Returns true if GS is a nontemporal move. */
2429 gimple_assign_nontemporal_move_p (const_gimple gs
)
2431 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2432 return gs
->nontemporal_move
;
2435 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2438 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
2440 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2441 gs
->nontemporal_move
= nontemporal
;
2445 /* Return the code of the expression computed on the rhs of assignment
2446 statement GS. In case that the RHS is a single object, returns the
2447 tree code of the object. */
2449 static inline enum tree_code
2450 gimple_assign_rhs_code (const_gimple gs
)
2452 enum tree_code code
;
2453 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2455 code
= (enum tree_code
) gs
->subcode
;
2456 /* While we initially set subcode to the TREE_CODE of the rhs for
2457 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2458 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2459 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2460 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2466 /* Set CODE to be the code for the expression computed on the RHS of
2470 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2472 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2477 /* Return the gimple rhs class of the code of the expression computed on
2478 the rhs of assignment statement GS.
2479 This will never return GIMPLE_INVALID_RHS. */
2481 static inline enum gimple_rhs_class
2482 gimple_assign_rhs_class (const_gimple gs
)
2484 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2487 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2488 there is no operator associated with the assignment itself.
2489 Unlike gimple_assign_copy_p, this predicate returns true for
2490 any RHS operand, including those that perform an operation
2491 and do not have the semantics of a copy, such as COND_EXPR. */
2494 gimple_assign_single_p (const_gimple gs
)
2496 return (is_gimple_assign (gs
)
2497 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2500 /* Return true if GS performs a store to its lhs. */
2503 gimple_store_p (const_gimple gs
)
2505 tree lhs
= gimple_get_lhs (gs
);
2506 return lhs
&& !is_gimple_reg (lhs
);
2509 /* Return true if GS is an assignment that loads from its rhs1. */
2512 gimple_assign_load_p (const_gimple gs
)
2515 if (!gimple_assign_single_p (gs
))
2517 rhs
= gimple_assign_rhs1 (gs
);
2518 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2520 rhs
= get_base_address (rhs
);
2521 return (DECL_P (rhs
)
2522 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2526 /* Return true if S is a type-cast assignment. */
2529 gimple_assign_cast_p (const_gimple s
)
2531 if (is_gimple_assign (s
))
2533 enum tree_code sc
= gimple_assign_rhs_code (s
);
2534 return CONVERT_EXPR_CODE_P (sc
)
2535 || sc
== VIEW_CONVERT_EXPR
2536 || sc
== FIX_TRUNC_EXPR
;
2542 /* Return true if S is a clobber statement. */
2545 gimple_clobber_p (const_gimple s
)
2547 return gimple_assign_single_p (s
)
2548 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2551 /* Return true if GS is a GIMPLE_CALL. */
2554 is_gimple_call (const_gimple gs
)
2556 return gimple_code (gs
) == GIMPLE_CALL
;
2559 /* Return the LHS of call statement GS. */
2562 gimple_call_lhs (const_gimple gs
)
2564 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2565 return gimple_op (gs
, 0);
2569 /* Return a pointer to the LHS of call statement GS. */
2571 static inline tree
*
2572 gimple_call_lhs_ptr (const_gimple gs
)
2574 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2575 return gimple_op_ptr (gs
, 0);
2579 /* Set LHS to be the LHS operand of call statement GS. */
2582 gimple_call_set_lhs (gimple gs
, tree lhs
)
2584 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2585 gimple_set_op (gs
, 0, lhs
);
2586 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2587 SSA_NAME_DEF_STMT (lhs
) = gs
;
2591 /* Return true if call GS calls an internal-only function, as enumerated
2595 gimple_call_internal_p (const_gimple gs
)
2597 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2598 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2602 /* Return the target of internal call GS. */
2604 static inline enum internal_fn
2605 gimple_call_internal_fn (const_gimple gs
)
2607 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2608 return static_cast <const gimple_statement_call
*> (gs
)->u
.internal_fn
;
2611 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2612 that could alter control flow. */
2615 gimple_call_set_ctrl_altering (gimple s
, bool ctrl_altering_p
)
2617 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2618 if (ctrl_altering_p
)
2619 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2621 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2624 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2625 flag is set. Such call could not be a stmt in the middle of a bb. */
2628 gimple_call_ctrl_altering_p (const_gimple gs
)
2630 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2631 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2635 /* Return the function type of the function called by GS. */
2638 gimple_call_fntype (const_gimple gs
)
2640 const gimple_statement_call
*call_stmt
=
2641 as_a
<const gimple_statement_call
*> (gs
);
2642 if (gimple_call_internal_p (gs
))
2644 return call_stmt
->u
.fntype
;
2647 /* Set the type of the function called by GS to FNTYPE. */
2650 gimple_call_set_fntype (gimple gs
, tree fntype
)
2652 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (gs
);
2653 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2654 call_stmt
->u
.fntype
= fntype
;
2658 /* Return the tree node representing the function called by call
2662 gimple_call_fn (const_gimple gs
)
2664 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2665 return gimple_op (gs
, 1);
2668 /* Return a pointer to the tree node representing the function called by call
2671 static inline tree
*
2672 gimple_call_fn_ptr (const_gimple gs
)
2674 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2675 return gimple_op_ptr (gs
, 1);
2679 /* Set FN to be the function called by call statement GS. */
2682 gimple_call_set_fn (gimple gs
, tree fn
)
2684 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2685 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2686 gimple_set_op (gs
, 1, fn
);
2690 /* Set FNDECL to be the function called by call statement GS. */
2693 gimple_call_set_fndecl (gimple gs
, tree decl
)
2695 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2696 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2697 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2701 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2704 gimple_call_set_internal_fn (gimple_call call_stmt
, enum internal_fn fn
)
2706 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
2707 call_stmt
->u
.internal_fn
= fn
;
2711 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2712 Otherwise return NULL. This function is analogous to
2713 get_callee_fndecl in tree land. */
2716 gimple_call_fndecl (const_gimple gs
)
2718 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2722 /* Return the type returned by call statement GS. */
2725 gimple_call_return_type (const_gimple_call gs
)
2727 tree type
= gimple_call_fntype (gs
);
2729 if (type
== NULL_TREE
)
2730 return TREE_TYPE (gimple_call_lhs (gs
));
2732 /* The type returned by a function is the type of its
2734 return TREE_TYPE (type
);
2738 /* Return the static chain for call statement GS. */
2741 gimple_call_chain (const_gimple gs
)
2743 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2744 return gimple_op (gs
, 2);
2748 /* Return a pointer to the static chain for call statement CALL_STMT. */
2750 static inline tree
*
2751 gimple_call_chain_ptr (const_gimple_call call_stmt
)
2753 return gimple_op_ptr (call_stmt
, 2);
2756 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2759 gimple_call_set_chain (gimple_call call_stmt
, tree chain
)
2761 gimple_set_op (call_stmt
, 2, chain
);
2765 /* Return the number of arguments used by call statement GS. */
2767 static inline unsigned
2768 gimple_call_num_args (const_gimple gs
)
2771 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2772 num_ops
= gimple_num_ops (gs
);
2777 /* Return the argument at position INDEX for call statement GS. */
2780 gimple_call_arg (const_gimple gs
, unsigned index
)
2782 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2783 return gimple_op (gs
, index
+ 3);
2787 /* Return a pointer to the argument at position INDEX for call
2790 static inline tree
*
2791 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2793 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2794 return gimple_op_ptr (gs
, index
+ 3);
2798 /* Set ARG to be the argument at position INDEX for call statement GS. */
2801 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2803 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2804 gimple_set_op (gs
, index
+ 3, arg
);
2808 /* If TAIL_P is true, mark call statement S as being a tail call
2809 (i.e., a call just before the exit of a function). These calls are
2810 candidate for tail call optimization. */
2813 gimple_call_set_tail (gimple s
, bool tail_p
)
2815 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2817 s
->subcode
|= GF_CALL_TAILCALL
;
2819 s
->subcode
&= ~GF_CALL_TAILCALL
;
2823 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2826 gimple_call_tail_p (gimple s
)
2828 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2829 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
2833 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2834 slot optimization. This transformation uses the target of the call
2835 expansion as the return slot for calls that return in memory. */
2838 gimple_call_set_return_slot_opt (gimple_call s
, bool return_slot_opt_p
)
2840 if (return_slot_opt_p
)
2841 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2843 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2847 /* Return true if S is marked for return slot optimization. */
2850 gimple_call_return_slot_opt_p (gimple_call s
)
2852 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2856 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2857 thunk to the thunked-to function. */
2860 gimple_call_set_from_thunk (gimple_call s
, bool from_thunk_p
)
2863 s
->subcode
|= GF_CALL_FROM_THUNK
;
2865 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
2869 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2872 gimple_call_from_thunk_p (gimple_call s
)
2874 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
2878 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2879 argument pack in its argument list. */
2882 gimple_call_set_va_arg_pack (gimple_call s
, bool pass_arg_pack_p
)
2884 if (pass_arg_pack_p
)
2885 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
2887 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
2891 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2892 argument pack in its argument list. */
2895 gimple_call_va_arg_pack_p (gimple_call s
)
2897 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2901 /* Return true if S is a noreturn call. */
2904 gimple_call_noreturn_p (gimple s
)
2906 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2907 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2911 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2912 even if the called function can throw in other cases. */
2915 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2917 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2919 s
->subcode
|= GF_CALL_NOTHROW
;
2921 s
->subcode
&= ~GF_CALL_NOTHROW
;
2924 /* Return true if S is a nothrow call. */
2927 gimple_call_nothrow_p (gimple s
)
2929 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2930 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2933 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2934 is known to be emitted for VLA objects. Those are wrapped by
2935 stack_save/stack_restore calls and hence can't lead to unbounded
2936 stack growth even when they occur in loops. */
2939 gimple_call_set_alloca_for_var (gimple_call s
, bool for_var
)
2942 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2944 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2947 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2950 gimple_call_alloca_for_var_p (gimple_call s
)
2952 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2955 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2958 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2960 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2961 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2962 dest_call
->subcode
= orig_call
->subcode
;
2966 /* Return a pointer to the points-to solution for the set of call-used
2967 variables of the call CALL_STMT. */
2969 static inline struct pt_solution
*
2970 gimple_call_use_set (gimple_call call_stmt
)
2972 return &call_stmt
->call_used
;
2976 /* Return a pointer to the points-to solution for the set of call-used
2977 variables of the call CALL_STMT. */
2979 static inline struct pt_solution
*
2980 gimple_call_clobber_set (gimple_call call_stmt
)
2982 return &call_stmt
->call_clobbered
;
2986 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2990 gimple_has_lhs (gimple stmt
)
2992 return (is_gimple_assign (stmt
)
2993 || (is_gimple_call (stmt
)
2994 && gimple_call_lhs (stmt
) != NULL_TREE
));
2998 /* Return the code of the predicate computed by conditional statement GS. */
3000 static inline enum tree_code
3001 gimple_cond_code (const_gimple gs
)
3003 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3004 return (enum tree_code
) gs
->subcode
;
3008 /* Set CODE to be the predicate code for the conditional statement GS. */
3011 gimple_cond_set_code (gimple gs
, enum tree_code code
)
3013 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3018 /* Return the LHS of the predicate computed by conditional statement GS. */
3021 gimple_cond_lhs (const_gimple gs
)
3023 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3024 return gimple_op (gs
, 0);
3027 /* Return the pointer to the LHS of the predicate computed by conditional
3030 static inline tree
*
3031 gimple_cond_lhs_ptr (const_gimple gs
)
3033 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3034 return gimple_op_ptr (gs
, 0);
3037 /* Set LHS to be the LHS operand of the predicate computed by
3038 conditional statement GS. */
3041 gimple_cond_set_lhs (gimple gs
, tree lhs
)
3043 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3044 gimple_set_op (gs
, 0, lhs
);
3048 /* Return the RHS operand of the predicate computed by conditional GS. */
3051 gimple_cond_rhs (const_gimple gs
)
3053 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3054 return gimple_op (gs
, 1);
3057 /* Return the pointer to the RHS operand of the predicate computed by
3060 static inline tree
*
3061 gimple_cond_rhs_ptr (const_gimple gs
)
3063 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3064 return gimple_op_ptr (gs
, 1);
3068 /* Set RHS to be the RHS operand of the predicate computed by
3069 conditional statement GS. */
3072 gimple_cond_set_rhs (gimple gs
, tree rhs
)
3074 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3075 gimple_set_op (gs
, 1, rhs
);
3079 /* Return the label used by conditional statement GS when its
3080 predicate evaluates to true. */
3083 gimple_cond_true_label (const_gimple gs
)
3085 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3086 return gimple_op (gs
, 2);
3090 /* Set LABEL to be the label used by conditional statement GS when its
3091 predicate evaluates to true. */
3094 gimple_cond_set_true_label (gimple_cond gs
, tree label
)
3096 gimple_set_op (gs
, 2, label
);
3100 /* Set LABEL to be the label used by conditional statement GS when its
3101 predicate evaluates to false. */
3104 gimple_cond_set_false_label (gimple_cond gs
, tree label
)
3106 gimple_set_op (gs
, 3, label
);
3110 /* Return the label used by conditional statement GS when its
3111 predicate evaluates to false. */
3114 gimple_cond_false_label (const_gimple gs
)
3116 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3117 return gimple_op (gs
, 3);
3121 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3124 gimple_cond_make_false (gimple_cond gs
)
3126 gimple_cond_set_lhs (gs
, boolean_true_node
);
3127 gimple_cond_set_rhs (gs
, boolean_false_node
);
3128 gs
->subcode
= EQ_EXPR
;
3132 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3135 gimple_cond_make_true (gimple_cond gs
)
3137 gimple_cond_set_lhs (gs
, boolean_true_node
);
3138 gimple_cond_set_rhs (gs
, boolean_true_node
);
3139 gs
->subcode
= EQ_EXPR
;
3142 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3143 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3146 gimple_cond_true_p (const_gimple_cond gs
)
3148 tree lhs
= gimple_cond_lhs (gs
);
3149 tree rhs
= gimple_cond_rhs (gs
);
3150 enum tree_code code
= gimple_cond_code (gs
);
3152 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3155 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3158 if (code
== NE_EXPR
&& lhs
!= rhs
)
3161 if (code
== EQ_EXPR
&& lhs
== rhs
)
3167 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3168 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3171 gimple_cond_false_p (const_gimple_cond gs
)
3173 tree lhs
= gimple_cond_lhs (gs
);
3174 tree rhs
= gimple_cond_rhs (gs
);
3175 enum tree_code code
= gimple_cond_code (gs
);
3177 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3180 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3183 if (code
== NE_EXPR
&& lhs
== rhs
)
3186 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3192 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3195 gimple_cond_set_condition (gimple_cond stmt
, enum tree_code code
, tree lhs
,
3198 gimple_cond_set_code (stmt
, code
);
3199 gimple_cond_set_lhs (stmt
, lhs
);
3200 gimple_cond_set_rhs (stmt
, rhs
);
3203 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3206 gimple_label_label (const_gimple_label gs
)
3208 return gimple_op (gs
, 0);
3212 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3216 gimple_label_set_label (gimple_label gs
, tree label
)
3218 gimple_set_op (gs
, 0, label
);
3222 /* Return the destination of the unconditional jump GS. */
3225 gimple_goto_dest (const_gimple gs
)
3227 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3228 return gimple_op (gs
, 0);
3232 /* Set DEST to be the destination of the unconditonal jump GS. */
3235 gimple_goto_set_dest (gimple_goto gs
, tree dest
)
3237 gimple_set_op (gs
, 0, dest
);
3241 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3244 gimple_bind_vars (const_gimple_bind bind_stmt
)
3246 return bind_stmt
->vars
;
3250 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3254 gimple_bind_set_vars (gimple_bind bind_stmt
, tree vars
)
3256 bind_stmt
->vars
= vars
;
3260 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3264 gimple_bind_append_vars (gimple_bind bind_stmt
, tree vars
)
3266 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3270 static inline gimple_seq
*
3271 gimple_bind_body_ptr (gimple_bind bind_stmt
)
3273 return &bind_stmt
->body
;
3276 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3278 static inline gimple_seq
3279 gimple_bind_body (gimple_bind gs
)
3281 return *gimple_bind_body_ptr (gs
);
3285 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3289 gimple_bind_set_body (gimple_bind bind_stmt
, gimple_seq seq
)
3291 bind_stmt
->body
= seq
;
3295 /* Append a statement to the end of a GIMPLE_BIND's body. */
3298 gimple_bind_add_stmt (gimple_bind bind_stmt
, gimple stmt
)
3300 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3304 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3307 gimple_bind_add_seq (gimple_bind bind_stmt
, gimple_seq seq
)
3309 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3313 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3314 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3317 gimple_bind_block (const_gimple_bind bind_stmt
)
3319 return bind_stmt
->block
;
3323 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3327 gimple_bind_set_block (gimple_bind bind_stmt
, tree block
)
3329 gcc_gimple_checking_assert (block
== NULL_TREE
3330 || TREE_CODE (block
) == BLOCK
);
3331 bind_stmt
->block
= block
;
3335 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3337 static inline unsigned
3338 gimple_asm_ninputs (const_gimple_asm asm_stmt
)
3340 return asm_stmt
->ni
;
3344 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3346 static inline unsigned
3347 gimple_asm_noutputs (const_gimple_asm asm_stmt
)
3349 return asm_stmt
->no
;
3353 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3355 static inline unsigned
3356 gimple_asm_nclobbers (const_gimple_asm asm_stmt
)
3358 return asm_stmt
->nc
;
3361 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3363 static inline unsigned
3364 gimple_asm_nlabels (const_gimple_asm asm_stmt
)
3366 return asm_stmt
->nl
;
3369 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3372 gimple_asm_input_op (const_gimple_asm asm_stmt
, unsigned index
)
3374 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3375 return gimple_op (asm_stmt
, index
+ asm_stmt
->no
);
3378 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3380 static inline tree
*
3381 gimple_asm_input_op_ptr (const_gimple_asm asm_stmt
, unsigned index
)
3383 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3384 return gimple_op_ptr (asm_stmt
, index
+ asm_stmt
->no
);
3388 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3391 gimple_asm_set_input_op (gimple_asm asm_stmt
, unsigned index
, tree in_op
)
3393 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3394 && TREE_CODE (in_op
) == TREE_LIST
);
3395 gimple_set_op (asm_stmt
, index
+ asm_stmt
->no
, in_op
);
3399 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3402 gimple_asm_output_op (const_gimple_asm asm_stmt
, unsigned index
)
3404 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3405 return gimple_op (asm_stmt
, index
);
3408 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3410 static inline tree
*
3411 gimple_asm_output_op_ptr (const_gimple_asm asm_stmt
, unsigned index
)
3413 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3414 return gimple_op_ptr (asm_stmt
, index
);
3418 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3421 gimple_asm_set_output_op (gimple_asm asm_stmt
, unsigned index
, tree out_op
)
3423 gcc_gimple_checking_assert (index
< asm_stmt
->no
3424 && TREE_CODE (out_op
) == TREE_LIST
);
3425 gimple_set_op (asm_stmt
, index
, out_op
);
3429 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3432 gimple_asm_clobber_op (const_gimple_asm asm_stmt
, unsigned index
)
3434 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3435 return gimple_op (asm_stmt
, index
+ asm_stmt
->ni
+ asm_stmt
->no
);
3439 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3442 gimple_asm_set_clobber_op (gimple_asm asm_stmt
, unsigned index
, tree clobber_op
)
3444 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3445 && TREE_CODE (clobber_op
) == TREE_LIST
);
3446 gimple_set_op (asm_stmt
, index
+ asm_stmt
->ni
+ asm_stmt
->no
, clobber_op
);
3449 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3452 gimple_asm_label_op (const_gimple_asm asm_stmt
, unsigned index
)
3454 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3455 return gimple_op (asm_stmt
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
);
3458 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3461 gimple_asm_set_label_op (gimple_asm asm_stmt
, unsigned index
, tree label_op
)
3463 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3464 && TREE_CODE (label_op
) == TREE_LIST
);
3465 gimple_set_op (asm_stmt
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
, label_op
);
3468 /* Return the string representing the assembly instruction in
3469 GIMPLE_ASM ASM_STMT. */
3471 static inline const char *
3472 gimple_asm_string (const_gimple_asm asm_stmt
)
3474 return asm_stmt
->string
;
3478 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3481 gimple_asm_volatile_p (const_gimple_asm asm_stmt
)
3483 return (asm_stmt
->subcode
& GF_ASM_VOLATILE
) != 0;
3487 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3490 gimple_asm_set_volatile (gimple_asm asm_stmt
, bool volatile_p
)
3493 asm_stmt
->subcode
|= GF_ASM_VOLATILE
;
3495 asm_stmt
->subcode
&= ~GF_ASM_VOLATILE
;
3499 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3502 gimple_asm_set_input (gimple_asm asm_stmt
, bool input_p
)
3505 asm_stmt
->subcode
|= GF_ASM_INPUT
;
3507 asm_stmt
->subcode
&= ~GF_ASM_INPUT
;
3511 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3514 gimple_asm_input_p (const_gimple_asm asm_stmt
)
3516 return (asm_stmt
->subcode
& GF_ASM_INPUT
) != 0;
3520 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3523 gimple_catch_types (const_gimple_catch catch_stmt
)
3525 return catch_stmt
->types
;
3529 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3531 static inline tree
*
3532 gimple_catch_types_ptr (gimple_catch catch_stmt
)
3534 return &catch_stmt
->types
;
3538 /* Return a pointer to the GIMPLE sequence representing the body of
3539 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3541 static inline gimple_seq
*
3542 gimple_catch_handler_ptr (gimple_catch catch_stmt
)
3544 return &catch_stmt
->handler
;
3548 /* Return the GIMPLE sequence representing the body of the handler of
3549 GIMPLE_CATCH statement CATCH_STMT. */
3551 static inline gimple_seq
3552 gimple_catch_handler (gimple_catch catch_stmt
)
3554 return *gimple_catch_handler_ptr (catch_stmt
);
3558 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3561 gimple_catch_set_types (gimple_catch catch_stmt
, tree t
)
3563 catch_stmt
->types
= t
;
3567 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3570 gimple_catch_set_handler (gimple_catch catch_stmt
, gimple_seq handler
)
3572 catch_stmt
->handler
= handler
;
3576 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3579 gimple_eh_filter_types (const_gimple gs
)
3581 const gimple_statement_eh_filter
*eh_filter_stmt
=
3582 as_a
<const gimple_statement_eh_filter
*> (gs
);
3583 return eh_filter_stmt
->types
;
3587 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3590 static inline tree
*
3591 gimple_eh_filter_types_ptr (gimple gs
)
3593 gimple_statement_eh_filter
*eh_filter_stmt
=
3594 as_a
<gimple_statement_eh_filter
*> (gs
);
3595 return &eh_filter_stmt
->types
;
3599 /* Return a pointer to the sequence of statement to execute when
3600 GIMPLE_EH_FILTER statement fails. */
3602 static inline gimple_seq
*
3603 gimple_eh_filter_failure_ptr (gimple gs
)
3605 gimple_statement_eh_filter
*eh_filter_stmt
=
3606 as_a
<gimple_statement_eh_filter
*> (gs
);
3607 return &eh_filter_stmt
->failure
;
3611 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3614 static inline gimple_seq
3615 gimple_eh_filter_failure (gimple gs
)
3617 return *gimple_eh_filter_failure_ptr (gs
);
3621 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3625 gimple_eh_filter_set_types (gimple_eh_filter eh_filter_stmt
, tree types
)
3627 eh_filter_stmt
->types
= types
;
3631 /* Set FAILURE to be the sequence of statements to execute on failure
3632 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3635 gimple_eh_filter_set_failure (gimple_eh_filter eh_filter_stmt
,
3638 eh_filter_stmt
->failure
= failure
;
3641 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3644 gimple_eh_must_not_throw_fndecl (gimple_eh_must_not_throw eh_mnt_stmt
)
3646 return eh_mnt_stmt
->fndecl
;
3649 /* Set the function decl to be called by GS to DECL. */
3652 gimple_eh_must_not_throw_set_fndecl (gimple_eh_must_not_throw eh_mnt_stmt
,
3655 eh_mnt_stmt
->fndecl
= decl
;
3658 /* GIMPLE_EH_ELSE accessors. */
3660 static inline gimple_seq
*
3661 gimple_eh_else_n_body_ptr (gimple_eh_else eh_else_stmt
)
3663 return &eh_else_stmt
->n_body
;
3666 static inline gimple_seq
3667 gimple_eh_else_n_body (gimple_eh_else eh_else_stmt
)
3669 return *gimple_eh_else_n_body_ptr (eh_else_stmt
);
3672 static inline gimple_seq
*
3673 gimple_eh_else_e_body_ptr (gimple_eh_else eh_else_stmt
)
3675 return &eh_else_stmt
->e_body
;
3678 static inline gimple_seq
3679 gimple_eh_else_e_body (gimple_eh_else eh_else_stmt
)
3681 return *gimple_eh_else_e_body_ptr (eh_else_stmt
);
3685 gimple_eh_else_set_n_body (gimple_eh_else eh_else_stmt
, gimple_seq seq
)
3687 eh_else_stmt
->n_body
= seq
;
3691 gimple_eh_else_set_e_body (gimple_eh_else eh_else_stmt
, gimple_seq seq
)
3693 eh_else_stmt
->e_body
= seq
;
3696 /* GIMPLE_TRY accessors. */
3698 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3699 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3701 static inline enum gimple_try_flags
3702 gimple_try_kind (const_gimple gs
)
3704 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3705 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
3709 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3712 gimple_try_set_kind (gimple_try gs
, enum gimple_try_flags kind
)
3714 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3715 || kind
== GIMPLE_TRY_FINALLY
);
3716 if (gimple_try_kind (gs
) != kind
)
3717 gs
->subcode
= (unsigned int) kind
;
3721 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3724 gimple_try_catch_is_cleanup (const_gimple gs
)
3726 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3727 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3731 /* Return a pointer to the sequence of statements used as the
3732 body for GIMPLE_TRY GS. */
3734 static inline gimple_seq
*
3735 gimple_try_eval_ptr (gimple gs
)
3737 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3738 return &try_stmt
->eval
;
3742 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3744 static inline gimple_seq
3745 gimple_try_eval (gimple gs
)
3747 return *gimple_try_eval_ptr (gs
);
3751 /* Return a pointer to the sequence of statements used as the cleanup body for
3754 static inline gimple_seq
*
3755 gimple_try_cleanup_ptr (gimple gs
)
3757 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3758 return &try_stmt
->cleanup
;
3762 /* Return the sequence of statements used as the cleanup body for
3765 static inline gimple_seq
3766 gimple_try_cleanup (gimple gs
)
3768 return *gimple_try_cleanup_ptr (gs
);
3772 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3775 gimple_try_set_catch_is_cleanup (gimple_try g
, bool catch_is_cleanup
)
3777 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3778 if (catch_is_cleanup
)
3779 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3781 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3785 /* Set EVAL to be the sequence of statements to use as the body for
3786 GIMPLE_TRY TRY_STMT. */
3789 gimple_try_set_eval (gimple_try try_stmt
, gimple_seq eval
)
3791 try_stmt
->eval
= eval
;
3795 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3796 body for GIMPLE_TRY TRY_STMT. */
3799 gimple_try_set_cleanup (gimple_try try_stmt
, gimple_seq cleanup
)
3801 try_stmt
->cleanup
= cleanup
;
3805 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3807 static inline gimple_seq
*
3808 gimple_wce_cleanup_ptr (gimple gs
)
3810 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3811 return &wce_stmt
->cleanup
;
3815 /* Return the cleanup sequence for cleanup statement GS. */
3817 static inline gimple_seq
3818 gimple_wce_cleanup (gimple gs
)
3820 return *gimple_wce_cleanup_ptr (gs
);
3824 /* Set CLEANUP to be the cleanup sequence for GS. */
3827 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3829 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3830 wce_stmt
->cleanup
= cleanup
;
3834 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3837 gimple_wce_cleanup_eh_only (const_gimple gs
)
3839 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3840 return gs
->subcode
!= 0;
3844 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3847 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3849 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3850 gs
->subcode
= (unsigned int) eh_only_p
;
3854 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3856 static inline unsigned
3857 gimple_phi_capacity (const_gimple gs
)
3859 const_gimple_phi phi_stmt
=
3860 as_a
<const_gimple_phi
> (gs
);
3861 return phi_stmt
->capacity
;
3865 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3866 be exactly the number of incoming edges for the basic block holding
3869 static inline unsigned
3870 gimple_phi_num_args (const_gimple gs
)
3872 const_gimple_phi phi_stmt
=
3873 as_a
<const_gimple_phi
> (gs
);
3874 return phi_stmt
->nargs
;
3878 /* Return the SSA name created by GIMPLE_PHI GS. */
3881 gimple_phi_result (const_gimple gs
)
3883 const_gimple_phi phi_stmt
=
3884 as_a
<const_gimple_phi
> (gs
);
3885 return phi_stmt
->result
;
3888 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3890 static inline tree
*
3891 gimple_phi_result_ptr (gimple gs
)
3893 gimple_phi phi_stmt
= as_a
<gimple_phi
> (gs
);
3894 return &phi_stmt
->result
;
3897 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
3900 gimple_phi_set_result (gimple_phi phi
, tree result
)
3902 phi
->result
= result
;
3903 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3904 SSA_NAME_DEF_STMT (result
) = phi
;
3908 /* Return the PHI argument corresponding to incoming edge INDEX for
3911 static inline struct phi_arg_d
*
3912 gimple_phi_arg (gimple gs
, unsigned index
)
3914 gimple_phi phi_stmt
= as_a
<gimple_phi
> (gs
);
3915 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
3916 return &(phi_stmt
->args
[index
]);
3919 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3920 for GIMPLE_PHI PHI. */
3923 gimple_phi_set_arg (gimple_phi phi
, unsigned index
, struct phi_arg_d
* phiarg
)
3925 gcc_gimple_checking_assert (index
<= phi
->nargs
);
3926 phi
->args
[index
] = *phiarg
;
3929 /* Return the PHI nodes for basic block BB, or NULL if there are no
3932 static inline gimple_seq
3933 phi_nodes (const_basic_block bb
)
3935 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3936 return bb
->il
.gimple
.phi_nodes
;
3939 /* Return a pointer to the PHI nodes for basic block BB. */
3941 static inline gimple_seq
*
3942 phi_nodes_ptr (basic_block bb
)
3944 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3945 return &bb
->il
.gimple
.phi_nodes
;
3948 /* Return the tree operand for argument I of PHI node GS. */
3951 gimple_phi_arg_def (gimple gs
, size_t index
)
3953 return gimple_phi_arg (gs
, index
)->def
;
3957 /* Return a pointer to the tree operand for argument I of phi node PHI. */
3959 static inline tree
*
3960 gimple_phi_arg_def_ptr (gimple_phi phi
, size_t index
)
3962 return &gimple_phi_arg (phi
, index
)->def
;
3965 /* Return the edge associated with argument I of phi node PHI. */
3968 gimple_phi_arg_edge (gimple_phi phi
, size_t i
)
3970 return EDGE_PRED (gimple_bb (phi
), i
);
3973 /* Return the source location of gimple argument I of phi node PHI. */
3975 static inline source_location
3976 gimple_phi_arg_location (gimple_phi phi
, size_t i
)
3978 return gimple_phi_arg (phi
, i
)->locus
;
3981 /* Return the source location of the argument on edge E of phi node PHI. */
3983 static inline source_location
3984 gimple_phi_arg_location_from_edge (gimple_phi phi
, edge e
)
3986 return gimple_phi_arg (phi
, e
->dest_idx
)->locus
;
3989 /* Set the source location of gimple argument I of phi node PHI to LOC. */
3992 gimple_phi_arg_set_location (gimple_phi phi
, size_t i
, source_location loc
)
3994 gimple_phi_arg (phi
, i
)->locus
= loc
;
3997 /* Return TRUE if argument I of phi node PHI has a location record. */
4000 gimple_phi_arg_has_location (gimple_phi phi
, size_t i
)
4002 return gimple_phi_arg_location (phi
, i
) != UNKNOWN_LOCATION
;
4006 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4009 gimple_resx_region (const_gimple_resx resx_stmt
)
4011 return resx_stmt
->region
;
4014 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4017 gimple_resx_set_region (gimple_resx resx_stmt
, int region
)
4019 resx_stmt
->region
= region
;
4022 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4025 gimple_eh_dispatch_region (const_gimple_eh_dispatch eh_dispatch_stmt
)
4027 return eh_dispatch_stmt
->region
;
4030 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4031 EH_DISPATCH_STMT. */
4034 gimple_eh_dispatch_set_region (gimple_eh_dispatch eh_dispatch_stmt
, int region
)
4036 eh_dispatch_stmt
->region
= region
;
4039 /* Return the number of labels associated with the switch statement GS. */
4041 static inline unsigned
4042 gimple_switch_num_labels (const_gimple_switch gs
)
4045 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4046 num_ops
= gimple_num_ops (gs
);
4047 gcc_gimple_checking_assert (num_ops
> 1);
4052 /* Set NLABELS to be the number of labels for the switch statement GS. */
4055 gimple_switch_set_num_labels (gimple_switch g
, unsigned nlabels
)
4057 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4058 gimple_set_num_ops (g
, nlabels
+ 1);
4062 /* Return the index variable used by the switch statement GS. */
4065 gimple_switch_index (const_gimple_switch gs
)
4067 return gimple_op (gs
, 0);
4071 /* Return a pointer to the index variable for the switch statement GS. */
4073 static inline tree
*
4074 gimple_switch_index_ptr (const_gimple_switch gs
)
4076 return gimple_op_ptr (gs
, 0);
4080 /* Set INDEX to be the index variable for switch statement GS. */
4083 gimple_switch_set_index (gimple_switch gs
, tree index
)
4085 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4086 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4087 gimple_set_op (gs
, 0, index
);
4091 /* Return the label numbered INDEX. The default label is 0, followed by any
4092 labels in a switch statement. */
4095 gimple_switch_label (const_gimple_switch gs
, unsigned index
)
4097 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4098 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4099 return gimple_op (gs
, index
+ 1);
4102 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4105 gimple_switch_set_label (gimple_switch gs
, unsigned index
, tree label
)
4107 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4108 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4109 && (label
== NULL_TREE
4110 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4111 gimple_set_op (gs
, index
+ 1, label
);
4114 /* Return the default label for a switch statement. */
4117 gimple_switch_default_label (const_gimple_switch gs
)
4119 tree label
= gimple_switch_label (gs
, 0);
4120 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4124 /* Set the default label for a switch statement. */
4127 gimple_switch_set_default_label (gimple_switch gs
, tree label
)
4129 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4130 gimple_switch_set_label (gs
, 0, label
);
4133 /* Return true if GS is a GIMPLE_DEBUG statement. */
4136 is_gimple_debug (const_gimple gs
)
4138 return gimple_code (gs
) == GIMPLE_DEBUG
;
4141 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4144 gimple_debug_bind_p (const_gimple s
)
4146 if (is_gimple_debug (s
))
4147 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4152 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4155 gimple_debug_bind_get_var (gimple dbg
)
4157 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4158 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4159 return gimple_op (dbg
, 0);
4162 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4166 gimple_debug_bind_get_value (gimple dbg
)
4168 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4169 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4170 return gimple_op (dbg
, 1);
4173 /* Return a pointer to the value bound to the variable in a
4174 GIMPLE_DEBUG bind statement. */
4176 static inline tree
*
4177 gimple_debug_bind_get_value_ptr (gimple dbg
)
4179 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4180 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4181 return gimple_op_ptr (dbg
, 1);
4184 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4187 gimple_debug_bind_set_var (gimple dbg
, tree var
)
4189 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4190 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4191 gimple_set_op (dbg
, 0, var
);
4194 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4198 gimple_debug_bind_set_value (gimple dbg
, tree value
)
4200 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4201 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4202 gimple_set_op (dbg
, 1, value
);
4205 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4207 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4209 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4213 gimple_debug_bind_reset_value (gimple dbg
)
4215 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4216 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4217 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4220 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4224 gimple_debug_bind_has_value_p (gimple dbg
)
4226 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4227 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4228 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4231 #undef GIMPLE_DEBUG_BIND_NOVALUE
4233 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4236 gimple_debug_source_bind_p (const_gimple s
)
4238 if (is_gimple_debug (s
))
4239 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4244 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4247 gimple_debug_source_bind_get_var (gimple dbg
)
4249 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4250 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4251 return gimple_op (dbg
, 0);
4254 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4258 gimple_debug_source_bind_get_value (gimple dbg
)
4260 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4261 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4262 return gimple_op (dbg
, 1);
4265 /* Return a pointer to the value bound to the variable in a
4266 GIMPLE_DEBUG source bind statement. */
4268 static inline tree
*
4269 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
4271 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4272 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4273 return gimple_op_ptr (dbg
, 1);
4276 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4279 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
4281 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4282 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4283 gimple_set_op (dbg
, 0, var
);
4286 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4290 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
4292 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4293 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4294 gimple_set_op (dbg
, 1, value
);
4297 /* Return the line number for EXPR, or return -1 if we have no line
4298 number information for it. */
4300 get_lineno (const_gimple stmt
)
4307 loc
= gimple_location (stmt
);
4308 if (loc
== UNKNOWN_LOCATION
)
4311 return LOCATION_LINE (loc
);
4314 /* Return a pointer to the body for the OMP statement GS. */
4316 static inline gimple_seq
*
4317 gimple_omp_body_ptr (gimple gs
)
4319 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4322 /* Return the body for the OMP statement GS. */
4324 static inline gimple_seq
4325 gimple_omp_body (gimple gs
)
4327 return *gimple_omp_body_ptr (gs
);
4330 /* Set BODY to be the body for the OMP statement GS. */
4333 gimple_omp_set_body (gimple gs
, gimple_seq body
)
4335 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4339 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4342 gimple_omp_critical_name (const_gimple_omp_critical crit_stmt
)
4344 return crit_stmt
->name
;
4348 /* Return a pointer to the name associated with OMP critical statement GS. */
4350 static inline tree
*
4351 gimple_omp_critical_name_ptr (gimple_omp_critical crit_stmt
)
4353 return &crit_stmt
->name
;
4357 /* Set NAME to be the name associated with OMP critical statement GS. */
4360 gimple_omp_critical_set_name (gimple_omp_critical crit_stmt
, tree name
)
4362 crit_stmt
->name
= name
;
4366 /* Return the kind of OMP for statemement. */
4369 gimple_omp_for_kind (const_gimple g
)
4371 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4372 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4376 /* Set the OMP for kind. */
4379 gimple_omp_for_set_kind (gimple_omp_for g
, int kind
)
4381 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4382 | (kind
& GF_OMP_FOR_KIND_MASK
);
4386 /* Return true if OMP for statement G has the
4387 GF_OMP_FOR_COMBINED flag set. */
4390 gimple_omp_for_combined_p (const_gimple g
)
4392 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4393 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4397 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4398 value of COMBINED_P. */
4401 gimple_omp_for_set_combined_p (gimple_omp_for g
, bool combined_p
)
4404 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4406 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4410 /* Return true if OMP for statement G has the
4411 GF_OMP_FOR_COMBINED_INTO flag set. */
4414 gimple_omp_for_combined_into_p (const_gimple g
)
4416 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4417 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4421 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4422 value of COMBINED_P. */
4425 gimple_omp_for_set_combined_into_p (gimple_omp_for g
, bool combined_p
)
4428 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4430 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4434 /* Return the clauses associated with OMP_FOR GS. */
4437 gimple_omp_for_clauses (const_gimple gs
)
4439 const gimple_statement_omp_for
*omp_for_stmt
=
4440 as_a
<const gimple_statement_omp_for
*> (gs
);
4441 return omp_for_stmt
->clauses
;
4445 /* Return a pointer to the OMP_FOR GS. */
4447 static inline tree
*
4448 gimple_omp_for_clauses_ptr (gimple gs
)
4450 gimple_statement_omp_for
*omp_for_stmt
=
4451 as_a
<gimple_statement_omp_for
*> (gs
);
4452 return &omp_for_stmt
->clauses
;
4456 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4459 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
4461 gimple_statement_omp_for
*omp_for_stmt
=
4462 as_a
<gimple_statement_omp_for
*> (gs
);
4463 omp_for_stmt
->clauses
= clauses
;
4467 /* Get the collapse count of OMP_FOR GS. */
4469 static inline size_t
4470 gimple_omp_for_collapse (gimple gs
)
4472 gimple_statement_omp_for
*omp_for_stmt
=
4473 as_a
<gimple_statement_omp_for
*> (gs
);
4474 return omp_for_stmt
->collapse
;
4478 /* Return the index variable for OMP_FOR GS. */
4481 gimple_omp_for_index (const_gimple gs
, size_t i
)
4483 const gimple_statement_omp_for
*omp_for_stmt
=
4484 as_a
<const gimple_statement_omp_for
*> (gs
);
4485 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4486 return omp_for_stmt
->iter
[i
].index
;
4490 /* Return a pointer to the index variable for OMP_FOR GS. */
4492 static inline tree
*
4493 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
4495 gimple_statement_omp_for
*omp_for_stmt
=
4496 as_a
<gimple_statement_omp_for
*> (gs
);
4497 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4498 return &omp_for_stmt
->iter
[i
].index
;
4502 /* Set INDEX to be the index variable for OMP_FOR GS. */
4505 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
4507 gimple_statement_omp_for
*omp_for_stmt
=
4508 as_a
<gimple_statement_omp_for
*> (gs
);
4509 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4510 omp_for_stmt
->iter
[i
].index
= index
;
4514 /* Return the initial value for OMP_FOR GS. */
4517 gimple_omp_for_initial (const_gimple gs
, size_t i
)
4519 const gimple_statement_omp_for
*omp_for_stmt
=
4520 as_a
<const gimple_statement_omp_for
*> (gs
);
4521 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4522 return omp_for_stmt
->iter
[i
].initial
;
4526 /* Return a pointer to the initial value for OMP_FOR GS. */
4528 static inline tree
*
4529 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
4531 gimple_statement_omp_for
*omp_for_stmt
=
4532 as_a
<gimple_statement_omp_for
*> (gs
);
4533 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4534 return &omp_for_stmt
->iter
[i
].initial
;
4538 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4541 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4543 gimple_statement_omp_for
*omp_for_stmt
=
4544 as_a
<gimple_statement_omp_for
*> (gs
);
4545 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4546 omp_for_stmt
->iter
[i
].initial
= initial
;
4550 /* Return the final value for OMP_FOR GS. */
4553 gimple_omp_for_final (const_gimple gs
, size_t i
)
4555 const gimple_statement_omp_for
*omp_for_stmt
=
4556 as_a
<const gimple_statement_omp_for
*> (gs
);
4557 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4558 return omp_for_stmt
->iter
[i
].final
;
4562 /* Return a pointer to the final value for OMP_FOR GS. */
4564 static inline tree
*
4565 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4567 gimple_statement_omp_for
*omp_for_stmt
=
4568 as_a
<gimple_statement_omp_for
*> (gs
);
4569 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4570 return &omp_for_stmt
->iter
[i
].final
;
4574 /* Set FINAL to be the final value for OMP_FOR GS. */
4577 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4579 gimple_statement_omp_for
*omp_for_stmt
=
4580 as_a
<gimple_statement_omp_for
*> (gs
);
4581 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4582 omp_for_stmt
->iter
[i
].final
= final
;
4586 /* Return the increment value for OMP_FOR GS. */
4589 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4591 const gimple_statement_omp_for
*omp_for_stmt
=
4592 as_a
<const gimple_statement_omp_for
*> (gs
);
4593 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4594 return omp_for_stmt
->iter
[i
].incr
;
4598 /* Return a pointer to the increment value for OMP_FOR GS. */
4600 static inline tree
*
4601 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4603 gimple_statement_omp_for
*omp_for_stmt
=
4604 as_a
<gimple_statement_omp_for
*> (gs
);
4605 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4606 return &omp_for_stmt
->iter
[i
].incr
;
4610 /* Set INCR to be the increment value for OMP_FOR GS. */
4613 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4615 gimple_statement_omp_for
*omp_for_stmt
=
4616 as_a
<gimple_statement_omp_for
*> (gs
);
4617 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4618 omp_for_stmt
->iter
[i
].incr
= incr
;
4622 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4623 statement GS starts. */
4625 static inline gimple_seq
*
4626 gimple_omp_for_pre_body_ptr (gimple gs
)
4628 gimple_statement_omp_for
*omp_for_stmt
=
4629 as_a
<gimple_statement_omp_for
*> (gs
);
4630 return &omp_for_stmt
->pre_body
;
4634 /* Return the sequence of statements to execute before the OMP_FOR
4635 statement GS starts. */
4637 static inline gimple_seq
4638 gimple_omp_for_pre_body (gimple gs
)
4640 return *gimple_omp_for_pre_body_ptr (gs
);
4644 /* Set PRE_BODY to be the sequence of statements to execute before the
4645 OMP_FOR statement GS starts. */
4648 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4650 gimple_statement_omp_for
*omp_for_stmt
=
4651 as_a
<gimple_statement_omp_for
*> (gs
);
4652 omp_for_stmt
->pre_body
= pre_body
;
4656 /* Return the clauses associated with OMP_PARALLEL GS. */
4659 gimple_omp_parallel_clauses (const_gimple gs
)
4661 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4662 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4663 return omp_parallel_stmt
->clauses
;
4667 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
4669 static inline tree
*
4670 gimple_omp_parallel_clauses_ptr (gimple_omp_parallel omp_parallel_stmt
)
4672 return &omp_parallel_stmt
->clauses
;
4676 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
4679 gimple_omp_parallel_set_clauses (gimple_omp_parallel omp_parallel_stmt
,
4682 omp_parallel_stmt
->clauses
= clauses
;
4686 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
4689 gimple_omp_parallel_child_fn (const_gimple_omp_parallel omp_parallel_stmt
)
4691 return omp_parallel_stmt
->child_fn
;
4694 /* Return a pointer to the child function used to hold the body of
4695 OMP_PARALLEL_STMT. */
4697 static inline tree
*
4698 gimple_omp_parallel_child_fn_ptr (gimple_omp_parallel omp_parallel_stmt
)
4700 return &omp_parallel_stmt
->child_fn
;
4704 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
4707 gimple_omp_parallel_set_child_fn (gimple_omp_parallel omp_parallel_stmt
,
4710 omp_parallel_stmt
->child_fn
= child_fn
;
4714 /* Return the artificial argument used to send variables and values
4715 from the parent to the children threads in OMP_PARALLEL_STMT. */
4718 gimple_omp_parallel_data_arg (const_gimple_omp_parallel omp_parallel_stmt
)
4720 return omp_parallel_stmt
->data_arg
;
4724 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
4726 static inline tree
*
4727 gimple_omp_parallel_data_arg_ptr (gimple_omp_parallel omp_parallel_stmt
)
4729 return &omp_parallel_stmt
->data_arg
;
4733 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
4736 gimple_omp_parallel_set_data_arg (gimple_omp_parallel omp_parallel_stmt
,
4739 omp_parallel_stmt
->data_arg
= data_arg
;
4743 /* Return the clauses associated with OMP_TASK GS. */
4746 gimple_omp_task_clauses (const_gimple gs
)
4748 const gimple_statement_omp_task
*omp_task_stmt
=
4749 as_a
<const gimple_statement_omp_task
*> (gs
);
4750 return omp_task_stmt
->clauses
;
4754 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4756 static inline tree
*
4757 gimple_omp_task_clauses_ptr (gimple gs
)
4759 gimple_statement_omp_task
*omp_task_stmt
=
4760 as_a
<gimple_statement_omp_task
*> (gs
);
4761 return &omp_task_stmt
->clauses
;
4765 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4769 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4771 gimple_statement_omp_task
*omp_task_stmt
=
4772 as_a
<gimple_statement_omp_task
*> (gs
);
4773 omp_task_stmt
->clauses
= clauses
;
4777 /* Return the child function used to hold the body of OMP_TASK GS. */
4780 gimple_omp_task_child_fn (const_gimple gs
)
4782 const gimple_statement_omp_task
*omp_task_stmt
=
4783 as_a
<const gimple_statement_omp_task
*> (gs
);
4784 return omp_task_stmt
->child_fn
;
4787 /* Return a pointer to the child function used to hold the body of
4790 static inline tree
*
4791 gimple_omp_task_child_fn_ptr (gimple gs
)
4793 gimple_statement_omp_task
*omp_task_stmt
=
4794 as_a
<gimple_statement_omp_task
*> (gs
);
4795 return &omp_task_stmt
->child_fn
;
4799 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4802 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4804 gimple_statement_omp_task
*omp_task_stmt
=
4805 as_a
<gimple_statement_omp_task
*> (gs
);
4806 omp_task_stmt
->child_fn
= child_fn
;
4810 /* Return the artificial argument used to send variables and values
4811 from the parent to the children threads in OMP_TASK GS. */
4814 gimple_omp_task_data_arg (const_gimple gs
)
4816 const gimple_statement_omp_task
*omp_task_stmt
=
4817 as_a
<const gimple_statement_omp_task
*> (gs
);
4818 return omp_task_stmt
->data_arg
;
4822 /* Return a pointer to the data argument for OMP_TASK GS. */
4824 static inline tree
*
4825 gimple_omp_task_data_arg_ptr (gimple gs
)
4827 gimple_statement_omp_task
*omp_task_stmt
=
4828 as_a
<gimple_statement_omp_task
*> (gs
);
4829 return &omp_task_stmt
->data_arg
;
4833 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4836 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4838 gimple_statement_omp_task
*omp_task_stmt
=
4839 as_a
<gimple_statement_omp_task
*> (gs
);
4840 omp_task_stmt
->data_arg
= data_arg
;
4844 /* Return the clauses associated with OMP_TASK GS. */
4847 gimple_omp_taskreg_clauses (const_gimple gs
)
4849 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4850 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4851 return omp_taskreg_stmt
->clauses
;
4855 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4857 static inline tree
*
4858 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4860 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4861 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4862 return &omp_taskreg_stmt
->clauses
;
4866 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4870 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4872 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4873 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4874 omp_taskreg_stmt
->clauses
= clauses
;
4878 /* Return the child function used to hold the body of OMP_TASK GS. */
4881 gimple_omp_taskreg_child_fn (const_gimple gs
)
4883 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4884 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4885 return omp_taskreg_stmt
->child_fn
;
4888 /* Return a pointer to the child function used to hold the body of
4891 static inline tree
*
4892 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4894 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4895 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4896 return &omp_taskreg_stmt
->child_fn
;
4900 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4903 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4905 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4906 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4907 omp_taskreg_stmt
->child_fn
= child_fn
;
4911 /* Return the artificial argument used to send variables and values
4912 from the parent to the children threads in OMP_TASK GS. */
4915 gimple_omp_taskreg_data_arg (const_gimple gs
)
4917 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4918 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4919 return omp_taskreg_stmt
->data_arg
;
4923 /* Return a pointer to the data argument for OMP_TASK GS. */
4925 static inline tree
*
4926 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4928 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4929 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4930 return &omp_taskreg_stmt
->data_arg
;
4934 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4937 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4939 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4940 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4941 omp_taskreg_stmt
->data_arg
= data_arg
;
4945 /* Return the copy function used to hold the body of OMP_TASK GS. */
4948 gimple_omp_task_copy_fn (const_gimple gs
)
4950 const gimple_statement_omp_task
*omp_task_stmt
=
4951 as_a
<const gimple_statement_omp_task
*> (gs
);
4952 return omp_task_stmt
->copy_fn
;
4955 /* Return a pointer to the copy function used to hold the body of
4958 static inline tree
*
4959 gimple_omp_task_copy_fn_ptr (gimple gs
)
4961 gimple_statement_omp_task
*omp_task_stmt
=
4962 as_a
<gimple_statement_omp_task
*> (gs
);
4963 return &omp_task_stmt
->copy_fn
;
4967 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4970 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4972 gimple_statement_omp_task
*omp_task_stmt
=
4973 as_a
<gimple_statement_omp_task
*> (gs
);
4974 omp_task_stmt
->copy_fn
= copy_fn
;
4978 /* Return size of the data block in bytes in OMP_TASK GS. */
4981 gimple_omp_task_arg_size (const_gimple gs
)
4983 const gimple_statement_omp_task
*omp_task_stmt
=
4984 as_a
<const gimple_statement_omp_task
*> (gs
);
4985 return omp_task_stmt
->arg_size
;
4989 /* Return a pointer to the data block size for OMP_TASK GS. */
4991 static inline tree
*
4992 gimple_omp_task_arg_size_ptr (gimple gs
)
4994 gimple_statement_omp_task
*omp_task_stmt
=
4995 as_a
<gimple_statement_omp_task
*> (gs
);
4996 return &omp_task_stmt
->arg_size
;
5000 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5003 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
5005 gimple_statement_omp_task
*omp_task_stmt
=
5006 as_a
<gimple_statement_omp_task
*> (gs
);
5007 omp_task_stmt
->arg_size
= arg_size
;
5011 /* Return align of the data block in bytes in OMP_TASK GS. */
5014 gimple_omp_task_arg_align (const_gimple gs
)
5016 const gimple_statement_omp_task
*omp_task_stmt
=
5017 as_a
<const gimple_statement_omp_task
*> (gs
);
5018 return omp_task_stmt
->arg_align
;
5022 /* Return a pointer to the data block align for OMP_TASK GS. */
5024 static inline tree
*
5025 gimple_omp_task_arg_align_ptr (gimple gs
)
5027 gimple_statement_omp_task
*omp_task_stmt
=
5028 as_a
<gimple_statement_omp_task
*> (gs
);
5029 return &omp_task_stmt
->arg_align
;
5033 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5036 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
5038 gimple_statement_omp_task
*omp_task_stmt
=
5039 as_a
<gimple_statement_omp_task
*> (gs
);
5040 omp_task_stmt
->arg_align
= arg_align
;
5044 /* Return the clauses associated with OMP_SINGLE GS. */
5047 gimple_omp_single_clauses (const_gimple gs
)
5049 const gimple_statement_omp_single
*omp_single_stmt
=
5050 as_a
<const gimple_statement_omp_single
*> (gs
);
5051 return omp_single_stmt
->clauses
;
5055 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5057 static inline tree
*
5058 gimple_omp_single_clauses_ptr (gimple gs
)
5060 gimple_statement_omp_single
*omp_single_stmt
=
5061 as_a
<gimple_statement_omp_single
*> (gs
);
5062 return &omp_single_stmt
->clauses
;
5066 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5069 gimple_omp_single_set_clauses (gimple_omp_single omp_single_stmt
, tree clauses
)
5071 omp_single_stmt
->clauses
= clauses
;
5075 /* Return the clauses associated with OMP_TARGET GS. */
5078 gimple_omp_target_clauses (const_gimple gs
)
5080 const gimple_statement_omp_target
*omp_target_stmt
=
5081 as_a
<const gimple_statement_omp_target
*> (gs
);
5082 return omp_target_stmt
->clauses
;
5086 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5088 static inline tree
*
5089 gimple_omp_target_clauses_ptr (gimple gs
)
5091 gimple_statement_omp_target
*omp_target_stmt
=
5092 as_a
<gimple_statement_omp_target
*> (gs
);
5093 return &omp_target_stmt
->clauses
;
5097 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5100 gimple_omp_target_set_clauses (gimple_omp_target omp_target_stmt
,
5103 omp_target_stmt
->clauses
= clauses
;
5107 /* Return the kind of OMP target statemement. */
5110 gimple_omp_target_kind (const_gimple g
)
5112 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5113 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5117 /* Set the OMP target kind. */
5120 gimple_omp_target_set_kind (gimple_omp_target g
, int kind
)
5122 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5123 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5127 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5130 gimple_omp_target_child_fn (const_gimple_omp_target omp_target_stmt
)
5132 return omp_target_stmt
->child_fn
;
5135 /* Return a pointer to the child function used to hold the body of
5138 static inline tree
*
5139 gimple_omp_target_child_fn_ptr (gimple_omp_target omp_target_stmt
)
5141 return &omp_target_stmt
->child_fn
;
5145 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5148 gimple_omp_target_set_child_fn (gimple_omp_target omp_target_stmt
,
5151 omp_target_stmt
->child_fn
= child_fn
;
5155 /* Return the artificial argument used to send variables and values
5156 from the parent to the children threads in OMP_TARGET_STMT. */
5159 gimple_omp_target_data_arg (const_gimple_omp_target omp_target_stmt
)
5161 return omp_target_stmt
->data_arg
;
5165 /* Return a pointer to the data argument for OMP_TARGET GS. */
5167 static inline tree
*
5168 gimple_omp_target_data_arg_ptr (gimple_omp_target omp_target_stmt
)
5170 return &omp_target_stmt
->data_arg
;
5174 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5177 gimple_omp_target_set_data_arg (gimple_omp_target omp_target_stmt
,
5180 omp_target_stmt
->data_arg
= data_arg
;
5184 /* Return the clauses associated with OMP_TEAMS GS. */
5187 gimple_omp_teams_clauses (const_gimple gs
)
5189 const gimple_statement_omp_teams
*omp_teams_stmt
=
5190 as_a
<const gimple_statement_omp_teams
*> (gs
);
5191 return omp_teams_stmt
->clauses
;
5195 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5197 static inline tree
*
5198 gimple_omp_teams_clauses_ptr (gimple gs
)
5200 gimple_statement_omp_teams
*omp_teams_stmt
=
5201 as_a
<gimple_statement_omp_teams
*> (gs
);
5202 return &omp_teams_stmt
->clauses
;
5206 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5209 gimple_omp_teams_set_clauses (gimple_omp_teams omp_teams_stmt
, tree clauses
)
5211 omp_teams_stmt
->clauses
= clauses
;
5215 /* Return the clauses associated with OMP_SECTIONS GS. */
5218 gimple_omp_sections_clauses (const_gimple gs
)
5220 const gimple_statement_omp_sections
*omp_sections_stmt
=
5221 as_a
<const gimple_statement_omp_sections
*> (gs
);
5222 return omp_sections_stmt
->clauses
;
5226 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5228 static inline tree
*
5229 gimple_omp_sections_clauses_ptr (gimple gs
)
5231 gimple_statement_omp_sections
*omp_sections_stmt
=
5232 as_a
<gimple_statement_omp_sections
*> (gs
);
5233 return &omp_sections_stmt
->clauses
;
5237 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5241 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
5243 gimple_statement_omp_sections
*omp_sections_stmt
=
5244 as_a
<gimple_statement_omp_sections
*> (gs
);
5245 omp_sections_stmt
->clauses
= clauses
;
5249 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5253 gimple_omp_sections_control (const_gimple gs
)
5255 const gimple_statement_omp_sections
*omp_sections_stmt
=
5256 as_a
<const gimple_statement_omp_sections
*> (gs
);
5257 return omp_sections_stmt
->control
;
5261 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5264 static inline tree
*
5265 gimple_omp_sections_control_ptr (gimple gs
)
5267 gimple_statement_omp_sections
*omp_sections_stmt
=
5268 as_a
<gimple_statement_omp_sections
*> (gs
);
5269 return &omp_sections_stmt
->control
;
5273 /* Set CONTROL to be the set of clauses associated with the
5274 GIMPLE_OMP_SECTIONS in GS. */
5277 gimple_omp_sections_set_control (gimple gs
, tree control
)
5279 gimple_statement_omp_sections
*omp_sections_stmt
=
5280 as_a
<gimple_statement_omp_sections
*> (gs
);
5281 omp_sections_stmt
->control
= control
;
5285 /* Set COND to be the condition code for OMP_FOR GS. */
5288 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
5290 gimple_statement_omp_for
*omp_for_stmt
=
5291 as_a
<gimple_statement_omp_for
*> (gs
);
5292 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5293 && i
< omp_for_stmt
->collapse
);
5294 omp_for_stmt
->iter
[i
].cond
= cond
;
5298 /* Return the condition code associated with OMP_FOR GS. */
5300 static inline enum tree_code
5301 gimple_omp_for_cond (const_gimple gs
, size_t i
)
5303 const gimple_statement_omp_for
*omp_for_stmt
=
5304 as_a
<const gimple_statement_omp_for
*> (gs
);
5305 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5306 return omp_for_stmt
->iter
[i
].cond
;
5310 /* Set the value being stored in an atomic store. */
5313 gimple_omp_atomic_store_set_val (gimple_omp_atomic_store store_stmt
, tree val
)
5315 store_stmt
->val
= val
;
5319 /* Return the value being stored in an atomic store. */
5322 gimple_omp_atomic_store_val (const_gimple_omp_atomic_store store_stmt
)
5324 return store_stmt
->val
;
5328 /* Return a pointer to the value being stored in an atomic store. */
5330 static inline tree
*
5331 gimple_omp_atomic_store_val_ptr (gimple_omp_atomic_store store_stmt
)
5333 return &store_stmt
->val
;
5337 /* Set the LHS of an atomic load. */
5340 gimple_omp_atomic_load_set_lhs (gimple_omp_atomic_load load_stmt
, tree lhs
)
5342 load_stmt
->lhs
= lhs
;
5346 /* Get the LHS of an atomic load. */
5349 gimple_omp_atomic_load_lhs (const_gimple_omp_atomic_load load_stmt
)
5351 return load_stmt
->lhs
;
5355 /* Return a pointer to the LHS of an atomic load. */
5357 static inline tree
*
5358 gimple_omp_atomic_load_lhs_ptr (gimple_omp_atomic_load load_stmt
)
5360 return &load_stmt
->lhs
;
5364 /* Set the RHS of an atomic load. */
5367 gimple_omp_atomic_load_set_rhs (gimple_omp_atomic_load load_stmt
, tree rhs
)
5369 load_stmt
->rhs
= rhs
;
5373 /* Get the RHS of an atomic load. */
5376 gimple_omp_atomic_load_rhs (const_gimple_omp_atomic_load load_stmt
)
5378 return load_stmt
->rhs
;
5382 /* Return a pointer to the RHS of an atomic load. */
5384 static inline tree
*
5385 gimple_omp_atomic_load_rhs_ptr (gimple_omp_atomic_load load_stmt
)
5387 return &load_stmt
->rhs
;
5391 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5394 gimple_omp_continue_control_def (const_gimple_omp_continue cont_stmt
)
5396 return cont_stmt
->control_def
;
5399 /* The same as above, but return the address. */
5401 static inline tree
*
5402 gimple_omp_continue_control_def_ptr (gimple_omp_continue cont_stmt
)
5404 return &cont_stmt
->control_def
;
5407 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5410 gimple_omp_continue_set_control_def (gimple_omp_continue cont_stmt
, tree def
)
5412 cont_stmt
->control_def
= def
;
5416 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5419 gimple_omp_continue_control_use (const_gimple_omp_continue cont_stmt
)
5421 return cont_stmt
->control_use
;
5425 /* The same as above, but return the address. */
5427 static inline tree
*
5428 gimple_omp_continue_control_use_ptr (gimple_omp_continue cont_stmt
)
5430 return &cont_stmt
->control_use
;
5434 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5437 gimple_omp_continue_set_control_use (gimple_omp_continue cont_stmt
, tree use
)
5439 cont_stmt
->control_use
= use
;
5442 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5443 TRANSACTION_STMT. */
5445 static inline gimple_seq
*
5446 gimple_transaction_body_ptr (gimple_transaction transaction_stmt
)
5448 return &transaction_stmt
->body
;
5451 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5453 static inline gimple_seq
5454 gimple_transaction_body (gimple_transaction transaction_stmt
)
5456 return *gimple_transaction_body_ptr (transaction_stmt
);
5459 /* Return the label associated with a GIMPLE_TRANSACTION. */
5462 gimple_transaction_label (const_gimple_transaction transaction_stmt
)
5464 return transaction_stmt
->label
;
5467 static inline tree
*
5468 gimple_transaction_label_ptr (gimple_transaction transaction_stmt
)
5470 return &transaction_stmt
->label
;
5473 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5475 static inline unsigned int
5476 gimple_transaction_subcode (const_gimple_transaction transaction_stmt
)
5478 return transaction_stmt
->subcode
;
5481 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5482 TRANSACTION_STMT. */
5485 gimple_transaction_set_body (gimple_transaction transaction_stmt
,
5488 transaction_stmt
->body
= body
;
5491 /* Set the label associated with a GIMPLE_TRANSACTION. */
5494 gimple_transaction_set_label (gimple_transaction transaction_stmt
, tree label
)
5496 transaction_stmt
->label
= label
;
5499 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5502 gimple_transaction_set_subcode (gimple_transaction transaction_stmt
,
5503 unsigned int subcode
)
5505 transaction_stmt
->subcode
= subcode
;
5509 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5511 static inline tree
*
5512 gimple_return_retval_ptr (const_gimple_return gs
)
5514 return gimple_op_ptr (gs
, 0);
5517 /* Return the return value for GIMPLE_RETURN GS. */
5520 gimple_return_retval (const_gimple_return gs
)
5522 return gimple_op (gs
, 0);
5526 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5529 gimple_return_set_retval (gimple_return gs
, tree retval
)
5531 gimple_set_op (gs
, 0, retval
);
5535 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5537 #define CASE_GIMPLE_OMP \
5538 case GIMPLE_OMP_PARALLEL: \
5539 case GIMPLE_OMP_TASK: \
5540 case GIMPLE_OMP_FOR: \
5541 case GIMPLE_OMP_SECTIONS: \
5542 case GIMPLE_OMP_SECTIONS_SWITCH: \
5543 case GIMPLE_OMP_SINGLE: \
5544 case GIMPLE_OMP_TARGET: \
5545 case GIMPLE_OMP_TEAMS: \
5546 case GIMPLE_OMP_SECTION: \
5547 case GIMPLE_OMP_MASTER: \
5548 case GIMPLE_OMP_TASKGROUP: \
5549 case GIMPLE_OMP_ORDERED: \
5550 case GIMPLE_OMP_CRITICAL: \
5551 case GIMPLE_OMP_RETURN: \
5552 case GIMPLE_OMP_ATOMIC_LOAD: \
5553 case GIMPLE_OMP_ATOMIC_STORE: \
5554 case GIMPLE_OMP_CONTINUE
5557 is_gimple_omp (const_gimple stmt
)
5559 switch (gimple_code (stmt
))
5569 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5572 gimple_nop_p (const_gimple g
)
5574 return gimple_code (g
) == GIMPLE_NOP
;
5578 /* Return true if GS is a GIMPLE_RESX. */
5581 is_gimple_resx (const_gimple gs
)
5583 return gimple_code (gs
) == GIMPLE_RESX
;
5586 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5588 static inline enum br_predictor
5589 gimple_predict_predictor (gimple gs
)
5591 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5592 return (enum br_predictor
) (gs
->subcode
& ~GF_PREDICT_TAKEN
);
5596 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5599 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5601 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5602 gs
->subcode
= (gs
->subcode
& GF_PREDICT_TAKEN
)
5603 | (unsigned) predictor
;
5607 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5609 static inline enum prediction
5610 gimple_predict_outcome (gimple gs
)
5612 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5613 return (gs
->subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5617 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5620 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5622 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5623 if (outcome
== TAKEN
)
5624 gs
->subcode
|= GF_PREDICT_TAKEN
;
5626 gs
->subcode
&= ~GF_PREDICT_TAKEN
;
5630 /* Return the type of the main expression computed by STMT. Return
5631 void_type_node if the statement computes nothing. */
5634 gimple_expr_type (const_gimple stmt
)
5636 enum gimple_code code
= gimple_code (stmt
);
5638 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5641 /* In general we want to pass out a type that can be substituted
5642 for both the RHS and the LHS types if there is a possibly
5643 useless conversion involved. That means returning the
5644 original RHS type as far as we can reconstruct it. */
5645 if (code
== GIMPLE_CALL
)
5647 const_gimple_call call_stmt
= as_a
<const_gimple_call
> (stmt
);
5648 if (gimple_call_internal_p (call_stmt
)
5649 && gimple_call_internal_fn (call_stmt
) == IFN_MASK_STORE
)
5650 type
= TREE_TYPE (gimple_call_arg (call_stmt
, 3));
5652 type
= gimple_call_return_type (call_stmt
);
5655 switch (gimple_assign_rhs_code (stmt
))
5657 case POINTER_PLUS_EXPR
:
5658 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5662 /* As fallback use the type of the LHS. */
5663 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5668 else if (code
== GIMPLE_COND
)
5669 return boolean_type_node
;
5671 return void_type_node
;
5674 /* Enum and arrays used for allocation stats. Keep in sync with
5675 gimple.c:gimple_alloc_kind_names. */
5676 enum gimple_alloc_kind
5678 gimple_alloc_kind_assign
, /* Assignments. */
5679 gimple_alloc_kind_phi
, /* PHI nodes. */
5680 gimple_alloc_kind_cond
, /* Conditionals. */
5681 gimple_alloc_kind_rest
, /* Everything else. */
5682 gimple_alloc_kind_all
5685 extern int gimple_alloc_counts
[];
5686 extern int gimple_alloc_sizes
[];
5688 /* Return the allocation kind for a given stmt CODE. */
5689 static inline enum gimple_alloc_kind
5690 gimple_alloc_kind (enum gimple_code code
)
5695 return gimple_alloc_kind_assign
;
5697 return gimple_alloc_kind_phi
;
5699 return gimple_alloc_kind_cond
;
5701 return gimple_alloc_kind_rest
;
5705 /* Return true if a location should not be emitted for this statement
5706 by annotate_all_with_location. */
5709 gimple_do_not_emit_location_p (gimple g
)
5711 return gimple_plf (g
, GF_PLF_1
);
5714 /* Mark statement G so a location will not be emitted by
5715 annotate_one_with_location. */
5718 gimple_set_do_not_emit_location (gimple g
)
5720 /* The PLF flags are initialized to 0 when a new tuple is created,
5721 so no need to initialize it anywhere. */
5722 gimple_set_plf (g
, GF_PLF_1
, true);
5726 /* Macros for showing usage statistics. */
5727 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5729 : ((x) < 1024*1024*10 \
5731 : (x) / (1024*1024))))
5733 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5735 #endif /* GCC_GIMPLE_H */