Rebase.
[official-gcc.git] / gcc / gimple.h
blob20a1e132f71f19d6b05a9322438c3df571e0bcf2
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_CALL_WITH_BOUNDS = 1 << 7,
94 GF_OMP_PARALLEL_COMBINED = 1 << 0,
95 GF_OMP_FOR_KIND_MASK = (1 << 2) - 1,
96 GF_OMP_FOR_KIND_FOR = 0,
97 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
98 /* Flag for SIMD variants of OMP_FOR kinds. */
99 GF_OMP_FOR_SIMD = 1 << 1,
100 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
101 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
102 GF_OMP_FOR_COMBINED = 1 << 2,
103 GF_OMP_FOR_COMBINED_INTO = 1 << 3,
104 GF_OMP_TARGET_KIND_MASK = (1 << 2) - 1,
105 GF_OMP_TARGET_KIND_REGION = 0,
106 GF_OMP_TARGET_KIND_DATA = 1,
107 GF_OMP_TARGET_KIND_UPDATE = 2,
109 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
110 a thread synchronization via some sort of barrier. The exact barrier
111 that would otherwise be emitted is dependent on the OMP statement with
112 which this return is associated. */
113 GF_OMP_RETURN_NOWAIT = 1 << 0,
115 GF_OMP_SECTION_LAST = 1 << 0,
116 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
117 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
118 GF_PREDICT_TAKEN = 1 << 15
121 /* Currently, there are only two types of gimple debug stmt. Others are
122 envisioned, for example, to enable the generation of is_stmt notes
123 in line number information, to mark sequence points, etc. This
124 subcode is to be used to tell them apart. */
125 enum gimple_debug_subcode {
126 GIMPLE_DEBUG_BIND = 0,
127 GIMPLE_DEBUG_SOURCE_BIND = 1
130 /* Masks for selecting a pass local flag (PLF) to work on. These
131 masks are used by gimple_set_plf and gimple_plf. */
132 enum plf_mask {
133 GF_PLF_1 = 1 << 0,
134 GF_PLF_2 = 1 << 1
137 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
138 are for 64 bit hosts. */
140 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
141 chain_next ("%h.next"), variable_size))
142 gimple_statement_base
144 /* [ WORD 1 ]
145 Main identifying code for a tuple. */
146 ENUM_BITFIELD(gimple_code) code : 8;
148 /* Nonzero if a warning should not be emitted on this tuple. */
149 unsigned int no_warning : 1;
151 /* Nonzero if this tuple has been visited. Passes are responsible
152 for clearing this bit before using it. */
153 unsigned int visited : 1;
155 /* Nonzero if this tuple represents a non-temporal move. */
156 unsigned int nontemporal_move : 1;
158 /* Pass local flags. These flags are free for any pass to use as
159 they see fit. Passes should not assume that these flags contain
160 any useful value when the pass starts. Any initial state that
161 the pass requires should be set on entry to the pass. See
162 gimple_set_plf and gimple_plf for usage. */
163 unsigned int plf : 2;
165 /* Nonzero if this statement has been modified and needs to have its
166 operands rescanned. */
167 unsigned modified : 1;
169 /* Nonzero if this statement contains volatile operands. */
170 unsigned has_volatile_ops : 1;
172 /* Padding to get subcode to 16 bit alignment. */
173 unsigned pad : 1;
175 /* The SUBCODE field can be used for tuple-specific flags for tuples
176 that do not require subcodes. Note that SUBCODE should be at
177 least as wide as tree codes, as several tuples store tree codes
178 in there. */
179 unsigned int subcode : 16;
181 /* UID of this statement. This is used by passes that want to
182 assign IDs to statements. It must be assigned and used by each
183 pass. By default it should be assumed to contain garbage. */
184 unsigned uid;
186 /* [ WORD 2 ]
187 Locus information for debug info. */
188 location_t location;
190 /* Number of operands in this tuple. */
191 unsigned num_ops;
193 /* [ WORD 3 ]
194 Basic block holding this statement. */
195 basic_block bb;
197 /* [ WORD 4-5 ]
198 Linked lists of gimple statements. The next pointers form
199 a NULL terminated list, the prev pointers are a cyclic list.
200 A gimple statement is hence also a double-ended list of
201 statements, with the pointer itself being the first element,
202 and the prev pointer being the last. */
203 gimple next;
204 gimple GTY((skip)) prev;
208 /* Base structure for tuples with operands. */
210 /* This gimple subclass has no tag value. */
211 struct GTY(())
212 gimple_statement_with_ops_base : public gimple_statement_base
214 /* [ WORD 1-6 ] : base class */
216 /* [ WORD 7 ]
217 SSA operand vectors. NOTE: It should be possible to
218 amalgamate these vectors with the operand vector OP. However,
219 the SSA operand vectors are organized differently and contain
220 more information (like immediate use chaining). */
221 struct use_optype_d GTY((skip (""))) *use_ops;
225 /* Statements that take register operands. */
227 struct GTY((tag("GSS_WITH_OPS")))
228 gimple_statement_with_ops : public gimple_statement_with_ops_base
230 /* [ WORD 1-7 ] : base class */
232 /* [ WORD 8 ]
233 Operand vector. NOTE! This must always be the last field
234 of this structure. In particular, this means that this
235 structure cannot be embedded inside another one. */
236 tree GTY((length ("%h.num_ops"))) op[1];
240 /* Base for statements that take both memory and register operands. */
242 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
243 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
245 /* [ WORD 1-7 ] : base class */
247 /* [ WORD 8-9 ]
248 Virtual operands for this statement. The GC will pick them
249 up via the ssa_names array. */
250 tree GTY((skip (""))) vdef;
251 tree GTY((skip (""))) vuse;
255 /* Statements that take both memory and register operands. */
257 struct GTY((tag("GSS_WITH_MEM_OPS")))
258 gimple_statement_with_memory_ops :
259 public gimple_statement_with_memory_ops_base
261 /* [ WORD 1-9 ] : base class */
263 /* [ WORD 10 ]
264 Operand vector. NOTE! This must always be the last field
265 of this structure. In particular, this means that this
266 structure cannot be embedded inside another one. */
267 tree GTY((length ("%h.num_ops"))) op[1];
271 /* Call statements that take both memory and register operands. */
273 struct GTY((tag("GSS_CALL")))
274 gimple_statement_call : public gimple_statement_with_memory_ops_base
276 /* [ WORD 1-9 ] : base class */
278 /* [ WORD 10-13 ] */
279 struct pt_solution call_used;
280 struct pt_solution call_clobbered;
282 /* [ WORD 14 ] */
283 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
284 tree GTY ((tag ("0"))) fntype;
285 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
286 } u;
288 /* [ WORD 15 ]
289 Operand vector. NOTE! This must always be the last field
290 of this structure. In particular, this means that this
291 structure cannot be embedded inside another one. */
292 tree GTY((length ("%h.num_ops"))) op[1];
296 /* OpenMP statements (#pragma omp). */
298 struct GTY((tag("GSS_OMP")))
299 gimple_statement_omp : public gimple_statement_base
301 /* [ WORD 1-6 ] : base class */
303 /* [ WORD 7 ] */
304 gimple_seq body;
308 /* GIMPLE_BIND */
310 struct GTY((tag("GSS_BIND")))
311 gimple_statement_bind : public gimple_statement_base
313 /* [ WORD 1-6 ] : base class */
315 /* [ WORD 7 ]
316 Variables declared in this scope. */
317 tree vars;
319 /* [ WORD 8 ]
320 This is different than the BLOCK field in gimple_statement_base,
321 which is analogous to TREE_BLOCK (i.e., the lexical block holding
322 this statement). This field is the equivalent of BIND_EXPR_BLOCK
323 in tree land (i.e., the lexical scope defined by this bind). See
324 gimple-low.c. */
325 tree block;
327 /* [ WORD 9 ] */
328 gimple_seq body;
332 /* GIMPLE_CATCH */
334 struct GTY((tag("GSS_CATCH")))
335 gimple_statement_catch : public gimple_statement_base
337 /* [ WORD 1-6 ] : base class */
339 /* [ WORD 7 ] */
340 tree types;
342 /* [ WORD 8 ] */
343 gimple_seq handler;
347 /* GIMPLE_EH_FILTER */
349 struct GTY((tag("GSS_EH_FILTER")))
350 gimple_statement_eh_filter : public gimple_statement_base
352 /* [ WORD 1-6 ] : base class */
354 /* [ WORD 7 ]
355 Filter types. */
356 tree types;
358 /* [ WORD 8 ]
359 Failure actions. */
360 gimple_seq failure;
363 /* GIMPLE_EH_ELSE */
365 struct GTY((tag("GSS_EH_ELSE")))
366 gimple_statement_eh_else : public gimple_statement_base
368 /* [ WORD 1-6 ] : base class */
370 /* [ WORD 7,8 ] */
371 gimple_seq n_body, e_body;
374 /* GIMPLE_EH_MUST_NOT_THROW */
376 struct GTY((tag("GSS_EH_MNT")))
377 gimple_statement_eh_mnt : public gimple_statement_base
379 /* [ WORD 1-6 ] : base class */
381 /* [ WORD 7 ] Abort function decl. */
382 tree fndecl;
385 /* GIMPLE_PHI */
387 struct GTY((tag("GSS_PHI")))
388 gimple_statement_phi : public gimple_statement_base
390 /* [ WORD 1-6 ] : base class */
392 /* [ WORD 7 ] */
393 unsigned capacity;
394 unsigned nargs;
396 /* [ WORD 8 ] */
397 tree result;
399 /* [ WORD 9 ] */
400 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
404 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
406 struct GTY((tag("GSS_EH_CTRL")))
407 gimple_statement_eh_ctrl : public gimple_statement_base
409 /* [ WORD 1-6 ] : base class */
411 /* [ WORD 7 ]
412 Exception region number. */
413 int region;
416 struct GTY((tag("GSS_EH_CTRL")))
417 gimple_statement_resx : public gimple_statement_eh_ctrl
419 /* No extra fields; adds invariant:
420 stmt->code == GIMPLE_RESX. */
423 struct GTY((tag("GSS_EH_CTRL")))
424 gimple_statement_eh_dispatch : public gimple_statement_eh_ctrl
426 /* No extra fields; adds invariant:
427 stmt->code == GIMPLE_EH_DISPATH. */
431 /* GIMPLE_TRY */
433 struct GTY((tag("GSS_TRY")))
434 gimple_statement_try : public gimple_statement_base
436 /* [ WORD 1-6 ] : base class */
438 /* [ WORD 7 ]
439 Expression to evaluate. */
440 gimple_seq eval;
442 /* [ WORD 8 ]
443 Cleanup expression. */
444 gimple_seq cleanup;
447 /* Kind of GIMPLE_TRY statements. */
448 enum gimple_try_flags
450 /* A try/catch. */
451 GIMPLE_TRY_CATCH = 1 << 0,
453 /* A try/finally. */
454 GIMPLE_TRY_FINALLY = 1 << 1,
455 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
457 /* Analogous to TRY_CATCH_IS_CLEANUP. */
458 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
461 /* GIMPLE_WITH_CLEANUP_EXPR */
463 struct GTY((tag("GSS_WCE")))
464 gimple_statement_wce : public gimple_statement_base
466 /* [ WORD 1-6 ] : base class */
468 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
469 executed if an exception is thrown, not on normal exit of its
470 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
471 in TARGET_EXPRs. */
473 /* [ WORD 7 ]
474 Cleanup expression. */
475 gimple_seq cleanup;
479 /* GIMPLE_ASM */
481 struct GTY((tag("GSS_ASM")))
482 gimple_statement_asm : public gimple_statement_with_memory_ops_base
484 /* [ WORD 1-9 ] : base class */
486 /* [ WORD 10 ]
487 __asm__ statement. */
488 const char *string;
490 /* [ WORD 11 ]
491 Number of inputs, outputs, clobbers, labels. */
492 unsigned char ni;
493 unsigned char no;
494 unsigned char nc;
495 unsigned char nl;
497 /* [ WORD 12 ]
498 Operand vector. NOTE! This must always be the last field
499 of this structure. In particular, this means that this
500 structure cannot be embedded inside another one. */
501 tree GTY((length ("%h.num_ops"))) op[1];
504 /* GIMPLE_OMP_CRITICAL */
506 struct GTY((tag("GSS_OMP_CRITICAL")))
507 gimple_statement_omp_critical : public gimple_statement_omp
509 /* [ WORD 1-7 ] : base class */
511 /* [ WORD 8 ]
512 Critical section name. */
513 tree name;
517 struct GTY(()) gimple_omp_for_iter {
518 /* Condition code. */
519 enum tree_code cond;
521 /* Index variable. */
522 tree index;
524 /* Initial value. */
525 tree initial;
527 /* Final value. */
528 tree final;
530 /* Increment. */
531 tree incr;
534 /* GIMPLE_OMP_FOR */
536 struct GTY((tag("GSS_OMP_FOR")))
537 gimple_statement_omp_for : public gimple_statement_omp
539 /* [ WORD 1-7 ] : base class */
541 /* [ WORD 8 ] */
542 tree clauses;
544 /* [ WORD 9 ]
545 Number of elements in iter array. */
546 size_t collapse;
548 /* [ WORD 10 ] */
549 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
551 /* [ WORD 11 ]
552 Pre-body evaluated before the loop body begins. */
553 gimple_seq pre_body;
557 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET */
558 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
559 gimple_statement_omp_parallel_layout : public gimple_statement_omp
561 /* [ WORD 1-7 ] : base class */
563 /* [ WORD 8 ]
564 Clauses. */
565 tree clauses;
567 /* [ WORD 9 ]
568 Child function holding the body of the parallel region. */
569 tree child_fn;
571 /* [ WORD 10 ]
572 Shared data argument. */
573 tree data_arg;
576 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
577 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
578 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
580 /* No extra fields; adds invariant:
581 stmt->code == GIMPLE_OMP_PARALLEL
582 || stmt->code == GIMPLE_OMP_TASK. */
586 /* GIMPLE_OMP_PARALLEL */
587 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
588 gimple_statement_omp_parallel : public gimple_statement_omp_taskreg
590 /* No extra fields; adds invariant:
591 stmt->code == GIMPLE_OMP_PARALLEL. */
594 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
595 gimple_statement_omp_target : public gimple_statement_omp_parallel_layout
597 /* No extra fields; adds invariant:
598 stmt->code == GIMPLE_OMP_TARGET. */
601 /* GIMPLE_OMP_TASK */
603 struct GTY((tag("GSS_OMP_TASK")))
604 gimple_statement_omp_task : public gimple_statement_omp_taskreg
606 /* [ WORD 1-10 ] : base class */
608 /* [ WORD 11 ]
609 Child function holding firstprivate initialization if needed. */
610 tree copy_fn;
612 /* [ WORD 12-13 ]
613 Size and alignment in bytes of the argument data block. */
614 tree arg_size;
615 tree arg_align;
619 /* GIMPLE_OMP_SECTION */
620 /* Uses struct gimple_statement_omp. */
623 /* GIMPLE_OMP_SECTIONS */
625 struct GTY((tag("GSS_OMP_SECTIONS")))
626 gimple_statement_omp_sections : public gimple_statement_omp
628 /* [ WORD 1-7 ] : base class */
630 /* [ WORD 8 ] */
631 tree clauses;
633 /* [ WORD 9 ]
634 The control variable used for deciding which of the sections to
635 execute. */
636 tree control;
639 /* GIMPLE_OMP_CONTINUE.
641 Note: This does not inherit from gimple_statement_omp, because we
642 do not need the body field. */
644 struct GTY((tag("GSS_OMP_CONTINUE")))
645 gimple_statement_omp_continue : public gimple_statement_base
647 /* [ WORD 1-6 ] : base class */
649 /* [ WORD 7 ] */
650 tree control_def;
652 /* [ WORD 8 ] */
653 tree control_use;
656 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
658 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
659 gimple_statement_omp_single_layout : public gimple_statement_omp
661 /* [ WORD 1-7 ] : base class */
663 /* [ WORD 7 ] */
664 tree clauses;
667 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
668 gimple_statement_omp_single : public gimple_statement_omp_single_layout
670 /* No extra fields; adds invariant:
671 stmt->code == GIMPLE_OMP_SINGLE. */
674 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
675 gimple_statement_omp_teams : public gimple_statement_omp_single_layout
677 /* No extra fields; adds invariant:
678 stmt->code == GIMPLE_OMP_TEAMS. */
682 /* GIMPLE_OMP_ATOMIC_LOAD.
683 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
684 contains a sequence, which we don't need here. */
686 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
687 gimple_statement_omp_atomic_load : public gimple_statement_base
689 /* [ WORD 1-6 ] : base class */
691 /* [ WORD 7-8 ] */
692 tree rhs, lhs;
695 /* GIMPLE_OMP_ATOMIC_STORE.
696 See note on GIMPLE_OMP_ATOMIC_LOAD. */
698 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
699 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
701 /* [ WORD 1-6 ] : base class */
703 /* [ WORD 7 ] */
704 tree val;
707 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
708 gimple_statement_omp_atomic_store :
709 public gimple_statement_omp_atomic_store_layout
711 /* No extra fields; adds invariant:
712 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
715 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
716 gimple_statement_omp_return :
717 public gimple_statement_omp_atomic_store_layout
719 /* No extra fields; adds invariant:
720 stmt->code == GIMPLE_OMP_RETURN. */
723 /* GIMPLE_TRANSACTION. */
725 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
727 /* The __transaction_atomic was declared [[outer]] or it is
728 __transaction_relaxed. */
729 #define GTMA_IS_OUTER (1u << 0)
730 #define GTMA_IS_RELAXED (1u << 1)
731 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
733 /* The transaction is seen to not have an abort. */
734 #define GTMA_HAVE_ABORT (1u << 2)
735 /* The transaction is seen to have loads or stores. */
736 #define GTMA_HAVE_LOAD (1u << 3)
737 #define GTMA_HAVE_STORE (1u << 4)
738 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
739 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
740 /* The transaction WILL enter serial irrevocable mode.
741 An irrevocable block post-dominates the entire transaction, such
742 that all invocations of the transaction will go serial-irrevocable.
743 In such case, we don't bother instrumenting the transaction, and
744 tell the runtime that it should begin the transaction in
745 serial-irrevocable mode. */
746 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
747 /* The transaction contains no instrumentation code whatsover, most
748 likely because it is guaranteed to go irrevocable upon entry. */
749 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
751 struct GTY((tag("GSS_TRANSACTION")))
752 gimple_statement_transaction : public gimple_statement_with_memory_ops_base
754 /* [ WORD 1-9 ] : base class */
756 /* [ WORD 10 ] */
757 gimple_seq body;
759 /* [ WORD 11 ] */
760 tree label;
763 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
764 enum gimple_statement_structure_enum {
765 #include "gsstruct.def"
766 LAST_GSS_ENUM
768 #undef DEFGSSTRUCT
770 template <>
771 template <>
772 inline bool
773 is_a_helper <gimple_statement_asm *>::test (gimple gs)
775 return gs->code == GIMPLE_ASM;
778 template <>
779 template <>
780 inline bool
781 is_a_helper <gimple_statement_bind *>::test (gimple gs)
783 return gs->code == GIMPLE_BIND;
786 template <>
787 template <>
788 inline bool
789 is_a_helper <gimple_statement_call *>::test (gimple gs)
791 return gs->code == GIMPLE_CALL;
794 template <>
795 template <>
796 inline bool
797 is_a_helper <gimple_statement_catch *>::test (gimple gs)
799 return gs->code == GIMPLE_CATCH;
802 template <>
803 template <>
804 inline bool
805 is_a_helper <gimple_statement_resx *>::test (gimple gs)
807 return gs->code == GIMPLE_RESX;
810 template <>
811 template <>
812 inline bool
813 is_a_helper <gimple_statement_eh_dispatch *>::test (gimple gs)
815 return gs->code == GIMPLE_EH_DISPATCH;
818 template <>
819 template <>
820 inline bool
821 is_a_helper <gimple_statement_eh_else *>::test (gimple gs)
823 return gs->code == GIMPLE_EH_ELSE;
826 template <>
827 template <>
828 inline bool
829 is_a_helper <gimple_statement_eh_filter *>::test (gimple gs)
831 return gs->code == GIMPLE_EH_FILTER;
834 template <>
835 template <>
836 inline bool
837 is_a_helper <gimple_statement_eh_mnt *>::test (gimple gs)
839 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
842 template <>
843 template <>
844 inline bool
845 is_a_helper <gimple_statement_omp_atomic_load *>::test (gimple gs)
847 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
850 template <>
851 template <>
852 inline bool
853 is_a_helper <gimple_statement_omp_atomic_store *>::test (gimple gs)
855 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
858 template <>
859 template <>
860 inline bool
861 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
863 return gs->code == GIMPLE_OMP_RETURN;
866 template <>
867 template <>
868 inline bool
869 is_a_helper <gimple_statement_omp_continue *>::test (gimple gs)
871 return gs->code == GIMPLE_OMP_CONTINUE;
874 template <>
875 template <>
876 inline bool
877 is_a_helper <gimple_statement_omp_critical *>::test (gimple gs)
879 return gs->code == GIMPLE_OMP_CRITICAL;
882 template <>
883 template <>
884 inline bool
885 is_a_helper <gimple_statement_omp_for *>::test (gimple gs)
887 return gs->code == GIMPLE_OMP_FOR;
890 template <>
891 template <>
892 inline bool
893 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple gs)
895 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
898 template <>
899 template <>
900 inline bool
901 is_a_helper <gimple_statement_omp_parallel *>::test (gimple gs)
903 return gs->code == GIMPLE_OMP_PARALLEL;
906 template <>
907 template <>
908 inline bool
909 is_a_helper <gimple_statement_omp_target *>::test (gimple gs)
911 return gs->code == GIMPLE_OMP_TARGET;
914 template <>
915 template <>
916 inline bool
917 is_a_helper <gimple_statement_omp_sections *>::test (gimple gs)
919 return gs->code == GIMPLE_OMP_SECTIONS;
922 template <>
923 template <>
924 inline bool
925 is_a_helper <gimple_statement_omp_single *>::test (gimple gs)
927 return gs->code == GIMPLE_OMP_SINGLE;
930 template <>
931 template <>
932 inline bool
933 is_a_helper <gimple_statement_omp_teams *>::test (gimple gs)
935 return gs->code == GIMPLE_OMP_TEAMS;
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gimple_statement_omp_task *>::test (gimple gs)
943 return gs->code == GIMPLE_OMP_TASK;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gimple_statement_phi *>::test (gimple gs)
951 return gs->code == GIMPLE_PHI;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <gimple_statement_transaction *>::test (gimple gs)
959 return gs->code == GIMPLE_TRANSACTION;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <gimple_statement_try *>::test (gimple gs)
967 return gs->code == GIMPLE_TRY;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gimple_statement_wce *>::test (gimple gs)
975 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <const gimple_statement_asm *>::test (const_gimple gs)
983 return gs->code == GIMPLE_ASM;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <const gimple_statement_bind *>::test (const_gimple gs)
991 return gs->code == GIMPLE_BIND;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <const gimple_statement_call *>::test (const_gimple gs)
999 return gs->code == GIMPLE_CALL;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <const gimple_statement_catch *>::test (const_gimple gs)
1007 return gs->code == GIMPLE_CATCH;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <const gimple_statement_resx *>::test (const_gimple gs)
1015 return gs->code == GIMPLE_RESX;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <const gimple_statement_eh_dispatch *>::test (const_gimple gs)
1023 return gs->code == GIMPLE_EH_DISPATCH;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <const gimple_statement_eh_filter *>::test (const_gimple gs)
1031 return gs->code == GIMPLE_EH_FILTER;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <const gimple_statement_omp_atomic_load *>::test (const_gimple gs)
1039 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <const gimple_statement_omp_atomic_store *>::test (const_gimple gs)
1047 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1055 return gs->code == GIMPLE_OMP_RETURN;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <const gimple_statement_omp_continue *>::test (const_gimple gs)
1063 return gs->code == GIMPLE_OMP_CONTINUE;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <const gimple_statement_omp_critical *>::test (const_gimple gs)
1071 return gs->code == GIMPLE_OMP_CRITICAL;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <const gimple_statement_omp_for *>::test (const_gimple gs)
1079 return gs->code == GIMPLE_OMP_FOR;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1087 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <const gimple_statement_omp_parallel *>::test (const_gimple gs)
1095 return gs->code == GIMPLE_OMP_PARALLEL;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <const gimple_statement_omp_target *>::test (const_gimple gs)
1103 return gs->code == GIMPLE_OMP_TARGET;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <const gimple_statement_omp_sections *>::test (const_gimple gs)
1111 return gs->code == GIMPLE_OMP_SECTIONS;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <const gimple_statement_omp_single *>::test (const_gimple gs)
1119 return gs->code == GIMPLE_OMP_SINGLE;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <const gimple_statement_omp_teams *>::test (const_gimple gs)
1127 return gs->code == GIMPLE_OMP_TEAMS;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <const gimple_statement_omp_task *>::test (const_gimple gs)
1135 return gs->code == GIMPLE_OMP_TASK;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <const gimple_statement_phi *>::test (const_gimple gs)
1143 return gs->code == GIMPLE_PHI;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <const gimple_statement_transaction *>::test (const_gimple gs)
1151 return gs->code == GIMPLE_TRANSACTION;
1154 /* Offset in bytes to the location of the operand vector.
1155 Zero if there is no operand vector for this tuple structure. */
1156 extern size_t const gimple_ops_offset_[];
1158 /* Map GIMPLE codes to GSS codes. */
1159 extern enum gimple_statement_structure_enum const gss_for_code_[];
1161 /* This variable holds the currently expanded gimple statement for purposes
1162 of comminucating the profile info to the builtin expanders. */
1163 extern gimple currently_expanding_gimple_stmt;
1165 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1166 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1167 gimple gimple_build_return (tree);
1168 void gimple_call_reset_alias_info (gimple);
1169 gimple gimple_build_call_vec (tree, vec<tree> );
1170 gimple gimple_build_call (tree, unsigned, ...);
1171 gimple gimple_build_call_valist (tree, unsigned, va_list);
1172 gimple gimple_build_call_internal (enum internal_fn, unsigned, ...);
1173 gimple gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1174 gimple gimple_build_call_from_tree (tree);
1175 gimple gimple_build_assign_stat (tree, tree MEM_STAT_DECL);
1176 #define gimple_build_assign(l,r) gimple_build_assign_stat (l, r MEM_STAT_INFO)
1177 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1178 tree, tree, tree CXX_MEM_STAT_INFO);
1179 gimple gimple_build_assign_with_ops (enum tree_code, tree,
1180 tree, tree CXX_MEM_STAT_INFO);
1181 gimple gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1182 gimple gimple_build_cond_from_tree (tree, tree, tree);
1183 void gimple_cond_set_condition_from_tree (gimple, tree);
1184 gimple gimple_build_label (tree label);
1185 gimple gimple_build_goto (tree dest);
1186 gimple gimple_build_nop (void);
1187 gimple gimple_build_bind (tree, gimple_seq, tree);
1188 gimple gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1189 vec<tree, va_gc> *, vec<tree, va_gc> *,
1190 vec<tree, va_gc> *);
1191 gimple gimple_build_catch (tree, gimple_seq);
1192 gimple gimple_build_eh_filter (tree, gimple_seq);
1193 gimple gimple_build_eh_must_not_throw (tree);
1194 gimple gimple_build_eh_else (gimple_seq, gimple_seq);
1195 gimple_statement_try *gimple_build_try (gimple_seq, gimple_seq,
1196 enum gimple_try_flags);
1197 gimple gimple_build_wce (gimple_seq);
1198 gimple gimple_build_resx (int);
1199 gimple gimple_build_switch_nlabels (unsigned, tree, tree);
1200 gimple gimple_build_switch (tree, tree, vec<tree> );
1201 gimple gimple_build_eh_dispatch (int);
1202 gimple gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1203 #define gimple_build_debug_bind(var,val,stmt) \
1204 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1205 gimple gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1206 #define gimple_build_debug_source_bind(var,val,stmt) \
1207 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1208 gimple gimple_build_omp_critical (gimple_seq, tree);
1209 gimple gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1210 gimple gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1211 gimple gimple_build_omp_task (gimple_seq, tree, tree, tree, tree, tree, tree);
1212 gimple gimple_build_omp_section (gimple_seq);
1213 gimple gimple_build_omp_master (gimple_seq);
1214 gimple gimple_build_omp_taskgroup (gimple_seq);
1215 gimple gimple_build_omp_continue (tree, tree);
1216 gimple gimple_build_omp_ordered (gimple_seq);
1217 gimple gimple_build_omp_return (bool);
1218 gimple gimple_build_omp_sections (gimple_seq, tree);
1219 gimple gimple_build_omp_sections_switch (void);
1220 gimple gimple_build_omp_single (gimple_seq, tree);
1221 gimple gimple_build_omp_target (gimple_seq, int, tree);
1222 gimple gimple_build_omp_teams (gimple_seq, tree);
1223 gimple gimple_build_omp_atomic_load (tree, tree);
1224 gimple gimple_build_omp_atomic_store (tree);
1225 gimple gimple_build_transaction (gimple_seq, tree);
1226 gimple gimple_build_predict (enum br_predictor, enum prediction);
1227 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1228 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1229 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1230 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1231 location_t);
1232 extern void annotate_all_with_location (gimple_seq, location_t);
1233 bool empty_body_p (gimple_seq);
1234 gimple_seq gimple_seq_copy (gimple_seq);
1235 bool gimple_call_same_target_p (const_gimple, const_gimple);
1236 int gimple_call_flags (const_gimple);
1237 int gimple_call_arg_flags (const_gimple, unsigned);
1238 int gimple_call_return_flags (const_gimple);
1239 bool gimple_assign_copy_p (gimple);
1240 bool gimple_assign_ssa_name_copy_p (gimple);
1241 bool gimple_assign_unary_nop_p (gimple);
1242 void gimple_set_bb (gimple, basic_block);
1243 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1244 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1245 tree, tree, tree);
1246 tree gimple_get_lhs (const_gimple);
1247 void gimple_set_lhs (gimple, tree);
1248 gimple gimple_copy (gimple);
1249 bool gimple_has_side_effects (const_gimple);
1250 bool gimple_could_trap_p_1 (gimple, bool, bool);
1251 bool gimple_could_trap_p (gimple);
1252 bool gimple_assign_rhs_could_trap_p (gimple);
1253 extern void dump_gimple_statistics (void);
1254 unsigned get_gimple_rhs_num_ops (enum tree_code);
1255 extern tree canonicalize_cond_expr_cond (tree);
1256 gimple gimple_call_copy_skip_args (gimple, bitmap);
1257 extern bool gimple_compare_field_offset (tree, tree);
1258 extern tree gimple_unsigned_type (tree);
1259 extern tree gimple_signed_type (tree);
1260 extern alias_set_type gimple_get_alias_set (tree);
1261 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1262 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1263 extern bool gimple_call_builtin_p (const_gimple);
1264 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1265 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1266 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1267 extern void dump_decl_set (FILE *, bitmap);
1268 extern bool nonfreeing_call_p (gimple);
1269 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1270 extern void sort_case_labels (vec<tree> );
1271 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1272 extern void gimple_seq_set_location (gimple_seq , location_t);
1274 /* Formal (expression) temporary table handling: multiple occurrences of
1275 the same scalar expression are evaluated into the same temporary. */
1277 typedef struct gimple_temp_hash_elt
1279 tree val; /* Key */
1280 tree temp; /* Value */
1281 } elt_t;
1283 /* Get the number of the next statement uid to be allocated. */
1284 static inline unsigned int
1285 gimple_stmt_max_uid (struct function *fn)
1287 return fn->last_stmt_uid;
1290 /* Set the number of the next statement uid to be allocated. */
1291 static inline void
1292 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1294 fn->last_stmt_uid = maxid;
1297 /* Set the number of the next statement uid to be allocated. */
1298 static inline unsigned int
1299 inc_gimple_stmt_max_uid (struct function *fn)
1301 return fn->last_stmt_uid++;
1304 /* Return the first node in GIMPLE sequence S. */
1306 static inline gimple_seq_node
1307 gimple_seq_first (gimple_seq s)
1309 return s;
1313 /* Return the first statement in GIMPLE sequence S. */
1315 static inline gimple
1316 gimple_seq_first_stmt (gimple_seq s)
1318 gimple_seq_node n = gimple_seq_first (s);
1319 return n;
1323 /* Return the last node in GIMPLE sequence S. */
1325 static inline gimple_seq_node
1326 gimple_seq_last (gimple_seq s)
1328 return s ? s->prev : NULL;
1332 /* Return the last statement in GIMPLE sequence S. */
1334 static inline gimple
1335 gimple_seq_last_stmt (gimple_seq s)
1337 gimple_seq_node n = gimple_seq_last (s);
1338 return n;
1342 /* Set the last node in GIMPLE sequence *PS to LAST. */
1344 static inline void
1345 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1347 (*ps)->prev = last;
1351 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1353 static inline void
1354 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1356 *ps = first;
1360 /* Return true if GIMPLE sequence S is empty. */
1362 static inline bool
1363 gimple_seq_empty_p (gimple_seq s)
1365 return s == NULL;
1368 /* Allocate a new sequence and initialize its first element with STMT. */
1370 static inline gimple_seq
1371 gimple_seq_alloc_with_stmt (gimple stmt)
1373 gimple_seq seq = NULL;
1374 gimple_seq_add_stmt (&seq, stmt);
1375 return seq;
1379 /* Returns the sequence of statements in BB. */
1381 static inline gimple_seq
1382 bb_seq (const_basic_block bb)
1384 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1387 static inline gimple_seq *
1388 bb_seq_addr (basic_block bb)
1390 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1393 /* Sets the sequence of statements in BB to SEQ. */
1395 static inline void
1396 set_bb_seq (basic_block bb, gimple_seq seq)
1398 gcc_checking_assert (!(bb->flags & BB_RTL));
1399 bb->il.gimple.seq = seq;
1403 /* Return the code for GIMPLE statement G. */
1405 static inline enum gimple_code
1406 gimple_code (const_gimple g)
1408 return g->code;
1412 /* Return the GSS code used by a GIMPLE code. */
1414 static inline enum gimple_statement_structure_enum
1415 gss_for_code (enum gimple_code code)
1417 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1418 return gss_for_code_[code];
1422 /* Return which GSS code is used by GS. */
1424 static inline enum gimple_statement_structure_enum
1425 gimple_statement_structure (gimple gs)
1427 return gss_for_code (gimple_code (gs));
1431 /* Return true if statement G has sub-statements. This is only true for
1432 High GIMPLE statements. */
1434 static inline bool
1435 gimple_has_substatements (gimple g)
1437 switch (gimple_code (g))
1439 case GIMPLE_BIND:
1440 case GIMPLE_CATCH:
1441 case GIMPLE_EH_FILTER:
1442 case GIMPLE_EH_ELSE:
1443 case GIMPLE_TRY:
1444 case GIMPLE_OMP_FOR:
1445 case GIMPLE_OMP_MASTER:
1446 case GIMPLE_OMP_TASKGROUP:
1447 case GIMPLE_OMP_ORDERED:
1448 case GIMPLE_OMP_SECTION:
1449 case GIMPLE_OMP_PARALLEL:
1450 case GIMPLE_OMP_TASK:
1451 case GIMPLE_OMP_SECTIONS:
1452 case GIMPLE_OMP_SINGLE:
1453 case GIMPLE_OMP_TARGET:
1454 case GIMPLE_OMP_TEAMS:
1455 case GIMPLE_OMP_CRITICAL:
1456 case GIMPLE_WITH_CLEANUP_EXPR:
1457 case GIMPLE_TRANSACTION:
1458 return true;
1460 default:
1461 return false;
1466 /* Return the basic block holding statement G. */
1468 static inline basic_block
1469 gimple_bb (const_gimple g)
1471 return g->bb;
1475 /* Return the lexical scope block holding statement G. */
1477 static inline tree
1478 gimple_block (const_gimple g)
1480 return LOCATION_BLOCK (g->location);
1484 /* Set BLOCK to be the lexical scope block holding statement G. */
1486 static inline void
1487 gimple_set_block (gimple g, tree block)
1489 if (block)
1490 g->location =
1491 COMBINE_LOCATION_DATA (line_table, g->location, block);
1492 else
1493 g->location = LOCATION_LOCUS (g->location);
1497 /* Return location information for statement G. */
1499 static inline location_t
1500 gimple_location (const_gimple g)
1502 return g->location;
1505 /* Return location information for statement G if g is not NULL.
1506 Otherwise, UNKNOWN_LOCATION is returned. */
1508 static inline location_t
1509 gimple_location_safe (const_gimple g)
1511 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1514 /* Return pointer to location information for statement G. */
1516 static inline const location_t *
1517 gimple_location_ptr (const_gimple g)
1519 return &g->location;
1523 /* Set location information for statement G. */
1525 static inline void
1526 gimple_set_location (gimple g, location_t location)
1528 g->location = location;
1532 /* Return true if G contains location information. */
1534 static inline bool
1535 gimple_has_location (const_gimple g)
1537 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1541 /* Return the file name of the location of STMT. */
1543 static inline const char *
1544 gimple_filename (const_gimple stmt)
1546 return LOCATION_FILE (gimple_location (stmt));
1550 /* Return the line number of the location of STMT. */
1552 static inline int
1553 gimple_lineno (const_gimple stmt)
1555 return LOCATION_LINE (gimple_location (stmt));
1559 /* Determine whether SEQ is a singleton. */
1561 static inline bool
1562 gimple_seq_singleton_p (gimple_seq seq)
1564 return ((gimple_seq_first (seq) != NULL)
1565 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1568 /* Return true if no warnings should be emitted for statement STMT. */
1570 static inline bool
1571 gimple_no_warning_p (const_gimple stmt)
1573 return stmt->no_warning;
1576 /* Set the no_warning flag of STMT to NO_WARNING. */
1578 static inline void
1579 gimple_set_no_warning (gimple stmt, bool no_warning)
1581 stmt->no_warning = (unsigned) no_warning;
1584 /* Set the visited status on statement STMT to VISITED_P. */
1586 static inline void
1587 gimple_set_visited (gimple stmt, bool visited_p)
1589 stmt->visited = (unsigned) visited_p;
1593 /* Return the visited status for statement STMT. */
1595 static inline bool
1596 gimple_visited_p (gimple stmt)
1598 return stmt->visited;
1602 /* Set pass local flag PLF on statement STMT to VAL_P. */
1604 static inline void
1605 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1607 if (val_p)
1608 stmt->plf |= (unsigned int) plf;
1609 else
1610 stmt->plf &= ~((unsigned int) plf);
1614 /* Return the value of pass local flag PLF on statement STMT. */
1616 static inline unsigned int
1617 gimple_plf (gimple stmt, enum plf_mask plf)
1619 return stmt->plf & ((unsigned int) plf);
1623 /* Set the UID of statement. */
1625 static inline void
1626 gimple_set_uid (gimple g, unsigned uid)
1628 g->uid = uid;
1632 /* Return the UID of statement. */
1634 static inline unsigned
1635 gimple_uid (const_gimple g)
1637 return g->uid;
1641 /* Make statement G a singleton sequence. */
1643 static inline void
1644 gimple_init_singleton (gimple g)
1646 g->next = NULL;
1647 g->prev = g;
1651 /* Return true if GIMPLE statement G has register or memory operands. */
1653 static inline bool
1654 gimple_has_ops (const_gimple g)
1656 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1659 template <>
1660 template <>
1661 inline bool
1662 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1664 return gimple_has_ops (gs);
1667 template <>
1668 template <>
1669 inline bool
1670 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1672 return gimple_has_ops (gs);
1675 /* Return true if GIMPLE statement G has memory operands. */
1677 static inline bool
1678 gimple_has_mem_ops (const_gimple g)
1680 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1683 template <>
1684 template <>
1685 inline bool
1686 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1688 return gimple_has_mem_ops (gs);
1691 template <>
1692 template <>
1693 inline bool
1694 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1696 return gimple_has_mem_ops (gs);
1699 /* Return the set of USE operands for statement G. */
1701 static inline struct use_optype_d *
1702 gimple_use_ops (const_gimple g)
1704 const gimple_statement_with_ops *ops_stmt =
1705 dyn_cast <const gimple_statement_with_ops *> (g);
1706 if (!ops_stmt)
1707 return NULL;
1708 return ops_stmt->use_ops;
1712 /* Set USE to be the set of USE operands for statement G. */
1714 static inline void
1715 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1717 gimple_statement_with_ops *ops_stmt =
1718 as_a <gimple_statement_with_ops *> (g);
1719 ops_stmt->use_ops = use;
1723 /* Return the single VUSE operand of the statement G. */
1725 static inline tree
1726 gimple_vuse (const_gimple g)
1728 const gimple_statement_with_memory_ops *mem_ops_stmt =
1729 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1730 if (!mem_ops_stmt)
1731 return NULL_TREE;
1732 return mem_ops_stmt->vuse;
1735 /* Return the single VDEF operand of the statement G. */
1737 static inline tree
1738 gimple_vdef (const_gimple g)
1740 const gimple_statement_with_memory_ops *mem_ops_stmt =
1741 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1742 if (!mem_ops_stmt)
1743 return NULL_TREE;
1744 return mem_ops_stmt->vdef;
1747 /* Return the single VUSE operand of the statement G. */
1749 static inline tree *
1750 gimple_vuse_ptr (gimple g)
1752 gimple_statement_with_memory_ops *mem_ops_stmt =
1753 dyn_cast <gimple_statement_with_memory_ops *> (g);
1754 if (!mem_ops_stmt)
1755 return NULL;
1756 return &mem_ops_stmt->vuse;
1759 /* Return the single VDEF operand of the statement G. */
1761 static inline tree *
1762 gimple_vdef_ptr (gimple g)
1764 gimple_statement_with_memory_ops *mem_ops_stmt =
1765 dyn_cast <gimple_statement_with_memory_ops *> (g);
1766 if (!mem_ops_stmt)
1767 return NULL;
1768 return &mem_ops_stmt->vdef;
1771 /* Set the single VUSE operand of the statement G. */
1773 static inline void
1774 gimple_set_vuse (gimple g, tree vuse)
1776 gimple_statement_with_memory_ops *mem_ops_stmt =
1777 as_a <gimple_statement_with_memory_ops *> (g);
1778 mem_ops_stmt->vuse = vuse;
1781 /* Set the single VDEF operand of the statement G. */
1783 static inline void
1784 gimple_set_vdef (gimple g, tree vdef)
1786 gimple_statement_with_memory_ops *mem_ops_stmt =
1787 as_a <gimple_statement_with_memory_ops *> (g);
1788 mem_ops_stmt->vdef = vdef;
1792 /* Return true if statement G has operands and the modified field has
1793 been set. */
1795 static inline bool
1796 gimple_modified_p (const_gimple g)
1798 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1802 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1803 a MODIFIED field. */
1805 static inline void
1806 gimple_set_modified (gimple s, bool modifiedp)
1808 if (gimple_has_ops (s))
1809 s->modified = (unsigned) modifiedp;
1813 /* Return the tree code for the expression computed by STMT. This is
1814 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1815 GIMPLE_CALL, return CALL_EXPR as the expression code for
1816 consistency. This is useful when the caller needs to deal with the
1817 three kinds of computation that GIMPLE supports. */
1819 static inline enum tree_code
1820 gimple_expr_code (const_gimple stmt)
1822 enum gimple_code code = gimple_code (stmt);
1823 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1824 return (enum tree_code) stmt->subcode;
1825 else
1827 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1828 return CALL_EXPR;
1833 /* Return true if statement STMT contains volatile operands. */
1835 static inline bool
1836 gimple_has_volatile_ops (const_gimple stmt)
1838 if (gimple_has_mem_ops (stmt))
1839 return stmt->has_volatile_ops;
1840 else
1841 return false;
1845 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1847 static inline void
1848 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1850 if (gimple_has_mem_ops (stmt))
1851 stmt->has_volatile_ops = (unsigned) volatilep;
1854 /* Return true if STMT is in a transaction. */
1856 static inline bool
1857 gimple_in_transaction (gimple stmt)
1859 return bb_in_transaction (gimple_bb (stmt));
1862 /* Return true if statement STMT may access memory. */
1864 static inline bool
1865 gimple_references_memory_p (gimple stmt)
1867 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1871 /* Return the subcode for OMP statement S. */
1873 static inline unsigned
1874 gimple_omp_subcode (const_gimple s)
1876 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1877 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1878 return s->subcode;
1881 /* Set the subcode for OMP statement S to SUBCODE. */
1883 static inline void
1884 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1886 /* We only have 16 bits for the subcode. Assert that we are not
1887 overflowing it. */
1888 gcc_gimple_checking_assert (subcode < (1 << 16));
1889 s->subcode = subcode;
1892 /* Set the nowait flag on OMP_RETURN statement S. */
1894 static inline void
1895 gimple_omp_return_set_nowait (gimple s)
1897 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1898 s->subcode |= GF_OMP_RETURN_NOWAIT;
1902 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1903 flag set. */
1905 static inline bool
1906 gimple_omp_return_nowait_p (const_gimple g)
1908 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1909 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1913 /* Set the LHS of OMP return. */
1915 static inline void
1916 gimple_omp_return_set_lhs (gimple g, tree lhs)
1918 gimple_statement_omp_return *omp_return_stmt =
1919 as_a <gimple_statement_omp_return *> (g);
1920 omp_return_stmt->val = lhs;
1924 /* Get the LHS of OMP return. */
1926 static inline tree
1927 gimple_omp_return_lhs (const_gimple g)
1929 const gimple_statement_omp_return *omp_return_stmt =
1930 as_a <const gimple_statement_omp_return *> (g);
1931 return omp_return_stmt->val;
1935 /* Return a pointer to the LHS of OMP return. */
1937 static inline tree *
1938 gimple_omp_return_lhs_ptr (gimple g)
1940 gimple_statement_omp_return *omp_return_stmt =
1941 as_a <gimple_statement_omp_return *> (g);
1942 return &omp_return_stmt->val;
1946 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1947 flag set. */
1949 static inline bool
1950 gimple_omp_section_last_p (const_gimple g)
1952 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1953 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1957 /* Set the GF_OMP_SECTION_LAST flag on G. */
1959 static inline void
1960 gimple_omp_section_set_last (gimple g)
1962 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1963 g->subcode |= GF_OMP_SECTION_LAST;
1967 /* Return true if OMP parallel statement G has the
1968 GF_OMP_PARALLEL_COMBINED flag set. */
1970 static inline bool
1971 gimple_omp_parallel_combined_p (const_gimple g)
1973 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1974 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1978 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1979 value of COMBINED_P. */
1981 static inline void
1982 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1984 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1985 if (combined_p)
1986 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1987 else
1988 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1992 /* Return true if OMP atomic load/store statement G has the
1993 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1995 static inline bool
1996 gimple_omp_atomic_need_value_p (const_gimple g)
1998 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
1999 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2000 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2004 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2006 static inline void
2007 gimple_omp_atomic_set_need_value (gimple g)
2009 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2010 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2011 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2015 /* Return true if OMP atomic load/store statement G has the
2016 GF_OMP_ATOMIC_SEQ_CST flag set. */
2018 static inline bool
2019 gimple_omp_atomic_seq_cst_p (const_gimple g)
2021 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2022 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2023 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2027 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2029 static inline void
2030 gimple_omp_atomic_set_seq_cst (gimple g)
2032 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2033 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2034 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2038 /* Return the number of operands for statement GS. */
2040 static inline unsigned
2041 gimple_num_ops (const_gimple gs)
2043 return gs->num_ops;
2047 /* Set the number of operands for statement GS. */
2049 static inline void
2050 gimple_set_num_ops (gimple gs, unsigned num_ops)
2052 gs->num_ops = num_ops;
2056 /* Return the array of operands for statement GS. */
2058 static inline tree *
2059 gimple_ops (gimple gs)
2061 size_t off;
2063 /* All the tuples have their operand vector at the very bottom
2064 of the structure. Note that those structures that do not
2065 have an operand vector have a zero offset. */
2066 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2067 gcc_gimple_checking_assert (off != 0);
2069 return (tree *) ((char *) gs + off);
2073 /* Return operand I for statement GS. */
2075 static inline tree
2076 gimple_op (const_gimple gs, unsigned i)
2078 if (gimple_has_ops (gs))
2080 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2081 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2083 else
2084 return NULL_TREE;
2087 /* Return a pointer to operand I for statement GS. */
2089 static inline tree *
2090 gimple_op_ptr (const_gimple gs, unsigned i)
2092 if (gimple_has_ops (gs))
2094 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2095 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2097 else
2098 return NULL;
2101 /* Set operand I of statement GS to OP. */
2103 static inline void
2104 gimple_set_op (gimple gs, unsigned i, tree op)
2106 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2108 /* Note. It may be tempting to assert that OP matches
2109 is_gimple_operand, but that would be wrong. Different tuples
2110 accept slightly different sets of tree operands. Each caller
2111 should perform its own validation. */
2112 gimple_ops (gs)[i] = op;
2115 /* Return true if GS is a GIMPLE_ASSIGN. */
2117 static inline bool
2118 is_gimple_assign (const_gimple gs)
2120 return gimple_code (gs) == GIMPLE_ASSIGN;
2123 /* Determine if expression CODE is one of the valid expressions that can
2124 be used on the RHS of GIMPLE assignments. */
2126 static inline enum gimple_rhs_class
2127 get_gimple_rhs_class (enum tree_code code)
2129 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2132 /* Return the LHS of assignment statement GS. */
2134 static inline tree
2135 gimple_assign_lhs (const_gimple gs)
2137 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2138 return gimple_op (gs, 0);
2142 /* Return a pointer to the LHS of assignment statement GS. */
2144 static inline tree *
2145 gimple_assign_lhs_ptr (const_gimple gs)
2147 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2148 return gimple_op_ptr (gs, 0);
2152 /* Set LHS to be the LHS operand of assignment statement GS. */
2154 static inline void
2155 gimple_assign_set_lhs (gimple gs, tree lhs)
2157 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2158 gimple_set_op (gs, 0, lhs);
2160 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2161 SSA_NAME_DEF_STMT (lhs) = gs;
2165 /* Return the first operand on the RHS of assignment statement GS. */
2167 static inline tree
2168 gimple_assign_rhs1 (const_gimple gs)
2170 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2171 return gimple_op (gs, 1);
2175 /* Return a pointer to the first operand on the RHS of assignment
2176 statement GS. */
2178 static inline tree *
2179 gimple_assign_rhs1_ptr (const_gimple gs)
2181 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2182 return gimple_op_ptr (gs, 1);
2185 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2187 static inline void
2188 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2190 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2192 gimple_set_op (gs, 1, rhs);
2196 /* Return the second operand on the RHS of assignment statement GS.
2197 If GS does not have two operands, NULL is returned instead. */
2199 static inline tree
2200 gimple_assign_rhs2 (const_gimple gs)
2202 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2204 if (gimple_num_ops (gs) >= 3)
2205 return gimple_op (gs, 2);
2206 else
2207 return NULL_TREE;
2211 /* Return a pointer to the second operand on the RHS of assignment
2212 statement GS. */
2214 static inline tree *
2215 gimple_assign_rhs2_ptr (const_gimple gs)
2217 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2218 return gimple_op_ptr (gs, 2);
2222 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2224 static inline void
2225 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2227 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2229 gimple_set_op (gs, 2, rhs);
2232 /* Return the third operand on the RHS of assignment statement GS.
2233 If GS does not have two operands, NULL is returned instead. */
2235 static inline tree
2236 gimple_assign_rhs3 (const_gimple gs)
2238 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2240 if (gimple_num_ops (gs) >= 4)
2241 return gimple_op (gs, 3);
2242 else
2243 return NULL_TREE;
2246 /* Return a pointer to the third operand on the RHS of assignment
2247 statement GS. */
2249 static inline tree *
2250 gimple_assign_rhs3_ptr (const_gimple gs)
2252 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2253 return gimple_op_ptr (gs, 3);
2257 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2259 static inline void
2260 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2262 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2264 gimple_set_op (gs, 3, rhs);
2267 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2268 to see only a maximum of two operands. */
2270 static inline void
2271 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2272 tree op1, tree op2)
2274 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2277 /* Returns true if GS is a nontemporal move. */
2279 static inline bool
2280 gimple_assign_nontemporal_move_p (const_gimple gs)
2282 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2283 return gs->nontemporal_move;
2286 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2288 static inline void
2289 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2291 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2292 gs->nontemporal_move = nontemporal;
2296 /* Return the code of the expression computed on the rhs of assignment
2297 statement GS. In case that the RHS is a single object, returns the
2298 tree code of the object. */
2300 static inline enum tree_code
2301 gimple_assign_rhs_code (const_gimple gs)
2303 enum tree_code code;
2304 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2306 code = (enum tree_code) gs->subcode;
2307 /* While we initially set subcode to the TREE_CODE of the rhs for
2308 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2309 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2310 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2311 code = TREE_CODE (gimple_assign_rhs1 (gs));
2313 return code;
2317 /* Set CODE to be the code for the expression computed on the RHS of
2318 assignment S. */
2320 static inline void
2321 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2323 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2324 s->subcode = code;
2328 /* Return the gimple rhs class of the code of the expression computed on
2329 the rhs of assignment statement GS.
2330 This will never return GIMPLE_INVALID_RHS. */
2332 static inline enum gimple_rhs_class
2333 gimple_assign_rhs_class (const_gimple gs)
2335 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2338 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2339 there is no operator associated with the assignment itself.
2340 Unlike gimple_assign_copy_p, this predicate returns true for
2341 any RHS operand, including those that perform an operation
2342 and do not have the semantics of a copy, such as COND_EXPR. */
2344 static inline bool
2345 gimple_assign_single_p (const_gimple gs)
2347 return (is_gimple_assign (gs)
2348 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2351 /* Return true if GS performs a store to its lhs. */
2353 static inline bool
2354 gimple_store_p (const_gimple gs)
2356 tree lhs = gimple_get_lhs (gs);
2357 return lhs && !is_gimple_reg (lhs);
2360 /* Return true if GS is an assignment that loads from its rhs1. */
2362 static inline bool
2363 gimple_assign_load_p (const_gimple gs)
2365 tree rhs;
2366 if (!gimple_assign_single_p (gs))
2367 return false;
2368 rhs = gimple_assign_rhs1 (gs);
2369 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2370 return true;
2371 rhs = get_base_address (rhs);
2372 return (DECL_P (rhs)
2373 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2377 /* Return true if S is a type-cast assignment. */
2379 static inline bool
2380 gimple_assign_cast_p (const_gimple s)
2382 if (is_gimple_assign (s))
2384 enum tree_code sc = gimple_assign_rhs_code (s);
2385 return CONVERT_EXPR_CODE_P (sc)
2386 || sc == VIEW_CONVERT_EXPR
2387 || sc == FIX_TRUNC_EXPR;
2390 return false;
2393 /* Return true if S is a clobber statement. */
2395 static inline bool
2396 gimple_clobber_p (const_gimple s)
2398 return gimple_assign_single_p (s)
2399 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2402 /* Return true if GS is a GIMPLE_CALL. */
2404 static inline bool
2405 is_gimple_call (const_gimple gs)
2407 return gimple_code (gs) == GIMPLE_CALL;
2410 /* Return the LHS of call statement GS. */
2412 static inline tree
2413 gimple_call_lhs (const_gimple gs)
2415 GIMPLE_CHECK (gs, GIMPLE_CALL);
2416 return gimple_op (gs, 0);
2420 /* Return a pointer to the LHS of call statement GS. */
2422 static inline tree *
2423 gimple_call_lhs_ptr (const_gimple gs)
2425 GIMPLE_CHECK (gs, GIMPLE_CALL);
2426 return gimple_op_ptr (gs, 0);
2430 /* Set LHS to be the LHS operand of call statement GS. */
2432 static inline void
2433 gimple_call_set_lhs (gimple gs, tree lhs)
2435 GIMPLE_CHECK (gs, GIMPLE_CALL);
2436 gimple_set_op (gs, 0, lhs);
2437 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2438 SSA_NAME_DEF_STMT (lhs) = gs;
2442 /* Return true if call GS calls an internal-only function, as enumerated
2443 by internal_fn. */
2445 static inline bool
2446 gimple_call_internal_p (const_gimple gs)
2448 GIMPLE_CHECK (gs, GIMPLE_CALL);
2449 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2453 /* Return true if call GS is marked as instrumented by
2454 Pointer Bounds Checker. */
2456 static inline bool
2457 gimple_call_with_bounds_p (const_gimple gs)
2459 GIMPLE_CHECK (gs, GIMPLE_CALL);
2460 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2464 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2465 Pointer Bounds Checker. */
2467 static inline void
2468 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2470 GIMPLE_CHECK (gs, GIMPLE_CALL);
2471 if (with_bounds)
2472 gs->subcode |= GF_CALL_WITH_BOUNDS;
2473 else
2474 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2478 /* Return the target of internal call GS. */
2480 static inline enum internal_fn
2481 gimple_call_internal_fn (const_gimple gs)
2483 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2484 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2488 /* Return the function type of the function called by GS. */
2490 static inline tree
2491 gimple_call_fntype (const_gimple gs)
2493 const gimple_statement_call *call_stmt =
2494 as_a <const gimple_statement_call *> (gs);
2495 if (gimple_call_internal_p (gs))
2496 return NULL_TREE;
2497 return call_stmt->u.fntype;
2500 /* Set the type of the function called by GS to FNTYPE. */
2502 static inline void
2503 gimple_call_set_fntype (gimple gs, tree fntype)
2505 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2506 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2507 call_stmt->u.fntype = fntype;
2511 /* Return the tree node representing the function called by call
2512 statement GS. */
2514 static inline tree
2515 gimple_call_fn (const_gimple gs)
2517 GIMPLE_CHECK (gs, GIMPLE_CALL);
2518 return gimple_op (gs, 1);
2521 /* Return a pointer to the tree node representing the function called by call
2522 statement GS. */
2524 static inline tree *
2525 gimple_call_fn_ptr (const_gimple gs)
2527 GIMPLE_CHECK (gs, GIMPLE_CALL);
2528 return gimple_op_ptr (gs, 1);
2532 /* Set FN to be the function called by call statement GS. */
2534 static inline void
2535 gimple_call_set_fn (gimple gs, tree fn)
2537 GIMPLE_CHECK (gs, GIMPLE_CALL);
2538 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2539 gimple_set_op (gs, 1, fn);
2543 /* Set FNDECL to be the function called by call statement GS. */
2545 static inline void
2546 gimple_call_set_fndecl (gimple gs, tree decl)
2548 GIMPLE_CHECK (gs, GIMPLE_CALL);
2549 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2550 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2554 /* Set internal function FN to be the function called by call statement GS. */
2556 static inline void
2557 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2559 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2560 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2561 call_stmt->u.internal_fn = fn;
2565 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2566 Otherwise return NULL. This function is analogous to
2567 get_callee_fndecl in tree land. */
2569 static inline tree
2570 gimple_call_fndecl (const_gimple gs)
2572 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2576 /* Return the type returned by call statement GS. */
2578 static inline tree
2579 gimple_call_return_type (const_gimple gs)
2581 tree type = gimple_call_fntype (gs);
2583 if (type == NULL_TREE)
2584 return TREE_TYPE (gimple_call_lhs (gs));
2586 /* The type returned by a function is the type of its
2587 function type. */
2588 return TREE_TYPE (type);
2592 /* Return the static chain for call statement GS. */
2594 static inline tree
2595 gimple_call_chain (const_gimple gs)
2597 GIMPLE_CHECK (gs, GIMPLE_CALL);
2598 return gimple_op (gs, 2);
2602 /* Return a pointer to the static chain for call statement GS. */
2604 static inline tree *
2605 gimple_call_chain_ptr (const_gimple gs)
2607 GIMPLE_CHECK (gs, GIMPLE_CALL);
2608 return gimple_op_ptr (gs, 2);
2611 /* Set CHAIN to be the static chain for call statement GS. */
2613 static inline void
2614 gimple_call_set_chain (gimple gs, tree chain)
2616 GIMPLE_CHECK (gs, GIMPLE_CALL);
2618 gimple_set_op (gs, 2, chain);
2622 /* Return the number of arguments used by call statement GS. */
2624 static inline unsigned
2625 gimple_call_num_args (const_gimple gs)
2627 unsigned num_ops;
2628 GIMPLE_CHECK (gs, GIMPLE_CALL);
2629 num_ops = gimple_num_ops (gs);
2630 return num_ops - 3;
2634 /* Return the argument at position INDEX for call statement GS. */
2636 static inline tree
2637 gimple_call_arg (const_gimple gs, unsigned index)
2639 GIMPLE_CHECK (gs, GIMPLE_CALL);
2640 return gimple_op (gs, index + 3);
2644 /* Return a pointer to the argument at position INDEX for call
2645 statement GS. */
2647 static inline tree *
2648 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2650 GIMPLE_CHECK (gs, GIMPLE_CALL);
2651 return gimple_op_ptr (gs, index + 3);
2655 /* Set ARG to be the argument at position INDEX for call statement GS. */
2657 static inline void
2658 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2660 GIMPLE_CHECK (gs, GIMPLE_CALL);
2661 gimple_set_op (gs, index + 3, arg);
2665 /* If TAIL_P is true, mark call statement S as being a tail call
2666 (i.e., a call just before the exit of a function). These calls are
2667 candidate for tail call optimization. */
2669 static inline void
2670 gimple_call_set_tail (gimple s, bool tail_p)
2672 GIMPLE_CHECK (s, GIMPLE_CALL);
2673 if (tail_p)
2674 s->subcode |= GF_CALL_TAILCALL;
2675 else
2676 s->subcode &= ~GF_CALL_TAILCALL;
2680 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2682 static inline bool
2683 gimple_call_tail_p (gimple s)
2685 GIMPLE_CHECK (s, GIMPLE_CALL);
2686 return (s->subcode & GF_CALL_TAILCALL) != 0;
2690 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2691 slot optimization. This transformation uses the target of the call
2692 expansion as the return slot for calls that return in memory. */
2694 static inline void
2695 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2697 GIMPLE_CHECK (s, GIMPLE_CALL);
2698 if (return_slot_opt_p)
2699 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2700 else
2701 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2705 /* Return true if S is marked for return slot optimization. */
2707 static inline bool
2708 gimple_call_return_slot_opt_p (gimple s)
2710 GIMPLE_CHECK (s, GIMPLE_CALL);
2711 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2715 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2716 thunk to the thunked-to function. */
2718 static inline void
2719 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2721 GIMPLE_CHECK (s, GIMPLE_CALL);
2722 if (from_thunk_p)
2723 s->subcode |= GF_CALL_FROM_THUNK;
2724 else
2725 s->subcode &= ~GF_CALL_FROM_THUNK;
2729 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2731 static inline bool
2732 gimple_call_from_thunk_p (gimple s)
2734 GIMPLE_CHECK (s, GIMPLE_CALL);
2735 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2739 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2740 argument pack in its argument list. */
2742 static inline void
2743 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2745 GIMPLE_CHECK (s, GIMPLE_CALL);
2746 if (pass_arg_pack_p)
2747 s->subcode |= GF_CALL_VA_ARG_PACK;
2748 else
2749 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2753 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2754 argument pack in its argument list. */
2756 static inline bool
2757 gimple_call_va_arg_pack_p (gimple s)
2759 GIMPLE_CHECK (s, GIMPLE_CALL);
2760 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2764 /* Return true if S is a noreturn call. */
2766 static inline bool
2767 gimple_call_noreturn_p (gimple s)
2769 GIMPLE_CHECK (s, GIMPLE_CALL);
2770 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2774 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2775 even if the called function can throw in other cases. */
2777 static inline void
2778 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2780 GIMPLE_CHECK (s, GIMPLE_CALL);
2781 if (nothrow_p)
2782 s->subcode |= GF_CALL_NOTHROW;
2783 else
2784 s->subcode &= ~GF_CALL_NOTHROW;
2787 /* Return true if S is a nothrow call. */
2789 static inline bool
2790 gimple_call_nothrow_p (gimple s)
2792 GIMPLE_CHECK (s, GIMPLE_CALL);
2793 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2796 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2797 is known to be emitted for VLA objects. Those are wrapped by
2798 stack_save/stack_restore calls and hence can't lead to unbounded
2799 stack growth even when they occur in loops. */
2801 static inline void
2802 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2804 GIMPLE_CHECK (s, GIMPLE_CALL);
2805 if (for_var)
2806 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2807 else
2808 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2811 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2813 static inline bool
2814 gimple_call_alloca_for_var_p (gimple s)
2816 GIMPLE_CHECK (s, GIMPLE_CALL);
2817 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2820 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2822 static inline void
2823 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2825 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2826 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2827 dest_call->subcode = orig_call->subcode;
2831 /* Return a pointer to the points-to solution for the set of call-used
2832 variables of the call CALL. */
2834 static inline struct pt_solution *
2835 gimple_call_use_set (gimple call)
2837 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2838 return &call_stmt->call_used;
2842 /* Return a pointer to the points-to solution for the set of call-used
2843 variables of the call CALL. */
2845 static inline struct pt_solution *
2846 gimple_call_clobber_set (gimple call)
2848 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2849 return &call_stmt->call_clobbered;
2853 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2854 non-NULL lhs. */
2856 static inline bool
2857 gimple_has_lhs (gimple stmt)
2859 return (is_gimple_assign (stmt)
2860 || (is_gimple_call (stmt)
2861 && gimple_call_lhs (stmt) != NULL_TREE));
2865 /* Return the code of the predicate computed by conditional statement GS. */
2867 static inline enum tree_code
2868 gimple_cond_code (const_gimple gs)
2870 GIMPLE_CHECK (gs, GIMPLE_COND);
2871 return (enum tree_code) gs->subcode;
2875 /* Set CODE to be the predicate code for the conditional statement GS. */
2877 static inline void
2878 gimple_cond_set_code (gimple gs, enum tree_code code)
2880 GIMPLE_CHECK (gs, GIMPLE_COND);
2881 gs->subcode = code;
2885 /* Return the LHS of the predicate computed by conditional statement GS. */
2887 static inline tree
2888 gimple_cond_lhs (const_gimple gs)
2890 GIMPLE_CHECK (gs, GIMPLE_COND);
2891 return gimple_op (gs, 0);
2894 /* Return the pointer to the LHS of the predicate computed by conditional
2895 statement GS. */
2897 static inline tree *
2898 gimple_cond_lhs_ptr (const_gimple gs)
2900 GIMPLE_CHECK (gs, GIMPLE_COND);
2901 return gimple_op_ptr (gs, 0);
2904 /* Set LHS to be the LHS operand of the predicate computed by
2905 conditional statement GS. */
2907 static inline void
2908 gimple_cond_set_lhs (gimple gs, tree lhs)
2910 GIMPLE_CHECK (gs, GIMPLE_COND);
2911 gimple_set_op (gs, 0, lhs);
2915 /* Return the RHS operand of the predicate computed by conditional GS. */
2917 static inline tree
2918 gimple_cond_rhs (const_gimple gs)
2920 GIMPLE_CHECK (gs, GIMPLE_COND);
2921 return gimple_op (gs, 1);
2924 /* Return the pointer to the RHS operand of the predicate computed by
2925 conditional GS. */
2927 static inline tree *
2928 gimple_cond_rhs_ptr (const_gimple gs)
2930 GIMPLE_CHECK (gs, GIMPLE_COND);
2931 return gimple_op_ptr (gs, 1);
2935 /* Set RHS to be the RHS operand of the predicate computed by
2936 conditional statement GS. */
2938 static inline void
2939 gimple_cond_set_rhs (gimple gs, tree rhs)
2941 GIMPLE_CHECK (gs, GIMPLE_COND);
2942 gimple_set_op (gs, 1, rhs);
2946 /* Return the label used by conditional statement GS when its
2947 predicate evaluates to true. */
2949 static inline tree
2950 gimple_cond_true_label (const_gimple gs)
2952 GIMPLE_CHECK (gs, GIMPLE_COND);
2953 return gimple_op (gs, 2);
2957 /* Set LABEL to be the label used by conditional statement GS when its
2958 predicate evaluates to true. */
2960 static inline void
2961 gimple_cond_set_true_label (gimple gs, tree label)
2963 GIMPLE_CHECK (gs, GIMPLE_COND);
2964 gimple_set_op (gs, 2, label);
2968 /* Set LABEL to be the label used by conditional statement GS when its
2969 predicate evaluates to false. */
2971 static inline void
2972 gimple_cond_set_false_label (gimple gs, tree label)
2974 GIMPLE_CHECK (gs, GIMPLE_COND);
2975 gimple_set_op (gs, 3, label);
2979 /* Return the label used by conditional statement GS when its
2980 predicate evaluates to false. */
2982 static inline tree
2983 gimple_cond_false_label (const_gimple gs)
2985 GIMPLE_CHECK (gs, GIMPLE_COND);
2986 return gimple_op (gs, 3);
2990 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2992 static inline void
2993 gimple_cond_make_false (gimple gs)
2995 gimple_cond_set_lhs (gs, boolean_true_node);
2996 gimple_cond_set_rhs (gs, boolean_false_node);
2997 gs->subcode = EQ_EXPR;
3001 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3003 static inline void
3004 gimple_cond_make_true (gimple gs)
3006 gimple_cond_set_lhs (gs, boolean_true_node);
3007 gimple_cond_set_rhs (gs, boolean_true_node);
3008 gs->subcode = EQ_EXPR;
3011 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3012 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3014 static inline bool
3015 gimple_cond_true_p (const_gimple gs)
3017 tree lhs = gimple_cond_lhs (gs);
3018 tree rhs = gimple_cond_rhs (gs);
3019 enum tree_code code = gimple_cond_code (gs);
3021 if (lhs != boolean_true_node && lhs != boolean_false_node)
3022 return false;
3024 if (rhs != boolean_true_node && rhs != boolean_false_node)
3025 return false;
3027 if (code == NE_EXPR && lhs != rhs)
3028 return true;
3030 if (code == EQ_EXPR && lhs == rhs)
3031 return true;
3033 return false;
3036 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3037 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3039 static inline bool
3040 gimple_cond_false_p (const_gimple gs)
3042 tree lhs = gimple_cond_lhs (gs);
3043 tree rhs = gimple_cond_rhs (gs);
3044 enum tree_code code = gimple_cond_code (gs);
3046 if (lhs != boolean_true_node && lhs != boolean_false_node)
3047 return false;
3049 if (rhs != boolean_true_node && rhs != boolean_false_node)
3050 return false;
3052 if (code == NE_EXPR && lhs == rhs)
3053 return true;
3055 if (code == EQ_EXPR && lhs != rhs)
3056 return true;
3058 return false;
3061 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3063 static inline void
3064 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3066 gimple_cond_set_code (stmt, code);
3067 gimple_cond_set_lhs (stmt, lhs);
3068 gimple_cond_set_rhs (stmt, rhs);
3071 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3073 static inline tree
3074 gimple_label_label (const_gimple gs)
3076 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3077 return gimple_op (gs, 0);
3081 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3082 GS. */
3084 static inline void
3085 gimple_label_set_label (gimple gs, tree label)
3087 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3088 gimple_set_op (gs, 0, label);
3092 /* Return the destination of the unconditional jump GS. */
3094 static inline tree
3095 gimple_goto_dest (const_gimple gs)
3097 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3098 return gimple_op (gs, 0);
3102 /* Set DEST to be the destination of the unconditonal jump GS. */
3104 static inline void
3105 gimple_goto_set_dest (gimple gs, tree dest)
3107 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3108 gimple_set_op (gs, 0, dest);
3112 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3114 static inline tree
3115 gimple_bind_vars (const_gimple gs)
3117 const gimple_statement_bind *bind_stmt =
3118 as_a <const gimple_statement_bind *> (gs);
3119 return bind_stmt->vars;
3123 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3124 statement GS. */
3126 static inline void
3127 gimple_bind_set_vars (gimple gs, tree vars)
3129 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3130 bind_stmt->vars = vars;
3134 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3135 statement GS. */
3137 static inline void
3138 gimple_bind_append_vars (gimple gs, tree vars)
3140 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3141 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3145 static inline gimple_seq *
3146 gimple_bind_body_ptr (gimple gs)
3148 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3149 return &bind_stmt->body;
3152 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3154 static inline gimple_seq
3155 gimple_bind_body (gimple gs)
3157 return *gimple_bind_body_ptr (gs);
3161 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3162 statement GS. */
3164 static inline void
3165 gimple_bind_set_body (gimple gs, gimple_seq seq)
3167 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3168 bind_stmt->body = seq;
3172 /* Append a statement to the end of a GIMPLE_BIND's body. */
3174 static inline void
3175 gimple_bind_add_stmt (gimple gs, gimple stmt)
3177 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3178 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3182 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3184 static inline void
3185 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3187 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3188 gimple_seq_add_seq (&bind_stmt->body, seq);
3192 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3193 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3195 static inline tree
3196 gimple_bind_block (const_gimple gs)
3198 const gimple_statement_bind *bind_stmt =
3199 as_a <const gimple_statement_bind *> (gs);
3200 return bind_stmt->block;
3204 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3205 statement GS. */
3207 static inline void
3208 gimple_bind_set_block (gimple gs, tree block)
3210 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3211 gcc_gimple_checking_assert (block == NULL_TREE
3212 || TREE_CODE (block) == BLOCK);
3213 bind_stmt->block = block;
3217 /* Return the number of input operands for GIMPLE_ASM GS. */
3219 static inline unsigned
3220 gimple_asm_ninputs (const_gimple gs)
3222 const gimple_statement_asm *asm_stmt =
3223 as_a <const gimple_statement_asm *> (gs);
3224 return asm_stmt->ni;
3228 /* Return the number of output operands for GIMPLE_ASM GS. */
3230 static inline unsigned
3231 gimple_asm_noutputs (const_gimple gs)
3233 const gimple_statement_asm *asm_stmt =
3234 as_a <const gimple_statement_asm *> (gs);
3235 return asm_stmt->no;
3239 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3241 static inline unsigned
3242 gimple_asm_nclobbers (const_gimple gs)
3244 const gimple_statement_asm *asm_stmt =
3245 as_a <const gimple_statement_asm *> (gs);
3246 return asm_stmt->nc;
3249 /* Return the number of label operands for GIMPLE_ASM GS. */
3251 static inline unsigned
3252 gimple_asm_nlabels (const_gimple gs)
3254 const gimple_statement_asm *asm_stmt =
3255 as_a <const gimple_statement_asm *> (gs);
3256 return asm_stmt->nl;
3259 /* Return input operand INDEX of GIMPLE_ASM GS. */
3261 static inline tree
3262 gimple_asm_input_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->ni);
3267 return gimple_op (gs, index + asm_stmt->no);
3270 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3272 static inline tree *
3273 gimple_asm_input_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->ni);
3278 return gimple_op_ptr (gs, index + asm_stmt->no);
3282 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3284 static inline void
3285 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3287 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3288 gcc_gimple_checking_assert (index < asm_stmt->ni
3289 && TREE_CODE (in_op) == TREE_LIST);
3290 gimple_set_op (gs, index + asm_stmt->no, in_op);
3294 /* Return output operand INDEX of GIMPLE_ASM GS. */
3296 static inline tree
3297 gimple_asm_output_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->no);
3302 return gimple_op (gs, index);
3305 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3307 static inline tree *
3308 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3310 const gimple_statement_asm *asm_stmt =
3311 as_a <const gimple_statement_asm *> (gs);
3312 gcc_gimple_checking_assert (index < asm_stmt->no);
3313 return gimple_op_ptr (gs, index);
3317 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3319 static inline void
3320 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3322 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3323 gcc_gimple_checking_assert (index < asm_stmt->no
3324 && TREE_CODE (out_op) == TREE_LIST);
3325 gimple_set_op (gs, index, out_op);
3329 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3331 static inline tree
3332 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3334 const gimple_statement_asm *asm_stmt =
3335 as_a <const gimple_statement_asm *> (gs);
3336 gcc_gimple_checking_assert (index < asm_stmt->nc);
3337 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3341 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3343 static inline void
3344 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3346 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3347 gcc_gimple_checking_assert (index < asm_stmt->nc
3348 && TREE_CODE (clobber_op) == TREE_LIST);
3349 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3352 /* Return label operand INDEX of GIMPLE_ASM GS. */
3354 static inline tree
3355 gimple_asm_label_op (const_gimple gs, unsigned index)
3357 const gimple_statement_asm *asm_stmt =
3358 as_a <const gimple_statement_asm *> (gs);
3359 gcc_gimple_checking_assert (index < asm_stmt->nl);
3360 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3363 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3365 static inline void
3366 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3368 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3369 gcc_gimple_checking_assert (index < asm_stmt->nl
3370 && TREE_CODE (label_op) == TREE_LIST);
3371 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3374 /* Return the string representing the assembly instruction in
3375 GIMPLE_ASM GS. */
3377 static inline const char *
3378 gimple_asm_string (const_gimple gs)
3380 const gimple_statement_asm *asm_stmt =
3381 as_a <const gimple_statement_asm *> (gs);
3382 return asm_stmt->string;
3386 /* Return true if GS is an asm statement marked volatile. */
3388 static inline bool
3389 gimple_asm_volatile_p (const_gimple gs)
3391 GIMPLE_CHECK (gs, GIMPLE_ASM);
3392 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3396 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3398 static inline void
3399 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3401 GIMPLE_CHECK (gs, GIMPLE_ASM);
3402 if (volatile_p)
3403 gs->subcode |= GF_ASM_VOLATILE;
3404 else
3405 gs->subcode &= ~GF_ASM_VOLATILE;
3409 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3411 static inline void
3412 gimple_asm_set_input (gimple gs, bool input_p)
3414 GIMPLE_CHECK (gs, GIMPLE_ASM);
3415 if (input_p)
3416 gs->subcode |= GF_ASM_INPUT;
3417 else
3418 gs->subcode &= ~GF_ASM_INPUT;
3422 /* Return true if asm GS is an ASM_INPUT. */
3424 static inline bool
3425 gimple_asm_input_p (const_gimple gs)
3427 GIMPLE_CHECK (gs, GIMPLE_ASM);
3428 return (gs->subcode & GF_ASM_INPUT) != 0;
3432 /* Return the types handled by GIMPLE_CATCH statement GS. */
3434 static inline tree
3435 gimple_catch_types (const_gimple gs)
3437 const gimple_statement_catch *catch_stmt =
3438 as_a <const gimple_statement_catch *> (gs);
3439 return catch_stmt->types;
3443 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3445 static inline tree *
3446 gimple_catch_types_ptr (gimple gs)
3448 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3449 return &catch_stmt->types;
3453 /* Return a pointer to the GIMPLE sequence representing the body of
3454 the handler of GIMPLE_CATCH statement GS. */
3456 static inline gimple_seq *
3457 gimple_catch_handler_ptr (gimple gs)
3459 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3460 return &catch_stmt->handler;
3464 /* Return the GIMPLE sequence representing the body of the handler of
3465 GIMPLE_CATCH statement GS. */
3467 static inline gimple_seq
3468 gimple_catch_handler (gimple gs)
3470 return *gimple_catch_handler_ptr (gs);
3474 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3476 static inline void
3477 gimple_catch_set_types (gimple gs, tree t)
3479 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3480 catch_stmt->types = t;
3484 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3486 static inline void
3487 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3489 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3490 catch_stmt->handler = handler;
3494 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3496 static inline tree
3497 gimple_eh_filter_types (const_gimple gs)
3499 const gimple_statement_eh_filter *eh_filter_stmt =
3500 as_a <const gimple_statement_eh_filter *> (gs);
3501 return eh_filter_stmt->types;
3505 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3506 GS. */
3508 static inline tree *
3509 gimple_eh_filter_types_ptr (gimple gs)
3511 gimple_statement_eh_filter *eh_filter_stmt =
3512 as_a <gimple_statement_eh_filter *> (gs);
3513 return &eh_filter_stmt->types;
3517 /* Return a pointer to the sequence of statement to execute when
3518 GIMPLE_EH_FILTER statement fails. */
3520 static inline gimple_seq *
3521 gimple_eh_filter_failure_ptr (gimple gs)
3523 gimple_statement_eh_filter *eh_filter_stmt =
3524 as_a <gimple_statement_eh_filter *> (gs);
3525 return &eh_filter_stmt->failure;
3529 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3530 statement fails. */
3532 static inline gimple_seq
3533 gimple_eh_filter_failure (gimple gs)
3535 return *gimple_eh_filter_failure_ptr (gs);
3539 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3541 static inline void
3542 gimple_eh_filter_set_types (gimple gs, tree types)
3544 gimple_statement_eh_filter *eh_filter_stmt =
3545 as_a <gimple_statement_eh_filter *> (gs);
3546 eh_filter_stmt->types = types;
3550 /* Set FAILURE to be the sequence of statements to execute on failure
3551 for GIMPLE_EH_FILTER GS. */
3553 static inline void
3554 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3556 gimple_statement_eh_filter *eh_filter_stmt =
3557 as_a <gimple_statement_eh_filter *> (gs);
3558 eh_filter_stmt->failure = failure;
3561 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3563 static inline tree
3564 gimple_eh_must_not_throw_fndecl (gimple gs)
3566 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3567 return eh_mnt_stmt->fndecl;
3570 /* Set the function decl to be called by GS to DECL. */
3572 static inline void
3573 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3575 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3576 eh_mnt_stmt->fndecl = decl;
3579 /* GIMPLE_EH_ELSE accessors. */
3581 static inline gimple_seq *
3582 gimple_eh_else_n_body_ptr (gimple gs)
3584 gimple_statement_eh_else *eh_else_stmt =
3585 as_a <gimple_statement_eh_else *> (gs);
3586 return &eh_else_stmt->n_body;
3589 static inline gimple_seq
3590 gimple_eh_else_n_body (gimple gs)
3592 return *gimple_eh_else_n_body_ptr (gs);
3595 static inline gimple_seq *
3596 gimple_eh_else_e_body_ptr (gimple gs)
3598 gimple_statement_eh_else *eh_else_stmt =
3599 as_a <gimple_statement_eh_else *> (gs);
3600 return &eh_else_stmt->e_body;
3603 static inline gimple_seq
3604 gimple_eh_else_e_body (gimple gs)
3606 return *gimple_eh_else_e_body_ptr (gs);
3609 static inline void
3610 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3612 gimple_statement_eh_else *eh_else_stmt =
3613 as_a <gimple_statement_eh_else *> (gs);
3614 eh_else_stmt->n_body = seq;
3617 static inline void
3618 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3620 gimple_statement_eh_else *eh_else_stmt =
3621 as_a <gimple_statement_eh_else *> (gs);
3622 eh_else_stmt->e_body = seq;
3625 /* GIMPLE_TRY accessors. */
3627 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3628 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3630 static inline enum gimple_try_flags
3631 gimple_try_kind (const_gimple gs)
3633 GIMPLE_CHECK (gs, GIMPLE_TRY);
3634 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3638 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3640 static inline void
3641 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3643 GIMPLE_CHECK (gs, GIMPLE_TRY);
3644 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3645 || kind == GIMPLE_TRY_FINALLY);
3646 if (gimple_try_kind (gs) != kind)
3647 gs->subcode = (unsigned int) kind;
3651 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3653 static inline bool
3654 gimple_try_catch_is_cleanup (const_gimple gs)
3656 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3657 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3661 /* Return a pointer to the sequence of statements used as the
3662 body for GIMPLE_TRY GS. */
3664 static inline gimple_seq *
3665 gimple_try_eval_ptr (gimple gs)
3667 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3668 return &try_stmt->eval;
3672 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3674 static inline gimple_seq
3675 gimple_try_eval (gimple gs)
3677 return *gimple_try_eval_ptr (gs);
3681 /* Return a pointer to the sequence of statements used as the cleanup body for
3682 GIMPLE_TRY GS. */
3684 static inline gimple_seq *
3685 gimple_try_cleanup_ptr (gimple gs)
3687 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3688 return &try_stmt->cleanup;
3692 /* Return the sequence of statements used as the cleanup body for
3693 GIMPLE_TRY GS. */
3695 static inline gimple_seq
3696 gimple_try_cleanup (gimple gs)
3698 return *gimple_try_cleanup_ptr (gs);
3702 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3704 static inline void
3705 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3707 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3708 if (catch_is_cleanup)
3709 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3710 else
3711 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3715 /* Set EVAL to be the sequence of statements to use as the body for
3716 GIMPLE_TRY GS. */
3718 static inline void
3719 gimple_try_set_eval (gimple gs, gimple_seq eval)
3721 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3722 try_stmt->eval = eval;
3726 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3727 body for GIMPLE_TRY GS. */
3729 static inline void
3730 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3732 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3733 try_stmt->cleanup = cleanup;
3737 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3739 static inline gimple_seq *
3740 gimple_wce_cleanup_ptr (gimple gs)
3742 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3743 return &wce_stmt->cleanup;
3747 /* Return the cleanup sequence for cleanup statement GS. */
3749 static inline gimple_seq
3750 gimple_wce_cleanup (gimple gs)
3752 return *gimple_wce_cleanup_ptr (gs);
3756 /* Set CLEANUP to be the cleanup sequence for GS. */
3758 static inline void
3759 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3761 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3762 wce_stmt->cleanup = cleanup;
3766 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3768 static inline bool
3769 gimple_wce_cleanup_eh_only (const_gimple gs)
3771 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3772 return gs->subcode != 0;
3776 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3778 static inline void
3779 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3781 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3782 gs->subcode = (unsigned int) eh_only_p;
3786 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3788 static inline unsigned
3789 gimple_phi_capacity (const_gimple gs)
3791 const gimple_statement_phi *phi_stmt =
3792 as_a <const gimple_statement_phi *> (gs);
3793 return phi_stmt->capacity;
3797 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3798 be exactly the number of incoming edges for the basic block holding
3799 GS. */
3801 static inline unsigned
3802 gimple_phi_num_args (const_gimple gs)
3804 const gimple_statement_phi *phi_stmt =
3805 as_a <const gimple_statement_phi *> (gs);
3806 return phi_stmt->nargs;
3810 /* Return the SSA name created by GIMPLE_PHI GS. */
3812 static inline tree
3813 gimple_phi_result (const_gimple gs)
3815 const gimple_statement_phi *phi_stmt =
3816 as_a <const gimple_statement_phi *> (gs);
3817 return phi_stmt->result;
3820 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3822 static inline tree *
3823 gimple_phi_result_ptr (gimple gs)
3825 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3826 return &phi_stmt->result;
3829 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3831 static inline void
3832 gimple_phi_set_result (gimple gs, tree result)
3834 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3835 phi_stmt->result = result;
3836 if (result && TREE_CODE (result) == SSA_NAME)
3837 SSA_NAME_DEF_STMT (result) = gs;
3841 /* Return the PHI argument corresponding to incoming edge INDEX for
3842 GIMPLE_PHI GS. */
3844 static inline struct phi_arg_d *
3845 gimple_phi_arg (gimple gs, unsigned index)
3847 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3848 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3849 return &(phi_stmt->args[index]);
3852 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3853 for GIMPLE_PHI GS. */
3855 static inline void
3856 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3858 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3859 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3860 phi_stmt->args[index] = *phiarg;
3863 /* Return the PHI nodes for basic block BB, or NULL if there are no
3864 PHI nodes. */
3866 static inline gimple_seq
3867 phi_nodes (const_basic_block bb)
3869 gcc_checking_assert (!(bb->flags & BB_RTL));
3870 return bb->il.gimple.phi_nodes;
3873 /* Return a pointer to the PHI nodes for basic block BB. */
3875 static inline gimple_seq *
3876 phi_nodes_ptr (basic_block bb)
3878 gcc_checking_assert (!(bb->flags & BB_RTL));
3879 return &bb->il.gimple.phi_nodes;
3882 /* Return the tree operand for argument I of PHI node GS. */
3884 static inline tree
3885 gimple_phi_arg_def (gimple gs, size_t index)
3887 return gimple_phi_arg (gs, index)->def;
3891 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3893 static inline tree *
3894 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3896 return &gimple_phi_arg (gs, index)->def;
3899 /* Return the edge associated with argument I of phi node GS. */
3901 static inline edge
3902 gimple_phi_arg_edge (gimple gs, size_t i)
3904 return EDGE_PRED (gimple_bb (gs), i);
3907 /* Return the source location of gimple argument I of phi node GS. */
3909 static inline source_location
3910 gimple_phi_arg_location (gimple gs, size_t i)
3912 return gimple_phi_arg (gs, i)->locus;
3915 /* Return the source location of the argument on edge E of phi node GS. */
3917 static inline source_location
3918 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3920 return gimple_phi_arg (gs, e->dest_idx)->locus;
3923 /* Set the source location of gimple argument I of phi node GS to LOC. */
3925 static inline void
3926 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3928 gimple_phi_arg (gs, i)->locus = loc;
3931 /* Return TRUE if argument I of phi node GS has a location record. */
3933 static inline bool
3934 gimple_phi_arg_has_location (gimple gs, size_t i)
3936 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3940 /* Return the region number for GIMPLE_RESX GS. */
3942 static inline int
3943 gimple_resx_region (const_gimple gs)
3945 const gimple_statement_resx *resx_stmt =
3946 as_a <const gimple_statement_resx *> (gs);
3947 return resx_stmt->region;
3950 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3952 static inline void
3953 gimple_resx_set_region (gimple gs, int region)
3955 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
3956 resx_stmt->region = region;
3959 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3961 static inline int
3962 gimple_eh_dispatch_region (const_gimple gs)
3964 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3965 as_a <const gimple_statement_eh_dispatch *> (gs);
3966 return eh_dispatch_stmt->region;
3969 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3971 static inline void
3972 gimple_eh_dispatch_set_region (gimple gs, int region)
3974 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3975 as_a <gimple_statement_eh_dispatch *> (gs);
3976 eh_dispatch_stmt->region = region;
3979 /* Return the number of labels associated with the switch statement GS. */
3981 static inline unsigned
3982 gimple_switch_num_labels (const_gimple gs)
3984 unsigned num_ops;
3985 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3986 num_ops = gimple_num_ops (gs);
3987 gcc_gimple_checking_assert (num_ops > 1);
3988 return num_ops - 1;
3992 /* Set NLABELS to be the number of labels for the switch statement GS. */
3994 static inline void
3995 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3997 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3998 gimple_set_num_ops (g, nlabels + 1);
4002 /* Return the index variable used by the switch statement GS. */
4004 static inline tree
4005 gimple_switch_index (const_gimple gs)
4007 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4008 return gimple_op (gs, 0);
4012 /* Return a pointer to the index variable for the switch statement GS. */
4014 static inline tree *
4015 gimple_switch_index_ptr (const_gimple gs)
4017 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4018 return gimple_op_ptr (gs, 0);
4022 /* Set INDEX to be the index variable for switch statement GS. */
4024 static inline void
4025 gimple_switch_set_index (gimple gs, tree index)
4027 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4028 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4029 gimple_set_op (gs, 0, index);
4033 /* Return the label numbered INDEX. The default label is 0, followed by any
4034 labels in a switch statement. */
4036 static inline tree
4037 gimple_switch_label (const_gimple gs, unsigned index)
4039 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4040 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4041 return gimple_op (gs, index + 1);
4044 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4046 static inline void
4047 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4049 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4050 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4051 && (label == NULL_TREE
4052 || TREE_CODE (label) == CASE_LABEL_EXPR));
4053 gimple_set_op (gs, index + 1, label);
4056 /* Return the default label for a switch statement. */
4058 static inline tree
4059 gimple_switch_default_label (const_gimple gs)
4061 tree label = gimple_switch_label (gs, 0);
4062 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4063 return label;
4066 /* Set the default label for a switch statement. */
4068 static inline void
4069 gimple_switch_set_default_label (gimple gs, tree label)
4071 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4072 gimple_switch_set_label (gs, 0, label);
4075 /* Return true if GS is a GIMPLE_DEBUG statement. */
4077 static inline bool
4078 is_gimple_debug (const_gimple gs)
4080 return gimple_code (gs) == GIMPLE_DEBUG;
4083 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4085 static inline bool
4086 gimple_debug_bind_p (const_gimple s)
4088 if (is_gimple_debug (s))
4089 return s->subcode == GIMPLE_DEBUG_BIND;
4091 return false;
4094 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4096 static inline tree
4097 gimple_debug_bind_get_var (gimple dbg)
4099 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4100 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4101 return gimple_op (dbg, 0);
4104 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4105 statement. */
4107 static inline tree
4108 gimple_debug_bind_get_value (gimple dbg)
4110 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4111 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4112 return gimple_op (dbg, 1);
4115 /* Return a pointer to the value bound to the variable in a
4116 GIMPLE_DEBUG bind statement. */
4118 static inline tree *
4119 gimple_debug_bind_get_value_ptr (gimple dbg)
4121 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4122 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4123 return gimple_op_ptr (dbg, 1);
4126 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4128 static inline void
4129 gimple_debug_bind_set_var (gimple dbg, tree var)
4131 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4132 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4133 gimple_set_op (dbg, 0, var);
4136 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4137 statement. */
4139 static inline void
4140 gimple_debug_bind_set_value (gimple dbg, tree value)
4142 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4143 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4144 gimple_set_op (dbg, 1, value);
4147 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4148 optimized away. */
4149 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4151 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4152 statement. */
4154 static inline void
4155 gimple_debug_bind_reset_value (gimple dbg)
4157 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4158 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4159 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4162 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4163 value. */
4165 static inline bool
4166 gimple_debug_bind_has_value_p (gimple dbg)
4168 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4169 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4170 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4173 #undef GIMPLE_DEBUG_BIND_NOVALUE
4175 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4177 static inline bool
4178 gimple_debug_source_bind_p (const_gimple s)
4180 if (is_gimple_debug (s))
4181 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4183 return false;
4186 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4188 static inline tree
4189 gimple_debug_source_bind_get_var (gimple dbg)
4191 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4192 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4193 return gimple_op (dbg, 0);
4196 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4197 statement. */
4199 static inline tree
4200 gimple_debug_source_bind_get_value (gimple dbg)
4202 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4203 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4204 return gimple_op (dbg, 1);
4207 /* Return a pointer to the value bound to the variable in a
4208 GIMPLE_DEBUG source bind statement. */
4210 static inline tree *
4211 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4213 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4214 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4215 return gimple_op_ptr (dbg, 1);
4218 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4220 static inline void
4221 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4223 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4224 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4225 gimple_set_op (dbg, 0, var);
4228 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4229 statement. */
4231 static inline void
4232 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4234 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4235 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4236 gimple_set_op (dbg, 1, value);
4239 /* Return the line number for EXPR, or return -1 if we have no line
4240 number information for it. */
4241 static inline int
4242 get_lineno (const_gimple stmt)
4244 location_t loc;
4246 if (!stmt)
4247 return -1;
4249 loc = gimple_location (stmt);
4250 if (loc == UNKNOWN_LOCATION)
4251 return -1;
4253 return LOCATION_LINE (loc);
4256 /* Return a pointer to the body for the OMP statement GS. */
4258 static inline gimple_seq *
4259 gimple_omp_body_ptr (gimple gs)
4261 return &static_cast <gimple_statement_omp *> (gs)->body;
4264 /* Return the body for the OMP statement GS. */
4266 static inline gimple_seq
4267 gimple_omp_body (gimple gs)
4269 return *gimple_omp_body_ptr (gs);
4272 /* Set BODY to be the body for the OMP statement GS. */
4274 static inline void
4275 gimple_omp_set_body (gimple gs, gimple_seq body)
4277 static_cast <gimple_statement_omp *> (gs)->body = body;
4281 /* Return the name associated with OMP_CRITICAL statement GS. */
4283 static inline tree
4284 gimple_omp_critical_name (const_gimple gs)
4286 const gimple_statement_omp_critical *omp_critical_stmt =
4287 as_a <const gimple_statement_omp_critical *> (gs);
4288 return omp_critical_stmt->name;
4292 /* Return a pointer to the name associated with OMP critical statement GS. */
4294 static inline tree *
4295 gimple_omp_critical_name_ptr (gimple gs)
4297 gimple_statement_omp_critical *omp_critical_stmt =
4298 as_a <gimple_statement_omp_critical *> (gs);
4299 return &omp_critical_stmt->name;
4303 /* Set NAME to be the name associated with OMP critical statement GS. */
4305 static inline void
4306 gimple_omp_critical_set_name (gimple gs, tree name)
4308 gimple_statement_omp_critical *omp_critical_stmt =
4309 as_a <gimple_statement_omp_critical *> (gs);
4310 omp_critical_stmt->name = name;
4314 /* Return the kind of OMP for statemement. */
4316 static inline int
4317 gimple_omp_for_kind (const_gimple g)
4319 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4320 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4324 /* Set the OMP for kind. */
4326 static inline void
4327 gimple_omp_for_set_kind (gimple g, int kind)
4329 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4330 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4331 | (kind & GF_OMP_FOR_KIND_MASK);
4335 /* Return true if OMP for statement G has the
4336 GF_OMP_FOR_COMBINED flag set. */
4338 static inline bool
4339 gimple_omp_for_combined_p (const_gimple g)
4341 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4342 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4346 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4347 value of COMBINED_P. */
4349 static inline void
4350 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4352 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4353 if (combined_p)
4354 g->subcode |= GF_OMP_FOR_COMBINED;
4355 else
4356 g->subcode &= ~GF_OMP_FOR_COMBINED;
4360 /* Return true if OMP for statement G has the
4361 GF_OMP_FOR_COMBINED_INTO flag set. */
4363 static inline bool
4364 gimple_omp_for_combined_into_p (const_gimple g)
4366 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4367 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4371 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4372 value of COMBINED_P. */
4374 static inline void
4375 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4377 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4378 if (combined_p)
4379 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4380 else
4381 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4385 /* Return the clauses associated with OMP_FOR GS. */
4387 static inline tree
4388 gimple_omp_for_clauses (const_gimple gs)
4390 const gimple_statement_omp_for *omp_for_stmt =
4391 as_a <const gimple_statement_omp_for *> (gs);
4392 return omp_for_stmt->clauses;
4396 /* Return a pointer to the OMP_FOR GS. */
4398 static inline tree *
4399 gimple_omp_for_clauses_ptr (gimple gs)
4401 gimple_statement_omp_for *omp_for_stmt =
4402 as_a <gimple_statement_omp_for *> (gs);
4403 return &omp_for_stmt->clauses;
4407 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4409 static inline void
4410 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4412 gimple_statement_omp_for *omp_for_stmt =
4413 as_a <gimple_statement_omp_for *> (gs);
4414 omp_for_stmt->clauses = clauses;
4418 /* Get the collapse count of OMP_FOR GS. */
4420 static inline size_t
4421 gimple_omp_for_collapse (gimple gs)
4423 gimple_statement_omp_for *omp_for_stmt =
4424 as_a <gimple_statement_omp_for *> (gs);
4425 return omp_for_stmt->collapse;
4429 /* Return the index variable for OMP_FOR GS. */
4431 static inline tree
4432 gimple_omp_for_index (const_gimple gs, size_t i)
4434 const gimple_statement_omp_for *omp_for_stmt =
4435 as_a <const gimple_statement_omp_for *> (gs);
4436 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4437 return omp_for_stmt->iter[i].index;
4441 /* Return a pointer to the index variable for OMP_FOR GS. */
4443 static inline tree *
4444 gimple_omp_for_index_ptr (gimple gs, size_t i)
4446 gimple_statement_omp_for *omp_for_stmt =
4447 as_a <gimple_statement_omp_for *> (gs);
4448 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4449 return &omp_for_stmt->iter[i].index;
4453 /* Set INDEX to be the index variable for OMP_FOR GS. */
4455 static inline void
4456 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4458 gimple_statement_omp_for *omp_for_stmt =
4459 as_a <gimple_statement_omp_for *> (gs);
4460 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4461 omp_for_stmt->iter[i].index = index;
4465 /* Return the initial value for OMP_FOR GS. */
4467 static inline tree
4468 gimple_omp_for_initial (const_gimple gs, size_t i)
4470 const gimple_statement_omp_for *omp_for_stmt =
4471 as_a <const gimple_statement_omp_for *> (gs);
4472 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4473 return omp_for_stmt->iter[i].initial;
4477 /* Return a pointer to the initial value for OMP_FOR GS. */
4479 static inline tree *
4480 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4482 gimple_statement_omp_for *omp_for_stmt =
4483 as_a <gimple_statement_omp_for *> (gs);
4484 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4485 return &omp_for_stmt->iter[i].initial;
4489 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4491 static inline void
4492 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4494 gimple_statement_omp_for *omp_for_stmt =
4495 as_a <gimple_statement_omp_for *> (gs);
4496 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4497 omp_for_stmt->iter[i].initial = initial;
4501 /* Return the final value for OMP_FOR GS. */
4503 static inline tree
4504 gimple_omp_for_final (const_gimple gs, size_t i)
4506 const gimple_statement_omp_for *omp_for_stmt =
4507 as_a <const gimple_statement_omp_for *> (gs);
4508 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4509 return omp_for_stmt->iter[i].final;
4513 /* Return a pointer to the final value for OMP_FOR GS. */
4515 static inline tree *
4516 gimple_omp_for_final_ptr (gimple gs, size_t i)
4518 gimple_statement_omp_for *omp_for_stmt =
4519 as_a <gimple_statement_omp_for *> (gs);
4520 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4521 return &omp_for_stmt->iter[i].final;
4525 /* Set FINAL to be the final value for OMP_FOR GS. */
4527 static inline void
4528 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4530 gimple_statement_omp_for *omp_for_stmt =
4531 as_a <gimple_statement_omp_for *> (gs);
4532 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4533 omp_for_stmt->iter[i].final = final;
4537 /* Return the increment value for OMP_FOR GS. */
4539 static inline tree
4540 gimple_omp_for_incr (const_gimple gs, size_t i)
4542 const gimple_statement_omp_for *omp_for_stmt =
4543 as_a <const gimple_statement_omp_for *> (gs);
4544 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4545 return omp_for_stmt->iter[i].incr;
4549 /* Return a pointer to the increment value for OMP_FOR GS. */
4551 static inline tree *
4552 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4554 gimple_statement_omp_for *omp_for_stmt =
4555 as_a <gimple_statement_omp_for *> (gs);
4556 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4557 return &omp_for_stmt->iter[i].incr;
4561 /* Set INCR to be the increment value for OMP_FOR GS. */
4563 static inline void
4564 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4566 gimple_statement_omp_for *omp_for_stmt =
4567 as_a <gimple_statement_omp_for *> (gs);
4568 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4569 omp_for_stmt->iter[i].incr = incr;
4573 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4574 statement GS starts. */
4576 static inline gimple_seq *
4577 gimple_omp_for_pre_body_ptr (gimple gs)
4579 gimple_statement_omp_for *omp_for_stmt =
4580 as_a <gimple_statement_omp_for *> (gs);
4581 return &omp_for_stmt->pre_body;
4585 /* Return the sequence of statements to execute before the OMP_FOR
4586 statement GS starts. */
4588 static inline gimple_seq
4589 gimple_omp_for_pre_body (gimple gs)
4591 return *gimple_omp_for_pre_body_ptr (gs);
4595 /* Set PRE_BODY to be the sequence of statements to execute before the
4596 OMP_FOR statement GS starts. */
4598 static inline void
4599 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4601 gimple_statement_omp_for *omp_for_stmt =
4602 as_a <gimple_statement_omp_for *> (gs);
4603 omp_for_stmt->pre_body = pre_body;
4607 /* Return the clauses associated with OMP_PARALLEL GS. */
4609 static inline tree
4610 gimple_omp_parallel_clauses (const_gimple gs)
4612 const gimple_statement_omp_parallel *omp_parallel_stmt =
4613 as_a <const gimple_statement_omp_parallel *> (gs);
4614 return omp_parallel_stmt->clauses;
4618 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4620 static inline tree *
4621 gimple_omp_parallel_clauses_ptr (gimple gs)
4623 gimple_statement_omp_parallel *omp_parallel_stmt =
4624 as_a <gimple_statement_omp_parallel *> (gs);
4625 return &omp_parallel_stmt->clauses;
4629 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4630 GS. */
4632 static inline void
4633 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4635 gimple_statement_omp_parallel *omp_parallel_stmt =
4636 as_a <gimple_statement_omp_parallel *> (gs);
4637 omp_parallel_stmt->clauses = clauses;
4641 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4643 static inline tree
4644 gimple_omp_parallel_child_fn (const_gimple gs)
4646 const gimple_statement_omp_parallel *omp_parallel_stmt =
4647 as_a <const gimple_statement_omp_parallel *> (gs);
4648 return omp_parallel_stmt->child_fn;
4651 /* Return a pointer to the child function used to hold the body of
4652 OMP_PARALLEL GS. */
4654 static inline tree *
4655 gimple_omp_parallel_child_fn_ptr (gimple gs)
4657 gimple_statement_omp_parallel *omp_parallel_stmt =
4658 as_a <gimple_statement_omp_parallel *> (gs);
4659 return &omp_parallel_stmt->child_fn;
4663 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4665 static inline void
4666 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4668 gimple_statement_omp_parallel *omp_parallel_stmt =
4669 as_a <gimple_statement_omp_parallel *> (gs);
4670 omp_parallel_stmt->child_fn = child_fn;
4674 /* Return the artificial argument used to send variables and values
4675 from the parent to the children threads in OMP_PARALLEL GS. */
4677 static inline tree
4678 gimple_omp_parallel_data_arg (const_gimple gs)
4680 const gimple_statement_omp_parallel *omp_parallel_stmt =
4681 as_a <const gimple_statement_omp_parallel *> (gs);
4682 return omp_parallel_stmt->data_arg;
4686 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4688 static inline tree *
4689 gimple_omp_parallel_data_arg_ptr (gimple gs)
4691 gimple_statement_omp_parallel *omp_parallel_stmt =
4692 as_a <gimple_statement_omp_parallel *> (gs);
4693 return &omp_parallel_stmt->data_arg;
4697 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4699 static inline void
4700 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4702 gimple_statement_omp_parallel *omp_parallel_stmt =
4703 as_a <gimple_statement_omp_parallel *> (gs);
4704 omp_parallel_stmt->data_arg = data_arg;
4708 /* Return the clauses associated with OMP_TASK GS. */
4710 static inline tree
4711 gimple_omp_task_clauses (const_gimple gs)
4713 const gimple_statement_omp_task *omp_task_stmt =
4714 as_a <const gimple_statement_omp_task *> (gs);
4715 return omp_task_stmt->clauses;
4719 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4721 static inline tree *
4722 gimple_omp_task_clauses_ptr (gimple gs)
4724 gimple_statement_omp_task *omp_task_stmt =
4725 as_a <gimple_statement_omp_task *> (gs);
4726 return &omp_task_stmt->clauses;
4730 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4731 GS. */
4733 static inline void
4734 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4736 gimple_statement_omp_task *omp_task_stmt =
4737 as_a <gimple_statement_omp_task *> (gs);
4738 omp_task_stmt->clauses = clauses;
4742 /* Return the child function used to hold the body of OMP_TASK GS. */
4744 static inline tree
4745 gimple_omp_task_child_fn (const_gimple gs)
4747 const gimple_statement_omp_task *omp_task_stmt =
4748 as_a <const gimple_statement_omp_task *> (gs);
4749 return omp_task_stmt->child_fn;
4752 /* Return a pointer to the child function used to hold the body of
4753 OMP_TASK GS. */
4755 static inline tree *
4756 gimple_omp_task_child_fn_ptr (gimple gs)
4758 gimple_statement_omp_task *omp_task_stmt =
4759 as_a <gimple_statement_omp_task *> (gs);
4760 return &omp_task_stmt->child_fn;
4764 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4766 static inline void
4767 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4769 gimple_statement_omp_task *omp_task_stmt =
4770 as_a <gimple_statement_omp_task *> (gs);
4771 omp_task_stmt->child_fn = child_fn;
4775 /* Return the artificial argument used to send variables and values
4776 from the parent to the children threads in OMP_TASK GS. */
4778 static inline tree
4779 gimple_omp_task_data_arg (const_gimple gs)
4781 const gimple_statement_omp_task *omp_task_stmt =
4782 as_a <const gimple_statement_omp_task *> (gs);
4783 return omp_task_stmt->data_arg;
4787 /* Return a pointer to the data argument for OMP_TASK GS. */
4789 static inline tree *
4790 gimple_omp_task_data_arg_ptr (gimple gs)
4792 gimple_statement_omp_task *omp_task_stmt =
4793 as_a <gimple_statement_omp_task *> (gs);
4794 return &omp_task_stmt->data_arg;
4798 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4800 static inline void
4801 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4803 gimple_statement_omp_task *omp_task_stmt =
4804 as_a <gimple_statement_omp_task *> (gs);
4805 omp_task_stmt->data_arg = data_arg;
4809 /* Return the clauses associated with OMP_TASK GS. */
4811 static inline tree
4812 gimple_omp_taskreg_clauses (const_gimple gs)
4814 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4815 as_a <const gimple_statement_omp_taskreg *> (gs);
4816 return omp_taskreg_stmt->clauses;
4820 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4822 static inline tree *
4823 gimple_omp_taskreg_clauses_ptr (gimple gs)
4825 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4826 as_a <gimple_statement_omp_taskreg *> (gs);
4827 return &omp_taskreg_stmt->clauses;
4831 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4832 GS. */
4834 static inline void
4835 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4837 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4838 as_a <gimple_statement_omp_taskreg *> (gs);
4839 omp_taskreg_stmt->clauses = clauses;
4843 /* Return the child function used to hold the body of OMP_TASK GS. */
4845 static inline tree
4846 gimple_omp_taskreg_child_fn (const_gimple gs)
4848 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4849 as_a <const gimple_statement_omp_taskreg *> (gs);
4850 return omp_taskreg_stmt->child_fn;
4853 /* Return a pointer to the child function used to hold the body of
4854 OMP_TASK GS. */
4856 static inline tree *
4857 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4859 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4860 as_a <gimple_statement_omp_taskreg *> (gs);
4861 return &omp_taskreg_stmt->child_fn;
4865 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4867 static inline void
4868 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4870 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4871 as_a <gimple_statement_omp_taskreg *> (gs);
4872 omp_taskreg_stmt->child_fn = child_fn;
4876 /* Return the artificial argument used to send variables and values
4877 from the parent to the children threads in OMP_TASK GS. */
4879 static inline tree
4880 gimple_omp_taskreg_data_arg (const_gimple gs)
4882 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4883 as_a <const gimple_statement_omp_taskreg *> (gs);
4884 return omp_taskreg_stmt->data_arg;
4888 /* Return a pointer to the data argument for OMP_TASK GS. */
4890 static inline tree *
4891 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4893 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4894 as_a <gimple_statement_omp_taskreg *> (gs);
4895 return &omp_taskreg_stmt->data_arg;
4899 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4901 static inline void
4902 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4904 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4905 as_a <gimple_statement_omp_taskreg *> (gs);
4906 omp_taskreg_stmt->data_arg = data_arg;
4910 /* Return the copy function used to hold the body of OMP_TASK GS. */
4912 static inline tree
4913 gimple_omp_task_copy_fn (const_gimple gs)
4915 const gimple_statement_omp_task *omp_task_stmt =
4916 as_a <const gimple_statement_omp_task *> (gs);
4917 return omp_task_stmt->copy_fn;
4920 /* Return a pointer to the copy function used to hold the body of
4921 OMP_TASK GS. */
4923 static inline tree *
4924 gimple_omp_task_copy_fn_ptr (gimple gs)
4926 gimple_statement_omp_task *omp_task_stmt =
4927 as_a <gimple_statement_omp_task *> (gs);
4928 return &omp_task_stmt->copy_fn;
4932 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4934 static inline void
4935 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4937 gimple_statement_omp_task *omp_task_stmt =
4938 as_a <gimple_statement_omp_task *> (gs);
4939 omp_task_stmt->copy_fn = copy_fn;
4943 /* Return size of the data block in bytes in OMP_TASK GS. */
4945 static inline tree
4946 gimple_omp_task_arg_size (const_gimple gs)
4948 const gimple_statement_omp_task *omp_task_stmt =
4949 as_a <const gimple_statement_omp_task *> (gs);
4950 return omp_task_stmt->arg_size;
4954 /* Return a pointer to the data block size for OMP_TASK GS. */
4956 static inline tree *
4957 gimple_omp_task_arg_size_ptr (gimple gs)
4959 gimple_statement_omp_task *omp_task_stmt =
4960 as_a <gimple_statement_omp_task *> (gs);
4961 return &omp_task_stmt->arg_size;
4965 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4967 static inline void
4968 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4970 gimple_statement_omp_task *omp_task_stmt =
4971 as_a <gimple_statement_omp_task *> (gs);
4972 omp_task_stmt->arg_size = arg_size;
4976 /* Return align of the data block in bytes in OMP_TASK GS. */
4978 static inline tree
4979 gimple_omp_task_arg_align (const_gimple gs)
4981 const gimple_statement_omp_task *omp_task_stmt =
4982 as_a <const gimple_statement_omp_task *> (gs);
4983 return omp_task_stmt->arg_align;
4987 /* Return a pointer to the data block align for OMP_TASK GS. */
4989 static inline tree *
4990 gimple_omp_task_arg_align_ptr (gimple gs)
4992 gimple_statement_omp_task *omp_task_stmt =
4993 as_a <gimple_statement_omp_task *> (gs);
4994 return &omp_task_stmt->arg_align;
4998 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5000 static inline void
5001 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5003 gimple_statement_omp_task *omp_task_stmt =
5004 as_a <gimple_statement_omp_task *> (gs);
5005 omp_task_stmt->arg_align = arg_align;
5009 /* Return the clauses associated with OMP_SINGLE GS. */
5011 static inline tree
5012 gimple_omp_single_clauses (const_gimple gs)
5014 const gimple_statement_omp_single *omp_single_stmt =
5015 as_a <const gimple_statement_omp_single *> (gs);
5016 return omp_single_stmt->clauses;
5020 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5022 static inline tree *
5023 gimple_omp_single_clauses_ptr (gimple gs)
5025 gimple_statement_omp_single *omp_single_stmt =
5026 as_a <gimple_statement_omp_single *> (gs);
5027 return &omp_single_stmt->clauses;
5031 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5033 static inline void
5034 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5036 gimple_statement_omp_single *omp_single_stmt =
5037 as_a <gimple_statement_omp_single *> (gs);
5038 omp_single_stmt->clauses = clauses;
5042 /* Return the clauses associated with OMP_TARGET GS. */
5044 static inline tree
5045 gimple_omp_target_clauses (const_gimple gs)
5047 const gimple_statement_omp_target *omp_target_stmt =
5048 as_a <const gimple_statement_omp_target *> (gs);
5049 return omp_target_stmt->clauses;
5053 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5055 static inline tree *
5056 gimple_omp_target_clauses_ptr (gimple gs)
5058 gimple_statement_omp_target *omp_target_stmt =
5059 as_a <gimple_statement_omp_target *> (gs);
5060 return &omp_target_stmt->clauses;
5064 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5066 static inline void
5067 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5069 gimple_statement_omp_target *omp_target_stmt =
5070 as_a <gimple_statement_omp_target *> (gs);
5071 omp_target_stmt->clauses = clauses;
5075 /* Return the kind of OMP target statemement. */
5077 static inline int
5078 gimple_omp_target_kind (const_gimple g)
5080 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5081 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5085 /* Set the OMP target kind. */
5087 static inline void
5088 gimple_omp_target_set_kind (gimple g, int kind)
5090 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5091 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5092 | (kind & GF_OMP_TARGET_KIND_MASK);
5096 /* Return the child function used to hold the body of OMP_TARGET GS. */
5098 static inline tree
5099 gimple_omp_target_child_fn (const_gimple gs)
5101 const gimple_statement_omp_target *omp_target_stmt =
5102 as_a <const gimple_statement_omp_target *> (gs);
5103 return omp_target_stmt->child_fn;
5106 /* Return a pointer to the child function used to hold the body of
5107 OMP_TARGET GS. */
5109 static inline tree *
5110 gimple_omp_target_child_fn_ptr (gimple gs)
5112 gimple_statement_omp_target *omp_target_stmt =
5113 as_a <gimple_statement_omp_target *> (gs);
5114 return &omp_target_stmt->child_fn;
5118 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5120 static inline void
5121 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5123 gimple_statement_omp_target *omp_target_stmt =
5124 as_a <gimple_statement_omp_target *> (gs);
5125 omp_target_stmt->child_fn = child_fn;
5129 /* Return the artificial argument used to send variables and values
5130 from the parent to the children threads in OMP_TARGET GS. */
5132 static inline tree
5133 gimple_omp_target_data_arg (const_gimple gs)
5135 const gimple_statement_omp_target *omp_target_stmt =
5136 as_a <const gimple_statement_omp_target *> (gs);
5137 return omp_target_stmt->data_arg;
5141 /* Return a pointer to the data argument for OMP_TARGET GS. */
5143 static inline tree *
5144 gimple_omp_target_data_arg_ptr (gimple gs)
5146 gimple_statement_omp_target *omp_target_stmt =
5147 as_a <gimple_statement_omp_target *> (gs);
5148 return &omp_target_stmt->data_arg;
5152 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5154 static inline void
5155 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5157 gimple_statement_omp_target *omp_target_stmt =
5158 as_a <gimple_statement_omp_target *> (gs);
5159 omp_target_stmt->data_arg = data_arg;
5163 /* Return the clauses associated with OMP_TEAMS GS. */
5165 static inline tree
5166 gimple_omp_teams_clauses (const_gimple gs)
5168 const gimple_statement_omp_teams *omp_teams_stmt =
5169 as_a <const gimple_statement_omp_teams *> (gs);
5170 return omp_teams_stmt->clauses;
5174 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5176 static inline tree *
5177 gimple_omp_teams_clauses_ptr (gimple gs)
5179 gimple_statement_omp_teams *omp_teams_stmt =
5180 as_a <gimple_statement_omp_teams *> (gs);
5181 return &omp_teams_stmt->clauses;
5185 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5187 static inline void
5188 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5190 gimple_statement_omp_teams *omp_teams_stmt =
5191 as_a <gimple_statement_omp_teams *> (gs);
5192 omp_teams_stmt->clauses = clauses;
5196 /* Return the clauses associated with OMP_SECTIONS GS. */
5198 static inline tree
5199 gimple_omp_sections_clauses (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->clauses;
5207 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5209 static inline tree *
5210 gimple_omp_sections_clauses_ptr (gimple gs)
5212 gimple_statement_omp_sections *omp_sections_stmt =
5213 as_a <gimple_statement_omp_sections *> (gs);
5214 return &omp_sections_stmt->clauses;
5218 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5219 GS. */
5221 static inline void
5222 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5224 gimple_statement_omp_sections *omp_sections_stmt =
5225 as_a <gimple_statement_omp_sections *> (gs);
5226 omp_sections_stmt->clauses = clauses;
5230 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5231 in GS. */
5233 static inline tree
5234 gimple_omp_sections_control (const_gimple gs)
5236 const gimple_statement_omp_sections *omp_sections_stmt =
5237 as_a <const gimple_statement_omp_sections *> (gs);
5238 return omp_sections_stmt->control;
5242 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5243 GS. */
5245 static inline tree *
5246 gimple_omp_sections_control_ptr (gimple gs)
5248 gimple_statement_omp_sections *omp_sections_stmt =
5249 as_a <gimple_statement_omp_sections *> (gs);
5250 return &omp_sections_stmt->control;
5254 /* Set CONTROL to be the set of clauses associated with the
5255 GIMPLE_OMP_SECTIONS in GS. */
5257 static inline void
5258 gimple_omp_sections_set_control (gimple gs, tree control)
5260 gimple_statement_omp_sections *omp_sections_stmt =
5261 as_a <gimple_statement_omp_sections *> (gs);
5262 omp_sections_stmt->control = control;
5266 /* Set COND to be the condition code for OMP_FOR GS. */
5268 static inline void
5269 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5271 gimple_statement_omp_for *omp_for_stmt =
5272 as_a <gimple_statement_omp_for *> (gs);
5273 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5274 && i < omp_for_stmt->collapse);
5275 omp_for_stmt->iter[i].cond = cond;
5279 /* Return the condition code associated with OMP_FOR GS. */
5281 static inline enum tree_code
5282 gimple_omp_for_cond (const_gimple gs, size_t i)
5284 const gimple_statement_omp_for *omp_for_stmt =
5285 as_a <const gimple_statement_omp_for *> (gs);
5286 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5287 return omp_for_stmt->iter[i].cond;
5291 /* Set the value being stored in an atomic store. */
5293 static inline void
5294 gimple_omp_atomic_store_set_val (gimple g, tree val)
5296 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5297 as_a <gimple_statement_omp_atomic_store *> (g);
5298 omp_atomic_store_stmt->val = val;
5302 /* Return the value being stored in an atomic store. */
5304 static inline tree
5305 gimple_omp_atomic_store_val (const_gimple g)
5307 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5308 as_a <const gimple_statement_omp_atomic_store *> (g);
5309 return omp_atomic_store_stmt->val;
5313 /* Return a pointer to the value being stored in an atomic store. */
5315 static inline tree *
5316 gimple_omp_atomic_store_val_ptr (gimple g)
5318 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5319 as_a <gimple_statement_omp_atomic_store *> (g);
5320 return &omp_atomic_store_stmt->val;
5324 /* Set the LHS of an atomic load. */
5326 static inline void
5327 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5329 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5330 as_a <gimple_statement_omp_atomic_load *> (g);
5331 omp_atomic_load_stmt->lhs = lhs;
5335 /* Get the LHS of an atomic load. */
5337 static inline tree
5338 gimple_omp_atomic_load_lhs (const_gimple g)
5340 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5341 as_a <const gimple_statement_omp_atomic_load *> (g);
5342 return omp_atomic_load_stmt->lhs;
5346 /* Return a pointer to the LHS of an atomic load. */
5348 static inline tree *
5349 gimple_omp_atomic_load_lhs_ptr (gimple g)
5351 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5352 as_a <gimple_statement_omp_atomic_load *> (g);
5353 return &omp_atomic_load_stmt->lhs;
5357 /* Set the RHS of an atomic load. */
5359 static inline void
5360 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5362 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5363 as_a <gimple_statement_omp_atomic_load *> (g);
5364 omp_atomic_load_stmt->rhs = rhs;
5368 /* Get the RHS of an atomic load. */
5370 static inline tree
5371 gimple_omp_atomic_load_rhs (const_gimple g)
5373 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5374 as_a <const gimple_statement_omp_atomic_load *> (g);
5375 return omp_atomic_load_stmt->rhs;
5379 /* Return a pointer to the RHS of an atomic load. */
5381 static inline tree *
5382 gimple_omp_atomic_load_rhs_ptr (gimple g)
5384 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5385 as_a <gimple_statement_omp_atomic_load *> (g);
5386 return &omp_atomic_load_stmt->rhs;
5390 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5392 static inline tree
5393 gimple_omp_continue_control_def (const_gimple g)
5395 const gimple_statement_omp_continue *omp_continue_stmt =
5396 as_a <const gimple_statement_omp_continue *> (g);
5397 return omp_continue_stmt->control_def;
5400 /* The same as above, but return the address. */
5402 static inline tree *
5403 gimple_omp_continue_control_def_ptr (gimple g)
5405 gimple_statement_omp_continue *omp_continue_stmt =
5406 as_a <gimple_statement_omp_continue *> (g);
5407 return &omp_continue_stmt->control_def;
5410 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5412 static inline void
5413 gimple_omp_continue_set_control_def (gimple g, tree def)
5415 gimple_statement_omp_continue *omp_continue_stmt =
5416 as_a <gimple_statement_omp_continue *> (g);
5417 omp_continue_stmt->control_def = def;
5421 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5423 static inline tree
5424 gimple_omp_continue_control_use (const_gimple g)
5426 const gimple_statement_omp_continue *omp_continue_stmt =
5427 as_a <const gimple_statement_omp_continue *> (g);
5428 return omp_continue_stmt->control_use;
5432 /* The same as above, but return the address. */
5434 static inline tree *
5435 gimple_omp_continue_control_use_ptr (gimple g)
5437 gimple_statement_omp_continue *omp_continue_stmt =
5438 as_a <gimple_statement_omp_continue *> (g);
5439 return &omp_continue_stmt->control_use;
5443 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5445 static inline void
5446 gimple_omp_continue_set_control_use (gimple g, tree use)
5448 gimple_statement_omp_continue *omp_continue_stmt =
5449 as_a <gimple_statement_omp_continue *> (g);
5450 omp_continue_stmt->control_use = use;
5453 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5455 static inline gimple_seq *
5456 gimple_transaction_body_ptr (gimple gs)
5458 gimple_statement_transaction *transaction_stmt =
5459 as_a <gimple_statement_transaction *> (gs);
5460 return &transaction_stmt->body;
5463 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5465 static inline gimple_seq
5466 gimple_transaction_body (gimple gs)
5468 return *gimple_transaction_body_ptr (gs);
5471 /* Return the label associated with a GIMPLE_TRANSACTION. */
5473 static inline tree
5474 gimple_transaction_label (const_gimple gs)
5476 const gimple_statement_transaction *transaction_stmt =
5477 as_a <const gimple_statement_transaction *> (gs);
5478 return transaction_stmt->label;
5481 static inline tree *
5482 gimple_transaction_label_ptr (gimple gs)
5484 gimple_statement_transaction *transaction_stmt =
5485 as_a <gimple_statement_transaction *> (gs);
5486 return &transaction_stmt->label;
5489 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5491 static inline unsigned int
5492 gimple_transaction_subcode (const_gimple gs)
5494 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5495 return gs->subcode;
5498 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5500 static inline void
5501 gimple_transaction_set_body (gimple gs, gimple_seq body)
5503 gimple_statement_transaction *transaction_stmt =
5504 as_a <gimple_statement_transaction *> (gs);
5505 transaction_stmt->body = body;
5508 /* Set the label associated with a GIMPLE_TRANSACTION. */
5510 static inline void
5511 gimple_transaction_set_label (gimple gs, tree label)
5513 gimple_statement_transaction *transaction_stmt =
5514 as_a <gimple_statement_transaction *> (gs);
5515 transaction_stmt->label = label;
5518 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5520 static inline void
5521 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5523 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5524 gs->subcode = subcode;
5528 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5530 static inline tree *
5531 gimple_return_retval_ptr (const_gimple gs)
5533 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5534 return gimple_op_ptr (gs, 0);
5537 /* Return the return value for GIMPLE_RETURN GS. */
5539 static inline tree
5540 gimple_return_retval (const_gimple gs)
5542 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5543 return gimple_op (gs, 0);
5547 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5549 static inline void
5550 gimple_return_set_retval (gimple gs, tree retval)
5552 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5553 gimple_set_op (gs, 0, retval);
5557 /* Return the return bounds for GIMPLE_RETURN GS. */
5559 static inline tree
5560 gimple_return_retbnd (const_gimple gs)
5562 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5563 return gimple_op (gs, 1);
5567 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5569 static inline void
5570 gimple_return_set_retbnd (gimple gs, tree retval)
5572 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5573 gimple_set_op (gs, 1, retval);
5577 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5579 #define CASE_GIMPLE_OMP \
5580 case GIMPLE_OMP_PARALLEL: \
5581 case GIMPLE_OMP_TASK: \
5582 case GIMPLE_OMP_FOR: \
5583 case GIMPLE_OMP_SECTIONS: \
5584 case GIMPLE_OMP_SECTIONS_SWITCH: \
5585 case GIMPLE_OMP_SINGLE: \
5586 case GIMPLE_OMP_TARGET: \
5587 case GIMPLE_OMP_TEAMS: \
5588 case GIMPLE_OMP_SECTION: \
5589 case GIMPLE_OMP_MASTER: \
5590 case GIMPLE_OMP_TASKGROUP: \
5591 case GIMPLE_OMP_ORDERED: \
5592 case GIMPLE_OMP_CRITICAL: \
5593 case GIMPLE_OMP_RETURN: \
5594 case GIMPLE_OMP_ATOMIC_LOAD: \
5595 case GIMPLE_OMP_ATOMIC_STORE: \
5596 case GIMPLE_OMP_CONTINUE
5598 static inline bool
5599 is_gimple_omp (const_gimple stmt)
5601 switch (gimple_code (stmt))
5603 CASE_GIMPLE_OMP:
5604 return true;
5605 default:
5606 return false;
5611 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5613 static inline bool
5614 gimple_nop_p (const_gimple g)
5616 return gimple_code (g) == GIMPLE_NOP;
5620 /* Return true if GS is a GIMPLE_RESX. */
5622 static inline bool
5623 is_gimple_resx (const_gimple gs)
5625 return gimple_code (gs) == GIMPLE_RESX;
5628 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5630 static inline enum br_predictor
5631 gimple_predict_predictor (gimple gs)
5633 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5634 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5638 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5640 static inline void
5641 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5643 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5644 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5645 | (unsigned) predictor;
5649 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5651 static inline enum prediction
5652 gimple_predict_outcome (gimple gs)
5654 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5655 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5659 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5661 static inline void
5662 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5664 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5665 if (outcome == TAKEN)
5666 gs->subcode |= GF_PREDICT_TAKEN;
5667 else
5668 gs->subcode &= ~GF_PREDICT_TAKEN;
5672 /* Return the type of the main expression computed by STMT. Return
5673 void_type_node if the statement computes nothing. */
5675 static inline tree
5676 gimple_expr_type (const_gimple stmt)
5678 enum gimple_code code = gimple_code (stmt);
5680 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5682 tree type;
5683 /* In general we want to pass out a type that can be substituted
5684 for both the RHS and the LHS types if there is a possibly
5685 useless conversion involved. That means returning the
5686 original RHS type as far as we can reconstruct it. */
5687 if (code == GIMPLE_CALL)
5689 if (gimple_call_internal_p (stmt)
5690 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5691 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5692 else
5693 type = gimple_call_return_type (stmt);
5695 else
5696 switch (gimple_assign_rhs_code (stmt))
5698 case POINTER_PLUS_EXPR:
5699 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5700 break;
5702 default:
5703 /* As fallback use the type of the LHS. */
5704 type = TREE_TYPE (gimple_get_lhs (stmt));
5705 break;
5707 return type;
5709 else if (code == GIMPLE_COND)
5710 return boolean_type_node;
5711 else
5712 return void_type_node;
5715 /* Enum and arrays used for allocation stats. Keep in sync with
5716 gimple.c:gimple_alloc_kind_names. */
5717 enum gimple_alloc_kind
5719 gimple_alloc_kind_assign, /* Assignments. */
5720 gimple_alloc_kind_phi, /* PHI nodes. */
5721 gimple_alloc_kind_cond, /* Conditionals. */
5722 gimple_alloc_kind_rest, /* Everything else. */
5723 gimple_alloc_kind_all
5726 extern int gimple_alloc_counts[];
5727 extern int gimple_alloc_sizes[];
5729 /* Return the allocation kind for a given stmt CODE. */
5730 static inline enum gimple_alloc_kind
5731 gimple_alloc_kind (enum gimple_code code)
5733 switch (code)
5735 case GIMPLE_ASSIGN:
5736 return gimple_alloc_kind_assign;
5737 case GIMPLE_PHI:
5738 return gimple_alloc_kind_phi;
5739 case GIMPLE_COND:
5740 return gimple_alloc_kind_cond;
5741 default:
5742 return gimple_alloc_kind_rest;
5746 /* Return true if a location should not be emitted for this statement
5747 by annotate_all_with_location. */
5749 static inline bool
5750 gimple_do_not_emit_location_p (gimple g)
5752 return gimple_plf (g, GF_PLF_1);
5755 /* Mark statement G so a location will not be emitted by
5756 annotate_one_with_location. */
5758 static inline void
5759 gimple_set_do_not_emit_location (gimple g)
5761 /* The PLF flags are initialized to 0 when a new tuple is created,
5762 so no need to initialize it anywhere. */
5763 gimple_set_plf (g, GF_PLF_1, true);
5767 /* Macros for showing usage statistics. */
5768 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5769 ? (x) \
5770 : ((x) < 1024*1024*10 \
5771 ? (x) / 1024 \
5772 : (x) / (1024*1024))))
5774 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5776 #endif /* GCC_GIMPLE_H */