Daily bump.
[official-gcc.git] / gcc / gimple.h
blobceefbc0890f09fcddaedf48959d75ac7cead6a9d
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
11 version.
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
16 for more details.
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/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 typedef gimple gimple_seq_node;
27 /* For each block, the PHI nodes that need to be rewritten are stored into
28 these vectors. */
29 typedef vec<gimple> gimple_vec;
31 enum gimple_code {
32 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
33 #include "gimple.def"
34 #undef DEFGSCODE
35 LAST_AND_UNUSED_GIMPLE_CODE
38 extern const char *const gimple_code_name[];
39 extern const unsigned char gimple_rhs_class_table[];
41 /* Error out if a gimple tuple is addressed incorrectly. */
42 #if defined ENABLE_GIMPLE_CHECKING
43 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
44 extern void gimple_check_failed (const_gimple, const char *, int, \
45 const char *, enum gimple_code, \
46 enum tree_code) ATTRIBUTE_NORETURN;
48 #define GIMPLE_CHECK(GS, CODE) \
49 do { \
50 const_gimple __gs = (GS); \
51 if (gimple_code (__gs) != (CODE)) \
52 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
53 (CODE), ERROR_MARK); \
54 } while (0)
55 #else /* not ENABLE_GIMPLE_CHECKING */
56 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
57 #define GIMPLE_CHECK(GS, CODE) (void)0
58 #endif
60 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
61 get_gimple_rhs_class. */
62 enum gimple_rhs_class
64 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
65 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
66 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
67 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
68 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
69 name, a _DECL, a _REF, etc. */
72 /* Specific flags for individual GIMPLE statements. These flags are
73 always stored in gimple_statement_base.subcode and they may only be
74 defined for statement codes that do not use subcodes.
76 Values for the masks can overlap as long as the overlapping values
77 are never used in the same statement class.
79 The maximum mask value that can be defined is 1 << 15 (i.e., each
80 statement code can hold up to 16 bitflags).
82 Keep this list sorted. */
83 enum gf_mask {
84 GF_ASM_INPUT = 1 << 0,
85 GF_ASM_VOLATILE = 1 << 1,
86 GF_CALL_FROM_THUNK = 1 << 0,
87 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
88 GF_CALL_TAILCALL = 1 << 2,
89 GF_CALL_VA_ARG_PACK = 1 << 3,
90 GF_CALL_NOTHROW = 1 << 4,
91 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
92 GF_CALL_INTERNAL = 1 << 6,
93 GF_OMP_PARALLEL_COMBINED = 1 << 0,
94 GF_OMP_FOR_KIND_MASK = (1 << 2) - 1,
95 GF_OMP_FOR_KIND_FOR = 0,
96 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
97 /* Flag for SIMD variants of OMP_FOR kinds. */
98 GF_OMP_FOR_SIMD = 1 << 1,
99 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
100 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
101 GF_OMP_FOR_COMBINED = 1 << 2,
102 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
103 GF_OMP_TARGET_KIND_MASK = (1 << 2) - 1,
104 GF_OMP_TARGET_KIND_REGION = 0,
105 GF_OMP_TARGET_KIND_DATA = 1,
106 GF_OMP_TARGET_KIND_UPDATE = 2,
108 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
109 a thread synchronization via some sort of barrier. The exact barrier
110 that would otherwise be emitted is dependent on the OMP statement with
111 which this return is associated. */
112 GF_OMP_RETURN_NOWAIT = 1 << 0,
114 GF_OMP_SECTION_LAST = 1 << 0,
115 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
116 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
117 GF_PREDICT_TAKEN = 1 << 15
120 /* Currently, there are only two types of gimple debug stmt. Others are
121 envisioned, for example, to enable the generation of is_stmt notes
122 in line number information, to mark sequence points, etc. This
123 subcode is to be used to tell them apart. */
124 enum gimple_debug_subcode {
125 GIMPLE_DEBUG_BIND = 0,
126 GIMPLE_DEBUG_SOURCE_BIND = 1
129 /* Masks for selecting a pass local flag (PLF) to work on. These
130 masks are used by gimple_set_plf and gimple_plf. */
131 enum plf_mask {
132 GF_PLF_1 = 1 << 0,
133 GF_PLF_2 = 1 << 1
136 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
137 are for 64 bit hosts. */
139 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
140 chain_next ("%h.next"), variable_size))
141 gimple_statement_base
143 /* [ WORD 1 ]
144 Main identifying code for a tuple. */
145 ENUM_BITFIELD(gimple_code) code : 8;
147 /* Nonzero if a warning should not be emitted on this tuple. */
148 unsigned int no_warning : 1;
150 /* Nonzero if this tuple has been visited. Passes are responsible
151 for clearing this bit before using it. */
152 unsigned int visited : 1;
154 /* Nonzero if this tuple represents a non-temporal move. */
155 unsigned int nontemporal_move : 1;
157 /* Pass local flags. These flags are free for any pass to use as
158 they see fit. Passes should not assume that these flags contain
159 any useful value when the pass starts. Any initial state that
160 the pass requires should be set on entry to the pass. See
161 gimple_set_plf and gimple_plf for usage. */
162 unsigned int plf : 2;
164 /* Nonzero if this statement has been modified and needs to have its
165 operands rescanned. */
166 unsigned modified : 1;
168 /* Nonzero if this statement contains volatile operands. */
169 unsigned has_volatile_ops : 1;
171 /* Padding to get subcode to 16 bit alignment. */
172 unsigned pad : 1;
174 /* The SUBCODE field can be used for tuple-specific flags for tuples
175 that do not require subcodes. Note that SUBCODE should be at
176 least as wide as tree codes, as several tuples store tree codes
177 in there. */
178 unsigned int subcode : 16;
180 /* UID of this statement. This is used by passes that want to
181 assign IDs to statements. It must be assigned and used by each
182 pass. By default it should be assumed to contain garbage. */
183 unsigned uid;
185 /* [ WORD 2 ]
186 Locus information for debug info. */
187 location_t location;
189 /* Number of operands in this tuple. */
190 unsigned num_ops;
192 /* [ WORD 3 ]
193 Basic block holding this statement. */
194 basic_block bb;
196 /* [ WORD 4-5 ]
197 Linked lists of gimple statements. The next pointers form
198 a NULL terminated list, the prev pointers are a cyclic list.
199 A gimple statement is hence also a double-ended list of
200 statements, with the pointer itself being the first element,
201 and the prev pointer being the last. */
202 gimple next;
203 gimple GTY((skip)) prev;
207 /* Base structure for tuples with operands. */
209 /* This gimple subclass has no tag value. */
210 struct GTY(())
211 gimple_statement_with_ops_base : public gimple_statement_base
213 /* [ WORD 1-6 ] : base class */
215 /* [ WORD 7 ]
216 SSA operand vectors. NOTE: It should be possible to
217 amalgamate these vectors with the operand vector OP. However,
218 the SSA operand vectors are organized differently and contain
219 more information (like immediate use chaining). */
220 struct use_optype_d GTY((skip (""))) *use_ops;
224 /* Statements that take register operands. */
226 struct GTY((tag("GSS_WITH_OPS")))
227 gimple_statement_with_ops : public gimple_statement_with_ops_base
229 /* [ WORD 1-7 ] : base class */
231 /* [ WORD 8 ]
232 Operand vector. NOTE! This must always be the last field
233 of this structure. In particular, this means that this
234 structure cannot be embedded inside another one. */
235 tree GTY((length ("%h.num_ops"))) op[1];
239 /* Base for statements that take both memory and register operands. */
241 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
242 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
244 /* [ WORD 1-7 ] : base class */
246 /* [ WORD 8-9 ]
247 Virtual operands for this statement. The GC will pick them
248 up via the ssa_names array. */
249 tree GTY((skip (""))) vdef;
250 tree GTY((skip (""))) vuse;
254 /* Statements that take both memory and register operands. */
256 struct GTY((tag("GSS_WITH_MEM_OPS")))
257 gimple_statement_with_memory_ops :
258 public gimple_statement_with_memory_ops_base
260 /* [ WORD 1-9 ] : base class */
262 /* [ WORD 10 ]
263 Operand vector. NOTE! This must always be the last field
264 of this structure. In particular, this means that this
265 structure cannot be embedded inside another one. */
266 tree GTY((length ("%h.num_ops"))) op[1];
270 /* Call statements that take both memory and register operands. */
272 struct GTY((tag("GSS_CALL")))
273 gimple_statement_call : public gimple_statement_with_memory_ops_base
275 /* [ WORD 1-9 ] : base class */
277 /* [ WORD 10-13 ] */
278 struct pt_solution call_used;
279 struct pt_solution call_clobbered;
281 /* [ WORD 14 ] */
282 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
283 tree GTY ((tag ("0"))) fntype;
284 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
285 } u;
287 /* [ WORD 15 ]
288 Operand vector. NOTE! This must always be the last field
289 of this structure. In particular, this means that this
290 structure cannot be embedded inside another one. */
291 tree GTY((length ("%h.num_ops"))) op[1];
295 /* OpenMP statements (#pragma omp). */
297 struct GTY((tag("GSS_OMP")))
298 gimple_statement_omp : public gimple_statement_base
300 /* [ WORD 1-6 ] : base class */
302 /* [ WORD 7 ] */
303 gimple_seq body;
307 /* GIMPLE_BIND */
309 struct GTY((tag("GSS_BIND")))
310 gimple_statement_bind : public gimple_statement_base
312 /* [ WORD 1-6 ] : base class */
314 /* [ WORD 7 ]
315 Variables declared in this scope. */
316 tree vars;
318 /* [ WORD 8 ]
319 This is different than the BLOCK field in gimple_statement_base,
320 which is analogous to TREE_BLOCK (i.e., the lexical block holding
321 this statement). This field is the equivalent of BIND_EXPR_BLOCK
322 in tree land (i.e., the lexical scope defined by this bind). See
323 gimple-low.c. */
324 tree block;
326 /* [ WORD 9 ] */
327 gimple_seq body;
331 /* GIMPLE_CATCH */
333 struct GTY((tag("GSS_CATCH")))
334 gimple_statement_catch : public gimple_statement_base
336 /* [ WORD 1-6 ] : base class */
338 /* [ WORD 7 ] */
339 tree types;
341 /* [ WORD 8 ] */
342 gimple_seq handler;
346 /* GIMPLE_EH_FILTER */
348 struct GTY((tag("GSS_EH_FILTER")))
349 gimple_statement_eh_filter : public gimple_statement_base
351 /* [ WORD 1-6 ] : base class */
353 /* [ WORD 7 ]
354 Filter types. */
355 tree types;
357 /* [ WORD 8 ]
358 Failure actions. */
359 gimple_seq failure;
362 /* GIMPLE_EH_ELSE */
364 struct GTY((tag("GSS_EH_ELSE")))
365 gimple_statement_eh_else : public gimple_statement_base
367 /* [ WORD 1-6 ] : base class */
369 /* [ WORD 7,8 ] */
370 gimple_seq n_body, e_body;
373 /* GIMPLE_EH_MUST_NOT_THROW */
375 struct GTY((tag("GSS_EH_MNT")))
376 gimple_statement_eh_mnt : public gimple_statement_base
378 /* [ WORD 1-6 ] : base class */
380 /* [ WORD 7 ] Abort function decl. */
381 tree fndecl;
384 /* GIMPLE_PHI */
386 struct GTY((tag("GSS_PHI")))
387 gimple_statement_phi : public gimple_statement_base
389 /* [ WORD 1-6 ] : base class */
391 /* [ WORD 7 ] */
392 unsigned capacity;
393 unsigned nargs;
395 /* [ WORD 8 ] */
396 tree result;
398 /* [ WORD 9 ] */
399 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
403 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
405 struct GTY((tag("GSS_EH_CTRL")))
406 gimple_statement_eh_ctrl : public gimple_statement_base
408 /* [ WORD 1-6 ] : base class */
410 /* [ WORD 7 ]
411 Exception region number. */
412 int region;
415 struct GTY((tag("GSS_EH_CTRL")))
416 gimple_statement_resx : public gimple_statement_eh_ctrl
418 /* No extra fields; adds invariant:
419 stmt->code == GIMPLE_RESX. */
422 struct GTY((tag("GSS_EH_CTRL")))
423 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
425 /* No extra fields; adds invariant:
426 stmt->code == GIMPLE_EH_DISPATH. */
430 /* GIMPLE_TRY */
432 struct GTY((tag("GSS_TRY")))
433 gimple_statement_try : public gimple_statement_base
435 /* [ WORD 1-6 ] : base class */
437 /* [ WORD 7 ]
438 Expression to evaluate. */
439 gimple_seq eval;
441 /* [ WORD 8 ]
442 Cleanup expression. */
443 gimple_seq cleanup;
446 /* Kind of GIMPLE_TRY statements. */
447 enum gimple_try_flags
449 /* A try/catch. */
450 GIMPLE_TRY_CATCH = 1 << 0,
452 /* A try/finally. */
453 GIMPLE_TRY_FINALLY = 1 << 1,
454 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
456 /* Analogous to TRY_CATCH_IS_CLEANUP. */
457 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
460 /* GIMPLE_WITH_CLEANUP_EXPR */
462 struct GTY((tag("GSS_WCE")))
463 gimple_statement_wce : public gimple_statement_base
465 /* [ WORD 1-6 ] : base class */
467 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
468 executed if an exception is thrown, not on normal exit of its
469 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
470 in TARGET_EXPRs. */
472 /* [ WORD 7 ]
473 Cleanup expression. */
474 gimple_seq cleanup;
478 /* GIMPLE_ASM */
480 struct GTY((tag("GSS_ASM")))
481 gimple_statement_asm : public gimple_statement_with_memory_ops_base
483 /* [ WORD 1-9 ] : base class */
485 /* [ WORD 10 ]
486 __asm__ statement. */
487 const char *string;
489 /* [ WORD 11 ]
490 Number of inputs, outputs, clobbers, labels. */
491 unsigned char ni;
492 unsigned char no;
493 unsigned char nc;
494 unsigned char nl;
496 /* [ WORD 12 ]
497 Operand vector. NOTE! This must always be the last field
498 of this structure. In particular, this means that this
499 structure cannot be embedded inside another one. */
500 tree GTY((length ("%h.num_ops"))) op[1];
503 /* GIMPLE_OMP_CRITICAL */
505 struct GTY((tag("GSS_OMP_CRITICAL")))
506 gimple_statement_omp_critical : public gimple_statement_omp
508 /* [ WORD 1-7 ] : base class */
510 /* [ WORD 8 ]
511 Critical section name. */
512 tree name;
516 struct GTY(()) gimple_omp_for_iter {
517 /* Condition code. */
518 enum tree_code cond;
520 /* Index variable. */
521 tree index;
523 /* Initial value. */
524 tree initial;
526 /* Final value. */
527 tree final;
529 /* Increment. */
530 tree incr;
533 /* GIMPLE_OMP_FOR */
535 struct GTY((tag("GSS_OMP_FOR")))
536 gimple_statement_omp_for : public gimple_statement_omp
538 /* [ WORD 1-7 ] : base class */
540 /* [ WORD 8 ] */
541 tree clauses;
543 /* [ WORD 9 ]
544 Number of elements in iter array. */
545 size_t collapse;
547 /* [ WORD 10 ] */
548 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
550 /* [ WORD 11 ]
551 Pre-body evaluated before the loop body begins. */
552 gimple_seq pre_body;
556 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
557 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
558 gimple_statement_omp_parallel_layout : public gimple_statement_omp
560 /* [ WORD 1-7 ] : base class */
562 /* [ WORD 8 ]
563 Clauses. */
564 tree clauses;
566 /* [ WORD 9 ]
567 Child function holding the body of the parallel region. */
568 tree child_fn;
570 /* [ WORD 10 ]
571 Shared data argument. */
572 tree data_arg;
575 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
576 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
577 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
579 /* No extra fields; adds invariant:
580 stmt->code == GIMPLE_OMP_PARALLEL
581 || stmt->code == GIMPLE_OMP_TASK. */
585 /* GIMPLE_OMP_PARALLEL */
586 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
587 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
589 /* No extra fields; adds invariant:
590 stmt->code == GIMPLE_OMP_PARALLEL. */
593 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
594 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
596 /* No extra fields; adds invariant:
597 stmt->code == GIMPLE_OMP_TARGET. */
600 /* GIMPLE_OMP_TASK */
602 struct GTY((tag("GSS_OMP_TASK")))
603 gimple_statement_omp_task : public gimple_statement_omp_taskreg
605 /* [ WORD 1-10 ] : base class */
607 /* [ WORD 11 ]
608 Child function holding firstprivate initialization if needed. */
609 tree copy_fn;
611 /* [ WORD 12-13 ]
612 Size and alignment in bytes of the argument data block. */
613 tree arg_size;
614 tree arg_align;
618 /* GIMPLE_OMP_SECTION */
619 /* Uses struct gimple_statement_omp. */
622 /* GIMPLE_OMP_SECTIONS */
624 struct GTY((tag("GSS_OMP_SECTIONS")))
625 gimple_statement_omp_sections : public gimple_statement_omp
627 /* [ WORD 1-7 ] : base class */
629 /* [ WORD 8 ] */
630 tree clauses;
632 /* [ WORD 9 ]
633 The control variable used for deciding which of the sections to
634 execute. */
635 tree control;
638 /* GIMPLE_OMP_CONTINUE.
640 Note: This does not inherit from gimple_statement_omp, because we
641 do not need the body field. */
643 struct GTY((tag("GSS_OMP_CONTINUE")))
644 gimple_statement_omp_continue : public gimple_statement_base
646 /* [ WORD 1-6 ] : base class */
648 /* [ WORD 7 ] */
649 tree control_def;
651 /* [ WORD 8 ] */
652 tree control_use;
655 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
657 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
658 gimple_statement_omp_single_layout : public gimple_statement_omp
660 /* [ WORD 1-7 ] : base class */
662 /* [ WORD 7 ] */
663 tree clauses;
666 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
667 gimple_statement_omp_single : public gimple_statement_omp_single_layout
669 /* No extra fields; adds invariant:
670 stmt->code == GIMPLE_OMP_SINGLE. */
673 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
674 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
676 /* No extra fields; adds invariant:
677 stmt->code == GIMPLE_OMP_TEAMS. */
681 /* GIMPLE_OMP_ATOMIC_LOAD.
682 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
683 contains a sequence, which we don't need here. */
685 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
686 gimple_statement_omp_atomic_load : public gimple_statement_base
688 /* [ WORD 1-6 ] : base class */
690 /* [ WORD 7-8 ] */
691 tree rhs, lhs;
694 /* GIMPLE_OMP_ATOMIC_STORE.
695 See note on GIMPLE_OMP_ATOMIC_LOAD. */
697 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
698 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
700 /* [ WORD 1-6 ] : base class */
702 /* [ WORD 7 ] */
703 tree val;
706 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
707 gimple_statement_omp_atomic_store :
708 public gimple_statement_omp_atomic_store_layout
710 /* No extra fields; adds invariant:
711 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
714 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
715 gimple_statement_omp_return :
716 public gimple_statement_omp_atomic_store_layout
718 /* No extra fields; adds invariant:
719 stmt->code == GIMPLE_OMP_RETURN. */
722 /* GIMPLE_TRANSACTION. */
724 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
726 /* The __transaction_atomic was declared [[outer]] or it is
727 __transaction_relaxed. */
728 #define GTMA_IS_OUTER (1u << 0)
729 #define GTMA_IS_RELAXED (1u << 1)
730 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
732 /* The transaction is seen to not have an abort. */
733 #define GTMA_HAVE_ABORT (1u << 2)
734 /* The transaction is seen to have loads or stores. */
735 #define GTMA_HAVE_LOAD (1u << 3)
736 #define GTMA_HAVE_STORE (1u << 4)
737 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
738 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
739 /* The transaction WILL enter serial irrevocable mode.
740 An irrevocable block post-dominates the entire transaction, such
741 that all invocations of the transaction will go serial-irrevocable.
742 In such case, we don't bother instrumenting the transaction, and
743 tell the runtime that it should begin the transaction in
744 serial-irrevocable mode. */
745 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
746 /* The transaction contains no instrumentation code whatsover, most
747 likely because it is guaranteed to go irrevocable upon entry. */
748 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
750 struct GTY((tag("GSS_TRANSACTION")))
751 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
753 /* [ WORD 1-9 ] : base class */
755 /* [ WORD 10 ] */
756 gimple_seq body;
758 /* [ WORD 11 ] */
759 tree label;
762 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
763 enum gimple_statement_structure_enum {
764 #include "gsstruct.def"
765 LAST_GSS_ENUM
767 #undef DEFGSSTRUCT
769 template <>
770 template <>
771 inline bool
772 is_a_helper <gimple_statement_asm *>::test (gimple gs)
774 return gs->code == GIMPLE_ASM;
777 template <>
778 template <>
779 inline bool
780 is_a_helper <gimple_statement_bind *>::test (gimple gs)
782 return gs->code == GIMPLE_BIND;
785 template <>
786 template <>
787 inline bool
788 is_a_helper <gimple_statement_call *>::test (gimple gs)
790 return gs->code == GIMPLE_CALL;
793 template <>
794 template <>
795 inline bool
796 is_a_helper <gimple_statement_catch *>::test (gimple gs)
798 return gs->code == GIMPLE_CATCH;
801 template <>
802 template <>
803 inline bool
804 is_a_helper <gimple_statement_resx *>::test (gimple gs)
806 return gs->code == GIMPLE_RESX;
809 template <>
810 template <>
811 inline bool
812 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
814 return gs->code == GIMPLE_EH_DISPATCH;
817 template <>
818 template <>
819 inline bool
820 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
822 return gs->code == GIMPLE_EH_ELSE;
825 template <>
826 template <>
827 inline bool
828 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
830 return gs->code == GIMPLE_EH_FILTER;
833 template <>
834 template <>
835 inline bool
836 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
838 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
841 template <>
842 template <>
843 inline bool
844 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
846 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
849 template <>
850 template <>
851 inline bool
852 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
854 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
857 template <>
858 template <>
859 inline bool
860 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
862 return gs->code == GIMPLE_OMP_RETURN;
865 template <>
866 template <>
867 inline bool
868 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
870 return gs->code == GIMPLE_OMP_CONTINUE;
873 template <>
874 template <>
875 inline bool
876 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
878 return gs->code == GIMPLE_OMP_CRITICAL;
881 template <>
882 template <>
883 inline bool
884 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
886 return gs->code == GIMPLE_OMP_FOR;
889 template <>
890 template <>
891 inline bool
892 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
894 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
897 template <>
898 template <>
899 inline bool
900 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
902 return gs->code == GIMPLE_OMP_PARALLEL;
905 template <>
906 template <>
907 inline bool
908 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
910 return gs->code == GIMPLE_OMP_TARGET;
913 template <>
914 template <>
915 inline bool
916 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
918 return gs->code == GIMPLE_OMP_SECTIONS;
921 template <>
922 template <>
923 inline bool
924 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
926 return gs->code == GIMPLE_OMP_SINGLE;
929 template <>
930 template <>
931 inline bool
932 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
934 return gs->code == GIMPLE_OMP_TEAMS;
937 template <>
938 template <>
939 inline bool
940 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
942 return gs->code == GIMPLE_OMP_TASK;
945 template <>
946 template <>
947 inline bool
948 is_a_helper <gimple_statement_phi *>::test (gimple gs)
950 return gs->code == GIMPLE_PHI;
953 template <>
954 template <>
955 inline bool
956 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
958 return gs->code == GIMPLE_TRANSACTION;
961 template <>
962 template <>
963 inline bool
964 is_a_helper <gimple_statement_try *>::test (gimple gs)
966 return gs->code == GIMPLE_TRY;
969 template <>
970 template <>
971 inline bool
972 is_a_helper <gimple_statement_wce *>::test (gimple gs)
974 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
977 template <>
978 template <>
979 inline bool
980 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
982 return gs->code == GIMPLE_ASM;
985 template <>
986 template <>
987 inline bool
988 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
990 return gs->code == GIMPLE_BIND;
993 template <>
994 template <>
995 inline bool
996 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
998 return gs->code == GIMPLE_CALL;
1001 template <>
1002 template <>
1003 inline bool
1004 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1006 return gs->code == GIMPLE_CATCH;
1009 template <>
1010 template <>
1011 inline bool
1012 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1014 return gs->code == GIMPLE_RESX;
1017 template <>
1018 template <>
1019 inline bool
1020 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1022 return gs->code == GIMPLE_EH_DISPATCH;
1025 template <>
1026 template <>
1027 inline bool
1028 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1030 return gs->code == GIMPLE_EH_FILTER;
1033 template <>
1034 template <>
1035 inline bool
1036 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1038 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1041 template <>
1042 template <>
1043 inline bool
1044 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1046 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1049 template <>
1050 template <>
1051 inline bool
1052 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1054 return gs->code == GIMPLE_OMP_RETURN;
1057 template <>
1058 template <>
1059 inline bool
1060 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1062 return gs->code == GIMPLE_OMP_CONTINUE;
1065 template <>
1066 template <>
1067 inline bool
1068 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1070 return gs->code == GIMPLE_OMP_CRITICAL;
1073 template <>
1074 template <>
1075 inline bool
1076 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1078 return gs->code == GIMPLE_OMP_FOR;
1081 template <>
1082 template <>
1083 inline bool
1084 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1086 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1089 template <>
1090 template <>
1091 inline bool
1092 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1094 return gs->code == GIMPLE_OMP_PARALLEL;
1097 template <>
1098 template <>
1099 inline bool
1100 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1102 return gs->code == GIMPLE_OMP_TARGET;
1105 template <>
1106 template <>
1107 inline bool
1108 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1110 return gs->code == GIMPLE_OMP_SECTIONS;
1113 template <>
1114 template <>
1115 inline bool
1116 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1118 return gs->code == GIMPLE_OMP_SINGLE;
1121 template <>
1122 template <>
1123 inline bool
1124 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1126 return gs->code == GIMPLE_OMP_TEAMS;
1129 template <>
1130 template <>
1131 inline bool
1132 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1134 return gs->code == GIMPLE_OMP_TASK;
1137 template <>
1138 template <>
1139 inline bool
1140 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1142 return gs->code == GIMPLE_PHI;
1145 template <>
1146 template <>
1147 inline bool
1148 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1150 return gs->code == GIMPLE_TRANSACTION;
1153 /* Offset in bytes to the location of the operand vector.
1154 Zero if there is no operand vector for this tuple structure. */
1155 extern size_t const gimple_ops_offset_[];
1157 /* Map GIMPLE codes to GSS codes. */
1158 extern enum gimple_statement_structure_enum const gss_for_code_[];
1160 /* This variable holds the currently expanded gimple statement for purposes
1161 of comminucating the profile info to the builtin expanders. */
1162 extern gimple currently_expanding_gimple_stmt;
1164 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1165 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1166 gimple gimple_build_return (tree);
1167 void gimple_call_reset_alias_info (gimple);
1168 gimple gimple_build_call_vec (tree, vec<tree> );
1169 gimple gimple_build_call (tree, unsigned, ...);
1170 gimple gimple_build_call_valist (tree, unsigned, va_list);
1171 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1172 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1173 gimple gimple_build_call_from_tree (tree);
1174 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1175 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1176 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1177 tree, tree, tree CXX_MEM_STAT_INFO);
1178 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1179 tree, tree CXX_MEM_STAT_INFO);
1180 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1181 gimple gimple_build_cond_from_tree (tree, tree, tree);
1182 void gimple_cond_set_condition_from_tree (gimple, tree);
1183 gimple gimple_build_label (tree label);
1184 gimple gimple_build_goto (tree dest);
1185 gimple gimple_build_nop (void);
1186 gimple gimple_build_bind (tree, gimple_seq, tree);
1187 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1188 vec<tree, va_gc> *, vec<tree, va_gc> *,
1189 vec<tree, va_gc> *);
1190 gimple gimple_build_catch (tree, gimple_seq);
1191 gimple gimple_build_eh_filter (tree, gimple_seq);
1192 gimple gimple_build_eh_must_not_throw (tree);
1193 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1194 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1195 enum gimple_try_flags);
1196 gimple gimple_build_wce (gimple_seq);
1197 gimple gimple_build_resx (int);
1198 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1199 gimple gimple_build_switch (tree, tree, vec<tree> );
1200 gimple gimple_build_eh_dispatch (int);
1201 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1202 #define gimple_build_debug_bind(var,val,stmt) \
1203 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1204 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1205 #define gimple_build_debug_source_bind(var,val,stmt) \
1206 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1207 gimple gimple_build_omp_critical (gimple_seq, tree);
1208 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1209 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1210 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1211 gimple gimple_build_omp_section (gimple_seq);
1212 gimple gimple_build_omp_master (gimple_seq);
1213 gimple gimple_build_omp_taskgroup (gimple_seq);
1214 gimple gimple_build_omp_continue (tree, tree);
1215 gimple gimple_build_omp_ordered (gimple_seq);
1216 gimple gimple_build_omp_return (bool);
1217 gimple gimple_build_omp_sections (gimple_seq, tree);
1218 gimple gimple_build_omp_sections_switch (void);
1219 gimple gimple_build_omp_single (gimple_seq, tree);
1220 gimple gimple_build_omp_target (gimple_seq, int, tree);
1221 gimple gimple_build_omp_teams (gimple_seq, tree);
1222 gimple gimple_build_omp_atomic_load (tree, tree);
1223 gimple gimple_build_omp_atomic_store (tree);
1224 gimple gimple_build_transaction (gimple_seq, tree);
1225 gimple gimple_build_predict (enum br_predictor, enum prediction);
1226 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1227 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1228 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1229 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1230 location_t);
1231 extern void annotate_all_with_location (gimple_seq, location_t);
1232 bool empty_body_p (gimple_seq);
1233 gimple_seq gimple_seq_copy (gimple_seq);
1234 bool gimple_call_same_target_p (const_gimple, const_gimple);
1235 int gimple_call_flags (const_gimple);
1236 int gimple_call_arg_flags (const_gimple, unsigned);
1237 int gimple_call_return_flags (const_gimple);
1238 bool gimple_assign_copy_p (gimple);
1239 bool gimple_assign_ssa_name_copy_p (gimple);
1240 bool gimple_assign_unary_nop_p (gimple);
1241 void gimple_set_bb (gimple, basic_block);
1242 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1243 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1244 tree, tree, tree);
1245 tree gimple_get_lhs (const_gimple);
1246 void gimple_set_lhs (gimple, tree);
1247 gimple gimple_copy (gimple);
1248 bool gimple_has_side_effects (const_gimple);
1249 bool gimple_could_trap_p_1 (gimple, bool, bool);
1250 bool gimple_could_trap_p (gimple);
1251 bool gimple_assign_rhs_could_trap_p (gimple);
1252 extern void dump_gimple_statistics (void);
1253 unsigned get_gimple_rhs_num_ops (enum tree_code);
1254 extern tree canonicalize_cond_expr_cond (tree);
1255 gimple gimple_call_copy_skip_args (gimple, bitmap);
1256 extern bool gimple_compare_field_offset (tree, tree);
1257 extern tree gimple_unsigned_type (tree);
1258 extern tree gimple_signed_type (tree);
1259 extern alias_set_type gimple_get_alias_set (tree);
1260 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1261 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1262 extern bool gimple_call_builtin_p (const_gimple);
1263 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1264 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1265 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1266 extern void dump_decl_set (FILE *, bitmap);
1267 extern bool nonfreeing_call_p (gimple);
1268 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1269 extern void sort_case_labels (vec<tree> );
1270 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1271 extern void gimple_seq_set_location (gimple_seq , location_t);
1273 /* Formal (expression) temporary table handling: multiple occurrences of
1274 the same scalar expression are evaluated into the same temporary. */
1276 typedef struct gimple_temp_hash_elt
1278 tree val; /* Key */
1279 tree temp; /* Value */
1280 } elt_t;
1282 /* Get the number of the next statement uid to be allocated. */
1283 static inline unsigned int
1284 gimple_stmt_max_uid (struct function *fn)
1286 return fn->last_stmt_uid;
1289 /* Set the number of the next statement uid to be allocated. */
1290 static inline void
1291 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1293 fn->last_stmt_uid = maxid;
1296 /* Set the number of the next statement uid to be allocated. */
1297 static inline unsigned int
1298 inc_gimple_stmt_max_uid (struct function *fn)
1300 return fn->last_stmt_uid++;
1303 /* Return the first node in GIMPLE sequence S. */
1305 static inline gimple_seq_node
1306 gimple_seq_first (gimple_seq s)
1308 return s;
1312 /* Return the first statement in GIMPLE sequence S. */
1314 static inline gimple
1315 gimple_seq_first_stmt (gimple_seq s)
1317 gimple_seq_node n = gimple_seq_first (s);
1318 return n;
1322 /* Return the last node in GIMPLE sequence S. */
1324 static inline gimple_seq_node
1325 gimple_seq_last (gimple_seq s)
1327 return s ? s->prev : NULL;
1331 /* Return the last statement in GIMPLE sequence S. */
1333 static inline gimple
1334 gimple_seq_last_stmt (gimple_seq s)
1336 gimple_seq_node n = gimple_seq_last (s);
1337 return n;
1341 /* Set the last node in GIMPLE sequence *PS to LAST. */
1343 static inline void
1344 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1346 (*ps)->prev = last;
1350 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1352 static inline void
1353 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1355 *ps = first;
1359 /* Return true if GIMPLE sequence S is empty. */
1361 static inline bool
1362 gimple_seq_empty_p (gimple_seq s)
1364 return s == NULL;
1367 /* Allocate a new sequence and initialize its first element with STMT. */
1369 static inline gimple_seq
1370 gimple_seq_alloc_with_stmt (gimple stmt)
1372 gimple_seq seq = NULL;
1373 gimple_seq_add_stmt (&seq, stmt);
1374 return seq;
1378 /* Returns the sequence of statements in BB. */
1380 static inline gimple_seq
1381 bb_seq (const_basic_block bb)
1383 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1386 static inline gimple_seq *
1387 bb_seq_addr (basic_block bb)
1389 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1392 /* Sets the sequence of statements in BB to SEQ. */
1394 static inline void
1395 set_bb_seq (basic_block bb, gimple_seq seq)
1397 gcc_checking_assert (!(bb->flags & BB_RTL));
1398 bb->il.gimple.seq = seq;
1402 /* Return the code for GIMPLE statement G. */
1404 static inline enum gimple_code
1405 gimple_code (const_gimple g)
1407 return g->code;
1411 /* Return the GSS code used by a GIMPLE code. */
1413 static inline enum gimple_statement_structure_enum
1414 gss_for_code (enum gimple_code code)
1416 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1417 return gss_for_code_[code];
1421 /* Return which GSS code is used by GS. */
1423 static inline enum gimple_statement_structure_enum
1424 gimple_statement_structure (gimple gs)
1426 return gss_for_code (gimple_code (gs));
1430 /* Return true if statement G has sub-statements. This is only true for
1431 High GIMPLE statements. */
1433 static inline bool
1434 gimple_has_substatements (gimple g)
1436 switch (gimple_code (g))
1438 case GIMPLE_BIND:
1439 case GIMPLE_CATCH:
1440 case GIMPLE_EH_FILTER:
1441 case GIMPLE_EH_ELSE:
1442 case GIMPLE_TRY:
1443 case GIMPLE_OMP_FOR:
1444 case GIMPLE_OMP_MASTER:
1445 case GIMPLE_OMP_TASKGROUP:
1446 case GIMPLE_OMP_ORDERED:
1447 case GIMPLE_OMP_SECTION:
1448 case GIMPLE_OMP_PARALLEL:
1449 case GIMPLE_OMP_TASK:
1450 case GIMPLE_OMP_SECTIONS:
1451 case GIMPLE_OMP_SINGLE:
1452 case GIMPLE_OMP_TARGET:
1453 case GIMPLE_OMP_TEAMS:
1454 case GIMPLE_OMP_CRITICAL:
1455 case GIMPLE_WITH_CLEANUP_EXPR:
1456 case GIMPLE_TRANSACTION:
1457 return true;
1459 default:
1460 return false;
1465 /* Return the basic block holding statement G. */
1467 static inline basic_block
1468 gimple_bb (const_gimple g)
1470 return g->bb;
1474 /* Return the lexical scope block holding statement G. */
1476 static inline tree
1477 gimple_block (const_gimple g)
1479 return LOCATION_BLOCK (g->location);
1483 /* Set BLOCK to be the lexical scope block holding statement G. */
1485 static inline void
1486 gimple_set_block (gimple g, tree block)
1488 if (block)
1489 g->location =
1490 COMBINE_LOCATION_DATA (line_table, g->location, block);
1491 else
1492 g->location = LOCATION_LOCUS (g->location);
1496 /* Return location information for statement G. */
1498 static inline location_t
1499 gimple_location (const_gimple g)
1501 return g->location;
1504 /* Return pointer to location information for statement G. */
1506 static inline const location_t *
1507 gimple_location_ptr (const_gimple g)
1509 return &g->location;
1513 /* Set location information for statement G. */
1515 static inline void
1516 gimple_set_location (gimple g, location_t location)
1518 g->location = location;
1522 /* Return true if G contains location information. */
1524 static inline bool
1525 gimple_has_location (const_gimple g)
1527 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1531 /* Return the file name of the location of STMT. */
1533 static inline const char *
1534 gimple_filename (const_gimple stmt)
1536 return LOCATION_FILE (gimple_location (stmt));
1540 /* Return the line number of the location of STMT. */
1542 static inline int
1543 gimple_lineno (const_gimple stmt)
1545 return LOCATION_LINE (gimple_location (stmt));
1549 /* Determine whether SEQ is a singleton. */
1551 static inline bool
1552 gimple_seq_singleton_p (gimple_seq seq)
1554 return ((gimple_seq_first (seq) != NULL)
1555 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1558 /* Return true if no warnings should be emitted for statement STMT. */
1560 static inline bool
1561 gimple_no_warning_p (const_gimple stmt)
1563 return stmt->no_warning;
1566 /* Set the no_warning flag of STMT to NO_WARNING. */
1568 static inline void
1569 gimple_set_no_warning (gimple stmt, bool no_warning)
1571 stmt->no_warning = (unsigned) no_warning;
1574 /* Set the visited status on statement STMT to VISITED_P. */
1576 static inline void
1577 gimple_set_visited (gimple stmt, bool visited_p)
1579 stmt->visited = (unsigned) visited_p;
1583 /* Return the visited status for statement STMT. */
1585 static inline bool
1586 gimple_visited_p (gimple stmt)
1588 return stmt->visited;
1592 /* Set pass local flag PLF on statement STMT to VAL_P. */
1594 static inline void
1595 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1597 if (val_p)
1598 stmt->plf |= (unsigned int) plf;
1599 else
1600 stmt->plf &= ~((unsigned int) plf);
1604 /* Return the value of pass local flag PLF on statement STMT. */
1606 static inline unsigned int
1607 gimple_plf (gimple stmt, enum plf_mask plf)
1609 return stmt->plf & ((unsigned int) plf);
1613 /* Set the UID of statement. */
1615 static inline void
1616 gimple_set_uid (gimple g, unsigned uid)
1618 g->uid = uid;
1622 /* Return the UID of statement. */
1624 static inline unsigned
1625 gimple_uid (const_gimple g)
1627 return g->uid;
1631 /* Make statement G a singleton sequence. */
1633 static inline void
1634 gimple_init_singleton (gimple g)
1636 g->next = NULL;
1637 g->prev = g;
1641 /* Return true if GIMPLE statement G has register or memory operands. */
1643 static inline bool
1644 gimple_has_ops (const_gimple g)
1646 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1649 template <>
1650 template <>
1651 inline bool
1652 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1654 return gimple_has_ops (gs);
1657 template <>
1658 template <>
1659 inline bool
1660 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1662 return gimple_has_ops (gs);
1665 /* Return true if GIMPLE statement G has memory operands. */
1667 static inline bool
1668 gimple_has_mem_ops (const_gimple g)
1670 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1673 template <>
1674 template <>
1675 inline bool
1676 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1678 return gimple_has_mem_ops (gs);
1681 template <>
1682 template <>
1683 inline bool
1684 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1686 return gimple_has_mem_ops (gs);
1689 /* Return the set of USE operands for statement G. */
1691 static inline struct use_optype_d *
1692 gimple_use_ops (const_gimple g)
1694 const gimple_statement_with_ops *ops_stmt =
1695 dyn_cast <const gimple_statement_with_ops *> (g);
1696 if (!ops_stmt)
1697 return NULL;
1698 return ops_stmt->use_ops;
1702 /* Set USE to be the set of USE operands for statement G. */
1704 static inline void
1705 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1707 gimple_statement_with_ops *ops_stmt =
1708 as_a <gimple_statement_with_ops *> (g);
1709 ops_stmt->use_ops = use;
1713 /* Return the single VUSE operand of the statement G. */
1715 static inline tree
1716 gimple_vuse (const_gimple g)
1718 const gimple_statement_with_memory_ops *mem_ops_stmt =
1719 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1720 if (!mem_ops_stmt)
1721 return NULL_TREE;
1722 return mem_ops_stmt->vuse;
1725 /* Return the single VDEF operand of the statement G. */
1727 static inline tree
1728 gimple_vdef (const_gimple g)
1730 const gimple_statement_with_memory_ops *mem_ops_stmt =
1731 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1732 if (!mem_ops_stmt)
1733 return NULL_TREE;
1734 return mem_ops_stmt->vdef;
1737 /* Return the single VUSE operand of the statement G. */
1739 static inline tree *
1740 gimple_vuse_ptr (gimple g)
1742 gimple_statement_with_memory_ops *mem_ops_stmt =
1743 dyn_cast <gimple_statement_with_memory_ops *> (g);
1744 if (!mem_ops_stmt)
1745 return NULL;
1746 return &mem_ops_stmt->vuse;
1749 /* Return the single VDEF operand of the statement G. */
1751 static inline tree *
1752 gimple_vdef_ptr (gimple g)
1754 gimple_statement_with_memory_ops *mem_ops_stmt =
1755 dyn_cast <gimple_statement_with_memory_ops *> (g);
1756 if (!mem_ops_stmt)
1757 return NULL;
1758 return &mem_ops_stmt->vdef;
1761 /* Set the single VUSE operand of the statement G. */
1763 static inline void
1764 gimple_set_vuse (gimple g, tree vuse)
1766 gimple_statement_with_memory_ops *mem_ops_stmt =
1767 as_a <gimple_statement_with_memory_ops *> (g);
1768 mem_ops_stmt->vuse = vuse;
1771 /* Set the single VDEF operand of the statement G. */
1773 static inline void
1774 gimple_set_vdef (gimple g, tree vdef)
1776 gimple_statement_with_memory_ops *mem_ops_stmt =
1777 as_a <gimple_statement_with_memory_ops *> (g);
1778 mem_ops_stmt->vdef = vdef;
1782 /* Return true if statement G has operands and the modified field has
1783 been set. */
1785 static inline bool
1786 gimple_modified_p (const_gimple g)
1788 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1792 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1793 a MODIFIED field. */
1795 static inline void
1796 gimple_set_modified (gimple s, bool modifiedp)
1798 if (gimple_has_ops (s))
1799 s->modified = (unsigned) modifiedp;
1803 /* Return the tree code for the expression computed by STMT. This is
1804 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1805 GIMPLE_CALL, return CALL_EXPR as the expression code for
1806 consistency. This is useful when the caller needs to deal with the
1807 three kinds of computation that GIMPLE supports. */
1809 static inline enum tree_code
1810 gimple_expr_code (const_gimple stmt)
1812 enum gimple_code code = gimple_code (stmt);
1813 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1814 return (enum tree_code) stmt->subcode;
1815 else
1817 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1818 return CALL_EXPR;
1823 /* Return true if statement STMT contains volatile operands. */
1825 static inline bool
1826 gimple_has_volatile_ops (const_gimple stmt)
1828 if (gimple_has_mem_ops (stmt))
1829 return stmt->has_volatile_ops;
1830 else
1831 return false;
1835 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1837 static inline void
1838 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1840 if (gimple_has_mem_ops (stmt))
1841 stmt->has_volatile_ops = (unsigned) volatilep;
1844 /* Return true if STMT is in a transaction. */
1846 static inline bool
1847 gimple_in_transaction (gimple stmt)
1849 return bb_in_transaction (gimple_bb (stmt));
1852 /* Return true if statement STMT may access memory. */
1854 static inline bool
1855 gimple_references_memory_p (gimple stmt)
1857 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1861 /* Return the subcode for OMP statement S. */
1863 static inline unsigned
1864 gimple_omp_subcode (const_gimple s)
1866 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1867 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1868 return s->subcode;
1871 /* Set the subcode for OMP statement S to SUBCODE. */
1873 static inline void
1874 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1876 /* We only have 16 bits for the subcode. Assert that we are not
1877 overflowing it. */
1878 gcc_gimple_checking_assert (subcode < (1 << 16));
1879 s->subcode = subcode;
1882 /* Set the nowait flag on OMP_RETURN statement S. */
1884 static inline void
1885 gimple_omp_return_set_nowait (gimple s)
1887 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1888 s->subcode |= GF_OMP_RETURN_NOWAIT;
1892 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1893 flag set. */
1895 static inline bool
1896 gimple_omp_return_nowait_p (const_gimple g)
1898 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1899 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1903 /* Set the LHS of OMP return. */
1905 static inline void
1906 gimple_omp_return_set_lhs (gimple g, tree lhs)
1908 gimple_statement_omp_return *omp_return_stmt =
1909 as_a <gimple_statement_omp_return *> (g);
1910 omp_return_stmt->val = lhs;
1914 /* Get the LHS of OMP return. */
1916 static inline tree
1917 gimple_omp_return_lhs (const_gimple g)
1919 const gimple_statement_omp_return *omp_return_stmt =
1920 as_a <const gimple_statement_omp_return *> (g);
1921 return omp_return_stmt->val;
1925 /* Return a pointer to the LHS of OMP return. */
1927 static inline tree *
1928 gimple_omp_return_lhs_ptr (gimple g)
1930 gimple_statement_omp_return *omp_return_stmt =
1931 as_a <gimple_statement_omp_return *> (g);
1932 return &omp_return_stmt->val;
1936 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1937 flag set. */
1939 static inline bool
1940 gimple_omp_section_last_p (const_gimple g)
1942 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1943 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1947 /* Set the GF_OMP_SECTION_LAST flag on G. */
1949 static inline void
1950 gimple_omp_section_set_last (gimple g)
1952 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1953 g->subcode |= GF_OMP_SECTION_LAST;
1957 /* Return true if OMP parallel statement G has the
1958 GF_OMP_PARALLEL_COMBINED flag set. */
1960 static inline bool
1961 gimple_omp_parallel_combined_p (const_gimple g)
1963 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1964 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1968 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1969 value of COMBINED_P. */
1971 static inline void
1972 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1974 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1975 if (combined_p)
1976 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1977 else
1978 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1982 /* Return true if OMP atomic load/store statement G has the
1983 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1985 static inline bool
1986 gimple_omp_atomic_need_value_p (const_gimple g)
1988 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1989 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
1990 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
1994 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
1996 static inline void
1997 gimple_omp_atomic_set_need_value (gimple g)
1999 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2000 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2001 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2005 /* Return true if OMP atomic load/store statement G has the
2006 GF_OMP_ATOMIC_SEQ_CST flag set. */
2008 static inline bool
2009 gimple_omp_atomic_seq_cst_p (const_gimple g)
2011 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2012 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2013 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2017 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2019 static inline void
2020 gimple_omp_atomic_set_seq_cst (gimple g)
2022 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2023 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2024 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2028 /* Return the number of operands for statement GS. */
2030 static inline unsigned
2031 gimple_num_ops (const_gimple gs)
2033 return gs->num_ops;
2037 /* Set the number of operands for statement GS. */
2039 static inline void
2040 gimple_set_num_ops (gimple gs, unsigned num_ops)
2042 gs->num_ops = num_ops;
2046 /* Return the array of operands for statement GS. */
2048 static inline tree *
2049 gimple_ops (gimple gs)
2051 size_t off;
2053 /* All the tuples have their operand vector at the very bottom
2054 of the structure. Note that those structures that do not
2055 have an operand vector have a zero offset. */
2056 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2057 gcc_gimple_checking_assert (off != 0);
2059 return (tree *) ((char *) gs + off);
2063 /* Return operand I for statement GS. */
2065 static inline tree
2066 gimple_op (const_gimple gs, unsigned i)
2068 if (gimple_has_ops (gs))
2070 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2071 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2073 else
2074 return NULL_TREE;
2077 /* Return a pointer to operand I for statement GS. */
2079 static inline tree *
2080 gimple_op_ptr (const_gimple gs, unsigned i)
2082 if (gimple_has_ops (gs))
2084 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2085 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2087 else
2088 return NULL;
2091 /* Set operand I of statement GS to OP. */
2093 static inline void
2094 gimple_set_op (gimple gs, unsigned i, tree op)
2096 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2098 /* Note. It may be tempting to assert that OP matches
2099 is_gimple_operand, but that would be wrong. Different tuples
2100 accept slightly different sets of tree operands. Each caller
2101 should perform its own validation. */
2102 gimple_ops (gs)[i] = op;
2105 /* Return true if GS is a GIMPLE_ASSIGN. */
2107 static inline bool
2108 is_gimple_assign (const_gimple gs)
2110 return gimple_code (gs) == GIMPLE_ASSIGN;
2113 /* Determine if expression CODE is one of the valid expressions that can
2114 be used on the RHS of GIMPLE assignments. */
2116 static inline enum gimple_rhs_class
2117 get_gimple_rhs_class (enum tree_code code)
2119 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2122 /* Return the LHS of assignment statement GS. */
2124 static inline tree
2125 gimple_assign_lhs (const_gimple gs)
2127 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2128 return gimple_op (gs, 0);
2132 /* Return a pointer to the LHS of assignment statement GS. */
2134 static inline tree *
2135 gimple_assign_lhs_ptr (const_gimple gs)
2137 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2138 return gimple_op_ptr (gs, 0);
2142 /* Set LHS to be the LHS operand of assignment statement GS. */
2144 static inline void
2145 gimple_assign_set_lhs (gimple gs, tree lhs)
2147 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2148 gimple_set_op (gs, 0, lhs);
2150 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2151 SSA_NAME_DEF_STMT (lhs) = gs;
2155 /* Return the first operand on the RHS of assignment statement GS. */
2157 static inline tree
2158 gimple_assign_rhs1 (const_gimple gs)
2160 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2161 return gimple_op (gs, 1);
2165 /* Return a pointer to the first operand on the RHS of assignment
2166 statement GS. */
2168 static inline tree *
2169 gimple_assign_rhs1_ptr (const_gimple gs)
2171 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2172 return gimple_op_ptr (gs, 1);
2175 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2177 static inline void
2178 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2180 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2182 gimple_set_op (gs, 1, rhs);
2186 /* Return the second operand on the RHS of assignment statement GS.
2187 If GS does not have two operands, NULL is returned instead. */
2189 static inline tree
2190 gimple_assign_rhs2 (const_gimple gs)
2192 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2194 if (gimple_num_ops (gs) >= 3)
2195 return gimple_op (gs, 2);
2196 else
2197 return NULL_TREE;
2201 /* Return a pointer to the second operand on the RHS of assignment
2202 statement GS. */
2204 static inline tree *
2205 gimple_assign_rhs2_ptr (const_gimple gs)
2207 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2208 return gimple_op_ptr (gs, 2);
2212 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2214 static inline void
2215 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2217 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2219 gimple_set_op (gs, 2, rhs);
2222 /* Return the third operand on the RHS of assignment statement GS.
2223 If GS does not have two operands, NULL is returned instead. */
2225 static inline tree
2226 gimple_assign_rhs3 (const_gimple gs)
2228 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2230 if (gimple_num_ops (gs) >= 4)
2231 return gimple_op (gs, 3);
2232 else
2233 return NULL_TREE;
2236 /* Return a pointer to the third operand on the RHS of assignment
2237 statement GS. */
2239 static inline tree *
2240 gimple_assign_rhs3_ptr (const_gimple gs)
2242 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2243 return gimple_op_ptr (gs, 3);
2247 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2249 static inline void
2250 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2252 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2254 gimple_set_op (gs, 3, rhs);
2257 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2258 to see only a maximum of two operands. */
2260 static inline void
2261 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2262 tree op1, tree op2)
2264 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2267 /* Returns true if GS is a nontemporal move. */
2269 static inline bool
2270 gimple_assign_nontemporal_move_p (const_gimple gs)
2272 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2273 return gs->nontemporal_move;
2276 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2278 static inline void
2279 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2281 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2282 gs->nontemporal_move = nontemporal;
2286 /* Return the code of the expression computed on the rhs of assignment
2287 statement GS. In case that the RHS is a single object, returns the
2288 tree code of the object. */
2290 static inline enum tree_code
2291 gimple_assign_rhs_code (const_gimple gs)
2293 enum tree_code code;
2294 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2296 code = (enum tree_code) gs->subcode;
2297 /* While we initially set subcode to the TREE_CODE of the rhs for
2298 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2299 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2300 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2301 code = TREE_CODE (gimple_assign_rhs1 (gs));
2303 return code;
2307 /* Set CODE to be the code for the expression computed on the RHS of
2308 assignment S. */
2310 static inline void
2311 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2313 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2314 s->subcode = code;
2318 /* Return the gimple rhs class of the code of the expression computed on
2319 the rhs of assignment statement GS.
2320 This will never return GIMPLE_INVALID_RHS. */
2322 static inline enum gimple_rhs_class
2323 gimple_assign_rhs_class (const_gimple gs)
2325 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2328 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2329 there is no operator associated with the assignment itself.
2330 Unlike gimple_assign_copy_p, this predicate returns true for
2331 any RHS operand, including those that perform an operation
2332 and do not have the semantics of a copy, such as COND_EXPR. */
2334 static inline bool
2335 gimple_assign_single_p (const_gimple gs)
2337 return (is_gimple_assign (gs)
2338 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2341 /* Return true if GS performs a store to its lhs. */
2343 static inline bool
2344 gimple_store_p (const_gimple gs)
2346 tree lhs = gimple_get_lhs (gs);
2347 return lhs && !is_gimple_reg (lhs);
2350 /* Return true if GS is an assignment that loads from its rhs1. */
2352 static inline bool
2353 gimple_assign_load_p (const_gimple gs)
2355 tree rhs;
2356 if (!gimple_assign_single_p (gs))
2357 return false;
2358 rhs = gimple_assign_rhs1 (gs);
2359 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2360 return true;
2361 rhs = get_base_address (rhs);
2362 return (DECL_P (rhs)
2363 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2367 /* Return true if S is a type-cast assignment. */
2369 static inline bool
2370 gimple_assign_cast_p (const_gimple s)
2372 if (is_gimple_assign (s))
2374 enum tree_code sc = gimple_assign_rhs_code (s);
2375 return CONVERT_EXPR_CODE_P (sc)
2376 || sc == VIEW_CONVERT_EXPR
2377 || sc == FIX_TRUNC_EXPR;
2380 return false;
2383 /* Return true if S is a clobber statement. */
2385 static inline bool
2386 gimple_clobber_p (const_gimple s)
2388 return gimple_assign_single_p (s)
2389 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2392 /* Return true if GS is a GIMPLE_CALL. */
2394 static inline bool
2395 is_gimple_call (const_gimple gs)
2397 return gimple_code (gs) == GIMPLE_CALL;
2400 /* Return the LHS of call statement GS. */
2402 static inline tree
2403 gimple_call_lhs (const_gimple gs)
2405 GIMPLE_CHECK (gs, GIMPLE_CALL);
2406 return gimple_op (gs, 0);
2410 /* Return a pointer to the LHS of call statement GS. */
2412 static inline tree *
2413 gimple_call_lhs_ptr (const_gimple gs)
2415 GIMPLE_CHECK (gs, GIMPLE_CALL);
2416 return gimple_op_ptr (gs, 0);
2420 /* Set LHS to be the LHS operand of call statement GS. */
2422 static inline void
2423 gimple_call_set_lhs (gimple gs, tree lhs)
2425 GIMPLE_CHECK (gs, GIMPLE_CALL);
2426 gimple_set_op (gs, 0, lhs);
2427 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2428 SSA_NAME_DEF_STMT (lhs) = gs;
2432 /* Return true if call GS calls an internal-only function, as enumerated
2433 by internal_fn. */
2435 static inline bool
2436 gimple_call_internal_p (const_gimple gs)
2438 GIMPLE_CHECK (gs, GIMPLE_CALL);
2439 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2443 /* Return the target of internal call GS. */
2445 static inline enum internal_fn
2446 gimple_call_internal_fn (const_gimple gs)
2448 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2449 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2453 /* Return the function type of the function called by GS. */
2455 static inline tree
2456 gimple_call_fntype (const_gimple gs)
2458 const gimple_statement_call *call_stmt =
2459 as_a <const gimple_statement_call *> (gs);
2460 if (gimple_call_internal_p (gs))
2461 return NULL_TREE;
2462 return call_stmt->u.fntype;
2465 /* Set the type of the function called by GS to FNTYPE. */
2467 static inline void
2468 gimple_call_set_fntype (gimple gs, tree fntype)
2470 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2471 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2472 call_stmt->u.fntype = fntype;
2476 /* Return the tree node representing the function called by call
2477 statement GS. */
2479 static inline tree
2480 gimple_call_fn (const_gimple gs)
2482 GIMPLE_CHECK (gs, GIMPLE_CALL);
2483 return gimple_op (gs, 1);
2486 /* Return a pointer to the tree node representing the function called by call
2487 statement GS. */
2489 static inline tree *
2490 gimple_call_fn_ptr (const_gimple gs)
2492 GIMPLE_CHECK (gs, GIMPLE_CALL);
2493 return gimple_op_ptr (gs, 1);
2497 /* Set FN to be the function called by call statement GS. */
2499 static inline void
2500 gimple_call_set_fn (gimple gs, tree fn)
2502 GIMPLE_CHECK (gs, GIMPLE_CALL);
2503 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2504 gimple_set_op (gs, 1, fn);
2508 /* Set FNDECL to be the function called by call statement GS. */
2510 static inline void
2511 gimple_call_set_fndecl (gimple gs, tree decl)
2513 GIMPLE_CHECK (gs, GIMPLE_CALL);
2514 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2515 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2519 /* Set internal function FN to be the function called by call statement GS. */
2521 static inline void
2522 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2524 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2525 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2526 call_stmt->u.internal_fn = fn;
2530 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2531 Otherwise return NULL. This function is analogous to
2532 get_callee_fndecl in tree land. */
2534 static inline tree
2535 gimple_call_fndecl (const_gimple gs)
2537 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2541 /* Return the type returned by call statement GS. */
2543 static inline tree
2544 gimple_call_return_type (const_gimple gs)
2546 tree type = gimple_call_fntype (gs);
2548 if (type == NULL_TREE)
2549 return TREE_TYPE (gimple_call_lhs (gs));
2551 /* The type returned by a function is the type of its
2552 function type. */
2553 return TREE_TYPE (type);
2557 /* Return the static chain for call statement GS. */
2559 static inline tree
2560 gimple_call_chain (const_gimple gs)
2562 GIMPLE_CHECK (gs, GIMPLE_CALL);
2563 return gimple_op (gs, 2);
2567 /* Return a pointer to the static chain for call statement GS. */
2569 static inline tree *
2570 gimple_call_chain_ptr (const_gimple gs)
2572 GIMPLE_CHECK (gs, GIMPLE_CALL);
2573 return gimple_op_ptr (gs, 2);
2576 /* Set CHAIN to be the static chain for call statement GS. */
2578 static inline void
2579 gimple_call_set_chain (gimple gs, tree chain)
2581 GIMPLE_CHECK (gs, GIMPLE_CALL);
2583 gimple_set_op (gs, 2, chain);
2587 /* Return the number of arguments used by call statement GS. */
2589 static inline unsigned
2590 gimple_call_num_args (const_gimple gs)
2592 unsigned num_ops;
2593 GIMPLE_CHECK (gs, GIMPLE_CALL);
2594 num_ops = gimple_num_ops (gs);
2595 return num_ops - 3;
2599 /* Return the argument at position INDEX for call statement GS. */
2601 static inline tree
2602 gimple_call_arg (const_gimple gs, unsigned index)
2604 GIMPLE_CHECK (gs, GIMPLE_CALL);
2605 return gimple_op (gs, index + 3);
2609 /* Return a pointer to the argument at position INDEX for call
2610 statement GS. */
2612 static inline tree *
2613 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2615 GIMPLE_CHECK (gs, GIMPLE_CALL);
2616 return gimple_op_ptr (gs, index + 3);
2620 /* Set ARG to be the argument at position INDEX for call statement GS. */
2622 static inline void
2623 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2625 GIMPLE_CHECK (gs, GIMPLE_CALL);
2626 gimple_set_op (gs, index + 3, arg);
2630 /* If TAIL_P is true, mark call statement S as being a tail call
2631 (i.e., a call just before the exit of a function). These calls are
2632 candidate for tail call optimization. */
2634 static inline void
2635 gimple_call_set_tail (gimple s, bool tail_p)
2637 GIMPLE_CHECK (s, GIMPLE_CALL);
2638 if (tail_p)
2639 s->subcode |= GF_CALL_TAILCALL;
2640 else
2641 s->subcode &= ~GF_CALL_TAILCALL;
2645 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2647 static inline bool
2648 gimple_call_tail_p (gimple s)
2650 GIMPLE_CHECK (s, GIMPLE_CALL);
2651 return (s->subcode & GF_CALL_TAILCALL) != 0;
2655 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2656 slot optimization. This transformation uses the target of the call
2657 expansion as the return slot for calls that return in memory. */
2659 static inline void
2660 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2662 GIMPLE_CHECK (s, GIMPLE_CALL);
2663 if (return_slot_opt_p)
2664 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2665 else
2666 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2670 /* Return true if S is marked for return slot optimization. */
2672 static inline bool
2673 gimple_call_return_slot_opt_p (gimple s)
2675 GIMPLE_CHECK (s, GIMPLE_CALL);
2676 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2680 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2681 thunk to the thunked-to function. */
2683 static inline void
2684 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2686 GIMPLE_CHECK (s, GIMPLE_CALL);
2687 if (from_thunk_p)
2688 s->subcode |= GF_CALL_FROM_THUNK;
2689 else
2690 s->subcode &= ~GF_CALL_FROM_THUNK;
2694 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2696 static inline bool
2697 gimple_call_from_thunk_p (gimple s)
2699 GIMPLE_CHECK (s, GIMPLE_CALL);
2700 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2704 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2705 argument pack in its argument list. */
2707 static inline void
2708 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2710 GIMPLE_CHECK (s, GIMPLE_CALL);
2711 if (pass_arg_pack_p)
2712 s->subcode |= GF_CALL_VA_ARG_PACK;
2713 else
2714 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2718 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2719 argument pack in its argument list. */
2721 static inline bool
2722 gimple_call_va_arg_pack_p (gimple s)
2724 GIMPLE_CHECK (s, GIMPLE_CALL);
2725 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2729 /* Return true if S is a noreturn call. */
2731 static inline bool
2732 gimple_call_noreturn_p (gimple s)
2734 GIMPLE_CHECK (s, GIMPLE_CALL);
2735 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2739 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2740 even if the called function can throw in other cases. */
2742 static inline void
2743 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2745 GIMPLE_CHECK (s, GIMPLE_CALL);
2746 if (nothrow_p)
2747 s->subcode |= GF_CALL_NOTHROW;
2748 else
2749 s->subcode &= ~GF_CALL_NOTHROW;
2752 /* Return true if S is a nothrow call. */
2754 static inline bool
2755 gimple_call_nothrow_p (gimple s)
2757 GIMPLE_CHECK (s, GIMPLE_CALL);
2758 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2761 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2762 is known to be emitted for VLA objects. Those are wrapped by
2763 stack_save/stack_restore calls and hence can't lead to unbounded
2764 stack growth even when they occur in loops. */
2766 static inline void
2767 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2769 GIMPLE_CHECK (s, GIMPLE_CALL);
2770 if (for_var)
2771 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2772 else
2773 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2776 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2778 static inline bool
2779 gimple_call_alloca_for_var_p (gimple s)
2781 GIMPLE_CHECK (s, GIMPLE_CALL);
2782 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2785 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2787 static inline void
2788 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2790 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2791 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2792 dest_call->subcode = orig_call->subcode;
2796 /* Return a pointer to the points-to solution for the set of call-used
2797 variables of the call CALL. */
2799 static inline struct pt_solution *
2800 gimple_call_use_set (gimple call)
2802 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2803 return &call_stmt->call_used;
2807 /* Return a pointer to the points-to solution for the set of call-used
2808 variables of the call CALL. */
2810 static inline struct pt_solution *
2811 gimple_call_clobber_set (gimple call)
2813 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2814 return &call_stmt->call_clobbered;
2818 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2819 non-NULL lhs. */
2821 static inline bool
2822 gimple_has_lhs (gimple stmt)
2824 return (is_gimple_assign (stmt)
2825 || (is_gimple_call (stmt)
2826 && gimple_call_lhs (stmt) != NULL_TREE));
2830 /* Return the code of the predicate computed by conditional statement GS. */
2832 static inline enum tree_code
2833 gimple_cond_code (const_gimple gs)
2835 GIMPLE_CHECK (gs, GIMPLE_COND);
2836 return (enum tree_code) gs->subcode;
2840 /* Set CODE to be the predicate code for the conditional statement GS. */
2842 static inline void
2843 gimple_cond_set_code (gimple gs, enum tree_code code)
2845 GIMPLE_CHECK (gs, GIMPLE_COND);
2846 gs->subcode = code;
2850 /* Return the LHS of the predicate computed by conditional statement GS. */
2852 static inline tree
2853 gimple_cond_lhs (const_gimple gs)
2855 GIMPLE_CHECK (gs, GIMPLE_COND);
2856 return gimple_op (gs, 0);
2859 /* Return the pointer to the LHS of the predicate computed by conditional
2860 statement GS. */
2862 static inline tree *
2863 gimple_cond_lhs_ptr (const_gimple gs)
2865 GIMPLE_CHECK (gs, GIMPLE_COND);
2866 return gimple_op_ptr (gs, 0);
2869 /* Set LHS to be the LHS operand of the predicate computed by
2870 conditional statement GS. */
2872 static inline void
2873 gimple_cond_set_lhs (gimple gs, tree lhs)
2875 GIMPLE_CHECK (gs, GIMPLE_COND);
2876 gimple_set_op (gs, 0, lhs);
2880 /* Return the RHS operand of the predicate computed by conditional GS. */
2882 static inline tree
2883 gimple_cond_rhs (const_gimple gs)
2885 GIMPLE_CHECK (gs, GIMPLE_COND);
2886 return gimple_op (gs, 1);
2889 /* Return the pointer to the RHS operand of the predicate computed by
2890 conditional GS. */
2892 static inline tree *
2893 gimple_cond_rhs_ptr (const_gimple gs)
2895 GIMPLE_CHECK (gs, GIMPLE_COND);
2896 return gimple_op_ptr (gs, 1);
2900 /* Set RHS to be the RHS operand of the predicate computed by
2901 conditional statement GS. */
2903 static inline void
2904 gimple_cond_set_rhs (gimple gs, tree rhs)
2906 GIMPLE_CHECK (gs, GIMPLE_COND);
2907 gimple_set_op (gs, 1, rhs);
2911 /* Return the label used by conditional statement GS when its
2912 predicate evaluates to true. */
2914 static inline tree
2915 gimple_cond_true_label (const_gimple gs)
2917 GIMPLE_CHECK (gs, GIMPLE_COND);
2918 return gimple_op (gs, 2);
2922 /* Set LABEL to be the label used by conditional statement GS when its
2923 predicate evaluates to true. */
2925 static inline void
2926 gimple_cond_set_true_label (gimple gs, tree label)
2928 GIMPLE_CHECK (gs, GIMPLE_COND);
2929 gimple_set_op (gs, 2, label);
2933 /* Set LABEL to be the label used by conditional statement GS when its
2934 predicate evaluates to false. */
2936 static inline void
2937 gimple_cond_set_false_label (gimple gs, tree label)
2939 GIMPLE_CHECK (gs, GIMPLE_COND);
2940 gimple_set_op (gs, 3, label);
2944 /* Return the label used by conditional statement GS when its
2945 predicate evaluates to false. */
2947 static inline tree
2948 gimple_cond_false_label (const_gimple gs)
2950 GIMPLE_CHECK (gs, GIMPLE_COND);
2951 return gimple_op (gs, 3);
2955 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2957 static inline void
2958 gimple_cond_make_false (gimple gs)
2960 gimple_cond_set_lhs (gs, boolean_true_node);
2961 gimple_cond_set_rhs (gs, boolean_false_node);
2962 gs->subcode = EQ_EXPR;
2966 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2968 static inline void
2969 gimple_cond_make_true (gimple gs)
2971 gimple_cond_set_lhs (gs, boolean_true_node);
2972 gimple_cond_set_rhs (gs, boolean_true_node);
2973 gs->subcode = EQ_EXPR;
2976 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2977 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2979 static inline bool
2980 gimple_cond_true_p (const_gimple gs)
2982 tree lhs = gimple_cond_lhs (gs);
2983 tree rhs = gimple_cond_rhs (gs);
2984 enum tree_code code = gimple_cond_code (gs);
2986 if (lhs != boolean_true_node && lhs != boolean_false_node)
2987 return false;
2989 if (rhs != boolean_true_node && rhs != boolean_false_node)
2990 return false;
2992 if (code == NE_EXPR && lhs != rhs)
2993 return true;
2995 if (code == EQ_EXPR && lhs == rhs)
2996 return true;
2998 return false;
3001 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3002 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3004 static inline bool
3005 gimple_cond_false_p (const_gimple gs)
3007 tree lhs = gimple_cond_lhs (gs);
3008 tree rhs = gimple_cond_rhs (gs);
3009 enum tree_code code = gimple_cond_code (gs);
3011 if (lhs != boolean_true_node && lhs != boolean_false_node)
3012 return false;
3014 if (rhs != boolean_true_node && rhs != boolean_false_node)
3015 return false;
3017 if (code == NE_EXPR && lhs == rhs)
3018 return true;
3020 if (code == EQ_EXPR && lhs != rhs)
3021 return true;
3023 return false;
3026 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3028 static inline void
3029 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3031 gimple_cond_set_code (stmt, code);
3032 gimple_cond_set_lhs (stmt, lhs);
3033 gimple_cond_set_rhs (stmt, rhs);
3036 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3038 static inline tree
3039 gimple_label_label (const_gimple gs)
3041 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3042 return gimple_op (gs, 0);
3046 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3047 GS. */
3049 static inline void
3050 gimple_label_set_label (gimple gs, tree label)
3052 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3053 gimple_set_op (gs, 0, label);
3057 /* Return the destination of the unconditional jump GS. */
3059 static inline tree
3060 gimple_goto_dest (const_gimple gs)
3062 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3063 return gimple_op (gs, 0);
3067 /* Set DEST to be the destination of the unconditonal jump GS. */
3069 static inline void
3070 gimple_goto_set_dest (gimple gs, tree dest)
3072 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3073 gimple_set_op (gs, 0, dest);
3077 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3079 static inline tree
3080 gimple_bind_vars (const_gimple gs)
3082 const gimple_statement_bind *bind_stmt =
3083 as_a <const gimple_statement_bind *> (gs);
3084 return bind_stmt->vars;
3088 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3089 statement GS. */
3091 static inline void
3092 gimple_bind_set_vars (gimple gs, tree vars)
3094 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3095 bind_stmt->vars = vars;
3099 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3100 statement GS. */
3102 static inline void
3103 gimple_bind_append_vars (gimple gs, tree vars)
3105 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3106 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3110 static inline gimple_seq *
3111 gimple_bind_body_ptr (gimple gs)
3113 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3114 return &bind_stmt->body;
3117 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3119 static inline gimple_seq
3120 gimple_bind_body (gimple gs)
3122 return *gimple_bind_body_ptr (gs);
3126 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3127 statement GS. */
3129 static inline void
3130 gimple_bind_set_body (gimple gs, gimple_seq seq)
3132 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3133 bind_stmt->body = seq;
3137 /* Append a statement to the end of a GIMPLE_BIND's body. */
3139 static inline void
3140 gimple_bind_add_stmt (gimple gs, gimple stmt)
3142 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3143 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3147 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3149 static inline void
3150 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3152 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3153 gimple_seq_add_seq (&bind_stmt->body, seq);
3157 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3158 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3160 static inline tree
3161 gimple_bind_block (const_gimple gs)
3163 const gimple_statement_bind *bind_stmt =
3164 as_a <const gimple_statement_bind *> (gs);
3165 return bind_stmt->block;
3169 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3170 statement GS. */
3172 static inline void
3173 gimple_bind_set_block (gimple gs, tree block)
3175 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3176 gcc_gimple_checking_assert (block == NULL_TREE
3177 || TREE_CODE (block) == BLOCK);
3178 bind_stmt->block = block;
3182 /* Return the number of input operands for GIMPLE_ASM GS. */
3184 static inline unsigned
3185 gimple_asm_ninputs (const_gimple gs)
3187 const gimple_statement_asm *asm_stmt =
3188 as_a <const gimple_statement_asm *> (gs);
3189 return asm_stmt->ni;
3193 /* Return the number of output operands for GIMPLE_ASM GS. */
3195 static inline unsigned
3196 gimple_asm_noutputs (const_gimple gs)
3198 const gimple_statement_asm *asm_stmt =
3199 as_a <const gimple_statement_asm *> (gs);
3200 return asm_stmt->no;
3204 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3206 static inline unsigned
3207 gimple_asm_nclobbers (const_gimple gs)
3209 const gimple_statement_asm *asm_stmt =
3210 as_a <const gimple_statement_asm *> (gs);
3211 return asm_stmt->nc;
3214 /* Return the number of label operands for GIMPLE_ASM GS. */
3216 static inline unsigned
3217 gimple_asm_nlabels (const_gimple gs)
3219 const gimple_statement_asm *asm_stmt =
3220 as_a <const gimple_statement_asm *> (gs);
3221 return asm_stmt->nl;
3224 /* Return input operand INDEX of GIMPLE_ASM GS. */
3226 static inline tree
3227 gimple_asm_input_op (const_gimple gs, unsigned index)
3229 const gimple_statement_asm *asm_stmt =
3230 as_a <const gimple_statement_asm *> (gs);
3231 gcc_gimple_checking_assert (index < asm_stmt->ni);
3232 return gimple_op (gs, index + asm_stmt->no);
3235 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3237 static inline tree *
3238 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3240 const gimple_statement_asm *asm_stmt =
3241 as_a <const gimple_statement_asm *> (gs);
3242 gcc_gimple_checking_assert (index < asm_stmt->ni);
3243 return gimple_op_ptr (gs, index + asm_stmt->no);
3247 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3249 static inline void
3250 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3252 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3253 gcc_gimple_checking_assert (index < asm_stmt->ni
3254 && TREE_CODE (in_op) == TREE_LIST);
3255 gimple_set_op (gs, index + asm_stmt->no, in_op);
3259 /* Return output operand INDEX of GIMPLE_ASM GS. */
3261 static inline tree
3262 gimple_asm_output_op (const_gimple gs, unsigned index)
3264 const gimple_statement_asm *asm_stmt =
3265 as_a <const gimple_statement_asm *> (gs);
3266 gcc_gimple_checking_assert (index < asm_stmt->no);
3267 return gimple_op (gs, index);
3270 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3272 static inline tree *
3273 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3275 const gimple_statement_asm *asm_stmt =
3276 as_a <const gimple_statement_asm *> (gs);
3277 gcc_gimple_checking_assert (index < asm_stmt->no);
3278 return gimple_op_ptr (gs, index);
3282 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3284 static inline void
3285 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3287 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3288 gcc_gimple_checking_assert (index < asm_stmt->no
3289 && TREE_CODE (out_op) == TREE_LIST);
3290 gimple_set_op (gs, index, out_op);
3294 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3296 static inline tree
3297 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3299 const gimple_statement_asm *asm_stmt =
3300 as_a <const gimple_statement_asm *> (gs);
3301 gcc_gimple_checking_assert (index < asm_stmt->nc);
3302 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3306 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3308 static inline void
3309 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3311 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3312 gcc_gimple_checking_assert (index < asm_stmt->nc
3313 && TREE_CODE (clobber_op) == TREE_LIST);
3314 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3317 /* Return label operand INDEX of GIMPLE_ASM GS. */
3319 static inline tree
3320 gimple_asm_label_op (const_gimple gs, unsigned index)
3322 const gimple_statement_asm *asm_stmt =
3323 as_a <const gimple_statement_asm *> (gs);
3324 gcc_gimple_checking_assert (index < asm_stmt->nl);
3325 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3328 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3330 static inline void
3331 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3333 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3334 gcc_gimple_checking_assert (index < asm_stmt->nl
3335 && TREE_CODE (label_op) == TREE_LIST);
3336 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3339 /* Return the string representing the assembly instruction in
3340 GIMPLE_ASM GS. */
3342 static inline const char *
3343 gimple_asm_string (const_gimple gs)
3345 const gimple_statement_asm *asm_stmt =
3346 as_a <const gimple_statement_asm *> (gs);
3347 return asm_stmt->string;
3351 /* Return true if GS is an asm statement marked volatile. */
3353 static inline bool
3354 gimple_asm_volatile_p (const_gimple gs)
3356 GIMPLE_CHECK (gs, GIMPLE_ASM);
3357 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3361 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3363 static inline void
3364 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3366 GIMPLE_CHECK (gs, GIMPLE_ASM);
3367 if (volatile_p)
3368 gs->subcode |= GF_ASM_VOLATILE;
3369 else
3370 gs->subcode &= ~GF_ASM_VOLATILE;
3374 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3376 static inline void
3377 gimple_asm_set_input (gimple gs, bool input_p)
3379 GIMPLE_CHECK (gs, GIMPLE_ASM);
3380 if (input_p)
3381 gs->subcode |= GF_ASM_INPUT;
3382 else
3383 gs->subcode &= ~GF_ASM_INPUT;
3387 /* Return true if asm GS is an ASM_INPUT. */
3389 static inline bool
3390 gimple_asm_input_p (const_gimple gs)
3392 GIMPLE_CHECK (gs, GIMPLE_ASM);
3393 return (gs->subcode & GF_ASM_INPUT) != 0;
3397 /* Return the types handled by GIMPLE_CATCH statement GS. */
3399 static inline tree
3400 gimple_catch_types (const_gimple gs)
3402 const gimple_statement_catch *catch_stmt =
3403 as_a <const gimple_statement_catch *> (gs);
3404 return catch_stmt->types;
3408 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3410 static inline tree *
3411 gimple_catch_types_ptr (gimple gs)
3413 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3414 return &catch_stmt->types;
3418 /* Return a pointer to the GIMPLE sequence representing the body of
3419 the handler of GIMPLE_CATCH statement GS. */
3421 static inline gimple_seq *
3422 gimple_catch_handler_ptr (gimple gs)
3424 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3425 return &catch_stmt->handler;
3429 /* Return the GIMPLE sequence representing the body of the handler of
3430 GIMPLE_CATCH statement GS. */
3432 static inline gimple_seq
3433 gimple_catch_handler (gimple gs)
3435 return *gimple_catch_handler_ptr (gs);
3439 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3441 static inline void
3442 gimple_catch_set_types (gimple gs, tree t)
3444 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3445 catch_stmt->types = t;
3449 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3451 static inline void
3452 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3454 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3455 catch_stmt->handler = handler;
3459 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3461 static inline tree
3462 gimple_eh_filter_types (const_gimple gs)
3464 const gimple_statement_eh_filter *eh_filter_stmt =
3465 as_a <const gimple_statement_eh_filter *> (gs);
3466 return eh_filter_stmt->types;
3470 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3471 GS. */
3473 static inline tree *
3474 gimple_eh_filter_types_ptr (gimple gs)
3476 gimple_statement_eh_filter *eh_filter_stmt =
3477 as_a <gimple_statement_eh_filter *> (gs);
3478 return &eh_filter_stmt->types;
3482 /* Return a pointer to the sequence of statement to execute when
3483 GIMPLE_EH_FILTER statement fails. */
3485 static inline gimple_seq *
3486 gimple_eh_filter_failure_ptr (gimple gs)
3488 gimple_statement_eh_filter *eh_filter_stmt =
3489 as_a <gimple_statement_eh_filter *> (gs);
3490 return &eh_filter_stmt->failure;
3494 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3495 statement fails. */
3497 static inline gimple_seq
3498 gimple_eh_filter_failure (gimple gs)
3500 return *gimple_eh_filter_failure_ptr (gs);
3504 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3506 static inline void
3507 gimple_eh_filter_set_types (gimple gs, tree types)
3509 gimple_statement_eh_filter *eh_filter_stmt =
3510 as_a <gimple_statement_eh_filter *> (gs);
3511 eh_filter_stmt->types = types;
3515 /* Set FAILURE to be the sequence of statements to execute on failure
3516 for GIMPLE_EH_FILTER GS. */
3518 static inline void
3519 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3521 gimple_statement_eh_filter *eh_filter_stmt =
3522 as_a <gimple_statement_eh_filter *> (gs);
3523 eh_filter_stmt->failure = failure;
3526 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3528 static inline tree
3529 gimple_eh_must_not_throw_fndecl (gimple gs)
3531 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3532 return eh_mnt_stmt->fndecl;
3535 /* Set the function decl to be called by GS to DECL. */
3537 static inline void
3538 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3540 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3541 eh_mnt_stmt->fndecl = decl;
3544 /* GIMPLE_EH_ELSE accessors. */
3546 static inline gimple_seq *
3547 gimple_eh_else_n_body_ptr (gimple gs)
3549 gimple_statement_eh_else *eh_else_stmt =
3550 as_a <gimple_statement_eh_else *> (gs);
3551 return &eh_else_stmt->n_body;
3554 static inline gimple_seq
3555 gimple_eh_else_n_body (gimple gs)
3557 return *gimple_eh_else_n_body_ptr (gs);
3560 static inline gimple_seq *
3561 gimple_eh_else_e_body_ptr (gimple gs)
3563 gimple_statement_eh_else *eh_else_stmt =
3564 as_a <gimple_statement_eh_else *> (gs);
3565 return &eh_else_stmt->e_body;
3568 static inline gimple_seq
3569 gimple_eh_else_e_body (gimple gs)
3571 return *gimple_eh_else_e_body_ptr (gs);
3574 static inline void
3575 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3577 gimple_statement_eh_else *eh_else_stmt =
3578 as_a <gimple_statement_eh_else *> (gs);
3579 eh_else_stmt->n_body = seq;
3582 static inline void
3583 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3585 gimple_statement_eh_else *eh_else_stmt =
3586 as_a <gimple_statement_eh_else *> (gs);
3587 eh_else_stmt->e_body = seq;
3590 /* GIMPLE_TRY accessors. */
3592 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3593 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3595 static inline enum gimple_try_flags
3596 gimple_try_kind (const_gimple gs)
3598 GIMPLE_CHECK (gs, GIMPLE_TRY);
3599 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3603 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3605 static inline void
3606 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3608 GIMPLE_CHECK (gs, GIMPLE_TRY);
3609 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3610 || kind == GIMPLE_TRY_FINALLY);
3611 if (gimple_try_kind (gs) != kind)
3612 gs->subcode = (unsigned int) kind;
3616 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3618 static inline bool
3619 gimple_try_catch_is_cleanup (const_gimple gs)
3621 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3622 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3626 /* Return a pointer to the sequence of statements used as the
3627 body for GIMPLE_TRY GS. */
3629 static inline gimple_seq *
3630 gimple_try_eval_ptr (gimple gs)
3632 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3633 return &try_stmt->eval;
3637 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3639 static inline gimple_seq
3640 gimple_try_eval (gimple gs)
3642 return *gimple_try_eval_ptr (gs);
3646 /* Return a pointer to the sequence of statements used as the cleanup body for
3647 GIMPLE_TRY GS. */
3649 static inline gimple_seq *
3650 gimple_try_cleanup_ptr (gimple gs)
3652 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3653 return &try_stmt->cleanup;
3657 /* Return the sequence of statements used as the cleanup body for
3658 GIMPLE_TRY GS. */
3660 static inline gimple_seq
3661 gimple_try_cleanup (gimple gs)
3663 return *gimple_try_cleanup_ptr (gs);
3667 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3669 static inline void
3670 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3672 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3673 if (catch_is_cleanup)
3674 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3675 else
3676 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3680 /* Set EVAL to be the sequence of statements to use as the body for
3681 GIMPLE_TRY GS. */
3683 static inline void
3684 gimple_try_set_eval (gimple gs, gimple_seq eval)
3686 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3687 try_stmt->eval = eval;
3691 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3692 body for GIMPLE_TRY GS. */
3694 static inline void
3695 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3697 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3698 try_stmt->cleanup = cleanup;
3702 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3704 static inline gimple_seq *
3705 gimple_wce_cleanup_ptr (gimple gs)
3707 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3708 return &wce_stmt->cleanup;
3712 /* Return the cleanup sequence for cleanup statement GS. */
3714 static inline gimple_seq
3715 gimple_wce_cleanup (gimple gs)
3717 return *gimple_wce_cleanup_ptr (gs);
3721 /* Set CLEANUP to be the cleanup sequence for GS. */
3723 static inline void
3724 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3726 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3727 wce_stmt->cleanup = cleanup;
3731 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3733 static inline bool
3734 gimple_wce_cleanup_eh_only (const_gimple gs)
3736 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3737 return gs->subcode != 0;
3741 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3743 static inline void
3744 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3746 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3747 gs->subcode = (unsigned int) eh_only_p;
3751 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3753 static inline unsigned
3754 gimple_phi_capacity (const_gimple gs)
3756 const gimple_statement_phi *phi_stmt =
3757 as_a <const gimple_statement_phi *> (gs);
3758 return phi_stmt->capacity;
3762 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3763 be exactly the number of incoming edges for the basic block holding
3764 GS. */
3766 static inline unsigned
3767 gimple_phi_num_args (const_gimple gs)
3769 const gimple_statement_phi *phi_stmt =
3770 as_a <const gimple_statement_phi *> (gs);
3771 return phi_stmt->nargs;
3775 /* Return the SSA name created by GIMPLE_PHI GS. */
3777 static inline tree
3778 gimple_phi_result (const_gimple gs)
3780 const gimple_statement_phi *phi_stmt =
3781 as_a <const gimple_statement_phi *> (gs);
3782 return phi_stmt->result;
3785 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3787 static inline tree *
3788 gimple_phi_result_ptr (gimple gs)
3790 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3791 return &phi_stmt->result;
3794 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3796 static inline void
3797 gimple_phi_set_result (gimple gs, tree result)
3799 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3800 phi_stmt->result = result;
3801 if (result && TREE_CODE (result) == SSA_NAME)
3802 SSA_NAME_DEF_STMT (result) = gs;
3806 /* Return the PHI argument corresponding to incoming edge INDEX for
3807 GIMPLE_PHI GS. */
3809 static inline struct phi_arg_d *
3810 gimple_phi_arg (gimple gs, unsigned index)
3812 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3813 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3814 return &(phi_stmt->args[index]);
3817 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3818 for GIMPLE_PHI GS. */
3820 static inline void
3821 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3823 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3824 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3825 phi_stmt->args[index] = *phiarg;
3828 /* Return the PHI nodes for basic block BB, or NULL if there are no
3829 PHI nodes. */
3831 static inline gimple_seq
3832 phi_nodes (const_basic_block bb)
3834 gcc_checking_assert (!(bb->flags & BB_RTL));
3835 return bb->il.gimple.phi_nodes;
3838 /* Return a pointer to the PHI nodes for basic block BB. */
3840 static inline gimple_seq *
3841 phi_nodes_ptr (basic_block bb)
3843 gcc_checking_assert (!(bb->flags & BB_RTL));
3844 return &bb->il.gimple.phi_nodes;
3847 /* Return the tree operand for argument I of PHI node GS. */
3849 static inline tree
3850 gimple_phi_arg_def (gimple gs, size_t index)
3852 return gimple_phi_arg (gs, index)->def;
3856 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3858 static inline tree *
3859 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3861 return &gimple_phi_arg (gs, index)->def;
3864 /* Return the edge associated with argument I of phi node GS. */
3866 static inline edge
3867 gimple_phi_arg_edge (gimple gs, size_t i)
3869 return EDGE_PRED (gimple_bb (gs), i);
3872 /* Return the source location of gimple argument I of phi node GS. */
3874 static inline source_location
3875 gimple_phi_arg_location (gimple gs, size_t i)
3877 return gimple_phi_arg (gs, i)->locus;
3880 /* Return the source location of the argument on edge E of phi node GS. */
3882 static inline source_location
3883 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3885 return gimple_phi_arg (gs, e->dest_idx)->locus;
3888 /* Set the source location of gimple argument I of phi node GS to LOC. */
3890 static inline void
3891 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3893 gimple_phi_arg (gs, i)->locus = loc;
3896 /* Return TRUE if argument I of phi node GS has a location record. */
3898 static inline bool
3899 gimple_phi_arg_has_location (gimple gs, size_t i)
3901 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3905 /* Return the region number for GIMPLE_RESX GS. */
3907 static inline int
3908 gimple_resx_region (const_gimple gs)
3910 const gimple_statement_resx *resx_stmt =
3911 as_a <const gimple_statement_resx *> (gs);
3912 return resx_stmt->region;
3915 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3917 static inline void
3918 gimple_resx_set_region (gimple gs, int region)
3920 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
3921 resx_stmt->region = region;
3924 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3926 static inline int
3927 gimple_eh_dispatch_region (const_gimple gs)
3929 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3930 as_a <const gimple_statement_eh_dispatch *> (gs);
3931 return eh_dispatch_stmt->region;
3934 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3936 static inline void
3937 gimple_eh_dispatch_set_region (gimple gs, int region)
3939 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3940 as_a <gimple_statement_eh_dispatch *> (gs);
3941 eh_dispatch_stmt->region = region;
3944 /* Return the number of labels associated with the switch statement GS. */
3946 static inline unsigned
3947 gimple_switch_num_labels (const_gimple gs)
3949 unsigned num_ops;
3950 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3951 num_ops = gimple_num_ops (gs);
3952 gcc_gimple_checking_assert (num_ops > 1);
3953 return num_ops - 1;
3957 /* Set NLABELS to be the number of labels for the switch statement GS. */
3959 static inline void
3960 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3962 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3963 gimple_set_num_ops (g, nlabels + 1);
3967 /* Return the index variable used by the switch statement GS. */
3969 static inline tree
3970 gimple_switch_index (const_gimple gs)
3972 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3973 return gimple_op (gs, 0);
3977 /* Return a pointer to the index variable for the switch statement GS. */
3979 static inline tree *
3980 gimple_switch_index_ptr (const_gimple gs)
3982 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3983 return gimple_op_ptr (gs, 0);
3987 /* Set INDEX to be the index variable for switch statement GS. */
3989 static inline void
3990 gimple_switch_set_index (gimple gs, tree index)
3992 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3993 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3994 gimple_set_op (gs, 0, index);
3998 /* Return the label numbered INDEX. The default label is 0, followed by any
3999 labels in a switch statement. */
4001 static inline tree
4002 gimple_switch_label (const_gimple gs, unsigned index)
4004 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4005 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4006 return gimple_op (gs, index + 1);
4009 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4011 static inline void
4012 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4014 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4015 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4016 && (label == NULL_TREE
4017 || TREE_CODE (label) == CASE_LABEL_EXPR));
4018 gimple_set_op (gs, index + 1, label);
4021 /* Return the default label for a switch statement. */
4023 static inline tree
4024 gimple_switch_default_label (const_gimple gs)
4026 tree label = gimple_switch_label (gs, 0);
4027 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4028 return label;
4031 /* Set the default label for a switch statement. */
4033 static inline void
4034 gimple_switch_set_default_label (gimple gs, tree label)
4036 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4037 gimple_switch_set_label (gs, 0, label);
4040 /* Return true if GS is a GIMPLE_DEBUG statement. */
4042 static inline bool
4043 is_gimple_debug (const_gimple gs)
4045 return gimple_code (gs) == GIMPLE_DEBUG;
4048 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4050 static inline bool
4051 gimple_debug_bind_p (const_gimple s)
4053 if (is_gimple_debug (s))
4054 return s->subcode == GIMPLE_DEBUG_BIND;
4056 return false;
4059 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4061 static inline tree
4062 gimple_debug_bind_get_var (gimple dbg)
4064 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4065 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4066 return gimple_op (dbg, 0);
4069 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4070 statement. */
4072 static inline tree
4073 gimple_debug_bind_get_value (gimple dbg)
4075 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4076 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4077 return gimple_op (dbg, 1);
4080 /* Return a pointer to the value bound to the variable in a
4081 GIMPLE_DEBUG bind statement. */
4083 static inline tree *
4084 gimple_debug_bind_get_value_ptr (gimple dbg)
4086 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4087 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4088 return gimple_op_ptr (dbg, 1);
4091 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4093 static inline void
4094 gimple_debug_bind_set_var (gimple dbg, tree var)
4096 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4097 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4098 gimple_set_op (dbg, 0, var);
4101 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4102 statement. */
4104 static inline void
4105 gimple_debug_bind_set_value (gimple dbg, tree value)
4107 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4108 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4109 gimple_set_op (dbg, 1, value);
4112 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4113 optimized away. */
4114 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4116 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4117 statement. */
4119 static inline void
4120 gimple_debug_bind_reset_value (gimple dbg)
4122 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4123 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4124 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4127 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4128 value. */
4130 static inline bool
4131 gimple_debug_bind_has_value_p (gimple dbg)
4133 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4134 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4135 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4138 #undef GIMPLE_DEBUG_BIND_NOVALUE
4140 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4142 static inline bool
4143 gimple_debug_source_bind_p (const_gimple s)
4145 if (is_gimple_debug (s))
4146 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4148 return false;
4151 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4153 static inline tree
4154 gimple_debug_source_bind_get_var (gimple dbg)
4156 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4157 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4158 return gimple_op (dbg, 0);
4161 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4162 statement. */
4164 static inline tree
4165 gimple_debug_source_bind_get_value (gimple dbg)
4167 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4168 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4169 return gimple_op (dbg, 1);
4172 /* Return a pointer to the value bound to the variable in a
4173 GIMPLE_DEBUG source bind statement. */
4175 static inline tree *
4176 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4178 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4179 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4180 return gimple_op_ptr (dbg, 1);
4183 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4185 static inline void
4186 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4188 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4189 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4190 gimple_set_op (dbg, 0, var);
4193 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4194 statement. */
4196 static inline void
4197 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4199 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4200 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4201 gimple_set_op (dbg, 1, value);
4204 /* Return the line number for EXPR, or return -1 if we have no line
4205 number information for it. */
4206 static inline int
4207 get_lineno (const_gimple stmt)
4209 location_t loc;
4211 if (!stmt)
4212 return -1;
4214 loc = gimple_location (stmt);
4215 if (loc == UNKNOWN_LOCATION)
4216 return -1;
4218 return LOCATION_LINE (loc);
4221 /* Return a pointer to the body for the OMP statement GS. */
4223 static inline gimple_seq *
4224 gimple_omp_body_ptr (gimple gs)
4226 return &static_cast <gimple_statement_omp *> (gs)->body;
4229 /* Return the body for the OMP statement GS. */
4231 static inline gimple_seq
4232 gimple_omp_body (gimple gs)
4234 return *gimple_omp_body_ptr (gs);
4237 /* Set BODY to be the body for the OMP statement GS. */
4239 static inline void
4240 gimple_omp_set_body (gimple gs, gimple_seq body)
4242 static_cast <gimple_statement_omp *> (gs)->body = body;
4246 /* Return the name associated with OMP_CRITICAL statement GS. */
4248 static inline tree
4249 gimple_omp_critical_name (const_gimple gs)
4251 const gimple_statement_omp_critical *omp_critical_stmt =
4252 as_a <const gimple_statement_omp_critical *> (gs);
4253 return omp_critical_stmt->name;
4257 /* Return a pointer to the name associated with OMP critical statement GS. */
4259 static inline tree *
4260 gimple_omp_critical_name_ptr (gimple gs)
4262 gimple_statement_omp_critical *omp_critical_stmt =
4263 as_a <gimple_statement_omp_critical *> (gs);
4264 return &omp_critical_stmt->name;
4268 /* Set NAME to be the name associated with OMP critical statement GS. */
4270 static inline void
4271 gimple_omp_critical_set_name (gimple gs, tree name)
4273 gimple_statement_omp_critical *omp_critical_stmt =
4274 as_a <gimple_statement_omp_critical *> (gs);
4275 omp_critical_stmt->name = name;
4279 /* Return the kind of OMP for statemement. */
4281 static inline int
4282 gimple_omp_for_kind (const_gimple g)
4284 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4285 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4289 /* Set the OMP for kind. */
4291 static inline void
4292 gimple_omp_for_set_kind (gimple g, int kind)
4294 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4295 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4296 | (kind & GF_OMP_FOR_KIND_MASK);
4300 /* Return true if OMP for statement G has the
4301 GF_OMP_FOR_COMBINED flag set. */
4303 static inline bool
4304 gimple_omp_for_combined_p (const_gimple g)
4306 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4307 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4311 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4312 value of COMBINED_P. */
4314 static inline void
4315 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4317 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4318 if (combined_p)
4319 g->subcode |= GF_OMP_FOR_COMBINED;
4320 else
4321 g->subcode &= ~GF_OMP_FOR_COMBINED;
4325 /* Return true if OMP for statement G has the
4326 GF_OMP_FOR_COMBINED_INTO flag set. */
4328 static inline bool
4329 gimple_omp_for_combined_into_p (const_gimple g)
4331 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4332 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4336 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4337 value of COMBINED_P. */
4339 static inline void
4340 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4342 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4343 if (combined_p)
4344 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4345 else
4346 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4350 /* Return the clauses associated with OMP_FOR GS. */
4352 static inline tree
4353 gimple_omp_for_clauses (const_gimple gs)
4355 const gimple_statement_omp_for *omp_for_stmt =
4356 as_a <const gimple_statement_omp_for *> (gs);
4357 return omp_for_stmt->clauses;
4361 /* Return a pointer to the OMP_FOR GS. */
4363 static inline tree *
4364 gimple_omp_for_clauses_ptr (gimple gs)
4366 gimple_statement_omp_for *omp_for_stmt =
4367 as_a <gimple_statement_omp_for *> (gs);
4368 return &omp_for_stmt->clauses;
4372 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4374 static inline void
4375 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4377 gimple_statement_omp_for *omp_for_stmt =
4378 as_a <gimple_statement_omp_for *> (gs);
4379 omp_for_stmt->clauses = clauses;
4383 /* Get the collapse count of OMP_FOR GS. */
4385 static inline size_t
4386 gimple_omp_for_collapse (gimple gs)
4388 gimple_statement_omp_for *omp_for_stmt =
4389 as_a <gimple_statement_omp_for *> (gs);
4390 return omp_for_stmt->collapse;
4394 /* Return the index variable for OMP_FOR GS. */
4396 static inline tree
4397 gimple_omp_for_index (const_gimple gs, size_t i)
4399 const gimple_statement_omp_for *omp_for_stmt =
4400 as_a <const gimple_statement_omp_for *> (gs);
4401 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4402 return omp_for_stmt->iter[i].index;
4406 /* Return a pointer to the index variable for OMP_FOR GS. */
4408 static inline tree *
4409 gimple_omp_for_index_ptr (gimple gs, size_t i)
4411 gimple_statement_omp_for *omp_for_stmt =
4412 as_a <gimple_statement_omp_for *> (gs);
4413 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4414 return &omp_for_stmt->iter[i].index;
4418 /* Set INDEX to be the index variable for OMP_FOR GS. */
4420 static inline void
4421 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4423 gimple_statement_omp_for *omp_for_stmt =
4424 as_a <gimple_statement_omp_for *> (gs);
4425 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4426 omp_for_stmt->iter[i].index = index;
4430 /* Return the initial value for OMP_FOR GS. */
4432 static inline tree
4433 gimple_omp_for_initial (const_gimple gs, size_t i)
4435 const gimple_statement_omp_for *omp_for_stmt =
4436 as_a <const gimple_statement_omp_for *> (gs);
4437 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4438 return omp_for_stmt->iter[i].initial;
4442 /* Return a pointer to the initial value for OMP_FOR GS. */
4444 static inline tree *
4445 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4447 gimple_statement_omp_for *omp_for_stmt =
4448 as_a <gimple_statement_omp_for *> (gs);
4449 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4450 return &omp_for_stmt->iter[i].initial;
4454 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4456 static inline void
4457 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4459 gimple_statement_omp_for *omp_for_stmt =
4460 as_a <gimple_statement_omp_for *> (gs);
4461 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4462 omp_for_stmt->iter[i].initial = initial;
4466 /* Return the final value for OMP_FOR GS. */
4468 static inline tree
4469 gimple_omp_for_final (const_gimple gs, size_t i)
4471 const gimple_statement_omp_for *omp_for_stmt =
4472 as_a <const gimple_statement_omp_for *> (gs);
4473 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4474 return omp_for_stmt->iter[i].final;
4478 /* Return a pointer to the final value for OMP_FOR GS. */
4480 static inline tree *
4481 gimple_omp_for_final_ptr (gimple gs, size_t i)
4483 gimple_statement_omp_for *omp_for_stmt =
4484 as_a <gimple_statement_omp_for *> (gs);
4485 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4486 return &omp_for_stmt->iter[i].final;
4490 /* Set FINAL to be the final value for OMP_FOR GS. */
4492 static inline void
4493 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4495 gimple_statement_omp_for *omp_for_stmt =
4496 as_a <gimple_statement_omp_for *> (gs);
4497 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4498 omp_for_stmt->iter[i].final = final;
4502 /* Return the increment value for OMP_FOR GS. */
4504 static inline tree
4505 gimple_omp_for_incr (const_gimple gs, size_t i)
4507 const gimple_statement_omp_for *omp_for_stmt =
4508 as_a <const gimple_statement_omp_for *> (gs);
4509 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4510 return omp_for_stmt->iter[i].incr;
4514 /* Return a pointer to the increment value for OMP_FOR GS. */
4516 static inline tree *
4517 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4519 gimple_statement_omp_for *omp_for_stmt =
4520 as_a <gimple_statement_omp_for *> (gs);
4521 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4522 return &omp_for_stmt->iter[i].incr;
4526 /* Set INCR to be the increment value for OMP_FOR GS. */
4528 static inline void
4529 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
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 omp_for_stmt->iter[i].incr = incr;
4538 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4539 statement GS starts. */
4541 static inline gimple_seq *
4542 gimple_omp_for_pre_body_ptr (gimple gs)
4544 gimple_statement_omp_for *omp_for_stmt =
4545 as_a <gimple_statement_omp_for *> (gs);
4546 return &omp_for_stmt->pre_body;
4550 /* Return the sequence of statements to execute before the OMP_FOR
4551 statement GS starts. */
4553 static inline gimple_seq
4554 gimple_omp_for_pre_body (gimple gs)
4556 return *gimple_omp_for_pre_body_ptr (gs);
4560 /* Set PRE_BODY to be the sequence of statements to execute before the
4561 OMP_FOR statement GS starts. */
4563 static inline void
4564 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4566 gimple_statement_omp_for *omp_for_stmt =
4567 as_a <gimple_statement_omp_for *> (gs);
4568 omp_for_stmt->pre_body = pre_body;
4572 /* Return the clauses associated with OMP_PARALLEL GS. */
4574 static inline tree
4575 gimple_omp_parallel_clauses (const_gimple gs)
4577 const gimple_statement_omp_parallel *omp_parallel_stmt =
4578 as_a <const gimple_statement_omp_parallel *> (gs);
4579 return omp_parallel_stmt->clauses;
4583 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4585 static inline tree *
4586 gimple_omp_parallel_clauses_ptr (gimple gs)
4588 gimple_statement_omp_parallel *omp_parallel_stmt =
4589 as_a <gimple_statement_omp_parallel *> (gs);
4590 return &omp_parallel_stmt->clauses;
4594 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4595 GS. */
4597 static inline void
4598 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4600 gimple_statement_omp_parallel *omp_parallel_stmt =
4601 as_a <gimple_statement_omp_parallel *> (gs);
4602 omp_parallel_stmt->clauses = clauses;
4606 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4608 static inline tree
4609 gimple_omp_parallel_child_fn (const_gimple gs)
4611 const gimple_statement_omp_parallel *omp_parallel_stmt =
4612 as_a <const gimple_statement_omp_parallel *> (gs);
4613 return omp_parallel_stmt->child_fn;
4616 /* Return a pointer to the child function used to hold the body of
4617 OMP_PARALLEL GS. */
4619 static inline tree *
4620 gimple_omp_parallel_child_fn_ptr (gimple gs)
4622 gimple_statement_omp_parallel *omp_parallel_stmt =
4623 as_a <gimple_statement_omp_parallel *> (gs);
4624 return &omp_parallel_stmt->child_fn;
4628 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4630 static inline void
4631 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4633 gimple_statement_omp_parallel *omp_parallel_stmt =
4634 as_a <gimple_statement_omp_parallel *> (gs);
4635 omp_parallel_stmt->child_fn = child_fn;
4639 /* Return the artificial argument used to send variables and values
4640 from the parent to the children threads in OMP_PARALLEL GS. */
4642 static inline tree
4643 gimple_omp_parallel_data_arg (const_gimple gs)
4645 const gimple_statement_omp_parallel *omp_parallel_stmt =
4646 as_a <const gimple_statement_omp_parallel *> (gs);
4647 return omp_parallel_stmt->data_arg;
4651 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4653 static inline tree *
4654 gimple_omp_parallel_data_arg_ptr (gimple gs)
4656 gimple_statement_omp_parallel *omp_parallel_stmt =
4657 as_a <gimple_statement_omp_parallel *> (gs);
4658 return &omp_parallel_stmt->data_arg;
4662 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4664 static inline void
4665 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4667 gimple_statement_omp_parallel *omp_parallel_stmt =
4668 as_a <gimple_statement_omp_parallel *> (gs);
4669 omp_parallel_stmt->data_arg = data_arg;
4673 /* Return the clauses associated with OMP_TASK GS. */
4675 static inline tree
4676 gimple_omp_task_clauses (const_gimple gs)
4678 const gimple_statement_omp_task *omp_task_stmt =
4679 as_a <const gimple_statement_omp_task *> (gs);
4680 return omp_task_stmt->clauses;
4684 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4686 static inline tree *
4687 gimple_omp_task_clauses_ptr (gimple gs)
4689 gimple_statement_omp_task *omp_task_stmt =
4690 as_a <gimple_statement_omp_task *> (gs);
4691 return &omp_task_stmt->clauses;
4695 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4696 GS. */
4698 static inline void
4699 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4701 gimple_statement_omp_task *omp_task_stmt =
4702 as_a <gimple_statement_omp_task *> (gs);
4703 omp_task_stmt->clauses = clauses;
4707 /* Return the child function used to hold the body of OMP_TASK GS. */
4709 static inline tree
4710 gimple_omp_task_child_fn (const_gimple gs)
4712 const gimple_statement_omp_task *omp_task_stmt =
4713 as_a <const gimple_statement_omp_task *> (gs);
4714 return omp_task_stmt->child_fn;
4717 /* Return a pointer to the child function used to hold the body of
4718 OMP_TASK GS. */
4720 static inline tree *
4721 gimple_omp_task_child_fn_ptr (gimple gs)
4723 gimple_statement_omp_task *omp_task_stmt =
4724 as_a <gimple_statement_omp_task *> (gs);
4725 return &omp_task_stmt->child_fn;
4729 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4731 static inline void
4732 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4734 gimple_statement_omp_task *omp_task_stmt =
4735 as_a <gimple_statement_omp_task *> (gs);
4736 omp_task_stmt->child_fn = child_fn;
4740 /* Return the artificial argument used to send variables and values
4741 from the parent to the children threads in OMP_TASK GS. */
4743 static inline tree
4744 gimple_omp_task_data_arg (const_gimple gs)
4746 const gimple_statement_omp_task *omp_task_stmt =
4747 as_a <const gimple_statement_omp_task *> (gs);
4748 return omp_task_stmt->data_arg;
4752 /* Return a pointer to the data argument for OMP_TASK GS. */
4754 static inline tree *
4755 gimple_omp_task_data_arg_ptr (gimple gs)
4757 gimple_statement_omp_task *omp_task_stmt =
4758 as_a <gimple_statement_omp_task *> (gs);
4759 return &omp_task_stmt->data_arg;
4763 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4765 static inline void
4766 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4768 gimple_statement_omp_task *omp_task_stmt =
4769 as_a <gimple_statement_omp_task *> (gs);
4770 omp_task_stmt->data_arg = data_arg;
4774 /* Return the clauses associated with OMP_TASK GS. */
4776 static inline tree
4777 gimple_omp_taskreg_clauses (const_gimple gs)
4779 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4780 as_a <const gimple_statement_omp_taskreg *> (gs);
4781 return omp_taskreg_stmt->clauses;
4785 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4787 static inline tree *
4788 gimple_omp_taskreg_clauses_ptr (gimple gs)
4790 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4791 as_a <gimple_statement_omp_taskreg *> (gs);
4792 return &omp_taskreg_stmt->clauses;
4796 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4797 GS. */
4799 static inline void
4800 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4802 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4803 as_a <gimple_statement_omp_taskreg *> (gs);
4804 omp_taskreg_stmt->clauses = clauses;
4808 /* Return the child function used to hold the body of OMP_TASK GS. */
4810 static inline tree
4811 gimple_omp_taskreg_child_fn (const_gimple gs)
4813 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4814 as_a <const gimple_statement_omp_taskreg *> (gs);
4815 return omp_taskreg_stmt->child_fn;
4818 /* Return a pointer to the child function used to hold the body of
4819 OMP_TASK GS. */
4821 static inline tree *
4822 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4824 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4825 as_a <gimple_statement_omp_taskreg *> (gs);
4826 return &omp_taskreg_stmt->child_fn;
4830 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4832 static inline void
4833 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4835 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4836 as_a <gimple_statement_omp_taskreg *> (gs);
4837 omp_taskreg_stmt->child_fn = child_fn;
4841 /* Return the artificial argument used to send variables and values
4842 from the parent to the children threads in OMP_TASK GS. */
4844 static inline tree
4845 gimple_omp_taskreg_data_arg (const_gimple gs)
4847 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4848 as_a <const gimple_statement_omp_taskreg *> (gs);
4849 return omp_taskreg_stmt->data_arg;
4853 /* Return a pointer to the data argument for OMP_TASK GS. */
4855 static inline tree *
4856 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4858 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4859 as_a <gimple_statement_omp_taskreg *> (gs);
4860 return &omp_taskreg_stmt->data_arg;
4864 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4866 static inline void
4867 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4869 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4870 as_a <gimple_statement_omp_taskreg *> (gs);
4871 omp_taskreg_stmt->data_arg = data_arg;
4875 /* Return the copy function used to hold the body of OMP_TASK GS. */
4877 static inline tree
4878 gimple_omp_task_copy_fn (const_gimple gs)
4880 const gimple_statement_omp_task *omp_task_stmt =
4881 as_a <const gimple_statement_omp_task *> (gs);
4882 return omp_task_stmt->copy_fn;
4885 /* Return a pointer to the copy function used to hold the body of
4886 OMP_TASK GS. */
4888 static inline tree *
4889 gimple_omp_task_copy_fn_ptr (gimple gs)
4891 gimple_statement_omp_task *omp_task_stmt =
4892 as_a <gimple_statement_omp_task *> (gs);
4893 return &omp_task_stmt->copy_fn;
4897 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4899 static inline void
4900 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4902 gimple_statement_omp_task *omp_task_stmt =
4903 as_a <gimple_statement_omp_task *> (gs);
4904 omp_task_stmt->copy_fn = copy_fn;
4908 /* Return size of the data block in bytes in OMP_TASK GS. */
4910 static inline tree
4911 gimple_omp_task_arg_size (const_gimple gs)
4913 const gimple_statement_omp_task *omp_task_stmt =
4914 as_a <const gimple_statement_omp_task *> (gs);
4915 return omp_task_stmt->arg_size;
4919 /* Return a pointer to the data block size for OMP_TASK GS. */
4921 static inline tree *
4922 gimple_omp_task_arg_size_ptr (gimple gs)
4924 gimple_statement_omp_task *omp_task_stmt =
4925 as_a <gimple_statement_omp_task *> (gs);
4926 return &omp_task_stmt->arg_size;
4930 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4932 static inline void
4933 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4935 gimple_statement_omp_task *omp_task_stmt =
4936 as_a <gimple_statement_omp_task *> (gs);
4937 omp_task_stmt->arg_size = arg_size;
4941 /* Return align of the data block in bytes in OMP_TASK GS. */
4943 static inline tree
4944 gimple_omp_task_arg_align (const_gimple gs)
4946 const gimple_statement_omp_task *omp_task_stmt =
4947 as_a <const gimple_statement_omp_task *> (gs);
4948 return omp_task_stmt->arg_align;
4952 /* Return a pointer to the data block align for OMP_TASK GS. */
4954 static inline tree *
4955 gimple_omp_task_arg_align_ptr (gimple gs)
4957 gimple_statement_omp_task *omp_task_stmt =
4958 as_a <gimple_statement_omp_task *> (gs);
4959 return &omp_task_stmt->arg_align;
4963 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4965 static inline void
4966 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
4968 gimple_statement_omp_task *omp_task_stmt =
4969 as_a <gimple_statement_omp_task *> (gs);
4970 omp_task_stmt->arg_align = arg_align;
4974 /* Return the clauses associated with OMP_SINGLE GS. */
4976 static inline tree
4977 gimple_omp_single_clauses (const_gimple gs)
4979 const gimple_statement_omp_single *omp_single_stmt =
4980 as_a <const gimple_statement_omp_single *> (gs);
4981 return omp_single_stmt->clauses;
4985 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
4987 static inline tree *
4988 gimple_omp_single_clauses_ptr (gimple gs)
4990 gimple_statement_omp_single *omp_single_stmt =
4991 as_a <gimple_statement_omp_single *> (gs);
4992 return &omp_single_stmt->clauses;
4996 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
4998 static inline void
4999 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5001 gimple_statement_omp_single *omp_single_stmt =
5002 as_a <gimple_statement_omp_single *> (gs);
5003 omp_single_stmt->clauses = clauses;
5007 /* Return the clauses associated with OMP_TARGET GS. */
5009 static inline tree
5010 gimple_omp_target_clauses (const_gimple gs)
5012 const gimple_statement_omp_target *omp_target_stmt =
5013 as_a <const gimple_statement_omp_target *> (gs);
5014 return omp_target_stmt->clauses;
5018 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5020 static inline tree *
5021 gimple_omp_target_clauses_ptr (gimple gs)
5023 gimple_statement_omp_target *omp_target_stmt =
5024 as_a <gimple_statement_omp_target *> (gs);
5025 return &omp_target_stmt->clauses;
5029 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5031 static inline void
5032 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5034 gimple_statement_omp_target *omp_target_stmt =
5035 as_a <gimple_statement_omp_target *> (gs);
5036 omp_target_stmt->clauses = clauses;
5040 /* Return the kind of OMP target statemement. */
5042 static inline int
5043 gimple_omp_target_kind (const_gimple g)
5045 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5046 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5050 /* Set the OMP target kind. */
5052 static inline void
5053 gimple_omp_target_set_kind (gimple g, int kind)
5055 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5056 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5057 | (kind & GF_OMP_TARGET_KIND_MASK);
5061 /* Return the child function used to hold the body of OMP_TARGET GS. */
5063 static inline tree
5064 gimple_omp_target_child_fn (const_gimple gs)
5066 const gimple_statement_omp_target *omp_target_stmt =
5067 as_a <const gimple_statement_omp_target *> (gs);
5068 return omp_target_stmt->child_fn;
5071 /* Return a pointer to the child function used to hold the body of
5072 OMP_TARGET GS. */
5074 static inline tree *
5075 gimple_omp_target_child_fn_ptr (gimple gs)
5077 gimple_statement_omp_target *omp_target_stmt =
5078 as_a <gimple_statement_omp_target *> (gs);
5079 return &omp_target_stmt->child_fn;
5083 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5085 static inline void
5086 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5088 gimple_statement_omp_target *omp_target_stmt =
5089 as_a <gimple_statement_omp_target *> (gs);
5090 omp_target_stmt->child_fn = child_fn;
5094 /* Return the artificial argument used to send variables and values
5095 from the parent to the children threads in OMP_TARGET GS. */
5097 static inline tree
5098 gimple_omp_target_data_arg (const_gimple gs)
5100 const gimple_statement_omp_target *omp_target_stmt =
5101 as_a <const gimple_statement_omp_target *> (gs);
5102 return omp_target_stmt->data_arg;
5106 /* Return a pointer to the data argument for OMP_TARGET GS. */
5108 static inline tree *
5109 gimple_omp_target_data_arg_ptr (gimple gs)
5111 gimple_statement_omp_target *omp_target_stmt =
5112 as_a <gimple_statement_omp_target *> (gs);
5113 return &omp_target_stmt->data_arg;
5117 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5119 static inline void
5120 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5122 gimple_statement_omp_target *omp_target_stmt =
5123 as_a <gimple_statement_omp_target *> (gs);
5124 omp_target_stmt->data_arg = data_arg;
5128 /* Return the clauses associated with OMP_TEAMS GS. */
5130 static inline tree
5131 gimple_omp_teams_clauses (const_gimple gs)
5133 const gimple_statement_omp_teams *omp_teams_stmt =
5134 as_a <const gimple_statement_omp_teams *> (gs);
5135 return omp_teams_stmt->clauses;
5139 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5141 static inline tree *
5142 gimple_omp_teams_clauses_ptr (gimple gs)
5144 gimple_statement_omp_teams *omp_teams_stmt =
5145 as_a <gimple_statement_omp_teams *> (gs);
5146 return &omp_teams_stmt->clauses;
5150 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5152 static inline void
5153 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5155 gimple_statement_omp_teams *omp_teams_stmt =
5156 as_a <gimple_statement_omp_teams *> (gs);
5157 omp_teams_stmt->clauses = clauses;
5161 /* Return the clauses associated with OMP_SECTIONS GS. */
5163 static inline tree
5164 gimple_omp_sections_clauses (const_gimple gs)
5166 const gimple_statement_omp_sections *omp_sections_stmt =
5167 as_a <const gimple_statement_omp_sections *> (gs);
5168 return omp_sections_stmt->clauses;
5172 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5174 static inline tree *
5175 gimple_omp_sections_clauses_ptr (gimple gs)
5177 gimple_statement_omp_sections *omp_sections_stmt =
5178 as_a <gimple_statement_omp_sections *> (gs);
5179 return &omp_sections_stmt->clauses;
5183 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5184 GS. */
5186 static inline void
5187 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5189 gimple_statement_omp_sections *omp_sections_stmt =
5190 as_a <gimple_statement_omp_sections *> (gs);
5191 omp_sections_stmt->clauses = clauses;
5195 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5196 in GS. */
5198 static inline tree
5199 gimple_omp_sections_control (const_gimple gs)
5201 const gimple_statement_omp_sections *omp_sections_stmt =
5202 as_a <const gimple_statement_omp_sections *> (gs);
5203 return omp_sections_stmt->control;
5207 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5208 GS. */
5210 static inline tree *
5211 gimple_omp_sections_control_ptr (gimple gs)
5213 gimple_statement_omp_sections *omp_sections_stmt =
5214 as_a <gimple_statement_omp_sections *> (gs);
5215 return &omp_sections_stmt->control;
5219 /* Set CONTROL to be the set of clauses associated with the
5220 GIMPLE_OMP_SECTIONS in GS. */
5222 static inline void
5223 gimple_omp_sections_set_control (gimple gs, tree control)
5225 gimple_statement_omp_sections *omp_sections_stmt =
5226 as_a <gimple_statement_omp_sections *> (gs);
5227 omp_sections_stmt->control = control;
5231 /* Set COND to be the condition code for OMP_FOR GS. */
5233 static inline void
5234 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5236 gimple_statement_omp_for *omp_for_stmt =
5237 as_a <gimple_statement_omp_for *> (gs);
5238 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5239 && i < omp_for_stmt->collapse);
5240 omp_for_stmt->iter[i].cond = cond;
5244 /* Return the condition code associated with OMP_FOR GS. */
5246 static inline enum tree_code
5247 gimple_omp_for_cond (const_gimple gs, size_t i)
5249 const gimple_statement_omp_for *omp_for_stmt =
5250 as_a <const gimple_statement_omp_for *> (gs);
5251 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5252 return omp_for_stmt->iter[i].cond;
5256 /* Set the value being stored in an atomic store. */
5258 static inline void
5259 gimple_omp_atomic_store_set_val (gimple g, tree val)
5261 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5262 as_a <gimple_statement_omp_atomic_store *> (g);
5263 omp_atomic_store_stmt->val = val;
5267 /* Return the value being stored in an atomic store. */
5269 static inline tree
5270 gimple_omp_atomic_store_val (const_gimple g)
5272 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5273 as_a <const gimple_statement_omp_atomic_store *> (g);
5274 return omp_atomic_store_stmt->val;
5278 /* Return a pointer to the value being stored in an atomic store. */
5280 static inline tree *
5281 gimple_omp_atomic_store_val_ptr (gimple g)
5283 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5284 as_a <gimple_statement_omp_atomic_store *> (g);
5285 return &omp_atomic_store_stmt->val;
5289 /* Set the LHS of an atomic load. */
5291 static inline void
5292 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5294 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5295 as_a <gimple_statement_omp_atomic_load *> (g);
5296 omp_atomic_load_stmt->lhs = lhs;
5300 /* Get the LHS of an atomic load. */
5302 static inline tree
5303 gimple_omp_atomic_load_lhs (const_gimple g)
5305 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5306 as_a <const gimple_statement_omp_atomic_load *> (g);
5307 return omp_atomic_load_stmt->lhs;
5311 /* Return a pointer to the LHS of an atomic load. */
5313 static inline tree *
5314 gimple_omp_atomic_load_lhs_ptr (gimple g)
5316 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5317 as_a <gimple_statement_omp_atomic_load *> (g);
5318 return &omp_atomic_load_stmt->lhs;
5322 /* Set the RHS of an atomic load. */
5324 static inline void
5325 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5327 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5328 as_a <gimple_statement_omp_atomic_load *> (g);
5329 omp_atomic_load_stmt->rhs = rhs;
5333 /* Get the RHS of an atomic load. */
5335 static inline tree
5336 gimple_omp_atomic_load_rhs (const_gimple g)
5338 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5339 as_a <const gimple_statement_omp_atomic_load *> (g);
5340 return omp_atomic_load_stmt->rhs;
5344 /* Return a pointer to the RHS of an atomic load. */
5346 static inline tree *
5347 gimple_omp_atomic_load_rhs_ptr (gimple g)
5349 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5350 as_a <gimple_statement_omp_atomic_load *> (g);
5351 return &omp_atomic_load_stmt->rhs;
5355 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5357 static inline tree
5358 gimple_omp_continue_control_def (const_gimple g)
5360 const gimple_statement_omp_continue *omp_continue_stmt =
5361 as_a <const gimple_statement_omp_continue *> (g);
5362 return omp_continue_stmt->control_def;
5365 /* The same as above, but return the address. */
5367 static inline tree *
5368 gimple_omp_continue_control_def_ptr (gimple g)
5370 gimple_statement_omp_continue *omp_continue_stmt =
5371 as_a <gimple_statement_omp_continue *> (g);
5372 return &omp_continue_stmt->control_def;
5375 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5377 static inline void
5378 gimple_omp_continue_set_control_def (gimple g, tree def)
5380 gimple_statement_omp_continue *omp_continue_stmt =
5381 as_a <gimple_statement_omp_continue *> (g);
5382 omp_continue_stmt->control_def = def;
5386 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5388 static inline tree
5389 gimple_omp_continue_control_use (const_gimple g)
5391 const gimple_statement_omp_continue *omp_continue_stmt =
5392 as_a <const gimple_statement_omp_continue *> (g);
5393 return omp_continue_stmt->control_use;
5397 /* The same as above, but return the address. */
5399 static inline tree *
5400 gimple_omp_continue_control_use_ptr (gimple g)
5402 gimple_statement_omp_continue *omp_continue_stmt =
5403 as_a <gimple_statement_omp_continue *> (g);
5404 return &omp_continue_stmt->control_use;
5408 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5410 static inline void
5411 gimple_omp_continue_set_control_use (gimple g, tree use)
5413 gimple_statement_omp_continue *omp_continue_stmt =
5414 as_a <gimple_statement_omp_continue *> (g);
5415 omp_continue_stmt->control_use = use;
5418 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5420 static inline gimple_seq *
5421 gimple_transaction_body_ptr (gimple gs)
5423 gimple_statement_transaction *transaction_stmt =
5424 as_a <gimple_statement_transaction *> (gs);
5425 return &transaction_stmt->body;
5428 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5430 static inline gimple_seq
5431 gimple_transaction_body (gimple gs)
5433 return *gimple_transaction_body_ptr (gs);
5436 /* Return the label associated with a GIMPLE_TRANSACTION. */
5438 static inline tree
5439 gimple_transaction_label (const_gimple gs)
5441 const gimple_statement_transaction *transaction_stmt =
5442 as_a <const gimple_statement_transaction *> (gs);
5443 return transaction_stmt->label;
5446 static inline tree *
5447 gimple_transaction_label_ptr (gimple gs)
5449 gimple_statement_transaction *transaction_stmt =
5450 as_a <gimple_statement_transaction *> (gs);
5451 return &transaction_stmt->label;
5454 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5456 static inline unsigned int
5457 gimple_transaction_subcode (const_gimple gs)
5459 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5460 return gs->subcode;
5463 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5465 static inline void
5466 gimple_transaction_set_body (gimple gs, gimple_seq body)
5468 gimple_statement_transaction *transaction_stmt =
5469 as_a <gimple_statement_transaction *> (gs);
5470 transaction_stmt->body = body;
5473 /* Set the label associated with a GIMPLE_TRANSACTION. */
5475 static inline void
5476 gimple_transaction_set_label (gimple gs, tree label)
5478 gimple_statement_transaction *transaction_stmt =
5479 as_a <gimple_statement_transaction *> (gs);
5480 transaction_stmt->label = label;
5483 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5485 static inline void
5486 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5488 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5489 gs->subcode = subcode;
5493 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5495 static inline tree *
5496 gimple_return_retval_ptr (const_gimple gs)
5498 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5499 return gimple_op_ptr (gs, 0);
5502 /* Return the return value for GIMPLE_RETURN GS. */
5504 static inline tree
5505 gimple_return_retval (const_gimple gs)
5507 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5508 return gimple_op (gs, 0);
5512 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5514 static inline void
5515 gimple_return_set_retval (gimple gs, tree retval)
5517 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5518 gimple_set_op (gs, 0, retval);
5522 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5524 #define CASE_GIMPLE_OMP \
5525 case GIMPLE_OMP_PARALLEL: \
5526 case GIMPLE_OMP_TASK: \
5527 case GIMPLE_OMP_FOR: \
5528 case GIMPLE_OMP_SECTIONS: \
5529 case GIMPLE_OMP_SECTIONS_SWITCH: \
5530 case GIMPLE_OMP_SINGLE: \
5531 case GIMPLE_OMP_TARGET: \
5532 case GIMPLE_OMP_TEAMS: \
5533 case GIMPLE_OMP_SECTION: \
5534 case GIMPLE_OMP_MASTER: \
5535 case GIMPLE_OMP_TASKGROUP: \
5536 case GIMPLE_OMP_ORDERED: \
5537 case GIMPLE_OMP_CRITICAL: \
5538 case GIMPLE_OMP_RETURN: \
5539 case GIMPLE_OMP_ATOMIC_LOAD: \
5540 case GIMPLE_OMP_ATOMIC_STORE: \
5541 case GIMPLE_OMP_CONTINUE
5543 static inline bool
5544 is_gimple_omp (const_gimple stmt)
5546 switch (gimple_code (stmt))
5548 CASE_GIMPLE_OMP:
5549 return true;
5550 default:
5551 return false;
5556 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5558 static inline bool
5559 gimple_nop_p (const_gimple g)
5561 return gimple_code (g) == GIMPLE_NOP;
5565 /* Return true if GS is a GIMPLE_RESX. */
5567 static inline bool
5568 is_gimple_resx (const_gimple gs)
5570 return gimple_code (gs) == GIMPLE_RESX;
5573 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5575 static inline enum br_predictor
5576 gimple_predict_predictor (gimple gs)
5578 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5579 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5583 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5585 static inline void
5586 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5588 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5589 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5590 | (unsigned) predictor;
5594 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5596 static inline enum prediction
5597 gimple_predict_outcome (gimple gs)
5599 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5600 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5604 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5606 static inline void
5607 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5609 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5610 if (outcome == TAKEN)
5611 gs->subcode |= GF_PREDICT_TAKEN;
5612 else
5613 gs->subcode &= ~GF_PREDICT_TAKEN;
5617 /* Return the type of the main expression computed by STMT. Return
5618 void_type_node if the statement computes nothing. */
5620 static inline tree
5621 gimple_expr_type (const_gimple stmt)
5623 enum gimple_code code = gimple_code (stmt);
5625 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5627 tree type;
5628 /* In general we want to pass out a type that can be substituted
5629 for both the RHS and the LHS types if there is a possibly
5630 useless conversion involved. That means returning the
5631 original RHS type as far as we can reconstruct it. */
5632 if (code == GIMPLE_CALL)
5634 if (gimple_call_internal_p (stmt)
5635 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5636 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5637 else
5638 type = gimple_call_return_type (stmt);
5640 else
5641 switch (gimple_assign_rhs_code (stmt))
5643 case POINTER_PLUS_EXPR:
5644 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5645 break;
5647 default:
5648 /* As fallback use the type of the LHS. */
5649 type = TREE_TYPE (gimple_get_lhs (stmt));
5650 break;
5652 return type;
5654 else if (code == GIMPLE_COND)
5655 return boolean_type_node;
5656 else
5657 return void_type_node;
5660 /* Enum and arrays used for allocation stats. Keep in sync with
5661 gimple.c:gimple_alloc_kind_names. */
5662 enum gimple_alloc_kind
5664 gimple_alloc_kind_assign, /* Assignments. */
5665 gimple_alloc_kind_phi, /* PHI nodes. */
5666 gimple_alloc_kind_cond, /* Conditionals. */
5667 gimple_alloc_kind_rest, /* Everything else. */
5668 gimple_alloc_kind_all
5671 extern int gimple_alloc_counts[];
5672 extern int gimple_alloc_sizes[];
5674 /* Return the allocation kind for a given stmt CODE. */
5675 static inline enum gimple_alloc_kind
5676 gimple_alloc_kind (enum gimple_code code)
5678 switch (code)
5680 case GIMPLE_ASSIGN:
5681 return gimple_alloc_kind_assign;
5682 case GIMPLE_PHI:
5683 return gimple_alloc_kind_phi;
5684 case GIMPLE_COND:
5685 return gimple_alloc_kind_cond;
5686 default:
5687 return gimple_alloc_kind_rest;
5691 /* Return true if a location should not be emitted for this statement
5692 by annotate_all_with_location. */
5694 static inline bool
5695 gimple_do_not_emit_location_p (gimple g)
5697 return gimple_plf (g, GF_PLF_1);
5700 /* Mark statement G so a location will not be emitted by
5701 annotate_one_with_location. */
5703 static inline void
5704 gimple_set_do_not_emit_location (gimple g)
5706 /* The PLF flags are initialized to 0 when a new tuple is created,
5707 so no need to initialize it anywhere. */
5708 gimple_set_plf (g, GF_PLF_1, true);
5712 /* Macros for showing usage statistics. */
5713 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5714 ? (x) \
5715 : ((x) < 1024*1024*10 \
5716 ? (x) / 1024 \
5717 : (x) / (1024*1024))))
5719 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5721 #endif /* GCC_GIMPLE_H */