1 /* Gimple IR definitions.
3 Copyright (C) 2007-2014 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 typedef gimple gimple_seq_node
;
28 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
31 LAST_AND_UNUSED_GIMPLE_CODE
34 extern const char *const gimple_code_name
[];
35 extern const unsigned char gimple_rhs_class_table
[];
37 /* Error out if a gimple tuple is addressed incorrectly. */
38 #if defined ENABLE_GIMPLE_CHECKING
39 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
40 extern void gimple_check_failed (const_gimple
, const char *, int, \
41 const char *, enum gimple_code
, \
42 enum tree_code
) ATTRIBUTE_NORETURN
;
44 #define GIMPLE_CHECK(GS, CODE) \
46 const_gimple __gs = (GS); \
47 if (gimple_code (__gs) != (CODE)) \
48 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
49 (CODE), ERROR_MARK); \
51 #else /* not ENABLE_GIMPLE_CHECKING */
52 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
53 #define GIMPLE_CHECK(GS, CODE) (void)0
56 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
57 get_gimple_rhs_class. */
60 GIMPLE_INVALID_RHS
, /* The expression cannot be used on the RHS. */
61 GIMPLE_TERNARY_RHS
, /* The expression is a ternary operation. */
62 GIMPLE_BINARY_RHS
, /* The expression is a binary operation. */
63 GIMPLE_UNARY_RHS
, /* The expression is a unary operation. */
64 GIMPLE_SINGLE_RHS
/* The expression is a single object (an SSA
65 name, a _DECL, a _REF, etc. */
68 /* Specific flags for individual GIMPLE statements. These flags are
69 always stored in gimple_statement_base.subcode and they may only be
70 defined for statement codes that do not use subcodes.
72 Values for the masks can overlap as long as the overlapping values
73 are never used in the same statement class.
75 The maximum mask value that can be defined is 1 << 15 (i.e., each
76 statement code can hold up to 16 bitflags).
78 Keep this list sorted. */
80 GF_ASM_INPUT
= 1 << 0,
81 GF_ASM_VOLATILE
= 1 << 1,
82 GF_CALL_FROM_THUNK
= 1 << 0,
83 GF_CALL_RETURN_SLOT_OPT
= 1 << 1,
84 GF_CALL_TAILCALL
= 1 << 2,
85 GF_CALL_VA_ARG_PACK
= 1 << 3,
86 GF_CALL_NOTHROW
= 1 << 4,
87 GF_CALL_ALLOCA_FOR_VAR
= 1 << 5,
88 GF_CALL_INTERNAL
= 1 << 6,
89 GF_CALL_CTRL_ALTERING
= 1 << 7,
90 GF_OMP_PARALLEL_COMBINED
= 1 << 0,
91 GF_OMP_FOR_KIND_MASK
= 7 << 0,
92 GF_OMP_FOR_KIND_FOR
= 0,
93 GF_OMP_FOR_KIND_DISTRIBUTE
= 1,
94 GF_OMP_FOR_KIND_CILKFOR
= 2,
95 /* Flag for SIMD variants of OMP_FOR kinds. */
96 GF_OMP_FOR_SIMD
= 1 << 2,
97 GF_OMP_FOR_KIND_SIMD
= GF_OMP_FOR_SIMD
| 0,
98 GF_OMP_FOR_KIND_CILKSIMD
= GF_OMP_FOR_SIMD
| 1,
99 GF_OMP_FOR_COMBINED
= 1 << 3,
100 GF_OMP_FOR_COMBINED_INTO
= 1 << 4,
101 GF_OMP_TARGET_KIND_MASK
= (1 << 2) - 1,
102 GF_OMP_TARGET_KIND_REGION
= 0,
103 GF_OMP_TARGET_KIND_DATA
= 1,
104 GF_OMP_TARGET_KIND_UPDATE
= 2,
106 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
107 a thread synchronization via some sort of barrier. The exact barrier
108 that would otherwise be emitted is dependent on the OMP statement with
109 which this return is associated. */
110 GF_OMP_RETURN_NOWAIT
= 1 << 0,
112 GF_OMP_SECTION_LAST
= 1 << 0,
113 GF_OMP_ATOMIC_NEED_VALUE
= 1 << 0,
114 GF_OMP_ATOMIC_SEQ_CST
= 1 << 1,
115 GF_PREDICT_TAKEN
= 1 << 15
118 /* Currently, there are only two types of gimple debug stmt. Others are
119 envisioned, for example, to enable the generation of is_stmt notes
120 in line number information, to mark sequence points, etc. This
121 subcode is to be used to tell them apart. */
122 enum gimple_debug_subcode
{
123 GIMPLE_DEBUG_BIND
= 0,
124 GIMPLE_DEBUG_SOURCE_BIND
= 1
127 /* Masks for selecting a pass local flag (PLF) to work on. These
128 masks are used by gimple_set_plf and gimple_plf. */
134 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
135 are for 64 bit hosts. */
137 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
138 chain_next ("%h.next"), variable_size
))
139 gimple_statement_base
142 Main identifying code for a tuple. */
143 ENUM_BITFIELD(gimple_code
) code
: 8;
145 /* Nonzero if a warning should not be emitted on this tuple. */
146 unsigned int no_warning
: 1;
148 /* Nonzero if this tuple has been visited. Passes are responsible
149 for clearing this bit before using it. */
150 unsigned int visited
: 1;
152 /* Nonzero if this tuple represents a non-temporal move. */
153 unsigned int nontemporal_move
: 1;
155 /* Pass local flags. These flags are free for any pass to use as
156 they see fit. Passes should not assume that these flags contain
157 any useful value when the pass starts. Any initial state that
158 the pass requires should be set on entry to the pass. See
159 gimple_set_plf and gimple_plf for usage. */
160 unsigned int plf
: 2;
162 /* Nonzero if this statement has been modified and needs to have its
163 operands rescanned. */
164 unsigned modified
: 1;
166 /* Nonzero if this statement contains volatile operands. */
167 unsigned has_volatile_ops
: 1;
169 /* Padding to get subcode to 16 bit alignment. */
172 /* The SUBCODE field can be used for tuple-specific flags for tuples
173 that do not require subcodes. Note that SUBCODE should be at
174 least as wide as tree codes, as several tuples store tree codes
176 unsigned int subcode
: 16;
178 /* UID of this statement. This is used by passes that want to
179 assign IDs to statements. It must be assigned and used by each
180 pass. By default it should be assumed to contain garbage. */
184 Locus information for debug info. */
187 /* Number of operands in this tuple. */
191 Basic block holding this statement. */
195 Linked lists of gimple statements. The next pointers form
196 a NULL terminated list, the prev pointers are a cyclic list.
197 A gimple statement is hence also a double-ended list of
198 statements, with the pointer itself being the first element,
199 and the prev pointer being the last. */
201 gimple
GTY((skip
)) prev
;
206 /* Base structure for tuples with operands. */
208 /* This gimple subclass has no tag value. */
210 gimple_statement_with_ops_base
: public gimple_statement_base
212 /* [ WORD 1-6 ] : base class */
215 SSA operand vectors. NOTE: It should be possible to
216 amalgamate these vectors with the operand vector OP. However,
217 the SSA operand vectors are organized differently and contain
218 more information (like immediate use chaining). */
219 struct use_optype_d
GTY((skip (""))) *use_ops
;
223 /* Statements that take register operands. */
225 struct GTY((tag("GSS_WITH_OPS")))
226 gimple_statement_with_ops
: public gimple_statement_with_ops_base
228 /* [ WORD 1-7 ] : base class */
231 Operand vector. NOTE! This must always be the last field
232 of this structure. In particular, this means that this
233 structure cannot be embedded inside another one. */
234 tree
GTY((length ("%h.num_ops"))) op
[1];
238 /* Base for statements that take both memory and register operands. */
240 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
241 gimple_statement_with_memory_ops_base
: public gimple_statement_with_ops_base
243 /* [ WORD 1-7 ] : base class */
246 Virtual operands for this statement. The GC will pick them
247 up via the ssa_names array. */
248 tree
GTY((skip (""))) vdef
;
249 tree
GTY((skip (""))) vuse
;
253 /* Statements that take both memory and register operands. */
255 struct GTY((tag("GSS_WITH_MEM_OPS")))
256 gimple_statement_with_memory_ops
:
257 public gimple_statement_with_memory_ops_base
259 /* [ WORD 1-9 ] : base class */
262 Operand vector. NOTE! This must always be the last field
263 of this structure. In particular, this means that this
264 structure cannot be embedded inside another one. */
265 tree
GTY((length ("%h.num_ops"))) op
[1];
269 /* Call statements that take both memory and register operands. */
271 struct GTY((tag("GSS_CALL")))
272 gimple_statement_call
: public gimple_statement_with_memory_ops_base
274 /* [ WORD 1-9 ] : base class */
277 struct pt_solution call_used
;
278 struct pt_solution call_clobbered
;
281 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
282 tree
GTY ((tag ("0"))) fntype
;
283 enum internal_fn
GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn
;
287 Operand vector. NOTE! This must always be the last field
288 of this structure. In particular, this means that this
289 structure cannot be embedded inside another one. */
290 tree
GTY((length ("%h.num_ops"))) op
[1];
294 /* OpenMP statements (#pragma omp). */
296 struct GTY((tag("GSS_OMP")))
297 gimple_statement_omp
: public gimple_statement_base
299 /* [ WORD 1-6 ] : base class */
308 struct GTY((tag("GSS_BIND")))
309 gimple_statement_bind
: public gimple_statement_base
311 /* [ WORD 1-6 ] : base class */
314 Variables declared in this scope. */
318 This is different than the BLOCK field in gimple_statement_base,
319 which is analogous to TREE_BLOCK (i.e., the lexical block holding
320 this statement). This field is the equivalent of BIND_EXPR_BLOCK
321 in tree land (i.e., the lexical scope defined by this bind). See
332 struct GTY((tag("GSS_CATCH")))
333 gimple_statement_catch
: public gimple_statement_base
335 /* [ WORD 1-6 ] : base class */
345 /* GIMPLE_EH_FILTER */
347 struct GTY((tag("GSS_EH_FILTER")))
348 gimple_statement_eh_filter
: public gimple_statement_base
350 /* [ WORD 1-6 ] : base class */
363 struct GTY((tag("GSS_EH_ELSE")))
364 gimple_statement_eh_else
: public gimple_statement_base
366 /* [ WORD 1-6 ] : base class */
369 gimple_seq n_body
, e_body
;
372 /* GIMPLE_EH_MUST_NOT_THROW */
374 struct GTY((tag("GSS_EH_MNT")))
375 gimple_statement_eh_mnt
: public gimple_statement_base
377 /* [ WORD 1-6 ] : base class */
379 /* [ WORD 7 ] Abort function decl. */
385 struct GTY((tag("GSS_PHI")))
386 gimple_statement_phi
: public gimple_statement_base
388 /* [ WORD 1-6 ] : base class */
398 struct phi_arg_d
GTY ((length ("%h.nargs"))) args
[1];
402 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
404 struct GTY((tag("GSS_EH_CTRL")))
405 gimple_statement_eh_ctrl
: public gimple_statement_base
407 /* [ WORD 1-6 ] : base class */
410 Exception region number. */
414 struct GTY((tag("GSS_EH_CTRL")))
415 gimple_statement_resx
: public gimple_statement_eh_ctrl
417 /* No extra fields; adds invariant:
418 stmt->code == GIMPLE_RESX. */
421 struct GTY((tag("GSS_EH_CTRL")))
422 gimple_statement_eh_dispatch
: public gimple_statement_eh_ctrl
424 /* No extra fields; adds invariant:
425 stmt->code == GIMPLE_EH_DISPATH. */
431 struct GTY((tag("GSS_TRY")))
432 gimple_statement_try
: public gimple_statement_base
434 /* [ WORD 1-6 ] : base class */
437 Expression to evaluate. */
441 Cleanup expression. */
445 /* Kind of GIMPLE_TRY statements. */
446 enum gimple_try_flags
449 GIMPLE_TRY_CATCH
= 1 << 0,
452 GIMPLE_TRY_FINALLY
= 1 << 1,
453 GIMPLE_TRY_KIND
= GIMPLE_TRY_CATCH
| GIMPLE_TRY_FINALLY
,
455 /* Analogous to TRY_CATCH_IS_CLEANUP. */
456 GIMPLE_TRY_CATCH_IS_CLEANUP
= 1 << 2
459 /* GIMPLE_WITH_CLEANUP_EXPR */
461 struct GTY((tag("GSS_WCE")))
462 gimple_statement_wce
: public gimple_statement_base
464 /* [ WORD 1-6 ] : base class */
466 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
467 executed if an exception is thrown, not on normal exit of its
468 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
472 Cleanup expression. */
479 struct GTY((tag("GSS_ASM")))
480 gimple_statement_asm
: public gimple_statement_with_memory_ops_base
482 /* [ WORD 1-9 ] : base class */
485 __asm__ statement. */
489 Number of inputs, outputs, clobbers, labels. */
496 Operand vector. NOTE! This must always be the last field
497 of this structure. In particular, this means that this
498 structure cannot be embedded inside another one. */
499 tree
GTY((length ("%h.num_ops"))) op
[1];
502 /* GIMPLE_OMP_CRITICAL */
504 struct GTY((tag("GSS_OMP_CRITICAL")))
505 gimple_statement_omp_critical
: public gimple_statement_omp
507 /* [ WORD 1-7 ] : base class */
510 Critical section name. */
515 struct GTY(()) gimple_omp_for_iter
{
516 /* Condition code. */
519 /* Index variable. */
534 struct GTY((tag("GSS_OMP_FOR")))
535 gimple_statement_omp_for
: public gimple_statement_omp
537 /* [ WORD 1-7 ] : base class */
543 Number of elements in iter array. */
547 struct gimple_omp_for_iter
* GTY((length ("%h.collapse"))) iter
;
550 Pre-body evaluated before the loop body begins. */
555 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
556 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
557 gimple_statement_omp_parallel_layout
: public gimple_statement_omp
559 /* [ WORD 1-7 ] : base class */
566 Child function holding the body of the parallel region. */
570 Shared data argument. */
574 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
575 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
576 gimple_statement_omp_taskreg
: public gimple_statement_omp_parallel_layout
578 /* No extra fields; adds invariant:
579 stmt->code == GIMPLE_OMP_PARALLEL
580 || stmt->code == GIMPLE_OMP_TASK. */
584 /* GIMPLE_OMP_PARALLEL */
585 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
586 gimple_statement_omp_parallel
: public gimple_statement_omp_taskreg
588 /* No extra fields; adds invariant:
589 stmt->code == GIMPLE_OMP_PARALLEL. */
592 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
593 gimple_statement_omp_target
: public gimple_statement_omp_parallel_layout
595 /* No extra fields; adds invariant:
596 stmt->code == GIMPLE_OMP_TARGET. */
599 /* GIMPLE_OMP_TASK */
601 struct GTY((tag("GSS_OMP_TASK")))
602 gimple_statement_omp_task
: public gimple_statement_omp_taskreg
604 /* [ WORD 1-10 ] : base class */
607 Child function holding firstprivate initialization if needed. */
611 Size and alignment in bytes of the argument data block. */
617 /* GIMPLE_OMP_SECTION */
618 /* Uses struct gimple_statement_omp. */
621 /* GIMPLE_OMP_SECTIONS */
623 struct GTY((tag("GSS_OMP_SECTIONS")))
624 gimple_statement_omp_sections
: public gimple_statement_omp
626 /* [ WORD 1-7 ] : base class */
632 The control variable used for deciding which of the sections to
637 /* GIMPLE_OMP_CONTINUE.
639 Note: This does not inherit from gimple_statement_omp, because we
640 do not need the body field. */
642 struct GTY((tag("GSS_OMP_CONTINUE")))
643 gimple_statement_omp_continue
: public gimple_statement_base
645 /* [ WORD 1-6 ] : base class */
654 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
656 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
657 gimple_statement_omp_single_layout
: public gimple_statement_omp
659 /* [ WORD 1-7 ] : base class */
665 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
666 gimple_statement_omp_single
: public gimple_statement_omp_single_layout
668 /* No extra fields; adds invariant:
669 stmt->code == GIMPLE_OMP_SINGLE. */
672 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
673 gimple_statement_omp_teams
: public gimple_statement_omp_single_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_TEAMS. */
680 /* GIMPLE_OMP_ATOMIC_LOAD.
681 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
682 contains a sequence, which we don't need here. */
684 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
685 gimple_statement_omp_atomic_load
: public gimple_statement_base
687 /* [ WORD 1-6 ] : base class */
693 /* GIMPLE_OMP_ATOMIC_STORE.
694 See note on GIMPLE_OMP_ATOMIC_LOAD. */
696 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
697 gimple_statement_omp_atomic_store_layout
: public gimple_statement_base
699 /* [ WORD 1-6 ] : base class */
705 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
706 gimple_statement_omp_atomic_store
:
707 public gimple_statement_omp_atomic_store_layout
709 /* No extra fields; adds invariant:
710 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
713 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
714 gimple_statement_omp_return
:
715 public gimple_statement_omp_atomic_store_layout
717 /* No extra fields; adds invariant:
718 stmt->code == GIMPLE_OMP_RETURN. */
721 /* GIMPLE_TRANSACTION. */
723 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
725 /* The __transaction_atomic was declared [[outer]] or it is
726 __transaction_relaxed. */
727 #define GTMA_IS_OUTER (1u << 0)
728 #define GTMA_IS_RELAXED (1u << 1)
729 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
731 /* The transaction is seen to not have an abort. */
732 #define GTMA_HAVE_ABORT (1u << 2)
733 /* The transaction is seen to have loads or stores. */
734 #define GTMA_HAVE_LOAD (1u << 3)
735 #define GTMA_HAVE_STORE (1u << 4)
736 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
737 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
738 /* The transaction WILL enter serial irrevocable mode.
739 An irrevocable block post-dominates the entire transaction, such
740 that all invocations of the transaction will go serial-irrevocable.
741 In such case, we don't bother instrumenting the transaction, and
742 tell the runtime that it should begin the transaction in
743 serial-irrevocable mode. */
744 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
745 /* The transaction contains no instrumentation code whatsover, most
746 likely because it is guaranteed to go irrevocable upon entry. */
747 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
749 struct GTY((tag("GSS_TRANSACTION")))
750 gimple_statement_transaction
: public gimple_statement_with_memory_ops_base
752 /* [ WORD 1-9 ] : base class */
761 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
762 enum gimple_statement_structure_enum
{
763 #include "gsstruct.def"
768 /* A statement with the invariant that
769 stmt->code == GIMPLE_COND
770 i.e. a conditional jump statement. */
772 struct GTY((tag("GSS_WITH_OPS")))
773 gimple_statement_cond
: public gimple_statement_with_ops
775 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
778 /* A statement with the invariant that
779 stmt->code == GIMPLE_DEBUG
780 i.e. a debug statement.
782 This type will normally be accessed via the gimple_debug and
783 const_gimple_debug typedefs (in coretypes.h), which are pointers to
786 struct GTY((tag("GSS_WITH_OPS")))
787 gimple_statement_debug
: public gimple_statement_with_ops
789 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
792 /* A statement with the invariant that
793 stmt->code == GIMPLE_LABEL
794 i.e. a label statement.
796 This type will normally be accessed via the gimple_label and
797 const_gimple_label typedefs (in coretypes.h), which are pointers to
800 struct GTY((tag("GSS_WITH_OPS")))
801 gimple_statement_label
: public gimple_statement_with_ops
803 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
806 /* A statement with the invariant that
807 stmt->code == GIMPLE_SWITCH
808 i.e. a switch statement. */
810 struct GTY((tag("GSS_WITH_OPS")))
811 gimple_statement_switch
: public gimple_statement_with_ops
813 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
816 /* A statement with the invariant that
817 stmt->code == GIMPLE_ASSIGN
818 i.e. an assignment statement. */
820 struct GTY((tag("GSS_WITH_MEM_OPS")))
821 gimple_statement_assign
: public gimple_statement_with_memory_ops
823 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
829 is_a_helper
<gimple_statement_asm
*>::test (gimple gs
)
831 return gs
->code
== GIMPLE_ASM
;
837 is_a_helper
<gimple_statement_assign
*>::test (gimple gs
)
839 return gs
->code
== GIMPLE_ASSIGN
;
845 is_a_helper
<gimple_statement_bind
*>::test (gimple gs
)
847 return gs
->code
== GIMPLE_BIND
;
853 is_a_helper
<gimple_statement_call
*>::test (gimple gs
)
855 return gs
->code
== GIMPLE_CALL
;
861 is_a_helper
<gimple_statement_catch
*>::test (gimple gs
)
863 return gs
->code
== GIMPLE_CATCH
;
869 is_a_helper
<gimple_statement_cond
*>::test (gimple gs
)
871 return gs
->code
== GIMPLE_COND
;
877 is_a_helper
<gimple_statement_debug
*>::test (gimple gs
)
879 return gs
->code
== GIMPLE_DEBUG
;
885 is_a_helper
<gimple_statement_label
*>::test (gimple gs
)
887 return gs
->code
== GIMPLE_LABEL
;
893 is_a_helper
<gimple_statement_resx
*>::test (gimple gs
)
895 return gs
->code
== GIMPLE_RESX
;
901 is_a_helper
<gimple_statement_eh_dispatch
*>::test (gimple gs
)
903 return gs
->code
== GIMPLE_EH_DISPATCH
;
909 is_a_helper
<gimple_statement_eh_else
*>::test (gimple gs
)
911 return gs
->code
== GIMPLE_EH_ELSE
;
917 is_a_helper
<gimple_statement_eh_filter
*>::test (gimple gs
)
919 return gs
->code
== GIMPLE_EH_FILTER
;
925 is_a_helper
<gimple_statement_eh_mnt
*>::test (gimple gs
)
927 return gs
->code
== GIMPLE_EH_MUST_NOT_THROW
;
933 is_a_helper
<gimple_statement_omp_atomic_load
*>::test (gimple gs
)
935 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
941 is_a_helper
<gimple_statement_omp_atomic_store
*>::test (gimple gs
)
943 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
949 is_a_helper
<gimple_statement_omp_return
*>::test (gimple gs
)
951 return gs
->code
== GIMPLE_OMP_RETURN
;
957 is_a_helper
<gimple_statement_omp_continue
*>::test (gimple gs
)
959 return gs
->code
== GIMPLE_OMP_CONTINUE
;
965 is_a_helper
<gimple_statement_omp_critical
*>::test (gimple gs
)
967 return gs
->code
== GIMPLE_OMP_CRITICAL
;
973 is_a_helper
<gimple_statement_omp_for
*>::test (gimple gs
)
975 return gs
->code
== GIMPLE_OMP_FOR
;
981 is_a_helper
<gimple_statement_omp_taskreg
*>::test (gimple gs
)
983 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
989 is_a_helper
<gimple_statement_omp_parallel
*>::test (gimple gs
)
991 return gs
->code
== GIMPLE_OMP_PARALLEL
;
997 is_a_helper
<gimple_statement_omp_target
*>::test (gimple gs
)
999 return gs
->code
== GIMPLE_OMP_TARGET
;
1005 is_a_helper
<gimple_statement_omp_sections
*>::test (gimple gs
)
1007 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1013 is_a_helper
<gimple_statement_omp_single
*>::test (gimple gs
)
1015 return gs
->code
== GIMPLE_OMP_SINGLE
;
1021 is_a_helper
<gimple_statement_omp_teams
*>::test (gimple gs
)
1023 return gs
->code
== GIMPLE_OMP_TEAMS
;
1029 is_a_helper
<gimple_statement_omp_task
*>::test (gimple gs
)
1031 return gs
->code
== GIMPLE_OMP_TASK
;
1037 is_a_helper
<gimple_statement_phi
*>::test (gimple gs
)
1039 return gs
->code
== GIMPLE_PHI
;
1045 is_a_helper
<gimple_statement_transaction
*>::test (gimple gs
)
1047 return gs
->code
== GIMPLE_TRANSACTION
;
1053 is_a_helper
<gimple_statement_switch
*>::test (gimple gs
)
1055 return gs
->code
== GIMPLE_SWITCH
;
1061 is_a_helper
<gimple_statement_try
*>::test (gimple gs
)
1063 return gs
->code
== GIMPLE_TRY
;
1069 is_a_helper
<gimple_statement_wce
*>::test (gimple gs
)
1071 return gs
->code
== GIMPLE_WITH_CLEANUP_EXPR
;
1077 is_a_helper
<const gimple_statement_asm
*>::test (const_gimple gs
)
1079 return gs
->code
== GIMPLE_ASM
;
1085 is_a_helper
<const gimple_statement_bind
*>::test (const_gimple gs
)
1087 return gs
->code
== GIMPLE_BIND
;
1093 is_a_helper
<const gimple_statement_call
*>::test (const_gimple gs
)
1095 return gs
->code
== GIMPLE_CALL
;
1101 is_a_helper
<const gimple_statement_catch
*>::test (const_gimple gs
)
1103 return gs
->code
== GIMPLE_CATCH
;
1109 is_a_helper
<const gimple_statement_resx
*>::test (const_gimple gs
)
1111 return gs
->code
== GIMPLE_RESX
;
1117 is_a_helper
<const gimple_statement_eh_dispatch
*>::test (const_gimple gs
)
1119 return gs
->code
== GIMPLE_EH_DISPATCH
;
1125 is_a_helper
<const gimple_statement_eh_filter
*>::test (const_gimple gs
)
1127 return gs
->code
== GIMPLE_EH_FILTER
;
1133 is_a_helper
<const gimple_statement_omp_atomic_load
*>::test (const_gimple gs
)
1135 return gs
->code
== GIMPLE_OMP_ATOMIC_LOAD
;
1141 is_a_helper
<const gimple_statement_omp_atomic_store
*>::test (const_gimple gs
)
1143 return gs
->code
== GIMPLE_OMP_ATOMIC_STORE
;
1149 is_a_helper
<const gimple_statement_omp_return
*>::test (const_gimple gs
)
1151 return gs
->code
== GIMPLE_OMP_RETURN
;
1157 is_a_helper
<const gimple_statement_omp_continue
*>::test (const_gimple gs
)
1159 return gs
->code
== GIMPLE_OMP_CONTINUE
;
1165 is_a_helper
<const gimple_statement_omp_critical
*>::test (const_gimple gs
)
1167 return gs
->code
== GIMPLE_OMP_CRITICAL
;
1173 is_a_helper
<const gimple_statement_omp_for
*>::test (const_gimple gs
)
1175 return gs
->code
== GIMPLE_OMP_FOR
;
1181 is_a_helper
<const gimple_statement_omp_taskreg
*>::test (const_gimple gs
)
1183 return gs
->code
== GIMPLE_OMP_PARALLEL
|| gs
->code
== GIMPLE_OMP_TASK
;
1189 is_a_helper
<const gimple_statement_omp_parallel
*>::test (const_gimple gs
)
1191 return gs
->code
== GIMPLE_OMP_PARALLEL
;
1197 is_a_helper
<const gimple_statement_omp_target
*>::test (const_gimple gs
)
1199 return gs
->code
== GIMPLE_OMP_TARGET
;
1205 is_a_helper
<const gimple_statement_omp_sections
*>::test (const_gimple gs
)
1207 return gs
->code
== GIMPLE_OMP_SECTIONS
;
1213 is_a_helper
<const gimple_statement_omp_single
*>::test (const_gimple gs
)
1215 return gs
->code
== GIMPLE_OMP_SINGLE
;
1221 is_a_helper
<const gimple_statement_omp_teams
*>::test (const_gimple gs
)
1223 return gs
->code
== GIMPLE_OMP_TEAMS
;
1229 is_a_helper
<const gimple_statement_omp_task
*>::test (const_gimple gs
)
1231 return gs
->code
== GIMPLE_OMP_TASK
;
1237 is_a_helper
<const gimple_statement_phi
*>::test (const_gimple gs
)
1239 return gs
->code
== GIMPLE_PHI
;
1245 is_a_helper
<const gimple_statement_transaction
*>::test (const_gimple gs
)
1247 return gs
->code
== GIMPLE_TRANSACTION
;
1250 /* Offset in bytes to the location of the operand vector.
1251 Zero if there is no operand vector for this tuple structure. */
1252 extern size_t const gimple_ops_offset_
[];
1254 /* Map GIMPLE codes to GSS codes. */
1255 extern enum gimple_statement_structure_enum
const gss_for_code_
[];
1257 /* This variable holds the currently expanded gimple statement for purposes
1258 of comminucating the profile info to the builtin expanders. */
1259 extern gimple currently_expanding_gimple_stmt
;
1261 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1262 gimple
gimple_alloc_stat (enum gimple_code
, unsigned MEM_STAT_DECL
);
1263 gimple
gimple_build_return (tree
);
1264 void gimple_call_reset_alias_info (gimple_call
);
1265 gimple_call
gimple_build_call_vec (tree
, vec
<tree
> );
1266 gimple_call
gimple_build_call (tree
, unsigned, ...);
1267 gimple_call
gimple_build_call_valist (tree
, unsigned, va_list);
1268 gimple_call
gimple_build_call_internal (enum internal_fn
, unsigned, ...);
1269 gimple_call
gimple_build_call_internal_vec (enum internal_fn
, vec
<tree
> );
1270 gimple_call
gimple_build_call_from_tree (tree
);
1271 gimple_assign
gimple_build_assign_stat (tree
, tree MEM_STAT_DECL
);
1272 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1273 gimple_assign
gimple_build_assign_with_ops (enum tree_code
, tree
,
1275 tree CXX_MEM_STAT_INFO
);
1276 gimple_assign
gimple_build_assign_with_ops (enum tree_code
, tree
,
1277 tree
, tree CXX_MEM_STAT_INFO
);
1278 gimple_cond
gimple_build_cond (enum tree_code
, tree
, tree
, tree
, tree
);
1279 gimple_cond
gimple_build_cond_from_tree (tree
, tree
, tree
);
1280 void gimple_cond_set_condition_from_tree (gimple_cond
, tree
);
1281 gimple_label
gimple_build_label (tree label
);
1282 gimple
gimple_build_goto (tree dest
);
1283 gimple
gimple_build_nop (void);
1284 gimple_bind
gimple_build_bind (tree
, gimple_seq
, tree
);
1285 gimple
gimple_build_asm_vec (const char *, vec
<tree
, va_gc
> *,
1286 vec
<tree
, va_gc
> *, vec
<tree
, va_gc
> *,
1287 vec
<tree
, va_gc
> *);
1288 gimple
gimple_build_catch (tree
, gimple_seq
);
1289 gimple
gimple_build_eh_filter (tree
, gimple_seq
);
1290 gimple
gimple_build_eh_must_not_throw (tree
);
1291 gimple
gimple_build_eh_else (gimple_seq
, gimple_seq
);
1292 gimple_statement_try
*gimple_build_try (gimple_seq
, gimple_seq
,
1293 enum gimple_try_flags
);
1294 gimple
gimple_build_wce (gimple_seq
);
1295 gimple
gimple_build_resx (int);
1296 gimple_switch
gimple_build_switch_nlabels (unsigned, tree
, tree
);
1297 gimple_switch
gimple_build_switch (tree
, tree
, vec
<tree
> );
1298 gimple
gimple_build_eh_dispatch (int);
1299 gimple_debug
gimple_build_debug_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1300 #define gimple_build_debug_bind(var,val,stmt) \
1301 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1302 gimple_debug
gimple_build_debug_source_bind_stat (tree
, tree
, gimple MEM_STAT_DECL
);
1303 #define gimple_build_debug_source_bind(var,val,stmt) \
1304 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1305 gimple
gimple_build_omp_critical (gimple_seq
, tree
);
1306 gimple
gimple_build_omp_for (gimple_seq
, int, tree
, size_t, gimple_seq
);
1307 gimple
gimple_build_omp_parallel (gimple_seq
, tree
, tree
, tree
);
1308 gimple
gimple_build_omp_task (gimple_seq
, tree
, tree
, tree
, tree
, tree
, tree
);
1309 gimple
gimple_build_omp_section (gimple_seq
);
1310 gimple
gimple_build_omp_master (gimple_seq
);
1311 gimple
gimple_build_omp_taskgroup (gimple_seq
);
1312 gimple
gimple_build_omp_continue (tree
, tree
);
1313 gimple
gimple_build_omp_ordered (gimple_seq
);
1314 gimple
gimple_build_omp_return (bool);
1315 gimple
gimple_build_omp_sections (gimple_seq
, tree
);
1316 gimple
gimple_build_omp_sections_switch (void);
1317 gimple
gimple_build_omp_single (gimple_seq
, tree
);
1318 gimple
gimple_build_omp_target (gimple_seq
, int, tree
);
1319 gimple
gimple_build_omp_teams (gimple_seq
, tree
);
1320 gimple
gimple_build_omp_atomic_load (tree
, tree
);
1321 gimple
gimple_build_omp_atomic_store (tree
);
1322 gimple
gimple_build_transaction (gimple_seq
, tree
);
1323 gimple
gimple_build_predict (enum br_predictor
, enum prediction
);
1324 extern void gimple_seq_add_stmt (gimple_seq
*, gimple
);
1325 extern void gimple_seq_add_stmt_without_update (gimple_seq
*, gimple
);
1326 void gimple_seq_add_seq (gimple_seq
*, gimple_seq
);
1327 void gimple_seq_add_seq_without_update (gimple_seq
*, gimple_seq
);
1328 extern void annotate_all_with_location_after (gimple_seq
, gimple_stmt_iterator
,
1330 extern void annotate_all_with_location (gimple_seq
, location_t
);
1331 bool empty_body_p (gimple_seq
);
1332 gimple_seq
gimple_seq_copy (gimple_seq
);
1333 bool gimple_call_same_target_p (const_gimple
, const_gimple
);
1334 int gimple_call_flags (const_gimple
);
1335 int gimple_call_arg_flags (const_gimple
, unsigned);
1336 int gimple_call_return_flags (const_gimple_call
);
1337 bool gimple_assign_copy_p (gimple
);
1338 bool gimple_assign_ssa_name_copy_p (gimple
);
1339 bool gimple_assign_unary_nop_p (gimple
);
1340 void gimple_set_bb (gimple
, basic_block
);
1341 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator
*, tree
);
1342 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator
*, enum tree_code
,
1344 tree
gimple_get_lhs (const_gimple
);
1345 void gimple_set_lhs (gimple
, tree
);
1346 gimple
gimple_copy (gimple
);
1347 bool gimple_has_side_effects (const_gimple
);
1348 bool gimple_could_trap_p_1 (gimple
, bool, bool);
1349 bool gimple_could_trap_p (gimple
);
1350 bool gimple_assign_rhs_could_trap_p (gimple
);
1351 extern void dump_gimple_statistics (void);
1352 unsigned get_gimple_rhs_num_ops (enum tree_code
);
1353 extern tree
canonicalize_cond_expr_cond (tree
);
1354 gimple_call
gimple_call_copy_skip_args (gimple
, bitmap
);
1355 extern bool gimple_compare_field_offset (tree
, tree
);
1356 extern tree
gimple_unsigned_type (tree
);
1357 extern tree
gimple_signed_type (tree
);
1358 extern alias_set_type
gimple_get_alias_set (tree
);
1359 extern bool gimple_ior_addresses_taken (bitmap
, gimple
);
1360 extern bool gimple_builtin_call_types_compatible_p (const_gimple
, tree
);
1361 extern bool gimple_call_builtin_p (const_gimple
);
1362 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_class
);
1363 extern bool gimple_call_builtin_p (const_gimple
, enum built_in_function
);
1364 extern bool gimple_asm_clobbers_memory_p (const_gimple
);
1365 extern void dump_decl_set (FILE *, bitmap
);
1366 extern bool nonfreeing_call_p (gimple
);
1367 extern bool infer_nonnull_range (gimple
, tree
, bool, bool);
1368 extern void sort_case_labels (vec
<tree
> );
1369 extern void preprocess_case_label_vec_for_gimple (vec
<tree
> , tree
, tree
*);
1370 extern void gimple_seq_set_location (gimple_seq
, location_t
);
1372 /* Formal (expression) temporary table handling: multiple occurrences of
1373 the same scalar expression are evaluated into the same temporary. */
1375 typedef struct gimple_temp_hash_elt
1378 tree temp
; /* Value */
1381 /* Get the number of the next statement uid to be allocated. */
1382 static inline unsigned int
1383 gimple_stmt_max_uid (struct function
*fn
)
1385 return fn
->last_stmt_uid
;
1388 /* Set the number of the next statement uid to be allocated. */
1390 set_gimple_stmt_max_uid (struct function
*fn
, unsigned int maxid
)
1392 fn
->last_stmt_uid
= maxid
;
1395 /* Set the number of the next statement uid to be allocated. */
1396 static inline unsigned int
1397 inc_gimple_stmt_max_uid (struct function
*fn
)
1399 return fn
->last_stmt_uid
++;
1402 /* Return the first node in GIMPLE sequence S. */
1404 static inline gimple_seq_node
1405 gimple_seq_first (gimple_seq s
)
1411 /* Return the first statement in GIMPLE sequence S. */
1413 static inline gimple
1414 gimple_seq_first_stmt (gimple_seq s
)
1416 gimple_seq_node n
= gimple_seq_first (s
);
1420 /* Return the first statement in GIMPLE sequence S as a gimple_bind,
1421 verifying that it has code GIMPLE_BIND in a checked build. */
1423 static inline gimple_bind
1424 gimple_seq_first_stmt_as_a_bind (gimple_seq s
)
1426 gimple_seq_node n
= gimple_seq_first (s
);
1427 return as_a
<gimple_bind
> (n
);
1431 /* Return the last node in GIMPLE sequence S. */
1433 static inline gimple_seq_node
1434 gimple_seq_last (gimple_seq s
)
1436 return s
? s
->prev
: NULL
;
1440 /* Return the last statement in GIMPLE sequence S. */
1442 static inline gimple
1443 gimple_seq_last_stmt (gimple_seq s
)
1445 gimple_seq_node n
= gimple_seq_last (s
);
1450 /* Set the last node in GIMPLE sequence *PS to LAST. */
1453 gimple_seq_set_last (gimple_seq
*ps
, gimple_seq_node last
)
1459 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1462 gimple_seq_set_first (gimple_seq
*ps
, gimple_seq_node first
)
1468 /* Return true if GIMPLE sequence S is empty. */
1471 gimple_seq_empty_p (gimple_seq s
)
1476 /* Allocate a new sequence and initialize its first element with STMT. */
1478 static inline gimple_seq
1479 gimple_seq_alloc_with_stmt (gimple stmt
)
1481 gimple_seq seq
= NULL
;
1482 gimple_seq_add_stmt (&seq
, stmt
);
1487 /* Returns the sequence of statements in BB. */
1489 static inline gimple_seq
1490 bb_seq (const_basic_block bb
)
1492 return (!(bb
->flags
& BB_RTL
)) ? bb
->il
.gimple
.seq
: NULL
;
1495 static inline gimple_seq
*
1496 bb_seq_addr (basic_block bb
)
1498 return (!(bb
->flags
& BB_RTL
)) ? &bb
->il
.gimple
.seq
: NULL
;
1501 /* Sets the sequence of statements in BB to SEQ. */
1504 set_bb_seq (basic_block bb
, gimple_seq seq
)
1506 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
1507 bb
->il
.gimple
.seq
= seq
;
1511 /* Return the code for GIMPLE statement G. */
1513 static inline enum gimple_code
1514 gimple_code (const_gimple g
)
1520 /* Return the GSS code used by a GIMPLE code. */
1522 static inline enum gimple_statement_structure_enum
1523 gss_for_code (enum gimple_code code
)
1525 gcc_gimple_checking_assert ((unsigned int)code
< LAST_AND_UNUSED_GIMPLE_CODE
);
1526 return gss_for_code_
[code
];
1530 /* Return which GSS code is used by GS. */
1532 static inline enum gimple_statement_structure_enum
1533 gimple_statement_structure (gimple gs
)
1535 return gss_for_code (gimple_code (gs
));
1539 /* Return true if statement G has sub-statements. This is only true for
1540 High GIMPLE statements. */
1543 gimple_has_substatements (gimple g
)
1545 switch (gimple_code (g
))
1549 case GIMPLE_EH_FILTER
:
1550 case GIMPLE_EH_ELSE
:
1552 case GIMPLE_OMP_FOR
:
1553 case GIMPLE_OMP_MASTER
:
1554 case GIMPLE_OMP_TASKGROUP
:
1555 case GIMPLE_OMP_ORDERED
:
1556 case GIMPLE_OMP_SECTION
:
1557 case GIMPLE_OMP_PARALLEL
:
1558 case GIMPLE_OMP_TASK
:
1559 case GIMPLE_OMP_SECTIONS
:
1560 case GIMPLE_OMP_SINGLE
:
1561 case GIMPLE_OMP_TARGET
:
1562 case GIMPLE_OMP_TEAMS
:
1563 case GIMPLE_OMP_CRITICAL
:
1564 case GIMPLE_WITH_CLEANUP_EXPR
:
1565 case GIMPLE_TRANSACTION
:
1574 /* Return the basic block holding statement G. */
1576 static inline basic_block
1577 gimple_bb (const_gimple g
)
1583 /* Return the lexical scope block holding statement G. */
1586 gimple_block (const_gimple g
)
1588 return LOCATION_BLOCK (g
->location
);
1592 /* Set BLOCK to be the lexical scope block holding statement G. */
1595 gimple_set_block (gimple g
, tree block
)
1599 COMBINE_LOCATION_DATA (line_table
, g
->location
, block
);
1601 g
->location
= LOCATION_LOCUS (g
->location
);
1605 /* Return location information for statement G. */
1607 static inline location_t
1608 gimple_location (const_gimple g
)
1613 /* Return location information for statement G if g is not NULL.
1614 Otherwise, UNKNOWN_LOCATION is returned. */
1616 static inline location_t
1617 gimple_location_safe (const_gimple g
)
1619 return g
? gimple_location (g
) : UNKNOWN_LOCATION
;
1622 /* Return pointer to location information for statement G. */
1624 static inline const location_t
*
1625 gimple_location_ptr (const_gimple g
)
1627 return &g
->location
;
1631 /* Set location information for statement G. */
1634 gimple_set_location (gimple g
, location_t location
)
1636 g
->location
= location
;
1640 /* Return true if G contains location information. */
1643 gimple_has_location (const_gimple g
)
1645 return LOCATION_LOCUS (gimple_location (g
)) != UNKNOWN_LOCATION
;
1649 /* Return the file name of the location of STMT. */
1651 static inline const char *
1652 gimple_filename (const_gimple stmt
)
1654 return LOCATION_FILE (gimple_location (stmt
));
1658 /* Return the line number of the location of STMT. */
1661 gimple_lineno (const_gimple stmt
)
1663 return LOCATION_LINE (gimple_location (stmt
));
1667 /* Determine whether SEQ is a singleton. */
1670 gimple_seq_singleton_p (gimple_seq seq
)
1672 return ((gimple_seq_first (seq
) != NULL
)
1673 && (gimple_seq_first (seq
) == gimple_seq_last (seq
)));
1676 /* Return true if no warnings should be emitted for statement STMT. */
1679 gimple_no_warning_p (const_gimple stmt
)
1681 return stmt
->no_warning
;
1684 /* Set the no_warning flag of STMT to NO_WARNING. */
1687 gimple_set_no_warning (gimple stmt
, bool no_warning
)
1689 stmt
->no_warning
= (unsigned) no_warning
;
1692 /* Set the visited status on statement STMT to VISITED_P. */
1695 gimple_set_visited (gimple stmt
, bool visited_p
)
1697 stmt
->visited
= (unsigned) visited_p
;
1701 /* Return the visited status for statement STMT. */
1704 gimple_visited_p (gimple stmt
)
1706 return stmt
->visited
;
1710 /* Set pass local flag PLF on statement STMT to VAL_P. */
1713 gimple_set_plf (gimple stmt
, enum plf_mask plf
, bool val_p
)
1716 stmt
->plf
|= (unsigned int) plf
;
1718 stmt
->plf
&= ~((unsigned int) plf
);
1722 /* Return the value of pass local flag PLF on statement STMT. */
1724 static inline unsigned int
1725 gimple_plf (gimple stmt
, enum plf_mask plf
)
1727 return stmt
->plf
& ((unsigned int) plf
);
1731 /* Set the UID of statement. */
1734 gimple_set_uid (gimple g
, unsigned uid
)
1740 /* Return the UID of statement. */
1742 static inline unsigned
1743 gimple_uid (const_gimple g
)
1749 /* Make statement G a singleton sequence. */
1752 gimple_init_singleton (gimple g
)
1759 /* Return true if GIMPLE statement G has register or memory operands. */
1762 gimple_has_ops (const_gimple g
)
1764 return gimple_code (g
) >= GIMPLE_COND
&& gimple_code (g
) <= GIMPLE_RETURN
;
1770 is_a_helper
<const gimple_statement_with_ops
*>::test (const_gimple gs
)
1772 return gimple_has_ops (gs
);
1778 is_a_helper
<gimple_statement_with_ops
*>::test (gimple gs
)
1780 return gimple_has_ops (gs
);
1783 /* Return true if GIMPLE statement G has memory operands. */
1786 gimple_has_mem_ops (const_gimple g
)
1788 return gimple_code (g
) >= GIMPLE_ASSIGN
&& gimple_code (g
) <= GIMPLE_RETURN
;
1794 is_a_helper
<const gimple_statement_with_memory_ops
*>::test (const_gimple gs
)
1796 return gimple_has_mem_ops (gs
);
1802 is_a_helper
<gimple_statement_with_memory_ops
*>::test (gimple gs
)
1804 return gimple_has_mem_ops (gs
);
1807 /* Return the set of USE operands for statement G. */
1809 static inline struct use_optype_d
*
1810 gimple_use_ops (const_gimple g
)
1812 const gimple_statement_with_ops
*ops_stmt
=
1813 dyn_cast
<const gimple_statement_with_ops
*> (g
);
1816 return ops_stmt
->use_ops
;
1820 /* Set USE to be the set of USE operands for statement G. */
1823 gimple_set_use_ops (gimple g
, struct use_optype_d
*use
)
1825 gimple_statement_with_ops
*ops_stmt
=
1826 as_a
<gimple_statement_with_ops
*> (g
);
1827 ops_stmt
->use_ops
= use
;
1831 /* Return the single VUSE operand of the statement G. */
1834 gimple_vuse (const_gimple g
)
1836 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1837 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1840 return mem_ops_stmt
->vuse
;
1843 /* Return the single VDEF operand of the statement G. */
1846 gimple_vdef (const_gimple g
)
1848 const gimple_statement_with_memory_ops
*mem_ops_stmt
=
1849 dyn_cast
<const gimple_statement_with_memory_ops
*> (g
);
1852 return mem_ops_stmt
->vdef
;
1855 /* Return the single VUSE operand of the statement G. */
1857 static inline tree
*
1858 gimple_vuse_ptr (gimple g
)
1860 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1861 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1864 return &mem_ops_stmt
->vuse
;
1867 /* Return the single VDEF operand of the statement G. */
1869 static inline tree
*
1870 gimple_vdef_ptr (gimple g
)
1872 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1873 dyn_cast
<gimple_statement_with_memory_ops
*> (g
);
1876 return &mem_ops_stmt
->vdef
;
1879 /* Set the single VUSE operand of the statement G. */
1882 gimple_set_vuse (gimple g
, tree vuse
)
1884 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1885 as_a
<gimple_statement_with_memory_ops
*> (g
);
1886 mem_ops_stmt
->vuse
= vuse
;
1889 /* Set the single VDEF operand of the statement G. */
1892 gimple_set_vdef (gimple g
, tree vdef
)
1894 gimple_statement_with_memory_ops
*mem_ops_stmt
=
1895 as_a
<gimple_statement_with_memory_ops
*> (g
);
1896 mem_ops_stmt
->vdef
= vdef
;
1900 /* Return true if statement G has operands and the modified field has
1904 gimple_modified_p (const_gimple g
)
1906 return (gimple_has_ops (g
)) ? (bool) g
->modified
: false;
1910 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1911 a MODIFIED field. */
1914 gimple_set_modified (gimple s
, bool modifiedp
)
1916 if (gimple_has_ops (s
))
1917 s
->modified
= (unsigned) modifiedp
;
1921 /* Return the tree code for the expression computed by STMT. This is
1922 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1923 GIMPLE_CALL, return CALL_EXPR as the expression code for
1924 consistency. This is useful when the caller needs to deal with the
1925 three kinds of computation that GIMPLE supports. */
1927 static inline enum tree_code
1928 gimple_expr_code (const_gimple stmt
)
1930 enum gimple_code code
= gimple_code (stmt
);
1931 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_COND
)
1932 return (enum tree_code
) stmt
->subcode
;
1935 gcc_gimple_checking_assert (code
== GIMPLE_CALL
);
1941 /* Return true if statement STMT contains volatile operands. */
1944 gimple_has_volatile_ops (const_gimple stmt
)
1946 if (gimple_has_mem_ops (stmt
))
1947 return stmt
->has_volatile_ops
;
1953 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1956 gimple_set_has_volatile_ops (gimple stmt
, bool volatilep
)
1958 if (gimple_has_mem_ops (stmt
))
1959 stmt
->has_volatile_ops
= (unsigned) volatilep
;
1962 /* Return true if STMT is in a transaction. */
1965 gimple_in_transaction (gimple stmt
)
1967 return bb_in_transaction (gimple_bb (stmt
));
1970 /* Return true if statement STMT may access memory. */
1973 gimple_references_memory_p (gimple stmt
)
1975 return gimple_has_mem_ops (stmt
) && gimple_vuse (stmt
);
1979 /* Return the subcode for OMP statement S. */
1981 static inline unsigned
1982 gimple_omp_subcode (const_gimple s
)
1984 gcc_gimple_checking_assert (gimple_code (s
) >= GIMPLE_OMP_ATOMIC_LOAD
1985 && gimple_code (s
) <= GIMPLE_OMP_TEAMS
);
1989 /* Set the subcode for OMP statement S to SUBCODE. */
1992 gimple_omp_set_subcode (gimple s
, unsigned int subcode
)
1994 /* We only have 16 bits for the subcode. Assert that we are not
1996 gcc_gimple_checking_assert (subcode
< (1 << 16));
1997 s
->subcode
= subcode
;
2000 /* Set the nowait flag on OMP_RETURN statement S. */
2003 gimple_omp_return_set_nowait (gimple s
)
2005 GIMPLE_CHECK (s
, GIMPLE_OMP_RETURN
);
2006 s
->subcode
|= GF_OMP_RETURN_NOWAIT
;
2010 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2014 gimple_omp_return_nowait_p (const_gimple g
)
2016 GIMPLE_CHECK (g
, GIMPLE_OMP_RETURN
);
2017 return (gimple_omp_subcode (g
) & GF_OMP_RETURN_NOWAIT
) != 0;
2021 /* Set the LHS of OMP return. */
2024 gimple_omp_return_set_lhs (gimple g
, tree lhs
)
2026 gimple_statement_omp_return
*omp_return_stmt
=
2027 as_a
<gimple_statement_omp_return
*> (g
);
2028 omp_return_stmt
->val
= lhs
;
2032 /* Get the LHS of OMP return. */
2035 gimple_omp_return_lhs (const_gimple g
)
2037 const gimple_statement_omp_return
*omp_return_stmt
=
2038 as_a
<const gimple_statement_omp_return
*> (g
);
2039 return omp_return_stmt
->val
;
2043 /* Return a pointer to the LHS of OMP return. */
2045 static inline tree
*
2046 gimple_omp_return_lhs_ptr (gimple g
)
2048 gimple_statement_omp_return
*omp_return_stmt
=
2049 as_a
<gimple_statement_omp_return
*> (g
);
2050 return &omp_return_stmt
->val
;
2054 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2058 gimple_omp_section_last_p (const_gimple g
)
2060 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2061 return (gimple_omp_subcode (g
) & GF_OMP_SECTION_LAST
) != 0;
2065 /* Set the GF_OMP_SECTION_LAST flag on G. */
2068 gimple_omp_section_set_last (gimple g
)
2070 GIMPLE_CHECK (g
, GIMPLE_OMP_SECTION
);
2071 g
->subcode
|= GF_OMP_SECTION_LAST
;
2075 /* Return true if OMP parallel statement G has the
2076 GF_OMP_PARALLEL_COMBINED flag set. */
2079 gimple_omp_parallel_combined_p (const_gimple g
)
2081 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2082 return (gimple_omp_subcode (g
) & GF_OMP_PARALLEL_COMBINED
) != 0;
2086 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2087 value of COMBINED_P. */
2090 gimple_omp_parallel_set_combined_p (gimple g
, bool combined_p
)
2092 GIMPLE_CHECK (g
, GIMPLE_OMP_PARALLEL
);
2094 g
->subcode
|= GF_OMP_PARALLEL_COMBINED
;
2096 g
->subcode
&= ~GF_OMP_PARALLEL_COMBINED
;
2100 /* Return true if OMP atomic load/store statement G has the
2101 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2104 gimple_omp_atomic_need_value_p (const_gimple g
)
2106 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2107 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2108 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_NEED_VALUE
) != 0;
2112 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2115 gimple_omp_atomic_set_need_value (gimple g
)
2117 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2118 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2119 g
->subcode
|= GF_OMP_ATOMIC_NEED_VALUE
;
2123 /* Return true if OMP atomic load/store statement G has the
2124 GF_OMP_ATOMIC_SEQ_CST flag set. */
2127 gimple_omp_atomic_seq_cst_p (const_gimple g
)
2129 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2130 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2131 return (gimple_omp_subcode (g
) & GF_OMP_ATOMIC_SEQ_CST
) != 0;
2135 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2138 gimple_omp_atomic_set_seq_cst (gimple g
)
2140 if (gimple_code (g
) != GIMPLE_OMP_ATOMIC_LOAD
)
2141 GIMPLE_CHECK (g
, GIMPLE_OMP_ATOMIC_STORE
);
2142 g
->subcode
|= GF_OMP_ATOMIC_SEQ_CST
;
2146 /* Return the number of operands for statement GS. */
2148 static inline unsigned
2149 gimple_num_ops (const_gimple gs
)
2155 /* Set the number of operands for statement GS. */
2158 gimple_set_num_ops (gimple gs
, unsigned num_ops
)
2160 gs
->num_ops
= num_ops
;
2164 /* Return the array of operands for statement GS. */
2166 static inline tree
*
2167 gimple_ops (gimple gs
)
2171 /* All the tuples have their operand vector at the very bottom
2172 of the structure. Note that those structures that do not
2173 have an operand vector have a zero offset. */
2174 off
= gimple_ops_offset_
[gimple_statement_structure (gs
)];
2175 gcc_gimple_checking_assert (off
!= 0);
2177 return (tree
*) ((char *) gs
+ off
);
2181 /* Return operand I for statement GS. */
2184 gimple_op (const_gimple gs
, unsigned i
)
2186 if (gimple_has_ops (gs
))
2188 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2189 return gimple_ops (CONST_CAST_GIMPLE (gs
))[i
];
2195 /* Return a pointer to operand I for statement GS. */
2197 static inline tree
*
2198 gimple_op_ptr (const_gimple gs
, unsigned i
)
2200 if (gimple_has_ops (gs
))
2202 gcc_gimple_checking_assert (i
< gimple_num_ops (gs
));
2203 return gimple_ops (CONST_CAST_GIMPLE (gs
)) + i
;
2209 /* Set operand I of statement GS to OP. */
2212 gimple_set_op (gimple gs
, unsigned i
, tree op
)
2214 gcc_gimple_checking_assert (gimple_has_ops (gs
) && i
< gimple_num_ops (gs
));
2216 /* Note. It may be tempting to assert that OP matches
2217 is_gimple_operand, but that would be wrong. Different tuples
2218 accept slightly different sets of tree operands. Each caller
2219 should perform its own validation. */
2220 gimple_ops (gs
)[i
] = op
;
2223 /* Return true if GS is a GIMPLE_ASSIGN. */
2226 is_gimple_assign (const_gimple gs
)
2228 return gimple_code (gs
) == GIMPLE_ASSIGN
;
2231 /* Determine if expression CODE is one of the valid expressions that can
2232 be used on the RHS of GIMPLE assignments. */
2234 static inline enum gimple_rhs_class
2235 get_gimple_rhs_class (enum tree_code code
)
2237 return (enum gimple_rhs_class
) gimple_rhs_class_table
[(int) code
];
2240 /* Return the LHS of assignment statement GS. */
2243 gimple_assign_lhs (const_gimple gs
)
2245 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2246 return gimple_op (gs
, 0);
2250 /* Return a pointer to the LHS of assignment statement GS. */
2252 static inline tree
*
2253 gimple_assign_lhs_ptr (const_gimple gs
)
2255 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2256 return gimple_op_ptr (gs
, 0);
2260 /* Set LHS to be the LHS operand of assignment statement GS. */
2263 gimple_assign_set_lhs (gimple gs
, tree lhs
)
2265 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2266 gimple_set_op (gs
, 0, lhs
);
2268 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2269 SSA_NAME_DEF_STMT (lhs
) = gs
;
2273 /* Return the first operand on the RHS of assignment statement GS. */
2276 gimple_assign_rhs1 (const_gimple gs
)
2278 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2279 return gimple_op (gs
, 1);
2283 /* Return a pointer to the first operand on the RHS of assignment
2286 static inline tree
*
2287 gimple_assign_rhs1_ptr (const_gimple gs
)
2289 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2290 return gimple_op_ptr (gs
, 1);
2293 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2296 gimple_assign_set_rhs1 (gimple gs
, tree rhs
)
2298 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2300 gimple_set_op (gs
, 1, rhs
);
2304 /* Return the second operand on the RHS of assignment statement GS.
2305 If GS does not have two operands, NULL is returned instead. */
2308 gimple_assign_rhs2 (const_gimple gs
)
2310 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2312 if (gimple_num_ops (gs
) >= 3)
2313 return gimple_op (gs
, 2);
2319 /* Return a pointer to the second operand on the RHS of assignment
2322 static inline tree
*
2323 gimple_assign_rhs2_ptr (const_gimple gs
)
2325 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2326 return gimple_op_ptr (gs
, 2);
2330 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2333 gimple_assign_set_rhs2 (gimple gs
, tree rhs
)
2335 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2337 gimple_set_op (gs
, 2, rhs
);
2340 /* Return the third operand on the RHS of assignment statement GS.
2341 If GS does not have two operands, NULL is returned instead. */
2344 gimple_assign_rhs3 (const_gimple gs
)
2346 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2348 if (gimple_num_ops (gs
) >= 4)
2349 return gimple_op (gs
, 3);
2354 /* Return a pointer to the third operand on the RHS of assignment
2357 static inline tree
*
2358 gimple_assign_rhs3_ptr (const_gimple gs
)
2360 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2361 return gimple_op_ptr (gs
, 3);
2365 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2368 gimple_assign_set_rhs3 (gimple gs
, tree rhs
)
2370 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2372 gimple_set_op (gs
, 3, rhs
);
2375 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2376 to see only a maximum of two operands. */
2379 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator
*gsi
, enum tree_code code
,
2382 gimple_assign_set_rhs_with_ops_1 (gsi
, code
, op1
, op2
, NULL
);
2385 /* Returns true if GS is a nontemporal move. */
2388 gimple_assign_nontemporal_move_p (const_gimple gs
)
2390 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2391 return gs
->nontemporal_move
;
2394 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2397 gimple_assign_set_nontemporal_move (gimple gs
, bool nontemporal
)
2399 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2400 gs
->nontemporal_move
= nontemporal
;
2404 /* Return the code of the expression computed on the rhs of assignment
2405 statement GS. In case that the RHS is a single object, returns the
2406 tree code of the object. */
2408 static inline enum tree_code
2409 gimple_assign_rhs_code (const_gimple gs
)
2411 enum tree_code code
;
2412 GIMPLE_CHECK (gs
, GIMPLE_ASSIGN
);
2414 code
= (enum tree_code
) gs
->subcode
;
2415 /* While we initially set subcode to the TREE_CODE of the rhs for
2416 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2417 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2418 if (get_gimple_rhs_class (code
) == GIMPLE_SINGLE_RHS
)
2419 code
= TREE_CODE (gimple_assign_rhs1 (gs
));
2425 /* Set CODE to be the code for the expression computed on the RHS of
2429 gimple_assign_set_rhs_code (gimple s
, enum tree_code code
)
2431 GIMPLE_CHECK (s
, GIMPLE_ASSIGN
);
2436 /* Return the gimple rhs class of the code of the expression computed on
2437 the rhs of assignment statement GS.
2438 This will never return GIMPLE_INVALID_RHS. */
2440 static inline enum gimple_rhs_class
2441 gimple_assign_rhs_class (const_gimple gs
)
2443 return get_gimple_rhs_class (gimple_assign_rhs_code (gs
));
2446 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2447 there is no operator associated with the assignment itself.
2448 Unlike gimple_assign_copy_p, this predicate returns true for
2449 any RHS operand, including those that perform an operation
2450 and do not have the semantics of a copy, such as COND_EXPR. */
2453 gimple_assign_single_p (const_gimple gs
)
2455 return (is_gimple_assign (gs
)
2456 && gimple_assign_rhs_class (gs
) == GIMPLE_SINGLE_RHS
);
2459 /* Return true if GS performs a store to its lhs. */
2462 gimple_store_p (const_gimple gs
)
2464 tree lhs
= gimple_get_lhs (gs
);
2465 return lhs
&& !is_gimple_reg (lhs
);
2468 /* Return true if GS is an assignment that loads from its rhs1. */
2471 gimple_assign_load_p (const_gimple gs
)
2474 if (!gimple_assign_single_p (gs
))
2476 rhs
= gimple_assign_rhs1 (gs
);
2477 if (TREE_CODE (rhs
) == WITH_SIZE_EXPR
)
2479 rhs
= get_base_address (rhs
);
2480 return (DECL_P (rhs
)
2481 || TREE_CODE (rhs
) == MEM_REF
|| TREE_CODE (rhs
) == TARGET_MEM_REF
);
2485 /* Return true if S is a type-cast assignment. */
2488 gimple_assign_cast_p (const_gimple s
)
2490 if (is_gimple_assign (s
))
2492 enum tree_code sc
= gimple_assign_rhs_code (s
);
2493 return CONVERT_EXPR_CODE_P (sc
)
2494 || sc
== VIEW_CONVERT_EXPR
2495 || sc
== FIX_TRUNC_EXPR
;
2501 /* Return true if S is a clobber statement. */
2504 gimple_clobber_p (const_gimple s
)
2506 return gimple_assign_single_p (s
)
2507 && TREE_CLOBBER_P (gimple_assign_rhs1 (s
));
2510 /* Return true if GS is a GIMPLE_CALL. */
2513 is_gimple_call (const_gimple gs
)
2515 return gimple_code (gs
) == GIMPLE_CALL
;
2518 /* Return the LHS of call statement GS. */
2521 gimple_call_lhs (const_gimple gs
)
2523 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2524 return gimple_op (gs
, 0);
2528 /* Return a pointer to the LHS of call statement GS. */
2530 static inline tree
*
2531 gimple_call_lhs_ptr (const_gimple gs
)
2533 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2534 return gimple_op_ptr (gs
, 0);
2538 /* Set LHS to be the LHS operand of call statement GS. */
2541 gimple_call_set_lhs (gimple gs
, tree lhs
)
2543 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2544 gimple_set_op (gs
, 0, lhs
);
2545 if (lhs
&& TREE_CODE (lhs
) == SSA_NAME
)
2546 SSA_NAME_DEF_STMT (lhs
) = gs
;
2550 /* Return true if call GS calls an internal-only function, as enumerated
2554 gimple_call_internal_p (const_gimple gs
)
2556 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2557 return (gs
->subcode
& GF_CALL_INTERNAL
) != 0;
2561 /* Return the target of internal call GS. */
2563 static inline enum internal_fn
2564 gimple_call_internal_fn (const_gimple gs
)
2566 gcc_gimple_checking_assert (gimple_call_internal_p (gs
));
2567 return static_cast <const gimple_statement_call
*> (gs
)->u
.internal_fn
;
2570 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2571 that could alter control flow. */
2574 gimple_call_set_ctrl_altering (gimple s
, bool ctrl_altering_p
)
2576 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2577 if (ctrl_altering_p
)
2578 s
->subcode
|= GF_CALL_CTRL_ALTERING
;
2580 s
->subcode
&= ~GF_CALL_CTRL_ALTERING
;
2583 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2584 flag is set. Such call could not be a stmt in the middle of a bb. */
2587 gimple_call_ctrl_altering_p (const_gimple gs
)
2589 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2590 return (gs
->subcode
& GF_CALL_CTRL_ALTERING
) != 0;
2594 /* Return the function type of the function called by GS. */
2597 gimple_call_fntype (const_gimple gs
)
2599 const gimple_statement_call
*call_stmt
=
2600 as_a
<const gimple_statement_call
*> (gs
);
2601 if (gimple_call_internal_p (gs
))
2603 return call_stmt
->u
.fntype
;
2606 /* Set the type of the function called by GS to FNTYPE. */
2609 gimple_call_set_fntype (gimple gs
, tree fntype
)
2611 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (gs
);
2612 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2613 call_stmt
->u
.fntype
= fntype
;
2617 /* Return the tree node representing the function called by call
2621 gimple_call_fn (const_gimple gs
)
2623 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2624 return gimple_op (gs
, 1);
2627 /* Return a pointer to the tree node representing the function called by call
2630 static inline tree
*
2631 gimple_call_fn_ptr (const_gimple gs
)
2633 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2634 return gimple_op_ptr (gs
, 1);
2638 /* Set FN to be the function called by call statement GS. */
2641 gimple_call_set_fn (gimple gs
, tree fn
)
2643 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2644 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2645 gimple_set_op (gs
, 1, fn
);
2649 /* Set FNDECL to be the function called by call statement GS. */
2652 gimple_call_set_fndecl (gimple gs
, tree decl
)
2654 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2655 gcc_gimple_checking_assert (!gimple_call_internal_p (gs
));
2656 gimple_set_op (gs
, 1, build_fold_addr_expr_loc (gimple_location (gs
), decl
));
2660 /* Set internal function FN to be the function called by call statement CALL_STMT. */
2663 gimple_call_set_internal_fn (gimple_call call_stmt
, enum internal_fn fn
)
2665 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt
));
2666 call_stmt
->u
.internal_fn
= fn
;
2670 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2671 Otherwise return NULL. This function is analogous to
2672 get_callee_fndecl in tree land. */
2675 gimple_call_fndecl (const_gimple gs
)
2677 return gimple_call_addr_fndecl (gimple_call_fn (gs
));
2681 /* Return the type returned by call statement GS. */
2684 gimple_call_return_type (const_gimple_call gs
)
2686 tree type
= gimple_call_fntype (gs
);
2688 if (type
== NULL_TREE
)
2689 return TREE_TYPE (gimple_call_lhs (gs
));
2691 /* The type returned by a function is the type of its
2693 return TREE_TYPE (type
);
2697 /* Return the static chain for call statement GS. */
2700 gimple_call_chain (const_gimple gs
)
2702 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2703 return gimple_op (gs
, 2);
2707 /* Return a pointer to the static chain for call statement CALL_STMT. */
2709 static inline tree
*
2710 gimple_call_chain_ptr (const_gimple_call call_stmt
)
2712 return gimple_op_ptr (call_stmt
, 2);
2715 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
2718 gimple_call_set_chain (gimple_call call_stmt
, tree chain
)
2720 gimple_set_op (call_stmt
, 2, chain
);
2724 /* Return the number of arguments used by call statement GS. */
2726 static inline unsigned
2727 gimple_call_num_args (const_gimple gs
)
2730 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2731 num_ops
= gimple_num_ops (gs
);
2736 /* Return the argument at position INDEX for call statement GS. */
2739 gimple_call_arg (const_gimple gs
, unsigned index
)
2741 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2742 return gimple_op (gs
, index
+ 3);
2746 /* Return a pointer to the argument at position INDEX for call
2749 static inline tree
*
2750 gimple_call_arg_ptr (const_gimple gs
, unsigned index
)
2752 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2753 return gimple_op_ptr (gs
, index
+ 3);
2757 /* Set ARG to be the argument at position INDEX for call statement GS. */
2760 gimple_call_set_arg (gimple gs
, unsigned index
, tree arg
)
2762 GIMPLE_CHECK (gs
, GIMPLE_CALL
);
2763 gimple_set_op (gs
, index
+ 3, arg
);
2767 /* If TAIL_P is true, mark call statement S as being a tail call
2768 (i.e., a call just before the exit of a function). These calls are
2769 candidate for tail call optimization. */
2772 gimple_call_set_tail (gimple s
, bool tail_p
)
2774 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2776 s
->subcode
|= GF_CALL_TAILCALL
;
2778 s
->subcode
&= ~GF_CALL_TAILCALL
;
2782 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2785 gimple_call_tail_p (gimple s
)
2787 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2788 return (s
->subcode
& GF_CALL_TAILCALL
) != 0;
2792 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2793 slot optimization. This transformation uses the target of the call
2794 expansion as the return slot for calls that return in memory. */
2797 gimple_call_set_return_slot_opt (gimple_call s
, bool return_slot_opt_p
)
2799 if (return_slot_opt_p
)
2800 s
->subcode
|= GF_CALL_RETURN_SLOT_OPT
;
2802 s
->subcode
&= ~GF_CALL_RETURN_SLOT_OPT
;
2806 /* Return true if S is marked for return slot optimization. */
2809 gimple_call_return_slot_opt_p (gimple s
)
2811 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2812 return (s
->subcode
& GF_CALL_RETURN_SLOT_OPT
) != 0;
2816 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2817 thunk to the thunked-to function. */
2820 gimple_call_set_from_thunk (gimple_call s
, bool from_thunk_p
)
2823 s
->subcode
|= GF_CALL_FROM_THUNK
;
2825 s
->subcode
&= ~GF_CALL_FROM_THUNK
;
2829 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2832 gimple_call_from_thunk_p (gimple_call s
)
2834 return (s
->subcode
& GF_CALL_FROM_THUNK
) != 0;
2838 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2839 argument pack in its argument list. */
2842 gimple_call_set_va_arg_pack (gimple_call s
, bool pass_arg_pack_p
)
2844 if (pass_arg_pack_p
)
2845 s
->subcode
|= GF_CALL_VA_ARG_PACK
;
2847 s
->subcode
&= ~GF_CALL_VA_ARG_PACK
;
2851 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2852 argument pack in its argument list. */
2855 gimple_call_va_arg_pack_p (gimple_call s
)
2857 return (s
->subcode
& GF_CALL_VA_ARG_PACK
) != 0;
2861 /* Return true if S is a noreturn call. */
2864 gimple_call_noreturn_p (gimple s
)
2866 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2867 return (gimple_call_flags (s
) & ECF_NORETURN
) != 0;
2871 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2872 even if the called function can throw in other cases. */
2875 gimple_call_set_nothrow (gimple s
, bool nothrow_p
)
2877 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2879 s
->subcode
|= GF_CALL_NOTHROW
;
2881 s
->subcode
&= ~GF_CALL_NOTHROW
;
2884 /* Return true if S is a nothrow call. */
2887 gimple_call_nothrow_p (gimple s
)
2889 GIMPLE_CHECK (s
, GIMPLE_CALL
);
2890 return (gimple_call_flags (s
) & ECF_NOTHROW
) != 0;
2893 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2894 is known to be emitted for VLA objects. Those are wrapped by
2895 stack_save/stack_restore calls and hence can't lead to unbounded
2896 stack growth even when they occur in loops. */
2899 gimple_call_set_alloca_for_var (gimple_call s
, bool for_var
)
2902 s
->subcode
|= GF_CALL_ALLOCA_FOR_VAR
;
2904 s
->subcode
&= ~GF_CALL_ALLOCA_FOR_VAR
;
2907 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2910 gimple_call_alloca_for_var_p (gimple_call s
)
2912 return (s
->subcode
& GF_CALL_ALLOCA_FOR_VAR
) != 0;
2915 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2918 gimple_call_copy_flags (gimple dest_call
, gimple orig_call
)
2920 GIMPLE_CHECK (dest_call
, GIMPLE_CALL
);
2921 GIMPLE_CHECK (orig_call
, GIMPLE_CALL
);
2922 dest_call
->subcode
= orig_call
->subcode
;
2926 /* Return a pointer to the points-to solution for the set of call-used
2927 variables of the call CALL. */
2929 static inline struct pt_solution
*
2930 gimple_call_use_set (gimple call
)
2932 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (call
);
2933 return &call_stmt
->call_used
;
2937 /* Return a pointer to the points-to solution for the set of call-used
2938 variables of the call CALL. */
2940 static inline struct pt_solution
*
2941 gimple_call_clobber_set (gimple call
)
2943 gimple_statement_call
*call_stmt
= as_a
<gimple_statement_call
*> (call
);
2944 return &call_stmt
->call_clobbered
;
2948 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2952 gimple_has_lhs (gimple stmt
)
2954 return (is_gimple_assign (stmt
)
2955 || (is_gimple_call (stmt
)
2956 && gimple_call_lhs (stmt
) != NULL_TREE
));
2960 /* Return the code of the predicate computed by conditional statement GS. */
2962 static inline enum tree_code
2963 gimple_cond_code (const_gimple gs
)
2965 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2966 return (enum tree_code
) gs
->subcode
;
2970 /* Set CODE to be the predicate code for the conditional statement GS. */
2973 gimple_cond_set_code (gimple gs
, enum tree_code code
)
2975 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2980 /* Return the LHS of the predicate computed by conditional statement GS. */
2983 gimple_cond_lhs (const_gimple gs
)
2985 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2986 return gimple_op (gs
, 0);
2989 /* Return the pointer to the LHS of the predicate computed by conditional
2992 static inline tree
*
2993 gimple_cond_lhs_ptr (const_gimple gs
)
2995 GIMPLE_CHECK (gs
, GIMPLE_COND
);
2996 return gimple_op_ptr (gs
, 0);
2999 /* Set LHS to be the LHS operand of the predicate computed by
3000 conditional statement GS. */
3003 gimple_cond_set_lhs (gimple gs
, tree lhs
)
3005 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3006 gimple_set_op (gs
, 0, lhs
);
3010 /* Return the RHS operand of the predicate computed by conditional GS. */
3013 gimple_cond_rhs (const_gimple gs
)
3015 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3016 return gimple_op (gs
, 1);
3019 /* Return the pointer to the RHS operand of the predicate computed by
3022 static inline tree
*
3023 gimple_cond_rhs_ptr (const_gimple gs
)
3025 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3026 return gimple_op_ptr (gs
, 1);
3030 /* Set RHS to be the RHS operand of the predicate computed by
3031 conditional statement GS. */
3034 gimple_cond_set_rhs (gimple gs
, tree rhs
)
3036 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3037 gimple_set_op (gs
, 1, rhs
);
3041 /* Return the label used by conditional statement GS when its
3042 predicate evaluates to true. */
3045 gimple_cond_true_label (const_gimple gs
)
3047 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3048 return gimple_op (gs
, 2);
3052 /* Set LABEL to be the label used by conditional statement GS when its
3053 predicate evaluates to true. */
3056 gimple_cond_set_true_label (gimple gs
, tree label
)
3058 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3059 gimple_set_op (gs
, 2, label
);
3063 /* Set LABEL to be the label used by conditional statement GS when its
3064 predicate evaluates to false. */
3067 gimple_cond_set_false_label (gimple gs
, tree label
)
3069 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3070 gimple_set_op (gs
, 3, label
);
3074 /* Return the label used by conditional statement GS when its
3075 predicate evaluates to false. */
3078 gimple_cond_false_label (const_gimple gs
)
3080 GIMPLE_CHECK (gs
, GIMPLE_COND
);
3081 return gimple_op (gs
, 3);
3085 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3088 gimple_cond_make_false (gimple gs
)
3090 gimple_cond_set_lhs (gs
, boolean_true_node
);
3091 gimple_cond_set_rhs (gs
, boolean_false_node
);
3092 gs
->subcode
= EQ_EXPR
;
3096 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3099 gimple_cond_make_true (gimple gs
)
3101 gimple_cond_set_lhs (gs
, boolean_true_node
);
3102 gimple_cond_set_rhs (gs
, boolean_true_node
);
3103 gs
->subcode
= EQ_EXPR
;
3106 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3107 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3110 gimple_cond_true_p (const_gimple_cond gs
)
3112 tree lhs
= gimple_cond_lhs (gs
);
3113 tree rhs
= gimple_cond_rhs (gs
);
3114 enum tree_code code
= gimple_cond_code (gs
);
3116 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3119 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3122 if (code
== NE_EXPR
&& lhs
!= rhs
)
3125 if (code
== EQ_EXPR
&& lhs
== rhs
)
3131 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3132 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3135 gimple_cond_false_p (const_gimple_cond gs
)
3137 tree lhs
= gimple_cond_lhs (gs
);
3138 tree rhs
= gimple_cond_rhs (gs
);
3139 enum tree_code code
= gimple_cond_code (gs
);
3141 if (lhs
!= boolean_true_node
&& lhs
!= boolean_false_node
)
3144 if (rhs
!= boolean_true_node
&& rhs
!= boolean_false_node
)
3147 if (code
== NE_EXPR
&& lhs
== rhs
)
3150 if (code
== EQ_EXPR
&& lhs
!= rhs
)
3156 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3159 gimple_cond_set_condition (gimple_cond stmt
, enum tree_code code
, tree lhs
,
3162 gimple_cond_set_code (stmt
, code
);
3163 gimple_cond_set_lhs (stmt
, lhs
);
3164 gimple_cond_set_rhs (stmt
, rhs
);
3167 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3170 gimple_label_label (const_gimple gs
)
3172 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
3173 return gimple_op (gs
, 0);
3177 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3181 gimple_label_set_label (gimple gs
, tree label
)
3183 GIMPLE_CHECK (gs
, GIMPLE_LABEL
);
3184 gimple_set_op (gs
, 0, label
);
3188 /* Return the destination of the unconditional jump GS. */
3191 gimple_goto_dest (const_gimple gs
)
3193 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3194 return gimple_op (gs
, 0);
3198 /* Set DEST to be the destination of the unconditonal jump GS. */
3201 gimple_goto_set_dest (gimple gs
, tree dest
)
3203 GIMPLE_CHECK (gs
, GIMPLE_GOTO
);
3204 gimple_set_op (gs
, 0, dest
);
3208 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3211 gimple_bind_vars (const_gimple_bind bind_stmt
)
3213 return bind_stmt
->vars
;
3217 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3221 gimple_bind_set_vars (gimple_bind bind_stmt
, tree vars
)
3223 bind_stmt
->vars
= vars
;
3227 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3231 gimple_bind_append_vars (gimple_bind bind_stmt
, tree vars
)
3233 bind_stmt
->vars
= chainon (bind_stmt
->vars
, vars
);
3237 static inline gimple_seq
*
3238 gimple_bind_body_ptr (gimple_bind bind_stmt
)
3240 return &bind_stmt
->body
;
3243 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3245 static inline gimple_seq
3246 gimple_bind_body (gimple_bind gs
)
3248 return *gimple_bind_body_ptr (gs
);
3252 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3256 gimple_bind_set_body (gimple_bind bind_stmt
, gimple_seq seq
)
3258 bind_stmt
->body
= seq
;
3262 /* Append a statement to the end of a GIMPLE_BIND's body. */
3265 gimple_bind_add_stmt (gimple_bind bind_stmt
, gimple stmt
)
3267 gimple_seq_add_stmt (&bind_stmt
->body
, stmt
);
3271 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3274 gimple_bind_add_seq (gimple_bind bind_stmt
, gimple_seq seq
)
3276 gimple_seq_add_seq (&bind_stmt
->body
, seq
);
3280 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3281 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3284 gimple_bind_block (const_gimple_bind bind_stmt
)
3286 return bind_stmt
->block
;
3290 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3294 gimple_bind_set_block (gimple_bind bind_stmt
, tree block
)
3296 gcc_gimple_checking_assert (block
== NULL_TREE
3297 || TREE_CODE (block
) == BLOCK
);
3298 bind_stmt
->block
= block
;
3302 /* Return the number of input operands for GIMPLE_ASM GS. */
3304 static inline unsigned
3305 gimple_asm_ninputs (const_gimple gs
)
3307 const gimple_statement_asm
*asm_stmt
=
3308 as_a
<const gimple_statement_asm
*> (gs
);
3309 return asm_stmt
->ni
;
3313 /* Return the number of output operands for GIMPLE_ASM GS. */
3315 static inline unsigned
3316 gimple_asm_noutputs (const_gimple gs
)
3318 const gimple_statement_asm
*asm_stmt
=
3319 as_a
<const gimple_statement_asm
*> (gs
);
3320 return asm_stmt
->no
;
3324 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3326 static inline unsigned
3327 gimple_asm_nclobbers (const_gimple gs
)
3329 const gimple_statement_asm
*asm_stmt
=
3330 as_a
<const gimple_statement_asm
*> (gs
);
3331 return asm_stmt
->nc
;
3334 /* Return the number of label operands for GIMPLE_ASM GS. */
3336 static inline unsigned
3337 gimple_asm_nlabels (const_gimple gs
)
3339 const gimple_statement_asm
*asm_stmt
=
3340 as_a
<const gimple_statement_asm
*> (gs
);
3341 return asm_stmt
->nl
;
3344 /* Return input operand INDEX of GIMPLE_ASM GS. */
3347 gimple_asm_input_op (const_gimple gs
, unsigned index
)
3349 const gimple_statement_asm
*asm_stmt
=
3350 as_a
<const gimple_statement_asm
*> (gs
);
3351 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3352 return gimple_op (gs
, index
+ asm_stmt
->no
);
3355 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3357 static inline tree
*
3358 gimple_asm_input_op_ptr (const_gimple gs
, unsigned index
)
3360 const gimple_statement_asm
*asm_stmt
=
3361 as_a
<const gimple_statement_asm
*> (gs
);
3362 gcc_gimple_checking_assert (index
< asm_stmt
->ni
);
3363 return gimple_op_ptr (gs
, index
+ asm_stmt
->no
);
3367 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3370 gimple_asm_set_input_op (gimple gs
, unsigned index
, tree in_op
)
3372 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3373 gcc_gimple_checking_assert (index
< asm_stmt
->ni
3374 && TREE_CODE (in_op
) == TREE_LIST
);
3375 gimple_set_op (gs
, index
+ asm_stmt
->no
, in_op
);
3379 /* Return output operand INDEX of GIMPLE_ASM GS. */
3382 gimple_asm_output_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
->no
);
3387 return gimple_op (gs
, index
);
3390 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3392 static inline tree
*
3393 gimple_asm_output_op_ptr (const_gimple gs
, unsigned index
)
3395 const gimple_statement_asm
*asm_stmt
=
3396 as_a
<const gimple_statement_asm
*> (gs
);
3397 gcc_gimple_checking_assert (index
< asm_stmt
->no
);
3398 return gimple_op_ptr (gs
, index
);
3402 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3405 gimple_asm_set_output_op (gimple gs
, unsigned index
, tree out_op
)
3407 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3408 gcc_gimple_checking_assert (index
< asm_stmt
->no
3409 && TREE_CODE (out_op
) == TREE_LIST
);
3410 gimple_set_op (gs
, index
, out_op
);
3414 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3417 gimple_asm_clobber_op (const_gimple gs
, unsigned index
)
3419 const gimple_statement_asm
*asm_stmt
=
3420 as_a
<const gimple_statement_asm
*> (gs
);
3421 gcc_gimple_checking_assert (index
< asm_stmt
->nc
);
3422 return gimple_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->no
);
3426 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3429 gimple_asm_set_clobber_op (gimple gs
, unsigned index
, tree clobber_op
)
3431 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3432 gcc_gimple_checking_assert (index
< asm_stmt
->nc
3433 && TREE_CODE (clobber_op
) == TREE_LIST
);
3434 gimple_set_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->no
, clobber_op
);
3437 /* Return label operand INDEX of GIMPLE_ASM GS. */
3440 gimple_asm_label_op (const_gimple gs
, unsigned index
)
3442 const gimple_statement_asm
*asm_stmt
=
3443 as_a
<const gimple_statement_asm
*> (gs
);
3444 gcc_gimple_checking_assert (index
< asm_stmt
->nl
);
3445 return gimple_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
);
3448 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3451 gimple_asm_set_label_op (gimple gs
, unsigned index
, tree label_op
)
3453 gimple_statement_asm
*asm_stmt
= as_a
<gimple_statement_asm
*> (gs
);
3454 gcc_gimple_checking_assert (index
< asm_stmt
->nl
3455 && TREE_CODE (label_op
) == TREE_LIST
);
3456 gimple_set_op (gs
, index
+ asm_stmt
->ni
+ asm_stmt
->nc
, label_op
);
3459 /* Return the string representing the assembly instruction in
3462 static inline const char *
3463 gimple_asm_string (const_gimple gs
)
3465 const gimple_statement_asm
*asm_stmt
=
3466 as_a
<const gimple_statement_asm
*> (gs
);
3467 return asm_stmt
->string
;
3471 /* Return true if GS is an asm statement marked volatile. */
3474 gimple_asm_volatile_p (const_gimple gs
)
3476 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3477 return (gs
->subcode
& GF_ASM_VOLATILE
) != 0;
3481 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3484 gimple_asm_set_volatile (gimple gs
, bool volatile_p
)
3486 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3488 gs
->subcode
|= GF_ASM_VOLATILE
;
3490 gs
->subcode
&= ~GF_ASM_VOLATILE
;
3494 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3497 gimple_asm_set_input (gimple gs
, bool input_p
)
3499 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3501 gs
->subcode
|= GF_ASM_INPUT
;
3503 gs
->subcode
&= ~GF_ASM_INPUT
;
3507 /* Return true if asm GS is an ASM_INPUT. */
3510 gimple_asm_input_p (const_gimple gs
)
3512 GIMPLE_CHECK (gs
, GIMPLE_ASM
);
3513 return (gs
->subcode
& GF_ASM_INPUT
) != 0;
3517 /* Return the types handled by GIMPLE_CATCH statement GS. */
3520 gimple_catch_types (const_gimple gs
)
3522 const gimple_statement_catch
*catch_stmt
=
3523 as_a
<const gimple_statement_catch
*> (gs
);
3524 return catch_stmt
->types
;
3528 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3530 static inline tree
*
3531 gimple_catch_types_ptr (gimple gs
)
3533 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3534 return &catch_stmt
->types
;
3538 /* Return a pointer to the GIMPLE sequence representing the body of
3539 the handler of GIMPLE_CATCH statement GS. */
3541 static inline gimple_seq
*
3542 gimple_catch_handler_ptr (gimple gs
)
3544 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3545 return &catch_stmt
->handler
;
3549 /* Return the GIMPLE sequence representing the body of the handler of
3550 GIMPLE_CATCH statement GS. */
3552 static inline gimple_seq
3553 gimple_catch_handler (gimple gs
)
3555 return *gimple_catch_handler_ptr (gs
);
3559 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3562 gimple_catch_set_types (gimple gs
, tree t
)
3564 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3565 catch_stmt
->types
= t
;
3569 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3572 gimple_catch_set_handler (gimple gs
, gimple_seq handler
)
3574 gimple_statement_catch
*catch_stmt
= as_a
<gimple_statement_catch
*> (gs
);
3575 catch_stmt
->handler
= handler
;
3579 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3582 gimple_eh_filter_types (const_gimple gs
)
3584 const gimple_statement_eh_filter
*eh_filter_stmt
=
3585 as_a
<const gimple_statement_eh_filter
*> (gs
);
3586 return eh_filter_stmt
->types
;
3590 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3593 static inline tree
*
3594 gimple_eh_filter_types_ptr (gimple gs
)
3596 gimple_statement_eh_filter
*eh_filter_stmt
=
3597 as_a
<gimple_statement_eh_filter
*> (gs
);
3598 return &eh_filter_stmt
->types
;
3602 /* Return a pointer to the sequence of statement to execute when
3603 GIMPLE_EH_FILTER statement fails. */
3605 static inline gimple_seq
*
3606 gimple_eh_filter_failure_ptr (gimple gs
)
3608 gimple_statement_eh_filter
*eh_filter_stmt
=
3609 as_a
<gimple_statement_eh_filter
*> (gs
);
3610 return &eh_filter_stmt
->failure
;
3614 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3617 static inline gimple_seq
3618 gimple_eh_filter_failure (gimple gs
)
3620 return *gimple_eh_filter_failure_ptr (gs
);
3624 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3627 gimple_eh_filter_set_types (gimple gs
, tree types
)
3629 gimple_statement_eh_filter
*eh_filter_stmt
=
3630 as_a
<gimple_statement_eh_filter
*> (gs
);
3631 eh_filter_stmt
->types
= types
;
3635 /* Set FAILURE to be the sequence of statements to execute on failure
3636 for GIMPLE_EH_FILTER GS. */
3639 gimple_eh_filter_set_failure (gimple gs
, gimple_seq failure
)
3641 gimple_statement_eh_filter
*eh_filter_stmt
=
3642 as_a
<gimple_statement_eh_filter
*> (gs
);
3643 eh_filter_stmt
->failure
= failure
;
3646 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3649 gimple_eh_must_not_throw_fndecl (gimple gs
)
3651 gimple_statement_eh_mnt
*eh_mnt_stmt
= as_a
<gimple_statement_eh_mnt
*> (gs
);
3652 return eh_mnt_stmt
->fndecl
;
3655 /* Set the function decl to be called by GS to DECL. */
3658 gimple_eh_must_not_throw_set_fndecl (gimple gs
, tree decl
)
3660 gimple_statement_eh_mnt
*eh_mnt_stmt
= as_a
<gimple_statement_eh_mnt
*> (gs
);
3661 eh_mnt_stmt
->fndecl
= decl
;
3664 /* GIMPLE_EH_ELSE accessors. */
3666 static inline gimple_seq
*
3667 gimple_eh_else_n_body_ptr (gimple gs
)
3669 gimple_statement_eh_else
*eh_else_stmt
=
3670 as_a
<gimple_statement_eh_else
*> (gs
);
3671 return &eh_else_stmt
->n_body
;
3674 static inline gimple_seq
3675 gimple_eh_else_n_body (gimple gs
)
3677 return *gimple_eh_else_n_body_ptr (gs
);
3680 static inline gimple_seq
*
3681 gimple_eh_else_e_body_ptr (gimple gs
)
3683 gimple_statement_eh_else
*eh_else_stmt
=
3684 as_a
<gimple_statement_eh_else
*> (gs
);
3685 return &eh_else_stmt
->e_body
;
3688 static inline gimple_seq
3689 gimple_eh_else_e_body (gimple gs
)
3691 return *gimple_eh_else_e_body_ptr (gs
);
3695 gimple_eh_else_set_n_body (gimple gs
, gimple_seq seq
)
3697 gimple_statement_eh_else
*eh_else_stmt
=
3698 as_a
<gimple_statement_eh_else
*> (gs
);
3699 eh_else_stmt
->n_body
= seq
;
3703 gimple_eh_else_set_e_body (gimple gs
, gimple_seq seq
)
3705 gimple_statement_eh_else
*eh_else_stmt
=
3706 as_a
<gimple_statement_eh_else
*> (gs
);
3707 eh_else_stmt
->e_body
= seq
;
3710 /* GIMPLE_TRY accessors. */
3712 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3713 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3715 static inline enum gimple_try_flags
3716 gimple_try_kind (const_gimple gs
)
3718 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3719 return (enum gimple_try_flags
) (gs
->subcode
& GIMPLE_TRY_KIND
);
3723 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3726 gimple_try_set_kind (gimple gs
, enum gimple_try_flags kind
)
3728 GIMPLE_CHECK (gs
, GIMPLE_TRY
);
3729 gcc_gimple_checking_assert (kind
== GIMPLE_TRY_CATCH
3730 || kind
== GIMPLE_TRY_FINALLY
);
3731 if (gimple_try_kind (gs
) != kind
)
3732 gs
->subcode
= (unsigned int) kind
;
3736 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3739 gimple_try_catch_is_cleanup (const_gimple gs
)
3741 gcc_gimple_checking_assert (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
);
3742 return (gs
->subcode
& GIMPLE_TRY_CATCH_IS_CLEANUP
) != 0;
3746 /* Return a pointer to the sequence of statements used as the
3747 body for GIMPLE_TRY GS. */
3749 static inline gimple_seq
*
3750 gimple_try_eval_ptr (gimple gs
)
3752 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3753 return &try_stmt
->eval
;
3757 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3759 static inline gimple_seq
3760 gimple_try_eval (gimple gs
)
3762 return *gimple_try_eval_ptr (gs
);
3766 /* Return a pointer to the sequence of statements used as the cleanup body for
3769 static inline gimple_seq
*
3770 gimple_try_cleanup_ptr (gimple gs
)
3772 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3773 return &try_stmt
->cleanup
;
3777 /* Return the sequence of statements used as the cleanup body for
3780 static inline gimple_seq
3781 gimple_try_cleanup (gimple gs
)
3783 return *gimple_try_cleanup_ptr (gs
);
3787 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3790 gimple_try_set_catch_is_cleanup (gimple g
, bool catch_is_cleanup
)
3792 gcc_gimple_checking_assert (gimple_try_kind (g
) == GIMPLE_TRY_CATCH
);
3793 if (catch_is_cleanup
)
3794 g
->subcode
|= GIMPLE_TRY_CATCH_IS_CLEANUP
;
3796 g
->subcode
&= ~GIMPLE_TRY_CATCH_IS_CLEANUP
;
3800 /* Set EVAL to be the sequence of statements to use as the body for
3804 gimple_try_set_eval (gimple gs
, gimple_seq eval
)
3806 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3807 try_stmt
->eval
= eval
;
3811 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3812 body for GIMPLE_TRY GS. */
3815 gimple_try_set_cleanup (gimple gs
, gimple_seq cleanup
)
3817 gimple_statement_try
*try_stmt
= as_a
<gimple_statement_try
*> (gs
);
3818 try_stmt
->cleanup
= cleanup
;
3822 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3824 static inline gimple_seq
*
3825 gimple_wce_cleanup_ptr (gimple gs
)
3827 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3828 return &wce_stmt
->cleanup
;
3832 /* Return the cleanup sequence for cleanup statement GS. */
3834 static inline gimple_seq
3835 gimple_wce_cleanup (gimple gs
)
3837 return *gimple_wce_cleanup_ptr (gs
);
3841 /* Set CLEANUP to be the cleanup sequence for GS. */
3844 gimple_wce_set_cleanup (gimple gs
, gimple_seq cleanup
)
3846 gimple_statement_wce
*wce_stmt
= as_a
<gimple_statement_wce
*> (gs
);
3847 wce_stmt
->cleanup
= cleanup
;
3851 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3854 gimple_wce_cleanup_eh_only (const_gimple gs
)
3856 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3857 return gs
->subcode
!= 0;
3861 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3864 gimple_wce_set_cleanup_eh_only (gimple gs
, bool eh_only_p
)
3866 GIMPLE_CHECK (gs
, GIMPLE_WITH_CLEANUP_EXPR
);
3867 gs
->subcode
= (unsigned int) eh_only_p
;
3871 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3873 static inline unsigned
3874 gimple_phi_capacity (const_gimple gs
)
3876 const_gimple_phi phi_stmt
=
3877 as_a
<const_gimple_phi
> (gs
);
3878 return phi_stmt
->capacity
;
3882 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3883 be exactly the number of incoming edges for the basic block holding
3886 static inline unsigned
3887 gimple_phi_num_args (const_gimple gs
)
3889 const_gimple_phi phi_stmt
=
3890 as_a
<const_gimple_phi
> (gs
);
3891 return phi_stmt
->nargs
;
3895 /* Return the SSA name created by GIMPLE_PHI GS. */
3898 gimple_phi_result (const_gimple gs
)
3900 const_gimple_phi phi_stmt
=
3901 as_a
<const_gimple_phi
> (gs
);
3902 return phi_stmt
->result
;
3905 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3907 static inline tree
*
3908 gimple_phi_result_ptr (gimple gs
)
3910 gimple_phi phi_stmt
= as_a
<gimple_phi
> (gs
);
3911 return &phi_stmt
->result
;
3914 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3917 gimple_phi_set_result (gimple gs
, tree result
)
3919 gimple_phi phi_stmt
= as_a
<gimple_phi
> (gs
);
3920 phi_stmt
->result
= result
;
3921 if (result
&& TREE_CODE (result
) == SSA_NAME
)
3922 SSA_NAME_DEF_STMT (result
) = gs
;
3926 /* Return the PHI argument corresponding to incoming edge INDEX for
3929 static inline struct phi_arg_d
*
3930 gimple_phi_arg (gimple gs
, unsigned index
)
3932 gimple_phi phi_stmt
= as_a
<gimple_phi
> (gs
);
3933 gcc_gimple_checking_assert (index
<= phi_stmt
->capacity
);
3934 return &(phi_stmt
->args
[index
]);
3937 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3938 for GIMPLE_PHI GS. */
3941 gimple_phi_set_arg (gimple gs
, unsigned index
, struct phi_arg_d
* phiarg
)
3943 gimple_phi phi_stmt
= as_a
<gimple_phi
> (gs
);
3944 gcc_gimple_checking_assert (index
<= phi_stmt
->nargs
);
3945 phi_stmt
->args
[index
] = *phiarg
;
3948 /* Return the PHI nodes for basic block BB, or NULL if there are no
3951 static inline gimple_seq
3952 phi_nodes (const_basic_block bb
)
3954 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3955 return bb
->il
.gimple
.phi_nodes
;
3958 /* Return a pointer to the PHI nodes for basic block BB. */
3960 static inline gimple_seq
*
3961 phi_nodes_ptr (basic_block bb
)
3963 gcc_checking_assert (!(bb
->flags
& BB_RTL
));
3964 return &bb
->il
.gimple
.phi_nodes
;
3967 /* Return the tree operand for argument I of PHI node GS. */
3970 gimple_phi_arg_def (gimple gs
, size_t index
)
3972 return gimple_phi_arg (gs
, index
)->def
;
3976 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3978 static inline tree
*
3979 gimple_phi_arg_def_ptr (gimple gs
, size_t index
)
3981 return &gimple_phi_arg (gs
, index
)->def
;
3984 /* Return the edge associated with argument I of phi node GS. */
3987 gimple_phi_arg_edge (gimple gs
, size_t i
)
3989 return EDGE_PRED (gimple_bb (gs
), i
);
3992 /* Return the source location of gimple argument I of phi node GS. */
3994 static inline source_location
3995 gimple_phi_arg_location (gimple gs
, size_t i
)
3997 return gimple_phi_arg (gs
, i
)->locus
;
4000 /* Return the source location of the argument on edge E of phi node GS. */
4002 static inline source_location
4003 gimple_phi_arg_location_from_edge (gimple gs
, edge e
)
4005 return gimple_phi_arg (gs
, e
->dest_idx
)->locus
;
4008 /* Set the source location of gimple argument I of phi node GS to LOC. */
4011 gimple_phi_arg_set_location (gimple gs
, size_t i
, source_location loc
)
4013 gimple_phi_arg (gs
, i
)->locus
= loc
;
4016 /* Return TRUE if argument I of phi node GS has a location record. */
4019 gimple_phi_arg_has_location (gimple gs
, size_t i
)
4021 return gimple_phi_arg_location (gs
, i
) != UNKNOWN_LOCATION
;
4025 /* Return the region number for GIMPLE_RESX GS. */
4028 gimple_resx_region (const_gimple gs
)
4030 const gimple_statement_resx
*resx_stmt
=
4031 as_a
<const gimple_statement_resx
*> (gs
);
4032 return resx_stmt
->region
;
4035 /* Set REGION to be the region number for GIMPLE_RESX GS. */
4038 gimple_resx_set_region (gimple gs
, int region
)
4040 gimple_statement_resx
*resx_stmt
= as_a
<gimple_statement_resx
*> (gs
);
4041 resx_stmt
->region
= region
;
4044 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
4047 gimple_eh_dispatch_region (const_gimple gs
)
4049 const gimple_statement_eh_dispatch
*eh_dispatch_stmt
=
4050 as_a
<const gimple_statement_eh_dispatch
*> (gs
);
4051 return eh_dispatch_stmt
->region
;
4054 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
4057 gimple_eh_dispatch_set_region (gimple gs
, int region
)
4059 gimple_statement_eh_dispatch
*eh_dispatch_stmt
=
4060 as_a
<gimple_statement_eh_dispatch
*> (gs
);
4061 eh_dispatch_stmt
->region
= region
;
4064 /* Return the number of labels associated with the switch statement GS. */
4066 static inline unsigned
4067 gimple_switch_num_labels (const_gimple_switch gs
)
4070 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4071 num_ops
= gimple_num_ops (gs
);
4072 gcc_gimple_checking_assert (num_ops
> 1);
4077 /* Set NLABELS to be the number of labels for the switch statement GS. */
4080 gimple_switch_set_num_labels (gimple_switch g
, unsigned nlabels
)
4082 GIMPLE_CHECK (g
, GIMPLE_SWITCH
);
4083 gimple_set_num_ops (g
, nlabels
+ 1);
4087 /* Return the index variable used by the switch statement GS. */
4090 gimple_switch_index (const_gimple gs
)
4092 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4093 return gimple_op (gs
, 0);
4097 /* Return a pointer to the index variable for the switch statement GS. */
4099 static inline tree
*
4100 gimple_switch_index_ptr (const_gimple gs
)
4102 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4103 return gimple_op_ptr (gs
, 0);
4107 /* Set INDEX to be the index variable for switch statement GS. */
4110 gimple_switch_set_index (gimple_switch gs
, tree index
)
4112 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4113 gcc_gimple_checking_assert (SSA_VAR_P (index
) || CONSTANT_CLASS_P (index
));
4114 gimple_set_op (gs
, 0, index
);
4118 /* Return the label numbered INDEX. The default label is 0, followed by any
4119 labels in a switch statement. */
4122 gimple_switch_label (const_gimple_switch gs
, unsigned index
)
4124 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4125 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1);
4126 return gimple_op (gs
, index
+ 1);
4129 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4132 gimple_switch_set_label (gimple_switch gs
, unsigned index
, tree label
)
4134 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
4135 gcc_gimple_checking_assert (gimple_num_ops (gs
) > index
+ 1
4136 && (label
== NULL_TREE
4137 || TREE_CODE (label
) == CASE_LABEL_EXPR
));
4138 gimple_set_op (gs
, index
+ 1, label
);
4141 /* Return the default label for a switch statement. */
4144 gimple_switch_default_label (const_gimple_switch gs
)
4146 tree label
= gimple_switch_label (gs
, 0);
4147 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4151 /* Set the default label for a switch statement. */
4154 gimple_switch_set_default_label (gimple_switch gs
, tree label
)
4156 gcc_checking_assert (!CASE_LOW (label
) && !CASE_HIGH (label
));
4157 gimple_switch_set_label (gs
, 0, label
);
4160 /* Return true if GS is a GIMPLE_DEBUG statement. */
4163 is_gimple_debug (const_gimple gs
)
4165 return gimple_code (gs
) == GIMPLE_DEBUG
;
4168 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4171 gimple_debug_bind_p (const_gimple s
)
4173 if (is_gimple_debug (s
))
4174 return s
->subcode
== GIMPLE_DEBUG_BIND
;
4179 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4182 gimple_debug_bind_get_var (gimple dbg
)
4184 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4185 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4186 return gimple_op (dbg
, 0);
4189 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4193 gimple_debug_bind_get_value (gimple dbg
)
4195 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4196 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4197 return gimple_op (dbg
, 1);
4200 /* Return a pointer to the value bound to the variable in a
4201 GIMPLE_DEBUG bind statement. */
4203 static inline tree
*
4204 gimple_debug_bind_get_value_ptr (gimple dbg
)
4206 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4207 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4208 return gimple_op_ptr (dbg
, 1);
4211 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4214 gimple_debug_bind_set_var (gimple dbg
, tree var
)
4216 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4217 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4218 gimple_set_op (dbg
, 0, var
);
4221 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4225 gimple_debug_bind_set_value (gimple dbg
, tree value
)
4227 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4228 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4229 gimple_set_op (dbg
, 1, value
);
4232 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4234 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4236 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4240 gimple_debug_bind_reset_value (gimple dbg
)
4242 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4243 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4244 gimple_set_op (dbg
, 1, GIMPLE_DEBUG_BIND_NOVALUE
);
4247 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4251 gimple_debug_bind_has_value_p (gimple dbg
)
4253 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4254 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg
));
4255 return gimple_op (dbg
, 1) != GIMPLE_DEBUG_BIND_NOVALUE
;
4258 #undef GIMPLE_DEBUG_BIND_NOVALUE
4260 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4263 gimple_debug_source_bind_p (const_gimple s
)
4265 if (is_gimple_debug (s
))
4266 return s
->subcode
== GIMPLE_DEBUG_SOURCE_BIND
;
4271 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4274 gimple_debug_source_bind_get_var (gimple dbg
)
4276 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4277 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4278 return gimple_op (dbg
, 0);
4281 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4285 gimple_debug_source_bind_get_value (gimple dbg
)
4287 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4288 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4289 return gimple_op (dbg
, 1);
4292 /* Return a pointer to the value bound to the variable in a
4293 GIMPLE_DEBUG source bind statement. */
4295 static inline tree
*
4296 gimple_debug_source_bind_get_value_ptr (gimple dbg
)
4298 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4299 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4300 return gimple_op_ptr (dbg
, 1);
4303 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4306 gimple_debug_source_bind_set_var (gimple dbg
, tree var
)
4308 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4309 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4310 gimple_set_op (dbg
, 0, var
);
4313 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4317 gimple_debug_source_bind_set_value (gimple dbg
, tree value
)
4319 GIMPLE_CHECK (dbg
, GIMPLE_DEBUG
);
4320 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg
));
4321 gimple_set_op (dbg
, 1, value
);
4324 /* Return the line number for EXPR, or return -1 if we have no line
4325 number information for it. */
4327 get_lineno (const_gimple stmt
)
4334 loc
= gimple_location (stmt
);
4335 if (loc
== UNKNOWN_LOCATION
)
4338 return LOCATION_LINE (loc
);
4341 /* Return a pointer to the body for the OMP statement GS. */
4343 static inline gimple_seq
*
4344 gimple_omp_body_ptr (gimple gs
)
4346 return &static_cast <gimple_statement_omp
*> (gs
)->body
;
4349 /* Return the body for the OMP statement GS. */
4351 static inline gimple_seq
4352 gimple_omp_body (gimple gs
)
4354 return *gimple_omp_body_ptr (gs
);
4357 /* Set BODY to be the body for the OMP statement GS. */
4360 gimple_omp_set_body (gimple gs
, gimple_seq body
)
4362 static_cast <gimple_statement_omp
*> (gs
)->body
= body
;
4366 /* Return the name associated with OMP_CRITICAL statement GS. */
4369 gimple_omp_critical_name (const_gimple gs
)
4371 const gimple_statement_omp_critical
*omp_critical_stmt
=
4372 as_a
<const gimple_statement_omp_critical
*> (gs
);
4373 return omp_critical_stmt
->name
;
4377 /* Return a pointer to the name associated with OMP critical statement GS. */
4379 static inline tree
*
4380 gimple_omp_critical_name_ptr (gimple gs
)
4382 gimple_statement_omp_critical
*omp_critical_stmt
=
4383 as_a
<gimple_statement_omp_critical
*> (gs
);
4384 return &omp_critical_stmt
->name
;
4388 /* Set NAME to be the name associated with OMP critical statement GS. */
4391 gimple_omp_critical_set_name (gimple gs
, tree name
)
4393 gimple_statement_omp_critical
*omp_critical_stmt
=
4394 as_a
<gimple_statement_omp_critical
*> (gs
);
4395 omp_critical_stmt
->name
= name
;
4399 /* Return the kind of OMP for statemement. */
4402 gimple_omp_for_kind (const_gimple g
)
4404 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4405 return (gimple_omp_subcode (g
) & GF_OMP_FOR_KIND_MASK
);
4409 /* Set the OMP for kind. */
4412 gimple_omp_for_set_kind (gimple g
, int kind
)
4414 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4415 g
->subcode
= (g
->subcode
& ~GF_OMP_FOR_KIND_MASK
)
4416 | (kind
& GF_OMP_FOR_KIND_MASK
);
4420 /* Return true if OMP for statement G has the
4421 GF_OMP_FOR_COMBINED flag set. */
4424 gimple_omp_for_combined_p (const_gimple g
)
4426 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4427 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED
) != 0;
4431 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4432 value of COMBINED_P. */
4435 gimple_omp_for_set_combined_p (gimple g
, bool combined_p
)
4437 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4439 g
->subcode
|= GF_OMP_FOR_COMBINED
;
4441 g
->subcode
&= ~GF_OMP_FOR_COMBINED
;
4445 /* Return true if OMP for statement G has the
4446 GF_OMP_FOR_COMBINED_INTO flag set. */
4449 gimple_omp_for_combined_into_p (const_gimple g
)
4451 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4452 return (gimple_omp_subcode (g
) & GF_OMP_FOR_COMBINED_INTO
) != 0;
4456 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4457 value of COMBINED_P. */
4460 gimple_omp_for_set_combined_into_p (gimple g
, bool combined_p
)
4462 GIMPLE_CHECK (g
, GIMPLE_OMP_FOR
);
4464 g
->subcode
|= GF_OMP_FOR_COMBINED_INTO
;
4466 g
->subcode
&= ~GF_OMP_FOR_COMBINED_INTO
;
4470 /* Return the clauses associated with OMP_FOR GS. */
4473 gimple_omp_for_clauses (const_gimple gs
)
4475 const gimple_statement_omp_for
*omp_for_stmt
=
4476 as_a
<const gimple_statement_omp_for
*> (gs
);
4477 return omp_for_stmt
->clauses
;
4481 /* Return a pointer to the OMP_FOR GS. */
4483 static inline tree
*
4484 gimple_omp_for_clauses_ptr (gimple gs
)
4486 gimple_statement_omp_for
*omp_for_stmt
=
4487 as_a
<gimple_statement_omp_for
*> (gs
);
4488 return &omp_for_stmt
->clauses
;
4492 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4495 gimple_omp_for_set_clauses (gimple gs
, tree clauses
)
4497 gimple_statement_omp_for
*omp_for_stmt
=
4498 as_a
<gimple_statement_omp_for
*> (gs
);
4499 omp_for_stmt
->clauses
= clauses
;
4503 /* Get the collapse count of OMP_FOR GS. */
4505 static inline size_t
4506 gimple_omp_for_collapse (gimple gs
)
4508 gimple_statement_omp_for
*omp_for_stmt
=
4509 as_a
<gimple_statement_omp_for
*> (gs
);
4510 return omp_for_stmt
->collapse
;
4514 /* Return the index variable for OMP_FOR GS. */
4517 gimple_omp_for_index (const_gimple gs
, size_t i
)
4519 const gimple_statement_omp_for
*omp_for_stmt
=
4520 as_a
<const gimple_statement_omp_for
*> (gs
);
4521 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4522 return omp_for_stmt
->iter
[i
].index
;
4526 /* Return a pointer to the index variable for OMP_FOR GS. */
4528 static inline tree
*
4529 gimple_omp_for_index_ptr (gimple gs
, size_t i
)
4531 gimple_statement_omp_for
*omp_for_stmt
=
4532 as_a
<gimple_statement_omp_for
*> (gs
);
4533 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4534 return &omp_for_stmt
->iter
[i
].index
;
4538 /* Set INDEX to be the index variable for OMP_FOR GS. */
4541 gimple_omp_for_set_index (gimple gs
, size_t i
, tree index
)
4543 gimple_statement_omp_for
*omp_for_stmt
=
4544 as_a
<gimple_statement_omp_for
*> (gs
);
4545 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4546 omp_for_stmt
->iter
[i
].index
= index
;
4550 /* Return the initial value for OMP_FOR GS. */
4553 gimple_omp_for_initial (const_gimple gs
, size_t i
)
4555 const gimple_statement_omp_for
*omp_for_stmt
=
4556 as_a
<const gimple_statement_omp_for
*> (gs
);
4557 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4558 return omp_for_stmt
->iter
[i
].initial
;
4562 /* Return a pointer to the initial value for OMP_FOR GS. */
4564 static inline tree
*
4565 gimple_omp_for_initial_ptr (gimple gs
, size_t i
)
4567 gimple_statement_omp_for
*omp_for_stmt
=
4568 as_a
<gimple_statement_omp_for
*> (gs
);
4569 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4570 return &omp_for_stmt
->iter
[i
].initial
;
4574 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4577 gimple_omp_for_set_initial (gimple gs
, size_t i
, tree initial
)
4579 gimple_statement_omp_for
*omp_for_stmt
=
4580 as_a
<gimple_statement_omp_for
*> (gs
);
4581 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4582 omp_for_stmt
->iter
[i
].initial
= initial
;
4586 /* Return the final value for OMP_FOR GS. */
4589 gimple_omp_for_final (const_gimple gs
, size_t i
)
4591 const gimple_statement_omp_for
*omp_for_stmt
=
4592 as_a
<const gimple_statement_omp_for
*> (gs
);
4593 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4594 return omp_for_stmt
->iter
[i
].final
;
4598 /* Return a pointer to the final value for OMP_FOR GS. */
4600 static inline tree
*
4601 gimple_omp_for_final_ptr (gimple gs
, size_t i
)
4603 gimple_statement_omp_for
*omp_for_stmt
=
4604 as_a
<gimple_statement_omp_for
*> (gs
);
4605 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4606 return &omp_for_stmt
->iter
[i
].final
;
4610 /* Set FINAL to be the final value for OMP_FOR GS. */
4613 gimple_omp_for_set_final (gimple gs
, size_t i
, tree final
)
4615 gimple_statement_omp_for
*omp_for_stmt
=
4616 as_a
<gimple_statement_omp_for
*> (gs
);
4617 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4618 omp_for_stmt
->iter
[i
].final
= final
;
4622 /* Return the increment value for OMP_FOR GS. */
4625 gimple_omp_for_incr (const_gimple gs
, size_t i
)
4627 const gimple_statement_omp_for
*omp_for_stmt
=
4628 as_a
<const gimple_statement_omp_for
*> (gs
);
4629 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4630 return omp_for_stmt
->iter
[i
].incr
;
4634 /* Return a pointer to the increment value for OMP_FOR GS. */
4636 static inline tree
*
4637 gimple_omp_for_incr_ptr (gimple gs
, size_t i
)
4639 gimple_statement_omp_for
*omp_for_stmt
=
4640 as_a
<gimple_statement_omp_for
*> (gs
);
4641 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4642 return &omp_for_stmt
->iter
[i
].incr
;
4646 /* Set INCR to be the increment value for OMP_FOR GS. */
4649 gimple_omp_for_set_incr (gimple gs
, size_t i
, tree incr
)
4651 gimple_statement_omp_for
*omp_for_stmt
=
4652 as_a
<gimple_statement_omp_for
*> (gs
);
4653 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
4654 omp_for_stmt
->iter
[i
].incr
= incr
;
4658 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4659 statement GS starts. */
4661 static inline gimple_seq
*
4662 gimple_omp_for_pre_body_ptr (gimple gs
)
4664 gimple_statement_omp_for
*omp_for_stmt
=
4665 as_a
<gimple_statement_omp_for
*> (gs
);
4666 return &omp_for_stmt
->pre_body
;
4670 /* Return the sequence of statements to execute before the OMP_FOR
4671 statement GS starts. */
4673 static inline gimple_seq
4674 gimple_omp_for_pre_body (gimple gs
)
4676 return *gimple_omp_for_pre_body_ptr (gs
);
4680 /* Set PRE_BODY to be the sequence of statements to execute before the
4681 OMP_FOR statement GS starts. */
4684 gimple_omp_for_set_pre_body (gimple gs
, gimple_seq pre_body
)
4686 gimple_statement_omp_for
*omp_for_stmt
=
4687 as_a
<gimple_statement_omp_for
*> (gs
);
4688 omp_for_stmt
->pre_body
= pre_body
;
4692 /* Return the clauses associated with OMP_PARALLEL GS. */
4695 gimple_omp_parallel_clauses (const_gimple gs
)
4697 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4698 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4699 return omp_parallel_stmt
->clauses
;
4703 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4705 static inline tree
*
4706 gimple_omp_parallel_clauses_ptr (gimple gs
)
4708 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4709 as_a
<gimple_statement_omp_parallel
*> (gs
);
4710 return &omp_parallel_stmt
->clauses
;
4714 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4718 gimple_omp_parallel_set_clauses (gimple gs
, tree clauses
)
4720 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4721 as_a
<gimple_statement_omp_parallel
*> (gs
);
4722 omp_parallel_stmt
->clauses
= clauses
;
4726 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4729 gimple_omp_parallel_child_fn (const_gimple gs
)
4731 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4732 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4733 return omp_parallel_stmt
->child_fn
;
4736 /* Return a pointer to the child function used to hold the body of
4739 static inline tree
*
4740 gimple_omp_parallel_child_fn_ptr (gimple gs
)
4742 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4743 as_a
<gimple_statement_omp_parallel
*> (gs
);
4744 return &omp_parallel_stmt
->child_fn
;
4748 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4751 gimple_omp_parallel_set_child_fn (gimple gs
, tree child_fn
)
4753 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4754 as_a
<gimple_statement_omp_parallel
*> (gs
);
4755 omp_parallel_stmt
->child_fn
= child_fn
;
4759 /* Return the artificial argument used to send variables and values
4760 from the parent to the children threads in OMP_PARALLEL GS. */
4763 gimple_omp_parallel_data_arg (const_gimple gs
)
4765 const gimple_statement_omp_parallel
*omp_parallel_stmt
=
4766 as_a
<const gimple_statement_omp_parallel
*> (gs
);
4767 return omp_parallel_stmt
->data_arg
;
4771 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4773 static inline tree
*
4774 gimple_omp_parallel_data_arg_ptr (gimple gs
)
4776 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4777 as_a
<gimple_statement_omp_parallel
*> (gs
);
4778 return &omp_parallel_stmt
->data_arg
;
4782 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4785 gimple_omp_parallel_set_data_arg (gimple gs
, tree data_arg
)
4787 gimple_statement_omp_parallel
*omp_parallel_stmt
=
4788 as_a
<gimple_statement_omp_parallel
*> (gs
);
4789 omp_parallel_stmt
->data_arg
= data_arg
;
4793 /* Return the clauses associated with OMP_TASK GS. */
4796 gimple_omp_task_clauses (const_gimple gs
)
4798 const gimple_statement_omp_task
*omp_task_stmt
=
4799 as_a
<const gimple_statement_omp_task
*> (gs
);
4800 return omp_task_stmt
->clauses
;
4804 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4806 static inline tree
*
4807 gimple_omp_task_clauses_ptr (gimple gs
)
4809 gimple_statement_omp_task
*omp_task_stmt
=
4810 as_a
<gimple_statement_omp_task
*> (gs
);
4811 return &omp_task_stmt
->clauses
;
4815 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4819 gimple_omp_task_set_clauses (gimple gs
, tree clauses
)
4821 gimple_statement_omp_task
*omp_task_stmt
=
4822 as_a
<gimple_statement_omp_task
*> (gs
);
4823 omp_task_stmt
->clauses
= clauses
;
4827 /* Return the child function used to hold the body of OMP_TASK GS. */
4830 gimple_omp_task_child_fn (const_gimple gs
)
4832 const gimple_statement_omp_task
*omp_task_stmt
=
4833 as_a
<const gimple_statement_omp_task
*> (gs
);
4834 return omp_task_stmt
->child_fn
;
4837 /* Return a pointer to the child function used to hold the body of
4840 static inline tree
*
4841 gimple_omp_task_child_fn_ptr (gimple gs
)
4843 gimple_statement_omp_task
*omp_task_stmt
=
4844 as_a
<gimple_statement_omp_task
*> (gs
);
4845 return &omp_task_stmt
->child_fn
;
4849 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4852 gimple_omp_task_set_child_fn (gimple gs
, tree child_fn
)
4854 gimple_statement_omp_task
*omp_task_stmt
=
4855 as_a
<gimple_statement_omp_task
*> (gs
);
4856 omp_task_stmt
->child_fn
= child_fn
;
4860 /* Return the artificial argument used to send variables and values
4861 from the parent to the children threads in OMP_TASK GS. */
4864 gimple_omp_task_data_arg (const_gimple gs
)
4866 const gimple_statement_omp_task
*omp_task_stmt
=
4867 as_a
<const gimple_statement_omp_task
*> (gs
);
4868 return omp_task_stmt
->data_arg
;
4872 /* Return a pointer to the data argument for OMP_TASK GS. */
4874 static inline tree
*
4875 gimple_omp_task_data_arg_ptr (gimple gs
)
4877 gimple_statement_omp_task
*omp_task_stmt
=
4878 as_a
<gimple_statement_omp_task
*> (gs
);
4879 return &omp_task_stmt
->data_arg
;
4883 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4886 gimple_omp_task_set_data_arg (gimple gs
, tree data_arg
)
4888 gimple_statement_omp_task
*omp_task_stmt
=
4889 as_a
<gimple_statement_omp_task
*> (gs
);
4890 omp_task_stmt
->data_arg
= data_arg
;
4894 /* Return the clauses associated with OMP_TASK GS. */
4897 gimple_omp_taskreg_clauses (const_gimple gs
)
4899 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4900 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4901 return omp_taskreg_stmt
->clauses
;
4905 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4907 static inline tree
*
4908 gimple_omp_taskreg_clauses_ptr (gimple gs
)
4910 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4911 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4912 return &omp_taskreg_stmt
->clauses
;
4916 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4920 gimple_omp_taskreg_set_clauses (gimple gs
, tree clauses
)
4922 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4923 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4924 omp_taskreg_stmt
->clauses
= clauses
;
4928 /* Return the child function used to hold the body of OMP_TASK GS. */
4931 gimple_omp_taskreg_child_fn (const_gimple gs
)
4933 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4934 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4935 return omp_taskreg_stmt
->child_fn
;
4938 /* Return a pointer to the child function used to hold the body of
4941 static inline tree
*
4942 gimple_omp_taskreg_child_fn_ptr (gimple gs
)
4944 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4945 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4946 return &omp_taskreg_stmt
->child_fn
;
4950 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4953 gimple_omp_taskreg_set_child_fn (gimple gs
, tree child_fn
)
4955 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4956 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4957 omp_taskreg_stmt
->child_fn
= child_fn
;
4961 /* Return the artificial argument used to send variables and values
4962 from the parent to the children threads in OMP_TASK GS. */
4965 gimple_omp_taskreg_data_arg (const_gimple gs
)
4967 const gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4968 as_a
<const gimple_statement_omp_taskreg
*> (gs
);
4969 return omp_taskreg_stmt
->data_arg
;
4973 /* Return a pointer to the data argument for OMP_TASK GS. */
4975 static inline tree
*
4976 gimple_omp_taskreg_data_arg_ptr (gimple gs
)
4978 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4979 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4980 return &omp_taskreg_stmt
->data_arg
;
4984 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4987 gimple_omp_taskreg_set_data_arg (gimple gs
, tree data_arg
)
4989 gimple_statement_omp_taskreg
*omp_taskreg_stmt
=
4990 as_a
<gimple_statement_omp_taskreg
*> (gs
);
4991 omp_taskreg_stmt
->data_arg
= data_arg
;
4995 /* Return the copy function used to hold the body of OMP_TASK GS. */
4998 gimple_omp_task_copy_fn (const_gimple gs
)
5000 const gimple_statement_omp_task
*omp_task_stmt
=
5001 as_a
<const gimple_statement_omp_task
*> (gs
);
5002 return omp_task_stmt
->copy_fn
;
5005 /* Return a pointer to the copy function used to hold the body of
5008 static inline tree
*
5009 gimple_omp_task_copy_fn_ptr (gimple gs
)
5011 gimple_statement_omp_task
*omp_task_stmt
=
5012 as_a
<gimple_statement_omp_task
*> (gs
);
5013 return &omp_task_stmt
->copy_fn
;
5017 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5020 gimple_omp_task_set_copy_fn (gimple gs
, tree copy_fn
)
5022 gimple_statement_omp_task
*omp_task_stmt
=
5023 as_a
<gimple_statement_omp_task
*> (gs
);
5024 omp_task_stmt
->copy_fn
= copy_fn
;
5028 /* Return size of the data block in bytes in OMP_TASK GS. */
5031 gimple_omp_task_arg_size (const_gimple gs
)
5033 const gimple_statement_omp_task
*omp_task_stmt
=
5034 as_a
<const gimple_statement_omp_task
*> (gs
);
5035 return omp_task_stmt
->arg_size
;
5039 /* Return a pointer to the data block size for OMP_TASK GS. */
5041 static inline tree
*
5042 gimple_omp_task_arg_size_ptr (gimple gs
)
5044 gimple_statement_omp_task
*omp_task_stmt
=
5045 as_a
<gimple_statement_omp_task
*> (gs
);
5046 return &omp_task_stmt
->arg_size
;
5050 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5053 gimple_omp_task_set_arg_size (gimple gs
, tree arg_size
)
5055 gimple_statement_omp_task
*omp_task_stmt
=
5056 as_a
<gimple_statement_omp_task
*> (gs
);
5057 omp_task_stmt
->arg_size
= arg_size
;
5061 /* Return align of the data block in bytes in OMP_TASK GS. */
5064 gimple_omp_task_arg_align (const_gimple gs
)
5066 const gimple_statement_omp_task
*omp_task_stmt
=
5067 as_a
<const gimple_statement_omp_task
*> (gs
);
5068 return omp_task_stmt
->arg_align
;
5072 /* Return a pointer to the data block align for OMP_TASK GS. */
5074 static inline tree
*
5075 gimple_omp_task_arg_align_ptr (gimple gs
)
5077 gimple_statement_omp_task
*omp_task_stmt
=
5078 as_a
<gimple_statement_omp_task
*> (gs
);
5079 return &omp_task_stmt
->arg_align
;
5083 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5086 gimple_omp_task_set_arg_align (gimple gs
, tree arg_align
)
5088 gimple_statement_omp_task
*omp_task_stmt
=
5089 as_a
<gimple_statement_omp_task
*> (gs
);
5090 omp_task_stmt
->arg_align
= arg_align
;
5094 /* Return the clauses associated with OMP_SINGLE GS. */
5097 gimple_omp_single_clauses (const_gimple gs
)
5099 const gimple_statement_omp_single
*omp_single_stmt
=
5100 as_a
<const gimple_statement_omp_single
*> (gs
);
5101 return omp_single_stmt
->clauses
;
5105 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5107 static inline tree
*
5108 gimple_omp_single_clauses_ptr (gimple gs
)
5110 gimple_statement_omp_single
*omp_single_stmt
=
5111 as_a
<gimple_statement_omp_single
*> (gs
);
5112 return &omp_single_stmt
->clauses
;
5116 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5119 gimple_omp_single_set_clauses (gimple gs
, tree clauses
)
5121 gimple_statement_omp_single
*omp_single_stmt
=
5122 as_a
<gimple_statement_omp_single
*> (gs
);
5123 omp_single_stmt
->clauses
= clauses
;
5127 /* Return the clauses associated with OMP_TARGET GS. */
5130 gimple_omp_target_clauses (const_gimple gs
)
5132 const gimple_statement_omp_target
*omp_target_stmt
=
5133 as_a
<const gimple_statement_omp_target
*> (gs
);
5134 return omp_target_stmt
->clauses
;
5138 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5140 static inline tree
*
5141 gimple_omp_target_clauses_ptr (gimple gs
)
5143 gimple_statement_omp_target
*omp_target_stmt
=
5144 as_a
<gimple_statement_omp_target
*> (gs
);
5145 return &omp_target_stmt
->clauses
;
5149 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5152 gimple_omp_target_set_clauses (gimple gs
, tree clauses
)
5154 gimple_statement_omp_target
*omp_target_stmt
=
5155 as_a
<gimple_statement_omp_target
*> (gs
);
5156 omp_target_stmt
->clauses
= clauses
;
5160 /* Return the kind of OMP target statemement. */
5163 gimple_omp_target_kind (const_gimple g
)
5165 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5166 return (gimple_omp_subcode (g
) & GF_OMP_TARGET_KIND_MASK
);
5170 /* Set the OMP target kind. */
5173 gimple_omp_target_set_kind (gimple g
, int kind
)
5175 GIMPLE_CHECK (g
, GIMPLE_OMP_TARGET
);
5176 g
->subcode
= (g
->subcode
& ~GF_OMP_TARGET_KIND_MASK
)
5177 | (kind
& GF_OMP_TARGET_KIND_MASK
);
5181 /* Return the child function used to hold the body of OMP_TARGET GS. */
5184 gimple_omp_target_child_fn (const_gimple gs
)
5186 const gimple_statement_omp_target
*omp_target_stmt
=
5187 as_a
<const gimple_statement_omp_target
*> (gs
);
5188 return omp_target_stmt
->child_fn
;
5191 /* Return a pointer to the child function used to hold the body of
5194 static inline tree
*
5195 gimple_omp_target_child_fn_ptr (gimple gs
)
5197 gimple_statement_omp_target
*omp_target_stmt
=
5198 as_a
<gimple_statement_omp_target
*> (gs
);
5199 return &omp_target_stmt
->child_fn
;
5203 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5206 gimple_omp_target_set_child_fn (gimple gs
, tree child_fn
)
5208 gimple_statement_omp_target
*omp_target_stmt
=
5209 as_a
<gimple_statement_omp_target
*> (gs
);
5210 omp_target_stmt
->child_fn
= child_fn
;
5214 /* Return the artificial argument used to send variables and values
5215 from the parent to the children threads in OMP_TARGET GS. */
5218 gimple_omp_target_data_arg (const_gimple gs
)
5220 const gimple_statement_omp_target
*omp_target_stmt
=
5221 as_a
<const gimple_statement_omp_target
*> (gs
);
5222 return omp_target_stmt
->data_arg
;
5226 /* Return a pointer to the data argument for OMP_TARGET GS. */
5228 static inline tree
*
5229 gimple_omp_target_data_arg_ptr (gimple gs
)
5231 gimple_statement_omp_target
*omp_target_stmt
=
5232 as_a
<gimple_statement_omp_target
*> (gs
);
5233 return &omp_target_stmt
->data_arg
;
5237 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5240 gimple_omp_target_set_data_arg (gimple gs
, tree data_arg
)
5242 gimple_statement_omp_target
*omp_target_stmt
=
5243 as_a
<gimple_statement_omp_target
*> (gs
);
5244 omp_target_stmt
->data_arg
= data_arg
;
5248 /* Return the clauses associated with OMP_TEAMS GS. */
5251 gimple_omp_teams_clauses (const_gimple gs
)
5253 const gimple_statement_omp_teams
*omp_teams_stmt
=
5254 as_a
<const gimple_statement_omp_teams
*> (gs
);
5255 return omp_teams_stmt
->clauses
;
5259 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5261 static inline tree
*
5262 gimple_omp_teams_clauses_ptr (gimple gs
)
5264 gimple_statement_omp_teams
*omp_teams_stmt
=
5265 as_a
<gimple_statement_omp_teams
*> (gs
);
5266 return &omp_teams_stmt
->clauses
;
5270 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5273 gimple_omp_teams_set_clauses (gimple gs
, tree clauses
)
5275 gimple_statement_omp_teams
*omp_teams_stmt
=
5276 as_a
<gimple_statement_omp_teams
*> (gs
);
5277 omp_teams_stmt
->clauses
= clauses
;
5281 /* Return the clauses associated with OMP_SECTIONS GS. */
5284 gimple_omp_sections_clauses (const_gimple gs
)
5286 const gimple_statement_omp_sections
*omp_sections_stmt
=
5287 as_a
<const gimple_statement_omp_sections
*> (gs
);
5288 return omp_sections_stmt
->clauses
;
5292 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5294 static inline tree
*
5295 gimple_omp_sections_clauses_ptr (gimple gs
)
5297 gimple_statement_omp_sections
*omp_sections_stmt
=
5298 as_a
<gimple_statement_omp_sections
*> (gs
);
5299 return &omp_sections_stmt
->clauses
;
5303 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5307 gimple_omp_sections_set_clauses (gimple gs
, tree clauses
)
5309 gimple_statement_omp_sections
*omp_sections_stmt
=
5310 as_a
<gimple_statement_omp_sections
*> (gs
);
5311 omp_sections_stmt
->clauses
= clauses
;
5315 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5319 gimple_omp_sections_control (const_gimple gs
)
5321 const gimple_statement_omp_sections
*omp_sections_stmt
=
5322 as_a
<const gimple_statement_omp_sections
*> (gs
);
5323 return omp_sections_stmt
->control
;
5327 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5330 static inline tree
*
5331 gimple_omp_sections_control_ptr (gimple gs
)
5333 gimple_statement_omp_sections
*omp_sections_stmt
=
5334 as_a
<gimple_statement_omp_sections
*> (gs
);
5335 return &omp_sections_stmt
->control
;
5339 /* Set CONTROL to be the set of clauses associated with the
5340 GIMPLE_OMP_SECTIONS in GS. */
5343 gimple_omp_sections_set_control (gimple gs
, tree control
)
5345 gimple_statement_omp_sections
*omp_sections_stmt
=
5346 as_a
<gimple_statement_omp_sections
*> (gs
);
5347 omp_sections_stmt
->control
= control
;
5351 /* Set COND to be the condition code for OMP_FOR GS. */
5354 gimple_omp_for_set_cond (gimple gs
, size_t i
, enum tree_code cond
)
5356 gimple_statement_omp_for
*omp_for_stmt
=
5357 as_a
<gimple_statement_omp_for
*> (gs
);
5358 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond
) == tcc_comparison
5359 && i
< omp_for_stmt
->collapse
);
5360 omp_for_stmt
->iter
[i
].cond
= cond
;
5364 /* Return the condition code associated with OMP_FOR GS. */
5366 static inline enum tree_code
5367 gimple_omp_for_cond (const_gimple gs
, size_t i
)
5369 const gimple_statement_omp_for
*omp_for_stmt
=
5370 as_a
<const gimple_statement_omp_for
*> (gs
);
5371 gcc_gimple_checking_assert (i
< omp_for_stmt
->collapse
);
5372 return omp_for_stmt
->iter
[i
].cond
;
5376 /* Set the value being stored in an atomic store. */
5379 gimple_omp_atomic_store_set_val (gimple g
, tree val
)
5381 gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5382 as_a
<gimple_statement_omp_atomic_store
*> (g
);
5383 omp_atomic_store_stmt
->val
= val
;
5387 /* Return the value being stored in an atomic store. */
5390 gimple_omp_atomic_store_val (const_gimple g
)
5392 const gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5393 as_a
<const gimple_statement_omp_atomic_store
*> (g
);
5394 return omp_atomic_store_stmt
->val
;
5398 /* Return a pointer to the value being stored in an atomic store. */
5400 static inline tree
*
5401 gimple_omp_atomic_store_val_ptr (gimple g
)
5403 gimple_statement_omp_atomic_store
*omp_atomic_store_stmt
=
5404 as_a
<gimple_statement_omp_atomic_store
*> (g
);
5405 return &omp_atomic_store_stmt
->val
;
5409 /* Set the LHS of an atomic load. */
5412 gimple_omp_atomic_load_set_lhs (gimple g
, tree lhs
)
5414 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5415 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5416 omp_atomic_load_stmt
->lhs
= lhs
;
5420 /* Get the LHS of an atomic load. */
5423 gimple_omp_atomic_load_lhs (const_gimple g
)
5425 const gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5426 as_a
<const gimple_statement_omp_atomic_load
*> (g
);
5427 return omp_atomic_load_stmt
->lhs
;
5431 /* Return a pointer to the LHS of an atomic load. */
5433 static inline tree
*
5434 gimple_omp_atomic_load_lhs_ptr (gimple g
)
5436 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5437 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5438 return &omp_atomic_load_stmt
->lhs
;
5442 /* Set the RHS of an atomic load. */
5445 gimple_omp_atomic_load_set_rhs (gimple g
, tree rhs
)
5447 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5448 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5449 omp_atomic_load_stmt
->rhs
= rhs
;
5453 /* Get the RHS of an atomic load. */
5456 gimple_omp_atomic_load_rhs (const_gimple g
)
5458 const gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5459 as_a
<const gimple_statement_omp_atomic_load
*> (g
);
5460 return omp_atomic_load_stmt
->rhs
;
5464 /* Return a pointer to the RHS of an atomic load. */
5466 static inline tree
*
5467 gimple_omp_atomic_load_rhs_ptr (gimple g
)
5469 gimple_statement_omp_atomic_load
*omp_atomic_load_stmt
=
5470 as_a
<gimple_statement_omp_atomic_load
*> (g
);
5471 return &omp_atomic_load_stmt
->rhs
;
5475 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5478 gimple_omp_continue_control_def (const_gimple g
)
5480 const gimple_statement_omp_continue
*omp_continue_stmt
=
5481 as_a
<const gimple_statement_omp_continue
*> (g
);
5482 return omp_continue_stmt
->control_def
;
5485 /* The same as above, but return the address. */
5487 static inline tree
*
5488 gimple_omp_continue_control_def_ptr (gimple g
)
5490 gimple_statement_omp_continue
*omp_continue_stmt
=
5491 as_a
<gimple_statement_omp_continue
*> (g
);
5492 return &omp_continue_stmt
->control_def
;
5495 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5498 gimple_omp_continue_set_control_def (gimple g
, tree def
)
5500 gimple_statement_omp_continue
*omp_continue_stmt
=
5501 as_a
<gimple_statement_omp_continue
*> (g
);
5502 omp_continue_stmt
->control_def
= def
;
5506 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5509 gimple_omp_continue_control_use (const_gimple g
)
5511 const gimple_statement_omp_continue
*omp_continue_stmt
=
5512 as_a
<const gimple_statement_omp_continue
*> (g
);
5513 return omp_continue_stmt
->control_use
;
5517 /* The same as above, but return the address. */
5519 static inline tree
*
5520 gimple_omp_continue_control_use_ptr (gimple g
)
5522 gimple_statement_omp_continue
*omp_continue_stmt
=
5523 as_a
<gimple_statement_omp_continue
*> (g
);
5524 return &omp_continue_stmt
->control_use
;
5528 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5531 gimple_omp_continue_set_control_use (gimple g
, tree use
)
5533 gimple_statement_omp_continue
*omp_continue_stmt
=
5534 as_a
<gimple_statement_omp_continue
*> (g
);
5535 omp_continue_stmt
->control_use
= use
;
5538 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5540 static inline gimple_seq
*
5541 gimple_transaction_body_ptr (gimple gs
)
5543 gimple_statement_transaction
*transaction_stmt
=
5544 as_a
<gimple_statement_transaction
*> (gs
);
5545 return &transaction_stmt
->body
;
5548 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5550 static inline gimple_seq
5551 gimple_transaction_body (gimple gs
)
5553 return *gimple_transaction_body_ptr (gs
);
5556 /* Return the label associated with a GIMPLE_TRANSACTION. */
5559 gimple_transaction_label (const_gimple gs
)
5561 const gimple_statement_transaction
*transaction_stmt
=
5562 as_a
<const gimple_statement_transaction
*> (gs
);
5563 return transaction_stmt
->label
;
5566 static inline tree
*
5567 gimple_transaction_label_ptr (gimple gs
)
5569 gimple_statement_transaction
*transaction_stmt
=
5570 as_a
<gimple_statement_transaction
*> (gs
);
5571 return &transaction_stmt
->label
;
5574 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5576 static inline unsigned int
5577 gimple_transaction_subcode (const_gimple gs
)
5579 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5583 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5586 gimple_transaction_set_body (gimple gs
, gimple_seq body
)
5588 gimple_statement_transaction
*transaction_stmt
=
5589 as_a
<gimple_statement_transaction
*> (gs
);
5590 transaction_stmt
->body
= body
;
5593 /* Set the label associated with a GIMPLE_TRANSACTION. */
5596 gimple_transaction_set_label (gimple gs
, tree label
)
5598 gimple_statement_transaction
*transaction_stmt
=
5599 as_a
<gimple_statement_transaction
*> (gs
);
5600 transaction_stmt
->label
= label
;
5603 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5606 gimple_transaction_set_subcode (gimple gs
, unsigned int subcode
)
5608 GIMPLE_CHECK (gs
, GIMPLE_TRANSACTION
);
5609 gs
->subcode
= subcode
;
5613 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5615 static inline tree
*
5616 gimple_return_retval_ptr (const_gimple gs
)
5618 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5619 return gimple_op_ptr (gs
, 0);
5622 /* Return the return value for GIMPLE_RETURN GS. */
5625 gimple_return_retval (const_gimple gs
)
5627 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5628 return gimple_op (gs
, 0);
5632 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5635 gimple_return_set_retval (gimple gs
, tree retval
)
5637 GIMPLE_CHECK (gs
, GIMPLE_RETURN
);
5638 gimple_set_op (gs
, 0, retval
);
5642 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5644 #define CASE_GIMPLE_OMP \
5645 case GIMPLE_OMP_PARALLEL: \
5646 case GIMPLE_OMP_TASK: \
5647 case GIMPLE_OMP_FOR: \
5648 case GIMPLE_OMP_SECTIONS: \
5649 case GIMPLE_OMP_SECTIONS_SWITCH: \
5650 case GIMPLE_OMP_SINGLE: \
5651 case GIMPLE_OMP_TARGET: \
5652 case GIMPLE_OMP_TEAMS: \
5653 case GIMPLE_OMP_SECTION: \
5654 case GIMPLE_OMP_MASTER: \
5655 case GIMPLE_OMP_TASKGROUP: \
5656 case GIMPLE_OMP_ORDERED: \
5657 case GIMPLE_OMP_CRITICAL: \
5658 case GIMPLE_OMP_RETURN: \
5659 case GIMPLE_OMP_ATOMIC_LOAD: \
5660 case GIMPLE_OMP_ATOMIC_STORE: \
5661 case GIMPLE_OMP_CONTINUE
5664 is_gimple_omp (const_gimple stmt
)
5666 switch (gimple_code (stmt
))
5676 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5679 gimple_nop_p (const_gimple g
)
5681 return gimple_code (g
) == GIMPLE_NOP
;
5685 /* Return true if GS is a GIMPLE_RESX. */
5688 is_gimple_resx (const_gimple gs
)
5690 return gimple_code (gs
) == GIMPLE_RESX
;
5693 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5695 static inline enum br_predictor
5696 gimple_predict_predictor (gimple gs
)
5698 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5699 return (enum br_predictor
) (gs
->subcode
& ~GF_PREDICT_TAKEN
);
5703 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5706 gimple_predict_set_predictor (gimple gs
, enum br_predictor predictor
)
5708 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5709 gs
->subcode
= (gs
->subcode
& GF_PREDICT_TAKEN
)
5710 | (unsigned) predictor
;
5714 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5716 static inline enum prediction
5717 gimple_predict_outcome (gimple gs
)
5719 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5720 return (gs
->subcode
& GF_PREDICT_TAKEN
) ? TAKEN
: NOT_TAKEN
;
5724 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5727 gimple_predict_set_outcome (gimple gs
, enum prediction outcome
)
5729 GIMPLE_CHECK (gs
, GIMPLE_PREDICT
);
5730 if (outcome
== TAKEN
)
5731 gs
->subcode
|= GF_PREDICT_TAKEN
;
5733 gs
->subcode
&= ~GF_PREDICT_TAKEN
;
5737 /* Return the type of the main expression computed by STMT. Return
5738 void_type_node if the statement computes nothing. */
5741 gimple_expr_type (const_gimple stmt
)
5743 enum gimple_code code
= gimple_code (stmt
);
5745 if (code
== GIMPLE_ASSIGN
|| code
== GIMPLE_CALL
)
5748 /* In general we want to pass out a type that can be substituted
5749 for both the RHS and the LHS types if there is a possibly
5750 useless conversion involved. That means returning the
5751 original RHS type as far as we can reconstruct it. */
5752 if (code
== GIMPLE_CALL
)
5754 const_gimple_call call_stmt
= as_a
<const_gimple_call
> (stmt
);
5755 if (gimple_call_internal_p (call_stmt
)
5756 && gimple_call_internal_fn (call_stmt
) == IFN_MASK_STORE
)
5757 type
= TREE_TYPE (gimple_call_arg (call_stmt
, 3));
5759 type
= gimple_call_return_type (call_stmt
);
5762 switch (gimple_assign_rhs_code (stmt
))
5764 case POINTER_PLUS_EXPR
:
5765 type
= TREE_TYPE (gimple_assign_rhs1 (stmt
));
5769 /* As fallback use the type of the LHS. */
5770 type
= TREE_TYPE (gimple_get_lhs (stmt
));
5775 else if (code
== GIMPLE_COND
)
5776 return boolean_type_node
;
5778 return void_type_node
;
5781 /* Enum and arrays used for allocation stats. Keep in sync with
5782 gimple.c:gimple_alloc_kind_names. */
5783 enum gimple_alloc_kind
5785 gimple_alloc_kind_assign
, /* Assignments. */
5786 gimple_alloc_kind_phi
, /* PHI nodes. */
5787 gimple_alloc_kind_cond
, /* Conditionals. */
5788 gimple_alloc_kind_rest
, /* Everything else. */
5789 gimple_alloc_kind_all
5792 extern int gimple_alloc_counts
[];
5793 extern int gimple_alloc_sizes
[];
5795 /* Return the allocation kind for a given stmt CODE. */
5796 static inline enum gimple_alloc_kind
5797 gimple_alloc_kind (enum gimple_code code
)
5802 return gimple_alloc_kind_assign
;
5804 return gimple_alloc_kind_phi
;
5806 return gimple_alloc_kind_cond
;
5808 return gimple_alloc_kind_rest
;
5812 /* Return true if a location should not be emitted for this statement
5813 by annotate_all_with_location. */
5816 gimple_do_not_emit_location_p (gimple g
)
5818 return gimple_plf (g
, GF_PLF_1
);
5821 /* Mark statement G so a location will not be emitted by
5822 annotate_one_with_location. */
5825 gimple_set_do_not_emit_location (gimple g
)
5827 /* The PLF flags are initialized to 0 when a new tuple is created,
5828 so no need to initialize it anywhere. */
5829 gimple_set_plf (g
, GF_PLF_1
, true);
5833 /* Macros for showing usage statistics. */
5834 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5836 : ((x) < 1024*1024*10 \
5838 : (x) / (1024*1024))))
5840 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5842 #endif /* GCC_GIMPLE_H */