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_CALL_CTRL_ALTERING
= 1 << 7,
94 GF_CALL_WITH_BOUNDS
= 1 << 8,
95 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
96 GF_OMP_FOR_KIND_MASK
= 7 << 0,
97 GF_OMP_FOR_KIND_FOR
= 0,
98 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
99 GF_OMP_FOR_KIND_CILKFOR
= 2,
100 /* Flag for SIMD variants of OMP_FOR kinds. */
101 GF_OMP_FOR_SIMD
= 1 << 2,
102 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
103 GF_OMP_FOR_KIND_CILKSIMD
= GF_OMP_FOR_SIMD
| 1,
104 GF_OMP_FOR_COMBINED
= 1 << 3,
105 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
106 GF_OMP_TARGET_KIND_MASK
= (1 << 2) - 1,
107 GF_OMP_TARGET_KIND_REGION
= 0,
108 GF_OMP_TARGET_KIND_DATA
= 1,
109 GF_OMP_TARGET_KIND_UPDATE
= 2,
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_OMP_PARALLEL, GIMPLE_OMP_TARGET */
560 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
561 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
563 /* [ WORD 1-7 ] : base class */
570 Child function holding the body of the parallel region. */
574 Shared data argument. */
578 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
579 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
580 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
582 /* No extra fields; adds invariant:
583 stmt->code == GIMPLE_OMP_PARALLEL
584 || stmt->code == GIMPLE_OMP_TASK. */
588 /* GIMPLE_OMP_PARALLEL */
589 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
590 gimple_statement_omp_parallel
: public gimple_statement_omp_taskreg
592 /* No extra fields; adds invariant:
593 stmt->code == GIMPLE_OMP_PARALLEL. */
596 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
597 gimple_statement_omp_target
: public gimple_statement_omp_parallel_layout
599 /* No extra fields; adds invariant:
600 stmt->code == GIMPLE_OMP_TARGET. */
603 /* GIMPLE_OMP_TASK */
605 struct GTY((tag("GSS_OMP_TASK")))
606 gimple_statement_omp_task
: public gimple_statement_omp_taskreg
608 /* [ WORD 1-10 ] : base class */
611 Child function holding firstprivate initialization if needed. */
615 Size and alignment in bytes of the argument data block. */
621 /* GIMPLE_OMP_SECTION */
622 /* Uses struct gimple_statement_omp. */
625 /* GIMPLE_OMP_SECTIONS */
627 struct GTY((tag("GSS_OMP_SECTIONS")))
628 gimple_statement_omp_sections
: public gimple_statement_omp
630 /* [ WORD 1-7 ] : base class */
636 The control variable used for deciding which of the sections to
641 /* GIMPLE_OMP_CONTINUE.
643 Note: This does not inherit from gimple_statement_omp, because we
644 do not need the body field. */
646 struct GTY((tag("GSS_OMP_CONTINUE")))
647 gimple_statement_omp_continue
: public gimple_statement_base
649 /* [ WORD 1-6 ] : base class */
658 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
660 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
661 gimple_statement_omp_single_layout
: public gimple_statement_omp
663 /* [ WORD 1-7 ] : base class */
669 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
670 gimple_statement_omp_single
: public gimple_statement_omp_single_layout
672 /* No extra fields; adds invariant:
673 stmt->code == GIMPLE_OMP_SINGLE. */
676 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
677 gimple_statement_omp_teams
: public gimple_statement_omp_single_layout
679 /* No extra fields; adds invariant:
680 stmt->code == GIMPLE_OMP_TEAMS. */
684 /* GIMPLE_OMP_ATOMIC_LOAD.
685 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
686 contains a sequence, which we don't need here. */
688 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
689 gimple_statement_omp_atomic_load
: public gimple_statement_base
691 /* [ WORD 1-6 ] : base class */
697 /* GIMPLE_OMP_ATOMIC_STORE.
698 See note on GIMPLE_OMP_ATOMIC_LOAD. */
700 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
701 gimple_statement_omp_atomic_store_layout
: public gimple_statement_base
703 /* [ WORD 1-6 ] : base class */
709 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
710 gimple_statement_omp_atomic_store
:
711 public gimple_statement_omp_atomic_store_layout
713 /* No extra fields; adds invariant:
714 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
717 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
718 gimple_statement_omp_return
:
719 public gimple_statement_omp_atomic_store_layout
721 /* No extra fields; adds invariant:
722 stmt->code == GIMPLE_OMP_RETURN. */
725 /* GIMPLE_TRANSACTION. */
727 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
729 /* The __transaction_atomic was declared [[outer]] or it is
730 __transaction_relaxed. */
731 #define GTMA_IS_OUTER (1u << 0)
732 #define GTMA_IS_RELAXED (1u << 1)
733 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
735 /* The transaction is seen to not have an abort. */
736 #define GTMA_HAVE_ABORT (1u << 2)
737 /* The transaction is seen to have loads or stores. */
738 #define GTMA_HAVE_LOAD (1u << 3)
739 #define GTMA_HAVE_STORE (1u << 4)
740 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
741 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
742 /* The transaction WILL enter serial irrevocable mode.
743 An irrevocable block post-dominates the entire transaction, such
744 that all invocations of the transaction will go serial-irrevocable.
745 In such case, we don't bother instrumenting the transaction, and
746 tell the runtime that it should begin the transaction in
747 serial-irrevocable mode. */
748 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
749 /* The transaction contains no instrumentation code whatsover, most
750 likely because it is guaranteed to go irrevocable upon entry. */
751 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
753 struct GTY((tag("GSS_TRANSACTION")))
754 gimple_statement_transaction
: public gimple_statement_with_memory_ops_base
756 /* [ WORD 1-9 ] : base class */
765 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
766 enum gimple_statement_structure_enum
{
767 #include "gsstruct.def"
775 is_a_helper
<gimple_statement_asm
*>::test (gimple gs
)
777 return gs
->code
== GIMPLE_ASM
;
783 is_a_helper
<gimple_statement_bind
*>::test (gimple gs
)
785 return gs
->code
== GIMPLE_BIND
;
791 is_a_helper
<gimple_statement_call
*>::test (gimple gs
)
793 return gs
->code
== GIMPLE_CALL
;
799 is_a_helper
<gimple_statement_catch
*>::test (gimple gs
)
801 return gs
->code
== GIMPLE_CATCH
;
807 is_a_helper
<gimple_statement_resx
*>::test (gimple gs
)
809 return gs
->code
== GIMPLE_RESX
;
815 is_a_helper
<gimple_statement_eh_dispatch
*>::test (gimple gs
)
817 return gs
->code
== GIMPLE_EH_DISPATCH
;
823 is_a_helper
<gimple_statement_eh_else
*>::test (gimple gs
)
825 return gs
->code
== GIMPLE_EH_ELSE
;
831 is_a_helper
<gimple_statement_eh_filter
*>::test (gimple gs
)
833 return gs
->code
== GIMPLE_EH_FILTER
;
839 is_a_helper
<gimple_statement_eh_mnt
*>::test (gimple gs
)
841 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
847 is_a_helper
<gimple_statement_omp_atomic_load
*>::test (gimple gs
)
849 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
855 is_a_helper
<gimple_statement_omp_atomic_store
*>::test (gimple gs
)
857 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
863 is_a_helper
<gimple_statement_omp_return
*>::test (gimple gs
)
865 return gs
->code
== GIMPLE_OMP_RETURN
;
871 is_a_helper
<gimple_statement_omp_continue
*>::test (gimple gs
)
873 return gs
->code
== GIMPLE_OMP_CONTINUE
;
879 is_a_helper
<gimple_statement_omp_critical
*>::test (gimple gs
)
881 return gs
->code
== GIMPLE_OMP_CRITICAL
;
887 is_a_helper
<gimple_statement_omp_for
*>::test (gimple gs
)
889 return gs
->code
== GIMPLE_OMP_FOR
;
895 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple gs
)
897 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
903 is_a_helper
<gimple_statement_omp_parallel
*>::test (gimple gs
)
905 return gs
->code
== GIMPLE_OMP_PARALLEL
;
911 is_a_helper
<gimple_statement_omp_target
*>::test (gimple gs
)
913 return gs
->code
== GIMPLE_OMP_TARGET
;
919 is_a_helper
<gimple_statement_omp_sections
*>::test (gimple gs
)
921 return gs
->code
== GIMPLE_OMP_SECTIONS
;
927 is_a_helper
<gimple_statement_omp_single
*>::test (gimple gs
)
929 return gs
->code
== GIMPLE_OMP_SINGLE
;
935 is_a_helper
<gimple_statement_omp_teams
*>::test (gimple gs
)
937 return gs
->code
== GIMPLE_OMP_TEAMS
;
943 is_a_helper
<gimple_statement_omp_task
*>::test (gimple gs
)
945 return gs
->code
== GIMPLE_OMP_TASK
;
951 is_a_helper
<gimple_statement_phi
*>::test (gimple gs
)
953 return gs
->code
== GIMPLE_PHI
;
959 is_a_helper
<gimple_statement_transaction
*>::test (gimple gs
)
961 return gs
->code
== GIMPLE_TRANSACTION
;
967 is_a_helper
<gimple_statement_try
*>::test (gimple gs
)
969 return gs
->code
== GIMPLE_TRY
;
975 is_a_helper
<gimple_statement_wce
*>::test (gimple gs
)
977 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
983 is_a_helper
<const gimple_statement_asm
*>::test (const_gimple gs
)
985 return gs
->code
== GIMPLE_ASM
;
991 is_a_helper
<const gimple_statement_bind
*>::test (const_gimple gs
)
993 return gs
->code
== GIMPLE_BIND
;
999 is_a_helper
<const gimple_statement_call
*>::test (const_gimple gs
)
1001 return gs
->code
== GIMPLE_CALL
;
1007 is_a_helper
<const gimple_statement_catch
*>::test (const_gimple gs
)
1009 return gs
->code
== GIMPLE_CATCH
;
1015 is_a_helper
<const gimple_statement_resx
*>::test (const_gimple gs
)
1017 return gs
->code
== GIMPLE_RESX
;
1023 is_a_helper
<const gimple_statement_eh_dispatch
*>::test (const_gimple gs
)
1025 return gs
->code
== GIMPLE_EH_DISPATCH
;
1031 is_a_helper
<const gimple_statement_eh_filter
*>::test (const_gimple gs
)
1033 return gs
->code
== GIMPLE_EH_FILTER
;
1039 is_a_helper
<const gimple_statement_omp_atomic_load
*>::test (const_gimple gs
)
1041 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1047 is_a_helper
<const gimple_statement_omp_atomic_store
*>::test (const_gimple gs
)
1049 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1055 is_a_helper
<const gimple_statement_omp_return
*>::test (const_gimple gs
)
1057 return gs
->code
== GIMPLE_OMP_RETURN
;
1063 is_a_helper
<const gimple_statement_omp_continue
*>::test (const_gimple gs
)
1065 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1071 is_a_helper
<const gimple_statement_omp_critical
*>::test (const_gimple gs
)
1073 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1079 is_a_helper
<const gimple_statement_omp_for
*>::test (const_gimple gs
)
1081 return gs
->code
== GIMPLE_OMP_FOR
;
1087 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const_gimple gs
)
1089 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1095 is_a_helper
<const gimple_statement_omp_parallel
*>::test (const_gimple gs
)
1097 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1103 is_a_helper
<const gimple_statement_omp_target
*>::test (const_gimple gs
)
1105 return gs
->code
== GIMPLE_OMP_TARGET
;
1111 is_a_helper
<const gimple_statement_omp_sections
*>::test (const_gimple gs
)
1113 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1119 is_a_helper
<const gimple_statement_omp_single
*>::test (const_gimple gs
)
1121 return gs
->code
== GIMPLE_OMP_SINGLE
;
1127 is_a_helper
<const gimple_statement_omp_teams
*>::test (const_gimple gs
)
1129 return gs
->code
== GIMPLE_OMP_TEAMS
;
1135 is_a_helper
<const gimple_statement_omp_task
*>::test (const_gimple gs
)
1137 return gs
->code
== GIMPLE_OMP_TASK
;
1143 is_a_helper
<const gimple_statement_phi
*>::test (const_gimple gs
)
1145 return gs
->code
== GIMPLE_PHI
;
1151 is_a_helper
<const gimple_statement_transaction
*>::test (const_gimple gs
)
1153 return gs
->code
== GIMPLE_TRANSACTION
;
1156 /* Offset in bytes to the location of the operand vector.
1157 Zero if there is no operand vector for this tuple structure. */
1158 extern size_t const gimple_ops_offset_
[];
1160 /* Map GIMPLE codes to GSS codes. */
1161 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1163 /* This variable holds the currently expanded gimple statement for purposes
1164 of comminucating the profile info to the builtin expanders. */
1165 extern gimple currently_expanding_gimple_stmt
;
1167 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1168 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
1169 gimple
gimple_build_return (tree
);
1170 void gimple_call_reset_alias_info (gimple
);
1171 gimple
gimple_build_call_vec (tree
, vec
<tree
> );
1172 gimple
gimple_build_call (tree
, unsigned, ...);
1173 gimple
gimple_build_call_valist (tree
, unsigned, va_list);
1174 gimple
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1175 gimple
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1176 gimple
gimple_build_call_from_tree (tree
);
1177 gimple
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
1178 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1179 gimple
gimple_build_assign_with_ops (enum tree_code
, tree
,
1180 tree
, tree
, tree CXX_MEM_STAT_INFO
);
1181 gimple
gimple_build_assign_with_ops (enum tree_code
, tree
,
1182 tree
, tree CXX_MEM_STAT_INFO
);
1183 gimple
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1184 gimple
gimple_build_cond_from_tree (tree
, tree
, tree
);
1185 void gimple_cond_set_condition_from_tree (gimple
, tree
);
1186 gimple
gimple_build_label (tree label
);
1187 gimple
gimple_build_goto (tree dest
);
1188 gimple
gimple_build_nop (void);
1189 gimple
gimple_build_bind (tree
, gimple_seq
, tree
);
1190 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1191 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1192 vec
<tree
, va_gc
> *);
1193 gimple
gimple_build_catch (tree
, gimple_seq
);
1194 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
1195 gimple
gimple_build_eh_must_not_throw (tree
);
1196 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
1197 gimple_statement_try
*gimple_build_try (gimple_seq
, gimple_seq
,
1198 enum gimple_try_flags
);
1199 gimple
gimple_build_wce (gimple_seq
);
1200 gimple
gimple_build_resx (int);
1201 gimple
gimple_build_switch_nlabels (unsigned, tree
, tree
);
1202 gimple
gimple_build_switch (tree
, tree
, vec
<tree
> );
1203 gimple
gimple_build_eh_dispatch (int);
1204 gimple
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1205 #define gimple_build_debug_bind(var,val,stmt) \
1206 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1207 gimple
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1208 #define gimple_build_debug_source_bind(var,val,stmt) \
1209 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1210 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
1211 gimple
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1212 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1213 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
1214 gimple
gimple_build_omp_section (gimple_seq
);
1215 gimple
gimple_build_omp_master (gimple_seq
);
1216 gimple
gimple_build_omp_taskgroup (gimple_seq
);
1217 gimple
gimple_build_omp_continue (tree
, tree
);
1218 gimple
gimple_build_omp_ordered (gimple_seq
);
1219 gimple
gimple_build_omp_return (bool);
1220 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
1221 gimple
gimple_build_omp_sections_switch (void);
1222 gimple
gimple_build_omp_single (gimple_seq
, tree
);
1223 gimple
gimple_build_omp_target (gimple_seq
, int, tree
);
1224 gimple
gimple_build_omp_teams (gimple_seq
, tree
);
1225 gimple
gimple_build_omp_atomic_load (tree
, tree
);
1226 gimple
gimple_build_omp_atomic_store (tree
);
1227 gimple
gimple_build_transaction (gimple_seq
, tree
);
1228 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
1229 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1230 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1231 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1232 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1233 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1235 extern void annotate_all_with_location (gimple_seq
, location_t
);
1236 bool empty_body_p (gimple_seq
);
1237 gimple_seq
gimple_seq_copy (gimple_seq
);
1238 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
1239 int gimple_call_flags (const_gimple
);
1240 int gimple_call_arg_flags (const_gimple
, unsigned);
1241 int gimple_call_return_flags (const_gimple
);
1242 bool gimple_assign_copy_p (gimple
);
1243 bool gimple_assign_ssa_name_copy_p (gimple
);
1244 bool gimple_assign_unary_nop_p (gimple
);
1245 void gimple_set_bb (gimple
, basic_block
);
1246 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1247 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
1249 tree
gimple_get_lhs (const_gimple
);
1250 void gimple_set_lhs (gimple
, tree
);
1251 gimple
gimple_copy (gimple
);
1252 bool gimple_has_side_effects (const_gimple
);
1253 bool gimple_could_trap_p_1 (gimple
, bool, bool);
1254 bool gimple_could_trap_p (gimple
);
1255 bool gimple_assign_rhs_could_trap_p (gimple
);
1256 extern void dump_gimple_statistics (void);
1257 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1258 extern tree
canonicalize_cond_expr_cond (tree
);
1259 gimple
gimple_call_copy_skip_args (gimple
, bitmap
);
1260 extern bool gimple_compare_field_offset (tree
, tree
);
1261 extern tree
gimple_unsigned_type (tree
);
1262 extern tree
gimple_signed_type (tree
);
1263 extern alias_set_type
gimple_get_alias_set (tree
);
1264 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
1265 extern bool gimple_builtin_call_types_compatible_p (const_gimple
, tree
);
1266 extern bool gimple_call_builtin_p (const_gimple
);
1267 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_class
);
1268 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_function
);
1269 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
1270 extern void dump_decl_set (FILE *, bitmap
);
1271 extern bool nonfreeing_call_p (gimple
);
1272 extern bool infer_nonnull_range (gimple
, tree
, bool, bool);
1273 extern void sort_case_labels (vec
<tree
>);
1274 extern void preprocess_case_label_vec_for_gimple (vec
<tree
>, tree
, tree
*);
1275 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1276 extern void gimple_seq_discard (gimple_seq
);
1278 /* Formal (expression) temporary table handling: multiple occurrences of
1279 the same scalar expression are evaluated into the same temporary. */
1281 typedef struct gimple_temp_hash_elt
1284 tree temp
; /* Value */
1287 /* Get the number of the next statement uid to be allocated. */
1288 static inline unsigned int
1289 gimple_stmt_max_uid (struct function
*fn
)
1291 return fn
->last_stmt_uid
;
1294 /* Set the number of the next statement uid to be allocated. */
1296 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1298 fn
->last_stmt_uid
= maxid
;
1301 /* Set the number of the next statement uid to be allocated. */
1302 static inline unsigned int
1303 inc_gimple_stmt_max_uid (struct function
*fn
)
1305 return fn
->last_stmt_uid
++;
1308 /* Return the first node in GIMPLE sequence S. */
1310 static inline gimple_seq_node
1311 gimple_seq_first (gimple_seq s
)
1317 /* Return the first statement in GIMPLE sequence S. */
1319 static inline gimple
1320 gimple_seq_first_stmt (gimple_seq s
)
1322 gimple_seq_node n
= gimple_seq_first (s
);
1327 /* Return the last node in GIMPLE sequence S. */
1329 static inline gimple_seq_node
1330 gimple_seq_last (gimple_seq s
)
1332 return s
? s
->prev
: NULL
;
1336 /* Return the last statement in GIMPLE sequence S. */
1338 static inline gimple
1339 gimple_seq_last_stmt (gimple_seq s
)
1341 gimple_seq_node n
= gimple_seq_last (s
);
1346 /* Set the last node in GIMPLE sequence *PS to LAST. */
1349 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1355 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1358 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1364 /* Return true if GIMPLE sequence S is empty. */
1367 gimple_seq_empty_p (gimple_seq s
)
1372 /* Allocate a new sequence and initialize its first element with STMT. */
1374 static inline gimple_seq
1375 gimple_seq_alloc_with_stmt (gimple stmt
)
1377 gimple_seq seq
= NULL
;
1378 gimple_seq_add_stmt (&seq
, stmt
);
1383 /* Returns the sequence of statements in BB. */
1385 static inline gimple_seq
1386 bb_seq (const_basic_block bb
)
1388 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1391 static inline gimple_seq
*
1392 bb_seq_addr (basic_block bb
)
1394 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1397 /* Sets the sequence of statements in BB to SEQ. */
1400 set_bb_seq (basic_block bb
, gimple_seq seq
)
1402 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1403 bb
->il
.gimple
.seq
= seq
;
1407 /* Return the code for GIMPLE statement G. */
1409 static inline enum gimple_code
1410 gimple_code (const_gimple g
)
1416 /* Return the GSS code used by a GIMPLE code. */
1418 static inline enum gimple_statement_structure_enum
1419 gss_for_code (enum gimple_code code
)
1421 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1422 return gss_for_code_
[code
];
1426 /* Return which GSS code is used by GS. */
1428 static inline enum gimple_statement_structure_enum
1429 gimple_statement_structure (gimple gs
)
1431 return gss_for_code (gimple_code (gs
));
1435 /* Return true if statement G has sub-statements. This is only true for
1436 High GIMPLE statements. */
1439 gimple_has_substatements (gimple g
)
1441 switch (gimple_code (g
))
1445 case GIMPLE_EH_FILTER
:
1446 case GIMPLE_EH_ELSE
:
1448 case GIMPLE_OMP_FOR
:
1449 case GIMPLE_OMP_MASTER
:
1450 case GIMPLE_OMP_TASKGROUP
:
1451 case GIMPLE_OMP_ORDERED
:
1452 case GIMPLE_OMP_SECTION
:
1453 case GIMPLE_OMP_PARALLEL
:
1454 case GIMPLE_OMP_TASK
:
1455 case GIMPLE_OMP_SECTIONS
:
1456 case GIMPLE_OMP_SINGLE
:
1457 case GIMPLE_OMP_TARGET
:
1458 case GIMPLE_OMP_TEAMS
:
1459 case GIMPLE_OMP_CRITICAL
:
1460 case GIMPLE_WITH_CLEANUP_EXPR
:
1461 case GIMPLE_TRANSACTION
:
1470 /* Return the basic block holding statement G. */
1472 static inline basic_block
1473 gimple_bb (const_gimple g
)
1479 /* Return the lexical scope block holding statement G. */
1482 gimple_block (const_gimple g
)
1484 return LOCATION_BLOCK (g
->location
);
1488 /* Set BLOCK to be the lexical scope block holding statement G. */
1491 gimple_set_block (gimple g
, tree block
)
1495 COMBINE_LOCATION_DATA (line_table
, g
->location
, block
);
1497 g
->location
= LOCATION_LOCUS (g
->location
);
1501 /* Return location information for statement G. */
1503 static inline location_t
1504 gimple_location (const_gimple g
)
1509 /* Return location information for statement G if g is not NULL.
1510 Otherwise, UNKNOWN_LOCATION is returned. */
1512 static inline location_t
1513 gimple_location_safe (const_gimple g
)
1515 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1518 /* Return pointer to location information for statement G. */
1520 static inline const location_t
*
1521 gimple_location_ptr (const_gimple g
)
1523 return &g
->location
;
1527 /* Set location information for statement G. */
1530 gimple_set_location (gimple g
, location_t location
)
1532 g
->location
= location
;
1536 /* Return true if G contains location information. */
1539 gimple_has_location (const_gimple g
)
1541 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1545 /* Return the file name of the location of STMT. */
1547 static inline const char *
1548 gimple_filename (const_gimple stmt
)
1550 return LOCATION_FILE (gimple_location (stmt
));
1554 /* Return the line number of the location of STMT. */
1557 gimple_lineno (const_gimple stmt
)
1559 return LOCATION_LINE (gimple_location (stmt
));
1563 /* Determine whether SEQ is a singleton. */
1566 gimple_seq_singleton_p (gimple_seq seq
)
1568 return ((gimple_seq_first (seq
) != NULL
)
1569 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1572 /* Return true if no warnings should be emitted for statement STMT. */
1575 gimple_no_warning_p (const_gimple stmt
)
1577 return stmt
->no_warning
;
1580 /* Set the no_warning flag of STMT to NO_WARNING. */
1583 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1585 stmt
->no_warning
= (unsigned) no_warning
;
1588 /* Set the visited status on statement STMT to VISITED_P. */
1591 gimple_set_visited (gimple stmt
, bool visited_p
)
1593 stmt
->visited
= (unsigned) visited_p
;
1597 /* Return the visited status for statement STMT. */
1600 gimple_visited_p (gimple stmt
)
1602 return stmt
->visited
;
1606 /* Set pass local flag PLF on statement STMT to VAL_P. */
1609 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1612 stmt
->plf
|= (unsigned int) plf
;
1614 stmt
->plf
&= ~((unsigned int) plf
);
1618 /* Return the value of pass local flag PLF on statement STMT. */
1620 static inline unsigned int
1621 gimple_plf (gimple stmt
, enum plf_mask plf
)
1623 return stmt
->plf
& ((unsigned int) plf
);
1627 /* Set the UID of statement. */
1630 gimple_set_uid (gimple g
, unsigned uid
)
1636 /* Return the UID of statement. */
1638 static inline unsigned
1639 gimple_uid (const_gimple g
)
1645 /* Make statement G a singleton sequence. */
1648 gimple_init_singleton (gimple g
)
1655 /* Return true if GIMPLE statement G has register or memory operands. */
1658 gimple_has_ops (const_gimple g
)
1660 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1666 is_a_helper
<const gimple_statement_with_ops
*>::test (const_gimple gs
)
1668 return gimple_has_ops (gs
);
1674 is_a_helper
<gimple_statement_with_ops
*>::test (gimple gs
)
1676 return gimple_has_ops (gs
);
1679 /* Return true if GIMPLE statement G has memory operands. */
1682 gimple_has_mem_ops (const_gimple g
)
1684 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1690 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const_gimple gs
)
1692 return gimple_has_mem_ops (gs
);
1698 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple gs
)
1700 return gimple_has_mem_ops (gs
);
1703 /* Return the set of USE operands for statement G. */
1705 static inline struct use_optype_d
*
1706 gimple_use_ops (const_gimple g
)
1708 const gimple_statement_with_ops
*ops_stmt
=
1709 dyn_cast
<const gimple_statement_with_ops
*> (g
);
1712 return ops_stmt
->use_ops
;
1716 /* Set USE to be the set of USE operands for statement G. */
1719 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1721 gimple_statement_with_ops
*ops_stmt
=
1722 as_a
<gimple_statement_with_ops
*> (g
);
1723 ops_stmt
->use_ops
= use
;
1727 /* Return the single VUSE operand of the statement G. */
1730 gimple_vuse (const_gimple g
)
1732 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1733 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1736 return mem_ops_stmt
->vuse
;
1739 /* Return the single VDEF operand of the statement G. */
1742 gimple_vdef (const_gimple g
)
1744 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1745 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1748 return mem_ops_stmt
->vdef
;
1751 /* Return the single VUSE operand of the statement G. */
1753 static inline tree
*
1754 gimple_vuse_ptr (gimple g
)
1756 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1757 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1760 return &mem_ops_stmt
->vuse
;
1763 /* Return the single VDEF operand of the statement G. */
1765 static inline tree
*
1766 gimple_vdef_ptr (gimple g
)
1768 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1769 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1772 return &mem_ops_stmt
->vdef
;
1775 /* Set the single VUSE operand of the statement G. */
1778 gimple_set_vuse (gimple g
, tree vuse
)
1780 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1781 as_a
<gimple_statement_with_memory_ops
*> (g
);
1782 mem_ops_stmt
->vuse
= vuse
;
1785 /* Set the single VDEF operand of the statement G. */
1788 gimple_set_vdef (gimple g
, tree vdef
)
1790 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1791 as_a
<gimple_statement_with_memory_ops
*> (g
);
1792 mem_ops_stmt
->vdef
= vdef
;
1796 /* Return true if statement G has operands and the modified field has
1800 gimple_modified_p (const_gimple g
)
1802 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
1806 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1807 a MODIFIED field. */
1810 gimple_set_modified (gimple s
, bool modifiedp
)
1812 if (gimple_has_ops (s
))
1813 s
->modified
= (unsigned) modifiedp
;
1817 /* Return the tree code for the expression computed by STMT. This is
1818 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1819 GIMPLE_CALL, return CALL_EXPR as the expression code for
1820 consistency. This is useful when the caller needs to deal with the
1821 three kinds of computation that GIMPLE supports. */
1823 static inline enum tree_code
1824 gimple_expr_code (const_gimple stmt
)
1826 enum gimple_code code
= gimple_code (stmt
);
1827 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1828 return (enum tree_code
) stmt
->subcode
;
1831 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1837 /* Return true if statement STMT contains volatile operands. */
1840 gimple_has_volatile_ops (const_gimple stmt
)
1842 if (gimple_has_mem_ops (stmt
))
1843 return stmt
->has_volatile_ops
;
1849 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1852 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1854 if (gimple_has_mem_ops (stmt
))
1855 stmt
->has_volatile_ops
= (unsigned) volatilep
;
1858 /* Return true if STMT is in a transaction. */
1861 gimple_in_transaction (gimple stmt
)
1863 return bb_in_transaction (gimple_bb (stmt
));
1866 /* Return true if statement STMT may access memory. */
1869 gimple_references_memory_p (gimple stmt
)
1871 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1875 /* Return the subcode for OMP statement S. */
1877 static inline unsigned
1878 gimple_omp_subcode (const_gimple s
)
1880 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1881 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
1885 /* Set the subcode for OMP statement S to SUBCODE. */
1888 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1890 /* We only have 16 bits for the subcode. Assert that we are not
1892 gcc_gimple_checking_assert (subcode
< (1 << 16));
1893 s
->subcode
= subcode
;
1896 /* Set the nowait flag on OMP_RETURN statement S. */
1899 gimple_omp_return_set_nowait (gimple s
)
1901 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
1902 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
1906 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1910 gimple_omp_return_nowait_p (const_gimple g
)
1912 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
1913 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
1917 /* Set the LHS of OMP return. */
1920 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
1922 gimple_statement_omp_return
*omp_return_stmt
=
1923 as_a
<gimple_statement_omp_return
*> (g
);
1924 omp_return_stmt
->val
= lhs
;
1928 /* Get the LHS of OMP return. */
1931 gimple_omp_return_lhs (const_gimple g
)
1933 const gimple_statement_omp_return
*omp_return_stmt
=
1934 as_a
<const gimple_statement_omp_return
*> (g
);
1935 return omp_return_stmt
->val
;
1939 /* Return a pointer to the LHS of OMP return. */
1941 static inline tree
*
1942 gimple_omp_return_lhs_ptr (gimple g
)
1944 gimple_statement_omp_return
*omp_return_stmt
=
1945 as_a
<gimple_statement_omp_return
*> (g
);
1946 return &omp_return_stmt
->val
;
1950 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1954 gimple_omp_section_last_p (const_gimple g
)
1956 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1957 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
1961 /* Set the GF_OMP_SECTION_LAST flag on G. */
1964 gimple_omp_section_set_last (gimple g
)
1966 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
1967 g
->subcode
|= GF_OMP_SECTION_LAST
;
1971 /* Return true if OMP parallel statement G has the
1972 GF_OMP_PARALLEL_COMBINED flag set. */
1975 gimple_omp_parallel_combined_p (const_gimple g
)
1977 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1978 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
1982 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1983 value of COMBINED_P. */
1986 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
1988 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
1990 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
1992 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
1996 /* Return true if OMP atomic load/store statement G has the
1997 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2000 gimple_omp_atomic_need_value_p (const_gimple g
)
2002 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2003 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2004 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2008 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2011 gimple_omp_atomic_set_need_value (gimple g
)
2013 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2014 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2015 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2019 /* Return true if OMP atomic load/store statement G has the
2020 GF_OMP_ATOMIC_SEQ_CST flag set. */
2023 gimple_omp_atomic_seq_cst_p (const_gimple g
)
2025 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2026 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2027 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2031 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2034 gimple_omp_atomic_set_seq_cst (gimple g
)
2036 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2037 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2038 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2042 /* Return the number of operands for statement GS. */
2044 static inline unsigned
2045 gimple_num_ops (const_gimple gs
)
2051 /* Set the number of operands for statement GS. */
2054 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
2056 gs
->num_ops
= num_ops
;
2060 /* Return the array of operands for statement GS. */
2062 static inline tree
*
2063 gimple_ops (gimple gs
)
2067 /* All the tuples have their operand vector at the very bottom
2068 of the structure. Note that those structures that do not
2069 have an operand vector have a zero offset. */
2070 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2071 gcc_gimple_checking_assert (off
!= 0);
2073 return (tree
*) ((char *) gs
+ off
);
2077 /* Return operand I for statement GS. */
2080 gimple_op (const_gimple gs
, unsigned i
)
2082 if (gimple_has_ops (gs
))
2084 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2085 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2091 /* Return a pointer to operand I for statement GS. */
2093 static inline tree
*
2094 gimple_op_ptr (const_gimple gs
, unsigned i
)
2096 if (gimple_has_ops (gs
))
2098 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2099 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
2105 /* Set operand I of statement GS to OP. */
2108 gimple_set_op (gimple gs
, unsigned i
, tree op
)
2110 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2112 /* Note. It may be tempting to assert that OP matches
2113 is_gimple_operand, but that would be wrong. Different tuples
2114 accept slightly different sets of tree operands. Each caller
2115 should perform its own validation. */
2116 gimple_ops (gs
)[i
] = op
;
2119 /* Return true if GS is a GIMPLE_ASSIGN. */
2122 is_gimple_assign (const_gimple gs
)
2124 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2127 /* Determine if expression CODE is one of the valid expressions that can
2128 be used on the RHS of GIMPLE assignments. */
2130 static inline enum gimple_rhs_class
2131 get_gimple_rhs_class (enum tree_code code
)
2133 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2136 /* Return the LHS of assignment statement GS. */
2139 gimple_assign_lhs (const_gimple gs
)
2141 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2142 return gimple_op (gs
, 0);
2146 /* Return a pointer to the LHS of assignment statement GS. */
2148 static inline tree
*
2149 gimple_assign_lhs_ptr (const_gimple gs
)
2151 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2152 return gimple_op_ptr (gs
, 0);
2156 /* Set LHS to be the LHS operand of assignment statement GS. */
2159 gimple_assign_set_lhs (gimple gs
, tree lhs
)
2161 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2162 gimple_set_op (gs
, 0, lhs
);
2164 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2165 SSA_NAME_DEF_STMT (lhs
) = gs
;
2169 /* Return the first operand on the RHS of assignment statement GS. */
2172 gimple_assign_rhs1 (const_gimple gs
)
2174 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2175 return gimple_op (gs
, 1);
2179 /* Return a pointer to the first operand on the RHS of assignment
2182 static inline tree
*
2183 gimple_assign_rhs1_ptr (const_gimple gs
)
2185 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2186 return gimple_op_ptr (gs
, 1);
2189 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2192 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
2194 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2196 gimple_set_op (gs
, 1, rhs
);
2200 /* Return the second operand on the RHS of assignment statement GS.
2201 If GS does not have two operands, NULL is returned instead. */
2204 gimple_assign_rhs2 (const_gimple gs
)
2206 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2208 if (gimple_num_ops (gs
) >= 3)
2209 return gimple_op (gs
, 2);
2215 /* Return a pointer to the second operand on the RHS of assignment
2218 static inline tree
*
2219 gimple_assign_rhs2_ptr (const_gimple gs
)
2221 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2222 return gimple_op_ptr (gs
, 2);
2226 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2229 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
2231 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2233 gimple_set_op (gs
, 2, rhs
);
2236 /* Return the third operand on the RHS of assignment statement GS.
2237 If GS does not have two operands, NULL is returned instead. */
2240 gimple_assign_rhs3 (const_gimple gs
)
2242 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2244 if (gimple_num_ops (gs
) >= 4)
2245 return gimple_op (gs
, 3);
2250 /* Return a pointer to the third operand on the RHS of assignment
2253 static inline tree
*
2254 gimple_assign_rhs3_ptr (const_gimple gs
)
2256 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2257 return gimple_op_ptr (gs
, 3);
2261 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2264 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
2266 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2268 gimple_set_op (gs
, 3, rhs
);
2271 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2272 to see only a maximum of two operands. */
2275 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2278 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
2281 /* Returns true if GS is a nontemporal move. */
2284 gimple_assign_nontemporal_move_p (const_gimple gs
)
2286 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2287 return gs
->nontemporal_move
;
2290 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2293 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
2295 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2296 gs
->nontemporal_move
= nontemporal
;
2300 /* Return the code of the expression computed on the rhs of assignment
2301 statement GS. In case that the RHS is a single object, returns the
2302 tree code of the object. */
2304 static inline enum tree_code
2305 gimple_assign_rhs_code (const_gimple gs
)
2307 enum tree_code code
;
2308 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2310 code
= (enum tree_code
) gs
->subcode
;
2311 /* While we initially set subcode to the TREE_CODE of the rhs for
2312 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2313 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2314 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2315 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2321 /* Set CODE to be the code for the expression computed on the RHS of
2325 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2327 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2332 /* Return the gimple rhs class of the code of the expression computed on
2333 the rhs of assignment statement GS.
2334 This will never return GIMPLE_INVALID_RHS. */
2336 static inline enum gimple_rhs_class
2337 gimple_assign_rhs_class (const_gimple gs
)
2339 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2342 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2343 there is no operator associated with the assignment itself.
2344 Unlike gimple_assign_copy_p, this predicate returns true for
2345 any RHS operand, including those that perform an operation
2346 and do not have the semantics of a copy, such as COND_EXPR. */
2349 gimple_assign_single_p (const_gimple gs
)
2351 return (is_gimple_assign (gs
)
2352 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2355 /* Return true if GS performs a store to its lhs. */
2358 gimple_store_p (const_gimple gs
)
2360 tree lhs
= gimple_get_lhs (gs
);
2361 return lhs
&& !is_gimple_reg (lhs
);
2364 /* Return true if GS is an assignment that loads from its rhs1. */
2367 gimple_assign_load_p (const_gimple gs
)
2370 if (!gimple_assign_single_p (gs
))
2372 rhs
= gimple_assign_rhs1 (gs
);
2373 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2375 rhs
= get_base_address (rhs
);
2376 return (DECL_P (rhs
)
2377 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2381 /* Return true if S is a type-cast assignment. */
2384 gimple_assign_cast_p (const_gimple s
)
2386 if (is_gimple_assign (s
))
2388 enum tree_code sc
= gimple_assign_rhs_code (s
);
2389 return CONVERT_EXPR_CODE_P (sc
)
2390 || sc
== VIEW_CONVERT_EXPR
2391 || sc
== FIX_TRUNC_EXPR
;
2397 /* Return true if S is a clobber statement. */
2400 gimple_clobber_p (const_gimple s
)
2402 return gimple_assign_single_p (s
)
2403 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2406 /* Return true if GS is a GIMPLE_CALL. */
2409 is_gimple_call (const_gimple gs
)
2411 return gimple_code (gs
) == GIMPLE_CALL
;
2414 /* Return the LHS of call statement GS. */
2417 gimple_call_lhs (const_gimple gs
)
2419 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2420 return gimple_op (gs
, 0);
2424 /* Return a pointer to the LHS of call statement GS. */
2426 static inline tree
*
2427 gimple_call_lhs_ptr (const_gimple gs
)
2429 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2430 return gimple_op_ptr (gs
, 0);
2434 /* Set LHS to be the LHS operand of call statement GS. */
2437 gimple_call_set_lhs (gimple gs
, tree lhs
)
2439 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2440 gimple_set_op (gs
, 0, lhs
);
2441 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2442 SSA_NAME_DEF_STMT (lhs
) = gs
;
2446 /* Return true if call GS calls an internal-only function, as enumerated
2450 gimple_call_internal_p (const_gimple gs
)
2452 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2453 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2457 /* Return true if call GS is marked as instrumented by
2458 Pointer Bounds Checker. */
2461 gimple_call_with_bounds_p (const_gimple gs
)
2463 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2464 return (gs
->subcode
& GF_CALL_WITH_BOUNDS
) != 0;
2468 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2469 Pointer Bounds Checker. */
2472 gimple_call_set_with_bounds (gimple gs
, bool with_bounds
)
2474 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2476 gs
->subcode
|= GF_CALL_WITH_BOUNDS
;
2478 gs
->subcode
&= ~GF_CALL_WITH_BOUNDS
;
2482 /* Return the target of internal call GS. */
2484 static inline enum internal_fn
2485 gimple_call_internal_fn (const_gimple gs
)
2487 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2488 return static_cast <const gimple_statement_call
*> (gs
)->u
.internal_fn
;
2491 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2492 that could alter control flow. */
2495 gimple_call_set_ctrl_altering (gimple s
, bool ctrl_altering_p
)
2497 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2498 if (ctrl_altering_p
)
2499 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2501 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2504 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2505 flag is set. Such call could not be a stmt in the middle of a bb. */
2508 gimple_call_ctrl_altering_p (const_gimple gs
)
2510 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2511 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2515 /* Return the function type of the function called by GS. */
2518 gimple_call_fntype (const_gimple gs
)
2520 const gimple_statement_call
*call_stmt
=
2521 as_a
<const gimple_statement_call
*> (gs
);
2522 if (gimple_call_internal_p (gs
))
2524 return call_stmt
->u
.fntype
;
2527 /* Set the type of the function called by GS to FNTYPE. */
2530 gimple_call_set_fntype (gimple gs
, tree fntype
)
2532 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (gs
);
2533 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2534 call_stmt
->u
.fntype
= fntype
;
2538 /* Return the tree node representing the function called by call
2542 gimple_call_fn (const_gimple gs
)
2544 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2545 return gimple_op (gs
, 1);
2548 /* Return a pointer to the tree node representing the function called by call
2551 static inline tree
*
2552 gimple_call_fn_ptr (const_gimple gs
)
2554 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2555 return gimple_op_ptr (gs
, 1);
2559 /* Set FN to be the function called by call statement GS. */
2562 gimple_call_set_fn (gimple gs
, tree fn
)
2564 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2565 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2566 gimple_set_op (gs
, 1, fn
);
2570 /* Set FNDECL to be the function called by call statement GS. */
2573 gimple_call_set_fndecl (gimple gs
, tree decl
)
2575 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2576 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2577 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2581 /* Set internal function FN to be the function called by call statement GS. */
2584 gimple_call_set_internal_fn (gimple gs
, enum internal_fn fn
)
2586 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (gs
);
2587 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2588 call_stmt
->u
.internal_fn
= fn
;
2592 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2593 Otherwise return NULL. This function is analogous to
2594 get_callee_fndecl in tree land. */
2597 gimple_call_fndecl (const_gimple gs
)
2599 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2603 /* Return the type returned by call statement GS. */
2606 gimple_call_return_type (const_gimple gs
)
2608 tree type
= gimple_call_fntype (gs
);
2610 if (type
== NULL_TREE
)
2611 return TREE_TYPE (gimple_call_lhs (gs
));
2613 /* The type returned by a function is the type of its
2615 return TREE_TYPE (type
);
2619 /* Return the static chain for call statement GS. */
2622 gimple_call_chain (const_gimple gs
)
2624 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2625 return gimple_op (gs
, 2);
2629 /* Return a pointer to the static chain for call statement GS. */
2631 static inline tree
*
2632 gimple_call_chain_ptr (const_gimple gs
)
2634 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2635 return gimple_op_ptr (gs
, 2);
2638 /* Set CHAIN to be the static chain for call statement GS. */
2641 gimple_call_set_chain (gimple gs
, tree chain
)
2643 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2645 gimple_set_op (gs
, 2, chain
);
2649 /* Return the number of arguments used by call statement GS. */
2651 static inline unsigned
2652 gimple_call_num_args (const_gimple gs
)
2655 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2656 num_ops
= gimple_num_ops (gs
);
2661 /* Return the argument at position INDEX for call statement GS. */
2664 gimple_call_arg (const_gimple gs
, unsigned index
)
2666 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2667 return gimple_op (gs
, index
+ 3);
2671 /* Return a pointer to the argument at position INDEX for call
2674 static inline tree
*
2675 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2677 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2678 return gimple_op_ptr (gs
, index
+ 3);
2682 /* Set ARG to be the argument at position INDEX for call statement GS. */
2685 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2687 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2688 gimple_set_op (gs
, index
+ 3, arg
);
2692 /* If TAIL_P is true, mark call statement S as being a tail call
2693 (i.e., a call just before the exit of a function). These calls are
2694 candidate for tail call optimization. */
2697 gimple_call_set_tail (gimple s
, bool tail_p
)
2699 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2701 s
->subcode
|= GF_CALL_TAILCALL
;
2703 s
->subcode
&= ~GF_CALL_TAILCALL
;
2707 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2710 gimple_call_tail_p (gimple s
)
2712 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2713 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
2717 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2718 slot optimization. This transformation uses the target of the call
2719 expansion as the return slot for calls that return in memory. */
2722 gimple_call_set_return_slot_opt (gimple s
, bool return_slot_opt_p
)
2724 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2725 if (return_slot_opt_p
)
2726 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2728 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2732 /* Return true if S is marked for return slot optimization. */
2735 gimple_call_return_slot_opt_p (gimple s
)
2737 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2738 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2742 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2743 thunk to the thunked-to function. */
2746 gimple_call_set_from_thunk (gimple s
, bool from_thunk_p
)
2748 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2750 s
->subcode
|= GF_CALL_FROM_THUNK
;
2752 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
2756 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2759 gimple_call_from_thunk_p (gimple s
)
2761 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2762 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
2766 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2767 argument pack in its argument list. */
2770 gimple_call_set_va_arg_pack (gimple s
, bool pass_arg_pack_p
)
2772 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2773 if (pass_arg_pack_p
)
2774 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
2776 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
2780 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2781 argument pack in its argument list. */
2784 gimple_call_va_arg_pack_p (gimple s
)
2786 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2787 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2791 /* Return true if S is a noreturn call. */
2794 gimple_call_noreturn_p (gimple s
)
2796 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2797 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2801 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2802 even if the called function can throw in other cases. */
2805 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2807 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2809 s
->subcode
|= GF_CALL_NOTHROW
;
2811 s
->subcode
&= ~GF_CALL_NOTHROW
;
2814 /* Return true if S is a nothrow call. */
2817 gimple_call_nothrow_p (gimple s
)
2819 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2820 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2823 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2824 is known to be emitted for VLA objects. Those are wrapped by
2825 stack_save/stack_restore calls and hence can't lead to unbounded
2826 stack growth even when they occur in loops. */
2829 gimple_call_set_alloca_for_var (gimple s
, bool for_var
)
2831 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2833 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2835 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2838 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2841 gimple_call_alloca_for_var_p (gimple s
)
2843 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2844 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2847 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2850 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2852 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2853 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2854 dest_call
->subcode
= orig_call
->subcode
;
2858 /* Return a pointer to the points-to solution for the set of call-used
2859 variables of the call CALL. */
2861 static inline struct pt_solution
*
2862 gimple_call_use_set (gimple call
)
2864 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (call
);
2865 return &call_stmt
->call_used
;
2869 /* Return a pointer to the points-to solution for the set of call-used
2870 variables of the call CALL. */
2872 static inline struct pt_solution
*
2873 gimple_call_clobber_set (gimple call
)
2875 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (call
);
2876 return &call_stmt
->call_clobbered
;
2880 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2884 gimple_has_lhs (gimple stmt
)
2886 return (is_gimple_assign (stmt
)
2887 || (is_gimple_call (stmt
)
2888 && gimple_call_lhs (stmt
) != NULL_TREE
));
2892 /* Return the code of the predicate computed by conditional statement GS. */
2894 static inline enum tree_code
2895 gimple_cond_code (const_gimple gs
)
2897 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2898 return (enum tree_code
) gs
->subcode
;
2902 /* Set CODE to be the predicate code for the conditional statement GS. */
2905 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2907 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2912 /* Return the LHS of the predicate computed by conditional statement GS. */
2915 gimple_cond_lhs (const_gimple gs
)
2917 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2918 return gimple_op (gs
, 0);
2921 /* Return the pointer to the LHS of the predicate computed by conditional
2924 static inline tree
*
2925 gimple_cond_lhs_ptr (const_gimple gs
)
2927 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2928 return gimple_op_ptr (gs
, 0);
2931 /* Set LHS to be the LHS operand of the predicate computed by
2932 conditional statement GS. */
2935 gimple_cond_set_lhs (gimple gs
, tree lhs
)
2937 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2938 gimple_set_op (gs
, 0, lhs
);
2942 /* Return the RHS operand of the predicate computed by conditional GS. */
2945 gimple_cond_rhs (const_gimple gs
)
2947 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2948 return gimple_op (gs
, 1);
2951 /* Return the pointer to the RHS operand of the predicate computed by
2954 static inline tree
*
2955 gimple_cond_rhs_ptr (const_gimple gs
)
2957 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2958 return gimple_op_ptr (gs
, 1);
2962 /* Set RHS to be the RHS operand of the predicate computed by
2963 conditional statement GS. */
2966 gimple_cond_set_rhs (gimple gs
, tree rhs
)
2968 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2969 gimple_set_op (gs
, 1, rhs
);
2973 /* Return the label used by conditional statement GS when its
2974 predicate evaluates to true. */
2977 gimple_cond_true_label (const_gimple gs
)
2979 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2980 return gimple_op (gs
, 2);
2984 /* Set LABEL to be the label used by conditional statement GS when its
2985 predicate evaluates to true. */
2988 gimple_cond_set_true_label (gimple gs
, tree label
)
2990 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2991 gimple_set_op (gs
, 2, label
);
2995 /* Set LABEL to be the label used by conditional statement GS when its
2996 predicate evaluates to false. */
2999 gimple_cond_set_false_label (gimple gs
, tree label
)
3001 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3002 gimple_set_op (gs
, 3, label
);
3006 /* Return the label used by conditional statement GS when its
3007 predicate evaluates to false. */
3010 gimple_cond_false_label (const_gimple gs
)
3012 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3013 return gimple_op (gs
, 3);
3017 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3020 gimple_cond_make_false (gimple gs
)
3022 gimple_cond_set_lhs (gs
, boolean_true_node
);
3023 gimple_cond_set_rhs (gs
, boolean_false_node
);
3024 gs
->subcode
= EQ_EXPR
;
3028 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3031 gimple_cond_make_true (gimple gs
)
3033 gimple_cond_set_lhs (gs
, boolean_true_node
);
3034 gimple_cond_set_rhs (gs
, boolean_true_node
);
3035 gs
->subcode
= EQ_EXPR
;
3038 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3039 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3042 gimple_cond_true_p (const_gimple gs
)
3044 tree lhs
= gimple_cond_lhs (gs
);
3045 tree rhs
= gimple_cond_rhs (gs
);
3046 enum tree_code code
= gimple_cond_code (gs
);
3048 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3051 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3054 if (code
== NE_EXPR
&& lhs
!= rhs
)
3057 if (code
== EQ_EXPR
&& lhs
== rhs
)
3063 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3064 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3067 gimple_cond_false_p (const_gimple gs
)
3069 tree lhs
= gimple_cond_lhs (gs
);
3070 tree rhs
= gimple_cond_rhs (gs
);
3071 enum tree_code code
= gimple_cond_code (gs
);
3073 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3076 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3079 if (code
== NE_EXPR
&& lhs
== rhs
)
3082 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3088 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3091 gimple_cond_set_condition (gimple stmt
, enum tree_code code
, tree lhs
, tree rhs
)
3093 gimple_cond_set_code (stmt
, code
);
3094 gimple_cond_set_lhs (stmt
, lhs
);
3095 gimple_cond_set_rhs (stmt
, rhs
);
3098 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3101 gimple_label_label (const_gimple gs
)
3103 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
3104 return gimple_op (gs
, 0);
3108 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3112 gimple_label_set_label (gimple gs
, tree label
)
3114 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
3115 gimple_set_op (gs
, 0, label
);
3119 /* Return the destination of the unconditional jump GS. */
3122 gimple_goto_dest (const_gimple gs
)
3124 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3125 return gimple_op (gs
, 0);
3129 /* Set DEST to be the destination of the unconditonal jump GS. */
3132 gimple_goto_set_dest (gimple gs
, tree dest
)
3134 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3135 gimple_set_op (gs
, 0, dest
);
3139 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3142 gimple_bind_vars (const_gimple gs
)
3144 const gimple_statement_bind
*bind_stmt
=
3145 as_a
<const gimple_statement_bind
*> (gs
);
3146 return bind_stmt
->vars
;
3150 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3154 gimple_bind_set_vars (gimple gs
, tree vars
)
3156 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3157 bind_stmt
->vars
= vars
;
3161 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3165 gimple_bind_append_vars (gimple gs
, tree vars
)
3167 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3168 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3172 static inline gimple_seq
*
3173 gimple_bind_body_ptr (gimple gs
)
3175 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3176 return &bind_stmt
->body
;
3179 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3181 static inline gimple_seq
3182 gimple_bind_body (gimple gs
)
3184 return *gimple_bind_body_ptr (gs
);
3188 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3192 gimple_bind_set_body (gimple gs
, gimple_seq seq
)
3194 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3195 bind_stmt
->body
= seq
;
3199 /* Append a statement to the end of a GIMPLE_BIND's body. */
3202 gimple_bind_add_stmt (gimple gs
, gimple stmt
)
3204 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3205 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3209 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3212 gimple_bind_add_seq (gimple gs
, gimple_seq seq
)
3214 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3215 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3219 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3220 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3223 gimple_bind_block (const_gimple gs
)
3225 const gimple_statement_bind
*bind_stmt
=
3226 as_a
<const gimple_statement_bind
*> (gs
);
3227 return bind_stmt
->block
;
3231 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3235 gimple_bind_set_block (gimple gs
, tree block
)
3237 gimple_statement_bind
*bind_stmt
= as_a
<gimple_statement_bind
*> (gs
);
3238 gcc_gimple_checking_assert (block
== NULL_TREE
3239 || TREE_CODE (block
) == BLOCK
);
3240 bind_stmt
->block
= block
;
3244 /* Return the number of input operands for GIMPLE_ASM GS. */
3246 static inline unsigned
3247 gimple_asm_ninputs (const_gimple gs
)
3249 const gimple_statement_asm
*asm_stmt
=
3250 as_a
<const gimple_statement_asm
*> (gs
);
3251 return asm_stmt
->ni
;
3255 /* Return the number of output operands for GIMPLE_ASM GS. */
3257 static inline unsigned
3258 gimple_asm_noutputs (const_gimple gs
)
3260 const gimple_statement_asm
*asm_stmt
=
3261 as_a
<const gimple_statement_asm
*> (gs
);
3262 return asm_stmt
->no
;
3266 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3268 static inline unsigned
3269 gimple_asm_nclobbers (const_gimple gs
)
3271 const gimple_statement_asm
*asm_stmt
=
3272 as_a
<const gimple_statement_asm
*> (gs
);
3273 return asm_stmt
->nc
;
3276 /* Return the number of label operands for GIMPLE_ASM GS. */
3278 static inline unsigned
3279 gimple_asm_nlabels (const_gimple gs
)
3281 const gimple_statement_asm
*asm_stmt
=
3282 as_a
<const gimple_statement_asm
*> (gs
);
3283 return asm_stmt
->nl
;
3286 /* Return input operand INDEX of GIMPLE_ASM GS. */
3289 gimple_asm_input_op (const_gimple gs
, unsigned index
)
3291 const gimple_statement_asm
*asm_stmt
=
3292 as_a
<const gimple_statement_asm
*> (gs
);
3293 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3294 return gimple_op (gs
, index
+ asm_stmt
->no
);
3297 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3299 static inline tree
*
3300 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
3302 const gimple_statement_asm
*asm_stmt
=
3303 as_a
<const gimple_statement_asm
*> (gs
);
3304 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3305 return gimple_op_ptr (gs
, index
+ asm_stmt
->no
);
3309 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3312 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
3314 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3315 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3316 && TREE_CODE (in_op
) == TREE_LIST
);
3317 gimple_set_op (gs
, index
+ asm_stmt
->no
, in_op
);
3321 /* Return output operand INDEX of GIMPLE_ASM GS. */
3324 gimple_asm_output_op (const_gimple gs
, unsigned index
)
3326 const gimple_statement_asm
*asm_stmt
=
3327 as_a
<const gimple_statement_asm
*> (gs
);
3328 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3329 return gimple_op (gs
, index
);
3332 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3334 static inline tree
*
3335 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
3337 const gimple_statement_asm
*asm_stmt
=
3338 as_a
<const gimple_statement_asm
*> (gs
);
3339 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3340 return gimple_op_ptr (gs
, index
);
3344 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3347 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
3349 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3350 gcc_gimple_checking_assert (index
< asm_stmt
->no
3351 && TREE_CODE (out_op
) == TREE_LIST
);
3352 gimple_set_op (gs
, index
, out_op
);
3356 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3359 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3361 const gimple_statement_asm
*asm_stmt
=
3362 as_a
<const gimple_statement_asm
*> (gs
);
3363 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3364 return gimple_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->no
);
3368 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3371 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3373 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3374 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3375 && TREE_CODE (clobber_op
) == TREE_LIST
);
3376 gimple_set_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->no
, clobber_op
);
3379 /* Return label operand INDEX of GIMPLE_ASM GS. */
3382 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3384 const gimple_statement_asm
*asm_stmt
=
3385 as_a
<const gimple_statement_asm
*> (gs
);
3386 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3387 return gimple_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
);
3390 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3393 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3395 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3396 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3397 && TREE_CODE (label_op
) == TREE_LIST
);
3398 gimple_set_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
, label_op
);
3401 /* Return the string representing the assembly instruction in
3404 static inline const char *
3405 gimple_asm_string (const_gimple gs
)
3407 const gimple_statement_asm
*asm_stmt
=
3408 as_a
<const gimple_statement_asm
*> (gs
);
3409 return asm_stmt
->string
;
3413 /* Return true if GS is an asm statement marked volatile. */
3416 gimple_asm_volatile_p (const_gimple gs
)
3418 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3419 return (gs
->subcode
& GF_ASM_VOLATILE
) != 0;
3423 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3426 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3428 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3430 gs
->subcode
|= GF_ASM_VOLATILE
;
3432 gs
->subcode
&= ~GF_ASM_VOLATILE
;
3436 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3439 gimple_asm_set_input (gimple gs
, bool input_p
)
3441 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3443 gs
->subcode
|= GF_ASM_INPUT
;
3445 gs
->subcode
&= ~GF_ASM_INPUT
;
3449 /* Return true if asm GS is an ASM_INPUT. */
3452 gimple_asm_input_p (const_gimple gs
)
3454 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3455 return (gs
->subcode
& GF_ASM_INPUT
) != 0;
3459 /* Return the types handled by GIMPLE_CATCH statement GS. */
3462 gimple_catch_types (const_gimple gs
)
3464 const gimple_statement_catch
*catch_stmt
=
3465 as_a
<const gimple_statement_catch
*> (gs
);
3466 return catch_stmt
->types
;
3470 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3472 static inline tree
*
3473 gimple_catch_types_ptr (gimple gs
)
3475 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3476 return &catch_stmt
->types
;
3480 /* Return a pointer to the GIMPLE sequence representing the body of
3481 the handler of GIMPLE_CATCH statement GS. */
3483 static inline gimple_seq
*
3484 gimple_catch_handler_ptr (gimple gs
)
3486 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3487 return &catch_stmt
->handler
;
3491 /* Return the GIMPLE sequence representing the body of the handler of
3492 GIMPLE_CATCH statement GS. */
3494 static inline gimple_seq
3495 gimple_catch_handler (gimple gs
)
3497 return *gimple_catch_handler_ptr (gs
);
3501 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3504 gimple_catch_set_types (gimple gs
, tree t
)
3506 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3507 catch_stmt
->types
= t
;
3511 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3514 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3516 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3517 catch_stmt
->handler
= handler
;
3521 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3524 gimple_eh_filter_types (const_gimple gs
)
3526 const gimple_statement_eh_filter
*eh_filter_stmt
=
3527 as_a
<const gimple_statement_eh_filter
*> (gs
);
3528 return eh_filter_stmt
->types
;
3532 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3535 static inline tree
*
3536 gimple_eh_filter_types_ptr (gimple gs
)
3538 gimple_statement_eh_filter
*eh_filter_stmt
=
3539 as_a
<gimple_statement_eh_filter
*> (gs
);
3540 return &eh_filter_stmt
->types
;
3544 /* Return a pointer to the sequence of statement to execute when
3545 GIMPLE_EH_FILTER statement fails. */
3547 static inline gimple_seq
*
3548 gimple_eh_filter_failure_ptr (gimple gs
)
3550 gimple_statement_eh_filter
*eh_filter_stmt
=
3551 as_a
<gimple_statement_eh_filter
*> (gs
);
3552 return &eh_filter_stmt
->failure
;
3556 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3559 static inline gimple_seq
3560 gimple_eh_filter_failure (gimple gs
)
3562 return *gimple_eh_filter_failure_ptr (gs
);
3566 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3569 gimple_eh_filter_set_types (gimple gs
, tree types
)
3571 gimple_statement_eh_filter
*eh_filter_stmt
=
3572 as_a
<gimple_statement_eh_filter
*> (gs
);
3573 eh_filter_stmt
->types
= types
;
3577 /* Set FAILURE to be the sequence of statements to execute on failure
3578 for GIMPLE_EH_FILTER GS. */
3581 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3583 gimple_statement_eh_filter
*eh_filter_stmt
=
3584 as_a
<gimple_statement_eh_filter
*> (gs
);
3585 eh_filter_stmt
->failure
= failure
;
3588 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3591 gimple_eh_must_not_throw_fndecl (gimple gs
)
3593 gimple_statement_eh_mnt
*eh_mnt_stmt
= as_a
<gimple_statement_eh_mnt
*> (gs
);
3594 return eh_mnt_stmt
->fndecl
;
3597 /* Set the function decl to be called by GS to DECL. */
3600 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3602 gimple_statement_eh_mnt
*eh_mnt_stmt
= as_a
<gimple_statement_eh_mnt
*> (gs
);
3603 eh_mnt_stmt
->fndecl
= decl
;
3606 /* GIMPLE_EH_ELSE accessors. */
3608 static inline gimple_seq
*
3609 gimple_eh_else_n_body_ptr (gimple gs
)
3611 gimple_statement_eh_else
*eh_else_stmt
=
3612 as_a
<gimple_statement_eh_else
*> (gs
);
3613 return &eh_else_stmt
->n_body
;
3616 static inline gimple_seq
3617 gimple_eh_else_n_body (gimple gs
)
3619 return *gimple_eh_else_n_body_ptr (gs
);
3622 static inline gimple_seq
*
3623 gimple_eh_else_e_body_ptr (gimple gs
)
3625 gimple_statement_eh_else
*eh_else_stmt
=
3626 as_a
<gimple_statement_eh_else
*> (gs
);
3627 return &eh_else_stmt
->e_body
;
3630 static inline gimple_seq
3631 gimple_eh_else_e_body (gimple gs
)
3633 return *gimple_eh_else_e_body_ptr (gs
);
3637 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3639 gimple_statement_eh_else
*eh_else_stmt
=
3640 as_a
<gimple_statement_eh_else
*> (gs
);
3641 eh_else_stmt
->n_body
= seq
;
3645 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3647 gimple_statement_eh_else
*eh_else_stmt
=
3648 as_a
<gimple_statement_eh_else
*> (gs
);
3649 eh_else_stmt
->e_body
= seq
;
3652 /* GIMPLE_TRY accessors. */
3654 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3655 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3657 static inline enum gimple_try_flags
3658 gimple_try_kind (const_gimple gs
)
3660 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3661 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
3665 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3668 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3670 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3671 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3672 || kind
== GIMPLE_TRY_FINALLY
);
3673 if (gimple_try_kind (gs
) != kind
)
3674 gs
->subcode
= (unsigned int) kind
;
3678 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3681 gimple_try_catch_is_cleanup (const_gimple gs
)
3683 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3684 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3688 /* Return a pointer to the sequence of statements used as the
3689 body for GIMPLE_TRY GS. */
3691 static inline gimple_seq
*
3692 gimple_try_eval_ptr (gimple gs
)
3694 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3695 return &try_stmt
->eval
;
3699 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3701 static inline gimple_seq
3702 gimple_try_eval (gimple gs
)
3704 return *gimple_try_eval_ptr (gs
);
3708 /* Return a pointer to the sequence of statements used as the cleanup body for
3711 static inline gimple_seq
*
3712 gimple_try_cleanup_ptr (gimple gs
)
3714 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3715 return &try_stmt
->cleanup
;
3719 /* Return the sequence of statements used as the cleanup body for
3722 static inline gimple_seq
3723 gimple_try_cleanup (gimple gs
)
3725 return *gimple_try_cleanup_ptr (gs
);
3729 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3732 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3734 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3735 if (catch_is_cleanup
)
3736 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3738 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3742 /* Set EVAL to be the sequence of statements to use as the body for
3746 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3748 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3749 try_stmt
->eval
= eval
;
3753 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3754 body for GIMPLE_TRY GS. */
3757 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3759 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3760 try_stmt
->cleanup
= cleanup
;
3764 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3766 static inline gimple_seq
*
3767 gimple_wce_cleanup_ptr (gimple gs
)
3769 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3770 return &wce_stmt
->cleanup
;
3774 /* Return the cleanup sequence for cleanup statement GS. */
3776 static inline gimple_seq
3777 gimple_wce_cleanup (gimple gs
)
3779 return *gimple_wce_cleanup_ptr (gs
);
3783 /* Set CLEANUP to be the cleanup sequence for GS. */
3786 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3788 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3789 wce_stmt
->cleanup
= cleanup
;
3793 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3796 gimple_wce_cleanup_eh_only (const_gimple gs
)
3798 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3799 return gs
->subcode
!= 0;
3803 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3806 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3808 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3809 gs
->subcode
= (unsigned int) eh_only_p
;
3813 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3815 static inline unsigned
3816 gimple_phi_capacity (const_gimple gs
)
3818 const gimple_statement_phi
*phi_stmt
=
3819 as_a
<const gimple_statement_phi
*> (gs
);
3820 return phi_stmt
->capacity
;
3824 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3825 be exactly the number of incoming edges for the basic block holding
3828 static inline unsigned
3829 gimple_phi_num_args (const_gimple gs
)
3831 const gimple_statement_phi
*phi_stmt
=
3832 as_a
<const gimple_statement_phi
*> (gs
);
3833 return phi_stmt
->nargs
;
3837 /* Return the SSA name created by GIMPLE_PHI GS. */
3840 gimple_phi_result (const_gimple gs
)
3842 const gimple_statement_phi
*phi_stmt
=
3843 as_a
<const gimple_statement_phi
*> (gs
);
3844 return phi_stmt
->result
;
3847 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3849 static inline tree
*
3850 gimple_phi_result_ptr (gimple gs
)
3852 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3853 return &phi_stmt
->result
;
3856 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3859 gimple_phi_set_result (gimple gs
, tree result
)
3861 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3862 phi_stmt
->result
= result
;
3863 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3864 SSA_NAME_DEF_STMT (result
) = gs
;
3868 /* Return the PHI argument corresponding to incoming edge INDEX for
3871 static inline struct phi_arg_d
*
3872 gimple_phi_arg (gimple gs
, unsigned index
)
3874 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3875 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
3876 return &(phi_stmt
->args
[index
]);
3879 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3880 for GIMPLE_PHI GS. */
3883 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3885 gimple_statement_phi
*phi_stmt
= as_a
<gimple_statement_phi
*> (gs
);
3886 gcc_gimple_checking_assert (index
<= phi_stmt
->nargs
);
3887 phi_stmt
->args
[index
] = *phiarg
;
3890 /* Return the PHI nodes for basic block BB, or NULL if there are no
3893 static inline gimple_seq
3894 phi_nodes (const_basic_block bb
)
3896 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3897 return bb
->il
.gimple
.phi_nodes
;
3900 /* Return a pointer to the PHI nodes for basic block BB. */
3902 static inline gimple_seq
*
3903 phi_nodes_ptr (basic_block bb
)
3905 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3906 return &bb
->il
.gimple
.phi_nodes
;
3909 /* Return the tree operand for argument I of PHI node GS. */
3912 gimple_phi_arg_def (gimple gs
, size_t index
)
3914 return gimple_phi_arg (gs
, index
)->def
;
3918 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3920 static inline tree
*
3921 gimple_phi_arg_def_ptr (gimple gs
, size_t index
)
3923 return &gimple_phi_arg (gs
, index
)->def
;
3926 /* Return the edge associated with argument I of phi node GS. */
3929 gimple_phi_arg_edge (gimple gs
, size_t i
)
3931 return EDGE_PRED (gimple_bb (gs
), i
);
3934 /* Return the source location of gimple argument I of phi node GS. */
3936 static inline source_location
3937 gimple_phi_arg_location (gimple gs
, size_t i
)
3939 return gimple_phi_arg (gs
, i
)->locus
;
3942 /* Return the source location of the argument on edge E of phi node GS. */
3944 static inline source_location
3945 gimple_phi_arg_location_from_edge (gimple gs
, edge e
)
3947 return gimple_phi_arg (gs
, e
->dest_idx
)->locus
;
3950 /* Set the source location of gimple argument I of phi node GS to LOC. */
3953 gimple_phi_arg_set_location (gimple gs
, size_t i
, source_location loc
)
3955 gimple_phi_arg (gs
, i
)->locus
= loc
;
3958 /* Return TRUE if argument I of phi node GS has a location record. */
3961 gimple_phi_arg_has_location (gimple gs
, size_t i
)
3963 return gimple_phi_arg_location (gs
, i
) != UNKNOWN_LOCATION
;
3967 /* Return the region number for GIMPLE_RESX GS. */
3970 gimple_resx_region (const_gimple gs
)
3972 const gimple_statement_resx
*resx_stmt
=
3973 as_a
<const gimple_statement_resx
*> (gs
);
3974 return resx_stmt
->region
;
3977 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3980 gimple_resx_set_region (gimple gs
, int region
)
3982 gimple_statement_resx
*resx_stmt
= as_a
<gimple_statement_resx
*> (gs
);
3983 resx_stmt
->region
= region
;
3986 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3989 gimple_eh_dispatch_region (const_gimple gs
)
3991 const gimple_statement_eh_dispatch
*eh_dispatch_stmt
=
3992 as_a
<const gimple_statement_eh_dispatch
*> (gs
);
3993 return eh_dispatch_stmt
->region
;
3996 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3999 gimple_eh_dispatch_set_region (gimple gs
, int region
)
4001 gimple_statement_eh_dispatch
*eh_dispatch_stmt
=
4002 as_a
<gimple_statement_eh_dispatch
*> (gs
);
4003 eh_dispatch_stmt
->region
= region
;
4006 /* Return the number of labels associated with the switch statement GS. */
4008 static inline unsigned
4009 gimple_switch_num_labels (const_gimple gs
)
4012 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4013 num_ops
= gimple_num_ops (gs
);
4014 gcc_gimple_checking_assert (num_ops
> 1);
4019 /* Set NLABELS to be the number of labels for the switch statement GS. */
4022 gimple_switch_set_num_labels (gimple g
, unsigned nlabels
)
4024 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4025 gimple_set_num_ops (g
, nlabels
+ 1);
4029 /* Return the index variable used by the switch statement GS. */
4032 gimple_switch_index (const_gimple gs
)
4034 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4035 return gimple_op (gs
, 0);
4039 /* Return a pointer to the index variable for the switch statement GS. */
4041 static inline tree
*
4042 gimple_switch_index_ptr (const_gimple gs
)
4044 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4045 return gimple_op_ptr (gs
, 0);
4049 /* Set INDEX to be the index variable for switch statement GS. */
4052 gimple_switch_set_index (gimple gs
, tree index
)
4054 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4055 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4056 gimple_set_op (gs
, 0, index
);
4060 /* Return the label numbered INDEX. The default label is 0, followed by any
4061 labels in a switch statement. */
4064 gimple_switch_label (const_gimple gs
, unsigned index
)
4066 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4067 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4068 return gimple_op (gs
, index
+ 1);
4071 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4074 gimple_switch_set_label (gimple gs
, unsigned index
, tree label
)
4076 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4077 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4078 && (label
== NULL_TREE
4079 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4080 gimple_set_op (gs
, index
+ 1, label
);
4083 /* Return the default label for a switch statement. */
4086 gimple_switch_default_label (const_gimple gs
)
4088 tree label
= gimple_switch_label (gs
, 0);
4089 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4093 /* Set the default label for a switch statement. */
4096 gimple_switch_set_default_label (gimple gs
, tree label
)
4098 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4099 gimple_switch_set_label (gs
, 0, label
);
4102 /* Return true if GS is a GIMPLE_DEBUG statement. */
4105 is_gimple_debug (const_gimple gs
)
4107 return gimple_code (gs
) == GIMPLE_DEBUG
;
4110 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4113 gimple_debug_bind_p (const_gimple s
)
4115 if (is_gimple_debug (s
))
4116 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4121 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4124 gimple_debug_bind_get_var (gimple dbg
)
4126 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4127 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4128 return gimple_op (dbg
, 0);
4131 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4135 gimple_debug_bind_get_value (gimple dbg
)
4137 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4138 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4139 return gimple_op (dbg
, 1);
4142 /* Return a pointer to the value bound to the variable in a
4143 GIMPLE_DEBUG bind statement. */
4145 static inline tree
*
4146 gimple_debug_bind_get_value_ptr (gimple dbg
)
4148 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4149 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4150 return gimple_op_ptr (dbg
, 1);
4153 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4156 gimple_debug_bind_set_var (gimple dbg
, tree var
)
4158 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4159 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4160 gimple_set_op (dbg
, 0, var
);
4163 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4167 gimple_debug_bind_set_value (gimple dbg
, tree value
)
4169 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4170 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4171 gimple_set_op (dbg
, 1, value
);
4174 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4176 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4178 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4182 gimple_debug_bind_reset_value (gimple dbg
)
4184 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4185 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4186 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4189 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4193 gimple_debug_bind_has_value_p (gimple dbg
)
4195 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4196 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4197 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4200 #undef GIMPLE_DEBUG_BIND_NOVALUE
4202 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4205 gimple_debug_source_bind_p (const_gimple s
)
4207 if (is_gimple_debug (s
))
4208 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4213 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4216 gimple_debug_source_bind_get_var (gimple dbg
)
4218 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4219 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4220 return gimple_op (dbg
, 0);
4223 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4227 gimple_debug_source_bind_get_value (gimple dbg
)
4229 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4230 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4231 return gimple_op (dbg
, 1);
4234 /* Return a pointer to the value bound to the variable in a
4235 GIMPLE_DEBUG source bind statement. */
4237 static inline tree
*
4238 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
4240 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4241 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4242 return gimple_op_ptr (dbg
, 1);
4245 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4248 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
4250 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4251 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4252 gimple_set_op (dbg
, 0, var
);
4255 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4259 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
4261 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4262 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4263 gimple_set_op (dbg
, 1, value
);
4266 /* Return the line number for EXPR, or return -1 if we have no line
4267 number information for it. */
4269 get_lineno (const_gimple stmt
)
4276 loc
= gimple_location (stmt
);
4277 if (loc
== UNKNOWN_LOCATION
)
4280 return LOCATION_LINE (loc
);
4283 /* Return a pointer to the body for the OMP statement GS. */
4285 static inline gimple_seq
*
4286 gimple_omp_body_ptr (gimple gs
)
4288 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4291 /* Return the body for the OMP statement GS. */
4293 static inline gimple_seq
4294 gimple_omp_body (gimple gs
)
4296 return *gimple_omp_body_ptr (gs
);
4299 /* Set BODY to be the body for the OMP statement GS. */
4302 gimple_omp_set_body (gimple gs
, gimple_seq body
)
4304 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4308 /* Return the name associated with OMP_CRITICAL statement GS. */
4311 gimple_omp_critical_name (const_gimple gs
)
4313 const gimple_statement_omp_critical
*omp_critical_stmt
=
4314 as_a
<const gimple_statement_omp_critical
*> (gs
);
4315 return omp_critical_stmt
->name
;
4319 /* Return a pointer to the name associated with OMP critical statement GS. */
4321 static inline tree
*
4322 gimple_omp_critical_name_ptr (gimple gs
)
4324 gimple_statement_omp_critical
*omp_critical_stmt
=
4325 as_a
<gimple_statement_omp_critical
*> (gs
);
4326 return &omp_critical_stmt
->name
;
4330 /* Set NAME to be the name associated with OMP critical statement GS. */
4333 gimple_omp_critical_set_name (gimple gs
, tree name
)
4335 gimple_statement_omp_critical
*omp_critical_stmt
=
4336 as_a
<gimple_statement_omp_critical
*> (gs
);
4337 omp_critical_stmt
->name
= name
;
4341 /* Return the kind of OMP for statemement. */
4344 gimple_omp_for_kind (const_gimple g
)
4346 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4347 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4351 /* Set the OMP for kind. */
4354 gimple_omp_for_set_kind (gimple g
, int kind
)
4356 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4357 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4358 | (kind
& GF_OMP_FOR_KIND_MASK
);
4362 /* Return true if OMP for statement G has the
4363 GF_OMP_FOR_COMBINED flag set. */
4366 gimple_omp_for_combined_p (const_gimple g
)
4368 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4369 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4373 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4374 value of COMBINED_P. */
4377 gimple_omp_for_set_combined_p (gimple g
, bool combined_p
)
4379 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4381 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4383 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4387 /* Return true if OMP for statement G has the
4388 GF_OMP_FOR_COMBINED_INTO flag set. */
4391 gimple_omp_for_combined_into_p (const_gimple g
)
4393 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4394 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4398 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4399 value of COMBINED_P. */
4402 gimple_omp_for_set_combined_into_p (gimple g
, bool combined_p
)
4404 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4406 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4408 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4412 /* Return the clauses associated with OMP_FOR GS. */
4415 gimple_omp_for_clauses (const_gimple gs
)
4417 const gimple_statement_omp_for
*omp_for_stmt
=
4418 as_a
<const gimple_statement_omp_for
*> (gs
);
4419 return omp_for_stmt
->clauses
;
4423 /* Return a pointer to the OMP_FOR GS. */
4425 static inline tree
*
4426 gimple_omp_for_clauses_ptr (gimple gs
)
4428 gimple_statement_omp_for
*omp_for_stmt
=
4429 as_a
<gimple_statement_omp_for
*> (gs
);
4430 return &omp_for_stmt
->clauses
;
4434 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4437 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
4439 gimple_statement_omp_for
*omp_for_stmt
=
4440 as_a
<gimple_statement_omp_for
*> (gs
);
4441 omp_for_stmt
->clauses
= clauses
;
4445 /* Get the collapse count of OMP_FOR GS. */
4447 static inline size_t
4448 gimple_omp_for_collapse (gimple gs
)
4450 gimple_statement_omp_for
*omp_for_stmt
=
4451 as_a
<gimple_statement_omp_for
*> (gs
);
4452 return omp_for_stmt
->collapse
;
4456 /* Return the index variable for OMP_FOR GS. */
4459 gimple_omp_for_index (const_gimple gs
, size_t i
)
4461 const gimple_statement_omp_for
*omp_for_stmt
=
4462 as_a
<const gimple_statement_omp_for
*> (gs
);
4463 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4464 return omp_for_stmt
->iter
[i
].index
;
4468 /* Return a pointer to the index variable for OMP_FOR GS. */
4470 static inline tree
*
4471 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
4473 gimple_statement_omp_for
*omp_for_stmt
=
4474 as_a
<gimple_statement_omp_for
*> (gs
);
4475 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4476 return &omp_for_stmt
->iter
[i
].index
;
4480 /* Set INDEX to be the index variable for OMP_FOR GS. */
4483 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
4485 gimple_statement_omp_for
*omp_for_stmt
=
4486 as_a
<gimple_statement_omp_for
*> (gs
);
4487 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4488 omp_for_stmt
->iter
[i
].index
= index
;
4492 /* Return the initial value for OMP_FOR GS. */
4495 gimple_omp_for_initial (const_gimple gs
, size_t i
)
4497 const gimple_statement_omp_for
*omp_for_stmt
=
4498 as_a
<const gimple_statement_omp_for
*> (gs
);
4499 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4500 return omp_for_stmt
->iter
[i
].initial
;
4504 /* Return a pointer to the initial value for OMP_FOR GS. */
4506 static inline tree
*
4507 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
4509 gimple_statement_omp_for
*omp_for_stmt
=
4510 as_a
<gimple_statement_omp_for
*> (gs
);
4511 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4512 return &omp_for_stmt
->iter
[i
].initial
;
4516 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4519 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4521 gimple_statement_omp_for
*omp_for_stmt
=
4522 as_a
<gimple_statement_omp_for
*> (gs
);
4523 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4524 omp_for_stmt
->iter
[i
].initial
= initial
;
4528 /* Return the final value for OMP_FOR GS. */
4531 gimple_omp_for_final (const_gimple gs
, size_t i
)
4533 const gimple_statement_omp_for
*omp_for_stmt
=
4534 as_a
<const gimple_statement_omp_for
*> (gs
);
4535 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4536 return omp_for_stmt
->iter
[i
].final
;
4540 /* Return a pointer to the final value for OMP_FOR GS. */
4542 static inline tree
*
4543 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4545 gimple_statement_omp_for
*omp_for_stmt
=
4546 as_a
<gimple_statement_omp_for
*> (gs
);
4547 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4548 return &omp_for_stmt
->iter
[i
].final
;
4552 /* Set FINAL to be the final value for OMP_FOR GS. */
4555 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4557 gimple_statement_omp_for
*omp_for_stmt
=
4558 as_a
<gimple_statement_omp_for
*> (gs
);
4559 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4560 omp_for_stmt
->iter
[i
].final
= final
;
4564 /* Return the increment value for OMP_FOR GS. */
4567 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4569 const gimple_statement_omp_for
*omp_for_stmt
=
4570 as_a
<const gimple_statement_omp_for
*> (gs
);
4571 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4572 return omp_for_stmt
->iter
[i
].incr
;
4576 /* Return a pointer to the increment value for OMP_FOR GS. */
4578 static inline tree
*
4579 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4581 gimple_statement_omp_for
*omp_for_stmt
=
4582 as_a
<gimple_statement_omp_for
*> (gs
);
4583 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4584 return &omp_for_stmt
->iter
[i
].incr
;
4588 /* Set INCR to be the increment value for OMP_FOR GS. */
4591 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4593 gimple_statement_omp_for
*omp_for_stmt
=
4594 as_a
<gimple_statement_omp_for
*> (gs
);
4595 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4596 omp_for_stmt
->iter
[i
].incr
= incr
;
4600 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4601 statement GS starts. */
4603 static inline gimple_seq
*
4604 gimple_omp_for_pre_body_ptr (gimple gs
)
4606 gimple_statement_omp_for
*omp_for_stmt
=
4607 as_a
<gimple_statement_omp_for
*> (gs
);
4608 return &omp_for_stmt
->pre_body
;
4612 /* Return the sequence of statements to execute before the OMP_FOR
4613 statement GS starts. */
4615 static inline gimple_seq
4616 gimple_omp_for_pre_body (gimple gs
)
4618 return *gimple_omp_for_pre_body_ptr (gs
);
4622 /* Set PRE_BODY to be the sequence of statements to execute before the
4623 OMP_FOR statement GS starts. */
4626 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4628 gimple_statement_omp_for
*omp_for_stmt
=
4629 as_a
<gimple_statement_omp_for
*> (gs
);
4630 omp_for_stmt
->pre_body
= pre_body
;
4634 /* Return the clauses associated with OMP_PARALLEL GS. */
4637 gimple_omp_parallel_clauses (const_gimple gs
)
4639 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4640 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4641 return omp_parallel_stmt
->clauses
;
4645 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4647 static inline tree
*
4648 gimple_omp_parallel_clauses_ptr (gimple gs
)
4650 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4651 as_a
<gimple_statement_omp_parallel
*> (gs
);
4652 return &omp_parallel_stmt
->clauses
;
4656 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4660 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4662 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4663 as_a
<gimple_statement_omp_parallel
*> (gs
);
4664 omp_parallel_stmt
->clauses
= clauses
;
4668 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4671 gimple_omp_parallel_child_fn (const_gimple gs
)
4673 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4674 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4675 return omp_parallel_stmt
->child_fn
;
4678 /* Return a pointer to the child function used to hold the body of
4681 static inline tree
*
4682 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4684 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4685 as_a
<gimple_statement_omp_parallel
*> (gs
);
4686 return &omp_parallel_stmt
->child_fn
;
4690 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4693 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4695 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4696 as_a
<gimple_statement_omp_parallel
*> (gs
);
4697 omp_parallel_stmt
->child_fn
= child_fn
;
4701 /* Return the artificial argument used to send variables and values
4702 from the parent to the children threads in OMP_PARALLEL GS. */
4705 gimple_omp_parallel_data_arg (const_gimple gs
)
4707 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4708 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4709 return omp_parallel_stmt
->data_arg
;
4713 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4715 static inline tree
*
4716 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4718 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4719 as_a
<gimple_statement_omp_parallel
*> (gs
);
4720 return &omp_parallel_stmt
->data_arg
;
4724 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4727 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4729 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4730 as_a
<gimple_statement_omp_parallel
*> (gs
);
4731 omp_parallel_stmt
->data_arg
= data_arg
;
4735 /* Return the clauses associated with OMP_TASK GS. */
4738 gimple_omp_task_clauses (const_gimple gs
)
4740 const gimple_statement_omp_task
*omp_task_stmt
=
4741 as_a
<const gimple_statement_omp_task
*> (gs
);
4742 return omp_task_stmt
->clauses
;
4746 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4748 static inline tree
*
4749 gimple_omp_task_clauses_ptr (gimple gs
)
4751 gimple_statement_omp_task
*omp_task_stmt
=
4752 as_a
<gimple_statement_omp_task
*> (gs
);
4753 return &omp_task_stmt
->clauses
;
4757 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4761 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4763 gimple_statement_omp_task
*omp_task_stmt
=
4764 as_a
<gimple_statement_omp_task
*> (gs
);
4765 omp_task_stmt
->clauses
= clauses
;
4769 /* Return the child function used to hold the body of OMP_TASK GS. */
4772 gimple_omp_task_child_fn (const_gimple gs
)
4774 const gimple_statement_omp_task
*omp_task_stmt
=
4775 as_a
<const gimple_statement_omp_task
*> (gs
);
4776 return omp_task_stmt
->child_fn
;
4779 /* Return a pointer to the child function used to hold the body of
4782 static inline tree
*
4783 gimple_omp_task_child_fn_ptr (gimple gs
)
4785 gimple_statement_omp_task
*omp_task_stmt
=
4786 as_a
<gimple_statement_omp_task
*> (gs
);
4787 return &omp_task_stmt
->child_fn
;
4791 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4794 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4796 gimple_statement_omp_task
*omp_task_stmt
=
4797 as_a
<gimple_statement_omp_task
*> (gs
);
4798 omp_task_stmt
->child_fn
= child_fn
;
4802 /* Return the artificial argument used to send variables and values
4803 from the parent to the children threads in OMP_TASK GS. */
4806 gimple_omp_task_data_arg (const_gimple gs
)
4808 const gimple_statement_omp_task
*omp_task_stmt
=
4809 as_a
<const gimple_statement_omp_task
*> (gs
);
4810 return omp_task_stmt
->data_arg
;
4814 /* Return a pointer to the data argument for OMP_TASK GS. */
4816 static inline tree
*
4817 gimple_omp_task_data_arg_ptr (gimple gs
)
4819 gimple_statement_omp_task
*omp_task_stmt
=
4820 as_a
<gimple_statement_omp_task
*> (gs
);
4821 return &omp_task_stmt
->data_arg
;
4825 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4828 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4830 gimple_statement_omp_task
*omp_task_stmt
=
4831 as_a
<gimple_statement_omp_task
*> (gs
);
4832 omp_task_stmt
->data_arg
= data_arg
;
4836 /* Return the clauses associated with OMP_TASK GS. */
4839 gimple_omp_taskreg_clauses (const_gimple gs
)
4841 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4842 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4843 return omp_taskreg_stmt
->clauses
;
4847 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4849 static inline tree
*
4850 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4852 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4853 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4854 return &omp_taskreg_stmt
->clauses
;
4858 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4862 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4864 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4865 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4866 omp_taskreg_stmt
->clauses
= clauses
;
4870 /* Return the child function used to hold the body of OMP_TASK GS. */
4873 gimple_omp_taskreg_child_fn (const_gimple gs
)
4875 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4876 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4877 return omp_taskreg_stmt
->child_fn
;
4880 /* Return a pointer to the child function used to hold the body of
4883 static inline tree
*
4884 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4886 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4887 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4888 return &omp_taskreg_stmt
->child_fn
;
4892 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4895 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4897 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4898 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4899 omp_taskreg_stmt
->child_fn
= child_fn
;
4903 /* Return the artificial argument used to send variables and values
4904 from the parent to the children threads in OMP_TASK GS. */
4907 gimple_omp_taskreg_data_arg (const_gimple gs
)
4909 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4910 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4911 return omp_taskreg_stmt
->data_arg
;
4915 /* Return a pointer to the data argument for OMP_TASK GS. */
4917 static inline tree
*
4918 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4920 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4921 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4922 return &omp_taskreg_stmt
->data_arg
;
4926 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4929 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4931 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4932 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4933 omp_taskreg_stmt
->data_arg
= data_arg
;
4937 /* Return the copy function used to hold the body of OMP_TASK GS. */
4940 gimple_omp_task_copy_fn (const_gimple gs
)
4942 const gimple_statement_omp_task
*omp_task_stmt
=
4943 as_a
<const gimple_statement_omp_task
*> (gs
);
4944 return omp_task_stmt
->copy_fn
;
4947 /* Return a pointer to the copy function used to hold the body of
4950 static inline tree
*
4951 gimple_omp_task_copy_fn_ptr (gimple gs
)
4953 gimple_statement_omp_task
*omp_task_stmt
=
4954 as_a
<gimple_statement_omp_task
*> (gs
);
4955 return &omp_task_stmt
->copy_fn
;
4959 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4962 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
4964 gimple_statement_omp_task
*omp_task_stmt
=
4965 as_a
<gimple_statement_omp_task
*> (gs
);
4966 omp_task_stmt
->copy_fn
= copy_fn
;
4970 /* Return size of the data block in bytes in OMP_TASK GS. */
4973 gimple_omp_task_arg_size (const_gimple gs
)
4975 const gimple_statement_omp_task
*omp_task_stmt
=
4976 as_a
<const gimple_statement_omp_task
*> (gs
);
4977 return omp_task_stmt
->arg_size
;
4981 /* Return a pointer to the data block size for OMP_TASK GS. */
4983 static inline tree
*
4984 gimple_omp_task_arg_size_ptr (gimple gs
)
4986 gimple_statement_omp_task
*omp_task_stmt
=
4987 as_a
<gimple_statement_omp_task
*> (gs
);
4988 return &omp_task_stmt
->arg_size
;
4992 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4995 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
4997 gimple_statement_omp_task
*omp_task_stmt
=
4998 as_a
<gimple_statement_omp_task
*> (gs
);
4999 omp_task_stmt
->arg_size
= arg_size
;
5003 /* Return align of the data block in bytes in OMP_TASK GS. */
5006 gimple_omp_task_arg_align (const_gimple gs
)
5008 const gimple_statement_omp_task
*omp_task_stmt
=
5009 as_a
<const gimple_statement_omp_task
*> (gs
);
5010 return omp_task_stmt
->arg_align
;
5014 /* Return a pointer to the data block align for OMP_TASK GS. */
5016 static inline tree
*
5017 gimple_omp_task_arg_align_ptr (gimple gs
)
5019 gimple_statement_omp_task
*omp_task_stmt
=
5020 as_a
<gimple_statement_omp_task
*> (gs
);
5021 return &omp_task_stmt
->arg_align
;
5025 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5028 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
5030 gimple_statement_omp_task
*omp_task_stmt
=
5031 as_a
<gimple_statement_omp_task
*> (gs
);
5032 omp_task_stmt
->arg_align
= arg_align
;
5036 /* Return the clauses associated with OMP_SINGLE GS. */
5039 gimple_omp_single_clauses (const_gimple gs
)
5041 const gimple_statement_omp_single
*omp_single_stmt
=
5042 as_a
<const gimple_statement_omp_single
*> (gs
);
5043 return omp_single_stmt
->clauses
;
5047 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5049 static inline tree
*
5050 gimple_omp_single_clauses_ptr (gimple gs
)
5052 gimple_statement_omp_single
*omp_single_stmt
=
5053 as_a
<gimple_statement_omp_single
*> (gs
);
5054 return &omp_single_stmt
->clauses
;
5058 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5061 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
5063 gimple_statement_omp_single
*omp_single_stmt
=
5064 as_a
<gimple_statement_omp_single
*> (gs
);
5065 omp_single_stmt
->clauses
= clauses
;
5069 /* Return the clauses associated with OMP_TARGET GS. */
5072 gimple_omp_target_clauses (const_gimple gs
)
5074 const gimple_statement_omp_target
*omp_target_stmt
=
5075 as_a
<const gimple_statement_omp_target
*> (gs
);
5076 return omp_target_stmt
->clauses
;
5080 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5082 static inline tree
*
5083 gimple_omp_target_clauses_ptr (gimple gs
)
5085 gimple_statement_omp_target
*omp_target_stmt
=
5086 as_a
<gimple_statement_omp_target
*> (gs
);
5087 return &omp_target_stmt
->clauses
;
5091 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5094 gimple_omp_target_set_clauses (gimple gs
, tree clauses
)
5096 gimple_statement_omp_target
*omp_target_stmt
=
5097 as_a
<gimple_statement_omp_target
*> (gs
);
5098 omp_target_stmt
->clauses
= clauses
;
5102 /* Return the kind of OMP target statemement. */
5105 gimple_omp_target_kind (const_gimple g
)
5107 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5108 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5112 /* Set the OMP target kind. */
5115 gimple_omp_target_set_kind (gimple g
, int kind
)
5117 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5118 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5119 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5123 /* Return the child function used to hold the body of OMP_TARGET GS. */
5126 gimple_omp_target_child_fn (const_gimple gs
)
5128 const gimple_statement_omp_target
*omp_target_stmt
=
5129 as_a
<const gimple_statement_omp_target
*> (gs
);
5130 return omp_target_stmt
->child_fn
;
5133 /* Return a pointer to the child function used to hold the body of
5136 static inline tree
*
5137 gimple_omp_target_child_fn_ptr (gimple gs
)
5139 gimple_statement_omp_target
*omp_target_stmt
=
5140 as_a
<gimple_statement_omp_target
*> (gs
);
5141 return &omp_target_stmt
->child_fn
;
5145 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5148 gimple_omp_target_set_child_fn (gimple gs
, tree child_fn
)
5150 gimple_statement_omp_target
*omp_target_stmt
=
5151 as_a
<gimple_statement_omp_target
*> (gs
);
5152 omp_target_stmt
->child_fn
= child_fn
;
5156 /* Return the artificial argument used to send variables and values
5157 from the parent to the children threads in OMP_TARGET GS. */
5160 gimple_omp_target_data_arg (const_gimple gs
)
5162 const gimple_statement_omp_target
*omp_target_stmt
=
5163 as_a
<const gimple_statement_omp_target
*> (gs
);
5164 return omp_target_stmt
->data_arg
;
5168 /* Return a pointer to the data argument for OMP_TARGET GS. */
5170 static inline tree
*
5171 gimple_omp_target_data_arg_ptr (gimple gs
)
5173 gimple_statement_omp_target
*omp_target_stmt
=
5174 as_a
<gimple_statement_omp_target
*> (gs
);
5175 return &omp_target_stmt
->data_arg
;
5179 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5182 gimple_omp_target_set_data_arg (gimple gs
, tree data_arg
)
5184 gimple_statement_omp_target
*omp_target_stmt
=
5185 as_a
<gimple_statement_omp_target
*> (gs
);
5186 omp_target_stmt
->data_arg
= data_arg
;
5190 /* Return the clauses associated with OMP_TEAMS GS. */
5193 gimple_omp_teams_clauses (const_gimple gs
)
5195 const gimple_statement_omp_teams
*omp_teams_stmt
=
5196 as_a
<const gimple_statement_omp_teams
*> (gs
);
5197 return omp_teams_stmt
->clauses
;
5201 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5203 static inline tree
*
5204 gimple_omp_teams_clauses_ptr (gimple gs
)
5206 gimple_statement_omp_teams
*omp_teams_stmt
=
5207 as_a
<gimple_statement_omp_teams
*> (gs
);
5208 return &omp_teams_stmt
->clauses
;
5212 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5215 gimple_omp_teams_set_clauses (gimple gs
, tree clauses
)
5217 gimple_statement_omp_teams
*omp_teams_stmt
=
5218 as_a
<gimple_statement_omp_teams
*> (gs
);
5219 omp_teams_stmt
->clauses
= clauses
;
5223 /* Return the clauses associated with OMP_SECTIONS GS. */
5226 gimple_omp_sections_clauses (const_gimple gs
)
5228 const gimple_statement_omp_sections
*omp_sections_stmt
=
5229 as_a
<const gimple_statement_omp_sections
*> (gs
);
5230 return omp_sections_stmt
->clauses
;
5234 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5236 static inline tree
*
5237 gimple_omp_sections_clauses_ptr (gimple gs
)
5239 gimple_statement_omp_sections
*omp_sections_stmt
=
5240 as_a
<gimple_statement_omp_sections
*> (gs
);
5241 return &omp_sections_stmt
->clauses
;
5245 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5249 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
5251 gimple_statement_omp_sections
*omp_sections_stmt
=
5252 as_a
<gimple_statement_omp_sections
*> (gs
);
5253 omp_sections_stmt
->clauses
= clauses
;
5257 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5261 gimple_omp_sections_control (const_gimple gs
)
5263 const gimple_statement_omp_sections
*omp_sections_stmt
=
5264 as_a
<const gimple_statement_omp_sections
*> (gs
);
5265 return omp_sections_stmt
->control
;
5269 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5272 static inline tree
*
5273 gimple_omp_sections_control_ptr (gimple gs
)
5275 gimple_statement_omp_sections
*omp_sections_stmt
=
5276 as_a
<gimple_statement_omp_sections
*> (gs
);
5277 return &omp_sections_stmt
->control
;
5281 /* Set CONTROL to be the set of clauses associated with the
5282 GIMPLE_OMP_SECTIONS in GS. */
5285 gimple_omp_sections_set_control (gimple gs
, tree control
)
5287 gimple_statement_omp_sections
*omp_sections_stmt
=
5288 as_a
<gimple_statement_omp_sections
*> (gs
);
5289 omp_sections_stmt
->control
= control
;
5293 /* Set COND to be the condition code for OMP_FOR GS. */
5296 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
5298 gimple_statement_omp_for
*omp_for_stmt
=
5299 as_a
<gimple_statement_omp_for
*> (gs
);
5300 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5301 && i
< omp_for_stmt
->collapse
);
5302 omp_for_stmt
->iter
[i
].cond
= cond
;
5306 /* Return the condition code associated with OMP_FOR GS. */
5308 static inline enum tree_code
5309 gimple_omp_for_cond (const_gimple gs
, size_t i
)
5311 const gimple_statement_omp_for
*omp_for_stmt
=
5312 as_a
<const gimple_statement_omp_for
*> (gs
);
5313 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5314 return omp_for_stmt
->iter
[i
].cond
;
5318 /* Set the value being stored in an atomic store. */
5321 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
5323 gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5324 as_a
<gimple_statement_omp_atomic_store
*> (g
);
5325 omp_atomic_store_stmt
->val
= val
;
5329 /* Return the value being stored in an atomic store. */
5332 gimple_omp_atomic_store_val (const_gimple g
)
5334 const gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5335 as_a
<const gimple_statement_omp_atomic_store
*> (g
);
5336 return omp_atomic_store_stmt
->val
;
5340 /* Return a pointer to the value being stored in an atomic store. */
5342 static inline tree
*
5343 gimple_omp_atomic_store_val_ptr (gimple g
)
5345 gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5346 as_a
<gimple_statement_omp_atomic_store
*> (g
);
5347 return &omp_atomic_store_stmt
->val
;
5351 /* Set the LHS of an atomic load. */
5354 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
5356 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5357 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5358 omp_atomic_load_stmt
->lhs
= lhs
;
5362 /* Get the LHS of an atomic load. */
5365 gimple_omp_atomic_load_lhs (const_gimple g
)
5367 const gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5368 as_a
<const gimple_statement_omp_atomic_load
*> (g
);
5369 return omp_atomic_load_stmt
->lhs
;
5373 /* Return a pointer to the LHS of an atomic load. */
5375 static inline tree
*
5376 gimple_omp_atomic_load_lhs_ptr (gimple g
)
5378 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5379 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5380 return &omp_atomic_load_stmt
->lhs
;
5384 /* Set the RHS of an atomic load. */
5387 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
5389 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5390 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5391 omp_atomic_load_stmt
->rhs
= rhs
;
5395 /* Get the RHS of an atomic load. */
5398 gimple_omp_atomic_load_rhs (const_gimple g
)
5400 const gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5401 as_a
<const gimple_statement_omp_atomic_load
*> (g
);
5402 return omp_atomic_load_stmt
->rhs
;
5406 /* Return a pointer to the RHS of an atomic load. */
5408 static inline tree
*
5409 gimple_omp_atomic_load_rhs_ptr (gimple g
)
5411 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5412 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5413 return &omp_atomic_load_stmt
->rhs
;
5417 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5420 gimple_omp_continue_control_def (const_gimple g
)
5422 const gimple_statement_omp_continue
*omp_continue_stmt
=
5423 as_a
<const gimple_statement_omp_continue
*> (g
);
5424 return omp_continue_stmt
->control_def
;
5427 /* The same as above, but return the address. */
5429 static inline tree
*
5430 gimple_omp_continue_control_def_ptr (gimple g
)
5432 gimple_statement_omp_continue
*omp_continue_stmt
=
5433 as_a
<gimple_statement_omp_continue
*> (g
);
5434 return &omp_continue_stmt
->control_def
;
5437 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5440 gimple_omp_continue_set_control_def (gimple g
, tree def
)
5442 gimple_statement_omp_continue
*omp_continue_stmt
=
5443 as_a
<gimple_statement_omp_continue
*> (g
);
5444 omp_continue_stmt
->control_def
= def
;
5448 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5451 gimple_omp_continue_control_use (const_gimple g
)
5453 const gimple_statement_omp_continue
*omp_continue_stmt
=
5454 as_a
<const gimple_statement_omp_continue
*> (g
);
5455 return omp_continue_stmt
->control_use
;
5459 /* The same as above, but return the address. */
5461 static inline tree
*
5462 gimple_omp_continue_control_use_ptr (gimple g
)
5464 gimple_statement_omp_continue
*omp_continue_stmt
=
5465 as_a
<gimple_statement_omp_continue
*> (g
);
5466 return &omp_continue_stmt
->control_use
;
5470 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5473 gimple_omp_continue_set_control_use (gimple g
, tree use
)
5475 gimple_statement_omp_continue
*omp_continue_stmt
=
5476 as_a
<gimple_statement_omp_continue
*> (g
);
5477 omp_continue_stmt
->control_use
= use
;
5480 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5482 static inline gimple_seq
*
5483 gimple_transaction_body_ptr (gimple gs
)
5485 gimple_statement_transaction
*transaction_stmt
=
5486 as_a
<gimple_statement_transaction
*> (gs
);
5487 return &transaction_stmt
->body
;
5490 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5492 static inline gimple_seq
5493 gimple_transaction_body (gimple gs
)
5495 return *gimple_transaction_body_ptr (gs
);
5498 /* Return the label associated with a GIMPLE_TRANSACTION. */
5501 gimple_transaction_label (const_gimple gs
)
5503 const gimple_statement_transaction
*transaction_stmt
=
5504 as_a
<const gimple_statement_transaction
*> (gs
);
5505 return transaction_stmt
->label
;
5508 static inline tree
*
5509 gimple_transaction_label_ptr (gimple gs
)
5511 gimple_statement_transaction
*transaction_stmt
=
5512 as_a
<gimple_statement_transaction
*> (gs
);
5513 return &transaction_stmt
->label
;
5516 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5518 static inline unsigned int
5519 gimple_transaction_subcode (const_gimple gs
)
5521 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5525 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5528 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
5530 gimple_statement_transaction
*transaction_stmt
=
5531 as_a
<gimple_statement_transaction
*> (gs
);
5532 transaction_stmt
->body
= body
;
5535 /* Set the label associated with a GIMPLE_TRANSACTION. */
5538 gimple_transaction_set_label (gimple gs
, tree label
)
5540 gimple_statement_transaction
*transaction_stmt
=
5541 as_a
<gimple_statement_transaction
*> (gs
);
5542 transaction_stmt
->label
= label
;
5545 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5548 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
5550 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5551 gs
->subcode
= subcode
;
5555 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5557 static inline tree
*
5558 gimple_return_retval_ptr (const_gimple gs
)
5560 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5561 return gimple_op_ptr (gs
, 0);
5564 /* Return the return value for GIMPLE_RETURN GS. */
5567 gimple_return_retval (const_gimple gs
)
5569 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5570 return gimple_op (gs
, 0);
5574 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5577 gimple_return_set_retval (gimple gs
, tree retval
)
5579 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5580 gimple_set_op (gs
, 0, retval
);
5584 /* Return the return bounds for GIMPLE_RETURN GS. */
5587 gimple_return_retbnd (const_gimple gs
)
5589 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5590 return gimple_op (gs
, 1);
5594 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5597 gimple_return_set_retbnd (gimple gs
, tree retval
)
5599 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5600 gimple_set_op (gs
, 1, retval
);
5604 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5606 #define CASE_GIMPLE_OMP \
5607 case GIMPLE_OMP_PARALLEL: \
5608 case GIMPLE_OMP_TASK: \
5609 case GIMPLE_OMP_FOR: \
5610 case GIMPLE_OMP_SECTIONS: \
5611 case GIMPLE_OMP_SECTIONS_SWITCH: \
5612 case GIMPLE_OMP_SINGLE: \
5613 case GIMPLE_OMP_TARGET: \
5614 case GIMPLE_OMP_TEAMS: \
5615 case GIMPLE_OMP_SECTION: \
5616 case GIMPLE_OMP_MASTER: \
5617 case GIMPLE_OMP_TASKGROUP: \
5618 case GIMPLE_OMP_ORDERED: \
5619 case GIMPLE_OMP_CRITICAL: \
5620 case GIMPLE_OMP_RETURN: \
5621 case GIMPLE_OMP_ATOMIC_LOAD: \
5622 case GIMPLE_OMP_ATOMIC_STORE: \
5623 case GIMPLE_OMP_CONTINUE
5626 is_gimple_omp (const_gimple stmt
)
5628 switch (gimple_code (stmt
))
5638 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5641 gimple_nop_p (const_gimple g
)
5643 return gimple_code (g
) == GIMPLE_NOP
;
5647 /* Return true if GS is a GIMPLE_RESX. */
5650 is_gimple_resx (const_gimple gs
)
5652 return gimple_code (gs
) == GIMPLE_RESX
;
5655 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5657 static inline enum br_predictor
5658 gimple_predict_predictor (gimple gs
)
5660 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5661 return (enum br_predictor
) (gs
->subcode
& ~GF_PREDICT_TAKEN
);
5665 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5668 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5670 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5671 gs
->subcode
= (gs
->subcode
& GF_PREDICT_TAKEN
)
5672 | (unsigned) predictor
;
5676 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5678 static inline enum prediction
5679 gimple_predict_outcome (gimple gs
)
5681 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5682 return (gs
->subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5686 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5689 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5691 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5692 if (outcome
== TAKEN
)
5693 gs
->subcode
|= GF_PREDICT_TAKEN
;
5695 gs
->subcode
&= ~GF_PREDICT_TAKEN
;
5699 /* Return the type of the main expression computed by STMT. Return
5700 void_type_node if the statement computes nothing. */
5703 gimple_expr_type (const_gimple stmt
)
5705 enum gimple_code code
= gimple_code (stmt
);
5707 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5710 /* In general we want to pass out a type that can be substituted
5711 for both the RHS and the LHS types if there is a possibly
5712 useless conversion involved. That means returning the
5713 original RHS type as far as we can reconstruct it. */
5714 if (code
== GIMPLE_CALL
)
5716 if (gimple_call_internal_p (stmt
)
5717 && gimple_call_internal_fn (stmt
) == IFN_MASK_STORE
)
5718 type
= TREE_TYPE (gimple_call_arg (stmt
, 3));
5720 type
= gimple_call_return_type (stmt
);
5723 switch (gimple_assign_rhs_code (stmt
))
5725 case POINTER_PLUS_EXPR
:
5726 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5730 /* As fallback use the type of the LHS. */
5731 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5736 else if (code
== GIMPLE_COND
)
5737 return boolean_type_node
;
5739 return void_type_node
;
5742 /* Enum and arrays used for allocation stats. Keep in sync with
5743 gimple.c:gimple_alloc_kind_names. */
5744 enum gimple_alloc_kind
5746 gimple_alloc_kind_assign
, /* Assignments. */
5747 gimple_alloc_kind_phi
, /* PHI nodes. */
5748 gimple_alloc_kind_cond
, /* Conditionals. */
5749 gimple_alloc_kind_rest
, /* Everything else. */
5750 gimple_alloc_kind_all
5753 extern int gimple_alloc_counts
[];
5754 extern int gimple_alloc_sizes
[];
5756 /* Return the allocation kind for a given stmt CODE. */
5757 static inline enum gimple_alloc_kind
5758 gimple_alloc_kind (enum gimple_code code
)
5763 return gimple_alloc_kind_assign
;
5765 return gimple_alloc_kind_phi
;
5767 return gimple_alloc_kind_cond
;
5769 return gimple_alloc_kind_rest
;
5773 /* Return true if a location should not be emitted for this statement
5774 by annotate_all_with_location. */
5777 gimple_do_not_emit_location_p (gimple g
)
5779 return gimple_plf (g
, GF_PLF_1
);
5782 /* Mark statement G so a location will not be emitted by
5783 annotate_one_with_location. */
5786 gimple_set_do_not_emit_location (gimple g
)
5788 /* The PLF flags are initialized to 0 when a new tuple is created,
5789 so no need to initialize it anywhere. */
5790 gimple_set_plf (g
, GF_PLF_1
, true);
5794 /* Macros for showing usage statistics. */
5795 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5797 : ((x) < 1024*1024*10 \
5799 : (x) / (1024*1024))))
5801 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5803 #endif /* GCC_GIMPLE_H */