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
;
27 /* For each block, the PHI nodes that need to be rewritten are stored into
29 typedef vec
<gimple
> gimple_vec
;
32 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
35 LAST_AND_UNUSED_GIMPLE_CODE
38 extern const char *const gimple_code_name
[];
39 extern const unsigned char gimple_rhs_class_table
[];
41 /* Error out if a gimple tuple is addressed incorrectly. */
42 #if defined ENABLE_GIMPLE_CHECKING
43 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
44 extern void gimple_check_failed (const_gimple
, const char *, int, \
45 const char *, enum gimple_code
, \
46 enum tree_code
) ATTRIBUTE_NORETURN
;
48 #define GIMPLE_CHECK(GS, CODE) \
50 const_gimple __gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
55 #else /* not ENABLE_GIMPLE_CHECKING */
56 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
57 #define GIMPLE_CHECK(GS, CODE) (void)0
60 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
61 get_gimple_rhs_class. */
64 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
65 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
66 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
67 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
68 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
69 name, a _DECL, a _REF, etc. */
72 /* Specific flags for individual GIMPLE statements. These flags are
73 always stored in gimple_statement_base.subcode and they may only be
74 defined for statement codes that do not use subcodes.
76 Values for the masks can overlap as long as the overlapping values
77 are never used in the same statement class.
79 The maximum mask value that can be defined is 1 << 15 (i.e., each
80 statement code can hold up to 16 bitflags).
82 Keep this list sorted. */
84 GF_ASM_INPUT
= 1 << 0,
85 GF_ASM_VOLATILE
= 1 << 1,
86 GF_CALL_FROM_THUNK
= 1 << 0,
87 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
88 GF_CALL_TAILCALL
= 1 << 2,
89 GF_CALL_VA_ARG_PACK
= 1 << 3,
90 GF_CALL_NOTHROW
= 1 << 4,
91 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
92 GF_CALL_INTERNAL
= 1 << 6,
93 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
94 GF_OMP_FOR_KIND_MASK
= (1 << 3) - 1,
95 GF_OMP_FOR_KIND_FOR
= 0,
96 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
97 GF_OMP_FOR_KIND_OACC_LOOP
= 2,
98 /* Flag for SIMD variants of OMP_FOR kinds. */
99 GF_OMP_FOR_SIMD
= 1 << 2,
100 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
101 GF_OMP_FOR_KIND_CILKSIMD
= GF_OMP_FOR_SIMD
| 1,
102 GF_OMP_FOR_COMBINED
= 1 << 3,
103 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
104 GF_OMP_TARGET_KIND_MASK
= (1 << 3) - 1,
105 GF_OMP_TARGET_KIND_REGION
= 0,
106 GF_OMP_TARGET_KIND_DATA
= 1,
107 GF_OMP_TARGET_KIND_UPDATE
= 2,
108 GF_OMP_TARGET_KIND_OACC_DATA
= 3,
109 GF_OMP_TARGET_KIND_OACC_UPDATE
= 4,
111 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
112 a thread synchronization via some sort of barrier. The exact barrier
113 that would otherwise be emitted is dependent on the OMP statement with
114 which this return is associated. */
115 GF_OMP_RETURN_NOWAIT
= 1 << 0,
117 GF_OMP_SECTION_LAST
= 1 << 0,
118 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
119 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
120 GF_PREDICT_TAKEN
= 1 << 15
123 /* Currently, there are only two types of gimple debug stmt. Others are
124 envisioned, for example, to enable the generation of is_stmt notes
125 in line number information, to mark sequence points, etc. This
126 subcode is to be used to tell them apart. */
127 enum gimple_debug_subcode
{
128 GIMPLE_DEBUG_BIND
= 0,
129 GIMPLE_DEBUG_SOURCE_BIND
= 1
132 /* Masks for selecting a pass local flag (PLF) to work on. These
133 masks are used by gimple_set_plf and gimple_plf. */
139 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
140 are for 64 bit hosts. */
142 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
143 chain_next ("%h.next"), variable_size
))
144 gimple_statement_base
147 Main identifying code for a tuple. */
148 ENUM_BITFIELD(gimple_code
) code
: 8;
150 /* Nonzero if a warning should not be emitted on this tuple. */
151 unsigned int no_warning
: 1;
153 /* Nonzero if this tuple has been visited. Passes are responsible
154 for clearing this bit before using it. */
155 unsigned int visited
: 1;
157 /* Nonzero if this tuple represents a non-temporal move. */
158 unsigned int nontemporal_move
: 1;
160 /* Pass local flags. These flags are free for any pass to use as
161 they see fit. Passes should not assume that these flags contain
162 any useful value when the pass starts. Any initial state that
163 the pass requires should be set on entry to the pass. See
164 gimple_set_plf and gimple_plf for usage. */
165 unsigned int plf
: 2;
167 /* Nonzero if this statement has been modified and needs to have its
168 operands rescanned. */
169 unsigned modified
: 1;
171 /* Nonzero if this statement contains volatile operands. */
172 unsigned has_volatile_ops
: 1;
174 /* Padding to get subcode to 16 bit alignment. */
177 /* The SUBCODE field can be used for tuple-specific flags for tuples
178 that do not require subcodes. Note that SUBCODE should be at
179 least as wide as tree codes, as several tuples store tree codes
181 unsigned int subcode
: 16;
183 /* UID of this statement. This is used by passes that want to
184 assign IDs to statements. It must be assigned and used by each
185 pass. By default it should be assumed to contain garbage. */
189 Locus information for debug info. */
192 /* Number of operands in this tuple. */
196 Basic block holding this statement. */
200 Linked lists of gimple statements. The next pointers form
201 a NULL terminated list, the prev pointers are a cyclic list.
202 A gimple statement is hence also a double-ended list of
203 statements, with the pointer itself being the first element,
204 and the prev pointer being the last. */
206 gimple
GTY((skip
)) prev
;
210 /* Base structure for tuples with operands. */
212 /* This gimple subclass has no tag value. */
214 gimple_statement_with_ops_base
: public gimple_statement_base
216 /* [ WORD 1-6 ] : base class */
219 SSA operand vectors. NOTE: It should be possible to
220 amalgamate these vectors with the operand vector OP. However,
221 the SSA operand vectors are organized differently and contain
222 more information (like immediate use chaining). */
223 struct use_optype_d
GTY((skip (""))) *use_ops
;
227 /* Statements that take register operands. */
229 struct GTY((tag("GSS_WITH_OPS")))
230 gimple_statement_with_ops
: public gimple_statement_with_ops_base
232 /* [ WORD 1-7 ] : base class */
235 Operand vector. NOTE! This must always be the last field
236 of this structure. In particular, this means that this
237 structure cannot be embedded inside another one. */
238 tree
GTY((length ("%h.num_ops"))) op
[1];
242 /* Base for statements that take both memory and register operands. */
244 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
245 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
247 /* [ WORD 1-7 ] : base class */
250 Virtual operands for this statement. The GC will pick them
251 up via the ssa_names array. */
252 tree
GTY((skip (""))) vdef
;
253 tree
GTY((skip (""))) vuse
;
257 /* Statements that take both memory and register operands. */
259 struct GTY((tag("GSS_WITH_MEM_OPS")))
260 gimple_statement_with_memory_ops
:
261 public gimple_statement_with_memory_ops_base
263 /* [ WORD 1-9 ] : base class */
266 Operand vector. NOTE! This must always be the last field
267 of this structure. In particular, this means that this
268 structure cannot be embedded inside another one. */
269 tree
GTY((length ("%h.num_ops"))) op
[1];
273 /* Call statements that take both memory and register operands. */
275 struct GTY((tag("GSS_CALL")))
276 gimple_statement_call
: public gimple_statement_with_memory_ops_base
278 /* [ WORD 1-9 ] : base class */
281 struct pt_solution call_used
;
282 struct pt_solution call_clobbered
;
285 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
286 tree
GTY ((tag ("0"))) fntype
;
287 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
291 Operand vector. NOTE! This must always be the last field
292 of this structure. In particular, this means that this
293 structure cannot be embedded inside another one. */
294 tree
GTY((length ("%h.num_ops"))) op
[1];
298 /* OpenMP statements (#pragma omp). */
300 struct GTY((tag("GSS_OMP")))
301 gimple_statement_omp
: public gimple_statement_base
303 /* [ WORD 1-6 ] : base class */
312 struct GTY((tag("GSS_BIND")))
313 gimple_statement_bind
: public gimple_statement_base
315 /* [ WORD 1-6 ] : base class */
318 Variables declared in this scope. */
322 This is different than the BLOCK field in gimple_statement_base,
323 which is analogous to TREE_BLOCK (i.e., the lexical block holding
324 this statement). This field is the equivalent of BIND_EXPR_BLOCK
325 in tree land (i.e., the lexical scope defined by this bind). See
336 struct GTY((tag("GSS_CATCH")))
337 gimple_statement_catch
: public gimple_statement_base
339 /* [ WORD 1-6 ] : base class */
349 /* GIMPLE_EH_FILTER */
351 struct GTY((tag("GSS_EH_FILTER")))
352 gimple_statement_eh_filter
: public gimple_statement_base
354 /* [ WORD 1-6 ] : base class */
367 struct GTY((tag("GSS_EH_ELSE")))
368 gimple_statement_eh_else
: public gimple_statement_base
370 /* [ WORD 1-6 ] : base class */
373 gimple_seq n_body
, e_body
;
376 /* GIMPLE_EH_MUST_NOT_THROW */
378 struct GTY((tag("GSS_EH_MNT")))
379 gimple_statement_eh_mnt
: public gimple_statement_base
381 /* [ WORD 1-6 ] : base class */
383 /* [ WORD 7 ] Abort function decl. */
389 struct GTY((tag("GSS_PHI")))
390 gimple_statement_phi
: public gimple_statement_base
392 /* [ WORD 1-6 ] : base class */
402 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
406 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
408 struct GTY((tag("GSS_EH_CTRL")))
409 gimple_statement_eh_ctrl
: public gimple_statement_base
411 /* [ WORD 1-6 ] : base class */
414 Exception region number. */
418 struct GTY((tag("GSS_EH_CTRL")))
419 gimple_statement_resx
: public gimple_statement_eh_ctrl
421 /* No extra fields; adds invariant:
422 stmt->code == GIMPLE_RESX. */
425 struct GTY((tag("GSS_EH_CTRL")))
426 gimple_statement_eh_dispatch
: public gimple_statement_eh_ctrl
428 /* No extra fields; adds invariant:
429 stmt->code == GIMPLE_EH_DISPATH. */
435 struct GTY((tag("GSS_TRY")))
436 gimple_statement_try
: public gimple_statement_base
438 /* [ WORD 1-6 ] : base class */
441 Expression to evaluate. */
445 Cleanup expression. */
449 /* Kind of GIMPLE_TRY statements. */
450 enum gimple_try_flags
453 GIMPLE_TRY_CATCH
= 1 << 0,
456 GIMPLE_TRY_FINALLY
= 1 << 1,
457 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
459 /* Analogous to TRY_CATCH_IS_CLEANUP. */
460 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
463 /* GIMPLE_WITH_CLEANUP_EXPR */
465 struct GTY((tag("GSS_WCE")))
466 gimple_statement_wce
: public gimple_statement_base
468 /* [ WORD 1-6 ] : base class */
470 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
471 executed if an exception is thrown, not on normal exit of its
472 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
476 Cleanup expression. */
483 struct GTY((tag("GSS_ASM")))
484 gimple_statement_asm
: public gimple_statement_with_memory_ops_base
486 /* [ WORD 1-9 ] : base class */
489 __asm__ statement. */
493 Number of inputs, outputs, clobbers, labels. */
500 Operand vector. NOTE! This must always be the last field
501 of this structure. In particular, this means that this
502 structure cannot be embedded inside another one. */
503 tree
GTY((length ("%h.num_ops"))) op
[1];
506 /* GIMPLE_OMP_CRITICAL */
508 struct GTY((tag("GSS_OMP_CRITICAL")))
509 gimple_statement_omp_critical
: public gimple_statement_omp
511 /* [ WORD 1-7 ] : base class */
514 Critical section name. */
519 struct GTY(()) gimple_omp_for_iter
{
520 /* Condition code. */
523 /* Index variable. */
538 struct GTY((tag("GSS_OMP_FOR")))
539 gimple_statement_omp_for
: public gimple_statement_omp
541 /* [ WORD 1-7 ] : base class */
547 Number of elements in iter array. */
551 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
554 Pre-body evaluated before the loop body begins. */
559 /* GIMPLE_OACC_KERNELS, GIMPLE_OACC_PARALLEL, GIMPLE_OMP_PARALLEL,
560 GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
561 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
562 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
564 /* [ WORD 1-7 ] : base class */
571 Child function holding the body of the parallel region. */
575 Shared data argument. */
579 /* GIMPLE_OACC_KERNELS */
580 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
581 gimple_statement_oacc_kernels
: public gimple_statement_omp_parallel_layout
583 /* No extra fields; adds invariant:
584 stmt->code == GIMPLE_OACC_KERNELS. */
587 /* GIMPLE_OACC_PARALLEL */
588 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
589 gimple_statement_oacc_parallel
: public gimple_statement_omp_parallel_layout
591 /* No extra fields; adds invariant:
592 stmt->code == GIMPLE_OACC_PARALLEL. */
595 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
596 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
597 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
599 /* No extra fields; adds invariant:
600 stmt->code == GIMPLE_OMP_PARALLEL
601 || stmt->code == GIMPLE_OMP_TASK. */
604 /* GIMPLE_OMP_PARALLEL */
605 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
606 gimple_statement_omp_parallel
: public gimple_statement_omp_taskreg
608 /* No extra fields; adds invariant:
609 stmt->code == GIMPLE_OMP_PARALLEL. */
612 /* GIMPLE_OMP_TARGET */
613 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
614 gimple_statement_omp_target
: public gimple_statement_omp_parallel_layout
616 /* No extra fields; adds invariant:
617 stmt->code == GIMPLE_OMP_TARGET. */
620 /* GIMPLE_OMP_TASK */
622 struct GTY((tag("GSS_OMP_TASK")))
623 gimple_statement_omp_task
: public gimple_statement_omp_taskreg
625 /* [ WORD 1-10 ] : base class */
628 Child function holding firstprivate initialization if needed. */
632 Size and alignment in bytes of the argument data block. */
638 /* GIMPLE_OMP_SECTION */
639 /* Uses struct gimple_statement_omp. */
642 /* GIMPLE_OMP_SECTIONS */
644 struct GTY((tag("GSS_OMP_SECTIONS")))
645 gimple_statement_omp_sections
: public gimple_statement_omp
647 /* [ WORD 1-7 ] : base class */
653 The control variable used for deciding which of the sections to
658 /* GIMPLE_OMP_CONTINUE.
660 Note: This does not inherit from gimple_statement_omp, because we
661 do not need the body field. */
663 struct GTY((tag("GSS_OMP_CONTINUE")))
664 gimple_statement_omp_continue
: public gimple_statement_base
666 /* [ WORD 1-6 ] : base class */
675 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
677 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
678 gimple_statement_omp_single_layout
: public gimple_statement_omp
680 /* [ WORD 1-7 ] : base class */
686 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
687 gimple_statement_omp_single
: public gimple_statement_omp_single_layout
689 /* No extra fields; adds invariant:
690 stmt->code == GIMPLE_OMP_SINGLE. */
693 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
694 gimple_statement_omp_teams
: public gimple_statement_omp_single_layout
696 /* No extra fields; adds invariant:
697 stmt->code == GIMPLE_OMP_TEAMS. */
701 /* GIMPLE_OMP_ATOMIC_LOAD.
702 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
703 contains a sequence, which we don't need here. */
705 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
706 gimple_statement_omp_atomic_load
: public gimple_statement_base
708 /* [ WORD 1-6 ] : base class */
714 /* GIMPLE_OMP_ATOMIC_STORE.
715 See note on GIMPLE_OMP_ATOMIC_LOAD. */
717 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
718 gimple_statement_omp_atomic_store_layout
: public gimple_statement_base
720 /* [ WORD 1-6 ] : base class */
726 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
727 gimple_statement_omp_atomic_store
:
728 public gimple_statement_omp_atomic_store_layout
730 /* No extra fields; adds invariant:
731 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
734 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
735 gimple_statement_omp_return
:
736 public gimple_statement_omp_atomic_store_layout
738 /* No extra fields; adds invariant:
739 stmt->code == GIMPLE_OMP_RETURN. */
742 /* GIMPLE_TRANSACTION. */
744 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
746 /* The __transaction_atomic was declared [[outer]] or it is
747 __transaction_relaxed. */
748 #define GTMA_IS_OUTER (1u << 0)
749 #define GTMA_IS_RELAXED (1u << 1)
750 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
752 /* The transaction is seen to not have an abort. */
753 #define GTMA_HAVE_ABORT (1u << 2)
754 /* The transaction is seen to have loads or stores. */
755 #define GTMA_HAVE_LOAD (1u << 3)
756 #define GTMA_HAVE_STORE (1u << 4)
757 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
758 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
759 /* The transaction WILL enter serial irrevocable mode.
760 An irrevocable block post-dominates the entire transaction, such
761 that all invocations of the transaction will go serial-irrevocable.
762 In such case, we don't bother instrumenting the transaction, and
763 tell the runtime that it should begin the transaction in
764 serial-irrevocable mode. */
765 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
766 /* The transaction contains no instrumentation code whatsover, most
767 likely because it is guaranteed to go irrevocable upon entry. */
768 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
770 struct GTY((tag("GSS_TRANSACTION")))
771 gimple_statement_transaction
: public gimple_statement_with_memory_ops_base
773 /* [ WORD 1-9 ] : base class */
782 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
783 enum gimple_statement_structure_enum
{
784 #include "gsstruct.def"
792 is_a_helper
<gimple_statement_asm
*>::test (gimple gs
)
794 return gs
->code
== GIMPLE_ASM
;
800 is_a_helper
<gimple_statement_bind
*>::test (gimple gs
)
802 return gs
->code
== GIMPLE_BIND
;
808 is_a_helper
<gimple_statement_call
*>::test (gimple gs
)
810 return gs
->code
== GIMPLE_CALL
;
816 is_a_helper
<gimple_statement_catch
*>::test (gimple gs
)
818 return gs
->code
== GIMPLE_CATCH
;
824 is_a_helper
<gimple_statement_resx
*>::test (gimple gs
)
826 return gs
->code
== GIMPLE_RESX
;
832 is_a_helper
<gimple_statement_eh_dispatch
*>::test (gimple gs
)
834 return gs
->code
== GIMPLE_EH_DISPATCH
;
840 is_a_helper
<gimple_statement_eh_else
*>::test (gimple gs
)
842 return gs
->code
== GIMPLE_EH_ELSE
;
848 is_a_helper
<gimple_statement_eh_filter
*>::test (gimple gs
)
850 return gs
->code
== GIMPLE_EH_FILTER
;
856 is_a_helper
<gimple_statement_eh_mnt
*>::test (gimple gs
)
858 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
864 is_a_helper
<gimple_statement_omp_atomic_load
*>::test (gimple gs
)
866 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
872 is_a_helper
<gimple_statement_omp_atomic_store
*>::test (gimple gs
)
874 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
880 is_a_helper
<gimple_statement_omp_return
*>::test (gimple gs
)
882 return gs
->code
== GIMPLE_OMP_RETURN
;
888 is_a_helper
<gimple_statement_omp_continue
*>::test (gimple gs
)
890 return gs
->code
== GIMPLE_OMP_CONTINUE
;
896 is_a_helper
<gimple_statement_omp_critical
*>::test (gimple gs
)
898 return gs
->code
== GIMPLE_OMP_CRITICAL
;
904 is_a_helper
<gimple_statement_omp_for
*>::test (gimple gs
)
906 return gs
->code
== GIMPLE_OMP_FOR
;
912 is_a_helper
<gimple_statement_oacc_kernels
*>::test (gimple gs
)
914 return gs
->code
== GIMPLE_OACC_KERNELS
;
920 is_a_helper
<gimple_statement_oacc_parallel
*>::test (gimple gs
)
922 return gs
->code
== GIMPLE_OACC_PARALLEL
;
928 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple gs
)
930 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
936 is_a_helper
<gimple_statement_omp_parallel
*>::test (gimple gs
)
938 return gs
->code
== GIMPLE_OMP_PARALLEL
;
944 is_a_helper
<gimple_statement_omp_target
*>::test (gimple gs
)
946 return gs
->code
== GIMPLE_OMP_TARGET
;
952 is_a_helper
<gimple_statement_omp_sections
*>::test (gimple gs
)
954 return gs
->code
== GIMPLE_OMP_SECTIONS
;
960 is_a_helper
<gimple_statement_omp_single
*>::test (gimple gs
)
962 return gs
->code
== GIMPLE_OMP_SINGLE
;
968 is_a_helper
<gimple_statement_omp_teams
*>::test (gimple gs
)
970 return gs
->code
== GIMPLE_OMP_TEAMS
;
976 is_a_helper
<gimple_statement_omp_task
*>::test (gimple gs
)
978 return gs
->code
== GIMPLE_OMP_TASK
;
984 is_a_helper
<gimple_statement_phi
*>::test (gimple gs
)
986 return gs
->code
== GIMPLE_PHI
;
992 is_a_helper
<gimple_statement_transaction
*>::test (gimple gs
)
994 return gs
->code
== GIMPLE_TRANSACTION
;
1000 is_a_helper
<gimple_statement_try
*>::test (gimple gs
)
1002 return gs
->code
== GIMPLE_TRY
;
1008 is_a_helper
<gimple_statement_wce
*>::test (gimple gs
)
1010 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1016 is_a_helper
<const gimple_statement_asm
*>::test (const_gimple gs
)
1018 return gs
->code
== GIMPLE_ASM
;
1024 is_a_helper
<const gimple_statement_bind
*>::test (const_gimple gs
)
1026 return gs
->code
== GIMPLE_BIND
;
1032 is_a_helper
<const gimple_statement_call
*>::test (const_gimple gs
)
1034 return gs
->code
== GIMPLE_CALL
;
1040 is_a_helper
<const gimple_statement_catch
*>::test (const_gimple gs
)
1042 return gs
->code
== GIMPLE_CATCH
;
1048 is_a_helper
<const gimple_statement_resx
*>::test (const_gimple gs
)
1050 return gs
->code
== GIMPLE_RESX
;
1056 is_a_helper
<const gimple_statement_eh_dispatch
*>::test (const_gimple gs
)
1058 return gs
->code
== GIMPLE_EH_DISPATCH
;
1064 is_a_helper
<const gimple_statement_eh_filter
*>::test (const_gimple gs
)
1066 return gs
->code
== GIMPLE_EH_FILTER
;
1072 is_a_helper
<const gimple_statement_omp_atomic_load
*>::test (const_gimple gs
)
1074 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1080 is_a_helper
<const gimple_statement_omp_atomic_store
*>::test (const_gimple gs
)
1082 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1088 is_a_helper
<const gimple_statement_omp_return
*>::test (const_gimple gs
)
1090 return gs
->code
== GIMPLE_OMP_RETURN
;
1096 is_a_helper
<const gimple_statement_omp_continue
*>::test (const_gimple gs
)
1098 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1104 is_a_helper
<const gimple_statement_omp_critical
*>::test (const_gimple gs
)
1106 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1112 is_a_helper
<const gimple_statement_omp_for
*>::test (const_gimple gs
)
1114 return gs
->code
== GIMPLE_OMP_FOR
;
1120 is_a_helper
<const gimple_statement_oacc_kernels
*>::test (const_gimple gs
)
1122 return gs
->code
== GIMPLE_OACC_KERNELS
;
1128 is_a_helper
<const gimple_statement_oacc_parallel
*>::test (const_gimple gs
)
1130 return gs
->code
== GIMPLE_OACC_PARALLEL
;
1136 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const_gimple gs
)
1138 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1144 is_a_helper
<const gimple_statement_omp_parallel
*>::test (const_gimple gs
)
1146 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1152 is_a_helper
<const gimple_statement_omp_target
*>::test (const_gimple gs
)
1154 return gs
->code
== GIMPLE_OMP_TARGET
;
1160 is_a_helper
<const gimple_statement_omp_sections
*>::test (const_gimple gs
)
1162 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1168 is_a_helper
<const gimple_statement_omp_single
*>::test (const_gimple gs
)
1170 return gs
->code
== GIMPLE_OMP_SINGLE
;
1176 is_a_helper
<const gimple_statement_omp_teams
*>::test (const_gimple gs
)
1178 return gs
->code
== GIMPLE_OMP_TEAMS
;
1184 is_a_helper
<const gimple_statement_omp_task
*>::test (const_gimple gs
)
1186 return gs
->code
== GIMPLE_OMP_TASK
;
1192 is_a_helper
<const gimple_statement_phi
*>::test (const_gimple gs
)
1194 return gs
->code
== GIMPLE_PHI
;
1200 is_a_helper
<const gimple_statement_transaction
*>::test (const_gimple gs
)
1202 return gs
->code
== GIMPLE_TRANSACTION
;
1205 /* Offset in bytes to the location of the operand vector.
1206 Zero if there is no operand vector for this tuple structure. */
1207 extern size_t const gimple_ops_offset_
[];
1209 /* Map GIMPLE codes to GSS codes. */
1210 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1212 /* This variable holds the currently expanded gimple statement for purposes
1213 of comminucating the profile info to the builtin expanders. */
1214 extern gimple currently_expanding_gimple_stmt
;
1216 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1217 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
1218 gimple
gimple_build_return (tree
);
1219 void gimple_call_reset_alias_info (gimple
);
1220 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
1221 gimple
gimple_build_call (tree
, unsigned, ...);
1222 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
1223 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1224 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1225 gimple
gimple_build_call_from_tree (tree
);
1226 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
1227 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1228 gimple
gimple_build_assign_with_ops (enum tree_code
, tree
,
1229 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1230 gimple
gimple_build_assign_with_ops (enum tree_code
, tree
,
1231 tree
, tree CXX_MEM_STAT_INFO
);
1232 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1233 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
1234 void gimple_cond_set_condition_from_tree (gimple
, tree
);
1235 gimple
gimple_build_label (tree label
);
1236 gimple
gimple_build_goto (tree dest
);
1237 gimple
gimple_build_nop (void);
1238 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
1239 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1240 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1241 vec
<tree
, va_gc
> *);
1242 gimple
gimple_build_catch (tree
, gimple_seq
);
1243 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
1244 gimple
gimple_build_eh_must_not_throw (tree
);
1245 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
1246 gimple_statement_try
*gimple_build_try (gimple_seq
, gimple_seq
,
1247 enum gimple_try_flags
);
1248 gimple
gimple_build_wce (gimple_seq
);
1249 gimple
gimple_build_resx (int);
1250 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
1251 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
1252 gimple
gimple_build_eh_dispatch (int);
1253 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1254 #define gimple_build_debug_bind(var,val,stmt) \
1255 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1256 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1257 #define gimple_build_debug_source_bind(var,val,stmt) \
1258 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1259 gimple
gimple_build_oacc_kernels (gimple_seq
, tree
);
1260 gimple
gimple_build_oacc_parallel (gimple_seq
, tree
);
1261 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
1262 gimple
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1263 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1264 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
1265 gimple
gimple_build_omp_section (gimple_seq
);
1266 gimple
gimple_build_omp_master (gimple_seq
);
1267 gimple
gimple_build_omp_taskgroup (gimple_seq
);
1268 gimple
gimple_build_omp_continue (tree
, tree
);
1269 gimple
gimple_build_omp_ordered (gimple_seq
);
1270 gimple
gimple_build_omp_return (bool);
1271 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
1272 gimple
gimple_build_omp_sections_switch (void);
1273 gimple
gimple_build_omp_single (gimple_seq
, tree
);
1274 gimple
gimple_build_omp_target (gimple_seq
, int, tree
);
1275 gimple
gimple_build_omp_teams (gimple_seq
, tree
);
1276 gimple
gimple_build_omp_atomic_load (tree
, tree
);
1277 gimple
gimple_build_omp_atomic_store (tree
);
1278 gimple
gimple_build_transaction (gimple_seq
, tree
);
1279 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
1280 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1281 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1282 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1283 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1285 extern void annotate_all_with_location (gimple_seq
, location_t
);
1286 bool empty_body_p (gimple_seq
);
1287 gimple_seq
gimple_seq_copy (gimple_seq
);
1288 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
1289 int gimple_call_flags (const_gimple
);
1290 int gimple_call_arg_flags (const_gimple
, unsigned);
1291 int gimple_call_return_flags (const_gimple
);
1292 bool gimple_assign_copy_p (gimple
);
1293 bool gimple_assign_ssa_name_copy_p (gimple
);
1294 bool gimple_assign_unary_nop_p (gimple
);
1295 void gimple_set_bb (gimple
, basic_block
);
1296 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1297 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
1299 tree
gimple_get_lhs (const_gimple
);
1300 void gimple_set_lhs (gimple
, tree
);
1301 gimple
gimple_copy (gimple
);
1302 bool gimple_has_side_effects (const_gimple
);
1303 bool gimple_could_trap_p_1 (gimple
, bool, bool);
1304 bool gimple_could_trap_p (gimple
);
1305 bool gimple_assign_rhs_could_trap_p (gimple
);
1306 extern void dump_gimple_statistics (void);
1307 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1308 extern tree
canonicalize_cond_expr_cond (tree
);
1309 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
1310 extern bool gimple_compare_field_offset (tree
, tree
);
1311 extern tree
gimple_unsigned_type (tree
);
1312 extern tree
gimple_signed_type (tree
);
1313 extern alias_set_type
gimple_get_alias_set (tree
);
1314 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
1315 extern bool gimple_builtin_call_types_compatible_p (const_gimple
, tree
);
1316 extern bool gimple_call_builtin_p (const_gimple
);
1317 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_class
);
1318 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_function
);
1319 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
1320 extern void dump_decl_set (FILE *, bitmap
);
1321 extern bool nonfreeing_call_p (gimple
);
1322 extern bool infer_nonnull_range (gimple
, tree
, bool, bool);
1323 extern void sort_case_labels (vec
<tree
> );
1324 extern void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
1325 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1327 /* Formal (expression) temporary table handling: multiple occurrences of
1328 the same scalar expression are evaluated into the same temporary. */
1330 typedef struct gimple_temp_hash_elt
1333 tree temp
; /* Value */
1336 /* Get the number of the next statement uid to be allocated. */
1337 static inline unsigned int
1338 gimple_stmt_max_uid (struct function
*fn
)
1340 return fn
->last_stmt_uid
;
1343 /* Set the number of the next statement uid to be allocated. */
1345 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1347 fn
->last_stmt_uid
= maxid
;
1350 /* Set the number of the next statement uid to be allocated. */
1351 static inline unsigned int
1352 inc_gimple_stmt_max_uid (struct function
*fn
)
1354 return fn
->last_stmt_uid
++;
1357 /* Return the first node in GIMPLE sequence S. */
1359 static inline gimple_seq_node
1360 gimple_seq_first (gimple_seq s
)
1366 /* Return the first statement in GIMPLE sequence S. */
1368 static inline gimple
1369 gimple_seq_first_stmt (gimple_seq s
)
1371 gimple_seq_node n
= gimple_seq_first (s
);
1376 /* Return the last node in GIMPLE sequence S. */
1378 static inline gimple_seq_node
1379 gimple_seq_last (gimple_seq s
)
1381 return s
? s
->prev
: NULL
;
1385 /* Return the last statement in GIMPLE sequence S. */
1387 static inline gimple
1388 gimple_seq_last_stmt (gimple_seq s
)
1390 gimple_seq_node n
= gimple_seq_last (s
);
1395 /* Set the last node in GIMPLE sequence *PS to LAST. */
1398 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1404 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1407 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1413 /* Return true if GIMPLE sequence S is empty. */
1416 gimple_seq_empty_p (gimple_seq s
)
1421 /* Allocate a new sequence and initialize its first element with STMT. */
1423 static inline gimple_seq
1424 gimple_seq_alloc_with_stmt (gimple stmt
)
1426 gimple_seq seq
= NULL
;
1427 gimple_seq_add_stmt (&seq
, stmt
);
1432 /* Returns the sequence of statements in BB. */
1434 static inline gimple_seq
1435 bb_seq (const_basic_block bb
)
1437 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1440 static inline gimple_seq
*
1441 bb_seq_addr (basic_block bb
)
1443 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1446 /* Sets the sequence of statements in BB to SEQ. */
1449 set_bb_seq (basic_block bb
, gimple_seq seq
)
1451 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1452 bb
->il
.gimple
.seq
= seq
;
1456 /* Return the code for GIMPLE statement G. */
1458 static inline enum gimple_code
1459 gimple_code (const_gimple g
)
1465 /* Return the GSS code used by a GIMPLE code. */
1467 static inline enum gimple_statement_structure_enum
1468 gss_for_code (enum gimple_code code
)
1470 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1471 return gss_for_code_
[code
];
1475 /* Return which GSS code is used by GS. */
1477 static inline enum gimple_statement_structure_enum
1478 gimple_statement_structure (gimple gs
)
1480 return gss_for_code (gimple_code (gs
));
1484 /* Return true if statement G has sub-statements. This is only true for
1485 High GIMPLE statements. */
1488 gimple_has_substatements (gimple g
)
1490 switch (gimple_code (g
))
1494 case GIMPLE_EH_FILTER
:
1495 case GIMPLE_EH_ELSE
:
1497 case GIMPLE_OACC_KERNELS
:
1498 case GIMPLE_OACC_PARALLEL
:
1499 case GIMPLE_OMP_FOR
:
1500 case GIMPLE_OMP_MASTER
:
1501 case GIMPLE_OMP_TASKGROUP
:
1502 case GIMPLE_OMP_ORDERED
:
1503 case GIMPLE_OMP_SECTION
:
1504 case GIMPLE_OMP_PARALLEL
:
1505 case GIMPLE_OMP_TASK
:
1506 case GIMPLE_OMP_SECTIONS
:
1507 case GIMPLE_OMP_SINGLE
:
1508 case GIMPLE_OMP_TARGET
:
1509 case GIMPLE_OMP_TEAMS
:
1510 case GIMPLE_OMP_CRITICAL
:
1511 case GIMPLE_WITH_CLEANUP_EXPR
:
1512 case GIMPLE_TRANSACTION
:
1521 /* Return the basic block holding statement G. */
1523 static inline basic_block
1524 gimple_bb (const_gimple g
)
1530 /* Return the lexical scope block holding statement G. */
1533 gimple_block (const_gimple g
)
1535 return LOCATION_BLOCK (g
->location
);
1539 /* Set BLOCK to be the lexical scope block holding statement G. */
1542 gimple_set_block (gimple g
, tree block
)
1546 COMBINE_LOCATION_DATA (line_table
, g
->location
, block
);
1548 g
->location
= LOCATION_LOCUS (g
->location
);
1552 /* Return location information for statement G. */
1554 static inline location_t
1555 gimple_location (const_gimple g
)
1560 /* Return pointer to location information for statement G. */
1562 static inline const location_t
*
1563 gimple_location_ptr (const_gimple g
)
1565 return &g
->location
;
1569 /* Set location information for statement G. */
1572 gimple_set_location (gimple g
, location_t location
)
1574 g
->location
= location
;
1578 /* Return true if G contains location information. */
1581 gimple_has_location (const_gimple g
)
1583 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1587 /* Return the file name of the location of STMT. */
1589 static inline const char *
1590 gimple_filename (const_gimple stmt
)
1592 return LOCATION_FILE (gimple_location (stmt
));
1596 /* Return the line number of the location of STMT. */
1599 gimple_lineno (const_gimple stmt
)
1601 return LOCATION_LINE (gimple_location (stmt
));
1605 /* Determine whether SEQ is a singleton. */
1608 gimple_seq_singleton_p (gimple_seq seq
)
1610 return ((gimple_seq_first (seq
) != NULL
)
1611 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1614 /* Return true if no warnings should be emitted for statement STMT. */
1617 gimple_no_warning_p (const_gimple stmt
)
1619 return stmt
->no_warning
;
1622 /* Set the no_warning flag of STMT to NO_WARNING. */
1625 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1627 stmt
->no_warning
= (unsigned) no_warning
;
1630 /* Set the visited status on statement STMT to VISITED_P. */
1633 gimple_set_visited (gimple stmt
, bool visited_p
)
1635 stmt
->visited
= (unsigned) visited_p
;
1639 /* Return the visited status for statement STMT. */
1642 gimple_visited_p (gimple stmt
)
1644 return stmt
->visited
;
1648 /* Set pass local flag PLF on statement STMT to VAL_P. */
1651 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1654 stmt
->plf
|= (unsigned int) plf
;
1656 stmt
->plf
&= ~((unsigned int) plf
);
1660 /* Return the value of pass local flag PLF on statement STMT. */
1662 static inline unsigned int
1663 gimple_plf (gimple stmt
, enum plf_mask plf
)
1665 return stmt
->plf
& ((unsigned int) plf
);
1669 /* Set the UID of statement. */
1672 gimple_set_uid (gimple g
, unsigned uid
)
1678 /* Return the UID of statement. */
1680 static inline unsigned
1681 gimple_uid (const_gimple g
)
1687 /* Make statement G a singleton sequence. */
1690 gimple_init_singleton (gimple g
)
1697 /* Return true if GIMPLE statement G has register or memory operands. */
1700 gimple_has_ops (const_gimple g
)
1702 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1708 is_a_helper
<const gimple_statement_with_ops
*>::test (const_gimple gs
)
1710 return gimple_has_ops (gs
);
1716 is_a_helper
<gimple_statement_with_ops
*>::test (gimple gs
)
1718 return gimple_has_ops (gs
);
1721 /* Return true if GIMPLE statement G has memory operands. */
1724 gimple_has_mem_ops (const_gimple g
)
1726 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1732 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const_gimple gs
)
1734 return gimple_has_mem_ops (gs
);
1740 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple gs
)
1742 return gimple_has_mem_ops (gs
);
1745 /* Return the set of USE operands for statement G. */
1747 static inline struct use_optype_d
*
1748 gimple_use_ops (const_gimple g
)
1750 const gimple_statement_with_ops
*ops_stmt
=
1751 dyn_cast
<const gimple_statement_with_ops
*> (g
);
1754 return ops_stmt
->use_ops
;
1758 /* Set USE to be the set of USE operands for statement G. */
1761 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1763 gimple_statement_with_ops
*ops_stmt
=
1764 as_a
<gimple_statement_with_ops
*> (g
);
1765 ops_stmt
->use_ops
= use
;
1769 /* Return the single VUSE operand of the statement G. */
1772 gimple_vuse (const_gimple g
)
1774 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1775 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1778 return mem_ops_stmt
->vuse
;
1781 /* Return the single VDEF operand of the statement G. */
1784 gimple_vdef (const_gimple g
)
1786 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1787 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1790 return mem_ops_stmt
->vdef
;
1793 /* Return the single VUSE operand of the statement G. */
1795 static inline tree
*
1796 gimple_vuse_ptr (gimple g
)
1798 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1799 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1802 return &mem_ops_stmt
->vuse
;
1805 /* Return the single VDEF operand of the statement G. */
1807 static inline tree
*
1808 gimple_vdef_ptr (gimple g
)
1810 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1811 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1814 return &mem_ops_stmt
->vdef
;
1817 /* Set the single VUSE operand of the statement G. */
1820 gimple_set_vuse (gimple g
, tree vuse
)
1822 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1823 as_a
<gimple_statement_with_memory_ops
*> (g
);
1824 mem_ops_stmt
->vuse
= vuse
;
1827 /* Set the single VDEF operand of the statement G. */
1830 gimple_set_vdef (gimple g
, tree vdef
)
1832 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1833 as_a
<gimple_statement_with_memory_ops
*> (g
);
1834 mem_ops_stmt
->vdef
= vdef
;
1838 /* Return true if statement G has operands and the modified field has
1842 gimple_modified_p (const_gimple g
)
1844 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
1848 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1849 a MODIFIED field. */
1852 gimple_set_modified (gimple s
, bool modifiedp
)
1854 if (gimple_has_ops (s
))
1855 s
->modified
= (unsigned) modifiedp
;
1859 /* Return the tree code for the expression computed by STMT. This is
1860 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1861 GIMPLE_CALL, return CALL_EXPR as the expression code for
1862 consistency. This is useful when the caller needs to deal with the
1863 three kinds of computation that GIMPLE supports. */
1865 static inline enum tree_code
1866 gimple_expr_code (const_gimple stmt
)
1868 enum gimple_code code
= gimple_code (stmt
);
1869 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1870 return (enum tree_code
) stmt
->subcode
;
1873 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1879 /* Return true if statement STMT contains volatile operands. */
1882 gimple_has_volatile_ops (const_gimple stmt
)
1884 if (gimple_has_mem_ops (stmt
))
1885 return stmt
->has_volatile_ops
;
1891 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1894 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1896 if (gimple_has_mem_ops (stmt
))
1897 stmt
->has_volatile_ops
= (unsigned) volatilep
;
1900 /* Return true if STMT is in a transaction. */
1903 gimple_in_transaction (gimple stmt
)
1905 return bb_in_transaction (gimple_bb (stmt
));
1908 /* Return true if statement STMT may access memory. */
1911 gimple_references_memory_p (gimple stmt
)
1913 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1917 /* Return the subcode for OMP statement S. */
1919 static inline unsigned
1920 gimple_omp_subcode (const_gimple s
)
1922 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1923 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
1927 /* Set the subcode for OMP statement S to SUBCODE. */
1930 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1932 /* We only have 16 bits for the subcode. Assert that we are not
1934 gcc_gimple_checking_assert (subcode
< (1 << 16));
1935 s
->subcode
= subcode
;
1938 /* Set the nowait flag on OMP_RETURN statement S. */
1941 gimple_omp_return_set_nowait (gimple s
)
1943 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1944 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
1948 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1952 gimple_omp_return_nowait_p (const_gimple g
)
1954 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1955 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1959 /* Set the LHS of OMP return. */
1962 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
1964 gimple_statement_omp_return
*omp_return_stmt
=
1965 as_a
<gimple_statement_omp_return
*> (g
);
1966 omp_return_stmt
->val
= lhs
;
1970 /* Get the LHS of OMP return. */
1973 gimple_omp_return_lhs (const_gimple g
)
1975 const gimple_statement_omp_return
*omp_return_stmt
=
1976 as_a
<const gimple_statement_omp_return
*> (g
);
1977 return omp_return_stmt
->val
;
1981 /* Return a pointer to the LHS of OMP return. */
1983 static inline tree
*
1984 gimple_omp_return_lhs_ptr (gimple g
)
1986 gimple_statement_omp_return
*omp_return_stmt
=
1987 as_a
<gimple_statement_omp_return
*> (g
);
1988 return &omp_return_stmt
->val
;
1992 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1996 gimple_omp_section_last_p (const_gimple g
)
1998 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1999 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2003 /* Set the GF_OMP_SECTION_LAST flag on G. */
2006 gimple_omp_section_set_last (gimple g
)
2008 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2009 g
->subcode
|= GF_OMP_SECTION_LAST
;
2013 /* Return true if OMP parallel statement G has the
2014 GF_OMP_PARALLEL_COMBINED flag set. */
2017 gimple_omp_parallel_combined_p (const_gimple g
)
2019 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2020 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2024 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2025 value of COMBINED_P. */
2028 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
2030 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2032 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2034 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2038 /* Return true if OMP atomic load/store statement G has the
2039 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2042 gimple_omp_atomic_need_value_p (const_gimple g
)
2044 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2045 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2046 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2050 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2053 gimple_omp_atomic_set_need_value (gimple g
)
2055 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2056 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2057 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2061 /* Return true if OMP atomic load/store statement G has the
2062 GF_OMP_ATOMIC_SEQ_CST flag set. */
2065 gimple_omp_atomic_seq_cst_p (const_gimple g
)
2067 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2068 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2069 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2073 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2076 gimple_omp_atomic_set_seq_cst (gimple g
)
2078 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2079 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2080 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2084 /* Return the number of operands for statement GS. */
2086 static inline unsigned
2087 gimple_num_ops (const_gimple gs
)
2093 /* Set the number of operands for statement GS. */
2096 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
2098 gs
->num_ops
= num_ops
;
2102 /* Return the array of operands for statement GS. */
2104 static inline tree
*
2105 gimple_ops (gimple gs
)
2109 /* All the tuples have their operand vector at the very bottom
2110 of the structure. Note that those structures that do not
2111 have an operand vector have a zero offset. */
2112 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2113 gcc_gimple_checking_assert (off
!= 0);
2115 return (tree
*) ((char *) gs
+ off
);
2119 /* Return operand I for statement GS. */
2122 gimple_op (const_gimple gs
, unsigned i
)
2124 if (gimple_has_ops (gs
))
2126 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2127 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2133 /* Return a pointer to operand I for statement GS. */
2135 static inline tree
*
2136 gimple_op_ptr (const_gimple gs
, unsigned i
)
2138 if (gimple_has_ops (gs
))
2140 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2141 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
2147 /* Set operand I of statement GS to OP. */
2150 gimple_set_op (gimple gs
, unsigned i
, tree op
)
2152 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2154 /* Note. It may be tempting to assert that OP matches
2155 is_gimple_operand, but that would be wrong. Different tuples
2156 accept slightly different sets of tree operands. Each caller
2157 should perform its own validation. */
2158 gimple_ops (gs
)[i
] = op
;
2161 /* Return true if GS is a GIMPLE_ASSIGN. */
2164 is_gimple_assign (const_gimple gs
)
2166 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2169 /* Determine if expression CODE is one of the valid expressions that can
2170 be used on the RHS of GIMPLE assignments. */
2172 static inline enum gimple_rhs_class
2173 get_gimple_rhs_class (enum tree_code code
)
2175 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2178 /* Return the LHS of assignment statement GS. */
2181 gimple_assign_lhs (const_gimple gs
)
2183 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2184 return gimple_op (gs
, 0);
2188 /* Return a pointer to the LHS of assignment statement GS. */
2190 static inline tree
*
2191 gimple_assign_lhs_ptr (const_gimple gs
)
2193 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2194 return gimple_op_ptr (gs
, 0);
2198 /* Set LHS to be the LHS operand of assignment statement GS. */
2201 gimple_assign_set_lhs (gimple gs
, tree lhs
)
2203 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2204 gimple_set_op (gs
, 0, lhs
);
2206 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2207 SSA_NAME_DEF_STMT (lhs
) = gs
;
2211 /* Return the first operand on the RHS of assignment statement GS. */
2214 gimple_assign_rhs1 (const_gimple gs
)
2216 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2217 return gimple_op (gs
, 1);
2221 /* Return a pointer to the first operand on the RHS of assignment
2224 static inline tree
*
2225 gimple_assign_rhs1_ptr (const_gimple gs
)
2227 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2228 return gimple_op_ptr (gs
, 1);
2231 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2234 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
2236 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2238 gimple_set_op (gs
, 1, rhs
);
2242 /* Return the second operand on the RHS of assignment statement GS.
2243 If GS does not have two operands, NULL is returned instead. */
2246 gimple_assign_rhs2 (const_gimple gs
)
2248 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2250 if (gimple_num_ops (gs
) >= 3)
2251 return gimple_op (gs
, 2);
2257 /* Return a pointer to the second operand on the RHS of assignment
2260 static inline tree
*
2261 gimple_assign_rhs2_ptr (const_gimple gs
)
2263 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2264 return gimple_op_ptr (gs
, 2);
2268 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2271 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
2273 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2275 gimple_set_op (gs
, 2, rhs
);
2278 /* Return the third operand on the RHS of assignment statement GS.
2279 If GS does not have two operands, NULL is returned instead. */
2282 gimple_assign_rhs3 (const_gimple gs
)
2284 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2286 if (gimple_num_ops (gs
) >= 4)
2287 return gimple_op (gs
, 3);
2292 /* Return a pointer to the third operand on the RHS of assignment
2295 static inline tree
*
2296 gimple_assign_rhs3_ptr (const_gimple gs
)
2298 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2299 return gimple_op_ptr (gs
, 3);
2303 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2306 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
2308 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2310 gimple_set_op (gs
, 3, rhs
);
2313 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2314 to see only a maximum of two operands. */
2317 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2320 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
2323 /* Returns true if GS is a nontemporal move. */
2326 gimple_assign_nontemporal_move_p (const_gimple gs
)
2328 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2329 return gs
->nontemporal_move
;
2332 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2335 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
2337 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2338 gs
->nontemporal_move
= nontemporal
;
2342 /* Return the code of the expression computed on the rhs of assignment
2343 statement GS. In case that the RHS is a single object, returns the
2344 tree code of the object. */
2346 static inline enum tree_code
2347 gimple_assign_rhs_code (const_gimple gs
)
2349 enum tree_code code
;
2350 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2352 code
= (enum tree_code
) gs
->subcode
;
2353 /* While we initially set subcode to the TREE_CODE of the rhs for
2354 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2355 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2356 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2357 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2363 /* Set CODE to be the code for the expression computed on the RHS of
2367 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2369 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2374 /* Return the gimple rhs class of the code of the expression computed on
2375 the rhs of assignment statement GS.
2376 This will never return GIMPLE_INVALID_RHS. */
2378 static inline enum gimple_rhs_class
2379 gimple_assign_rhs_class (const_gimple gs
)
2381 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2384 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2385 there is no operator associated with the assignment itself.
2386 Unlike gimple_assign_copy_p, this predicate returns true for
2387 any RHS operand, including those that perform an operation
2388 and do not have the semantics of a copy, such as COND_EXPR. */
2391 gimple_assign_single_p (const_gimple gs
)
2393 return (is_gimple_assign (gs
)
2394 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2397 /* Return true if GS performs a store to its lhs. */
2400 gimple_store_p (const_gimple gs
)
2402 tree lhs
= gimple_get_lhs (gs
);
2403 return lhs
&& !is_gimple_reg (lhs
);
2406 /* Return true if GS is an assignment that loads from its rhs1. */
2409 gimple_assign_load_p (const_gimple gs
)
2412 if (!gimple_assign_single_p (gs
))
2414 rhs
= gimple_assign_rhs1 (gs
);
2415 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2417 rhs
= get_base_address (rhs
);
2418 return (DECL_P (rhs
)
2419 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2423 /* Return true if S is a type-cast assignment. */
2426 gimple_assign_cast_p (const_gimple s
)
2428 if (is_gimple_assign (s
))
2430 enum tree_code sc
= gimple_assign_rhs_code (s
);
2431 return CONVERT_EXPR_CODE_P (sc
)
2432 || sc
== VIEW_CONVERT_EXPR
2433 || sc
== FIX_TRUNC_EXPR
;
2439 /* Return true if S is a clobber statement. */
2442 gimple_clobber_p (const_gimple s
)
2444 return gimple_assign_single_p (s
)
2445 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2448 /* Return true if GS is a GIMPLE_CALL. */
2451 is_gimple_call (const_gimple gs
)
2453 return gimple_code (gs
) == GIMPLE_CALL
;
2456 /* Return the LHS of call statement GS. */
2459 gimple_call_lhs (const_gimple gs
)
2461 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2462 return gimple_op (gs
, 0);
2466 /* Return a pointer to the LHS of call statement GS. */
2468 static inline tree
*
2469 gimple_call_lhs_ptr (const_gimple gs
)
2471 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2472 return gimple_op_ptr (gs
, 0);
2476 /* Set LHS to be the LHS operand of call statement GS. */
2479 gimple_call_set_lhs (gimple gs
, tree lhs
)
2481 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2482 gimple_set_op (gs
, 0, lhs
);
2483 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2484 SSA_NAME_DEF_STMT (lhs
) = gs
;
2488 /* Return true if call GS calls an internal-only function, as enumerated
2492 gimple_call_internal_p (const_gimple gs
)
2494 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2495 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2499 /* Return the target of internal call GS. */
2501 static inline enum internal_fn
2502 gimple_call_internal_fn (const_gimple gs
)
2504 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2505 return static_cast <const gimple_statement_call
*> (gs
)->u
.internal_fn
;
2509 /* Return the function type of the function called by GS. */
2512 gimple_call_fntype (const_gimple gs
)
2514 const gimple_statement_call
*call_stmt
=
2515 as_a
<const gimple_statement_call
*> (gs
);
2516 if (gimple_call_internal_p (gs
))
2518 return call_stmt
->u
.fntype
;
2521 /* Set the type of the function called by GS to FNTYPE. */
2524 gimple_call_set_fntype (gimple gs
, tree fntype
)
2526 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (gs
);
2527 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2528 call_stmt
->u
.fntype
= fntype
;
2532 /* Return the tree node representing the function called by call
2536 gimple_call_fn (const_gimple gs
)
2538 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2539 return gimple_op (gs
, 1);
2542 /* Return a pointer to the tree node representing the function called by call
2545 static inline tree
*
2546 gimple_call_fn_ptr (const_gimple gs
)
2548 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2549 return gimple_op_ptr (gs
, 1);
2553 /* Set FN to be the function called by call statement GS. */
2556 gimple_call_set_fn (gimple gs
, tree fn
)
2558 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2559 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2560 gimple_set_op (gs
, 1, fn
);
2564 /* Set FNDECL to be the function called by call statement GS. */
2567 gimple_call_set_fndecl (gimple gs
, tree decl
)
2569 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2570 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2571 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2575 /* Set internal function FN to be the function called by call statement GS. */
2578 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2580 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (gs
);
2581 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2582 call_stmt
->u
.internal_fn
= fn
;
2586 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2587 Otherwise return NULL. This function is analogous to
2588 get_callee_fndecl in tree land. */
2591 gimple_call_fndecl (const_gimple gs
)
2593 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2597 /* Return the type returned by call statement GS. */
2600 gimple_call_return_type (const_gimple gs
)
2602 tree type
= gimple_call_fntype (gs
);
2604 if (type
== NULL_TREE
)
2605 return TREE_TYPE (gimple_call_lhs (gs
));
2607 /* The type returned by a function is the type of its
2609 return TREE_TYPE (type
);
2613 /* Return the static chain for call statement GS. */
2616 gimple_call_chain (const_gimple gs
)
2618 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2619 return gimple_op (gs
, 2);
2623 /* Return a pointer to the static chain for call statement GS. */
2625 static inline tree
*
2626 gimple_call_chain_ptr (const_gimple gs
)
2628 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2629 return gimple_op_ptr (gs
, 2);
2632 /* Set CHAIN to be the static chain for call statement GS. */
2635 gimple_call_set_chain (gimple gs
, tree chain
)
2637 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2639 gimple_set_op (gs
, 2, chain
);
2643 /* Return the number of arguments used by call statement GS. */
2645 static inline unsigned
2646 gimple_call_num_args (const_gimple gs
)
2649 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2650 num_ops
= gimple_num_ops (gs
);
2655 /* Return the argument at position INDEX for call statement GS. */
2658 gimple_call_arg (const_gimple gs
, unsigned index
)
2660 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2661 return gimple_op (gs
, index
+ 3);
2665 /* Return a pointer to the argument at position INDEX for call
2668 static inline tree
*
2669 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2671 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2672 return gimple_op_ptr (gs
, index
+ 3);
2676 /* Set ARG to be the argument at position INDEX for call statement GS. */
2679 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2681 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2682 gimple_set_op (gs
, index
+ 3, arg
);
2686 /* If TAIL_P is true, mark call statement S as being a tail call
2687 (i.e., a call just before the exit of a function). These calls are
2688 candidate for tail call optimization. */
2691 gimple_call_set_tail (gimple s
, bool tail_p
)
2693 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2695 s
->subcode
|= GF_CALL_TAILCALL
;
2697 s
->subcode
&= ~GF_CALL_TAILCALL
;
2701 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2704 gimple_call_tail_p (gimple s
)
2706 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2707 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
2711 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2712 slot optimization. This transformation uses the target of the call
2713 expansion as the return slot for calls that return in memory. */
2716 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2718 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2719 if (return_slot_opt_p
)
2720 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2722 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2726 /* Return true if S is marked for return slot optimization. */
2729 gimple_call_return_slot_opt_p (gimple s
)
2731 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2732 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2736 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2737 thunk to the thunked-to function. */
2740 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2742 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2744 s
->subcode
|= GF_CALL_FROM_THUNK
;
2746 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
2750 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2753 gimple_call_from_thunk_p (gimple s
)
2755 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2756 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
2760 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2761 argument pack in its argument list. */
2764 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2766 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2767 if (pass_arg_pack_p
)
2768 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
2770 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
2774 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2775 argument pack in its argument list. */
2778 gimple_call_va_arg_pack_p (gimple s
)
2780 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2781 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2785 /* Return true if S is a noreturn call. */
2788 gimple_call_noreturn_p (gimple s
)
2790 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2791 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2795 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2796 even if the called function can throw in other cases. */
2799 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2801 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2803 s
->subcode
|= GF_CALL_NOTHROW
;
2805 s
->subcode
&= ~GF_CALL_NOTHROW
;
2808 /* Return true if S is a nothrow call. */
2811 gimple_call_nothrow_p (gimple s
)
2813 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2814 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2817 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2818 is known to be emitted for VLA objects. Those are wrapped by
2819 stack_save/stack_restore calls and hence can't lead to unbounded
2820 stack growth even when they occur in loops. */
2823 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2825 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2827 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2829 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2832 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2835 gimple_call_alloca_for_var_p (gimple s
)
2837 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2838 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2841 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2844 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2846 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2847 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2848 dest_call
->subcode
= orig_call
->subcode
;
2852 /* Return a pointer to the points-to solution for the set of call-used
2853 variables of the call CALL. */
2855 static inline struct pt_solution
*
2856 gimple_call_use_set (gimple call
)
2858 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (call
);
2859 return &call_stmt
->call_used
;
2863 /* Return a pointer to the points-to solution for the set of call-used
2864 variables of the call CALL. */
2866 static inline struct pt_solution
*
2867 gimple_call_clobber_set (gimple call
)
2869 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (call
);
2870 return &call_stmt
->call_clobbered
;
2874 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2878 gimple_has_lhs (gimple stmt
)
2880 return (is_gimple_assign (stmt
)
2881 || (is_gimple_call (stmt
)
2882 && gimple_call_lhs (stmt
) != NULL_TREE
));
2886 /* Return the code of the predicate computed by conditional statement GS. */
2888 static inline enum tree_code
2889 gimple_cond_code (const_gimple gs
)
2891 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2892 return (enum tree_code
) gs
->subcode
;
2896 /* Set CODE to be the predicate code for the conditional statement GS. */
2899 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2901 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2906 /* Return the LHS of the predicate computed by conditional statement GS. */
2909 gimple_cond_lhs (const_gimple gs
)
2911 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2912 return gimple_op (gs
, 0);
2915 /* Return the pointer to the LHS of the predicate computed by conditional
2918 static inline tree
*
2919 gimple_cond_lhs_ptr (const_gimple gs
)
2921 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2922 return gimple_op_ptr (gs
, 0);
2925 /* Set LHS to be the LHS operand of the predicate computed by
2926 conditional statement GS. */
2929 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2931 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2932 gimple_set_op (gs
, 0, lhs
);
2936 /* Return the RHS operand of the predicate computed by conditional GS. */
2939 gimple_cond_rhs (const_gimple gs
)
2941 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2942 return gimple_op (gs
, 1);
2945 /* Return the pointer to the RHS operand of the predicate computed by
2948 static inline tree
*
2949 gimple_cond_rhs_ptr (const_gimple gs
)
2951 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2952 return gimple_op_ptr (gs
, 1);
2956 /* Set RHS to be the RHS operand of the predicate computed by
2957 conditional statement GS. */
2960 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2962 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2963 gimple_set_op (gs
, 1, rhs
);
2967 /* Return the label used by conditional statement GS when its
2968 predicate evaluates to true. */
2971 gimple_cond_true_label (const_gimple gs
)
2973 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2974 return gimple_op (gs
, 2);
2978 /* Set LABEL to be the label used by conditional statement GS when its
2979 predicate evaluates to true. */
2982 gimple_cond_set_true_label (gimple gs
, tree label
)
2984 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2985 gimple_set_op (gs
, 2, label
);
2989 /* Set LABEL to be the label used by conditional statement GS when its
2990 predicate evaluates to false. */
2993 gimple_cond_set_false_label (gimple gs
, tree label
)
2995 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2996 gimple_set_op (gs
, 3, label
);
3000 /* Return the label used by conditional statement GS when its
3001 predicate evaluates to false. */
3004 gimple_cond_false_label (const_gimple gs
)
3006 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3007 return gimple_op (gs
, 3);
3011 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3014 gimple_cond_make_false (gimple gs
)
3016 gimple_cond_set_lhs (gs
, boolean_true_node
);
3017 gimple_cond_set_rhs (gs
, boolean_false_node
);
3018 gs
->subcode
= EQ_EXPR
;
3022 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3025 gimple_cond_make_true (gimple gs
)
3027 gimple_cond_set_lhs (gs
, boolean_true_node
);
3028 gimple_cond_set_rhs (gs
, boolean_true_node
);
3029 gs
->subcode
= EQ_EXPR
;
3032 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3033 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3036 gimple_cond_true_p (const_gimple gs
)
3038 tree lhs
= gimple_cond_lhs (gs
);
3039 tree rhs
= gimple_cond_rhs (gs
);
3040 enum tree_code code
= gimple_cond_code (gs
);
3042 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3045 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3048 if (code
== NE_EXPR
&& lhs
!= rhs
)
3051 if (code
== EQ_EXPR
&& lhs
== rhs
)
3057 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3058 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3061 gimple_cond_false_p (const_gimple gs
)
3063 tree lhs
= gimple_cond_lhs (gs
);
3064 tree rhs
= gimple_cond_rhs (gs
);
3065 enum tree_code code
= gimple_cond_code (gs
);
3067 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3070 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3073 if (code
== NE_EXPR
&& lhs
== rhs
)
3076 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3082 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3085 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
3087 gimple_cond_set_code (stmt
, code
);
3088 gimple_cond_set_lhs (stmt
, lhs
);
3089 gimple_cond_set_rhs (stmt
, rhs
);
3092 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3095 gimple_label_label (const_gimple gs
)
3097 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
3098 return gimple_op (gs
, 0);
3102 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3106 gimple_label_set_label (gimple gs
, tree label
)
3108 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
3109 gimple_set_op (gs
, 0, label
);
3113 /* Return the destination of the unconditional jump GS. */
3116 gimple_goto_dest (const_gimple gs
)
3118 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3119 return gimple_op (gs
, 0);
3123 /* Set DEST to be the destination of the unconditonal jump GS. */
3126 gimple_goto_set_dest (gimple gs
, tree dest
)
3128 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3129 gimple_set_op (gs
, 0, dest
);
3133 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3136 gimple_bind_vars (const_gimple gs
)
3138 const gimple_statement_bind
*bind_stmt
=
3139 as_a
<const gimple_statement_bind
*> (gs
);
3140 return bind_stmt
->vars
;
3144 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3148 gimple_bind_set_vars (gimple gs
, tree vars
)
3150 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3151 bind_stmt
->vars
= vars
;
3155 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3159 gimple_bind_append_vars (gimple gs
, tree vars
)
3161 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3162 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3166 static inline gimple_seq
*
3167 gimple_bind_body_ptr (gimple gs
)
3169 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3170 return &bind_stmt
->body
;
3173 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3175 static inline gimple_seq
3176 gimple_bind_body (gimple gs
)
3178 return *gimple_bind_body_ptr (gs
);
3182 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3186 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
3188 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3189 bind_stmt
->body
= seq
;
3193 /* Append a statement to the end of a GIMPLE_BIND's body. */
3196 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
3198 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3199 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3203 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3206 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
3208 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3209 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3213 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3214 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3217 gimple_bind_block (const_gimple gs
)
3219 const gimple_statement_bind
*bind_stmt
=
3220 as_a
<const gimple_statement_bind
*> (gs
);
3221 return bind_stmt
->block
;
3225 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3229 gimple_bind_set_block (gimple gs
, tree block
)
3231 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3232 gcc_gimple_checking_assert (block
== NULL_TREE
3233 || TREE_CODE (block
) == BLOCK
);
3234 bind_stmt
->block
= block
;
3238 /* Return the number of input operands for GIMPLE_ASM GS. */
3240 static inline unsigned
3241 gimple_asm_ninputs (const_gimple gs
)
3243 const gimple_statement_asm
*asm_stmt
=
3244 as_a
<const gimple_statement_asm
*> (gs
);
3245 return asm_stmt
->ni
;
3249 /* Return the number of output operands for GIMPLE_ASM GS. */
3251 static inline unsigned
3252 gimple_asm_noutputs (const_gimple gs
)
3254 const gimple_statement_asm
*asm_stmt
=
3255 as_a
<const gimple_statement_asm
*> (gs
);
3256 return asm_stmt
->no
;
3260 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3262 static inline unsigned
3263 gimple_asm_nclobbers (const_gimple gs
)
3265 const gimple_statement_asm
*asm_stmt
=
3266 as_a
<const gimple_statement_asm
*> (gs
);
3267 return asm_stmt
->nc
;
3270 /* Return the number of label operands for GIMPLE_ASM GS. */
3272 static inline unsigned
3273 gimple_asm_nlabels (const_gimple gs
)
3275 const gimple_statement_asm
*asm_stmt
=
3276 as_a
<const gimple_statement_asm
*> (gs
);
3277 return asm_stmt
->nl
;
3280 /* Return input operand INDEX of GIMPLE_ASM GS. */
3283 gimple_asm_input_op (const_gimple gs
, unsigned index
)
3285 const gimple_statement_asm
*asm_stmt
=
3286 as_a
<const gimple_statement_asm
*> (gs
);
3287 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3288 return gimple_op (gs
, index
+ asm_stmt
->no
);
3291 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3293 static inline tree
*
3294 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
3296 const gimple_statement_asm
*asm_stmt
=
3297 as_a
<const gimple_statement_asm
*> (gs
);
3298 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3299 return gimple_op_ptr (gs
, index
+ asm_stmt
->no
);
3303 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3306 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
3308 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3309 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3310 && TREE_CODE (in_op
) == TREE_LIST
);
3311 gimple_set_op (gs
, index
+ asm_stmt
->no
, in_op
);
3315 /* Return output operand INDEX of GIMPLE_ASM GS. */
3318 gimple_asm_output_op (const_gimple gs
, unsigned index
)
3320 const gimple_statement_asm
*asm_stmt
=
3321 as_a
<const gimple_statement_asm
*> (gs
);
3322 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3323 return gimple_op (gs
, index
);
3326 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3328 static inline tree
*
3329 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
3331 const gimple_statement_asm
*asm_stmt
=
3332 as_a
<const gimple_statement_asm
*> (gs
);
3333 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3334 return gimple_op_ptr (gs
, index
);
3338 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3341 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
3343 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3344 gcc_gimple_checking_assert (index
< asm_stmt
->no
3345 && TREE_CODE (out_op
) == TREE_LIST
);
3346 gimple_set_op (gs
, index
, out_op
);
3350 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3353 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3355 const gimple_statement_asm
*asm_stmt
=
3356 as_a
<const gimple_statement_asm
*> (gs
);
3357 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3358 return gimple_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->no
);
3362 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3365 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3367 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3368 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3369 && TREE_CODE (clobber_op
) == TREE_LIST
);
3370 gimple_set_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->no
, clobber_op
);
3373 /* Return label operand INDEX of GIMPLE_ASM GS. */
3376 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3378 const gimple_statement_asm
*asm_stmt
=
3379 as_a
<const gimple_statement_asm
*> (gs
);
3380 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3381 return gimple_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
);
3384 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3387 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3389 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3390 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3391 && TREE_CODE (label_op
) == TREE_LIST
);
3392 gimple_set_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
, label_op
);
3395 /* Return the string representing the assembly instruction in
3398 static inline const char *
3399 gimple_asm_string (const_gimple gs
)
3401 const gimple_statement_asm
*asm_stmt
=
3402 as_a
<const gimple_statement_asm
*> (gs
);
3403 return asm_stmt
->string
;
3407 /* Return true if GS is an asm statement marked volatile. */
3410 gimple_asm_volatile_p (const_gimple gs
)
3412 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3413 return (gs
->subcode
& GF_ASM_VOLATILE
) != 0;
3417 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3420 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3422 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3424 gs
->subcode
|= GF_ASM_VOLATILE
;
3426 gs
->subcode
&= ~GF_ASM_VOLATILE
;
3430 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3433 gimple_asm_set_input (gimple gs
, bool input_p
)
3435 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3437 gs
->subcode
|= GF_ASM_INPUT
;
3439 gs
->subcode
&= ~GF_ASM_INPUT
;
3443 /* Return true if asm GS is an ASM_INPUT. */
3446 gimple_asm_input_p (const_gimple gs
)
3448 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3449 return (gs
->subcode
& GF_ASM_INPUT
) != 0;
3453 /* Return the types handled by GIMPLE_CATCH statement GS. */
3456 gimple_catch_types (const_gimple gs
)
3458 const gimple_statement_catch
*catch_stmt
=
3459 as_a
<const gimple_statement_catch
*> (gs
);
3460 return catch_stmt
->types
;
3464 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3466 static inline tree
*
3467 gimple_catch_types_ptr (gimple gs
)
3469 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3470 return &catch_stmt
->types
;
3474 /* Return a pointer to the GIMPLE sequence representing the body of
3475 the handler of GIMPLE_CATCH statement GS. */
3477 static inline gimple_seq
*
3478 gimple_catch_handler_ptr (gimple gs
)
3480 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3481 return &catch_stmt
->handler
;
3485 /* Return the GIMPLE sequence representing the body of the handler of
3486 GIMPLE_CATCH statement GS. */
3488 static inline gimple_seq
3489 gimple_catch_handler (gimple gs
)
3491 return *gimple_catch_handler_ptr (gs
);
3495 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3498 gimple_catch_set_types (gimple gs
, tree t
)
3500 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3501 catch_stmt
->types
= t
;
3505 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3508 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3510 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3511 catch_stmt
->handler
= handler
;
3515 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3518 gimple_eh_filter_types (const_gimple gs
)
3520 const gimple_statement_eh_filter
*eh_filter_stmt
=
3521 as_a
<const gimple_statement_eh_filter
*> (gs
);
3522 return eh_filter_stmt
->types
;
3526 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3529 static inline tree
*
3530 gimple_eh_filter_types_ptr (gimple gs
)
3532 gimple_statement_eh_filter
*eh_filter_stmt
=
3533 as_a
<gimple_statement_eh_filter
*> (gs
);
3534 return &eh_filter_stmt
->types
;
3538 /* Return a pointer to the sequence of statement to execute when
3539 GIMPLE_EH_FILTER statement fails. */
3541 static inline gimple_seq
*
3542 gimple_eh_filter_failure_ptr (gimple gs
)
3544 gimple_statement_eh_filter
*eh_filter_stmt
=
3545 as_a
<gimple_statement_eh_filter
*> (gs
);
3546 return &eh_filter_stmt
->failure
;
3550 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3553 static inline gimple_seq
3554 gimple_eh_filter_failure (gimple gs
)
3556 return *gimple_eh_filter_failure_ptr (gs
);
3560 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3563 gimple_eh_filter_set_types (gimple gs
, tree types
)
3565 gimple_statement_eh_filter
*eh_filter_stmt
=
3566 as_a
<gimple_statement_eh_filter
*> (gs
);
3567 eh_filter_stmt
->types
= types
;
3571 /* Set FAILURE to be the sequence of statements to execute on failure
3572 for GIMPLE_EH_FILTER GS. */
3575 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3577 gimple_statement_eh_filter
*eh_filter_stmt
=
3578 as_a
<gimple_statement_eh_filter
*> (gs
);
3579 eh_filter_stmt
->failure
= failure
;
3582 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3585 gimple_eh_must_not_throw_fndecl (gimple gs
)
3587 gimple_statement_eh_mnt
*eh_mnt_stmt
= as_a
<gimple_statement_eh_mnt
*> (gs
);
3588 return eh_mnt_stmt
->fndecl
;
3591 /* Set the function decl to be called by GS to DECL. */
3594 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3596 gimple_statement_eh_mnt
*eh_mnt_stmt
= as_a
<gimple_statement_eh_mnt
*> (gs
);
3597 eh_mnt_stmt
->fndecl
= decl
;
3600 /* GIMPLE_EH_ELSE accessors. */
3602 static inline gimple_seq
*
3603 gimple_eh_else_n_body_ptr (gimple gs
)
3605 gimple_statement_eh_else
*eh_else_stmt
=
3606 as_a
<gimple_statement_eh_else
*> (gs
);
3607 return &eh_else_stmt
->n_body
;
3610 static inline gimple_seq
3611 gimple_eh_else_n_body (gimple gs
)
3613 return *gimple_eh_else_n_body_ptr (gs
);
3616 static inline gimple_seq
*
3617 gimple_eh_else_e_body_ptr (gimple gs
)
3619 gimple_statement_eh_else
*eh_else_stmt
=
3620 as_a
<gimple_statement_eh_else
*> (gs
);
3621 return &eh_else_stmt
->e_body
;
3624 static inline gimple_seq
3625 gimple_eh_else_e_body (gimple gs
)
3627 return *gimple_eh_else_e_body_ptr (gs
);
3631 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3633 gimple_statement_eh_else
*eh_else_stmt
=
3634 as_a
<gimple_statement_eh_else
*> (gs
);
3635 eh_else_stmt
->n_body
= seq
;
3639 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3641 gimple_statement_eh_else
*eh_else_stmt
=
3642 as_a
<gimple_statement_eh_else
*> (gs
);
3643 eh_else_stmt
->e_body
= seq
;
3646 /* GIMPLE_TRY accessors. */
3648 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3649 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3651 static inline enum gimple_try_flags
3652 gimple_try_kind (const_gimple gs
)
3654 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3655 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
3659 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3662 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3664 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3665 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3666 || kind
== GIMPLE_TRY_FINALLY
);
3667 if (gimple_try_kind (gs
) != kind
)
3668 gs
->subcode
= (unsigned int) kind
;
3672 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3675 gimple_try_catch_is_cleanup (const_gimple gs
)
3677 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3678 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3682 /* Return a pointer to the sequence of statements used as the
3683 body for GIMPLE_TRY GS. */
3685 static inline gimple_seq
*
3686 gimple_try_eval_ptr (gimple gs
)
3688 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3689 return &try_stmt
->eval
;
3693 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3695 static inline gimple_seq
3696 gimple_try_eval (gimple gs
)
3698 return *gimple_try_eval_ptr (gs
);
3702 /* Return a pointer to the sequence of statements used as the cleanup body for
3705 static inline gimple_seq
*
3706 gimple_try_cleanup_ptr (gimple gs
)
3708 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3709 return &try_stmt
->cleanup
;
3713 /* Return the sequence of statements used as the cleanup body for
3716 static inline gimple_seq
3717 gimple_try_cleanup (gimple gs
)
3719 return *gimple_try_cleanup_ptr (gs
);
3723 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3726 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3728 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3729 if (catch_is_cleanup
)
3730 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3732 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3736 /* Set EVAL to be the sequence of statements to use as the body for
3740 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3742 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3743 try_stmt
->eval
= eval
;
3747 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3748 body for GIMPLE_TRY GS. */
3751 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3753 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3754 try_stmt
->cleanup
= cleanup
;
3758 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3760 static inline gimple_seq
*
3761 gimple_wce_cleanup_ptr (gimple gs
)
3763 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3764 return &wce_stmt
->cleanup
;
3768 /* Return the cleanup sequence for cleanup statement GS. */
3770 static inline gimple_seq
3771 gimple_wce_cleanup (gimple gs
)
3773 return *gimple_wce_cleanup_ptr (gs
);
3777 /* Set CLEANUP to be the cleanup sequence for GS. */
3780 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3782 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3783 wce_stmt
->cleanup
= cleanup
;
3787 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3790 gimple_wce_cleanup_eh_only (const_gimple gs
)
3792 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3793 return gs
->subcode
!= 0;
3797 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3800 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3802 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3803 gs
->subcode
= (unsigned int) eh_only_p
;
3807 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3809 static inline unsigned
3810 gimple_phi_capacity (const_gimple gs
)
3812 const gimple_statement_phi
*phi_stmt
=
3813 as_a
<const gimple_statement_phi
*> (gs
);
3814 return phi_stmt
->capacity
;
3818 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3819 be exactly the number of incoming edges for the basic block holding
3822 static inline unsigned
3823 gimple_phi_num_args (const_gimple gs
)
3825 const gimple_statement_phi
*phi_stmt
=
3826 as_a
<const gimple_statement_phi
*> (gs
);
3827 return phi_stmt
->nargs
;
3831 /* Return the SSA name created by GIMPLE_PHI GS. */
3834 gimple_phi_result (const_gimple gs
)
3836 const gimple_statement_phi
*phi_stmt
=
3837 as_a
<const gimple_statement_phi
*> (gs
);
3838 return phi_stmt
->result
;
3841 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3843 static inline tree
*
3844 gimple_phi_result_ptr (gimple gs
)
3846 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3847 return &phi_stmt
->result
;
3850 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3853 gimple_phi_set_result (gimple gs
, tree result
)
3855 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3856 phi_stmt
->result
= result
;
3857 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3858 SSA_NAME_DEF_STMT (result
) = gs
;
3862 /* Return the PHI argument corresponding to incoming edge INDEX for
3865 static inline struct phi_arg_d
*
3866 gimple_phi_arg (gimple gs
, unsigned index
)
3868 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3869 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
3870 return &(phi_stmt
->args
[index
]);
3873 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3874 for GIMPLE_PHI GS. */
3877 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3879 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3880 gcc_gimple_checking_assert (index
<= phi_stmt
->nargs
);
3881 phi_stmt
->args
[index
] = *phiarg
;
3884 /* Return the PHI nodes for basic block BB, or NULL if there are no
3887 static inline gimple_seq
3888 phi_nodes (const_basic_block bb
)
3890 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3891 return bb
->il
.gimple
.phi_nodes
;
3894 /* Return a pointer to the PHI nodes for basic block BB. */
3896 static inline gimple_seq
*
3897 phi_nodes_ptr (basic_block bb
)
3899 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3900 return &bb
->il
.gimple
.phi_nodes
;
3903 /* Return the tree operand for argument I of PHI node GS. */
3906 gimple_phi_arg_def (gimple gs
, size_t index
)
3908 return gimple_phi_arg (gs
, index
)->def
;
3912 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3914 static inline tree
*
3915 gimple_phi_arg_def_ptr (gimple gs
, size_t index
)
3917 return &gimple_phi_arg (gs
, index
)->def
;
3920 /* Return the edge associated with argument I of phi node GS. */
3923 gimple_phi_arg_edge (gimple gs
, size_t i
)
3925 return EDGE_PRED (gimple_bb (gs
), i
);
3928 /* Return the source location of gimple argument I of phi node GS. */
3930 static inline source_location
3931 gimple_phi_arg_location (gimple gs
, size_t i
)
3933 return gimple_phi_arg (gs
, i
)->locus
;
3936 /* Return the source location of the argument on edge E of phi node GS. */
3938 static inline source_location
3939 gimple_phi_arg_location_from_edge (gimple gs
, edge e
)
3941 return gimple_phi_arg (gs
, e
->dest_idx
)->locus
;
3944 /* Set the source location of gimple argument I of phi node GS to LOC. */
3947 gimple_phi_arg_set_location (gimple gs
, size_t i
, source_location loc
)
3949 gimple_phi_arg (gs
, i
)->locus
= loc
;
3952 /* Return TRUE if argument I of phi node GS has a location record. */
3955 gimple_phi_arg_has_location (gimple gs
, size_t i
)
3957 return gimple_phi_arg_location (gs
, i
) != UNKNOWN_LOCATION
;
3961 /* Return the region number for GIMPLE_RESX GS. */
3964 gimple_resx_region (const_gimple gs
)
3966 const gimple_statement_resx
*resx_stmt
=
3967 as_a
<const gimple_statement_resx
*> (gs
);
3968 return resx_stmt
->region
;
3971 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3974 gimple_resx_set_region (gimple gs
, int region
)
3976 gimple_statement_resx
*resx_stmt
= as_a
<gimple_statement_resx
*> (gs
);
3977 resx_stmt
->region
= region
;
3980 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3983 gimple_eh_dispatch_region (const_gimple gs
)
3985 const gimple_statement_eh_dispatch
*eh_dispatch_stmt
=
3986 as_a
<const gimple_statement_eh_dispatch
*> (gs
);
3987 return eh_dispatch_stmt
->region
;
3990 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3993 gimple_eh_dispatch_set_region (gimple gs
, int region
)
3995 gimple_statement_eh_dispatch
*eh_dispatch_stmt
=
3996 as_a
<gimple_statement_eh_dispatch
*> (gs
);
3997 eh_dispatch_stmt
->region
= region
;
4000 /* Return the number of labels associated with the switch statement GS. */
4002 static inline unsigned
4003 gimple_switch_num_labels (const_gimple gs
)
4006 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4007 num_ops
= gimple_num_ops (gs
);
4008 gcc_gimple_checking_assert (num_ops
> 1);
4013 /* Set NLABELS to be the number of labels for the switch statement GS. */
4016 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
4018 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4019 gimple_set_num_ops (g
, nlabels
+ 1);
4023 /* Return the index variable used by the switch statement GS. */
4026 gimple_switch_index (const_gimple gs
)
4028 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4029 return gimple_op (gs
, 0);
4033 /* Return a pointer to the index variable for the switch statement GS. */
4035 static inline tree
*
4036 gimple_switch_index_ptr (const_gimple gs
)
4038 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4039 return gimple_op_ptr (gs
, 0);
4043 /* Set INDEX to be the index variable for switch statement GS. */
4046 gimple_switch_set_index (gimple gs
, tree index
)
4048 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4049 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4050 gimple_set_op (gs
, 0, index
);
4054 /* Return the label numbered INDEX. The default label is 0, followed by any
4055 labels in a switch statement. */
4058 gimple_switch_label (const_gimple gs
, unsigned index
)
4060 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4061 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4062 return gimple_op (gs
, index
+ 1);
4065 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4068 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
4070 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4071 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4072 && (label
== NULL_TREE
4073 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4074 gimple_set_op (gs
, index
+ 1, label
);
4077 /* Return the default label for a switch statement. */
4080 gimple_switch_default_label (const_gimple gs
)
4082 tree label
= gimple_switch_label (gs
, 0);
4083 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4087 /* Set the default label for a switch statement. */
4090 gimple_switch_set_default_label (gimple gs
, tree label
)
4092 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4093 gimple_switch_set_label (gs
, 0, label
);
4096 /* Return true if GS is a GIMPLE_DEBUG statement. */
4099 is_gimple_debug (const_gimple gs
)
4101 return gimple_code (gs
) == GIMPLE_DEBUG
;
4104 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4107 gimple_debug_bind_p (const_gimple s
)
4109 if (is_gimple_debug (s
))
4110 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4115 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4118 gimple_debug_bind_get_var (gimple dbg
)
4120 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4121 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4122 return gimple_op (dbg
, 0);
4125 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4129 gimple_debug_bind_get_value (gimple dbg
)
4131 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4132 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4133 return gimple_op (dbg
, 1);
4136 /* Return a pointer to the value bound to the variable in a
4137 GIMPLE_DEBUG bind statement. */
4139 static inline tree
*
4140 gimple_debug_bind_get_value_ptr (gimple dbg
)
4142 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4143 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4144 return gimple_op_ptr (dbg
, 1);
4147 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4150 gimple_debug_bind_set_var (gimple dbg
, tree var
)
4152 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4153 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4154 gimple_set_op (dbg
, 0, var
);
4157 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4161 gimple_debug_bind_set_value (gimple dbg
, tree value
)
4163 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4164 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4165 gimple_set_op (dbg
, 1, value
);
4168 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4170 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4172 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4176 gimple_debug_bind_reset_value (gimple dbg
)
4178 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4179 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4180 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4183 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4187 gimple_debug_bind_has_value_p (gimple dbg
)
4189 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4190 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4191 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4194 #undef GIMPLE_DEBUG_BIND_NOVALUE
4196 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4199 gimple_debug_source_bind_p (const_gimple s
)
4201 if (is_gimple_debug (s
))
4202 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4207 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4210 gimple_debug_source_bind_get_var (gimple dbg
)
4212 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4213 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4214 return gimple_op (dbg
, 0);
4217 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4221 gimple_debug_source_bind_get_value (gimple dbg
)
4223 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4224 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4225 return gimple_op (dbg
, 1);
4228 /* Return a pointer to the value bound to the variable in a
4229 GIMPLE_DEBUG source bind statement. */
4231 static inline tree
*
4232 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
4234 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4235 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4236 return gimple_op_ptr (dbg
, 1);
4239 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4242 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
4244 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4245 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4246 gimple_set_op (dbg
, 0, var
);
4249 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4253 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
4255 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4256 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4257 gimple_set_op (dbg
, 1, value
);
4260 /* Return the line number for EXPR, or return -1 if we have no line
4261 number information for it. */
4263 get_lineno (const_gimple stmt
)
4270 loc
= gimple_location (stmt
);
4271 if (loc
== UNKNOWN_LOCATION
)
4274 return LOCATION_LINE (loc
);
4277 /* Return a pointer to the body for the OMP statement GS. */
4279 static inline gimple_seq
*
4280 gimple_omp_body_ptr (gimple gs
)
4282 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4285 /* Return the body for the OMP statement GS. */
4287 static inline gimple_seq
4288 gimple_omp_body (gimple gs
)
4290 return *gimple_omp_body_ptr (gs
);
4293 /* Set BODY to be the body for the OMP statement GS. */
4296 gimple_omp_set_body (gimple gs
, gimple_seq body
)
4298 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4302 /* Return the clauses associated with OACC_KERNELS statement GS. */
4305 gimple_oacc_kernels_clauses (const_gimple gs
)
4307 const gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4308 as_a
<const gimple_statement_oacc_kernels
*> (gs
);
4309 return oacc_kernels_stmt
->clauses
;
4312 /* Return a pointer to the clauses associated with OACC_KERNELS statement GS. */
4314 static inline tree
*
4315 gimple_oacc_kernels_clauses_ptr (gimple gs
)
4317 gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4318 as_a
<gimple_statement_oacc_kernels
*> (gs
);
4319 return &oacc_kernels_stmt
->clauses
;
4322 /* Set CLAUSES to be the list of clauses associated with OACC_KERNELS statement
4326 gimple_oacc_kernels_set_clauses (gimple gs
, tree clauses
)
4328 gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4329 as_a
<gimple_statement_oacc_kernels
*> (gs
);
4330 oacc_kernels_stmt
->clauses
= clauses
;
4333 /* Return the child function used to hold the body of OACC_KERNELS statement
4337 gimple_oacc_kernels_child_fn (const_gimple gs
)
4339 const gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4340 as_a
<const gimple_statement_oacc_kernels
*> (gs
);
4341 return oacc_kernels_stmt
->child_fn
;
4344 /* Return a pointer to the child function used to hold the body of OACC_KERNELS
4347 static inline tree
*
4348 gimple_oacc_kernels_child_fn_ptr (gimple gs
)
4350 gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4351 as_a
<gimple_statement_oacc_kernels
*> (gs
);
4352 return &oacc_kernels_stmt
->child_fn
;
4355 /* Set CHILD_FN to be the child function for OACC_KERNELS statement GS. */
4358 gimple_oacc_kernels_set_child_fn (gimple gs
, tree child_fn
)
4360 gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4361 as_a
<gimple_statement_oacc_kernels
*> (gs
);
4362 oacc_kernels_stmt
->child_fn
= child_fn
;
4365 /* Return the artificial argument used to send variables and values
4366 from the parent to the children threads in OACC_KERNELS statement GS. */
4369 gimple_oacc_kernels_data_arg (const_gimple gs
)
4371 const gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4372 as_a
<const gimple_statement_oacc_kernels
*> (gs
);
4373 return oacc_kernels_stmt
->data_arg
;
4376 /* Return a pointer to the data argument for OACC_KERNELS statement GS. */
4378 static inline tree
*
4379 gimple_oacc_kernels_data_arg_ptr (gimple gs
)
4381 gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4382 as_a
<gimple_statement_oacc_kernels
*> (gs
);
4383 return &oacc_kernels_stmt
->data_arg
;
4386 /* Set DATA_ARG to be the data argument for OACC_KERNELS statement GS. */
4389 gimple_oacc_kernels_set_data_arg (gimple gs
, tree data_arg
)
4391 gimple_statement_oacc_kernels
*oacc_kernels_stmt
=
4392 as_a
<gimple_statement_oacc_kernels
*> (gs
);
4393 oacc_kernels_stmt
->data_arg
= data_arg
;
4397 /* Return the clauses associated with OACC_PARALLEL statement GS. */
4400 gimple_oacc_parallel_clauses (const_gimple gs
)
4402 const gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4403 as_a
<const gimple_statement_oacc_parallel
*> (gs
);
4404 return oacc_parallel_stmt
->clauses
;
4407 /* Return a pointer to the clauses associated with OACC_PARALLEL statement
4410 static inline tree
*
4411 gimple_oacc_parallel_clauses_ptr (gimple gs
)
4413 gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4414 as_a
<gimple_statement_oacc_parallel
*> (gs
);
4415 return &oacc_parallel_stmt
->clauses
;
4418 /* Set CLAUSES to be the list of clauses associated with OACC_PARALLEL
4422 gimple_oacc_parallel_set_clauses (gimple gs
, tree clauses
)
4424 gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4425 as_a
<gimple_statement_oacc_parallel
*> (gs
);
4426 oacc_parallel_stmt
->clauses
= clauses
;
4429 /* Return the child function used to hold the body of OACC_PARALLEL statement
4433 gimple_oacc_parallel_child_fn (const_gimple gs
)
4435 const gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4436 as_a
<const gimple_statement_oacc_parallel
*> (gs
);
4437 return oacc_parallel_stmt
->child_fn
;
4440 /* Return a pointer to the child function used to hold the body of
4441 OACC_PARALLEL statement GS. */
4443 static inline tree
*
4444 gimple_oacc_parallel_child_fn_ptr (gimple gs
)
4446 gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4447 as_a
<gimple_statement_oacc_parallel
*> (gs
);
4448 return &oacc_parallel_stmt
->child_fn
;
4451 /* Set CHILD_FN to be the child function for OACC_PARALLEL statement GS. */
4454 gimple_oacc_parallel_set_child_fn (gimple gs
, tree child_fn
)
4456 gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4457 as_a
<gimple_statement_oacc_parallel
*> (gs
);
4458 oacc_parallel_stmt
->child_fn
= child_fn
;
4461 /* Return the artificial argument used to send variables and values
4462 from the parent to the children threads in OACC_PARALLEL statement GS. */
4465 gimple_oacc_parallel_data_arg (const_gimple gs
)
4467 const gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4468 as_a
<const gimple_statement_oacc_parallel
*> (gs
);
4469 return oacc_parallel_stmt
->data_arg
;
4472 /* Return a pointer to the data argument for OACC_PARALLEL statement GS. */
4474 static inline tree
*
4475 gimple_oacc_parallel_data_arg_ptr (gimple gs
)
4477 gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4478 as_a
<gimple_statement_oacc_parallel
*> (gs
);
4479 return &oacc_parallel_stmt
->data_arg
;
4482 /* Set DATA_ARG to be the data argument for OACC_PARALLEL statement GS. */
4485 gimple_oacc_parallel_set_data_arg (gimple gs
, tree data_arg
)
4487 gimple_statement_oacc_parallel
*oacc_parallel_stmt
=
4488 as_a
<gimple_statement_oacc_parallel
*> (gs
);
4489 oacc_parallel_stmt
->data_arg
= data_arg
;
4493 /* Return the name associated with OMP_CRITICAL statement GS. */
4496 gimple_omp_critical_name (const_gimple gs
)
4498 const gimple_statement_omp_critical
*omp_critical_stmt
=
4499 as_a
<const gimple_statement_omp_critical
*> (gs
);
4500 return omp_critical_stmt
->name
;
4504 /* Return a pointer to the name associated with OMP critical statement GS. */
4506 static inline tree
*
4507 gimple_omp_critical_name_ptr (gimple gs
)
4509 gimple_statement_omp_critical
*omp_critical_stmt
=
4510 as_a
<gimple_statement_omp_critical
*> (gs
);
4511 return &omp_critical_stmt
->name
;
4515 /* Set NAME to be the name associated with OMP critical statement GS. */
4518 gimple_omp_critical_set_name (gimple gs
, tree name
)
4520 gimple_statement_omp_critical
*omp_critical_stmt
=
4521 as_a
<gimple_statement_omp_critical
*> (gs
);
4522 omp_critical_stmt
->name
= name
;
4526 /* Return the kind of the OMP_FOR statemement G. */
4529 gimple_omp_for_kind (const_gimple g
)
4531 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4532 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4536 /* Set the kind of the OMP_FOR statement G. */
4539 gimple_omp_for_set_kind (gimple g
, int kind
)
4541 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4542 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4543 | (kind
& GF_OMP_FOR_KIND_MASK
);
4547 /* Return true if OMP_FOR statement G has the
4548 GF_OMP_FOR_COMBINED flag set. */
4551 gimple_omp_for_combined_p (const_gimple g
)
4553 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4554 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4558 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4559 the boolean value of COMBINED_P. */
4562 gimple_omp_for_set_combined_p (gimple g
, bool combined_p
)
4564 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4566 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4568 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4572 /* Return true if the OMP_FOR statement G has the
4573 GF_OMP_FOR_COMBINED_INTO flag set. */
4576 gimple_omp_for_combined_into_p (const_gimple g
)
4578 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4579 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4583 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4584 on the boolean value of COMBINED_P. */
4587 gimple_omp_for_set_combined_into_p (gimple g
, bool combined_p
)
4589 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4591 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4593 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4597 /* Return the clauses associated with the OMP_FOR statement GS. */
4600 gimple_omp_for_clauses (const_gimple gs
)
4602 const gimple_statement_omp_for
*omp_for_stmt
=
4603 as_a
<const gimple_statement_omp_for
*> (gs
);
4604 return omp_for_stmt
->clauses
;
4608 /* Return a pointer to the clauses associated with the OMP_FOR statement
4611 static inline tree
*
4612 gimple_omp_for_clauses_ptr (gimple gs
)
4614 gimple_statement_omp_for
*omp_for_stmt
=
4615 as_a
<gimple_statement_omp_for
*> (gs
);
4616 return &omp_for_stmt
->clauses
;
4620 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4624 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
4626 gimple_statement_omp_for
*omp_for_stmt
=
4627 as_a
<gimple_statement_omp_for
*> (gs
);
4628 omp_for_stmt
->clauses
= clauses
;
4632 /* Get the collapse count of the OMP_FOR statement GS. */
4634 static inline size_t
4635 gimple_omp_for_collapse (gimple gs
)
4637 gimple_statement_omp_for
*omp_for_stmt
=
4638 as_a
<gimple_statement_omp_for
*> (gs
);
4639 return omp_for_stmt
->collapse
;
4643 /* Return the index variable for the OMP_FOR statement GS. */
4646 gimple_omp_for_index (const_gimple gs
, size_t i
)
4648 const gimple_statement_omp_for
*omp_for_stmt
=
4649 as_a
<const gimple_statement_omp_for
*> (gs
);
4650 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4651 return omp_for_stmt
->iter
[i
].index
;
4655 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4657 static inline tree
*
4658 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
4660 gimple_statement_omp_for
*omp_for_stmt
=
4661 as_a
<gimple_statement_omp_for
*> (gs
);
4662 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4663 return &omp_for_stmt
->iter
[i
].index
;
4667 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4670 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
4672 gimple_statement_omp_for
*omp_for_stmt
=
4673 as_a
<gimple_statement_omp_for
*> (gs
);
4674 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4675 omp_for_stmt
->iter
[i
].index
= index
;
4679 /* Return the initial value for the OMP_FOR statement GS. */
4682 gimple_omp_for_initial (const_gimple gs
, size_t i
)
4684 const gimple_statement_omp_for
*omp_for_stmt
=
4685 as_a
<const gimple_statement_omp_for
*> (gs
);
4686 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4687 return omp_for_stmt
->iter
[i
].initial
;
4691 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4693 static inline tree
*
4694 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
4696 gimple_statement_omp_for
*omp_for_stmt
=
4697 as_a
<gimple_statement_omp_for
*> (gs
);
4698 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4699 return &omp_for_stmt
->iter
[i
].initial
;
4703 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4706 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4708 gimple_statement_omp_for
*omp_for_stmt
=
4709 as_a
<gimple_statement_omp_for
*> (gs
);
4710 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4711 omp_for_stmt
->iter
[i
].initial
= initial
;
4715 /* Return the final value for the OMP_FOR statement GS. */
4718 gimple_omp_for_final (const_gimple gs
, size_t i
)
4720 const gimple_statement_omp_for
*omp_for_stmt
=
4721 as_a
<const gimple_statement_omp_for
*> (gs
);
4722 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4723 return omp_for_stmt
->iter
[i
].final
;
4727 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4729 static inline tree
*
4730 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4732 gimple_statement_omp_for
*omp_for_stmt
=
4733 as_a
<gimple_statement_omp_for
*> (gs
);
4734 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4735 return &omp_for_stmt
->iter
[i
].final
;
4739 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
4742 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4744 gimple_statement_omp_for
*omp_for_stmt
=
4745 as_a
<gimple_statement_omp_for
*> (gs
);
4746 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4747 omp_for_stmt
->iter
[i
].final
= final
;
4751 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4754 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
4756 gimple_statement_omp_for
*omp_for_stmt
=
4757 as_a
<gimple_statement_omp_for
*> (gs
);
4758 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
4759 && i
< omp_for_stmt
->collapse
);
4760 omp_for_stmt
->iter
[i
].cond
= cond
;
4764 /* Return the condition code associated with the OMP_FOR statement GS. */
4766 static inline enum tree_code
4767 gimple_omp_for_cond (const_gimple gs
, size_t i
)
4769 const gimple_statement_omp_for
*omp_for_stmt
=
4770 as_a
<const gimple_statement_omp_for
*> (gs
);
4771 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4772 return omp_for_stmt
->iter
[i
].cond
;
4776 /* Return the increment value for the OMP_FOR statement GS. */
4779 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4781 const gimple_statement_omp_for
*omp_for_stmt
=
4782 as_a
<const gimple_statement_omp_for
*> (gs
);
4783 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4784 return omp_for_stmt
->iter
[i
].incr
;
4788 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
4790 static inline tree
*
4791 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4793 gimple_statement_omp_for
*omp_for_stmt
=
4794 as_a
<gimple_statement_omp_for
*> (gs
);
4795 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4796 return &omp_for_stmt
->iter
[i
].incr
;
4800 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
4803 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4805 gimple_statement_omp_for
*omp_for_stmt
=
4806 as_a
<gimple_statement_omp_for
*> (gs
);
4807 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4808 omp_for_stmt
->iter
[i
].incr
= incr
;
4812 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4813 statement GS starts. */
4815 static inline gimple_seq
*
4816 gimple_omp_for_pre_body_ptr (gimple gs
)
4818 gimple_statement_omp_for
*omp_for_stmt
=
4819 as_a
<gimple_statement_omp_for
*> (gs
);
4820 return &omp_for_stmt
->pre_body
;
4824 /* Return the sequence of statements to execute before the OMP_FOR
4825 statement GS starts. */
4827 static inline gimple_seq
4828 gimple_omp_for_pre_body (gimple gs
)
4830 return *gimple_omp_for_pre_body_ptr (gs
);
4834 /* Set PRE_BODY to be the sequence of statements to execute before the
4835 OMP_FOR statement GS starts. */
4838 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4840 gimple_statement_omp_for
*omp_for_stmt
=
4841 as_a
<gimple_statement_omp_for
*> (gs
);
4842 omp_for_stmt
->pre_body
= pre_body
;
4846 /* Return the clauses associated with OMP_PARALLEL GS. */
4849 gimple_omp_parallel_clauses (const_gimple gs
)
4851 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4852 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4853 return omp_parallel_stmt
->clauses
;
4857 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4859 static inline tree
*
4860 gimple_omp_parallel_clauses_ptr (gimple gs
)
4862 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4863 as_a
<gimple_statement_omp_parallel
*> (gs
);
4864 return &omp_parallel_stmt
->clauses
;
4868 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4872 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4874 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4875 as_a
<gimple_statement_omp_parallel
*> (gs
);
4876 omp_parallel_stmt
->clauses
= clauses
;
4880 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4883 gimple_omp_parallel_child_fn (const_gimple gs
)
4885 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4886 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4887 return omp_parallel_stmt
->child_fn
;
4890 /* Return a pointer to the child function used to hold the body of
4893 static inline tree
*
4894 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4896 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4897 as_a
<gimple_statement_omp_parallel
*> (gs
);
4898 return &omp_parallel_stmt
->child_fn
;
4902 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4905 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4907 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4908 as_a
<gimple_statement_omp_parallel
*> (gs
);
4909 omp_parallel_stmt
->child_fn
= child_fn
;
4913 /* Return the artificial argument used to send variables and values
4914 from the parent to the children threads in OMP_PARALLEL GS. */
4917 gimple_omp_parallel_data_arg (const_gimple gs
)
4919 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4920 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4921 return omp_parallel_stmt
->data_arg
;
4925 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4927 static inline tree
*
4928 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4930 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4931 as_a
<gimple_statement_omp_parallel
*> (gs
);
4932 return &omp_parallel_stmt
->data_arg
;
4936 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4939 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4941 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4942 as_a
<gimple_statement_omp_parallel
*> (gs
);
4943 omp_parallel_stmt
->data_arg
= data_arg
;
4947 /* Return the clauses associated with OMP_TASK GS. */
4950 gimple_omp_task_clauses (const_gimple gs
)
4952 const gimple_statement_omp_task
*omp_task_stmt
=
4953 as_a
<const gimple_statement_omp_task
*> (gs
);
4954 return omp_task_stmt
->clauses
;
4958 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4960 static inline tree
*
4961 gimple_omp_task_clauses_ptr (gimple gs
)
4963 gimple_statement_omp_task
*omp_task_stmt
=
4964 as_a
<gimple_statement_omp_task
*> (gs
);
4965 return &omp_task_stmt
->clauses
;
4969 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4973 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4975 gimple_statement_omp_task
*omp_task_stmt
=
4976 as_a
<gimple_statement_omp_task
*> (gs
);
4977 omp_task_stmt
->clauses
= clauses
;
4981 /* Return the child function used to hold the body of OMP_TASK GS. */
4984 gimple_omp_task_child_fn (const_gimple gs
)
4986 const gimple_statement_omp_task
*omp_task_stmt
=
4987 as_a
<const gimple_statement_omp_task
*> (gs
);
4988 return omp_task_stmt
->child_fn
;
4991 /* Return a pointer to the child function used to hold the body of
4994 static inline tree
*
4995 gimple_omp_task_child_fn_ptr (gimple gs
)
4997 gimple_statement_omp_task
*omp_task_stmt
=
4998 as_a
<gimple_statement_omp_task
*> (gs
);
4999 return &omp_task_stmt
->child_fn
;
5003 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5006 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
5008 gimple_statement_omp_task
*omp_task_stmt
=
5009 as_a
<gimple_statement_omp_task
*> (gs
);
5010 omp_task_stmt
->child_fn
= child_fn
;
5014 /* Return the artificial argument used to send variables and values
5015 from the parent to the children threads in OMP_TASK GS. */
5018 gimple_omp_task_data_arg (const_gimple gs
)
5020 const gimple_statement_omp_task
*omp_task_stmt
=
5021 as_a
<const gimple_statement_omp_task
*> (gs
);
5022 return omp_task_stmt
->data_arg
;
5026 /* Return a pointer to the data argument for OMP_TASK GS. */
5028 static inline tree
*
5029 gimple_omp_task_data_arg_ptr (gimple gs
)
5031 gimple_statement_omp_task
*omp_task_stmt
=
5032 as_a
<gimple_statement_omp_task
*> (gs
);
5033 return &omp_task_stmt
->data_arg
;
5037 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5040 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
5042 gimple_statement_omp_task
*omp_task_stmt
=
5043 as_a
<gimple_statement_omp_task
*> (gs
);
5044 omp_task_stmt
->data_arg
= data_arg
;
5048 /* Return the clauses associated with OMP_TASK GS. */
5051 gimple_omp_taskreg_clauses (const_gimple gs
)
5053 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5054 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5055 return omp_taskreg_stmt
->clauses
;
5059 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5061 static inline tree
*
5062 gimple_omp_taskreg_clauses_ptr (gimple gs
)
5064 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5065 as_a
<gimple_statement_omp_taskreg
*> (gs
);
5066 return &omp_taskreg_stmt
->clauses
;
5070 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5074 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
5076 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5077 as_a
<gimple_statement_omp_taskreg
*> (gs
);
5078 omp_taskreg_stmt
->clauses
= clauses
;
5082 /* Return the child function used to hold the body of OMP_TASK GS. */
5085 gimple_omp_taskreg_child_fn (const_gimple gs
)
5087 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5088 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5089 return omp_taskreg_stmt
->child_fn
;
5092 /* Return a pointer to the child function used to hold the body of
5095 static inline tree
*
5096 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
5098 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5099 as_a
<gimple_statement_omp_taskreg
*> (gs
);
5100 return &omp_taskreg_stmt
->child_fn
;
5104 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5107 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
5109 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5110 as_a
<gimple_statement_omp_taskreg
*> (gs
);
5111 omp_taskreg_stmt
->child_fn
= child_fn
;
5115 /* Return the artificial argument used to send variables and values
5116 from the parent to the children threads in OMP_TASK GS. */
5119 gimple_omp_taskreg_data_arg (const_gimple gs
)
5121 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5122 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
5123 return omp_taskreg_stmt
->data_arg
;
5127 /* Return a pointer to the data argument for OMP_TASK GS. */
5129 static inline tree
*
5130 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
5132 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5133 as_a
<gimple_statement_omp_taskreg
*> (gs
);
5134 return &omp_taskreg_stmt
->data_arg
;
5138 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5141 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
5143 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
5144 as_a
<gimple_statement_omp_taskreg
*> (gs
);
5145 omp_taskreg_stmt
->data_arg
= data_arg
;
5149 /* Return the copy function used to hold the body of OMP_TASK GS. */
5152 gimple_omp_task_copy_fn (const_gimple gs
)
5154 const gimple_statement_omp_task
*omp_task_stmt
=
5155 as_a
<const gimple_statement_omp_task
*> (gs
);
5156 return omp_task_stmt
->copy_fn
;
5159 /* Return a pointer to the copy function used to hold the body of
5162 static inline tree
*
5163 gimple_omp_task_copy_fn_ptr (gimple gs
)
5165 gimple_statement_omp_task
*omp_task_stmt
=
5166 as_a
<gimple_statement_omp_task
*> (gs
);
5167 return &omp_task_stmt
->copy_fn
;
5171 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5174 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
5176 gimple_statement_omp_task
*omp_task_stmt
=
5177 as_a
<gimple_statement_omp_task
*> (gs
);
5178 omp_task_stmt
->copy_fn
= copy_fn
;
5182 /* Return size of the data block in bytes in OMP_TASK GS. */
5185 gimple_omp_task_arg_size (const_gimple gs
)
5187 const gimple_statement_omp_task
*omp_task_stmt
=
5188 as_a
<const gimple_statement_omp_task
*> (gs
);
5189 return omp_task_stmt
->arg_size
;
5193 /* Return a pointer to the data block size for OMP_TASK GS. */
5195 static inline tree
*
5196 gimple_omp_task_arg_size_ptr (gimple gs
)
5198 gimple_statement_omp_task
*omp_task_stmt
=
5199 as_a
<gimple_statement_omp_task
*> (gs
);
5200 return &omp_task_stmt
->arg_size
;
5204 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5207 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
5209 gimple_statement_omp_task
*omp_task_stmt
=
5210 as_a
<gimple_statement_omp_task
*> (gs
);
5211 omp_task_stmt
->arg_size
= arg_size
;
5215 /* Return align of the data block in bytes in OMP_TASK GS. */
5218 gimple_omp_task_arg_align (const_gimple gs
)
5220 const gimple_statement_omp_task
*omp_task_stmt
=
5221 as_a
<const gimple_statement_omp_task
*> (gs
);
5222 return omp_task_stmt
->arg_align
;
5226 /* Return a pointer to the data block align for OMP_TASK GS. */
5228 static inline tree
*
5229 gimple_omp_task_arg_align_ptr (gimple gs
)
5231 gimple_statement_omp_task
*omp_task_stmt
=
5232 as_a
<gimple_statement_omp_task
*> (gs
);
5233 return &omp_task_stmt
->arg_align
;
5237 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5240 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
5242 gimple_statement_omp_task
*omp_task_stmt
=
5243 as_a
<gimple_statement_omp_task
*> (gs
);
5244 omp_task_stmt
->arg_align
= arg_align
;
5248 /* Return the clauses associated with OMP_SINGLE GS. */
5251 gimple_omp_single_clauses (const_gimple gs
)
5253 const gimple_statement_omp_single
*omp_single_stmt
=
5254 as_a
<const gimple_statement_omp_single
*> (gs
);
5255 return omp_single_stmt
->clauses
;
5259 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5261 static inline tree
*
5262 gimple_omp_single_clauses_ptr (gimple gs
)
5264 gimple_statement_omp_single
*omp_single_stmt
=
5265 as_a
<gimple_statement_omp_single
*> (gs
);
5266 return &omp_single_stmt
->clauses
;
5270 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5273 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
5275 gimple_statement_omp_single
*omp_single_stmt
=
5276 as_a
<gimple_statement_omp_single
*> (gs
);
5277 omp_single_stmt
->clauses
= clauses
;
5281 /* Return the clauses associated with OMP_TARGET GS. */
5284 gimple_omp_target_clauses (const_gimple gs
)
5286 const gimple_statement_omp_target
*omp_target_stmt
=
5287 as_a
<const gimple_statement_omp_target
*> (gs
);
5288 return omp_target_stmt
->clauses
;
5292 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5294 static inline tree
*
5295 gimple_omp_target_clauses_ptr (gimple gs
)
5297 gimple_statement_omp_target
*omp_target_stmt
=
5298 as_a
<gimple_statement_omp_target
*> (gs
);
5299 return &omp_target_stmt
->clauses
;
5303 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5306 gimple_omp_target_set_clauses (gimple gs
, tree clauses
)
5308 gimple_statement_omp_target
*omp_target_stmt
=
5309 as_a
<gimple_statement_omp_target
*> (gs
);
5310 omp_target_stmt
->clauses
= clauses
;
5314 /* Return the kind of OMP target statemement. */
5317 gimple_omp_target_kind (const_gimple g
)
5319 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5320 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5324 /* Set the OMP target kind. */
5327 gimple_omp_target_set_kind (gimple g
, int kind
)
5329 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5330 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5331 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5335 /* Return the child function used to hold the body of OMP_TARGET GS. */
5338 gimple_omp_target_child_fn (const_gimple gs
)
5340 const gimple_statement_omp_target
*omp_target_stmt
=
5341 as_a
<const gimple_statement_omp_target
*> (gs
);
5342 return omp_target_stmt
->child_fn
;
5345 /* Return a pointer to the child function used to hold the body of
5348 static inline tree
*
5349 gimple_omp_target_child_fn_ptr (gimple gs
)
5351 gimple_statement_omp_target
*omp_target_stmt
=
5352 as_a
<gimple_statement_omp_target
*> (gs
);
5353 return &omp_target_stmt
->child_fn
;
5357 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5360 gimple_omp_target_set_child_fn (gimple gs
, tree child_fn
)
5362 gimple_statement_omp_target
*omp_target_stmt
=
5363 as_a
<gimple_statement_omp_target
*> (gs
);
5364 omp_target_stmt
->child_fn
= child_fn
;
5368 /* Return the artificial argument used to send variables and values
5369 from the parent to the children threads in OMP_TARGET GS. */
5372 gimple_omp_target_data_arg (const_gimple gs
)
5374 const gimple_statement_omp_target
*omp_target_stmt
=
5375 as_a
<const gimple_statement_omp_target
*> (gs
);
5376 return omp_target_stmt
->data_arg
;
5380 /* Return a pointer to the data argument for OMP_TARGET GS. */
5382 static inline tree
*
5383 gimple_omp_target_data_arg_ptr (gimple gs
)
5385 gimple_statement_omp_target
*omp_target_stmt
=
5386 as_a
<gimple_statement_omp_target
*> (gs
);
5387 return &omp_target_stmt
->data_arg
;
5391 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5394 gimple_omp_target_set_data_arg (gimple gs
, tree data_arg
)
5396 gimple_statement_omp_target
*omp_target_stmt
=
5397 as_a
<gimple_statement_omp_target
*> (gs
);
5398 omp_target_stmt
->data_arg
= data_arg
;
5402 /* Return the clauses associated with OMP_TEAMS GS. */
5405 gimple_omp_teams_clauses (const_gimple gs
)
5407 const gimple_statement_omp_teams
*omp_teams_stmt
=
5408 as_a
<const gimple_statement_omp_teams
*> (gs
);
5409 return omp_teams_stmt
->clauses
;
5413 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5415 static inline tree
*
5416 gimple_omp_teams_clauses_ptr (gimple gs
)
5418 gimple_statement_omp_teams
*omp_teams_stmt
=
5419 as_a
<gimple_statement_omp_teams
*> (gs
);
5420 return &omp_teams_stmt
->clauses
;
5424 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5427 gimple_omp_teams_set_clauses (gimple gs
, tree clauses
)
5429 gimple_statement_omp_teams
*omp_teams_stmt
=
5430 as_a
<gimple_statement_omp_teams
*> (gs
);
5431 omp_teams_stmt
->clauses
= clauses
;
5435 /* Return the clauses associated with OMP_SECTIONS GS. */
5438 gimple_omp_sections_clauses (const_gimple gs
)
5440 const gimple_statement_omp_sections
*omp_sections_stmt
=
5441 as_a
<const gimple_statement_omp_sections
*> (gs
);
5442 return omp_sections_stmt
->clauses
;
5446 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5448 static inline tree
*
5449 gimple_omp_sections_clauses_ptr (gimple gs
)
5451 gimple_statement_omp_sections
*omp_sections_stmt
=
5452 as_a
<gimple_statement_omp_sections
*> (gs
);
5453 return &omp_sections_stmt
->clauses
;
5457 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5461 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
5463 gimple_statement_omp_sections
*omp_sections_stmt
=
5464 as_a
<gimple_statement_omp_sections
*> (gs
);
5465 omp_sections_stmt
->clauses
= clauses
;
5469 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5473 gimple_omp_sections_control (const_gimple gs
)
5475 const gimple_statement_omp_sections
*omp_sections_stmt
=
5476 as_a
<const gimple_statement_omp_sections
*> (gs
);
5477 return omp_sections_stmt
->control
;
5481 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5484 static inline tree
*
5485 gimple_omp_sections_control_ptr (gimple gs
)
5487 gimple_statement_omp_sections
*omp_sections_stmt
=
5488 as_a
<gimple_statement_omp_sections
*> (gs
);
5489 return &omp_sections_stmt
->control
;
5493 /* Set CONTROL to be the set of clauses associated with the
5494 GIMPLE_OMP_SECTIONS in GS. */
5497 gimple_omp_sections_set_control (gimple gs
, tree control
)
5499 gimple_statement_omp_sections
*omp_sections_stmt
=
5500 as_a
<gimple_statement_omp_sections
*> (gs
);
5501 omp_sections_stmt
->control
= control
;
5505 /* Set the value being stored in an atomic store. */
5508 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
5510 gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5511 as_a
<gimple_statement_omp_atomic_store
*> (g
);
5512 omp_atomic_store_stmt
->val
= val
;
5516 /* Return the value being stored in an atomic store. */
5519 gimple_omp_atomic_store_val (const_gimple g
)
5521 const gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5522 as_a
<const gimple_statement_omp_atomic_store
*> (g
);
5523 return omp_atomic_store_stmt
->val
;
5527 /* Return a pointer to the value being stored in an atomic store. */
5529 static inline tree
*
5530 gimple_omp_atomic_store_val_ptr (gimple g
)
5532 gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5533 as_a
<gimple_statement_omp_atomic_store
*> (g
);
5534 return &omp_atomic_store_stmt
->val
;
5538 /* Set the LHS of an atomic load. */
5541 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
5543 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5544 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5545 omp_atomic_load_stmt
->lhs
= lhs
;
5549 /* Get the LHS of an atomic load. */
5552 gimple_omp_atomic_load_lhs (const_gimple g
)
5554 const gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5555 as_a
<const gimple_statement_omp_atomic_load
*> (g
);
5556 return omp_atomic_load_stmt
->lhs
;
5560 /* Return a pointer to the LHS of an atomic load. */
5562 static inline tree
*
5563 gimple_omp_atomic_load_lhs_ptr (gimple g
)
5565 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5566 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5567 return &omp_atomic_load_stmt
->lhs
;
5571 /* Set the RHS of an atomic load. */
5574 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
5576 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5577 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5578 omp_atomic_load_stmt
->rhs
= rhs
;
5582 /* Get the RHS of an atomic load. */
5585 gimple_omp_atomic_load_rhs (const_gimple g
)
5587 const gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5588 as_a
<const gimple_statement_omp_atomic_load
*> (g
);
5589 return omp_atomic_load_stmt
->rhs
;
5593 /* Return a pointer to the RHS of an atomic load. */
5595 static inline tree
*
5596 gimple_omp_atomic_load_rhs_ptr (gimple g
)
5598 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5599 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5600 return &omp_atomic_load_stmt
->rhs
;
5604 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5607 gimple_omp_continue_control_def (const_gimple g
)
5609 const gimple_statement_omp_continue
*omp_continue_stmt
=
5610 as_a
<const gimple_statement_omp_continue
*> (g
);
5611 return omp_continue_stmt
->control_def
;
5614 /* The same as above, but return the address. */
5616 static inline tree
*
5617 gimple_omp_continue_control_def_ptr (gimple g
)
5619 gimple_statement_omp_continue
*omp_continue_stmt
=
5620 as_a
<gimple_statement_omp_continue
*> (g
);
5621 return &omp_continue_stmt
->control_def
;
5624 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5627 gimple_omp_continue_set_control_def (gimple g
, tree def
)
5629 gimple_statement_omp_continue
*omp_continue_stmt
=
5630 as_a
<gimple_statement_omp_continue
*> (g
);
5631 omp_continue_stmt
->control_def
= def
;
5635 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5638 gimple_omp_continue_control_use (const_gimple g
)
5640 const gimple_statement_omp_continue
*omp_continue_stmt
=
5641 as_a
<const gimple_statement_omp_continue
*> (g
);
5642 return omp_continue_stmt
->control_use
;
5646 /* The same as above, but return the address. */
5648 static inline tree
*
5649 gimple_omp_continue_control_use_ptr (gimple g
)
5651 gimple_statement_omp_continue
*omp_continue_stmt
=
5652 as_a
<gimple_statement_omp_continue
*> (g
);
5653 return &omp_continue_stmt
->control_use
;
5657 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5660 gimple_omp_continue_set_control_use (gimple g
, tree use
)
5662 gimple_statement_omp_continue
*omp_continue_stmt
=
5663 as_a
<gimple_statement_omp_continue
*> (g
);
5664 omp_continue_stmt
->control_use
= use
;
5667 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5669 static inline gimple_seq
*
5670 gimple_transaction_body_ptr (gimple gs
)
5672 gimple_statement_transaction
*transaction_stmt
=
5673 as_a
<gimple_statement_transaction
*> (gs
);
5674 return &transaction_stmt
->body
;
5677 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5679 static inline gimple_seq
5680 gimple_transaction_body (gimple gs
)
5682 return *gimple_transaction_body_ptr (gs
);
5685 /* Return the label associated with a GIMPLE_TRANSACTION. */
5688 gimple_transaction_label (const_gimple gs
)
5690 const gimple_statement_transaction
*transaction_stmt
=
5691 as_a
<const gimple_statement_transaction
*> (gs
);
5692 return transaction_stmt
->label
;
5695 static inline tree
*
5696 gimple_transaction_label_ptr (gimple gs
)
5698 gimple_statement_transaction
*transaction_stmt
=
5699 as_a
<gimple_statement_transaction
*> (gs
);
5700 return &transaction_stmt
->label
;
5703 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5705 static inline unsigned int
5706 gimple_transaction_subcode (const_gimple gs
)
5708 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5712 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5715 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
5717 gimple_statement_transaction
*transaction_stmt
=
5718 as_a
<gimple_statement_transaction
*> (gs
);
5719 transaction_stmt
->body
= body
;
5722 /* Set the label associated with a GIMPLE_TRANSACTION. */
5725 gimple_transaction_set_label (gimple gs
, tree label
)
5727 gimple_statement_transaction
*transaction_stmt
=
5728 as_a
<gimple_statement_transaction
*> (gs
);
5729 transaction_stmt
->label
= label
;
5732 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5735 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
5737 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5738 gs
->subcode
= subcode
;
5742 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5744 static inline tree
*
5745 gimple_return_retval_ptr (const_gimple gs
)
5747 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5748 return gimple_op_ptr (gs
, 0);
5751 /* Return the return value for GIMPLE_RETURN GS. */
5754 gimple_return_retval (const_gimple gs
)
5756 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5757 return gimple_op (gs
, 0);
5761 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5764 gimple_return_set_retval (gimple gs
, tree retval
)
5766 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5767 gimple_set_op (gs
, 0, retval
);
5771 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5773 #define CASE_GIMPLE_OMP \
5774 case GIMPLE_OACC_KERNELS: \
5775 case GIMPLE_OACC_PARALLEL: \
5776 case GIMPLE_OMP_PARALLEL: \
5777 case GIMPLE_OMP_TASK: \
5778 case GIMPLE_OMP_FOR: \
5779 case GIMPLE_OMP_SECTIONS: \
5780 case GIMPLE_OMP_SECTIONS_SWITCH: \
5781 case GIMPLE_OMP_SINGLE: \
5782 case GIMPLE_OMP_TARGET: \
5783 case GIMPLE_OMP_TEAMS: \
5784 case GIMPLE_OMP_SECTION: \
5785 case GIMPLE_OMP_MASTER: \
5786 case GIMPLE_OMP_TASKGROUP: \
5787 case GIMPLE_OMP_ORDERED: \
5788 case GIMPLE_OMP_CRITICAL: \
5789 case GIMPLE_OMP_RETURN: \
5790 case GIMPLE_OMP_ATOMIC_LOAD: \
5791 case GIMPLE_OMP_ATOMIC_STORE: \
5792 case GIMPLE_OMP_CONTINUE
5795 is_gimple_omp (const_gimple stmt
)
5797 switch (gimple_code (stmt
))
5806 /* Return true if STMT is any of the OpenACC types specifically.
5808 TODO: This function should go away eventually, once all its callers have
5809 either been fixed, changed into more specific checks, or verified to not
5810 need any special handling for OpenACC. */
5813 is_gimple_omp_oacc_specifically (const_gimple stmt
)
5815 gcc_assert (is_gimple_omp (stmt
));
5816 switch (gimple_code (stmt
))
5818 case GIMPLE_OACC_KERNELS
:
5819 case GIMPLE_OACC_PARALLEL
:
5821 case GIMPLE_OMP_FOR
:
5822 switch (gimple_omp_for_kind (stmt
))
5824 case GF_OMP_FOR_KIND_OACC_LOOP
:
5829 case GIMPLE_OMP_TARGET
:
5830 switch (gimple_omp_target_kind (stmt
))
5832 case GF_OMP_TARGET_KIND_OACC_DATA
:
5834 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
5845 /* Return true if OMP_* STMT is offloaded. */
5848 is_gimple_omp_offloaded (const_gimple stmt
)
5850 gcc_assert (is_gimple_omp (stmt
));
5851 switch (gimple_code (stmt
))
5853 case GIMPLE_OACC_KERNELS
:
5854 case GIMPLE_OACC_PARALLEL
:
5856 case GIMPLE_OMP_TARGET
:
5857 switch (gimple_omp_target_kind (stmt
))
5859 case GF_OMP_TARGET_KIND_REGION
:
5870 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5873 gimple_nop_p (const_gimple g
)
5875 return gimple_code (g
) == GIMPLE_NOP
;
5879 /* Return true if GS is a GIMPLE_RESX. */
5882 is_gimple_resx (const_gimple gs
)
5884 return gimple_code (gs
) == GIMPLE_RESX
;
5887 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5889 static inline enum br_predictor
5890 gimple_predict_predictor (gimple gs
)
5892 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5893 return (enum br_predictor
) (gs
->subcode
& ~GF_PREDICT_TAKEN
);
5897 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5900 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5902 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5903 gs
->subcode
= (gs
->subcode
& GF_PREDICT_TAKEN
)
5904 | (unsigned) predictor
;
5908 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5910 static inline enum prediction
5911 gimple_predict_outcome (gimple gs
)
5913 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5914 return (gs
->subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5918 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5921 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5923 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5924 if (outcome
== TAKEN
)
5925 gs
->subcode
|= GF_PREDICT_TAKEN
;
5927 gs
->subcode
&= ~GF_PREDICT_TAKEN
;
5931 /* Return the type of the main expression computed by STMT. Return
5932 void_type_node if the statement computes nothing. */
5935 gimple_expr_type (const_gimple stmt
)
5937 enum gimple_code code
= gimple_code (stmt
);
5939 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5942 /* In general we want to pass out a type that can be substituted
5943 for both the RHS and the LHS types if there is a possibly
5944 useless conversion involved. That means returning the
5945 original RHS type as far as we can reconstruct it. */
5946 if (code
== GIMPLE_CALL
)
5948 if (gimple_call_internal_p (stmt
)
5949 && gimple_call_internal_fn (stmt
) == IFN_MASK_STORE
)
5950 type
= TREE_TYPE (gimple_call_arg (stmt
, 3));
5952 type
= gimple_call_return_type (stmt
);
5955 switch (gimple_assign_rhs_code (stmt
))
5957 case POINTER_PLUS_EXPR
:
5958 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5962 /* As fallback use the type of the LHS. */
5963 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5968 else if (code
== GIMPLE_COND
)
5969 return boolean_type_node
;
5971 return void_type_node
;
5974 /* Enum and arrays used for allocation stats. Keep in sync with
5975 gimple.c:gimple_alloc_kind_names. */
5976 enum gimple_alloc_kind
5978 gimple_alloc_kind_assign
, /* Assignments. */
5979 gimple_alloc_kind_phi
, /* PHI nodes. */
5980 gimple_alloc_kind_cond
, /* Conditionals. */
5981 gimple_alloc_kind_rest
, /* Everything else. */
5982 gimple_alloc_kind_all
5985 extern int gimple_alloc_counts
[];
5986 extern int gimple_alloc_sizes
[];
5988 /* Return the allocation kind for a given stmt CODE. */
5989 static inline enum gimple_alloc_kind
5990 gimple_alloc_kind (enum gimple_code code
)
5995 return gimple_alloc_kind_assign
;
5997 return gimple_alloc_kind_phi
;
5999 return gimple_alloc_kind_cond
;
6001 return gimple_alloc_kind_rest
;
6005 /* Return true if a location should not be emitted for this statement
6006 by annotate_all_with_location. */
6009 gimple_do_not_emit_location_p (gimple g
)
6011 return gimple_plf (g
, GF_PLF_1
);
6014 /* Mark statement G so a location will not be emitted by
6015 annotate_one_with_location. */
6018 gimple_set_do_not_emit_location (gimple g
)
6020 /* The PLF flags are initialized to 0 when a new tuple is created,
6021 so no need to initialize it anywhere. */
6022 gimple_set_plf (g
, GF_PLF_1
, true);
6026 /* Macros for showing usage statistics. */
6027 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6029 : ((x) < 1024*1024*10 \
6031 : (x) / (1024*1024))))
6033 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6035 #endif /* GCC_GIMPLE_H */