* gcc.dg/tree-ssa/loop-19.c: Exclude classic FPU Power targets.
[official-gcc.git] / gcc / gimple.h
blob51814baa65ab51c89a16309294b715fed7d26b12
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_CTRL_ALTERING = 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 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1231 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1232 location_t);
1233 extern void annotate_all_with_location (gimple_seq, location_t);
1234 bool empty_body_p (gimple_seq);
1235 gimple_seq gimple_seq_copy (gimple_seq);
1236 bool gimple_call_same_target_p (const_gimple, const_gimple);
1237 int gimple_call_flags (const_gimple);
1238 int gimple_call_arg_flags (const_gimple, unsigned);
1239 int gimple_call_return_flags (const_gimple);
1240 bool gimple_assign_copy_p (gimple);
1241 bool gimple_assign_ssa_name_copy_p (gimple);
1242 bool gimple_assign_unary_nop_p (gimple);
1243 void gimple_set_bb (gimple, basic_block);
1244 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1245 void gimple_assign_set_rhs_with_ops_1 (gimple_stmt_iterator *, enum tree_code,
1246 tree, tree, tree);
1247 tree gimple_get_lhs (const_gimple);
1248 void gimple_set_lhs (gimple, tree);
1249 gimple gimple_copy (gimple);
1250 bool gimple_has_side_effects (const_gimple);
1251 bool gimple_could_trap_p_1 (gimple, bool, bool);
1252 bool gimple_could_trap_p (gimple);
1253 bool gimple_assign_rhs_could_trap_p (gimple);
1254 extern void dump_gimple_statistics (void);
1255 unsigned get_gimple_rhs_num_ops (enum tree_code);
1256 extern tree canonicalize_cond_expr_cond (tree);
1257 gimple gimple_call_copy_skip_args (gimple, bitmap);
1258 extern bool gimple_compare_field_offset (tree, tree);
1259 extern tree gimple_unsigned_type (tree);
1260 extern tree gimple_signed_type (tree);
1261 extern alias_set_type gimple_get_alias_set (tree);
1262 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1263 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1264 extern bool gimple_call_builtin_p (const_gimple);
1265 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1266 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1267 extern bool gimple_asm_clobbers_memory_p (const_gimple);
1268 extern void dump_decl_set (FILE *, bitmap);
1269 extern bool nonfreeing_call_p (gimple);
1270 extern bool infer_nonnull_range (gimple, tree, bool, bool);
1271 extern void sort_case_labels (vec<tree> );
1272 extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
1273 extern void gimple_seq_set_location (gimple_seq , location_t);
1275 /* Formal (expression) temporary table handling: multiple occurrences of
1276 the same scalar expression are evaluated into the same temporary. */
1278 typedef struct gimple_temp_hash_elt
1280 tree val; /* Key */
1281 tree temp; /* Value */
1282 } elt_t;
1284 /* Get the number of the next statement uid to be allocated. */
1285 static inline unsigned int
1286 gimple_stmt_max_uid (struct function *fn)
1288 return fn->last_stmt_uid;
1291 /* Set the number of the next statement uid to be allocated. */
1292 static inline void
1293 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1295 fn->last_stmt_uid = maxid;
1298 /* Set the number of the next statement uid to be allocated. */
1299 static inline unsigned int
1300 inc_gimple_stmt_max_uid (struct function *fn)
1302 return fn->last_stmt_uid++;
1305 /* Return the first node in GIMPLE sequence S. */
1307 static inline gimple_seq_node
1308 gimple_seq_first (gimple_seq s)
1310 return s;
1314 /* Return the first statement in GIMPLE sequence S. */
1316 static inline gimple
1317 gimple_seq_first_stmt (gimple_seq s)
1319 gimple_seq_node n = gimple_seq_first (s);
1320 return n;
1324 /* Return the last node in GIMPLE sequence S. */
1326 static inline gimple_seq_node
1327 gimple_seq_last (gimple_seq s)
1329 return s ? s->prev : NULL;
1333 /* Return the last statement in GIMPLE sequence S. */
1335 static inline gimple
1336 gimple_seq_last_stmt (gimple_seq s)
1338 gimple_seq_node n = gimple_seq_last (s);
1339 return n;
1343 /* Set the last node in GIMPLE sequence *PS to LAST. */
1345 static inline void
1346 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1348 (*ps)->prev = last;
1352 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1354 static inline void
1355 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1357 *ps = first;
1361 /* Return true if GIMPLE sequence S is empty. */
1363 static inline bool
1364 gimple_seq_empty_p (gimple_seq s)
1366 return s == NULL;
1369 /* Allocate a new sequence and initialize its first element with STMT. */
1371 static inline gimple_seq
1372 gimple_seq_alloc_with_stmt (gimple stmt)
1374 gimple_seq seq = NULL;
1375 gimple_seq_add_stmt (&seq, stmt);
1376 return seq;
1380 /* Returns the sequence of statements in BB. */
1382 static inline gimple_seq
1383 bb_seq (const_basic_block bb)
1385 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1388 static inline gimple_seq *
1389 bb_seq_addr (basic_block bb)
1391 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1394 /* Sets the sequence of statements in BB to SEQ. */
1396 static inline void
1397 set_bb_seq (basic_block bb, gimple_seq seq)
1399 gcc_checking_assert (!(bb->flags & BB_RTL));
1400 bb->il.gimple.seq = seq;
1404 /* Return the code for GIMPLE statement G. */
1406 static inline enum gimple_code
1407 gimple_code (const_gimple g)
1409 return g->code;
1413 /* Return the GSS code used by a GIMPLE code. */
1415 static inline enum gimple_statement_structure_enum
1416 gss_for_code (enum gimple_code code)
1418 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1419 return gss_for_code_[code];
1423 /* Return which GSS code is used by GS. */
1425 static inline enum gimple_statement_structure_enum
1426 gimple_statement_structure (gimple gs)
1428 return gss_for_code (gimple_code (gs));
1432 /* Return true if statement G has sub-statements. This is only true for
1433 High GIMPLE statements. */
1435 static inline bool
1436 gimple_has_substatements (gimple g)
1438 switch (gimple_code (g))
1440 case GIMPLE_BIND:
1441 case GIMPLE_CATCH:
1442 case GIMPLE_EH_FILTER:
1443 case GIMPLE_EH_ELSE:
1444 case GIMPLE_TRY:
1445 case GIMPLE_OMP_FOR:
1446 case GIMPLE_OMP_MASTER:
1447 case GIMPLE_OMP_TASKGROUP:
1448 case GIMPLE_OMP_ORDERED:
1449 case GIMPLE_OMP_SECTION:
1450 case GIMPLE_OMP_PARALLEL:
1451 case GIMPLE_OMP_TASK:
1452 case GIMPLE_OMP_SECTIONS:
1453 case GIMPLE_OMP_SINGLE:
1454 case GIMPLE_OMP_TARGET:
1455 case GIMPLE_OMP_TEAMS:
1456 case GIMPLE_OMP_CRITICAL:
1457 case GIMPLE_WITH_CLEANUP_EXPR:
1458 case GIMPLE_TRANSACTION:
1459 return true;
1461 default:
1462 return false;
1467 /* Return the basic block holding statement G. */
1469 static inline basic_block
1470 gimple_bb (const_gimple g)
1472 return g->bb;
1476 /* Return the lexical scope block holding statement G. */
1478 static inline tree
1479 gimple_block (const_gimple g)
1481 return LOCATION_BLOCK (g->location);
1485 /* Set BLOCK to be the lexical scope block holding statement G. */
1487 static inline void
1488 gimple_set_block (gimple g, tree block)
1490 if (block)
1491 g->location =
1492 COMBINE_LOCATION_DATA (line_table, g->location, block);
1493 else
1494 g->location = LOCATION_LOCUS (g->location);
1498 /* Return location information for statement G. */
1500 static inline location_t
1501 gimple_location (const_gimple g)
1503 return g->location;
1506 /* Return location information for statement G if g is not NULL.
1507 Otherwise, UNKNOWN_LOCATION is returned. */
1509 static inline location_t
1510 gimple_location_safe (const_gimple g)
1512 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1515 /* Return pointer to location information for statement G. */
1517 static inline const location_t *
1518 gimple_location_ptr (const_gimple g)
1520 return &g->location;
1524 /* Set location information for statement G. */
1526 static inline void
1527 gimple_set_location (gimple g, location_t location)
1529 g->location = location;
1533 /* Return true if G contains location information. */
1535 static inline bool
1536 gimple_has_location (const_gimple g)
1538 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1542 /* Return the file name of the location of STMT. */
1544 static inline const char *
1545 gimple_filename (const_gimple stmt)
1547 return LOCATION_FILE (gimple_location (stmt));
1551 /* Return the line number of the location of STMT. */
1553 static inline int
1554 gimple_lineno (const_gimple stmt)
1556 return LOCATION_LINE (gimple_location (stmt));
1560 /* Determine whether SEQ is a singleton. */
1562 static inline bool
1563 gimple_seq_singleton_p (gimple_seq seq)
1565 return ((gimple_seq_first (seq) != NULL)
1566 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1569 /* Return true if no warnings should be emitted for statement STMT. */
1571 static inline bool
1572 gimple_no_warning_p (const_gimple stmt)
1574 return stmt->no_warning;
1577 /* Set the no_warning flag of STMT to NO_WARNING. */
1579 static inline void
1580 gimple_set_no_warning (gimple stmt, bool no_warning)
1582 stmt->no_warning = (unsigned) no_warning;
1585 /* Set the visited status on statement STMT to VISITED_P. */
1587 static inline void
1588 gimple_set_visited (gimple stmt, bool visited_p)
1590 stmt->visited = (unsigned) visited_p;
1594 /* Return the visited status for statement STMT. */
1596 static inline bool
1597 gimple_visited_p (gimple stmt)
1599 return stmt->visited;
1603 /* Set pass local flag PLF on statement STMT to VAL_P. */
1605 static inline void
1606 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1608 if (val_p)
1609 stmt->plf |= (unsigned int) plf;
1610 else
1611 stmt->plf &= ~((unsigned int) plf);
1615 /* Return the value of pass local flag PLF on statement STMT. */
1617 static inline unsigned int
1618 gimple_plf (gimple stmt, enum plf_mask plf)
1620 return stmt->plf & ((unsigned int) plf);
1624 /* Set the UID of statement. */
1626 static inline void
1627 gimple_set_uid (gimple g, unsigned uid)
1629 g->uid = uid;
1633 /* Return the UID of statement. */
1635 static inline unsigned
1636 gimple_uid (const_gimple g)
1638 return g->uid;
1642 /* Make statement G a singleton sequence. */
1644 static inline void
1645 gimple_init_singleton (gimple g)
1647 g->next = NULL;
1648 g->prev = g;
1652 /* Return true if GIMPLE statement G has register or memory operands. */
1654 static inline bool
1655 gimple_has_ops (const_gimple g)
1657 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1660 template <>
1661 template <>
1662 inline bool
1663 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1665 return gimple_has_ops (gs);
1668 template <>
1669 template <>
1670 inline bool
1671 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1673 return gimple_has_ops (gs);
1676 /* Return true if GIMPLE statement G has memory operands. */
1678 static inline bool
1679 gimple_has_mem_ops (const_gimple g)
1681 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1684 template <>
1685 template <>
1686 inline bool
1687 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1689 return gimple_has_mem_ops (gs);
1692 template <>
1693 template <>
1694 inline bool
1695 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1697 return gimple_has_mem_ops (gs);
1700 /* Return the set of USE operands for statement G. */
1702 static inline struct use_optype_d *
1703 gimple_use_ops (const_gimple g)
1705 const gimple_statement_with_ops *ops_stmt =
1706 dyn_cast <const gimple_statement_with_ops *> (g);
1707 if (!ops_stmt)
1708 return NULL;
1709 return ops_stmt->use_ops;
1713 /* Set USE to be the set of USE operands for statement G. */
1715 static inline void
1716 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1718 gimple_statement_with_ops *ops_stmt =
1719 as_a <gimple_statement_with_ops *> (g);
1720 ops_stmt->use_ops = use;
1724 /* Return the single VUSE operand of the statement G. */
1726 static inline tree
1727 gimple_vuse (const_gimple g)
1729 const gimple_statement_with_memory_ops *mem_ops_stmt =
1730 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1731 if (!mem_ops_stmt)
1732 return NULL_TREE;
1733 return mem_ops_stmt->vuse;
1736 /* Return the single VDEF operand of the statement G. */
1738 static inline tree
1739 gimple_vdef (const_gimple g)
1741 const gimple_statement_with_memory_ops *mem_ops_stmt =
1742 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1743 if (!mem_ops_stmt)
1744 return NULL_TREE;
1745 return mem_ops_stmt->vdef;
1748 /* Return the single VUSE operand of the statement G. */
1750 static inline tree *
1751 gimple_vuse_ptr (gimple g)
1753 gimple_statement_with_memory_ops *mem_ops_stmt =
1754 dyn_cast <gimple_statement_with_memory_ops *> (g);
1755 if (!mem_ops_stmt)
1756 return NULL;
1757 return &mem_ops_stmt->vuse;
1760 /* Return the single VDEF operand of the statement G. */
1762 static inline tree *
1763 gimple_vdef_ptr (gimple g)
1765 gimple_statement_with_memory_ops *mem_ops_stmt =
1766 dyn_cast <gimple_statement_with_memory_ops *> (g);
1767 if (!mem_ops_stmt)
1768 return NULL;
1769 return &mem_ops_stmt->vdef;
1772 /* Set the single VUSE operand of the statement G. */
1774 static inline void
1775 gimple_set_vuse (gimple g, tree vuse)
1777 gimple_statement_with_memory_ops *mem_ops_stmt =
1778 as_a <gimple_statement_with_memory_ops *> (g);
1779 mem_ops_stmt->vuse = vuse;
1782 /* Set the single VDEF operand of the statement G. */
1784 static inline void
1785 gimple_set_vdef (gimple g, tree vdef)
1787 gimple_statement_with_memory_ops *mem_ops_stmt =
1788 as_a <gimple_statement_with_memory_ops *> (g);
1789 mem_ops_stmt->vdef = vdef;
1793 /* Return true if statement G has operands and the modified field has
1794 been set. */
1796 static inline bool
1797 gimple_modified_p (const_gimple g)
1799 return (gimple_has_ops (g)) ? (bool) g->modified : false;
1803 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
1804 a MODIFIED field. */
1806 static inline void
1807 gimple_set_modified (gimple s, bool modifiedp)
1809 if (gimple_has_ops (s))
1810 s->modified = (unsigned) modifiedp;
1814 /* Return the tree code for the expression computed by STMT. This is
1815 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1816 GIMPLE_CALL, return CALL_EXPR as the expression code for
1817 consistency. This is useful when the caller needs to deal with the
1818 three kinds of computation that GIMPLE supports. */
1820 static inline enum tree_code
1821 gimple_expr_code (const_gimple stmt)
1823 enum gimple_code code = gimple_code (stmt);
1824 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1825 return (enum tree_code) stmt->subcode;
1826 else
1828 gcc_gimple_checking_assert (code == GIMPLE_CALL);
1829 return CALL_EXPR;
1834 /* Return true if statement STMT contains volatile operands. */
1836 static inline bool
1837 gimple_has_volatile_ops (const_gimple stmt)
1839 if (gimple_has_mem_ops (stmt))
1840 return stmt->has_volatile_ops;
1841 else
1842 return false;
1846 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1848 static inline void
1849 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1851 if (gimple_has_mem_ops (stmt))
1852 stmt->has_volatile_ops = (unsigned) volatilep;
1855 /* Return true if STMT is in a transaction. */
1857 static inline bool
1858 gimple_in_transaction (gimple stmt)
1860 return bb_in_transaction (gimple_bb (stmt));
1863 /* Return true if statement STMT may access memory. */
1865 static inline bool
1866 gimple_references_memory_p (gimple stmt)
1868 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
1872 /* Return the subcode for OMP statement S. */
1874 static inline unsigned
1875 gimple_omp_subcode (const_gimple s)
1877 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1878 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
1879 return s->subcode;
1882 /* Set the subcode for OMP statement S to SUBCODE. */
1884 static inline void
1885 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1887 /* We only have 16 bits for the subcode. Assert that we are not
1888 overflowing it. */
1889 gcc_gimple_checking_assert (subcode < (1 << 16));
1890 s->subcode = subcode;
1893 /* Set the nowait flag on OMP_RETURN statement S. */
1895 static inline void
1896 gimple_omp_return_set_nowait (gimple s)
1898 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1899 s->subcode |= GF_OMP_RETURN_NOWAIT;
1903 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1904 flag set. */
1906 static inline bool
1907 gimple_omp_return_nowait_p (const_gimple g)
1909 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1910 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1914 /* Set the LHS of OMP return. */
1916 static inline void
1917 gimple_omp_return_set_lhs (gimple g, tree lhs)
1919 gimple_statement_omp_return *omp_return_stmt =
1920 as_a <gimple_statement_omp_return *> (g);
1921 omp_return_stmt->val = lhs;
1925 /* Get the LHS of OMP return. */
1927 static inline tree
1928 gimple_omp_return_lhs (const_gimple g)
1930 const gimple_statement_omp_return *omp_return_stmt =
1931 as_a <const gimple_statement_omp_return *> (g);
1932 return omp_return_stmt->val;
1936 /* Return a pointer to the LHS of OMP return. */
1938 static inline tree *
1939 gimple_omp_return_lhs_ptr (gimple g)
1941 gimple_statement_omp_return *omp_return_stmt =
1942 as_a <gimple_statement_omp_return *> (g);
1943 return &omp_return_stmt->val;
1947 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1948 flag set. */
1950 static inline bool
1951 gimple_omp_section_last_p (const_gimple g)
1953 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1954 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1958 /* Set the GF_OMP_SECTION_LAST flag on G. */
1960 static inline void
1961 gimple_omp_section_set_last (gimple g)
1963 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1964 g->subcode |= GF_OMP_SECTION_LAST;
1968 /* Return true if OMP parallel statement G has the
1969 GF_OMP_PARALLEL_COMBINED flag set. */
1971 static inline bool
1972 gimple_omp_parallel_combined_p (const_gimple g)
1974 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1975 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1979 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1980 value of COMBINED_P. */
1982 static inline void
1983 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1985 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1986 if (combined_p)
1987 g->subcode |= GF_OMP_PARALLEL_COMBINED;
1988 else
1989 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
1993 /* Return true if OMP atomic load/store statement G has the
1994 GF_OMP_ATOMIC_NEED_VALUE flag set. */
1996 static inline bool
1997 gimple_omp_atomic_need_value_p (const_gimple g)
1999 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2000 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2001 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2005 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2007 static inline void
2008 gimple_omp_atomic_set_need_value (gimple g)
2010 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2011 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2012 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2016 /* Return true if OMP atomic load/store statement G has the
2017 GF_OMP_ATOMIC_SEQ_CST flag set. */
2019 static inline bool
2020 gimple_omp_atomic_seq_cst_p (const_gimple g)
2022 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2023 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2024 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2028 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2030 static inline void
2031 gimple_omp_atomic_set_seq_cst (gimple g)
2033 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2034 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2035 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2039 /* Return the number of operands for statement GS. */
2041 static inline unsigned
2042 gimple_num_ops (const_gimple gs)
2044 return gs->num_ops;
2048 /* Set the number of operands for statement GS. */
2050 static inline void
2051 gimple_set_num_ops (gimple gs, unsigned num_ops)
2053 gs->num_ops = num_ops;
2057 /* Return the array of operands for statement GS. */
2059 static inline tree *
2060 gimple_ops (gimple gs)
2062 size_t off;
2064 /* All the tuples have their operand vector at the very bottom
2065 of the structure. Note that those structures that do not
2066 have an operand vector have a zero offset. */
2067 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2068 gcc_gimple_checking_assert (off != 0);
2070 return (tree *) ((char *) gs + off);
2074 /* Return operand I for statement GS. */
2076 static inline tree
2077 gimple_op (const_gimple gs, unsigned i)
2079 if (gimple_has_ops (gs))
2081 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2082 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2084 else
2085 return NULL_TREE;
2088 /* Return a pointer to operand I for statement GS. */
2090 static inline tree *
2091 gimple_op_ptr (const_gimple gs, unsigned i)
2093 if (gimple_has_ops (gs))
2095 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2096 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2098 else
2099 return NULL;
2102 /* Set operand I of statement GS to OP. */
2104 static inline void
2105 gimple_set_op (gimple gs, unsigned i, tree op)
2107 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2109 /* Note. It may be tempting to assert that OP matches
2110 is_gimple_operand, but that would be wrong. Different tuples
2111 accept slightly different sets of tree operands. Each caller
2112 should perform its own validation. */
2113 gimple_ops (gs)[i] = op;
2116 /* Return true if GS is a GIMPLE_ASSIGN. */
2118 static inline bool
2119 is_gimple_assign (const_gimple gs)
2121 return gimple_code (gs) == GIMPLE_ASSIGN;
2124 /* Determine if expression CODE is one of the valid expressions that can
2125 be used on the RHS of GIMPLE assignments. */
2127 static inline enum gimple_rhs_class
2128 get_gimple_rhs_class (enum tree_code code)
2130 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2133 /* Return the LHS of assignment statement GS. */
2135 static inline tree
2136 gimple_assign_lhs (const_gimple gs)
2138 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2139 return gimple_op (gs, 0);
2143 /* Return a pointer to the LHS of assignment statement GS. */
2145 static inline tree *
2146 gimple_assign_lhs_ptr (const_gimple gs)
2148 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2149 return gimple_op_ptr (gs, 0);
2153 /* Set LHS to be the LHS operand of assignment statement GS. */
2155 static inline void
2156 gimple_assign_set_lhs (gimple gs, tree lhs)
2158 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2159 gimple_set_op (gs, 0, lhs);
2161 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2162 SSA_NAME_DEF_STMT (lhs) = gs;
2166 /* Return the first operand on the RHS of assignment statement GS. */
2168 static inline tree
2169 gimple_assign_rhs1 (const_gimple gs)
2171 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2172 return gimple_op (gs, 1);
2176 /* Return a pointer to the first operand on the RHS of assignment
2177 statement GS. */
2179 static inline tree *
2180 gimple_assign_rhs1_ptr (const_gimple gs)
2182 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2183 return gimple_op_ptr (gs, 1);
2186 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2188 static inline void
2189 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2191 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2193 gimple_set_op (gs, 1, rhs);
2197 /* Return the second operand on the RHS of assignment statement GS.
2198 If GS does not have two operands, NULL is returned instead. */
2200 static inline tree
2201 gimple_assign_rhs2 (const_gimple gs)
2203 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2205 if (gimple_num_ops (gs) >= 3)
2206 return gimple_op (gs, 2);
2207 else
2208 return NULL_TREE;
2212 /* Return a pointer to the second operand on the RHS of assignment
2213 statement GS. */
2215 static inline tree *
2216 gimple_assign_rhs2_ptr (const_gimple gs)
2218 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2219 return gimple_op_ptr (gs, 2);
2223 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2225 static inline void
2226 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2228 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2230 gimple_set_op (gs, 2, rhs);
2233 /* Return the third operand on the RHS of assignment statement GS.
2234 If GS does not have two operands, NULL is returned instead. */
2236 static inline tree
2237 gimple_assign_rhs3 (const_gimple gs)
2239 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2241 if (gimple_num_ops (gs) >= 4)
2242 return gimple_op (gs, 3);
2243 else
2244 return NULL_TREE;
2247 /* Return a pointer to the third operand on the RHS of assignment
2248 statement GS. */
2250 static inline tree *
2251 gimple_assign_rhs3_ptr (const_gimple gs)
2253 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2254 return gimple_op_ptr (gs, 3);
2258 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2260 static inline void
2261 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2263 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2265 gimple_set_op (gs, 3, rhs);
2268 /* A wrapper around gimple_assign_set_rhs_with_ops_1, for callers which expect
2269 to see only a maximum of two operands. */
2271 static inline void
2272 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2273 tree op1, tree op2)
2275 gimple_assign_set_rhs_with_ops_1 (gsi, code, op1, op2, NULL);
2278 /* Returns true if GS is a nontemporal move. */
2280 static inline bool
2281 gimple_assign_nontemporal_move_p (const_gimple gs)
2283 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2284 return gs->nontemporal_move;
2287 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2289 static inline void
2290 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2292 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2293 gs->nontemporal_move = nontemporal;
2297 /* Return the code of the expression computed on the rhs of assignment
2298 statement GS. In case that the RHS is a single object, returns the
2299 tree code of the object. */
2301 static inline enum tree_code
2302 gimple_assign_rhs_code (const_gimple gs)
2304 enum tree_code code;
2305 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2307 code = (enum tree_code) gs->subcode;
2308 /* While we initially set subcode to the TREE_CODE of the rhs for
2309 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2310 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2311 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2312 code = TREE_CODE (gimple_assign_rhs1 (gs));
2314 return code;
2318 /* Set CODE to be the code for the expression computed on the RHS of
2319 assignment S. */
2321 static inline void
2322 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2324 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2325 s->subcode = code;
2329 /* Return the gimple rhs class of the code of the expression computed on
2330 the rhs of assignment statement GS.
2331 This will never return GIMPLE_INVALID_RHS. */
2333 static inline enum gimple_rhs_class
2334 gimple_assign_rhs_class (const_gimple gs)
2336 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2339 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2340 there is no operator associated with the assignment itself.
2341 Unlike gimple_assign_copy_p, this predicate returns true for
2342 any RHS operand, including those that perform an operation
2343 and do not have the semantics of a copy, such as COND_EXPR. */
2345 static inline bool
2346 gimple_assign_single_p (const_gimple gs)
2348 return (is_gimple_assign (gs)
2349 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2352 /* Return true if GS performs a store to its lhs. */
2354 static inline bool
2355 gimple_store_p (const_gimple gs)
2357 tree lhs = gimple_get_lhs (gs);
2358 return lhs && !is_gimple_reg (lhs);
2361 /* Return true if GS is an assignment that loads from its rhs1. */
2363 static inline bool
2364 gimple_assign_load_p (const_gimple gs)
2366 tree rhs;
2367 if (!gimple_assign_single_p (gs))
2368 return false;
2369 rhs = gimple_assign_rhs1 (gs);
2370 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2371 return true;
2372 rhs = get_base_address (rhs);
2373 return (DECL_P (rhs)
2374 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2378 /* Return true if S is a type-cast assignment. */
2380 static inline bool
2381 gimple_assign_cast_p (const_gimple s)
2383 if (is_gimple_assign (s))
2385 enum tree_code sc = gimple_assign_rhs_code (s);
2386 return CONVERT_EXPR_CODE_P (sc)
2387 || sc == VIEW_CONVERT_EXPR
2388 || sc == FIX_TRUNC_EXPR;
2391 return false;
2394 /* Return true if S is a clobber statement. */
2396 static inline bool
2397 gimple_clobber_p (const_gimple s)
2399 return gimple_assign_single_p (s)
2400 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2403 /* Return true if GS is a GIMPLE_CALL. */
2405 static inline bool
2406 is_gimple_call (const_gimple gs)
2408 return gimple_code (gs) == GIMPLE_CALL;
2411 /* Return the LHS of call statement GS. */
2413 static inline tree
2414 gimple_call_lhs (const_gimple gs)
2416 GIMPLE_CHECK (gs, GIMPLE_CALL);
2417 return gimple_op (gs, 0);
2421 /* Return a pointer to the LHS of call statement GS. */
2423 static inline tree *
2424 gimple_call_lhs_ptr (const_gimple gs)
2426 GIMPLE_CHECK (gs, GIMPLE_CALL);
2427 return gimple_op_ptr (gs, 0);
2431 /* Set LHS to be the LHS operand of call statement GS. */
2433 static inline void
2434 gimple_call_set_lhs (gimple gs, tree lhs)
2436 GIMPLE_CHECK (gs, GIMPLE_CALL);
2437 gimple_set_op (gs, 0, lhs);
2438 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2439 SSA_NAME_DEF_STMT (lhs) = gs;
2443 /* Return true if call GS calls an internal-only function, as enumerated
2444 by internal_fn. */
2446 static inline bool
2447 gimple_call_internal_p (const_gimple gs)
2449 GIMPLE_CHECK (gs, GIMPLE_CALL);
2450 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2454 /* Return the target of internal call GS. */
2456 static inline enum internal_fn
2457 gimple_call_internal_fn (const_gimple gs)
2459 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2460 return static_cast <const gimple_statement_call *> (gs)->u.internal_fn;
2463 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2464 that could alter control flow. */
2466 static inline void
2467 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2469 GIMPLE_CHECK (s, GIMPLE_CALL);
2470 if (ctrl_altering_p)
2471 s->subcode |= GF_CALL_CTRL_ALTERING;
2472 else
2473 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2476 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2477 flag is set. Such call could not be a stmt in the middle of a bb. */
2479 static inline bool
2480 gimple_call_ctrl_altering_p (const_gimple gs)
2482 GIMPLE_CHECK (gs, GIMPLE_CALL);
2483 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2487 /* Return the function type of the function called by GS. */
2489 static inline tree
2490 gimple_call_fntype (const_gimple gs)
2492 const gimple_statement_call *call_stmt =
2493 as_a <const gimple_statement_call *> (gs);
2494 if (gimple_call_internal_p (gs))
2495 return NULL_TREE;
2496 return call_stmt->u.fntype;
2499 /* Set the type of the function called by GS to FNTYPE. */
2501 static inline void
2502 gimple_call_set_fntype (gimple gs, tree fntype)
2504 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2505 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2506 call_stmt->u.fntype = fntype;
2510 /* Return the tree node representing the function called by call
2511 statement GS. */
2513 static inline tree
2514 gimple_call_fn (const_gimple gs)
2516 GIMPLE_CHECK (gs, GIMPLE_CALL);
2517 return gimple_op (gs, 1);
2520 /* Return a pointer to the tree node representing the function called by call
2521 statement GS. */
2523 static inline tree *
2524 gimple_call_fn_ptr (const_gimple gs)
2526 GIMPLE_CHECK (gs, GIMPLE_CALL);
2527 return gimple_op_ptr (gs, 1);
2531 /* Set FN to be the function called by call statement GS. */
2533 static inline void
2534 gimple_call_set_fn (gimple gs, tree fn)
2536 GIMPLE_CHECK (gs, GIMPLE_CALL);
2537 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2538 gimple_set_op (gs, 1, fn);
2542 /* Set FNDECL to be the function called by call statement GS. */
2544 static inline void
2545 gimple_call_set_fndecl (gimple gs, tree decl)
2547 GIMPLE_CHECK (gs, GIMPLE_CALL);
2548 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2549 gimple_set_op (gs, 1, build_fold_addr_expr_loc (gimple_location (gs), decl));
2553 /* Set internal function FN to be the function called by call statement GS. */
2555 static inline void
2556 gimple_call_set_internal_fn (gimple gs, enum internal_fn fn)
2558 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
2559 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2560 call_stmt->u.internal_fn = fn;
2564 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
2565 Otherwise return NULL. This function is analogous to
2566 get_callee_fndecl in tree land. */
2568 static inline tree
2569 gimple_call_fndecl (const_gimple gs)
2571 return gimple_call_addr_fndecl (gimple_call_fn (gs));
2575 /* Return the type returned by call statement GS. */
2577 static inline tree
2578 gimple_call_return_type (const_gimple gs)
2580 tree type = gimple_call_fntype (gs);
2582 if (type == NULL_TREE)
2583 return TREE_TYPE (gimple_call_lhs (gs));
2585 /* The type returned by a function is the type of its
2586 function type. */
2587 return TREE_TYPE (type);
2591 /* Return the static chain for call statement GS. */
2593 static inline tree
2594 gimple_call_chain (const_gimple gs)
2596 GIMPLE_CHECK (gs, GIMPLE_CALL);
2597 return gimple_op (gs, 2);
2601 /* Return a pointer to the static chain for call statement GS. */
2603 static inline tree *
2604 gimple_call_chain_ptr (const_gimple gs)
2606 GIMPLE_CHECK (gs, GIMPLE_CALL);
2607 return gimple_op_ptr (gs, 2);
2610 /* Set CHAIN to be the static chain for call statement GS. */
2612 static inline void
2613 gimple_call_set_chain (gimple gs, tree chain)
2615 GIMPLE_CHECK (gs, GIMPLE_CALL);
2617 gimple_set_op (gs, 2, chain);
2621 /* Return the number of arguments used by call statement GS. */
2623 static inline unsigned
2624 gimple_call_num_args (const_gimple gs)
2626 unsigned num_ops;
2627 GIMPLE_CHECK (gs, GIMPLE_CALL);
2628 num_ops = gimple_num_ops (gs);
2629 return num_ops - 3;
2633 /* Return the argument at position INDEX for call statement GS. */
2635 static inline tree
2636 gimple_call_arg (const_gimple gs, unsigned index)
2638 GIMPLE_CHECK (gs, GIMPLE_CALL);
2639 return gimple_op (gs, index + 3);
2643 /* Return a pointer to the argument at position INDEX for call
2644 statement GS. */
2646 static inline tree *
2647 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2649 GIMPLE_CHECK (gs, GIMPLE_CALL);
2650 return gimple_op_ptr (gs, index + 3);
2654 /* Set ARG to be the argument at position INDEX for call statement GS. */
2656 static inline void
2657 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2659 GIMPLE_CHECK (gs, GIMPLE_CALL);
2660 gimple_set_op (gs, index + 3, arg);
2664 /* If TAIL_P is true, mark call statement S as being a tail call
2665 (i.e., a call just before the exit of a function). These calls are
2666 candidate for tail call optimization. */
2668 static inline void
2669 gimple_call_set_tail (gimple s, bool tail_p)
2671 GIMPLE_CHECK (s, GIMPLE_CALL);
2672 if (tail_p)
2673 s->subcode |= GF_CALL_TAILCALL;
2674 else
2675 s->subcode &= ~GF_CALL_TAILCALL;
2679 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2681 static inline bool
2682 gimple_call_tail_p (gimple s)
2684 GIMPLE_CHECK (s, GIMPLE_CALL);
2685 return (s->subcode & GF_CALL_TAILCALL) != 0;
2689 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2690 slot optimization. This transformation uses the target of the call
2691 expansion as the return slot for calls that return in memory. */
2693 static inline void
2694 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2696 GIMPLE_CHECK (s, GIMPLE_CALL);
2697 if (return_slot_opt_p)
2698 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
2699 else
2700 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2704 /* Return true if S is marked for return slot optimization. */
2706 static inline bool
2707 gimple_call_return_slot_opt_p (gimple s)
2709 GIMPLE_CHECK (s, GIMPLE_CALL);
2710 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2714 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2715 thunk to the thunked-to function. */
2717 static inline void
2718 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2720 GIMPLE_CHECK (s, GIMPLE_CALL);
2721 if (from_thunk_p)
2722 s->subcode |= GF_CALL_FROM_THUNK;
2723 else
2724 s->subcode &= ~GF_CALL_FROM_THUNK;
2728 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2730 static inline bool
2731 gimple_call_from_thunk_p (gimple s)
2733 GIMPLE_CHECK (s, GIMPLE_CALL);
2734 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
2738 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2739 argument pack in its argument list. */
2741 static inline void
2742 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2744 GIMPLE_CHECK (s, GIMPLE_CALL);
2745 if (pass_arg_pack_p)
2746 s->subcode |= GF_CALL_VA_ARG_PACK;
2747 else
2748 s->subcode &= ~GF_CALL_VA_ARG_PACK;
2752 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2753 argument pack in its argument list. */
2755 static inline bool
2756 gimple_call_va_arg_pack_p (gimple s)
2758 GIMPLE_CHECK (s, GIMPLE_CALL);
2759 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
2763 /* Return true if S is a noreturn call. */
2765 static inline bool
2766 gimple_call_noreturn_p (gimple s)
2768 GIMPLE_CHECK (s, GIMPLE_CALL);
2769 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2773 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
2774 even if the called function can throw in other cases. */
2776 static inline void
2777 gimple_call_set_nothrow (gimple s, bool nothrow_p)
2779 GIMPLE_CHECK (s, GIMPLE_CALL);
2780 if (nothrow_p)
2781 s->subcode |= GF_CALL_NOTHROW;
2782 else
2783 s->subcode &= ~GF_CALL_NOTHROW;
2786 /* Return true if S is a nothrow call. */
2788 static inline bool
2789 gimple_call_nothrow_p (gimple s)
2791 GIMPLE_CHECK (s, GIMPLE_CALL);
2792 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2795 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
2796 is known to be emitted for VLA objects. Those are wrapped by
2797 stack_save/stack_restore calls and hence can't lead to unbounded
2798 stack growth even when they occur in loops. */
2800 static inline void
2801 gimple_call_set_alloca_for_var (gimple s, bool for_var)
2803 GIMPLE_CHECK (s, GIMPLE_CALL);
2804 if (for_var)
2805 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
2806 else
2807 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
2810 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
2812 static inline bool
2813 gimple_call_alloca_for_var_p (gimple s)
2815 GIMPLE_CHECK (s, GIMPLE_CALL);
2816 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
2819 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2821 static inline void
2822 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2824 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2825 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2826 dest_call->subcode = orig_call->subcode;
2830 /* Return a pointer to the points-to solution for the set of call-used
2831 variables of the call CALL. */
2833 static inline struct pt_solution *
2834 gimple_call_use_set (gimple call)
2836 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2837 return &call_stmt->call_used;
2841 /* Return a pointer to the points-to solution for the set of call-used
2842 variables of the call CALL. */
2844 static inline struct pt_solution *
2845 gimple_call_clobber_set (gimple call)
2847 gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (call);
2848 return &call_stmt->call_clobbered;
2852 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2853 non-NULL lhs. */
2855 static inline bool
2856 gimple_has_lhs (gimple stmt)
2858 return (is_gimple_assign (stmt)
2859 || (is_gimple_call (stmt)
2860 && gimple_call_lhs (stmt) != NULL_TREE));
2864 /* Return the code of the predicate computed by conditional statement GS. */
2866 static inline enum tree_code
2867 gimple_cond_code (const_gimple gs)
2869 GIMPLE_CHECK (gs, GIMPLE_COND);
2870 return (enum tree_code) gs->subcode;
2874 /* Set CODE to be the predicate code for the conditional statement GS. */
2876 static inline void
2877 gimple_cond_set_code (gimple gs, enum tree_code code)
2879 GIMPLE_CHECK (gs, GIMPLE_COND);
2880 gs->subcode = code;
2884 /* Return the LHS of the predicate computed by conditional statement GS. */
2886 static inline tree
2887 gimple_cond_lhs (const_gimple gs)
2889 GIMPLE_CHECK (gs, GIMPLE_COND);
2890 return gimple_op (gs, 0);
2893 /* Return the pointer to the LHS of the predicate computed by conditional
2894 statement GS. */
2896 static inline tree *
2897 gimple_cond_lhs_ptr (const_gimple gs)
2899 GIMPLE_CHECK (gs, GIMPLE_COND);
2900 return gimple_op_ptr (gs, 0);
2903 /* Set LHS to be the LHS operand of the predicate computed by
2904 conditional statement GS. */
2906 static inline void
2907 gimple_cond_set_lhs (gimple gs, tree lhs)
2909 GIMPLE_CHECK (gs, GIMPLE_COND);
2910 gimple_set_op (gs, 0, lhs);
2914 /* Return the RHS operand of the predicate computed by conditional GS. */
2916 static inline tree
2917 gimple_cond_rhs (const_gimple gs)
2919 GIMPLE_CHECK (gs, GIMPLE_COND);
2920 return gimple_op (gs, 1);
2923 /* Return the pointer to the RHS operand of the predicate computed by
2924 conditional GS. */
2926 static inline tree *
2927 gimple_cond_rhs_ptr (const_gimple gs)
2929 GIMPLE_CHECK (gs, GIMPLE_COND);
2930 return gimple_op_ptr (gs, 1);
2934 /* Set RHS to be the RHS operand of the predicate computed by
2935 conditional statement GS. */
2937 static inline void
2938 gimple_cond_set_rhs (gimple gs, tree rhs)
2940 GIMPLE_CHECK (gs, GIMPLE_COND);
2941 gimple_set_op (gs, 1, rhs);
2945 /* Return the label used by conditional statement GS when its
2946 predicate evaluates to true. */
2948 static inline tree
2949 gimple_cond_true_label (const_gimple gs)
2951 GIMPLE_CHECK (gs, GIMPLE_COND);
2952 return gimple_op (gs, 2);
2956 /* Set LABEL to be the label used by conditional statement GS when its
2957 predicate evaluates to true. */
2959 static inline void
2960 gimple_cond_set_true_label (gimple gs, tree label)
2962 GIMPLE_CHECK (gs, GIMPLE_COND);
2963 gimple_set_op (gs, 2, label);
2967 /* Set LABEL to be the label used by conditional statement GS when its
2968 predicate evaluates to false. */
2970 static inline void
2971 gimple_cond_set_false_label (gimple gs, tree label)
2973 GIMPLE_CHECK (gs, GIMPLE_COND);
2974 gimple_set_op (gs, 3, label);
2978 /* Return the label used by conditional statement GS when its
2979 predicate evaluates to false. */
2981 static inline tree
2982 gimple_cond_false_label (const_gimple gs)
2984 GIMPLE_CHECK (gs, GIMPLE_COND);
2985 return gimple_op (gs, 3);
2989 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2991 static inline void
2992 gimple_cond_make_false (gimple gs)
2994 gimple_cond_set_lhs (gs, boolean_true_node);
2995 gimple_cond_set_rhs (gs, boolean_false_node);
2996 gs->subcode = EQ_EXPR;
3000 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3002 static inline void
3003 gimple_cond_make_true (gimple gs)
3005 gimple_cond_set_lhs (gs, boolean_true_node);
3006 gimple_cond_set_rhs (gs, boolean_true_node);
3007 gs->subcode = EQ_EXPR;
3010 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3011 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3013 static inline bool
3014 gimple_cond_true_p (const_gimple gs)
3016 tree lhs = gimple_cond_lhs (gs);
3017 tree rhs = gimple_cond_rhs (gs);
3018 enum tree_code code = gimple_cond_code (gs);
3020 if (lhs != boolean_true_node && lhs != boolean_false_node)
3021 return false;
3023 if (rhs != boolean_true_node && rhs != boolean_false_node)
3024 return false;
3026 if (code == NE_EXPR && lhs != rhs)
3027 return true;
3029 if (code == EQ_EXPR && lhs == rhs)
3030 return true;
3032 return false;
3035 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3036 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3038 static inline bool
3039 gimple_cond_false_p (const_gimple gs)
3041 tree lhs = gimple_cond_lhs (gs);
3042 tree rhs = gimple_cond_rhs (gs);
3043 enum tree_code code = gimple_cond_code (gs);
3045 if (lhs != boolean_true_node && lhs != boolean_false_node)
3046 return false;
3048 if (rhs != boolean_true_node && rhs != boolean_false_node)
3049 return false;
3051 if (code == NE_EXPR && lhs == rhs)
3052 return true;
3054 if (code == EQ_EXPR && lhs != rhs)
3055 return true;
3057 return false;
3060 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3062 static inline void
3063 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
3065 gimple_cond_set_code (stmt, code);
3066 gimple_cond_set_lhs (stmt, lhs);
3067 gimple_cond_set_rhs (stmt, rhs);
3070 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3072 static inline tree
3073 gimple_label_label (const_gimple gs)
3075 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3076 return gimple_op (gs, 0);
3080 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3081 GS. */
3083 static inline void
3084 gimple_label_set_label (gimple gs, tree label)
3086 GIMPLE_CHECK (gs, GIMPLE_LABEL);
3087 gimple_set_op (gs, 0, label);
3091 /* Return the destination of the unconditional jump GS. */
3093 static inline tree
3094 gimple_goto_dest (const_gimple gs)
3096 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3097 return gimple_op (gs, 0);
3101 /* Set DEST to be the destination of the unconditonal jump GS. */
3103 static inline void
3104 gimple_goto_set_dest (gimple gs, tree dest)
3106 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3107 gimple_set_op (gs, 0, dest);
3111 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3113 static inline tree
3114 gimple_bind_vars (const_gimple gs)
3116 const gimple_statement_bind *bind_stmt =
3117 as_a <const gimple_statement_bind *> (gs);
3118 return bind_stmt->vars;
3122 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3123 statement GS. */
3125 static inline void
3126 gimple_bind_set_vars (gimple gs, tree vars)
3128 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3129 bind_stmt->vars = vars;
3133 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3134 statement GS. */
3136 static inline void
3137 gimple_bind_append_vars (gimple gs, tree vars)
3139 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3140 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3144 static inline gimple_seq *
3145 gimple_bind_body_ptr (gimple gs)
3147 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3148 return &bind_stmt->body;
3151 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3153 static inline gimple_seq
3154 gimple_bind_body (gimple gs)
3156 return *gimple_bind_body_ptr (gs);
3160 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3161 statement GS. */
3163 static inline void
3164 gimple_bind_set_body (gimple gs, gimple_seq seq)
3166 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3167 bind_stmt->body = seq;
3171 /* Append a statement to the end of a GIMPLE_BIND's body. */
3173 static inline void
3174 gimple_bind_add_stmt (gimple gs, gimple stmt)
3176 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3177 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3181 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3183 static inline void
3184 gimple_bind_add_seq (gimple gs, gimple_seq seq)
3186 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3187 gimple_seq_add_seq (&bind_stmt->body, seq);
3191 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3192 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3194 static inline tree
3195 gimple_bind_block (const_gimple gs)
3197 const gimple_statement_bind *bind_stmt =
3198 as_a <const gimple_statement_bind *> (gs);
3199 return bind_stmt->block;
3203 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3204 statement GS. */
3206 static inline void
3207 gimple_bind_set_block (gimple gs, tree block)
3209 gimple_statement_bind *bind_stmt = as_a <gimple_statement_bind *> (gs);
3210 gcc_gimple_checking_assert (block == NULL_TREE
3211 || TREE_CODE (block) == BLOCK);
3212 bind_stmt->block = block;
3216 /* Return the number of input operands for GIMPLE_ASM GS. */
3218 static inline unsigned
3219 gimple_asm_ninputs (const_gimple gs)
3221 const gimple_statement_asm *asm_stmt =
3222 as_a <const gimple_statement_asm *> (gs);
3223 return asm_stmt->ni;
3227 /* Return the number of output operands for GIMPLE_ASM GS. */
3229 static inline unsigned
3230 gimple_asm_noutputs (const_gimple gs)
3232 const gimple_statement_asm *asm_stmt =
3233 as_a <const gimple_statement_asm *> (gs);
3234 return asm_stmt->no;
3238 /* Return the number of clobber operands for GIMPLE_ASM GS. */
3240 static inline unsigned
3241 gimple_asm_nclobbers (const_gimple gs)
3243 const gimple_statement_asm *asm_stmt =
3244 as_a <const gimple_statement_asm *> (gs);
3245 return asm_stmt->nc;
3248 /* Return the number of label operands for GIMPLE_ASM GS. */
3250 static inline unsigned
3251 gimple_asm_nlabels (const_gimple gs)
3253 const gimple_statement_asm *asm_stmt =
3254 as_a <const gimple_statement_asm *> (gs);
3255 return asm_stmt->nl;
3258 /* Return input operand INDEX of GIMPLE_ASM GS. */
3260 static inline tree
3261 gimple_asm_input_op (const_gimple gs, unsigned index)
3263 const gimple_statement_asm *asm_stmt =
3264 as_a <const gimple_statement_asm *> (gs);
3265 gcc_gimple_checking_assert (index < asm_stmt->ni);
3266 return gimple_op (gs, index + asm_stmt->no);
3269 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
3271 static inline tree *
3272 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
3274 const gimple_statement_asm *asm_stmt =
3275 as_a <const gimple_statement_asm *> (gs);
3276 gcc_gimple_checking_assert (index < asm_stmt->ni);
3277 return gimple_op_ptr (gs, index + asm_stmt->no);
3281 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
3283 static inline void
3284 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
3286 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3287 gcc_gimple_checking_assert (index < asm_stmt->ni
3288 && TREE_CODE (in_op) == TREE_LIST);
3289 gimple_set_op (gs, index + asm_stmt->no, in_op);
3293 /* Return output operand INDEX of GIMPLE_ASM GS. */
3295 static inline tree
3296 gimple_asm_output_op (const_gimple gs, unsigned index)
3298 const gimple_statement_asm *asm_stmt =
3299 as_a <const gimple_statement_asm *> (gs);
3300 gcc_gimple_checking_assert (index < asm_stmt->no);
3301 return gimple_op (gs, index);
3304 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
3306 static inline tree *
3307 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
3309 const gimple_statement_asm *asm_stmt =
3310 as_a <const gimple_statement_asm *> (gs);
3311 gcc_gimple_checking_assert (index < asm_stmt->no);
3312 return gimple_op_ptr (gs, index);
3316 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
3318 static inline void
3319 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
3321 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3322 gcc_gimple_checking_assert (index < asm_stmt->no
3323 && TREE_CODE (out_op) == TREE_LIST);
3324 gimple_set_op (gs, index, out_op);
3328 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
3330 static inline tree
3331 gimple_asm_clobber_op (const_gimple gs, unsigned index)
3333 const gimple_statement_asm *asm_stmt =
3334 as_a <const gimple_statement_asm *> (gs);
3335 gcc_gimple_checking_assert (index < asm_stmt->nc);
3336 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->no);
3340 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
3342 static inline void
3343 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
3345 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3346 gcc_gimple_checking_assert (index < asm_stmt->nc
3347 && TREE_CODE (clobber_op) == TREE_LIST);
3348 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->no, clobber_op);
3351 /* Return label operand INDEX of GIMPLE_ASM GS. */
3353 static inline tree
3354 gimple_asm_label_op (const_gimple gs, unsigned index)
3356 const gimple_statement_asm *asm_stmt =
3357 as_a <const gimple_statement_asm *> (gs);
3358 gcc_gimple_checking_assert (index < asm_stmt->nl);
3359 return gimple_op (gs, index + asm_stmt->ni + asm_stmt->nc);
3362 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM GS. */
3364 static inline void
3365 gimple_asm_set_label_op (gimple gs, unsigned index, tree label_op)
3367 gimple_statement_asm *asm_stmt = as_a <gimple_statement_asm *> (gs);
3368 gcc_gimple_checking_assert (index < asm_stmt->nl
3369 && TREE_CODE (label_op) == TREE_LIST);
3370 gimple_set_op (gs, index + asm_stmt->ni + asm_stmt->nc, label_op);
3373 /* Return the string representing the assembly instruction in
3374 GIMPLE_ASM GS. */
3376 static inline const char *
3377 gimple_asm_string (const_gimple gs)
3379 const gimple_statement_asm *asm_stmt =
3380 as_a <const gimple_statement_asm *> (gs);
3381 return asm_stmt->string;
3385 /* Return true if GS is an asm statement marked volatile. */
3387 static inline bool
3388 gimple_asm_volatile_p (const_gimple gs)
3390 GIMPLE_CHECK (gs, GIMPLE_ASM);
3391 return (gs->subcode & GF_ASM_VOLATILE) != 0;
3395 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
3397 static inline void
3398 gimple_asm_set_volatile (gimple gs, bool volatile_p)
3400 GIMPLE_CHECK (gs, GIMPLE_ASM);
3401 if (volatile_p)
3402 gs->subcode |= GF_ASM_VOLATILE;
3403 else
3404 gs->subcode &= ~GF_ASM_VOLATILE;
3408 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
3410 static inline void
3411 gimple_asm_set_input (gimple gs, bool input_p)
3413 GIMPLE_CHECK (gs, GIMPLE_ASM);
3414 if (input_p)
3415 gs->subcode |= GF_ASM_INPUT;
3416 else
3417 gs->subcode &= ~GF_ASM_INPUT;
3421 /* Return true if asm GS is an ASM_INPUT. */
3423 static inline bool
3424 gimple_asm_input_p (const_gimple gs)
3426 GIMPLE_CHECK (gs, GIMPLE_ASM);
3427 return (gs->subcode & GF_ASM_INPUT) != 0;
3431 /* Return the types handled by GIMPLE_CATCH statement GS. */
3433 static inline tree
3434 gimple_catch_types (const_gimple gs)
3436 const gimple_statement_catch *catch_stmt =
3437 as_a <const gimple_statement_catch *> (gs);
3438 return catch_stmt->types;
3442 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
3444 static inline tree *
3445 gimple_catch_types_ptr (gimple gs)
3447 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3448 return &catch_stmt->types;
3452 /* Return a pointer to the GIMPLE sequence representing the body of
3453 the handler of GIMPLE_CATCH statement GS. */
3455 static inline gimple_seq *
3456 gimple_catch_handler_ptr (gimple gs)
3458 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3459 return &catch_stmt->handler;
3463 /* Return the GIMPLE sequence representing the body of the handler of
3464 GIMPLE_CATCH statement GS. */
3466 static inline gimple_seq
3467 gimple_catch_handler (gimple gs)
3469 return *gimple_catch_handler_ptr (gs);
3473 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
3475 static inline void
3476 gimple_catch_set_types (gimple gs, tree t)
3478 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3479 catch_stmt->types = t;
3483 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
3485 static inline void
3486 gimple_catch_set_handler (gimple gs, gimple_seq handler)
3488 gimple_statement_catch *catch_stmt = as_a <gimple_statement_catch *> (gs);
3489 catch_stmt->handler = handler;
3493 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3495 static inline tree
3496 gimple_eh_filter_types (const_gimple gs)
3498 const gimple_statement_eh_filter *eh_filter_stmt =
3499 as_a <const gimple_statement_eh_filter *> (gs);
3500 return eh_filter_stmt->types;
3504 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3505 GS. */
3507 static inline tree *
3508 gimple_eh_filter_types_ptr (gimple gs)
3510 gimple_statement_eh_filter *eh_filter_stmt =
3511 as_a <gimple_statement_eh_filter *> (gs);
3512 return &eh_filter_stmt->types;
3516 /* Return a pointer to the sequence of statement to execute when
3517 GIMPLE_EH_FILTER statement fails. */
3519 static inline gimple_seq *
3520 gimple_eh_filter_failure_ptr (gimple gs)
3522 gimple_statement_eh_filter *eh_filter_stmt =
3523 as_a <gimple_statement_eh_filter *> (gs);
3524 return &eh_filter_stmt->failure;
3528 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3529 statement fails. */
3531 static inline gimple_seq
3532 gimple_eh_filter_failure (gimple gs)
3534 return *gimple_eh_filter_failure_ptr (gs);
3538 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
3540 static inline void
3541 gimple_eh_filter_set_types (gimple gs, tree types)
3543 gimple_statement_eh_filter *eh_filter_stmt =
3544 as_a <gimple_statement_eh_filter *> (gs);
3545 eh_filter_stmt->types = types;
3549 /* Set FAILURE to be the sequence of statements to execute on failure
3550 for GIMPLE_EH_FILTER GS. */
3552 static inline void
3553 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
3555 gimple_statement_eh_filter *eh_filter_stmt =
3556 as_a <gimple_statement_eh_filter *> (gs);
3557 eh_filter_stmt->failure = failure;
3560 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3562 static inline tree
3563 gimple_eh_must_not_throw_fndecl (gimple gs)
3565 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3566 return eh_mnt_stmt->fndecl;
3569 /* Set the function decl to be called by GS to DECL. */
3571 static inline void
3572 gimple_eh_must_not_throw_set_fndecl (gimple gs, tree decl)
3574 gimple_statement_eh_mnt *eh_mnt_stmt = as_a <gimple_statement_eh_mnt *> (gs);
3575 eh_mnt_stmt->fndecl = decl;
3578 /* GIMPLE_EH_ELSE accessors. */
3580 static inline gimple_seq *
3581 gimple_eh_else_n_body_ptr (gimple gs)
3583 gimple_statement_eh_else *eh_else_stmt =
3584 as_a <gimple_statement_eh_else *> (gs);
3585 return &eh_else_stmt->n_body;
3588 static inline gimple_seq
3589 gimple_eh_else_n_body (gimple gs)
3591 return *gimple_eh_else_n_body_ptr (gs);
3594 static inline gimple_seq *
3595 gimple_eh_else_e_body_ptr (gimple gs)
3597 gimple_statement_eh_else *eh_else_stmt =
3598 as_a <gimple_statement_eh_else *> (gs);
3599 return &eh_else_stmt->e_body;
3602 static inline gimple_seq
3603 gimple_eh_else_e_body (gimple gs)
3605 return *gimple_eh_else_e_body_ptr (gs);
3608 static inline void
3609 gimple_eh_else_set_n_body (gimple gs, gimple_seq seq)
3611 gimple_statement_eh_else *eh_else_stmt =
3612 as_a <gimple_statement_eh_else *> (gs);
3613 eh_else_stmt->n_body = seq;
3616 static inline void
3617 gimple_eh_else_set_e_body (gimple gs, gimple_seq seq)
3619 gimple_statement_eh_else *eh_else_stmt =
3620 as_a <gimple_statement_eh_else *> (gs);
3621 eh_else_stmt->e_body = seq;
3624 /* GIMPLE_TRY accessors. */
3626 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
3627 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
3629 static inline enum gimple_try_flags
3630 gimple_try_kind (const_gimple gs)
3632 GIMPLE_CHECK (gs, GIMPLE_TRY);
3633 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
3637 /* Set the kind of try block represented by GIMPLE_TRY GS. */
3639 static inline void
3640 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
3642 GIMPLE_CHECK (gs, GIMPLE_TRY);
3643 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
3644 || kind == GIMPLE_TRY_FINALLY);
3645 if (gimple_try_kind (gs) != kind)
3646 gs->subcode = (unsigned int) kind;
3650 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3652 static inline bool
3653 gimple_try_catch_is_cleanup (const_gimple gs)
3655 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
3656 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
3660 /* Return a pointer to the sequence of statements used as the
3661 body for GIMPLE_TRY GS. */
3663 static inline gimple_seq *
3664 gimple_try_eval_ptr (gimple gs)
3666 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3667 return &try_stmt->eval;
3671 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
3673 static inline gimple_seq
3674 gimple_try_eval (gimple gs)
3676 return *gimple_try_eval_ptr (gs);
3680 /* Return a pointer to the sequence of statements used as the cleanup body for
3681 GIMPLE_TRY GS. */
3683 static inline gimple_seq *
3684 gimple_try_cleanup_ptr (gimple gs)
3686 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3687 return &try_stmt->cleanup;
3691 /* Return the sequence of statements used as the cleanup body for
3692 GIMPLE_TRY GS. */
3694 static inline gimple_seq
3695 gimple_try_cleanup (gimple gs)
3697 return *gimple_try_cleanup_ptr (gs);
3701 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
3703 static inline void
3704 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
3706 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
3707 if (catch_is_cleanup)
3708 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
3709 else
3710 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
3714 /* Set EVAL to be the sequence of statements to use as the body for
3715 GIMPLE_TRY GS. */
3717 static inline void
3718 gimple_try_set_eval (gimple gs, gimple_seq eval)
3720 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3721 try_stmt->eval = eval;
3725 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3726 body for GIMPLE_TRY GS. */
3728 static inline void
3729 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3731 gimple_statement_try *try_stmt = as_a <gimple_statement_try *> (gs);
3732 try_stmt->cleanup = cleanup;
3736 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
3738 static inline gimple_seq *
3739 gimple_wce_cleanup_ptr (gimple gs)
3741 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3742 return &wce_stmt->cleanup;
3746 /* Return the cleanup sequence for cleanup statement GS. */
3748 static inline gimple_seq
3749 gimple_wce_cleanup (gimple gs)
3751 return *gimple_wce_cleanup_ptr (gs);
3755 /* Set CLEANUP to be the cleanup sequence for GS. */
3757 static inline void
3758 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3760 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
3761 wce_stmt->cleanup = cleanup;
3765 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3767 static inline bool
3768 gimple_wce_cleanup_eh_only (const_gimple gs)
3770 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3771 return gs->subcode != 0;
3775 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3777 static inline void
3778 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3780 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3781 gs->subcode = (unsigned int) eh_only_p;
3785 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3787 static inline unsigned
3788 gimple_phi_capacity (const_gimple gs)
3790 const gimple_statement_phi *phi_stmt =
3791 as_a <const gimple_statement_phi *> (gs);
3792 return phi_stmt->capacity;
3796 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3797 be exactly the number of incoming edges for the basic block holding
3798 GS. */
3800 static inline unsigned
3801 gimple_phi_num_args (const_gimple gs)
3803 const gimple_statement_phi *phi_stmt =
3804 as_a <const gimple_statement_phi *> (gs);
3805 return phi_stmt->nargs;
3809 /* Return the SSA name created by GIMPLE_PHI GS. */
3811 static inline tree
3812 gimple_phi_result (const_gimple gs)
3814 const gimple_statement_phi *phi_stmt =
3815 as_a <const gimple_statement_phi *> (gs);
3816 return phi_stmt->result;
3819 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3821 static inline tree *
3822 gimple_phi_result_ptr (gimple gs)
3824 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3825 return &phi_stmt->result;
3828 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3830 static inline void
3831 gimple_phi_set_result (gimple gs, tree result)
3833 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3834 phi_stmt->result = result;
3835 if (result && TREE_CODE (result) == SSA_NAME)
3836 SSA_NAME_DEF_STMT (result) = gs;
3840 /* Return the PHI argument corresponding to incoming edge INDEX for
3841 GIMPLE_PHI GS. */
3843 static inline struct phi_arg_d *
3844 gimple_phi_arg (gimple gs, unsigned index)
3846 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3847 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
3848 return &(phi_stmt->args[index]);
3851 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3852 for GIMPLE_PHI GS. */
3854 static inline void
3855 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3857 gimple_statement_phi *phi_stmt = as_a <gimple_statement_phi *> (gs);
3858 gcc_gimple_checking_assert (index <= phi_stmt->nargs);
3859 phi_stmt->args[index] = *phiarg;
3862 /* Return the PHI nodes for basic block BB, or NULL if there are no
3863 PHI nodes. */
3865 static inline gimple_seq
3866 phi_nodes (const_basic_block bb)
3868 gcc_checking_assert (!(bb->flags & BB_RTL));
3869 return bb->il.gimple.phi_nodes;
3872 /* Return a pointer to the PHI nodes for basic block BB. */
3874 static inline gimple_seq *
3875 phi_nodes_ptr (basic_block bb)
3877 gcc_checking_assert (!(bb->flags & BB_RTL));
3878 return &bb->il.gimple.phi_nodes;
3881 /* Return the tree operand for argument I of PHI node GS. */
3883 static inline tree
3884 gimple_phi_arg_def (gimple gs, size_t index)
3886 return gimple_phi_arg (gs, index)->def;
3890 /* Return a pointer to the tree operand for argument I of PHI node GS. */
3892 static inline tree *
3893 gimple_phi_arg_def_ptr (gimple gs, size_t index)
3895 return &gimple_phi_arg (gs, index)->def;
3898 /* Return the edge associated with argument I of phi node GS. */
3900 static inline edge
3901 gimple_phi_arg_edge (gimple gs, size_t i)
3903 return EDGE_PRED (gimple_bb (gs), i);
3906 /* Return the source location of gimple argument I of phi node GS. */
3908 static inline source_location
3909 gimple_phi_arg_location (gimple gs, size_t i)
3911 return gimple_phi_arg (gs, i)->locus;
3914 /* Return the source location of the argument on edge E of phi node GS. */
3916 static inline source_location
3917 gimple_phi_arg_location_from_edge (gimple gs, edge e)
3919 return gimple_phi_arg (gs, e->dest_idx)->locus;
3922 /* Set the source location of gimple argument I of phi node GS to LOC. */
3924 static inline void
3925 gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
3927 gimple_phi_arg (gs, i)->locus = loc;
3930 /* Return TRUE if argument I of phi node GS has a location record. */
3932 static inline bool
3933 gimple_phi_arg_has_location (gimple gs, size_t i)
3935 return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
3939 /* Return the region number for GIMPLE_RESX GS. */
3941 static inline int
3942 gimple_resx_region (const_gimple gs)
3944 const gimple_statement_resx *resx_stmt =
3945 as_a <const gimple_statement_resx *> (gs);
3946 return resx_stmt->region;
3949 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3951 static inline void
3952 gimple_resx_set_region (gimple gs, int region)
3954 gimple_statement_resx *resx_stmt = as_a <gimple_statement_resx *> (gs);
3955 resx_stmt->region = region;
3958 /* Return the region number for GIMPLE_EH_DISPATCH GS. */
3960 static inline int
3961 gimple_eh_dispatch_region (const_gimple gs)
3963 const gimple_statement_eh_dispatch *eh_dispatch_stmt =
3964 as_a <const gimple_statement_eh_dispatch *> (gs);
3965 return eh_dispatch_stmt->region;
3968 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
3970 static inline void
3971 gimple_eh_dispatch_set_region (gimple gs, int region)
3973 gimple_statement_eh_dispatch *eh_dispatch_stmt =
3974 as_a <gimple_statement_eh_dispatch *> (gs);
3975 eh_dispatch_stmt->region = region;
3978 /* Return the number of labels associated with the switch statement GS. */
3980 static inline unsigned
3981 gimple_switch_num_labels (const_gimple gs)
3983 unsigned num_ops;
3984 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3985 num_ops = gimple_num_ops (gs);
3986 gcc_gimple_checking_assert (num_ops > 1);
3987 return num_ops - 1;
3991 /* Set NLABELS to be the number of labels for the switch statement GS. */
3993 static inline void
3994 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3996 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3997 gimple_set_num_ops (g, nlabels + 1);
4001 /* Return the index variable used by the switch statement GS. */
4003 static inline tree
4004 gimple_switch_index (const_gimple gs)
4006 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4007 return gimple_op (gs, 0);
4011 /* Return a pointer to the index variable for the switch statement GS. */
4013 static inline tree *
4014 gimple_switch_index_ptr (const_gimple gs)
4016 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4017 return gimple_op_ptr (gs, 0);
4021 /* Set INDEX to be the index variable for switch statement GS. */
4023 static inline void
4024 gimple_switch_set_index (gimple gs, tree index)
4026 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4027 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4028 gimple_set_op (gs, 0, index);
4032 /* Return the label numbered INDEX. The default label is 0, followed by any
4033 labels in a switch statement. */
4035 static inline tree
4036 gimple_switch_label (const_gimple gs, unsigned index)
4038 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4039 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4040 return gimple_op (gs, index + 1);
4043 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4045 static inline void
4046 gimple_switch_set_label (gimple gs, unsigned index, tree label)
4048 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4049 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4050 && (label == NULL_TREE
4051 || TREE_CODE (label) == CASE_LABEL_EXPR));
4052 gimple_set_op (gs, index + 1, label);
4055 /* Return the default label for a switch statement. */
4057 static inline tree
4058 gimple_switch_default_label (const_gimple gs)
4060 tree label = gimple_switch_label (gs, 0);
4061 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4062 return label;
4065 /* Set the default label for a switch statement. */
4067 static inline void
4068 gimple_switch_set_default_label (gimple gs, tree label)
4070 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4071 gimple_switch_set_label (gs, 0, label);
4074 /* Return true if GS is a GIMPLE_DEBUG statement. */
4076 static inline bool
4077 is_gimple_debug (const_gimple gs)
4079 return gimple_code (gs) == GIMPLE_DEBUG;
4082 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4084 static inline bool
4085 gimple_debug_bind_p (const_gimple s)
4087 if (is_gimple_debug (s))
4088 return s->subcode == GIMPLE_DEBUG_BIND;
4090 return false;
4093 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4095 static inline tree
4096 gimple_debug_bind_get_var (gimple dbg)
4098 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4099 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4100 return gimple_op (dbg, 0);
4103 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4104 statement. */
4106 static inline tree
4107 gimple_debug_bind_get_value (gimple dbg)
4109 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4110 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4111 return gimple_op (dbg, 1);
4114 /* Return a pointer to the value bound to the variable in a
4115 GIMPLE_DEBUG bind statement. */
4117 static inline tree *
4118 gimple_debug_bind_get_value_ptr (gimple dbg)
4120 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4121 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4122 return gimple_op_ptr (dbg, 1);
4125 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4127 static inline void
4128 gimple_debug_bind_set_var (gimple dbg, tree var)
4130 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4131 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4132 gimple_set_op (dbg, 0, var);
4135 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4136 statement. */
4138 static inline void
4139 gimple_debug_bind_set_value (gimple dbg, tree value)
4141 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4142 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4143 gimple_set_op (dbg, 1, value);
4146 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4147 optimized away. */
4148 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4150 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4151 statement. */
4153 static inline void
4154 gimple_debug_bind_reset_value (gimple dbg)
4156 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4157 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4158 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4161 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4162 value. */
4164 static inline bool
4165 gimple_debug_bind_has_value_p (gimple dbg)
4167 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4168 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4169 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4172 #undef GIMPLE_DEBUG_BIND_NOVALUE
4174 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4176 static inline bool
4177 gimple_debug_source_bind_p (const_gimple s)
4179 if (is_gimple_debug (s))
4180 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4182 return false;
4185 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4187 static inline tree
4188 gimple_debug_source_bind_get_var (gimple dbg)
4190 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4191 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4192 return gimple_op (dbg, 0);
4195 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4196 statement. */
4198 static inline tree
4199 gimple_debug_source_bind_get_value (gimple dbg)
4201 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4202 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4203 return gimple_op (dbg, 1);
4206 /* Return a pointer to the value bound to the variable in a
4207 GIMPLE_DEBUG source bind statement. */
4209 static inline tree *
4210 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4212 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4213 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4214 return gimple_op_ptr (dbg, 1);
4217 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4219 static inline void
4220 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4222 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4223 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4224 gimple_set_op (dbg, 0, var);
4227 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4228 statement. */
4230 static inline void
4231 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4233 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4234 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4235 gimple_set_op (dbg, 1, value);
4238 /* Return the line number for EXPR, or return -1 if we have no line
4239 number information for it. */
4240 static inline int
4241 get_lineno (const_gimple stmt)
4243 location_t loc;
4245 if (!stmt)
4246 return -1;
4248 loc = gimple_location (stmt);
4249 if (loc == UNKNOWN_LOCATION)
4250 return -1;
4252 return LOCATION_LINE (loc);
4255 /* Return a pointer to the body for the OMP statement GS. */
4257 static inline gimple_seq *
4258 gimple_omp_body_ptr (gimple gs)
4260 return &static_cast <gimple_statement_omp *> (gs)->body;
4263 /* Return the body for the OMP statement GS. */
4265 static inline gimple_seq
4266 gimple_omp_body (gimple gs)
4268 return *gimple_omp_body_ptr (gs);
4271 /* Set BODY to be the body for the OMP statement GS. */
4273 static inline void
4274 gimple_omp_set_body (gimple gs, gimple_seq body)
4276 static_cast <gimple_statement_omp *> (gs)->body = body;
4280 /* Return the name associated with OMP_CRITICAL statement GS. */
4282 static inline tree
4283 gimple_omp_critical_name (const_gimple gs)
4285 const gimple_statement_omp_critical *omp_critical_stmt =
4286 as_a <const gimple_statement_omp_critical *> (gs);
4287 return omp_critical_stmt->name;
4291 /* Return a pointer to the name associated with OMP critical statement GS. */
4293 static inline tree *
4294 gimple_omp_critical_name_ptr (gimple gs)
4296 gimple_statement_omp_critical *omp_critical_stmt =
4297 as_a <gimple_statement_omp_critical *> (gs);
4298 return &omp_critical_stmt->name;
4302 /* Set NAME to be the name associated with OMP critical statement GS. */
4304 static inline void
4305 gimple_omp_critical_set_name (gimple gs, tree name)
4307 gimple_statement_omp_critical *omp_critical_stmt =
4308 as_a <gimple_statement_omp_critical *> (gs);
4309 omp_critical_stmt->name = name;
4313 /* Return the kind of OMP for statemement. */
4315 static inline int
4316 gimple_omp_for_kind (const_gimple g)
4318 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4319 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4323 /* Set the OMP for kind. */
4325 static inline void
4326 gimple_omp_for_set_kind (gimple g, int kind)
4328 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4329 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4330 | (kind & GF_OMP_FOR_KIND_MASK);
4334 /* Return true if OMP for statement G has the
4335 GF_OMP_FOR_COMBINED flag set. */
4337 static inline bool
4338 gimple_omp_for_combined_p (const_gimple g)
4340 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4341 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4345 /* Set the GF_OMP_FOR_COMBINED field in G depending on the boolean
4346 value of COMBINED_P. */
4348 static inline void
4349 gimple_omp_for_set_combined_p (gimple g, bool combined_p)
4351 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4352 if (combined_p)
4353 g->subcode |= GF_OMP_FOR_COMBINED;
4354 else
4355 g->subcode &= ~GF_OMP_FOR_COMBINED;
4359 /* Return true if OMP for statement G has the
4360 GF_OMP_FOR_COMBINED_INTO flag set. */
4362 static inline bool
4363 gimple_omp_for_combined_into_p (const_gimple g)
4365 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4366 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4370 /* Set the GF_OMP_FOR_COMBINED_INTO field in G depending on the boolean
4371 value of COMBINED_P. */
4373 static inline void
4374 gimple_omp_for_set_combined_into_p (gimple g, bool combined_p)
4376 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4377 if (combined_p)
4378 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4379 else
4380 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4384 /* Return the clauses associated with OMP_FOR GS. */
4386 static inline tree
4387 gimple_omp_for_clauses (const_gimple gs)
4389 const gimple_statement_omp_for *omp_for_stmt =
4390 as_a <const gimple_statement_omp_for *> (gs);
4391 return omp_for_stmt->clauses;
4395 /* Return a pointer to the OMP_FOR GS. */
4397 static inline tree *
4398 gimple_omp_for_clauses_ptr (gimple gs)
4400 gimple_statement_omp_for *omp_for_stmt =
4401 as_a <gimple_statement_omp_for *> (gs);
4402 return &omp_for_stmt->clauses;
4406 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
4408 static inline void
4409 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4411 gimple_statement_omp_for *omp_for_stmt =
4412 as_a <gimple_statement_omp_for *> (gs);
4413 omp_for_stmt->clauses = clauses;
4417 /* Get the collapse count of OMP_FOR GS. */
4419 static inline size_t
4420 gimple_omp_for_collapse (gimple gs)
4422 gimple_statement_omp_for *omp_for_stmt =
4423 as_a <gimple_statement_omp_for *> (gs);
4424 return omp_for_stmt->collapse;
4428 /* Return the index variable for OMP_FOR GS. */
4430 static inline tree
4431 gimple_omp_for_index (const_gimple gs, size_t i)
4433 const gimple_statement_omp_for *omp_for_stmt =
4434 as_a <const gimple_statement_omp_for *> (gs);
4435 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4436 return omp_for_stmt->iter[i].index;
4440 /* Return a pointer to the index variable for OMP_FOR GS. */
4442 static inline tree *
4443 gimple_omp_for_index_ptr (gimple gs, size_t i)
4445 gimple_statement_omp_for *omp_for_stmt =
4446 as_a <gimple_statement_omp_for *> (gs);
4447 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4448 return &omp_for_stmt->iter[i].index;
4452 /* Set INDEX to be the index variable for OMP_FOR GS. */
4454 static inline void
4455 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4457 gimple_statement_omp_for *omp_for_stmt =
4458 as_a <gimple_statement_omp_for *> (gs);
4459 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4460 omp_for_stmt->iter[i].index = index;
4464 /* Return the initial value for OMP_FOR GS. */
4466 static inline tree
4467 gimple_omp_for_initial (const_gimple gs, size_t i)
4469 const gimple_statement_omp_for *omp_for_stmt =
4470 as_a <const gimple_statement_omp_for *> (gs);
4471 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4472 return omp_for_stmt->iter[i].initial;
4476 /* Return a pointer to the initial value for OMP_FOR GS. */
4478 static inline tree *
4479 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4481 gimple_statement_omp_for *omp_for_stmt =
4482 as_a <gimple_statement_omp_for *> (gs);
4483 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4484 return &omp_for_stmt->iter[i].initial;
4488 /* Set INITIAL to be the initial value for OMP_FOR GS. */
4490 static inline void
4491 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4493 gimple_statement_omp_for *omp_for_stmt =
4494 as_a <gimple_statement_omp_for *> (gs);
4495 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4496 omp_for_stmt->iter[i].initial = initial;
4500 /* Return the final value for OMP_FOR GS. */
4502 static inline tree
4503 gimple_omp_for_final (const_gimple gs, size_t i)
4505 const gimple_statement_omp_for *omp_for_stmt =
4506 as_a <const gimple_statement_omp_for *> (gs);
4507 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4508 return omp_for_stmt->iter[i].final;
4512 /* Return a pointer to the final value for OMP_FOR GS. */
4514 static inline tree *
4515 gimple_omp_for_final_ptr (gimple gs, size_t i)
4517 gimple_statement_omp_for *omp_for_stmt =
4518 as_a <gimple_statement_omp_for *> (gs);
4519 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4520 return &omp_for_stmt->iter[i].final;
4524 /* Set FINAL to be the final value for OMP_FOR GS. */
4526 static inline void
4527 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4529 gimple_statement_omp_for *omp_for_stmt =
4530 as_a <gimple_statement_omp_for *> (gs);
4531 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4532 omp_for_stmt->iter[i].final = final;
4536 /* Return the increment value for OMP_FOR GS. */
4538 static inline tree
4539 gimple_omp_for_incr (const_gimple gs, size_t i)
4541 const gimple_statement_omp_for *omp_for_stmt =
4542 as_a <const gimple_statement_omp_for *> (gs);
4543 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4544 return omp_for_stmt->iter[i].incr;
4548 /* Return a pointer to the increment value for OMP_FOR GS. */
4550 static inline tree *
4551 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4553 gimple_statement_omp_for *omp_for_stmt =
4554 as_a <gimple_statement_omp_for *> (gs);
4555 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4556 return &omp_for_stmt->iter[i].incr;
4560 /* Set INCR to be the increment value for OMP_FOR GS. */
4562 static inline void
4563 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4565 gimple_statement_omp_for *omp_for_stmt =
4566 as_a <gimple_statement_omp_for *> (gs);
4567 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4568 omp_for_stmt->iter[i].incr = incr;
4572 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4573 statement GS starts. */
4575 static inline gimple_seq *
4576 gimple_omp_for_pre_body_ptr (gimple gs)
4578 gimple_statement_omp_for *omp_for_stmt =
4579 as_a <gimple_statement_omp_for *> (gs);
4580 return &omp_for_stmt->pre_body;
4584 /* Return the sequence of statements to execute before the OMP_FOR
4585 statement GS starts. */
4587 static inline gimple_seq
4588 gimple_omp_for_pre_body (gimple gs)
4590 return *gimple_omp_for_pre_body_ptr (gs);
4594 /* Set PRE_BODY to be the sequence of statements to execute before the
4595 OMP_FOR statement GS starts. */
4597 static inline void
4598 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
4600 gimple_statement_omp_for *omp_for_stmt =
4601 as_a <gimple_statement_omp_for *> (gs);
4602 omp_for_stmt->pre_body = pre_body;
4606 /* Return the clauses associated with OMP_PARALLEL GS. */
4608 static inline tree
4609 gimple_omp_parallel_clauses (const_gimple gs)
4611 const gimple_statement_omp_parallel *omp_parallel_stmt =
4612 as_a <const gimple_statement_omp_parallel *> (gs);
4613 return omp_parallel_stmt->clauses;
4617 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
4619 static inline tree *
4620 gimple_omp_parallel_clauses_ptr (gimple gs)
4622 gimple_statement_omp_parallel *omp_parallel_stmt =
4623 as_a <gimple_statement_omp_parallel *> (gs);
4624 return &omp_parallel_stmt->clauses;
4628 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
4629 GS. */
4631 static inline void
4632 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
4634 gimple_statement_omp_parallel *omp_parallel_stmt =
4635 as_a <gimple_statement_omp_parallel *> (gs);
4636 omp_parallel_stmt->clauses = clauses;
4640 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
4642 static inline tree
4643 gimple_omp_parallel_child_fn (const_gimple gs)
4645 const gimple_statement_omp_parallel *omp_parallel_stmt =
4646 as_a <const gimple_statement_omp_parallel *> (gs);
4647 return omp_parallel_stmt->child_fn;
4650 /* Return a pointer to the child function used to hold the body of
4651 OMP_PARALLEL GS. */
4653 static inline tree *
4654 gimple_omp_parallel_child_fn_ptr (gimple gs)
4656 gimple_statement_omp_parallel *omp_parallel_stmt =
4657 as_a <gimple_statement_omp_parallel *> (gs);
4658 return &omp_parallel_stmt->child_fn;
4662 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
4664 static inline void
4665 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
4667 gimple_statement_omp_parallel *omp_parallel_stmt =
4668 as_a <gimple_statement_omp_parallel *> (gs);
4669 omp_parallel_stmt->child_fn = child_fn;
4673 /* Return the artificial argument used to send variables and values
4674 from the parent to the children threads in OMP_PARALLEL GS. */
4676 static inline tree
4677 gimple_omp_parallel_data_arg (const_gimple gs)
4679 const gimple_statement_omp_parallel *omp_parallel_stmt =
4680 as_a <const gimple_statement_omp_parallel *> (gs);
4681 return omp_parallel_stmt->data_arg;
4685 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
4687 static inline tree *
4688 gimple_omp_parallel_data_arg_ptr (gimple gs)
4690 gimple_statement_omp_parallel *omp_parallel_stmt =
4691 as_a <gimple_statement_omp_parallel *> (gs);
4692 return &omp_parallel_stmt->data_arg;
4696 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
4698 static inline void
4699 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
4701 gimple_statement_omp_parallel *omp_parallel_stmt =
4702 as_a <gimple_statement_omp_parallel *> (gs);
4703 omp_parallel_stmt->data_arg = data_arg;
4707 /* Return the clauses associated with OMP_TASK GS. */
4709 static inline tree
4710 gimple_omp_task_clauses (const_gimple gs)
4712 const gimple_statement_omp_task *omp_task_stmt =
4713 as_a <const gimple_statement_omp_task *> (gs);
4714 return omp_task_stmt->clauses;
4718 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4720 static inline tree *
4721 gimple_omp_task_clauses_ptr (gimple gs)
4723 gimple_statement_omp_task *omp_task_stmt =
4724 as_a <gimple_statement_omp_task *> (gs);
4725 return &omp_task_stmt->clauses;
4729 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4730 GS. */
4732 static inline void
4733 gimple_omp_task_set_clauses (gimple gs, tree clauses)
4735 gimple_statement_omp_task *omp_task_stmt =
4736 as_a <gimple_statement_omp_task *> (gs);
4737 omp_task_stmt->clauses = clauses;
4741 /* Return the child function used to hold the body of OMP_TASK GS. */
4743 static inline tree
4744 gimple_omp_task_child_fn (const_gimple gs)
4746 const gimple_statement_omp_task *omp_task_stmt =
4747 as_a <const gimple_statement_omp_task *> (gs);
4748 return omp_task_stmt->child_fn;
4751 /* Return a pointer to the child function used to hold the body of
4752 OMP_TASK GS. */
4754 static inline tree *
4755 gimple_omp_task_child_fn_ptr (gimple gs)
4757 gimple_statement_omp_task *omp_task_stmt =
4758 as_a <gimple_statement_omp_task *> (gs);
4759 return &omp_task_stmt->child_fn;
4763 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4765 static inline void
4766 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
4768 gimple_statement_omp_task *omp_task_stmt =
4769 as_a <gimple_statement_omp_task *> (gs);
4770 omp_task_stmt->child_fn = child_fn;
4774 /* Return the artificial argument used to send variables and values
4775 from the parent to the children threads in OMP_TASK GS. */
4777 static inline tree
4778 gimple_omp_task_data_arg (const_gimple gs)
4780 const gimple_statement_omp_task *omp_task_stmt =
4781 as_a <const gimple_statement_omp_task *> (gs);
4782 return omp_task_stmt->data_arg;
4786 /* Return a pointer to the data argument for OMP_TASK GS. */
4788 static inline tree *
4789 gimple_omp_task_data_arg_ptr (gimple gs)
4791 gimple_statement_omp_task *omp_task_stmt =
4792 as_a <gimple_statement_omp_task *> (gs);
4793 return &omp_task_stmt->data_arg;
4797 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4799 static inline void
4800 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
4802 gimple_statement_omp_task *omp_task_stmt =
4803 as_a <gimple_statement_omp_task *> (gs);
4804 omp_task_stmt->data_arg = data_arg;
4808 /* Return the clauses associated with OMP_TASK GS. */
4810 static inline tree
4811 gimple_omp_taskreg_clauses (const_gimple gs)
4813 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4814 as_a <const gimple_statement_omp_taskreg *> (gs);
4815 return omp_taskreg_stmt->clauses;
4819 /* Return a pointer to the clauses associated with OMP_TASK GS. */
4821 static inline tree *
4822 gimple_omp_taskreg_clauses_ptr (gimple gs)
4824 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4825 as_a <gimple_statement_omp_taskreg *> (gs);
4826 return &omp_taskreg_stmt->clauses;
4830 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
4831 GS. */
4833 static inline void
4834 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
4836 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4837 as_a <gimple_statement_omp_taskreg *> (gs);
4838 omp_taskreg_stmt->clauses = clauses;
4842 /* Return the child function used to hold the body of OMP_TASK GS. */
4844 static inline tree
4845 gimple_omp_taskreg_child_fn (const_gimple gs)
4847 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4848 as_a <const gimple_statement_omp_taskreg *> (gs);
4849 return omp_taskreg_stmt->child_fn;
4852 /* Return a pointer to the child function used to hold the body of
4853 OMP_TASK GS. */
4855 static inline tree *
4856 gimple_omp_taskreg_child_fn_ptr (gimple gs)
4858 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4859 as_a <gimple_statement_omp_taskreg *> (gs);
4860 return &omp_taskreg_stmt->child_fn;
4864 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
4866 static inline void
4867 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
4869 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4870 as_a <gimple_statement_omp_taskreg *> (gs);
4871 omp_taskreg_stmt->child_fn = child_fn;
4875 /* Return the artificial argument used to send variables and values
4876 from the parent to the children threads in OMP_TASK GS. */
4878 static inline tree
4879 gimple_omp_taskreg_data_arg (const_gimple gs)
4881 const gimple_statement_omp_taskreg *omp_taskreg_stmt =
4882 as_a <const gimple_statement_omp_taskreg *> (gs);
4883 return omp_taskreg_stmt->data_arg;
4887 /* Return a pointer to the data argument for OMP_TASK GS. */
4889 static inline tree *
4890 gimple_omp_taskreg_data_arg_ptr (gimple gs)
4892 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4893 as_a <gimple_statement_omp_taskreg *> (gs);
4894 return &omp_taskreg_stmt->data_arg;
4898 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
4900 static inline void
4901 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
4903 gimple_statement_omp_taskreg *omp_taskreg_stmt =
4904 as_a <gimple_statement_omp_taskreg *> (gs);
4905 omp_taskreg_stmt->data_arg = data_arg;
4909 /* Return the copy function used to hold the body of OMP_TASK GS. */
4911 static inline tree
4912 gimple_omp_task_copy_fn (const_gimple gs)
4914 const gimple_statement_omp_task *omp_task_stmt =
4915 as_a <const gimple_statement_omp_task *> (gs);
4916 return omp_task_stmt->copy_fn;
4919 /* Return a pointer to the copy function used to hold the body of
4920 OMP_TASK GS. */
4922 static inline tree *
4923 gimple_omp_task_copy_fn_ptr (gimple gs)
4925 gimple_statement_omp_task *omp_task_stmt =
4926 as_a <gimple_statement_omp_task *> (gs);
4927 return &omp_task_stmt->copy_fn;
4931 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
4933 static inline void
4934 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
4936 gimple_statement_omp_task *omp_task_stmt =
4937 as_a <gimple_statement_omp_task *> (gs);
4938 omp_task_stmt->copy_fn = copy_fn;
4942 /* Return size of the data block in bytes in OMP_TASK GS. */
4944 static inline tree
4945 gimple_omp_task_arg_size (const_gimple gs)
4947 const gimple_statement_omp_task *omp_task_stmt =
4948 as_a <const gimple_statement_omp_task *> (gs);
4949 return omp_task_stmt->arg_size;
4953 /* Return a pointer to the data block size for OMP_TASK GS. */
4955 static inline tree *
4956 gimple_omp_task_arg_size_ptr (gimple gs)
4958 gimple_statement_omp_task *omp_task_stmt =
4959 as_a <gimple_statement_omp_task *> (gs);
4960 return &omp_task_stmt->arg_size;
4964 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
4966 static inline void
4967 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
4969 gimple_statement_omp_task *omp_task_stmt =
4970 as_a <gimple_statement_omp_task *> (gs);
4971 omp_task_stmt->arg_size = arg_size;
4975 /* Return align of the data block in bytes in OMP_TASK GS. */
4977 static inline tree
4978 gimple_omp_task_arg_align (const_gimple gs)
4980 const gimple_statement_omp_task *omp_task_stmt =
4981 as_a <const gimple_statement_omp_task *> (gs);
4982 return omp_task_stmt->arg_align;
4986 /* Return a pointer to the data block align for OMP_TASK GS. */
4988 static inline tree *
4989 gimple_omp_task_arg_align_ptr (gimple gs)
4991 gimple_statement_omp_task *omp_task_stmt =
4992 as_a <gimple_statement_omp_task *> (gs);
4993 return &omp_task_stmt->arg_align;
4997 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
4999 static inline void
5000 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5002 gimple_statement_omp_task *omp_task_stmt =
5003 as_a <gimple_statement_omp_task *> (gs);
5004 omp_task_stmt->arg_align = arg_align;
5008 /* Return the clauses associated with OMP_SINGLE GS. */
5010 static inline tree
5011 gimple_omp_single_clauses (const_gimple gs)
5013 const gimple_statement_omp_single *omp_single_stmt =
5014 as_a <const gimple_statement_omp_single *> (gs);
5015 return omp_single_stmt->clauses;
5019 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5021 static inline tree *
5022 gimple_omp_single_clauses_ptr (gimple gs)
5024 gimple_statement_omp_single *omp_single_stmt =
5025 as_a <gimple_statement_omp_single *> (gs);
5026 return &omp_single_stmt->clauses;
5030 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
5032 static inline void
5033 gimple_omp_single_set_clauses (gimple gs, tree clauses)
5035 gimple_statement_omp_single *omp_single_stmt =
5036 as_a <gimple_statement_omp_single *> (gs);
5037 omp_single_stmt->clauses = clauses;
5041 /* Return the clauses associated with OMP_TARGET GS. */
5043 static inline tree
5044 gimple_omp_target_clauses (const_gimple gs)
5046 const gimple_statement_omp_target *omp_target_stmt =
5047 as_a <const gimple_statement_omp_target *> (gs);
5048 return omp_target_stmt->clauses;
5052 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5054 static inline tree *
5055 gimple_omp_target_clauses_ptr (gimple gs)
5057 gimple_statement_omp_target *omp_target_stmt =
5058 as_a <gimple_statement_omp_target *> (gs);
5059 return &omp_target_stmt->clauses;
5063 /* Set CLAUSES to be the clauses associated with OMP_TARGET GS. */
5065 static inline void
5066 gimple_omp_target_set_clauses (gimple gs, tree clauses)
5068 gimple_statement_omp_target *omp_target_stmt =
5069 as_a <gimple_statement_omp_target *> (gs);
5070 omp_target_stmt->clauses = clauses;
5074 /* Return the kind of OMP target statemement. */
5076 static inline int
5077 gimple_omp_target_kind (const_gimple g)
5079 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5080 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5084 /* Set the OMP target kind. */
5086 static inline void
5087 gimple_omp_target_set_kind (gimple g, int kind)
5089 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5090 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5091 | (kind & GF_OMP_TARGET_KIND_MASK);
5095 /* Return the child function used to hold the body of OMP_TARGET GS. */
5097 static inline tree
5098 gimple_omp_target_child_fn (const_gimple gs)
5100 const gimple_statement_omp_target *omp_target_stmt =
5101 as_a <const gimple_statement_omp_target *> (gs);
5102 return omp_target_stmt->child_fn;
5105 /* Return a pointer to the child function used to hold the body of
5106 OMP_TARGET GS. */
5108 static inline tree *
5109 gimple_omp_target_child_fn_ptr (gimple gs)
5111 gimple_statement_omp_target *omp_target_stmt =
5112 as_a <gimple_statement_omp_target *> (gs);
5113 return &omp_target_stmt->child_fn;
5117 /* Set CHILD_FN to be the child function for OMP_TARGET GS. */
5119 static inline void
5120 gimple_omp_target_set_child_fn (gimple gs, tree child_fn)
5122 gimple_statement_omp_target *omp_target_stmt =
5123 as_a <gimple_statement_omp_target *> (gs);
5124 omp_target_stmt->child_fn = child_fn;
5128 /* Return the artificial argument used to send variables and values
5129 from the parent to the children threads in OMP_TARGET GS. */
5131 static inline tree
5132 gimple_omp_target_data_arg (const_gimple gs)
5134 const gimple_statement_omp_target *omp_target_stmt =
5135 as_a <const gimple_statement_omp_target *> (gs);
5136 return omp_target_stmt->data_arg;
5140 /* Return a pointer to the data argument for OMP_TARGET GS. */
5142 static inline tree *
5143 gimple_omp_target_data_arg_ptr (gimple gs)
5145 gimple_statement_omp_target *omp_target_stmt =
5146 as_a <gimple_statement_omp_target *> (gs);
5147 return &omp_target_stmt->data_arg;
5151 /* Set DATA_ARG to be the data argument for OMP_TARGET GS. */
5153 static inline void
5154 gimple_omp_target_set_data_arg (gimple gs, tree data_arg)
5156 gimple_statement_omp_target *omp_target_stmt =
5157 as_a <gimple_statement_omp_target *> (gs);
5158 omp_target_stmt->data_arg = data_arg;
5162 /* Return the clauses associated with OMP_TEAMS GS. */
5164 static inline tree
5165 gimple_omp_teams_clauses (const_gimple gs)
5167 const gimple_statement_omp_teams *omp_teams_stmt =
5168 as_a <const gimple_statement_omp_teams *> (gs);
5169 return omp_teams_stmt->clauses;
5173 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5175 static inline tree *
5176 gimple_omp_teams_clauses_ptr (gimple gs)
5178 gimple_statement_omp_teams *omp_teams_stmt =
5179 as_a <gimple_statement_omp_teams *> (gs);
5180 return &omp_teams_stmt->clauses;
5184 /* Set CLAUSES to be the clauses associated with OMP_TEAMS GS. */
5186 static inline void
5187 gimple_omp_teams_set_clauses (gimple gs, tree clauses)
5189 gimple_statement_omp_teams *omp_teams_stmt =
5190 as_a <gimple_statement_omp_teams *> (gs);
5191 omp_teams_stmt->clauses = clauses;
5195 /* Return the clauses associated with OMP_SECTIONS GS. */
5197 static inline tree
5198 gimple_omp_sections_clauses (const_gimple gs)
5200 const gimple_statement_omp_sections *omp_sections_stmt =
5201 as_a <const gimple_statement_omp_sections *> (gs);
5202 return omp_sections_stmt->clauses;
5206 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5208 static inline tree *
5209 gimple_omp_sections_clauses_ptr (gimple gs)
5211 gimple_statement_omp_sections *omp_sections_stmt =
5212 as_a <gimple_statement_omp_sections *> (gs);
5213 return &omp_sections_stmt->clauses;
5217 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5218 GS. */
5220 static inline void
5221 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5223 gimple_statement_omp_sections *omp_sections_stmt =
5224 as_a <gimple_statement_omp_sections *> (gs);
5225 omp_sections_stmt->clauses = clauses;
5229 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5230 in GS. */
5232 static inline tree
5233 gimple_omp_sections_control (const_gimple gs)
5235 const gimple_statement_omp_sections *omp_sections_stmt =
5236 as_a <const gimple_statement_omp_sections *> (gs);
5237 return omp_sections_stmt->control;
5241 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5242 GS. */
5244 static inline tree *
5245 gimple_omp_sections_control_ptr (gimple gs)
5247 gimple_statement_omp_sections *omp_sections_stmt =
5248 as_a <gimple_statement_omp_sections *> (gs);
5249 return &omp_sections_stmt->control;
5253 /* Set CONTROL to be the set of clauses associated with the
5254 GIMPLE_OMP_SECTIONS in GS. */
5256 static inline void
5257 gimple_omp_sections_set_control (gimple gs, tree control)
5259 gimple_statement_omp_sections *omp_sections_stmt =
5260 as_a <gimple_statement_omp_sections *> (gs);
5261 omp_sections_stmt->control = control;
5265 /* Set COND to be the condition code for OMP_FOR GS. */
5267 static inline void
5268 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
5270 gimple_statement_omp_for *omp_for_stmt =
5271 as_a <gimple_statement_omp_for *> (gs);
5272 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5273 && i < omp_for_stmt->collapse);
5274 omp_for_stmt->iter[i].cond = cond;
5278 /* Return the condition code associated with OMP_FOR GS. */
5280 static inline enum tree_code
5281 gimple_omp_for_cond (const_gimple gs, size_t i)
5283 const gimple_statement_omp_for *omp_for_stmt =
5284 as_a <const gimple_statement_omp_for *> (gs);
5285 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5286 return omp_for_stmt->iter[i].cond;
5290 /* Set the value being stored in an atomic store. */
5292 static inline void
5293 gimple_omp_atomic_store_set_val (gimple g, tree val)
5295 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5296 as_a <gimple_statement_omp_atomic_store *> (g);
5297 omp_atomic_store_stmt->val = val;
5301 /* Return the value being stored in an atomic store. */
5303 static inline tree
5304 gimple_omp_atomic_store_val (const_gimple g)
5306 const gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5307 as_a <const gimple_statement_omp_atomic_store *> (g);
5308 return omp_atomic_store_stmt->val;
5312 /* Return a pointer to the value being stored in an atomic store. */
5314 static inline tree *
5315 gimple_omp_atomic_store_val_ptr (gimple g)
5317 gimple_statement_omp_atomic_store *omp_atomic_store_stmt =
5318 as_a <gimple_statement_omp_atomic_store *> (g);
5319 return &omp_atomic_store_stmt->val;
5323 /* Set the LHS of an atomic load. */
5325 static inline void
5326 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
5328 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5329 as_a <gimple_statement_omp_atomic_load *> (g);
5330 omp_atomic_load_stmt->lhs = lhs;
5334 /* Get the LHS of an atomic load. */
5336 static inline tree
5337 gimple_omp_atomic_load_lhs (const_gimple g)
5339 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5340 as_a <const gimple_statement_omp_atomic_load *> (g);
5341 return omp_atomic_load_stmt->lhs;
5345 /* Return a pointer to the LHS of an atomic load. */
5347 static inline tree *
5348 gimple_omp_atomic_load_lhs_ptr (gimple g)
5350 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5351 as_a <gimple_statement_omp_atomic_load *> (g);
5352 return &omp_atomic_load_stmt->lhs;
5356 /* Set the RHS of an atomic load. */
5358 static inline void
5359 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
5361 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5362 as_a <gimple_statement_omp_atomic_load *> (g);
5363 omp_atomic_load_stmt->rhs = rhs;
5367 /* Get the RHS of an atomic load. */
5369 static inline tree
5370 gimple_omp_atomic_load_rhs (const_gimple g)
5372 const gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5373 as_a <const gimple_statement_omp_atomic_load *> (g);
5374 return omp_atomic_load_stmt->rhs;
5378 /* Return a pointer to the RHS of an atomic load. */
5380 static inline tree *
5381 gimple_omp_atomic_load_rhs_ptr (gimple g)
5383 gimple_statement_omp_atomic_load *omp_atomic_load_stmt =
5384 as_a <gimple_statement_omp_atomic_load *> (g);
5385 return &omp_atomic_load_stmt->rhs;
5389 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5391 static inline tree
5392 gimple_omp_continue_control_def (const_gimple g)
5394 const gimple_statement_omp_continue *omp_continue_stmt =
5395 as_a <const gimple_statement_omp_continue *> (g);
5396 return omp_continue_stmt->control_def;
5399 /* The same as above, but return the address. */
5401 static inline tree *
5402 gimple_omp_continue_control_def_ptr (gimple g)
5404 gimple_statement_omp_continue *omp_continue_stmt =
5405 as_a <gimple_statement_omp_continue *> (g);
5406 return &omp_continue_stmt->control_def;
5409 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5411 static inline void
5412 gimple_omp_continue_set_control_def (gimple g, tree def)
5414 gimple_statement_omp_continue *omp_continue_stmt =
5415 as_a <gimple_statement_omp_continue *> (g);
5416 omp_continue_stmt->control_def = def;
5420 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5422 static inline tree
5423 gimple_omp_continue_control_use (const_gimple g)
5425 const gimple_statement_omp_continue *omp_continue_stmt =
5426 as_a <const gimple_statement_omp_continue *> (g);
5427 return omp_continue_stmt->control_use;
5431 /* The same as above, but return the address. */
5433 static inline tree *
5434 gimple_omp_continue_control_use_ptr (gimple g)
5436 gimple_statement_omp_continue *omp_continue_stmt =
5437 as_a <gimple_statement_omp_continue *> (g);
5438 return &omp_continue_stmt->control_use;
5442 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5444 static inline void
5445 gimple_omp_continue_set_control_use (gimple g, tree use)
5447 gimple_statement_omp_continue *omp_continue_stmt =
5448 as_a <gimple_statement_omp_continue *> (g);
5449 omp_continue_stmt->control_use = use;
5452 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement GS. */
5454 static inline gimple_seq *
5455 gimple_transaction_body_ptr (gimple gs)
5457 gimple_statement_transaction *transaction_stmt =
5458 as_a <gimple_statement_transaction *> (gs);
5459 return &transaction_stmt->body;
5462 /* Return the body for the GIMPLE_TRANSACTION statement GS. */
5464 static inline gimple_seq
5465 gimple_transaction_body (gimple gs)
5467 return *gimple_transaction_body_ptr (gs);
5470 /* Return the label associated with a GIMPLE_TRANSACTION. */
5472 static inline tree
5473 gimple_transaction_label (const_gimple gs)
5475 const gimple_statement_transaction *transaction_stmt =
5476 as_a <const gimple_statement_transaction *> (gs);
5477 return transaction_stmt->label;
5480 static inline tree *
5481 gimple_transaction_label_ptr (gimple gs)
5483 gimple_statement_transaction *transaction_stmt =
5484 as_a <gimple_statement_transaction *> (gs);
5485 return &transaction_stmt->label;
5488 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5490 static inline unsigned int
5491 gimple_transaction_subcode (const_gimple gs)
5493 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5494 return gs->subcode;
5497 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement GS. */
5499 static inline void
5500 gimple_transaction_set_body (gimple gs, gimple_seq body)
5502 gimple_statement_transaction *transaction_stmt =
5503 as_a <gimple_statement_transaction *> (gs);
5504 transaction_stmt->body = body;
5507 /* Set the label associated with a GIMPLE_TRANSACTION. */
5509 static inline void
5510 gimple_transaction_set_label (gimple gs, tree label)
5512 gimple_statement_transaction *transaction_stmt =
5513 as_a <gimple_statement_transaction *> (gs);
5514 transaction_stmt->label = label;
5517 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5519 static inline void
5520 gimple_transaction_set_subcode (gimple gs, unsigned int subcode)
5522 GIMPLE_CHECK (gs, GIMPLE_TRANSACTION);
5523 gs->subcode = subcode;
5527 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5529 static inline tree *
5530 gimple_return_retval_ptr (const_gimple gs)
5532 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5533 return gimple_op_ptr (gs, 0);
5536 /* Return the return value for GIMPLE_RETURN GS. */
5538 static inline tree
5539 gimple_return_retval (const_gimple gs)
5541 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5542 return gimple_op (gs, 0);
5546 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5548 static inline void
5549 gimple_return_set_retval (gimple gs, tree retval)
5551 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5552 gimple_set_op (gs, 0, retval);
5556 /* Returns true when the gimple statement STMT is any of the OpenMP types. */
5558 #define CASE_GIMPLE_OMP \
5559 case GIMPLE_OMP_PARALLEL: \
5560 case GIMPLE_OMP_TASK: \
5561 case GIMPLE_OMP_FOR: \
5562 case GIMPLE_OMP_SECTIONS: \
5563 case GIMPLE_OMP_SECTIONS_SWITCH: \
5564 case GIMPLE_OMP_SINGLE: \
5565 case GIMPLE_OMP_TARGET: \
5566 case GIMPLE_OMP_TEAMS: \
5567 case GIMPLE_OMP_SECTION: \
5568 case GIMPLE_OMP_MASTER: \
5569 case GIMPLE_OMP_TASKGROUP: \
5570 case GIMPLE_OMP_ORDERED: \
5571 case GIMPLE_OMP_CRITICAL: \
5572 case GIMPLE_OMP_RETURN: \
5573 case GIMPLE_OMP_ATOMIC_LOAD: \
5574 case GIMPLE_OMP_ATOMIC_STORE: \
5575 case GIMPLE_OMP_CONTINUE
5577 static inline bool
5578 is_gimple_omp (const_gimple stmt)
5580 switch (gimple_code (stmt))
5582 CASE_GIMPLE_OMP:
5583 return true;
5584 default:
5585 return false;
5590 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5592 static inline bool
5593 gimple_nop_p (const_gimple g)
5595 return gimple_code (g) == GIMPLE_NOP;
5599 /* Return true if GS is a GIMPLE_RESX. */
5601 static inline bool
5602 is_gimple_resx (const_gimple gs)
5604 return gimple_code (gs) == GIMPLE_RESX;
5607 /* Return the predictor of GIMPLE_PREDICT statement GS. */
5609 static inline enum br_predictor
5610 gimple_predict_predictor (gimple gs)
5612 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5613 return (enum br_predictor) (gs->subcode & ~GF_PREDICT_TAKEN);
5617 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
5619 static inline void
5620 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
5622 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5623 gs->subcode = (gs->subcode & GF_PREDICT_TAKEN)
5624 | (unsigned) predictor;
5628 /* Return the outcome of GIMPLE_PREDICT statement GS. */
5630 static inline enum prediction
5631 gimple_predict_outcome (gimple gs)
5633 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5634 return (gs->subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
5638 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
5640 static inline void
5641 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
5643 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
5644 if (outcome == TAKEN)
5645 gs->subcode |= GF_PREDICT_TAKEN;
5646 else
5647 gs->subcode &= ~GF_PREDICT_TAKEN;
5651 /* Return the type of the main expression computed by STMT. Return
5652 void_type_node if the statement computes nothing. */
5654 static inline tree
5655 gimple_expr_type (const_gimple stmt)
5657 enum gimple_code code = gimple_code (stmt);
5659 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
5661 tree type;
5662 /* In general we want to pass out a type that can be substituted
5663 for both the RHS and the LHS types if there is a possibly
5664 useless conversion involved. That means returning the
5665 original RHS type as far as we can reconstruct it. */
5666 if (code == GIMPLE_CALL)
5668 if (gimple_call_internal_p (stmt)
5669 && gimple_call_internal_fn (stmt) == IFN_MASK_STORE)
5670 type = TREE_TYPE (gimple_call_arg (stmt, 3));
5671 else
5672 type = gimple_call_return_type (stmt);
5674 else
5675 switch (gimple_assign_rhs_code (stmt))
5677 case POINTER_PLUS_EXPR:
5678 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
5679 break;
5681 default:
5682 /* As fallback use the type of the LHS. */
5683 type = TREE_TYPE (gimple_get_lhs (stmt));
5684 break;
5686 return type;
5688 else if (code == GIMPLE_COND)
5689 return boolean_type_node;
5690 else
5691 return void_type_node;
5694 /* Enum and arrays used for allocation stats. Keep in sync with
5695 gimple.c:gimple_alloc_kind_names. */
5696 enum gimple_alloc_kind
5698 gimple_alloc_kind_assign, /* Assignments. */
5699 gimple_alloc_kind_phi, /* PHI nodes. */
5700 gimple_alloc_kind_cond, /* Conditionals. */
5701 gimple_alloc_kind_rest, /* Everything else. */
5702 gimple_alloc_kind_all
5705 extern int gimple_alloc_counts[];
5706 extern int gimple_alloc_sizes[];
5708 /* Return the allocation kind for a given stmt CODE. */
5709 static inline enum gimple_alloc_kind
5710 gimple_alloc_kind (enum gimple_code code)
5712 switch (code)
5714 case GIMPLE_ASSIGN:
5715 return gimple_alloc_kind_assign;
5716 case GIMPLE_PHI:
5717 return gimple_alloc_kind_phi;
5718 case GIMPLE_COND:
5719 return gimple_alloc_kind_cond;
5720 default:
5721 return gimple_alloc_kind_rest;
5725 /* Return true if a location should not be emitted for this statement
5726 by annotate_all_with_location. */
5728 static inline bool
5729 gimple_do_not_emit_location_p (gimple g)
5731 return gimple_plf (g, GF_PLF_1);
5734 /* Mark statement G so a location will not be emitted by
5735 annotate_one_with_location. */
5737 static inline void
5738 gimple_set_do_not_emit_location (gimple g)
5740 /* The PLF flags are initialized to 0 when a new tuple is created,
5741 so no need to initialize it anywhere. */
5742 gimple_set_plf (g, GF_PLF_1, true);
5746 /* Macros for showing usage statistics. */
5747 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
5748 ? (x) \
5749 : ((x) < 1024*1024*10 \
5750 ? (x) / 1024 \
5751 : (x) / (1024*1024))))
5753 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
5755 #endif /* GCC_GIMPLE_H */