Move some comparison simplifications to match.pd
[official-gcc.git] / gcc / gimple.h
blob55f21318c26d259868280db57b3bf2966ff3e271
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2015 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 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const_gimple, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN;
51 #define GIMPLE_CHECK(GS, CODE) \
52 do { \
53 const_gimple __gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
57 } while (0)
58 template <typename T>
59 static inline T
60 GIMPLE_CHECK2(const_gimple gs,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file = __builtin_FILE (),
63 int line = __builtin_LINE (),
64 const char *fun = __builtin_FUNCTION ())
65 #else
66 const char *file = __FILE__,
67 int line = __LINE__,
68 const char *fun = NULL)
69 #endif
71 T ret = dyn_cast <T> (gs);
72 if (!ret)
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
75 return ret;
77 template <typename T>
78 static inline T
79 GIMPLE_CHECK2(gimple gs,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file = __builtin_FILE (),
82 int line = __builtin_LINE (),
83 const char *fun = __builtin_FUNCTION ())
84 #else
85 const char *file = __FILE__,
86 int line = __LINE__,
87 const char *fun = NULL)
88 #endif
90 T ret = dyn_cast <T> (gs);
91 if (!ret)
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
94 return ret;
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
99 template <typename T>
100 static inline T
101 GIMPLE_CHECK2(gimple gs)
103 return as_a <T> (gs);
105 template <typename T>
106 static inline T
107 GIMPLE_CHECK2(const_gimple gs)
109 return as_a <T> (gs);
111 #endif
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple_statement_base.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_OMP_PARALLEL_COMBINED = 1 << 0,
149 GF_OMP_FOR_KIND_MASK = (1 << 3) - 1,
150 GF_OMP_FOR_KIND_FOR = 0,
151 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
152 GF_OMP_FOR_KIND_CILKFOR = 2,
153 GF_OMP_FOR_KIND_OACC_LOOP = 3,
154 /* Flag for SIMD variants of OMP_FOR kinds. */
155 GF_OMP_FOR_SIMD = 1 << 2,
156 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
157 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
158 GF_OMP_FOR_COMBINED = 1 << 3,
159 GF_OMP_FOR_COMBINED_INTO = 1 << 4,
160 GF_OMP_TARGET_KIND_MASK = (1 << 3) - 1,
161 GF_OMP_TARGET_KIND_REGION = 0,
162 GF_OMP_TARGET_KIND_DATA = 1,
163 GF_OMP_TARGET_KIND_UPDATE = 2,
164 GF_OMP_TARGET_KIND_OACC_PARALLEL = 3,
165 GF_OMP_TARGET_KIND_OACC_KERNELS = 4,
166 GF_OMP_TARGET_KIND_OACC_DATA = 5,
167 GF_OMP_TARGET_KIND_OACC_UPDATE = 6,
168 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 7,
170 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
171 a thread synchronization via some sort of barrier. The exact barrier
172 that would otherwise be emitted is dependent on the OMP statement with
173 which this return is associated. */
174 GF_OMP_RETURN_NOWAIT = 1 << 0,
176 GF_OMP_SECTION_LAST = 1 << 0,
177 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
178 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
179 GF_PREDICT_TAKEN = 1 << 15
182 /* Currently, there are only two types of gimple debug stmt. Others are
183 envisioned, for example, to enable the generation of is_stmt notes
184 in line number information, to mark sequence points, etc. This
185 subcode is to be used to tell them apart. */
186 enum gimple_debug_subcode {
187 GIMPLE_DEBUG_BIND = 0,
188 GIMPLE_DEBUG_SOURCE_BIND = 1
191 /* Masks for selecting a pass local flag (PLF) to work on. These
192 masks are used by gimple_set_plf and gimple_plf. */
193 enum plf_mask {
194 GF_PLF_1 = 1 << 0,
195 GF_PLF_2 = 1 << 1
198 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
199 are for 64 bit hosts. */
201 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
202 chain_next ("%h.next"), variable_size))
203 gimple_statement_base
205 /* [ WORD 1 ]
206 Main identifying code for a tuple. */
207 ENUM_BITFIELD(gimple_code) code : 8;
209 /* Nonzero if a warning should not be emitted on this tuple. */
210 unsigned int no_warning : 1;
212 /* Nonzero if this tuple has been visited. Passes are responsible
213 for clearing this bit before using it. */
214 unsigned int visited : 1;
216 /* Nonzero if this tuple represents a non-temporal move. */
217 unsigned int nontemporal_move : 1;
219 /* Pass local flags. These flags are free for any pass to use as
220 they see fit. Passes should not assume that these flags contain
221 any useful value when the pass starts. Any initial state that
222 the pass requires should be set on entry to the pass. See
223 gimple_set_plf and gimple_plf for usage. */
224 unsigned int plf : 2;
226 /* Nonzero if this statement has been modified and needs to have its
227 operands rescanned. */
228 unsigned modified : 1;
230 /* Nonzero if this statement contains volatile operands. */
231 unsigned has_volatile_ops : 1;
233 /* Padding to get subcode to 16 bit alignment. */
234 unsigned pad : 1;
236 /* The SUBCODE field can be used for tuple-specific flags for tuples
237 that do not require subcodes. Note that SUBCODE should be at
238 least as wide as tree codes, as several tuples store tree codes
239 in there. */
240 unsigned int subcode : 16;
242 /* UID of this statement. This is used by passes that want to
243 assign IDs to statements. It must be assigned and used by each
244 pass. By default it should be assumed to contain garbage. */
245 unsigned uid;
247 /* [ WORD 2 ]
248 Locus information for debug info. */
249 location_t location;
251 /* Number of operands in this tuple. */
252 unsigned num_ops;
254 /* [ WORD 3 ]
255 Basic block holding this statement. */
256 basic_block bb;
258 /* [ WORD 4-5 ]
259 Linked lists of gimple statements. The next pointers form
260 a NULL terminated list, the prev pointers are a cyclic list.
261 A gimple statement is hence also a double-ended list of
262 statements, with the pointer itself being the first element,
263 and the prev pointer being the last. */
264 gimple next;
265 gimple GTY((skip)) prev;
269 /* Base structure for tuples with operands. */
271 /* This gimple subclass has no tag value. */
272 struct GTY(())
273 gimple_statement_with_ops_base : public gimple_statement_base
275 /* [ WORD 1-6 ] : base class */
277 /* [ WORD 7 ]
278 SSA operand vectors. NOTE: It should be possible to
279 amalgamate these vectors with the operand vector OP. However,
280 the SSA operand vectors are organized differently and contain
281 more information (like immediate use chaining). */
282 struct use_optype_d GTY((skip (""))) *use_ops;
286 /* Statements that take register operands. */
288 struct GTY((tag("GSS_WITH_OPS")))
289 gimple_statement_with_ops : public gimple_statement_with_ops_base
291 /* [ WORD 1-7 ] : base class */
293 /* [ WORD 8 ]
294 Operand vector. NOTE! This must always be the last field
295 of this structure. In particular, this means that this
296 structure cannot be embedded inside another one. */
297 tree GTY((length ("%h.num_ops"))) op[1];
301 /* Base for statements that take both memory and register operands. */
303 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
304 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
306 /* [ WORD 1-7 ] : base class */
308 /* [ WORD 8-9 ]
309 Virtual operands for this statement. The GC will pick them
310 up via the ssa_names array. */
311 tree GTY((skip (""))) vdef;
312 tree GTY((skip (""))) vuse;
316 /* Statements that take both memory and register operands. */
318 struct GTY((tag("GSS_WITH_MEM_OPS")))
319 gimple_statement_with_memory_ops :
320 public gimple_statement_with_memory_ops_base
322 /* [ WORD 1-9 ] : base class */
324 /* [ WORD 10 ]
325 Operand vector. NOTE! This must always be the last field
326 of this structure. In particular, this means that this
327 structure cannot be embedded inside another one. */
328 tree GTY((length ("%h.num_ops"))) op[1];
332 /* Call statements that take both memory and register operands. */
334 struct GTY((tag("GSS_CALL")))
335 gcall : public gimple_statement_with_memory_ops_base
337 /* [ WORD 1-9 ] : base class */
339 /* [ WORD 10-13 ] */
340 struct pt_solution call_used;
341 struct pt_solution call_clobbered;
343 /* [ WORD 14 ] */
344 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
345 tree GTY ((tag ("0"))) fntype;
346 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
347 } u;
349 /* [ WORD 15 ]
350 Operand vector. NOTE! This must always be the last field
351 of this structure. In particular, this means that this
352 structure cannot be embedded inside another one. */
353 tree GTY((length ("%h.num_ops"))) op[1];
355 static const enum gimple_code code_ = GIMPLE_CALL;
359 /* OMP statements. */
361 struct GTY((tag("GSS_OMP")))
362 gimple_statement_omp : public gimple_statement_base
364 /* [ WORD 1-6 ] : base class */
366 /* [ WORD 7 ] */
367 gimple_seq body;
371 /* GIMPLE_BIND */
373 struct GTY((tag("GSS_BIND")))
374 gbind : public gimple_statement_base
376 /* [ WORD 1-6 ] : base class */
378 /* [ WORD 7 ]
379 Variables declared in this scope. */
380 tree vars;
382 /* [ WORD 8 ]
383 This is different than the BLOCK field in gimple_statement_base,
384 which is analogous to TREE_BLOCK (i.e., the lexical block holding
385 this statement). This field is the equivalent of BIND_EXPR_BLOCK
386 in tree land (i.e., the lexical scope defined by this bind). See
387 gimple-low.c. */
388 tree block;
390 /* [ WORD 9 ] */
391 gimple_seq body;
395 /* GIMPLE_CATCH */
397 struct GTY((tag("GSS_CATCH")))
398 gcatch : public gimple_statement_base
400 /* [ WORD 1-6 ] : base class */
402 /* [ WORD 7 ] */
403 tree types;
405 /* [ WORD 8 ] */
406 gimple_seq handler;
410 /* GIMPLE_EH_FILTER */
412 struct GTY((tag("GSS_EH_FILTER")))
413 geh_filter : public gimple_statement_base
415 /* [ WORD 1-6 ] : base class */
417 /* [ WORD 7 ]
418 Filter types. */
419 tree types;
421 /* [ WORD 8 ]
422 Failure actions. */
423 gimple_seq failure;
426 /* GIMPLE_EH_ELSE */
428 struct GTY((tag("GSS_EH_ELSE")))
429 geh_else : public gimple_statement_base
431 /* [ WORD 1-6 ] : base class */
433 /* [ WORD 7,8 ] */
434 gimple_seq n_body, e_body;
437 /* GIMPLE_EH_MUST_NOT_THROW */
439 struct GTY((tag("GSS_EH_MNT")))
440 geh_mnt : public gimple_statement_base
442 /* [ WORD 1-6 ] : base class */
444 /* [ WORD 7 ] Abort function decl. */
445 tree fndecl;
448 /* GIMPLE_PHI */
450 struct GTY((tag("GSS_PHI")))
451 gphi : public gimple_statement_base
453 /* [ WORD 1-6 ] : base class */
455 /* [ WORD 7 ] */
456 unsigned capacity;
457 unsigned nargs;
459 /* [ WORD 8 ] */
460 tree result;
462 /* [ WORD 9 ] */
463 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
467 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
469 struct GTY((tag("GSS_EH_CTRL")))
470 gimple_statement_eh_ctrl : public gimple_statement_base
472 /* [ WORD 1-6 ] : base class */
474 /* [ WORD 7 ]
475 Exception region number. */
476 int region;
479 struct GTY((tag("GSS_EH_CTRL")))
480 gresx : public gimple_statement_eh_ctrl
482 /* No extra fields; adds invariant:
483 stmt->code == GIMPLE_RESX. */
486 struct GTY((tag("GSS_EH_CTRL")))
487 geh_dispatch : public gimple_statement_eh_ctrl
489 /* No extra fields; adds invariant:
490 stmt->code == GIMPLE_EH_DISPATH. */
494 /* GIMPLE_TRY */
496 struct GTY((tag("GSS_TRY")))
497 gtry : public gimple_statement_base
499 /* [ WORD 1-6 ] : base class */
501 /* [ WORD 7 ]
502 Expression to evaluate. */
503 gimple_seq eval;
505 /* [ WORD 8 ]
506 Cleanup expression. */
507 gimple_seq cleanup;
510 /* Kind of GIMPLE_TRY statements. */
511 enum gimple_try_flags
513 /* A try/catch. */
514 GIMPLE_TRY_CATCH = 1 << 0,
516 /* A try/finally. */
517 GIMPLE_TRY_FINALLY = 1 << 1,
518 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
520 /* Analogous to TRY_CATCH_IS_CLEANUP. */
521 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
524 /* GIMPLE_WITH_CLEANUP_EXPR */
526 struct GTY((tag("GSS_WCE")))
527 gimple_statement_wce : public gimple_statement_base
529 /* [ WORD 1-6 ] : base class */
531 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
532 executed if an exception is thrown, not on normal exit of its
533 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
534 in TARGET_EXPRs. */
536 /* [ WORD 7 ]
537 Cleanup expression. */
538 gimple_seq cleanup;
542 /* GIMPLE_ASM */
544 struct GTY((tag("GSS_ASM")))
545 gasm : public gimple_statement_with_memory_ops_base
547 /* [ WORD 1-9 ] : base class */
549 /* [ WORD 10 ]
550 __asm__ statement. */
551 const char *string;
553 /* [ WORD 11 ]
554 Number of inputs, outputs, clobbers, labels. */
555 unsigned char ni;
556 unsigned char no;
557 unsigned char nc;
558 unsigned char nl;
560 /* [ WORD 12 ]
561 Operand vector. NOTE! This must always be the last field
562 of this structure. In particular, this means that this
563 structure cannot be embedded inside another one. */
564 tree GTY((length ("%h.num_ops"))) op[1];
567 /* GIMPLE_OMP_CRITICAL */
569 struct GTY((tag("GSS_OMP_CRITICAL")))
570 gomp_critical : public gimple_statement_omp
572 /* [ WORD 1-7 ] : base class */
574 /* [ WORD 8 ]
575 Critical section name. */
576 tree name;
580 struct GTY(()) gimple_omp_for_iter {
581 /* Condition code. */
582 enum tree_code cond;
584 /* Index variable. */
585 tree index;
587 /* Initial value. */
588 tree initial;
590 /* Final value. */
591 tree final;
593 /* Increment. */
594 tree incr;
597 /* GIMPLE_OMP_FOR */
599 struct GTY((tag("GSS_OMP_FOR")))
600 gomp_for : public gimple_statement_omp
602 /* [ WORD 1-7 ] : base class */
604 /* [ WORD 8 ] */
605 tree clauses;
607 /* [ WORD 9 ]
608 Number of elements in iter array. */
609 size_t collapse;
611 /* [ WORD 10 ] */
612 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
614 /* [ WORD 11 ]
615 Pre-body evaluated before the loop body begins. */
616 gimple_seq pre_body;
620 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
622 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
623 gimple_statement_omp_parallel_layout : public gimple_statement_omp
625 /* [ WORD 1-7 ] : base class */
627 /* [ WORD 8 ]
628 Clauses. */
629 tree clauses;
631 /* [ WORD 9 ]
632 Child function holding the body of the parallel region. */
633 tree child_fn;
635 /* [ WORD 10 ]
636 Shared data argument. */
637 tree data_arg;
640 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
641 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
642 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
644 /* No extra fields; adds invariant:
645 stmt->code == GIMPLE_OMP_PARALLEL
646 || stmt->code == GIMPLE_OMP_TASK. */
649 /* GIMPLE_OMP_PARALLEL */
650 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
651 gomp_parallel : public gimple_statement_omp_taskreg
653 /* No extra fields; adds invariant:
654 stmt->code == GIMPLE_OMP_PARALLEL. */
657 /* GIMPLE_OMP_TARGET */
658 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
659 gomp_target : public gimple_statement_omp_parallel_layout
661 /* No extra fields; adds invariant:
662 stmt->code == GIMPLE_OMP_TARGET. */
665 /* GIMPLE_OMP_TASK */
667 struct GTY((tag("GSS_OMP_TASK")))
668 gomp_task : public gimple_statement_omp_taskreg
670 /* [ WORD 1-10 ] : base class */
672 /* [ WORD 11 ]
673 Child function holding firstprivate initialization if needed. */
674 tree copy_fn;
676 /* [ WORD 12-13 ]
677 Size and alignment in bytes of the argument data block. */
678 tree arg_size;
679 tree arg_align;
683 /* GIMPLE_OMP_SECTION */
684 /* Uses struct gimple_statement_omp. */
687 /* GIMPLE_OMP_SECTIONS */
689 struct GTY((tag("GSS_OMP_SECTIONS")))
690 gomp_sections : public gimple_statement_omp
692 /* [ WORD 1-7 ] : base class */
694 /* [ WORD 8 ] */
695 tree clauses;
697 /* [ WORD 9 ]
698 The control variable used for deciding which of the sections to
699 execute. */
700 tree control;
703 /* GIMPLE_OMP_CONTINUE.
705 Note: This does not inherit from gimple_statement_omp, because we
706 do not need the body field. */
708 struct GTY((tag("GSS_OMP_CONTINUE")))
709 gomp_continue : public gimple_statement_base
711 /* [ WORD 1-6 ] : base class */
713 /* [ WORD 7 ] */
714 tree control_def;
716 /* [ WORD 8 ] */
717 tree control_use;
720 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS */
722 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
723 gimple_statement_omp_single_layout : public gimple_statement_omp
725 /* [ WORD 1-7 ] : base class */
727 /* [ WORD 7 ] */
728 tree clauses;
731 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
732 gomp_single : public gimple_statement_omp_single_layout
734 /* No extra fields; adds invariant:
735 stmt->code == GIMPLE_OMP_SINGLE. */
738 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
739 gomp_teams : public gimple_statement_omp_single_layout
741 /* No extra fields; adds invariant:
742 stmt->code == GIMPLE_OMP_TEAMS. */
746 /* GIMPLE_OMP_ATOMIC_LOAD.
747 Note: This is based on gimple_statement_base, not g_s_omp, because g_s_omp
748 contains a sequence, which we don't need here. */
750 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
751 gomp_atomic_load : public gimple_statement_base
753 /* [ WORD 1-6 ] : base class */
755 /* [ WORD 7-8 ] */
756 tree rhs, lhs;
759 /* GIMPLE_OMP_ATOMIC_STORE.
760 See note on GIMPLE_OMP_ATOMIC_LOAD. */
762 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
763 gimple_statement_omp_atomic_store_layout : public gimple_statement_base
765 /* [ WORD 1-6 ] : base class */
767 /* [ WORD 7 ] */
768 tree val;
771 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
772 gomp_atomic_store :
773 public gimple_statement_omp_atomic_store_layout
775 /* No extra fields; adds invariant:
776 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
779 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
780 gimple_statement_omp_return :
781 public gimple_statement_omp_atomic_store_layout
783 /* No extra fields; adds invariant:
784 stmt->code == GIMPLE_OMP_RETURN. */
787 /* GIMPLE_TRANSACTION. */
789 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
791 /* The __transaction_atomic was declared [[outer]] or it is
792 __transaction_relaxed. */
793 #define GTMA_IS_OUTER (1u << 0)
794 #define GTMA_IS_RELAXED (1u << 1)
795 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
797 /* The transaction is seen to not have an abort. */
798 #define GTMA_HAVE_ABORT (1u << 2)
799 /* The transaction is seen to have loads or stores. */
800 #define GTMA_HAVE_LOAD (1u << 3)
801 #define GTMA_HAVE_STORE (1u << 4)
802 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
803 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
804 /* The transaction WILL enter serial irrevocable mode.
805 An irrevocable block post-dominates the entire transaction, such
806 that all invocations of the transaction will go serial-irrevocable.
807 In such case, we don't bother instrumenting the transaction, and
808 tell the runtime that it should begin the transaction in
809 serial-irrevocable mode. */
810 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
811 /* The transaction contains no instrumentation code whatsover, most
812 likely because it is guaranteed to go irrevocable upon entry. */
813 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
815 struct GTY((tag("GSS_TRANSACTION")))
816 gtransaction : public gimple_statement_with_memory_ops_base
818 /* [ WORD 1-9 ] : base class */
820 /* [ WORD 10 ] */
821 gimple_seq body;
823 /* [ WORD 11 ] */
824 tree label;
827 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
828 enum gimple_statement_structure_enum {
829 #include "gsstruct.def"
830 LAST_GSS_ENUM
832 #undef DEFGSSTRUCT
834 /* A statement with the invariant that
835 stmt->code == GIMPLE_COND
836 i.e. a conditional jump statement. */
838 struct GTY((tag("GSS_WITH_OPS")))
839 gcond : public gimple_statement_with_ops
841 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
842 static const enum gimple_code code_ = GIMPLE_COND;
845 /* A statement with the invariant that
846 stmt->code == GIMPLE_DEBUG
847 i.e. a debug statement. */
849 struct GTY((tag("GSS_WITH_OPS")))
850 gdebug : public gimple_statement_with_ops
852 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
855 /* A statement with the invariant that
856 stmt->code == GIMPLE_GOTO
857 i.e. a goto statement. */
859 struct GTY((tag("GSS_WITH_OPS")))
860 ggoto : public gimple_statement_with_ops
862 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
865 /* A statement with the invariant that
866 stmt->code == GIMPLE_LABEL
867 i.e. a label statement. */
869 struct GTY((tag("GSS_WITH_OPS")))
870 glabel : public gimple_statement_with_ops
872 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
875 /* A statement with the invariant that
876 stmt->code == GIMPLE_SWITCH
877 i.e. a switch statement. */
879 struct GTY((tag("GSS_WITH_OPS")))
880 gswitch : public gimple_statement_with_ops
882 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
885 /* A statement with the invariant that
886 stmt->code == GIMPLE_ASSIGN
887 i.e. an assignment statement. */
889 struct GTY((tag("GSS_WITH_MEM_OPS")))
890 gassign : public gimple_statement_with_memory_ops
892 static const enum gimple_code code_ = GIMPLE_ASSIGN;
893 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
896 /* A statement with the invariant that
897 stmt->code == GIMPLE_RETURN
898 i.e. a return statement. */
900 struct GTY((tag("GSS_WITH_MEM_OPS")))
901 greturn : public gimple_statement_with_memory_ops
903 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
906 template <>
907 template <>
908 inline bool
909 is_a_helper <gasm *>::test (gimple gs)
911 return gs->code == GIMPLE_ASM;
914 template <>
915 template <>
916 inline bool
917 is_a_helper <gassign *>::test (gimple gs)
919 return gs->code == GIMPLE_ASSIGN;
922 template <>
923 template <>
924 inline bool
925 is_a_helper <const gassign *>::test (const_gimple gs)
927 return gs->code == GIMPLE_ASSIGN;
930 template <>
931 template <>
932 inline bool
933 is_a_helper <gbind *>::test (gimple gs)
935 return gs->code == GIMPLE_BIND;
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gcall *>::test (gimple gs)
943 return gs->code == GIMPLE_CALL;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gcatch *>::test (gimple gs)
951 return gs->code == GIMPLE_CATCH;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <gcond *>::test (gimple gs)
959 return gs->code == GIMPLE_COND;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <const gcond *>::test (const_gimple gs)
967 return gs->code == GIMPLE_COND;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gdebug *>::test (gimple gs)
975 return gs->code == GIMPLE_DEBUG;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <ggoto *>::test (gimple gs)
983 return gs->code == GIMPLE_GOTO;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <glabel *>::test (gimple gs)
991 return gs->code == GIMPLE_LABEL;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <gresx *>::test (gimple gs)
999 return gs->code == GIMPLE_RESX;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <geh_dispatch *>::test (gimple gs)
1007 return gs->code == GIMPLE_EH_DISPATCH;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <geh_else *>::test (gimple gs)
1015 return gs->code == GIMPLE_EH_ELSE;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <geh_filter *>::test (gimple gs)
1023 return gs->code == GIMPLE_EH_FILTER;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <geh_mnt *>::test (gimple gs)
1031 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <gomp_atomic_load *>::test (gimple gs)
1039 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <gomp_atomic_store *>::test (gimple gs)
1047 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <gimple_statement_omp_return *>::test (gimple gs)
1055 return gs->code == GIMPLE_OMP_RETURN;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <gomp_continue *>::test (gimple gs)
1063 return gs->code == GIMPLE_OMP_CONTINUE;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <gomp_critical *>::test (gimple gs)
1071 return gs->code == GIMPLE_OMP_CRITICAL;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <gomp_for *>::test (gimple gs)
1079 return gs->code == GIMPLE_OMP_FOR;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <gimple_statement_omp_taskreg *>::test (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 <gomp_parallel *>::test (gimple gs)
1095 return gs->code == GIMPLE_OMP_PARALLEL;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <gomp_target *>::test (gimple gs)
1103 return gs->code == GIMPLE_OMP_TARGET;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <gomp_sections *>::test (gimple gs)
1111 return gs->code == GIMPLE_OMP_SECTIONS;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <gomp_single *>::test (gimple gs)
1119 return gs->code == GIMPLE_OMP_SINGLE;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <gomp_teams *>::test (gimple gs)
1127 return gs->code == GIMPLE_OMP_TEAMS;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <gomp_task *>::test (gimple gs)
1135 return gs->code == GIMPLE_OMP_TASK;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <gphi *>::test (gimple gs)
1143 return gs->code == GIMPLE_PHI;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <greturn *>::test (gimple gs)
1151 return gs->code == GIMPLE_RETURN;
1154 template <>
1155 template <>
1156 inline bool
1157 is_a_helper <gswitch *>::test (gimple gs)
1159 return gs->code == GIMPLE_SWITCH;
1162 template <>
1163 template <>
1164 inline bool
1165 is_a_helper <gtransaction *>::test (gimple gs)
1167 return gs->code == GIMPLE_TRANSACTION;
1170 template <>
1171 template <>
1172 inline bool
1173 is_a_helper <gtry *>::test (gimple gs)
1175 return gs->code == GIMPLE_TRY;
1178 template <>
1179 template <>
1180 inline bool
1181 is_a_helper <gimple_statement_wce *>::test (gimple gs)
1183 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1186 template <>
1187 template <>
1188 inline bool
1189 is_a_helper <const gasm *>::test (const_gimple gs)
1191 return gs->code == GIMPLE_ASM;
1194 template <>
1195 template <>
1196 inline bool
1197 is_a_helper <const gbind *>::test (const_gimple gs)
1199 return gs->code == GIMPLE_BIND;
1202 template <>
1203 template <>
1204 inline bool
1205 is_a_helper <const gcall *>::test (const_gimple gs)
1207 return gs->code == GIMPLE_CALL;
1210 template <>
1211 template <>
1212 inline bool
1213 is_a_helper <const gcatch *>::test (const_gimple gs)
1215 return gs->code == GIMPLE_CATCH;
1218 template <>
1219 template <>
1220 inline bool
1221 is_a_helper <const gresx *>::test (const_gimple gs)
1223 return gs->code == GIMPLE_RESX;
1226 template <>
1227 template <>
1228 inline bool
1229 is_a_helper <const geh_dispatch *>::test (const_gimple gs)
1231 return gs->code == GIMPLE_EH_DISPATCH;
1234 template <>
1235 template <>
1236 inline bool
1237 is_a_helper <const geh_filter *>::test (const_gimple gs)
1239 return gs->code == GIMPLE_EH_FILTER;
1242 template <>
1243 template <>
1244 inline bool
1245 is_a_helper <const gomp_atomic_load *>::test (const_gimple gs)
1247 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1250 template <>
1251 template <>
1252 inline bool
1253 is_a_helper <const gomp_atomic_store *>::test (const_gimple gs)
1255 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1258 template <>
1259 template <>
1260 inline bool
1261 is_a_helper <const gimple_statement_omp_return *>::test (const_gimple gs)
1263 return gs->code == GIMPLE_OMP_RETURN;
1266 template <>
1267 template <>
1268 inline bool
1269 is_a_helper <const gomp_continue *>::test (const_gimple gs)
1271 return gs->code == GIMPLE_OMP_CONTINUE;
1274 template <>
1275 template <>
1276 inline bool
1277 is_a_helper <const gomp_critical *>::test (const_gimple gs)
1279 return gs->code == GIMPLE_OMP_CRITICAL;
1282 template <>
1283 template <>
1284 inline bool
1285 is_a_helper <const gomp_for *>::test (const_gimple gs)
1287 return gs->code == GIMPLE_OMP_FOR;
1290 template <>
1291 template <>
1292 inline bool
1293 is_a_helper <const gimple_statement_omp_taskreg *>::test (const_gimple gs)
1295 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1298 template <>
1299 template <>
1300 inline bool
1301 is_a_helper <const gomp_parallel *>::test (const_gimple gs)
1303 return gs->code == GIMPLE_OMP_PARALLEL;
1306 template <>
1307 template <>
1308 inline bool
1309 is_a_helper <const gomp_target *>::test (const_gimple gs)
1311 return gs->code == GIMPLE_OMP_TARGET;
1314 template <>
1315 template <>
1316 inline bool
1317 is_a_helper <const gomp_sections *>::test (const_gimple gs)
1319 return gs->code == GIMPLE_OMP_SECTIONS;
1322 template <>
1323 template <>
1324 inline bool
1325 is_a_helper <const gomp_single *>::test (const_gimple gs)
1327 return gs->code == GIMPLE_OMP_SINGLE;
1330 template <>
1331 template <>
1332 inline bool
1333 is_a_helper <const gomp_teams *>::test (const_gimple gs)
1335 return gs->code == GIMPLE_OMP_TEAMS;
1338 template <>
1339 template <>
1340 inline bool
1341 is_a_helper <const gomp_task *>::test (const_gimple gs)
1343 return gs->code == GIMPLE_OMP_TASK;
1346 template <>
1347 template <>
1348 inline bool
1349 is_a_helper <const gphi *>::test (const_gimple gs)
1351 return gs->code == GIMPLE_PHI;
1354 template <>
1355 template <>
1356 inline bool
1357 is_a_helper <const gtransaction *>::test (const_gimple gs)
1359 return gs->code == GIMPLE_TRANSACTION;
1362 /* Offset in bytes to the location of the operand vector.
1363 Zero if there is no operand vector for this tuple structure. */
1364 extern size_t const gimple_ops_offset_[];
1366 /* Map GIMPLE codes to GSS codes. */
1367 extern enum gimple_statement_structure_enum const gss_for_code_[];
1369 /* This variable holds the currently expanded gimple statement for purposes
1370 of comminucating the profile info to the builtin expanders. */
1371 extern gimple currently_expanding_gimple_stmt;
1373 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1374 gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1375 greturn *gimple_build_return (tree);
1376 void gimple_call_reset_alias_info (gcall *);
1377 gcall *gimple_build_call_vec (tree, vec<tree> );
1378 gcall *gimple_build_call (tree, unsigned, ...);
1379 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1380 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1381 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1382 gcall *gimple_build_call_from_tree (tree);
1383 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1384 gassign *gimple_build_assign (tree, enum tree_code,
1385 tree, tree, tree CXX_MEM_STAT_INFO);
1386 gassign *gimple_build_assign (tree, enum tree_code,
1387 tree, tree CXX_MEM_STAT_INFO);
1388 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1389 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1390 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1391 void gimple_cond_set_condition_from_tree (gcond *, tree);
1392 glabel *gimple_build_label (tree label);
1393 ggoto *gimple_build_goto (tree dest);
1394 gimple gimple_build_nop (void);
1395 gbind *gimple_build_bind (tree, gimple_seq, tree);
1396 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1397 vec<tree, va_gc> *, vec<tree, va_gc> *,
1398 vec<tree, va_gc> *);
1399 gcatch *gimple_build_catch (tree, gimple_seq);
1400 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1401 geh_mnt *gimple_build_eh_must_not_throw (tree);
1402 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1403 gtry *gimple_build_try (gimple_seq, gimple_seq,
1404 enum gimple_try_flags);
1405 gimple gimple_build_wce (gimple_seq);
1406 gresx *gimple_build_resx (int);
1407 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1408 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1409 geh_dispatch *gimple_build_eh_dispatch (int);
1410 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1411 #define gimple_build_debug_bind(var,val,stmt) \
1412 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1413 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple MEM_STAT_DECL);
1414 #define gimple_build_debug_source_bind(var,val,stmt) \
1415 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1416 gomp_critical *gimple_build_omp_critical (gimple_seq, tree);
1417 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1418 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1419 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1420 tree, tree);
1421 gimple gimple_build_omp_section (gimple_seq);
1422 gimple gimple_build_omp_master (gimple_seq);
1423 gimple gimple_build_omp_taskgroup (gimple_seq);
1424 gomp_continue *gimple_build_omp_continue (tree, tree);
1425 gimple gimple_build_omp_ordered (gimple_seq);
1426 gimple gimple_build_omp_return (bool);
1427 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1428 gimple gimple_build_omp_sections_switch (void);
1429 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1430 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1431 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1432 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1433 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1434 gtransaction *gimple_build_transaction (gimple_seq, tree);
1435 extern void gimple_seq_add_stmt (gimple_seq *, gimple);
1436 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple);
1437 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1438 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1439 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1440 location_t);
1441 extern void annotate_all_with_location (gimple_seq, location_t);
1442 bool empty_body_p (gimple_seq);
1443 gimple_seq gimple_seq_copy (gimple_seq);
1444 bool gimple_call_same_target_p (const_gimple, const_gimple);
1445 int gimple_call_flags (const_gimple);
1446 int gimple_call_arg_flags (const gcall *, unsigned);
1447 int gimple_call_return_flags (const gcall *);
1448 bool gimple_assign_copy_p (gimple);
1449 bool gimple_assign_ssa_name_copy_p (gimple);
1450 bool gimple_assign_unary_nop_p (gimple);
1451 void gimple_set_bb (gimple, basic_block);
1452 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1453 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1454 tree, tree, tree);
1455 tree gimple_get_lhs (const_gimple);
1456 void gimple_set_lhs (gimple, tree);
1457 gimple gimple_copy (gimple);
1458 bool gimple_has_side_effects (const_gimple);
1459 bool gimple_could_trap_p_1 (gimple, bool, bool);
1460 bool gimple_could_trap_p (gimple);
1461 bool gimple_assign_rhs_could_trap_p (gimple);
1462 extern void dump_gimple_statistics (void);
1463 unsigned get_gimple_rhs_num_ops (enum tree_code);
1464 extern tree canonicalize_cond_expr_cond (tree);
1465 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1466 extern bool gimple_compare_field_offset (tree, tree);
1467 extern tree gimple_unsigned_type (tree);
1468 extern tree gimple_signed_type (tree);
1469 extern alias_set_type gimple_get_alias_set (tree);
1470 extern bool gimple_ior_addresses_taken (bitmap, gimple);
1471 extern bool gimple_builtin_call_types_compatible_p (const_gimple, tree);
1472 extern bool gimple_call_builtin_p (const_gimple);
1473 extern bool gimple_call_builtin_p (const_gimple, enum built_in_class);
1474 extern bool gimple_call_builtin_p (const_gimple, enum built_in_function);
1475 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1476 extern void dump_decl_set (FILE *, bitmap);
1477 extern bool nonfreeing_call_p (gimple);
1478 extern bool infer_nonnull_range (gimple, tree);
1479 extern bool infer_nonnull_range_by_dereference (gimple, tree);
1480 extern bool infer_nonnull_range_by_attribute (gimple, tree);
1481 extern void sort_case_labels (vec<tree>);
1482 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1483 extern void gimple_seq_set_location (gimple_seq, location_t);
1484 extern void gimple_seq_discard (gimple_seq);
1485 extern void maybe_remove_unused_call_args (struct function *, gimple);
1487 /* Formal (expression) temporary table handling: multiple occurrences of
1488 the same scalar expression are evaluated into the same temporary. */
1490 typedef struct gimple_temp_hash_elt
1492 tree val; /* Key */
1493 tree temp; /* Value */
1494 } elt_t;
1496 /* Get the number of the next statement uid to be allocated. */
1497 static inline unsigned int
1498 gimple_stmt_max_uid (struct function *fn)
1500 return fn->last_stmt_uid;
1503 /* Set the number of the next statement uid to be allocated. */
1504 static inline void
1505 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1507 fn->last_stmt_uid = maxid;
1510 /* Set the number of the next statement uid to be allocated. */
1511 static inline unsigned int
1512 inc_gimple_stmt_max_uid (struct function *fn)
1514 return fn->last_stmt_uid++;
1517 /* Return the first node in GIMPLE sequence S. */
1519 static inline gimple_seq_node
1520 gimple_seq_first (gimple_seq s)
1522 return s;
1526 /* Return the first statement in GIMPLE sequence S. */
1528 static inline gimple
1529 gimple_seq_first_stmt (gimple_seq s)
1531 gimple_seq_node n = gimple_seq_first (s);
1532 return n;
1535 /* Return the first statement in GIMPLE sequence S as a gbind *,
1536 verifying that it has code GIMPLE_BIND in a checked build. */
1538 static inline gbind *
1539 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1541 gimple_seq_node n = gimple_seq_first (s);
1542 return as_a <gbind *> (n);
1546 /* Return the last node in GIMPLE sequence S. */
1548 static inline gimple_seq_node
1549 gimple_seq_last (gimple_seq s)
1551 return s ? s->prev : NULL;
1555 /* Return the last statement in GIMPLE sequence S. */
1557 static inline gimple
1558 gimple_seq_last_stmt (gimple_seq s)
1560 gimple_seq_node n = gimple_seq_last (s);
1561 return n;
1565 /* Set the last node in GIMPLE sequence *PS to LAST. */
1567 static inline void
1568 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1570 (*ps)->prev = last;
1574 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1576 static inline void
1577 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1579 *ps = first;
1583 /* Return true if GIMPLE sequence S is empty. */
1585 static inline bool
1586 gimple_seq_empty_p (gimple_seq s)
1588 return s == NULL;
1591 /* Allocate a new sequence and initialize its first element with STMT. */
1593 static inline gimple_seq
1594 gimple_seq_alloc_with_stmt (gimple stmt)
1596 gimple_seq seq = NULL;
1597 gimple_seq_add_stmt (&seq, stmt);
1598 return seq;
1602 /* Returns the sequence of statements in BB. */
1604 static inline gimple_seq
1605 bb_seq (const_basic_block bb)
1607 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1610 static inline gimple_seq *
1611 bb_seq_addr (basic_block bb)
1613 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1616 /* Sets the sequence of statements in BB to SEQ. */
1618 static inline void
1619 set_bb_seq (basic_block bb, gimple_seq seq)
1621 gcc_checking_assert (!(bb->flags & BB_RTL));
1622 bb->il.gimple.seq = seq;
1626 /* Return the code for GIMPLE statement G. */
1628 static inline enum gimple_code
1629 gimple_code (const_gimple g)
1631 return g->code;
1635 /* Return the GSS code used by a GIMPLE code. */
1637 static inline enum gimple_statement_structure_enum
1638 gss_for_code (enum gimple_code code)
1640 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1641 return gss_for_code_[code];
1645 /* Return which GSS code is used by GS. */
1647 static inline enum gimple_statement_structure_enum
1648 gimple_statement_structure (gimple gs)
1650 return gss_for_code (gimple_code (gs));
1654 /* Return true if statement G has sub-statements. This is only true for
1655 High GIMPLE statements. */
1657 static inline bool
1658 gimple_has_substatements (gimple g)
1660 switch (gimple_code (g))
1662 case GIMPLE_BIND:
1663 case GIMPLE_CATCH:
1664 case GIMPLE_EH_FILTER:
1665 case GIMPLE_EH_ELSE:
1666 case GIMPLE_TRY:
1667 case GIMPLE_OMP_FOR:
1668 case GIMPLE_OMP_MASTER:
1669 case GIMPLE_OMP_TASKGROUP:
1670 case GIMPLE_OMP_ORDERED:
1671 case GIMPLE_OMP_SECTION:
1672 case GIMPLE_OMP_PARALLEL:
1673 case GIMPLE_OMP_TASK:
1674 case GIMPLE_OMP_SECTIONS:
1675 case GIMPLE_OMP_SINGLE:
1676 case GIMPLE_OMP_TARGET:
1677 case GIMPLE_OMP_TEAMS:
1678 case GIMPLE_OMP_CRITICAL:
1679 case GIMPLE_WITH_CLEANUP_EXPR:
1680 case GIMPLE_TRANSACTION:
1681 return true;
1683 default:
1684 return false;
1689 /* Return the basic block holding statement G. */
1691 static inline basic_block
1692 gimple_bb (const_gimple g)
1694 return g->bb;
1698 /* Return the lexical scope block holding statement G. */
1700 static inline tree
1701 gimple_block (const_gimple g)
1703 return LOCATION_BLOCK (g->location);
1707 /* Set BLOCK to be the lexical scope block holding statement G. */
1709 static inline void
1710 gimple_set_block (gimple g, tree block)
1712 if (block)
1713 g->location =
1714 COMBINE_LOCATION_DATA (line_table, g->location, block);
1715 else
1716 g->location = LOCATION_LOCUS (g->location);
1720 /* Return location information for statement G. */
1722 static inline location_t
1723 gimple_location (const_gimple g)
1725 return g->location;
1728 /* Return location information for statement G if g is not NULL.
1729 Otherwise, UNKNOWN_LOCATION is returned. */
1731 static inline location_t
1732 gimple_location_safe (const_gimple g)
1734 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1737 /* Return pointer to location information for statement G. */
1739 static inline const location_t *
1740 gimple_location_ptr (const_gimple g)
1742 return &g->location;
1746 /* Set location information for statement G. */
1748 static inline void
1749 gimple_set_location (gimple g, location_t location)
1751 g->location = location;
1755 /* Return true if G contains location information. */
1757 static inline bool
1758 gimple_has_location (const_gimple g)
1760 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1764 /* Return the file name of the location of STMT. */
1766 static inline const char *
1767 gimple_filename (const_gimple stmt)
1769 return LOCATION_FILE (gimple_location (stmt));
1773 /* Return the line number of the location of STMT. */
1775 static inline int
1776 gimple_lineno (const_gimple stmt)
1778 return LOCATION_LINE (gimple_location (stmt));
1782 /* Determine whether SEQ is a singleton. */
1784 static inline bool
1785 gimple_seq_singleton_p (gimple_seq seq)
1787 return ((gimple_seq_first (seq) != NULL)
1788 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1791 /* Return true if no warnings should be emitted for statement STMT. */
1793 static inline bool
1794 gimple_no_warning_p (const_gimple stmt)
1796 return stmt->no_warning;
1799 /* Set the no_warning flag of STMT to NO_WARNING. */
1801 static inline void
1802 gimple_set_no_warning (gimple stmt, bool no_warning)
1804 stmt->no_warning = (unsigned) no_warning;
1807 /* Set the visited status on statement STMT to VISITED_P.
1809 Please note that this 'visited' property of the gimple statement is
1810 supposed to be undefined at pass boundaries. This means that a
1811 given pass should not assume it contains any useful value when the
1812 pass starts and thus can set it to any value it sees fit.
1814 You can learn more about the visited property of the gimple
1815 statement by reading the comments of the 'visited' data member of
1816 struct gimple statement_base.
1819 static inline void
1820 gimple_set_visited (gimple stmt, bool visited_p)
1822 stmt->visited = (unsigned) visited_p;
1826 /* Return the visited status for statement STMT.
1828 Please note that this 'visited' property of the gimple statement is
1829 supposed to be undefined at pass boundaries. This means that a
1830 given pass should not assume it contains any useful value when the
1831 pass starts and thus can set it to any value it sees fit.
1833 You can learn more about the visited property of the gimple
1834 statement by reading the comments of the 'visited' data member of
1835 struct gimple statement_base. */
1837 static inline bool
1838 gimple_visited_p (gimple stmt)
1840 return stmt->visited;
1844 /* Set pass local flag PLF on statement STMT to VAL_P.
1846 Please note that this PLF property of the gimple statement is
1847 supposed to be undefined at pass boundaries. This means that a
1848 given pass should not assume it contains any useful value when the
1849 pass starts and thus can set it to any value it sees fit.
1851 You can learn more about the PLF property by reading the comment of
1852 the 'plf' data member of struct gimple_statement_structure. */
1854 static inline void
1855 gimple_set_plf (gimple stmt, enum plf_mask plf, bool val_p)
1857 if (val_p)
1858 stmt->plf |= (unsigned int) plf;
1859 else
1860 stmt->plf &= ~((unsigned int) plf);
1864 /* Return the value of pass local flag PLF on statement STMT.
1866 Please note that this 'plf' property of the gimple statement is
1867 supposed to be undefined at pass boundaries. This means that a
1868 given pass should not assume it contains any useful value when the
1869 pass starts and thus can set it to any value it sees fit.
1871 You can learn more about the plf property by reading the comment of
1872 the 'plf' data member of struct gimple_statement_structure. */
1874 static inline unsigned int
1875 gimple_plf (gimple stmt, enum plf_mask plf)
1877 return stmt->plf & ((unsigned int) plf);
1881 /* Set the UID of statement.
1883 Please note that this UID property is supposed to be undefined at
1884 pass boundaries. This means that a given pass should not assume it
1885 contains any useful value when the pass starts and thus can set it
1886 to any value it sees fit. */
1888 static inline void
1889 gimple_set_uid (gimple g, unsigned uid)
1891 g->uid = uid;
1895 /* Return the UID of statement.
1897 Please note that this UID property is supposed to be undefined at
1898 pass boundaries. This means that a given pass should not assume it
1899 contains any useful value when the pass starts and thus can set it
1900 to any value it sees fit. */
1902 static inline unsigned
1903 gimple_uid (const_gimple g)
1905 return g->uid;
1909 /* Make statement G a singleton sequence. */
1911 static inline void
1912 gimple_init_singleton (gimple g)
1914 g->next = NULL;
1915 g->prev = g;
1919 /* Return true if GIMPLE statement G has register or memory operands. */
1921 static inline bool
1922 gimple_has_ops (const_gimple g)
1924 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1927 template <>
1928 template <>
1929 inline bool
1930 is_a_helper <const gimple_statement_with_ops *>::test (const_gimple gs)
1932 return gimple_has_ops (gs);
1935 template <>
1936 template <>
1937 inline bool
1938 is_a_helper <gimple_statement_with_ops *>::test (gimple gs)
1940 return gimple_has_ops (gs);
1943 /* Return true if GIMPLE statement G has memory operands. */
1945 static inline bool
1946 gimple_has_mem_ops (const_gimple g)
1948 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1951 template <>
1952 template <>
1953 inline bool
1954 is_a_helper <const gimple_statement_with_memory_ops *>::test (const_gimple gs)
1956 return gimple_has_mem_ops (gs);
1959 template <>
1960 template <>
1961 inline bool
1962 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple gs)
1964 return gimple_has_mem_ops (gs);
1967 /* Return the set of USE operands for statement G. */
1969 static inline struct use_optype_d *
1970 gimple_use_ops (const_gimple g)
1972 const gimple_statement_with_ops *ops_stmt =
1973 dyn_cast <const gimple_statement_with_ops *> (g);
1974 if (!ops_stmt)
1975 return NULL;
1976 return ops_stmt->use_ops;
1980 /* Set USE to be the set of USE operands for statement G. */
1982 static inline void
1983 gimple_set_use_ops (gimple g, struct use_optype_d *use)
1985 gimple_statement_with_ops *ops_stmt =
1986 as_a <gimple_statement_with_ops *> (g);
1987 ops_stmt->use_ops = use;
1991 /* Return the single VUSE operand of the statement G. */
1993 static inline tree
1994 gimple_vuse (const_gimple g)
1996 const gimple_statement_with_memory_ops *mem_ops_stmt =
1997 dyn_cast <const gimple_statement_with_memory_ops *> (g);
1998 if (!mem_ops_stmt)
1999 return NULL_TREE;
2000 return mem_ops_stmt->vuse;
2003 /* Return the single VDEF operand of the statement G. */
2005 static inline tree
2006 gimple_vdef (const_gimple g)
2008 const gimple_statement_with_memory_ops *mem_ops_stmt =
2009 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2010 if (!mem_ops_stmt)
2011 return NULL_TREE;
2012 return mem_ops_stmt->vdef;
2015 /* Return the single VUSE operand of the statement G. */
2017 static inline tree *
2018 gimple_vuse_ptr (gimple g)
2020 gimple_statement_with_memory_ops *mem_ops_stmt =
2021 dyn_cast <gimple_statement_with_memory_ops *> (g);
2022 if (!mem_ops_stmt)
2023 return NULL;
2024 return &mem_ops_stmt->vuse;
2027 /* Return the single VDEF operand of the statement G. */
2029 static inline tree *
2030 gimple_vdef_ptr (gimple g)
2032 gimple_statement_with_memory_ops *mem_ops_stmt =
2033 dyn_cast <gimple_statement_with_memory_ops *> (g);
2034 if (!mem_ops_stmt)
2035 return NULL;
2036 return &mem_ops_stmt->vdef;
2039 /* Set the single VUSE operand of the statement G. */
2041 static inline void
2042 gimple_set_vuse (gimple g, tree vuse)
2044 gimple_statement_with_memory_ops *mem_ops_stmt =
2045 as_a <gimple_statement_with_memory_ops *> (g);
2046 mem_ops_stmt->vuse = vuse;
2049 /* Set the single VDEF operand of the statement G. */
2051 static inline void
2052 gimple_set_vdef (gimple g, tree vdef)
2054 gimple_statement_with_memory_ops *mem_ops_stmt =
2055 as_a <gimple_statement_with_memory_ops *> (g);
2056 mem_ops_stmt->vdef = vdef;
2060 /* Return true if statement G has operands and the modified field has
2061 been set. */
2063 static inline bool
2064 gimple_modified_p (const_gimple g)
2066 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2070 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2071 a MODIFIED field. */
2073 static inline void
2074 gimple_set_modified (gimple s, bool modifiedp)
2076 if (gimple_has_ops (s))
2077 s->modified = (unsigned) modifiedp;
2081 /* Return the tree code for the expression computed by STMT. This is
2082 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2083 GIMPLE_CALL, return CALL_EXPR as the expression code for
2084 consistency. This is useful when the caller needs to deal with the
2085 three kinds of computation that GIMPLE supports. */
2087 static inline enum tree_code
2088 gimple_expr_code (const_gimple stmt)
2090 enum gimple_code code = gimple_code (stmt);
2091 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2092 return (enum tree_code) stmt->subcode;
2093 else
2095 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2096 return CALL_EXPR;
2101 /* Return true if statement STMT contains volatile operands. */
2103 static inline bool
2104 gimple_has_volatile_ops (const_gimple stmt)
2106 if (gimple_has_mem_ops (stmt))
2107 return stmt->has_volatile_ops;
2108 else
2109 return false;
2113 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2115 static inline void
2116 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
2118 if (gimple_has_mem_ops (stmt))
2119 stmt->has_volatile_ops = (unsigned) volatilep;
2122 /* Return true if STMT is in a transaction. */
2124 static inline bool
2125 gimple_in_transaction (gimple stmt)
2127 return bb_in_transaction (gimple_bb (stmt));
2130 /* Return true if statement STMT may access memory. */
2132 static inline bool
2133 gimple_references_memory_p (gimple stmt)
2135 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2139 /* Return the subcode for OMP statement S. */
2141 static inline unsigned
2142 gimple_omp_subcode (const_gimple s)
2144 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2145 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2146 return s->subcode;
2149 /* Set the subcode for OMP statement S to SUBCODE. */
2151 static inline void
2152 gimple_omp_set_subcode (gimple s, unsigned int subcode)
2154 /* We only have 16 bits for the subcode. Assert that we are not
2155 overflowing it. */
2156 gcc_gimple_checking_assert (subcode < (1 << 16));
2157 s->subcode = subcode;
2160 /* Set the nowait flag on OMP_RETURN statement S. */
2162 static inline void
2163 gimple_omp_return_set_nowait (gimple s)
2165 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2166 s->subcode |= GF_OMP_RETURN_NOWAIT;
2170 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2171 flag set. */
2173 static inline bool
2174 gimple_omp_return_nowait_p (const_gimple g)
2176 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2177 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2181 /* Set the LHS of OMP return. */
2183 static inline void
2184 gimple_omp_return_set_lhs (gimple g, tree lhs)
2186 gimple_statement_omp_return *omp_return_stmt =
2187 as_a <gimple_statement_omp_return *> (g);
2188 omp_return_stmt->val = lhs;
2192 /* Get the LHS of OMP return. */
2194 static inline tree
2195 gimple_omp_return_lhs (const_gimple g)
2197 const gimple_statement_omp_return *omp_return_stmt =
2198 as_a <const gimple_statement_omp_return *> (g);
2199 return omp_return_stmt->val;
2203 /* Return a pointer to the LHS of OMP return. */
2205 static inline tree *
2206 gimple_omp_return_lhs_ptr (gimple g)
2208 gimple_statement_omp_return *omp_return_stmt =
2209 as_a <gimple_statement_omp_return *> (g);
2210 return &omp_return_stmt->val;
2214 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2215 flag set. */
2217 static inline bool
2218 gimple_omp_section_last_p (const_gimple g)
2220 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2221 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2225 /* Set the GF_OMP_SECTION_LAST flag on G. */
2227 static inline void
2228 gimple_omp_section_set_last (gimple g)
2230 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2231 g->subcode |= GF_OMP_SECTION_LAST;
2235 /* Return true if OMP parallel statement G has the
2236 GF_OMP_PARALLEL_COMBINED flag set. */
2238 static inline bool
2239 gimple_omp_parallel_combined_p (const_gimple g)
2241 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2242 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2246 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2247 value of COMBINED_P. */
2249 static inline void
2250 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
2252 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2253 if (combined_p)
2254 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2255 else
2256 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2260 /* Return true if OMP atomic load/store statement G has the
2261 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2263 static inline bool
2264 gimple_omp_atomic_need_value_p (const_gimple g)
2266 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2267 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2268 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2272 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2274 static inline void
2275 gimple_omp_atomic_set_need_value (gimple g)
2277 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2278 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2279 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2283 /* Return true if OMP atomic load/store statement G has the
2284 GF_OMP_ATOMIC_SEQ_CST flag set. */
2286 static inline bool
2287 gimple_omp_atomic_seq_cst_p (const_gimple g)
2289 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2290 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2291 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2295 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2297 static inline void
2298 gimple_omp_atomic_set_seq_cst (gimple g)
2300 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2301 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2302 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2306 /* Return the number of operands for statement GS. */
2308 static inline unsigned
2309 gimple_num_ops (const_gimple gs)
2311 return gs->num_ops;
2315 /* Set the number of operands for statement GS. */
2317 static inline void
2318 gimple_set_num_ops (gimple gs, unsigned num_ops)
2320 gs->num_ops = num_ops;
2324 /* Return the array of operands for statement GS. */
2326 static inline tree *
2327 gimple_ops (gimple gs)
2329 size_t off;
2331 /* All the tuples have their operand vector at the very bottom
2332 of the structure. Note that those structures that do not
2333 have an operand vector have a zero offset. */
2334 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2335 gcc_gimple_checking_assert (off != 0);
2337 return (tree *) ((char *) gs + off);
2341 /* Return operand I for statement GS. */
2343 static inline tree
2344 gimple_op (const_gimple gs, unsigned i)
2346 if (gimple_has_ops (gs))
2348 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2349 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2351 else
2352 return NULL_TREE;
2355 /* Return a pointer to operand I for statement GS. */
2357 static inline tree *
2358 gimple_op_ptr (const_gimple gs, unsigned i)
2360 if (gimple_has_ops (gs))
2362 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2363 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
2365 else
2366 return NULL;
2369 /* Set operand I of statement GS to OP. */
2371 static inline void
2372 gimple_set_op (gimple gs, unsigned i, tree op)
2374 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2376 /* Note. It may be tempting to assert that OP matches
2377 is_gimple_operand, but that would be wrong. Different tuples
2378 accept slightly different sets of tree operands. Each caller
2379 should perform its own validation. */
2380 gimple_ops (gs)[i] = op;
2383 /* Return true if GS is a GIMPLE_ASSIGN. */
2385 static inline bool
2386 is_gimple_assign (const_gimple gs)
2388 return gimple_code (gs) == GIMPLE_ASSIGN;
2391 /* Determine if expression CODE is one of the valid expressions that can
2392 be used on the RHS of GIMPLE assignments. */
2394 static inline enum gimple_rhs_class
2395 get_gimple_rhs_class (enum tree_code code)
2397 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2400 /* Return the LHS of assignment statement GS. */
2402 static inline tree
2403 gimple_assign_lhs (const gassign *gs)
2405 return gs->op[0];
2408 static inline tree
2409 gimple_assign_lhs (const_gimple gs)
2411 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2412 return gimple_assign_lhs (ass);
2416 /* Return a pointer to the LHS of assignment statement GS. */
2418 static inline tree *
2419 gimple_assign_lhs_ptr (const gassign *gs)
2421 return const_cast<tree *> (&gs->op[0]);
2424 static inline tree *
2425 gimple_assign_lhs_ptr (const_gimple gs)
2427 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2428 return gimple_assign_lhs_ptr (ass);
2432 /* Set LHS to be the LHS operand of assignment statement GS. */
2434 static inline void
2435 gimple_assign_set_lhs (gassign *gs, tree lhs)
2437 gs->op[0] = lhs;
2439 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2440 SSA_NAME_DEF_STMT (lhs) = gs;
2443 static inline void
2444 gimple_assign_set_lhs (gimple gs, tree lhs)
2446 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2447 gimple_assign_set_lhs (ass, lhs);
2451 /* Return the first operand on the RHS of assignment statement GS. */
2453 static inline tree
2454 gimple_assign_rhs1 (const gassign *gs)
2456 return gs->op[1];
2459 static inline tree
2460 gimple_assign_rhs1 (const_gimple gs)
2462 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2463 return gimple_assign_rhs1 (ass);
2467 /* Return a pointer to the first operand on the RHS of assignment
2468 statement GS. */
2470 static inline tree *
2471 gimple_assign_rhs1_ptr (const gassign *gs)
2473 return const_cast<tree *> (&gs->op[1]);
2476 static inline tree *
2477 gimple_assign_rhs1_ptr (const_gimple gs)
2479 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2480 return gimple_assign_rhs1_ptr (ass);
2483 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2485 static inline void
2486 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2488 gs->op[1] = rhs;
2491 static inline void
2492 gimple_assign_set_rhs1 (gimple gs, tree rhs)
2494 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2495 gimple_assign_set_rhs1 (ass, rhs);
2499 /* Return the second operand on the RHS of assignment statement GS.
2500 If GS does not have two operands, NULL is returned instead. */
2502 static inline tree
2503 gimple_assign_rhs2 (const gassign *gs)
2505 if (gimple_num_ops (gs) >= 3)
2506 return gs->op[2];
2507 else
2508 return NULL_TREE;
2511 static inline tree
2512 gimple_assign_rhs2 (const_gimple gs)
2514 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2515 return gimple_assign_rhs2 (ass);
2519 /* Return a pointer to the second operand on the RHS of assignment
2520 statement GS. */
2522 static inline tree *
2523 gimple_assign_rhs2_ptr (const gassign *gs)
2525 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2526 return const_cast<tree *> (&gs->op[2]);
2529 static inline tree *
2530 gimple_assign_rhs2_ptr (const_gimple gs)
2532 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2533 return gimple_assign_rhs2_ptr (ass);
2537 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2539 static inline void
2540 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2542 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2543 gs->op[2] = rhs;
2546 static inline void
2547 gimple_assign_set_rhs2 (gimple gs, tree rhs)
2549 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2550 return gimple_assign_set_rhs2 (ass, rhs);
2553 /* Return the third operand on the RHS of assignment statement GS.
2554 If GS does not have two operands, NULL is returned instead. */
2556 static inline tree
2557 gimple_assign_rhs3 (const gassign *gs)
2559 if (gimple_num_ops (gs) >= 4)
2560 return gs->op[3];
2561 else
2562 return NULL_TREE;
2565 static inline tree
2566 gimple_assign_rhs3 (const_gimple gs)
2568 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2569 return gimple_assign_rhs3 (ass);
2572 /* Return a pointer to the third operand on the RHS of assignment
2573 statement GS. */
2575 static inline tree *
2576 gimple_assign_rhs3_ptr (const_gimple gs)
2578 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2579 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2580 return const_cast<tree *> (&ass->op[3]);
2584 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2586 static inline void
2587 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2589 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2590 gs->op[3] = rhs;
2593 static inline void
2594 gimple_assign_set_rhs3 (gimple gs, tree rhs)
2596 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2597 gimple_assign_set_rhs3 (ass, rhs);
2601 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2602 which expect to see only two operands. */
2604 static inline void
2605 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2606 tree op1, tree op2)
2608 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2611 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2612 which expect to see only one operands. */
2614 static inline void
2615 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2616 tree op1)
2618 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2621 /* Returns true if GS is a nontemporal move. */
2623 static inline bool
2624 gimple_assign_nontemporal_move_p (const gassign *gs)
2626 return gs->nontemporal_move;
2629 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2631 static inline void
2632 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
2634 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2635 gs->nontemporal_move = nontemporal;
2639 /* Return the code of the expression computed on the rhs of assignment
2640 statement GS. In case that the RHS is a single object, returns the
2641 tree code of the object. */
2643 static inline enum tree_code
2644 gimple_assign_rhs_code (const gassign *gs)
2646 enum tree_code code = (enum tree_code) gs->subcode;
2647 /* While we initially set subcode to the TREE_CODE of the rhs for
2648 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2649 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2650 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2651 code = TREE_CODE (gs->op[1]);
2653 return code;
2656 static inline enum tree_code
2657 gimple_assign_rhs_code (const_gimple gs)
2659 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2660 return gimple_assign_rhs_code (ass);
2664 /* Set CODE to be the code for the expression computed on the RHS of
2665 assignment S. */
2667 static inline void
2668 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
2670 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2671 s->subcode = code;
2675 /* Return the gimple rhs class of the code of the expression computed on
2676 the rhs of assignment statement GS.
2677 This will never return GIMPLE_INVALID_RHS. */
2679 static inline enum gimple_rhs_class
2680 gimple_assign_rhs_class (const_gimple gs)
2682 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2685 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2686 there is no operator associated with the assignment itself.
2687 Unlike gimple_assign_copy_p, this predicate returns true for
2688 any RHS operand, including those that perform an operation
2689 and do not have the semantics of a copy, such as COND_EXPR. */
2691 static inline bool
2692 gimple_assign_single_p (const_gimple gs)
2694 return (is_gimple_assign (gs)
2695 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2698 /* Return true if GS performs a store to its lhs. */
2700 static inline bool
2701 gimple_store_p (const_gimple gs)
2703 tree lhs = gimple_get_lhs (gs);
2704 return lhs && !is_gimple_reg (lhs);
2707 /* Return true if GS is an assignment that loads from its rhs1. */
2709 static inline bool
2710 gimple_assign_load_p (const_gimple gs)
2712 tree rhs;
2713 if (!gimple_assign_single_p (gs))
2714 return false;
2715 rhs = gimple_assign_rhs1 (gs);
2716 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2717 return true;
2718 rhs = get_base_address (rhs);
2719 return (DECL_P (rhs)
2720 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2724 /* Return true if S is a type-cast assignment. */
2726 static inline bool
2727 gimple_assign_cast_p (const_gimple s)
2729 if (is_gimple_assign (s))
2731 enum tree_code sc = gimple_assign_rhs_code (s);
2732 return CONVERT_EXPR_CODE_P (sc)
2733 || sc == VIEW_CONVERT_EXPR
2734 || sc == FIX_TRUNC_EXPR;
2737 return false;
2740 /* Return true if S is a clobber statement. */
2742 static inline bool
2743 gimple_clobber_p (const_gimple s)
2745 return gimple_assign_single_p (s)
2746 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2749 /* Return true if GS is a GIMPLE_CALL. */
2751 static inline bool
2752 is_gimple_call (const_gimple gs)
2754 return gimple_code (gs) == GIMPLE_CALL;
2757 /* Return the LHS of call statement GS. */
2759 static inline tree
2760 gimple_call_lhs (const gcall *gs)
2762 return gs->op[0];
2765 static inline tree
2766 gimple_call_lhs (const_gimple gs)
2768 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2769 return gimple_call_lhs (gc);
2773 /* Return a pointer to the LHS of call statement GS. */
2775 static inline tree *
2776 gimple_call_lhs_ptr (const gcall *gs)
2778 return const_cast<tree *> (&gs->op[0]);
2781 static inline tree *
2782 gimple_call_lhs_ptr (const_gimple gs)
2784 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2785 return gimple_call_lhs_ptr (gc);
2789 /* Set LHS to be the LHS operand of call statement GS. */
2791 static inline void
2792 gimple_call_set_lhs (gcall *gs, tree lhs)
2794 gs->op[0] = lhs;
2795 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2796 SSA_NAME_DEF_STMT (lhs) = gs;
2799 static inline void
2800 gimple_call_set_lhs (gimple gs, tree lhs)
2802 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2803 gimple_call_set_lhs (gc, lhs);
2807 /* Return true if call GS calls an internal-only function, as enumerated
2808 by internal_fn. */
2810 static inline bool
2811 gimple_call_internal_p (const gcall *gs)
2813 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2816 static inline bool
2817 gimple_call_internal_p (const_gimple gs)
2819 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2820 return gimple_call_internal_p (gc);
2824 /* Return true if call GS is marked as instrumented by
2825 Pointer Bounds Checker. */
2827 static inline bool
2828 gimple_call_with_bounds_p (const gcall *gs)
2830 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2833 static inline bool
2834 gimple_call_with_bounds_p (const_gimple gs)
2836 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2837 return gimple_call_with_bounds_p (gc);
2841 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2842 Pointer Bounds Checker. */
2844 static inline void
2845 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2847 if (with_bounds)
2848 gs->subcode |= GF_CALL_WITH_BOUNDS;
2849 else
2850 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2853 static inline void
2854 gimple_call_set_with_bounds (gimple gs, bool with_bounds)
2856 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2857 gimple_call_set_with_bounds (gc, with_bounds);
2861 /* Return the target of internal call GS. */
2863 static inline enum internal_fn
2864 gimple_call_internal_fn (const gcall *gs)
2866 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2867 return gs->u.internal_fn;
2870 static inline enum internal_fn
2871 gimple_call_internal_fn (const_gimple gs)
2873 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2874 return gimple_call_internal_fn (gc);
2877 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2878 that could alter control flow. */
2880 static inline void
2881 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2883 if (ctrl_altering_p)
2884 s->subcode |= GF_CALL_CTRL_ALTERING;
2885 else
2886 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2889 static inline void
2890 gimple_call_set_ctrl_altering (gimple s, bool ctrl_altering_p)
2892 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2893 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2896 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2897 flag is set. Such call could not be a stmt in the middle of a bb. */
2899 static inline bool
2900 gimple_call_ctrl_altering_p (const gcall *gs)
2902 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2905 static inline bool
2906 gimple_call_ctrl_altering_p (const_gimple gs)
2908 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2909 return gimple_call_ctrl_altering_p (gc);
2913 /* Return the function type of the function called by GS. */
2915 static inline tree
2916 gimple_call_fntype (const gcall *gs)
2918 if (gimple_call_internal_p (gs))
2919 return NULL_TREE;
2920 return gs->u.fntype;
2923 static inline tree
2924 gimple_call_fntype (const_gimple gs)
2926 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2927 return gimple_call_fntype (call_stmt);
2930 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2932 static inline void
2933 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2935 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2936 call_stmt->u.fntype = fntype;
2940 /* Return the tree node representing the function called by call
2941 statement GS. */
2943 static inline tree
2944 gimple_call_fn (const gcall *gs)
2946 return gs->op[1];
2949 static inline tree
2950 gimple_call_fn (const_gimple gs)
2952 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2953 return gimple_call_fn (gc);
2956 /* Return a pointer to the tree node representing the function called by call
2957 statement GS. */
2959 static inline tree *
2960 gimple_call_fn_ptr (const gcall *gs)
2962 return const_cast<tree *> (&gs->op[1]);
2965 static inline tree *
2966 gimple_call_fn_ptr (const_gimple gs)
2968 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2969 return gimple_call_fn_ptr (gc);
2973 /* Set FN to be the function called by call statement GS. */
2975 static inline void
2976 gimple_call_set_fn (gcall *gs, tree fn)
2978 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2979 gs->op[1] = fn;
2983 /* Set FNDECL to be the function called by call statement GS. */
2985 static inline void
2986 gimple_call_set_fndecl (gcall *gs, tree decl)
2988 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
2989 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
2990 build_pointer_type (TREE_TYPE (decl)), decl);
2993 static inline void
2994 gimple_call_set_fndecl (gimple gs, tree decl)
2996 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2997 gimple_call_set_fndecl (gc, decl);
3001 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3003 static inline void
3004 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3006 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3007 call_stmt->u.internal_fn = fn;
3011 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3012 Otherwise return NULL. This function is analogous to
3013 get_callee_fndecl in tree land. */
3015 static inline tree
3016 gimple_call_fndecl (const gcall *gs)
3018 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3021 static inline tree
3022 gimple_call_fndecl (const_gimple gs)
3024 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3025 return gimple_call_fndecl (gc);
3029 /* Return the type returned by call statement GS. */
3031 static inline tree
3032 gimple_call_return_type (const gcall *gs)
3034 tree type = gimple_call_fntype (gs);
3036 if (type == NULL_TREE)
3037 return TREE_TYPE (gimple_call_lhs (gs));
3039 /* The type returned by a function is the type of its
3040 function type. */
3041 return TREE_TYPE (type);
3045 /* Return the static chain for call statement GS. */
3047 static inline tree
3048 gimple_call_chain (const gcall *gs)
3050 return gs->op[2];
3053 static inline tree
3054 gimple_call_chain (const_gimple gs)
3056 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3057 return gimple_call_chain (gc);
3061 /* Return a pointer to the static chain for call statement CALL_STMT. */
3063 static inline tree *
3064 gimple_call_chain_ptr (const gcall *call_stmt)
3066 return const_cast<tree *> (&call_stmt->op[2]);
3069 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3071 static inline void
3072 gimple_call_set_chain (gcall *call_stmt, tree chain)
3074 call_stmt->op[2] = chain;
3078 /* Return the number of arguments used by call statement GS. */
3080 static inline unsigned
3081 gimple_call_num_args (const gcall *gs)
3083 return gimple_num_ops (gs) - 3;
3086 static inline unsigned
3087 gimple_call_num_args (const_gimple gs)
3089 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3090 return gimple_call_num_args (gc);
3094 /* Return the argument at position INDEX for call statement GS. */
3096 static inline tree
3097 gimple_call_arg (const gcall *gs, unsigned index)
3099 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3100 return gs->op[index + 3];
3103 static inline tree
3104 gimple_call_arg (const_gimple gs, unsigned index)
3106 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3107 return gimple_call_arg (gc, index);
3111 /* Return a pointer to the argument at position INDEX for call
3112 statement GS. */
3114 static inline tree *
3115 gimple_call_arg_ptr (const gcall *gs, unsigned index)
3117 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3118 return const_cast<tree *> (&gs->op[index + 3]);
3121 static inline tree *
3122 gimple_call_arg_ptr (const_gimple gs, unsigned index)
3124 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3125 return gimple_call_arg_ptr (gc, index);
3129 /* Set ARG to be the argument at position INDEX for call statement GS. */
3131 static inline void
3132 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3134 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3135 gs->op[index + 3] = arg;
3138 static inline void
3139 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
3141 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3142 gimple_call_set_arg (gc, index, arg);
3146 /* If TAIL_P is true, mark call statement S as being a tail call
3147 (i.e., a call just before the exit of a function). These calls are
3148 candidate for tail call optimization. */
3150 static inline void
3151 gimple_call_set_tail (gcall *s, bool tail_p)
3153 if (tail_p)
3154 s->subcode |= GF_CALL_TAILCALL;
3155 else
3156 s->subcode &= ~GF_CALL_TAILCALL;
3160 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3162 static inline bool
3163 gimple_call_tail_p (gcall *s)
3165 return (s->subcode & GF_CALL_TAILCALL) != 0;
3169 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3170 slot optimization. This transformation uses the target of the call
3171 expansion as the return slot for calls that return in memory. */
3173 static inline void
3174 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3176 if (return_slot_opt_p)
3177 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3178 else
3179 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3183 /* Return true if S is marked for return slot optimization. */
3185 static inline bool
3186 gimple_call_return_slot_opt_p (gcall *s)
3188 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3192 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3193 thunk to the thunked-to function. */
3195 static inline void
3196 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3198 if (from_thunk_p)
3199 s->subcode |= GF_CALL_FROM_THUNK;
3200 else
3201 s->subcode &= ~GF_CALL_FROM_THUNK;
3205 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3207 static inline bool
3208 gimple_call_from_thunk_p (gcall *s)
3210 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3214 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3215 argument pack in its argument list. */
3217 static inline void
3218 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3220 if (pass_arg_pack_p)
3221 s->subcode |= GF_CALL_VA_ARG_PACK;
3222 else
3223 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3227 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3228 argument pack in its argument list. */
3230 static inline bool
3231 gimple_call_va_arg_pack_p (gcall *s)
3233 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3237 /* Return true if S is a noreturn call. */
3239 static inline bool
3240 gimple_call_noreturn_p (const gcall *s)
3242 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3245 static inline bool
3246 gimple_call_noreturn_p (const_gimple s)
3248 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3249 return gimple_call_noreturn_p (gc);
3253 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3254 even if the called function can throw in other cases. */
3256 static inline void
3257 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3259 if (nothrow_p)
3260 s->subcode |= GF_CALL_NOTHROW;
3261 else
3262 s->subcode &= ~GF_CALL_NOTHROW;
3265 /* Return true if S is a nothrow call. */
3267 static inline bool
3268 gimple_call_nothrow_p (gcall *s)
3270 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3273 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3274 is known to be emitted for VLA objects. Those are wrapped by
3275 stack_save/stack_restore calls and hence can't lead to unbounded
3276 stack growth even when they occur in loops. */
3278 static inline void
3279 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3281 if (for_var)
3282 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3283 else
3284 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3287 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3289 static inline bool
3290 gimple_call_alloca_for_var_p (gcall *s)
3292 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3295 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3297 static inline void
3298 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3300 dest_call->subcode = orig_call->subcode;
3304 /* Return a pointer to the points-to solution for the set of call-used
3305 variables of the call CALL_STMT. */
3307 static inline struct pt_solution *
3308 gimple_call_use_set (gcall *call_stmt)
3310 return &call_stmt->call_used;
3314 /* Return a pointer to the points-to solution for the set of call-used
3315 variables of the call CALL_STMT. */
3317 static inline struct pt_solution *
3318 gimple_call_clobber_set (gcall *call_stmt)
3320 return &call_stmt->call_clobbered;
3324 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3325 non-NULL lhs. */
3327 static inline bool
3328 gimple_has_lhs (gimple stmt)
3330 if (is_gimple_assign (stmt))
3331 return true;
3332 if (gcall *call = dyn_cast <gcall *> (stmt))
3333 return gimple_call_lhs (call) != NULL_TREE;
3334 return false;
3338 /* Return the code of the predicate computed by conditional statement GS. */
3340 static inline enum tree_code
3341 gimple_cond_code (const gcond *gs)
3343 return (enum tree_code) gs->subcode;
3346 static inline enum tree_code
3347 gimple_cond_code (const_gimple gs)
3349 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3350 return gimple_cond_code (gc);
3354 /* Set CODE to be the predicate code for the conditional statement GS. */
3356 static inline void
3357 gimple_cond_set_code (gcond *gs, enum tree_code code)
3359 gs->subcode = code;
3363 /* Return the LHS of the predicate computed by conditional statement GS. */
3365 static inline tree
3366 gimple_cond_lhs (const gcond *gs)
3368 return gs->op[0];
3371 static inline tree
3372 gimple_cond_lhs (const_gimple gs)
3374 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3375 return gimple_cond_lhs (gc);
3378 /* Return the pointer to the LHS of the predicate computed by conditional
3379 statement GS. */
3381 static inline tree *
3382 gimple_cond_lhs_ptr (const gcond *gs)
3384 return const_cast<tree *> (&gs->op[0]);
3387 /* Set LHS to be the LHS operand of the predicate computed by
3388 conditional statement GS. */
3390 static inline void
3391 gimple_cond_set_lhs (gcond *gs, tree lhs)
3393 gs->op[0] = lhs;
3397 /* Return the RHS operand of the predicate computed by conditional GS. */
3399 static inline tree
3400 gimple_cond_rhs (const gcond *gs)
3402 return gs->op[1];
3405 static inline tree
3406 gimple_cond_rhs (const_gimple gs)
3408 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3409 return gimple_cond_rhs (gc);
3412 /* Return the pointer to the RHS operand of the predicate computed by
3413 conditional GS. */
3415 static inline tree *
3416 gimple_cond_rhs_ptr (const gcond *gs)
3418 return const_cast<tree *> (&gs->op[1]);
3422 /* Set RHS to be the RHS operand of the predicate computed by
3423 conditional statement GS. */
3425 static inline void
3426 gimple_cond_set_rhs (gcond *gs, tree rhs)
3428 gs->op[1] = rhs;
3432 /* Return the label used by conditional statement GS when its
3433 predicate evaluates to true. */
3435 static inline tree
3436 gimple_cond_true_label (const gcond *gs)
3438 return gs->op[2];
3442 /* Set LABEL to be the label used by conditional statement GS when its
3443 predicate evaluates to true. */
3445 static inline void
3446 gimple_cond_set_true_label (gcond *gs, tree label)
3448 gs->op[2] = label;
3452 /* Set LABEL to be the label used by conditional statement GS when its
3453 predicate evaluates to false. */
3455 static inline void
3456 gimple_cond_set_false_label (gcond *gs, tree label)
3458 gs->op[3] = label;
3462 /* Return the label used by conditional statement GS when its
3463 predicate evaluates to false. */
3465 static inline tree
3466 gimple_cond_false_label (const gcond *gs)
3468 return gs->op[3];
3472 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3474 static inline void
3475 gimple_cond_make_false (gcond *gs)
3477 gimple_cond_set_lhs (gs, boolean_false_node);
3478 gimple_cond_set_rhs (gs, boolean_false_node);
3479 gs->subcode = NE_EXPR;
3483 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3485 static inline void
3486 gimple_cond_make_true (gcond *gs)
3488 gimple_cond_set_lhs (gs, boolean_true_node);
3489 gimple_cond_set_rhs (gs, boolean_false_node);
3490 gs->subcode = NE_EXPR;
3493 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3494 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3496 static inline bool
3497 gimple_cond_true_p (const gcond *gs)
3499 tree lhs = gimple_cond_lhs (gs);
3500 tree rhs = gimple_cond_rhs (gs);
3501 enum tree_code code = gimple_cond_code (gs);
3503 if (lhs != boolean_true_node && lhs != boolean_false_node)
3504 return false;
3506 if (rhs != boolean_true_node && rhs != boolean_false_node)
3507 return false;
3509 if (code == NE_EXPR && lhs != rhs)
3510 return true;
3512 if (code == EQ_EXPR && lhs == rhs)
3513 return true;
3515 return false;
3518 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3519 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3521 static inline bool
3522 gimple_cond_false_p (const gcond *gs)
3524 tree lhs = gimple_cond_lhs (gs);
3525 tree rhs = gimple_cond_rhs (gs);
3526 enum tree_code code = gimple_cond_code (gs);
3528 if (lhs != boolean_true_node && lhs != boolean_false_node)
3529 return false;
3531 if (rhs != boolean_true_node && rhs != boolean_false_node)
3532 return false;
3534 if (code == NE_EXPR && lhs == rhs)
3535 return true;
3537 if (code == EQ_EXPR && lhs != rhs)
3538 return true;
3540 return false;
3543 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3545 static inline void
3546 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3547 tree rhs)
3549 gimple_cond_set_code (stmt, code);
3550 gimple_cond_set_lhs (stmt, lhs);
3551 gimple_cond_set_rhs (stmt, rhs);
3554 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3556 static inline tree
3557 gimple_label_label (const glabel *gs)
3559 return gs->op[0];
3563 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3564 GS. */
3566 static inline void
3567 gimple_label_set_label (glabel *gs, tree label)
3569 gs->op[0] = label;
3573 /* Return the destination of the unconditional jump GS. */
3575 static inline tree
3576 gimple_goto_dest (const_gimple gs)
3578 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3579 return gimple_op (gs, 0);
3583 /* Set DEST to be the destination of the unconditonal jump GS. */
3585 static inline void
3586 gimple_goto_set_dest (ggoto *gs, tree dest)
3588 gs->op[0] = dest;
3592 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3594 static inline tree
3595 gimple_bind_vars (const gbind *bind_stmt)
3597 return bind_stmt->vars;
3601 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3602 statement GS. */
3604 static inline void
3605 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3607 bind_stmt->vars = vars;
3611 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3612 statement GS. */
3614 static inline void
3615 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3617 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3621 static inline gimple_seq *
3622 gimple_bind_body_ptr (gbind *bind_stmt)
3624 return &bind_stmt->body;
3627 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3629 static inline gimple_seq
3630 gimple_bind_body (gbind *gs)
3632 return *gimple_bind_body_ptr (gs);
3636 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3637 statement GS. */
3639 static inline void
3640 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3642 bind_stmt->body = seq;
3646 /* Append a statement to the end of a GIMPLE_BIND's body. */
3648 static inline void
3649 gimple_bind_add_stmt (gbind *bind_stmt, gimple stmt)
3651 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3655 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3657 static inline void
3658 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3660 gimple_seq_add_seq (&bind_stmt->body, seq);
3664 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3665 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3667 static inline tree
3668 gimple_bind_block (const gbind *bind_stmt)
3670 return bind_stmt->block;
3674 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3675 statement GS. */
3677 static inline void
3678 gimple_bind_set_block (gbind *bind_stmt, tree block)
3680 gcc_gimple_checking_assert (block == NULL_TREE
3681 || TREE_CODE (block) == BLOCK);
3682 bind_stmt->block = block;
3686 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3688 static inline unsigned
3689 gimple_asm_ninputs (const gasm *asm_stmt)
3691 return asm_stmt->ni;
3695 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3697 static inline unsigned
3698 gimple_asm_noutputs (const gasm *asm_stmt)
3700 return asm_stmt->no;
3704 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3706 static inline unsigned
3707 gimple_asm_nclobbers (const gasm *asm_stmt)
3709 return asm_stmt->nc;
3712 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3714 static inline unsigned
3715 gimple_asm_nlabels (const gasm *asm_stmt)
3717 return asm_stmt->nl;
3720 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3722 static inline tree
3723 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3725 gcc_gimple_checking_assert (index < asm_stmt->ni);
3726 return asm_stmt->op[index + asm_stmt->no];
3729 /* Return a pointer to input operand INDEX of GIMPLE_ASM ASM_STMT. */
3731 static inline tree *
3732 gimple_asm_input_op_ptr (const gasm *asm_stmt, unsigned index)
3734 gcc_gimple_checking_assert (index < asm_stmt->ni);
3735 return const_cast<tree *> (&asm_stmt->op[index + asm_stmt->no]);
3739 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3741 static inline void
3742 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3744 gcc_gimple_checking_assert (index < asm_stmt->ni
3745 && TREE_CODE (in_op) == TREE_LIST);
3746 asm_stmt->op[index + asm_stmt->no] = in_op;
3750 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3752 static inline tree
3753 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3755 gcc_gimple_checking_assert (index < asm_stmt->no);
3756 return asm_stmt->op[index];
3759 /* Return a pointer to output operand INDEX of GIMPLE_ASM ASM_STMT. */
3761 static inline tree *
3762 gimple_asm_output_op_ptr (const gasm *asm_stmt, unsigned index)
3764 gcc_gimple_checking_assert (index < asm_stmt->no);
3765 return const_cast<tree *> (&asm_stmt->op[index]);
3769 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3771 static inline void
3772 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3774 gcc_gimple_checking_assert (index < asm_stmt->no
3775 && TREE_CODE (out_op) == TREE_LIST);
3776 asm_stmt->op[index] = out_op;
3780 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3782 static inline tree
3783 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3785 gcc_gimple_checking_assert (index < asm_stmt->nc);
3786 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3790 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3792 static inline void
3793 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3795 gcc_gimple_checking_assert (index < asm_stmt->nc
3796 && TREE_CODE (clobber_op) == TREE_LIST);
3797 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3800 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3802 static inline tree
3803 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3805 gcc_gimple_checking_assert (index < asm_stmt->nl);
3806 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3809 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3811 static inline void
3812 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3814 gcc_gimple_checking_assert (index < asm_stmt->nl
3815 && TREE_CODE (label_op) == TREE_LIST);
3816 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3819 /* Return the string representing the assembly instruction in
3820 GIMPLE_ASM ASM_STMT. */
3822 static inline const char *
3823 gimple_asm_string (const gasm *asm_stmt)
3825 return asm_stmt->string;
3829 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3831 static inline bool
3832 gimple_asm_volatile_p (const gasm *asm_stmt)
3834 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3838 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3840 static inline void
3841 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3843 if (volatile_p)
3844 asm_stmt->subcode |= GF_ASM_VOLATILE;
3845 else
3846 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3850 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3852 static inline void
3853 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3855 if (input_p)
3856 asm_stmt->subcode |= GF_ASM_INPUT;
3857 else
3858 asm_stmt->subcode &= ~GF_ASM_INPUT;
3862 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3864 static inline bool
3865 gimple_asm_input_p (const gasm *asm_stmt)
3867 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3871 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3873 static inline tree
3874 gimple_catch_types (const gcatch *catch_stmt)
3876 return catch_stmt->types;
3880 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3882 static inline tree *
3883 gimple_catch_types_ptr (gcatch *catch_stmt)
3885 return &catch_stmt->types;
3889 /* Return a pointer to the GIMPLE sequence representing the body of
3890 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3892 static inline gimple_seq *
3893 gimple_catch_handler_ptr (gcatch *catch_stmt)
3895 return &catch_stmt->handler;
3899 /* Return the GIMPLE sequence representing the body of the handler of
3900 GIMPLE_CATCH statement CATCH_STMT. */
3902 static inline gimple_seq
3903 gimple_catch_handler (gcatch *catch_stmt)
3905 return *gimple_catch_handler_ptr (catch_stmt);
3909 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3911 static inline void
3912 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3914 catch_stmt->types = t;
3918 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3920 static inline void
3921 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3923 catch_stmt->handler = handler;
3927 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3929 static inline tree
3930 gimple_eh_filter_types (const_gimple gs)
3932 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3933 return eh_filter_stmt->types;
3937 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3938 GS. */
3940 static inline tree *
3941 gimple_eh_filter_types_ptr (gimple gs)
3943 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3944 return &eh_filter_stmt->types;
3948 /* Return a pointer to the sequence of statement to execute when
3949 GIMPLE_EH_FILTER statement fails. */
3951 static inline gimple_seq *
3952 gimple_eh_filter_failure_ptr (gimple gs)
3954 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3955 return &eh_filter_stmt->failure;
3959 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
3960 statement fails. */
3962 static inline gimple_seq
3963 gimple_eh_filter_failure (gimple gs)
3965 return *gimple_eh_filter_failure_ptr (gs);
3969 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
3970 EH_FILTER_STMT. */
3972 static inline void
3973 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
3975 eh_filter_stmt->types = types;
3979 /* Set FAILURE to be the sequence of statements to execute on failure
3980 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
3982 static inline void
3983 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
3984 gimple_seq failure)
3986 eh_filter_stmt->failure = failure;
3989 /* Get the function decl to be called by the MUST_NOT_THROW region. */
3991 static inline tree
3992 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
3994 return eh_mnt_stmt->fndecl;
3997 /* Set the function decl to be called by GS to DECL. */
3999 static inline void
4000 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4001 tree decl)
4003 eh_mnt_stmt->fndecl = decl;
4006 /* GIMPLE_EH_ELSE accessors. */
4008 static inline gimple_seq *
4009 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4011 return &eh_else_stmt->n_body;
4014 static inline gimple_seq
4015 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4017 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4020 static inline gimple_seq *
4021 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4023 return &eh_else_stmt->e_body;
4026 static inline gimple_seq
4027 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4029 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4032 static inline void
4033 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4035 eh_else_stmt->n_body = seq;
4038 static inline void
4039 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4041 eh_else_stmt->e_body = seq;
4044 /* GIMPLE_TRY accessors. */
4046 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4047 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4049 static inline enum gimple_try_flags
4050 gimple_try_kind (const_gimple gs)
4052 GIMPLE_CHECK (gs, GIMPLE_TRY);
4053 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4057 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4059 static inline void
4060 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4062 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4063 || kind == GIMPLE_TRY_FINALLY);
4064 if (gimple_try_kind (gs) != kind)
4065 gs->subcode = (unsigned int) kind;
4069 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4071 static inline bool
4072 gimple_try_catch_is_cleanup (const_gimple gs)
4074 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4075 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4079 /* Return a pointer to the sequence of statements used as the
4080 body for GIMPLE_TRY GS. */
4082 static inline gimple_seq *
4083 gimple_try_eval_ptr (gimple gs)
4085 gtry *try_stmt = as_a <gtry *> (gs);
4086 return &try_stmt->eval;
4090 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4092 static inline gimple_seq
4093 gimple_try_eval (gimple gs)
4095 return *gimple_try_eval_ptr (gs);
4099 /* Return a pointer to the sequence of statements used as the cleanup body for
4100 GIMPLE_TRY GS. */
4102 static inline gimple_seq *
4103 gimple_try_cleanup_ptr (gimple gs)
4105 gtry *try_stmt = as_a <gtry *> (gs);
4106 return &try_stmt->cleanup;
4110 /* Return the sequence of statements used as the cleanup body for
4111 GIMPLE_TRY GS. */
4113 static inline gimple_seq
4114 gimple_try_cleanup (gimple gs)
4116 return *gimple_try_cleanup_ptr (gs);
4120 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4122 static inline void
4123 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4125 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4126 if (catch_is_cleanup)
4127 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4128 else
4129 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4133 /* Set EVAL to be the sequence of statements to use as the body for
4134 GIMPLE_TRY TRY_STMT. */
4136 static inline void
4137 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4139 try_stmt->eval = eval;
4143 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4144 body for GIMPLE_TRY TRY_STMT. */
4146 static inline void
4147 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4149 try_stmt->cleanup = cleanup;
4153 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4155 static inline gimple_seq *
4156 gimple_wce_cleanup_ptr (gimple gs)
4158 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4159 return &wce_stmt->cleanup;
4163 /* Return the cleanup sequence for cleanup statement GS. */
4165 static inline gimple_seq
4166 gimple_wce_cleanup (gimple gs)
4168 return *gimple_wce_cleanup_ptr (gs);
4172 /* Set CLEANUP to be the cleanup sequence for GS. */
4174 static inline void
4175 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
4177 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4178 wce_stmt->cleanup = cleanup;
4182 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4184 static inline bool
4185 gimple_wce_cleanup_eh_only (const_gimple gs)
4187 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4188 return gs->subcode != 0;
4192 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4194 static inline void
4195 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
4197 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4198 gs->subcode = (unsigned int) eh_only_p;
4202 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4204 static inline unsigned
4205 gimple_phi_capacity (const_gimple gs)
4207 const gphi *phi_stmt = as_a <const gphi *> (gs);
4208 return phi_stmt->capacity;
4212 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4213 be exactly the number of incoming edges for the basic block holding
4214 GS. */
4216 static inline unsigned
4217 gimple_phi_num_args (const_gimple gs)
4219 const gphi *phi_stmt = as_a <const gphi *> (gs);
4220 return phi_stmt->nargs;
4224 /* Return the SSA name created by GIMPLE_PHI GS. */
4226 static inline tree
4227 gimple_phi_result (const_gimple gs)
4229 const gphi *phi_stmt = as_a <const gphi *> (gs);
4230 return phi_stmt->result;
4233 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4235 static inline tree *
4236 gimple_phi_result_ptr (gimple gs)
4238 gphi *phi_stmt = as_a <gphi *> (gs);
4239 return &phi_stmt->result;
4242 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4244 static inline void
4245 gimple_phi_set_result (gphi *phi, tree result)
4247 phi->result = result;
4248 if (result && TREE_CODE (result) == SSA_NAME)
4249 SSA_NAME_DEF_STMT (result) = phi;
4253 /* Return the PHI argument corresponding to incoming edge INDEX for
4254 GIMPLE_PHI GS. */
4256 static inline struct phi_arg_d *
4257 gimple_phi_arg (gimple gs, unsigned index)
4259 gphi *phi_stmt = as_a <gphi *> (gs);
4260 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4261 return &(phi_stmt->args[index]);
4264 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4265 for GIMPLE_PHI PHI. */
4267 static inline void
4268 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4270 gcc_gimple_checking_assert (index <= phi->nargs);
4271 phi->args[index] = *phiarg;
4274 /* Return the PHI nodes for basic block BB, or NULL if there are no
4275 PHI nodes. */
4277 static inline gimple_seq
4278 phi_nodes (const_basic_block bb)
4280 gcc_checking_assert (!(bb->flags & BB_RTL));
4281 return bb->il.gimple.phi_nodes;
4284 /* Return a pointer to the PHI nodes for basic block BB. */
4286 static inline gimple_seq *
4287 phi_nodes_ptr (basic_block bb)
4289 gcc_checking_assert (!(bb->flags & BB_RTL));
4290 return &bb->il.gimple.phi_nodes;
4293 /* Return the tree operand for argument I of PHI node GS. */
4295 static inline tree
4296 gimple_phi_arg_def (gimple gs, size_t index)
4298 return gimple_phi_arg (gs, index)->def;
4302 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4304 static inline tree *
4305 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4307 return &gimple_phi_arg (phi, index)->def;
4310 /* Return the edge associated with argument I of phi node PHI. */
4312 static inline edge
4313 gimple_phi_arg_edge (gphi *phi, size_t i)
4315 return EDGE_PRED (gimple_bb (phi), i);
4318 /* Return the source location of gimple argument I of phi node PHI. */
4320 static inline source_location
4321 gimple_phi_arg_location (gphi *phi, size_t i)
4323 return gimple_phi_arg (phi, i)->locus;
4326 /* Return the source location of the argument on edge E of phi node PHI. */
4328 static inline source_location
4329 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4331 return gimple_phi_arg (phi, e->dest_idx)->locus;
4334 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4336 static inline void
4337 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4339 gimple_phi_arg (phi, i)->locus = loc;
4342 /* Return TRUE if argument I of phi node PHI has a location record. */
4344 static inline bool
4345 gimple_phi_arg_has_location (gphi *phi, size_t i)
4347 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4351 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4353 static inline int
4354 gimple_resx_region (const gresx *resx_stmt)
4356 return resx_stmt->region;
4359 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4361 static inline void
4362 gimple_resx_set_region (gresx *resx_stmt, int region)
4364 resx_stmt->region = region;
4367 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4369 static inline int
4370 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4372 return eh_dispatch_stmt->region;
4375 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4376 EH_DISPATCH_STMT. */
4378 static inline void
4379 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4381 eh_dispatch_stmt->region = region;
4384 /* Return the number of labels associated with the switch statement GS. */
4386 static inline unsigned
4387 gimple_switch_num_labels (const gswitch *gs)
4389 unsigned num_ops;
4390 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4391 num_ops = gimple_num_ops (gs);
4392 gcc_gimple_checking_assert (num_ops > 1);
4393 return num_ops - 1;
4397 /* Set NLABELS to be the number of labels for the switch statement GS. */
4399 static inline void
4400 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4402 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4403 gimple_set_num_ops (g, nlabels + 1);
4407 /* Return the index variable used by the switch statement GS. */
4409 static inline tree
4410 gimple_switch_index (const gswitch *gs)
4412 return gs->op[0];
4416 /* Return a pointer to the index variable for the switch statement GS. */
4418 static inline tree *
4419 gimple_switch_index_ptr (const gswitch *gs)
4421 return const_cast<tree *> (&gs->op[0]);
4425 /* Set INDEX to be the index variable for switch statement GS. */
4427 static inline void
4428 gimple_switch_set_index (gswitch *gs, tree index)
4430 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4431 gs->op[0] = index;
4435 /* Return the label numbered INDEX. The default label is 0, followed by any
4436 labels in a switch statement. */
4438 static inline tree
4439 gimple_switch_label (const gswitch *gs, unsigned index)
4441 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4442 return gs->op[index + 1];
4445 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4447 static inline void
4448 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4450 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4451 && (label == NULL_TREE
4452 || TREE_CODE (label) == CASE_LABEL_EXPR));
4453 gs->op[index + 1] = label;
4456 /* Return the default label for a switch statement. */
4458 static inline tree
4459 gimple_switch_default_label (const gswitch *gs)
4461 tree label = gimple_switch_label (gs, 0);
4462 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4463 return label;
4466 /* Set the default label for a switch statement. */
4468 static inline void
4469 gimple_switch_set_default_label (gswitch *gs, tree label)
4471 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4472 gimple_switch_set_label (gs, 0, label);
4475 /* Return true if GS is a GIMPLE_DEBUG statement. */
4477 static inline bool
4478 is_gimple_debug (const_gimple gs)
4480 return gimple_code (gs) == GIMPLE_DEBUG;
4483 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4485 static inline bool
4486 gimple_debug_bind_p (const_gimple s)
4488 if (is_gimple_debug (s))
4489 return s->subcode == GIMPLE_DEBUG_BIND;
4491 return false;
4494 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4496 static inline tree
4497 gimple_debug_bind_get_var (gimple dbg)
4499 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4500 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4501 return gimple_op (dbg, 0);
4504 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4505 statement. */
4507 static inline tree
4508 gimple_debug_bind_get_value (gimple dbg)
4510 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4511 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4512 return gimple_op (dbg, 1);
4515 /* Return a pointer to the value bound to the variable in a
4516 GIMPLE_DEBUG bind statement. */
4518 static inline tree *
4519 gimple_debug_bind_get_value_ptr (gimple dbg)
4521 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4522 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4523 return gimple_op_ptr (dbg, 1);
4526 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4528 static inline void
4529 gimple_debug_bind_set_var (gimple dbg, tree var)
4531 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4532 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4533 gimple_set_op (dbg, 0, var);
4536 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4537 statement. */
4539 static inline void
4540 gimple_debug_bind_set_value (gimple dbg, tree value)
4542 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4543 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4544 gimple_set_op (dbg, 1, value);
4547 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4548 optimized away. */
4549 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4551 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4552 statement. */
4554 static inline void
4555 gimple_debug_bind_reset_value (gimple dbg)
4557 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4558 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4559 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4562 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4563 value. */
4565 static inline bool
4566 gimple_debug_bind_has_value_p (gimple dbg)
4568 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4569 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4570 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4573 #undef GIMPLE_DEBUG_BIND_NOVALUE
4575 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4577 static inline bool
4578 gimple_debug_source_bind_p (const_gimple s)
4580 if (is_gimple_debug (s))
4581 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4583 return false;
4586 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4588 static inline tree
4589 gimple_debug_source_bind_get_var (gimple dbg)
4591 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4592 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4593 return gimple_op (dbg, 0);
4596 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4597 statement. */
4599 static inline tree
4600 gimple_debug_source_bind_get_value (gimple dbg)
4602 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4603 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4604 return gimple_op (dbg, 1);
4607 /* Return a pointer to the value bound to the variable in a
4608 GIMPLE_DEBUG source bind statement. */
4610 static inline tree *
4611 gimple_debug_source_bind_get_value_ptr (gimple dbg)
4613 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4614 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4615 return gimple_op_ptr (dbg, 1);
4618 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4620 static inline void
4621 gimple_debug_source_bind_set_var (gimple dbg, tree var)
4623 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4624 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4625 gimple_set_op (dbg, 0, var);
4628 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4629 statement. */
4631 static inline void
4632 gimple_debug_source_bind_set_value (gimple dbg, tree value)
4634 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4635 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4636 gimple_set_op (dbg, 1, value);
4639 /* Return the line number for EXPR, or return -1 if we have no line
4640 number information for it. */
4641 static inline int
4642 get_lineno (const_gimple stmt)
4644 location_t loc;
4646 if (!stmt)
4647 return -1;
4649 loc = gimple_location (stmt);
4650 if (loc == UNKNOWN_LOCATION)
4651 return -1;
4653 return LOCATION_LINE (loc);
4656 /* Return a pointer to the body for the OMP statement GS. */
4658 static inline gimple_seq *
4659 gimple_omp_body_ptr (gimple gs)
4661 return &static_cast <gimple_statement_omp *> (gs)->body;
4664 /* Return the body for the OMP statement GS. */
4666 static inline gimple_seq
4667 gimple_omp_body (gimple gs)
4669 return *gimple_omp_body_ptr (gs);
4672 /* Set BODY to be the body for the OMP statement GS. */
4674 static inline void
4675 gimple_omp_set_body (gimple gs, gimple_seq body)
4677 static_cast <gimple_statement_omp *> (gs)->body = body;
4681 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4683 static inline tree
4684 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4686 return crit_stmt->name;
4690 /* Return a pointer to the name associated with OMP critical statement GS. */
4692 static inline tree *
4693 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4695 return &crit_stmt->name;
4699 /* Set NAME to be the name associated with OMP critical statement GS. */
4701 static inline void
4702 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4704 crit_stmt->name = name;
4708 /* Return the kind of the OMP_FOR statemement G. */
4710 static inline int
4711 gimple_omp_for_kind (const_gimple g)
4713 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4714 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4718 /* Set the kind of the OMP_FOR statement G. */
4720 static inline void
4721 gimple_omp_for_set_kind (gomp_for *g, int kind)
4723 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4724 | (kind & GF_OMP_FOR_KIND_MASK);
4728 /* Return true if OMP_FOR statement G has the
4729 GF_OMP_FOR_COMBINED flag set. */
4731 static inline bool
4732 gimple_omp_for_combined_p (const_gimple g)
4734 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4735 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4739 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4740 the boolean value of COMBINED_P. */
4742 static inline void
4743 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4745 if (combined_p)
4746 g->subcode |= GF_OMP_FOR_COMBINED;
4747 else
4748 g->subcode &= ~GF_OMP_FOR_COMBINED;
4752 /* Return true if the OMP_FOR statement G has the
4753 GF_OMP_FOR_COMBINED_INTO flag set. */
4755 static inline bool
4756 gimple_omp_for_combined_into_p (const_gimple g)
4758 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4759 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4763 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4764 on the boolean value of COMBINED_P. */
4766 static inline void
4767 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4769 if (combined_p)
4770 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4771 else
4772 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4776 /* Return the clauses associated with the OMP_FOR statement GS. */
4778 static inline tree
4779 gimple_omp_for_clauses (const_gimple gs)
4781 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4782 return omp_for_stmt->clauses;
4786 /* Return a pointer to the clauses associated with the OMP_FOR statement
4787 GS. */
4789 static inline tree *
4790 gimple_omp_for_clauses_ptr (gimple gs)
4792 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4793 return &omp_for_stmt->clauses;
4797 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4798 GS. */
4800 static inline void
4801 gimple_omp_for_set_clauses (gimple gs, tree clauses)
4803 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4804 omp_for_stmt->clauses = clauses;
4808 /* Get the collapse count of the OMP_FOR statement GS. */
4810 static inline size_t
4811 gimple_omp_for_collapse (gimple gs)
4813 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4814 return omp_for_stmt->collapse;
4818 /* Return the condition code associated with the OMP_FOR statement GS. */
4820 static inline enum tree_code
4821 gimple_omp_for_cond (const_gimple gs, size_t i)
4823 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4824 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4825 return omp_for_stmt->iter[i].cond;
4829 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4831 static inline void
4832 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
4834 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4835 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4836 && i < omp_for_stmt->collapse);
4837 omp_for_stmt->iter[i].cond = cond;
4841 /* Return the index variable for the OMP_FOR statement GS. */
4843 static inline tree
4844 gimple_omp_for_index (const_gimple gs, size_t i)
4846 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4847 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4848 return omp_for_stmt->iter[i].index;
4852 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4854 static inline tree *
4855 gimple_omp_for_index_ptr (gimple gs, size_t i)
4857 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4858 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4859 return &omp_for_stmt->iter[i].index;
4863 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4865 static inline void
4866 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
4868 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4869 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4870 omp_for_stmt->iter[i].index = index;
4874 /* Return the initial value for the OMP_FOR statement GS. */
4876 static inline tree
4877 gimple_omp_for_initial (const_gimple gs, size_t i)
4879 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4880 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4881 return omp_for_stmt->iter[i].initial;
4885 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4887 static inline tree *
4888 gimple_omp_for_initial_ptr (gimple gs, size_t i)
4890 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4891 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4892 return &omp_for_stmt->iter[i].initial;
4896 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
4898 static inline void
4899 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
4901 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4902 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4903 omp_for_stmt->iter[i].initial = initial;
4907 /* Return the final value for the OMP_FOR statement GS. */
4909 static inline tree
4910 gimple_omp_for_final (const_gimple gs, size_t i)
4912 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4913 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4914 return omp_for_stmt->iter[i].final;
4918 /* Return a pointer to the final value for the OMP_FOR statement GS. */
4920 static inline tree *
4921 gimple_omp_for_final_ptr (gimple gs, size_t i)
4923 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4924 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4925 return &omp_for_stmt->iter[i].final;
4929 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
4931 static inline void
4932 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
4934 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4935 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4936 omp_for_stmt->iter[i].final = final;
4940 /* Return the increment value for the OMP_FOR statement GS. */
4942 static inline tree
4943 gimple_omp_for_incr (const_gimple gs, size_t i)
4945 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4946 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4947 return omp_for_stmt->iter[i].incr;
4951 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
4953 static inline tree *
4954 gimple_omp_for_incr_ptr (gimple gs, size_t i)
4956 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4957 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4958 return &omp_for_stmt->iter[i].incr;
4962 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
4964 static inline void
4965 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
4967 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4968 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4969 omp_for_stmt->iter[i].incr = incr;
4973 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
4974 statement GS starts. */
4976 static inline gimple_seq *
4977 gimple_omp_for_pre_body_ptr (gimple gs)
4979 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4980 return &omp_for_stmt->pre_body;
4984 /* Return the sequence of statements to execute before the OMP_FOR
4985 statement GS starts. */
4987 static inline gimple_seq
4988 gimple_omp_for_pre_body (gimple gs)
4990 return *gimple_omp_for_pre_body_ptr (gs);
4994 /* Set PRE_BODY to be the sequence of statements to execute before the
4995 OMP_FOR statement GS starts. */
4997 static inline void
4998 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
5000 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5001 omp_for_stmt->pre_body = pre_body;
5005 /* Return the clauses associated with OMP_PARALLEL GS. */
5007 static inline tree
5008 gimple_omp_parallel_clauses (const_gimple gs)
5010 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5011 return omp_parallel_stmt->clauses;
5015 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5017 static inline tree *
5018 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5020 return &omp_parallel_stmt->clauses;
5024 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5026 static inline void
5027 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5028 tree clauses)
5030 omp_parallel_stmt->clauses = clauses;
5034 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5036 static inline tree
5037 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5039 return omp_parallel_stmt->child_fn;
5042 /* Return a pointer to the child function used to hold the body of
5043 OMP_PARALLEL_STMT. */
5045 static inline tree *
5046 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5048 return &omp_parallel_stmt->child_fn;
5052 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5054 static inline void
5055 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5056 tree child_fn)
5058 omp_parallel_stmt->child_fn = child_fn;
5062 /* Return the artificial argument used to send variables and values
5063 from the parent to the children threads in OMP_PARALLEL_STMT. */
5065 static inline tree
5066 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5068 return omp_parallel_stmt->data_arg;
5072 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5074 static inline tree *
5075 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5077 return &omp_parallel_stmt->data_arg;
5081 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5083 static inline void
5084 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5085 tree data_arg)
5087 omp_parallel_stmt->data_arg = data_arg;
5091 /* Return the clauses associated with OMP_TASK GS. */
5093 static inline tree
5094 gimple_omp_task_clauses (const_gimple gs)
5096 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5097 return omp_task_stmt->clauses;
5101 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5103 static inline tree *
5104 gimple_omp_task_clauses_ptr (gimple gs)
5106 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5107 return &omp_task_stmt->clauses;
5111 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5112 GS. */
5114 static inline void
5115 gimple_omp_task_set_clauses (gimple gs, tree clauses)
5117 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5118 omp_task_stmt->clauses = clauses;
5122 /* Return the child function used to hold the body of OMP_TASK GS. */
5124 static inline tree
5125 gimple_omp_task_child_fn (const_gimple gs)
5127 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5128 return omp_task_stmt->child_fn;
5131 /* Return a pointer to the child function used to hold the body of
5132 OMP_TASK GS. */
5134 static inline tree *
5135 gimple_omp_task_child_fn_ptr (gimple gs)
5137 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5138 return &omp_task_stmt->child_fn;
5142 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5144 static inline void
5145 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
5147 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5148 omp_task_stmt->child_fn = child_fn;
5152 /* Return the artificial argument used to send variables and values
5153 from the parent to the children threads in OMP_TASK GS. */
5155 static inline tree
5156 gimple_omp_task_data_arg (const_gimple gs)
5158 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5159 return omp_task_stmt->data_arg;
5163 /* Return a pointer to the data argument for OMP_TASK GS. */
5165 static inline tree *
5166 gimple_omp_task_data_arg_ptr (gimple gs)
5168 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5169 return &omp_task_stmt->data_arg;
5173 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5175 static inline void
5176 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
5178 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5179 omp_task_stmt->data_arg = data_arg;
5183 /* Return the clauses associated with OMP_TASK GS. */
5185 static inline tree
5186 gimple_omp_taskreg_clauses (const_gimple gs)
5188 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5189 = as_a <const gimple_statement_omp_taskreg *> (gs);
5190 return omp_taskreg_stmt->clauses;
5194 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5196 static inline tree *
5197 gimple_omp_taskreg_clauses_ptr (gimple gs)
5199 gimple_statement_omp_taskreg *omp_taskreg_stmt
5200 = as_a <gimple_statement_omp_taskreg *> (gs);
5201 return &omp_taskreg_stmt->clauses;
5205 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5206 GS. */
5208 static inline void
5209 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
5211 gimple_statement_omp_taskreg *omp_taskreg_stmt
5212 = as_a <gimple_statement_omp_taskreg *> (gs);
5213 omp_taskreg_stmt->clauses = clauses;
5217 /* Return the child function used to hold the body of OMP_TASK GS. */
5219 static inline tree
5220 gimple_omp_taskreg_child_fn (const_gimple gs)
5222 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5223 = as_a <const gimple_statement_omp_taskreg *> (gs);
5224 return omp_taskreg_stmt->child_fn;
5227 /* Return a pointer to the child function used to hold the body of
5228 OMP_TASK GS. */
5230 static inline tree *
5231 gimple_omp_taskreg_child_fn_ptr (gimple gs)
5233 gimple_statement_omp_taskreg *omp_taskreg_stmt
5234 = as_a <gimple_statement_omp_taskreg *> (gs);
5235 return &omp_taskreg_stmt->child_fn;
5239 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5241 static inline void
5242 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
5244 gimple_statement_omp_taskreg *omp_taskreg_stmt
5245 = as_a <gimple_statement_omp_taskreg *> (gs);
5246 omp_taskreg_stmt->child_fn = child_fn;
5250 /* Return the artificial argument used to send variables and values
5251 from the parent to the children threads in OMP_TASK GS. */
5253 static inline tree
5254 gimple_omp_taskreg_data_arg (const_gimple gs)
5256 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5257 = as_a <const gimple_statement_omp_taskreg *> (gs);
5258 return omp_taskreg_stmt->data_arg;
5262 /* Return a pointer to the data argument for OMP_TASK GS. */
5264 static inline tree *
5265 gimple_omp_taskreg_data_arg_ptr (gimple gs)
5267 gimple_statement_omp_taskreg *omp_taskreg_stmt
5268 = as_a <gimple_statement_omp_taskreg *> (gs);
5269 return &omp_taskreg_stmt->data_arg;
5273 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5275 static inline void
5276 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
5278 gimple_statement_omp_taskreg *omp_taskreg_stmt
5279 = as_a <gimple_statement_omp_taskreg *> (gs);
5280 omp_taskreg_stmt->data_arg = data_arg;
5284 /* Return the copy function used to hold the body of OMP_TASK GS. */
5286 static inline tree
5287 gimple_omp_task_copy_fn (const_gimple gs)
5289 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5290 return omp_task_stmt->copy_fn;
5293 /* Return a pointer to the copy function used to hold the body of
5294 OMP_TASK GS. */
5296 static inline tree *
5297 gimple_omp_task_copy_fn_ptr (gimple gs)
5299 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5300 return &omp_task_stmt->copy_fn;
5304 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5306 static inline void
5307 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
5309 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5310 omp_task_stmt->copy_fn = copy_fn;
5314 /* Return size of the data block in bytes in OMP_TASK GS. */
5316 static inline tree
5317 gimple_omp_task_arg_size (const_gimple gs)
5319 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5320 return omp_task_stmt->arg_size;
5324 /* Return a pointer to the data block size for OMP_TASK GS. */
5326 static inline tree *
5327 gimple_omp_task_arg_size_ptr (gimple gs)
5329 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5330 return &omp_task_stmt->arg_size;
5334 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5336 static inline void
5337 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
5339 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5340 omp_task_stmt->arg_size = arg_size;
5344 /* Return align of the data block in bytes in OMP_TASK GS. */
5346 static inline tree
5347 gimple_omp_task_arg_align (const_gimple gs)
5349 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5350 return omp_task_stmt->arg_align;
5354 /* Return a pointer to the data block align for OMP_TASK GS. */
5356 static inline tree *
5357 gimple_omp_task_arg_align_ptr (gimple gs)
5359 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5360 return &omp_task_stmt->arg_align;
5364 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5366 static inline void
5367 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
5369 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5370 omp_task_stmt->arg_align = arg_align;
5374 /* Return the clauses associated with OMP_SINGLE GS. */
5376 static inline tree
5377 gimple_omp_single_clauses (const_gimple gs)
5379 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5380 return omp_single_stmt->clauses;
5384 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5386 static inline tree *
5387 gimple_omp_single_clauses_ptr (gimple gs)
5389 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5390 return &omp_single_stmt->clauses;
5394 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5396 static inline void
5397 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5399 omp_single_stmt->clauses = clauses;
5403 /* Return the clauses associated with OMP_TARGET GS. */
5405 static inline tree
5406 gimple_omp_target_clauses (const_gimple gs)
5408 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5409 return omp_target_stmt->clauses;
5413 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5415 static inline tree *
5416 gimple_omp_target_clauses_ptr (gimple gs)
5418 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5419 return &omp_target_stmt->clauses;
5423 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5425 static inline void
5426 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5427 tree clauses)
5429 omp_target_stmt->clauses = clauses;
5433 /* Return the kind of the OMP_TARGET G. */
5435 static inline int
5436 gimple_omp_target_kind (const_gimple g)
5438 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5439 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5443 /* Set the kind of the OMP_TARGET G. */
5445 static inline void
5446 gimple_omp_target_set_kind (gomp_target *g, int kind)
5448 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5449 | (kind & GF_OMP_TARGET_KIND_MASK);
5453 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5455 static inline tree
5456 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5458 return omp_target_stmt->child_fn;
5461 /* Return a pointer to the child function used to hold the body of
5462 OMP_TARGET_STMT. */
5464 static inline tree *
5465 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5467 return &omp_target_stmt->child_fn;
5471 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5473 static inline void
5474 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5475 tree child_fn)
5477 omp_target_stmt->child_fn = child_fn;
5481 /* Return the artificial argument used to send variables and values
5482 from the parent to the children threads in OMP_TARGET_STMT. */
5484 static inline tree
5485 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5487 return omp_target_stmt->data_arg;
5491 /* Return a pointer to the data argument for OMP_TARGET GS. */
5493 static inline tree *
5494 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5496 return &omp_target_stmt->data_arg;
5500 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5502 static inline void
5503 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5504 tree data_arg)
5506 omp_target_stmt->data_arg = data_arg;
5510 /* Return the clauses associated with OMP_TEAMS GS. */
5512 static inline tree
5513 gimple_omp_teams_clauses (const_gimple gs)
5515 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5516 return omp_teams_stmt->clauses;
5520 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5522 static inline tree *
5523 gimple_omp_teams_clauses_ptr (gimple gs)
5525 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5526 return &omp_teams_stmt->clauses;
5530 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5532 static inline void
5533 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5535 omp_teams_stmt->clauses = clauses;
5539 /* Return the clauses associated with OMP_SECTIONS GS. */
5541 static inline tree
5542 gimple_omp_sections_clauses (const_gimple gs)
5544 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5545 return omp_sections_stmt->clauses;
5549 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5551 static inline tree *
5552 gimple_omp_sections_clauses_ptr (gimple gs)
5554 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5555 return &omp_sections_stmt->clauses;
5559 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5560 GS. */
5562 static inline void
5563 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
5565 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5566 omp_sections_stmt->clauses = clauses;
5570 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5571 in GS. */
5573 static inline tree
5574 gimple_omp_sections_control (const_gimple gs)
5576 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5577 return omp_sections_stmt->control;
5581 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5582 GS. */
5584 static inline tree *
5585 gimple_omp_sections_control_ptr (gimple gs)
5587 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5588 return &omp_sections_stmt->control;
5592 /* Set CONTROL to be the set of clauses associated with the
5593 GIMPLE_OMP_SECTIONS in GS. */
5595 static inline void
5596 gimple_omp_sections_set_control (gimple gs, tree control)
5598 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5599 omp_sections_stmt->control = control;
5603 /* Set the value being stored in an atomic store. */
5605 static inline void
5606 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5608 store_stmt->val = val;
5612 /* Return the value being stored in an atomic store. */
5614 static inline tree
5615 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5617 return store_stmt->val;
5621 /* Return a pointer to the value being stored in an atomic store. */
5623 static inline tree *
5624 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5626 return &store_stmt->val;
5630 /* Set the LHS of an atomic load. */
5632 static inline void
5633 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5635 load_stmt->lhs = lhs;
5639 /* Get the LHS of an atomic load. */
5641 static inline tree
5642 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5644 return load_stmt->lhs;
5648 /* Return a pointer to the LHS of an atomic load. */
5650 static inline tree *
5651 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5653 return &load_stmt->lhs;
5657 /* Set the RHS of an atomic load. */
5659 static inline void
5660 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5662 load_stmt->rhs = rhs;
5666 /* Get the RHS of an atomic load. */
5668 static inline tree
5669 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5671 return load_stmt->rhs;
5675 /* Return a pointer to the RHS of an atomic load. */
5677 static inline tree *
5678 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5680 return &load_stmt->rhs;
5684 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5686 static inline tree
5687 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5689 return cont_stmt->control_def;
5692 /* The same as above, but return the address. */
5694 static inline tree *
5695 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5697 return &cont_stmt->control_def;
5700 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5702 static inline void
5703 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5705 cont_stmt->control_def = def;
5709 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5711 static inline tree
5712 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5714 return cont_stmt->control_use;
5718 /* The same as above, but return the address. */
5720 static inline tree *
5721 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5723 return &cont_stmt->control_use;
5727 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5729 static inline void
5730 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5732 cont_stmt->control_use = use;
5735 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5736 TRANSACTION_STMT. */
5738 static inline gimple_seq *
5739 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5741 return &transaction_stmt->body;
5744 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5746 static inline gimple_seq
5747 gimple_transaction_body (gtransaction *transaction_stmt)
5749 return *gimple_transaction_body_ptr (transaction_stmt);
5752 /* Return the label associated with a GIMPLE_TRANSACTION. */
5754 static inline tree
5755 gimple_transaction_label (const gtransaction *transaction_stmt)
5757 return transaction_stmt->label;
5760 static inline tree *
5761 gimple_transaction_label_ptr (gtransaction *transaction_stmt)
5763 return &transaction_stmt->label;
5766 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5768 static inline unsigned int
5769 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5771 return transaction_stmt->subcode;
5774 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5775 TRANSACTION_STMT. */
5777 static inline void
5778 gimple_transaction_set_body (gtransaction *transaction_stmt,
5779 gimple_seq body)
5781 transaction_stmt->body = body;
5784 /* Set the label associated with a GIMPLE_TRANSACTION. */
5786 static inline void
5787 gimple_transaction_set_label (gtransaction *transaction_stmt, tree label)
5789 transaction_stmt->label = label;
5792 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
5794 static inline void
5795 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
5796 unsigned int subcode)
5798 transaction_stmt->subcode = subcode;
5802 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
5804 static inline tree *
5805 gimple_return_retval_ptr (const greturn *gs)
5807 return const_cast<tree *> (&gs->op[0]);
5810 /* Return the return value for GIMPLE_RETURN GS. */
5812 static inline tree
5813 gimple_return_retval (const greturn *gs)
5815 return gs->op[0];
5819 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
5821 static inline void
5822 gimple_return_set_retval (greturn *gs, tree retval)
5824 gs->op[0] = retval;
5828 /* Return the return bounds for GIMPLE_RETURN GS. */
5830 static inline tree
5831 gimple_return_retbnd (const_gimple gs)
5833 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5834 return gimple_op (gs, 1);
5838 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
5840 static inline void
5841 gimple_return_set_retbnd (gimple gs, tree retval)
5843 GIMPLE_CHECK (gs, GIMPLE_RETURN);
5844 gimple_set_op (gs, 1, retval);
5848 /* Returns true when the gimple statement STMT is any of the OMP types. */
5850 #define CASE_GIMPLE_OMP \
5851 case GIMPLE_OMP_PARALLEL: \
5852 case GIMPLE_OMP_TASK: \
5853 case GIMPLE_OMP_FOR: \
5854 case GIMPLE_OMP_SECTIONS: \
5855 case GIMPLE_OMP_SECTIONS_SWITCH: \
5856 case GIMPLE_OMP_SINGLE: \
5857 case GIMPLE_OMP_TARGET: \
5858 case GIMPLE_OMP_TEAMS: \
5859 case GIMPLE_OMP_SECTION: \
5860 case GIMPLE_OMP_MASTER: \
5861 case GIMPLE_OMP_TASKGROUP: \
5862 case GIMPLE_OMP_ORDERED: \
5863 case GIMPLE_OMP_CRITICAL: \
5864 case GIMPLE_OMP_RETURN: \
5865 case GIMPLE_OMP_ATOMIC_LOAD: \
5866 case GIMPLE_OMP_ATOMIC_STORE: \
5867 case GIMPLE_OMP_CONTINUE
5869 static inline bool
5870 is_gimple_omp (const_gimple stmt)
5872 switch (gimple_code (stmt))
5874 CASE_GIMPLE_OMP:
5875 return true;
5876 default:
5877 return false;
5881 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
5882 specifically. */
5884 static inline bool
5885 is_gimple_omp_oacc (const_gimple stmt)
5887 gcc_assert (is_gimple_omp (stmt));
5888 switch (gimple_code (stmt))
5890 case GIMPLE_OMP_FOR:
5891 switch (gimple_omp_for_kind (stmt))
5893 case GF_OMP_FOR_KIND_OACC_LOOP:
5894 return true;
5895 default:
5896 return false;
5898 case GIMPLE_OMP_TARGET:
5899 switch (gimple_omp_target_kind (stmt))
5901 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
5902 case GF_OMP_TARGET_KIND_OACC_KERNELS:
5903 case GF_OMP_TARGET_KIND_OACC_DATA:
5904 case GF_OMP_TARGET_KIND_OACC_UPDATE:
5905 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
5906 return true;
5907 default:
5908 return false;
5910 default:
5911 return false;
5916 /* Return true if the OMP gimple statement STMT is offloaded. */
5918 static inline bool
5919 is_gimple_omp_offloaded (const_gimple stmt)
5921 gcc_assert (is_gimple_omp (stmt));
5922 switch (gimple_code (stmt))
5924 case GIMPLE_OMP_TARGET:
5925 switch (gimple_omp_target_kind (stmt))
5927 case GF_OMP_TARGET_KIND_REGION:
5928 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
5929 case GF_OMP_TARGET_KIND_OACC_KERNELS:
5930 return true;
5931 default:
5932 return false;
5934 default:
5935 return false;
5940 /* Returns TRUE if statement G is a GIMPLE_NOP. */
5942 static inline bool
5943 gimple_nop_p (const_gimple g)
5945 return gimple_code (g) == GIMPLE_NOP;
5949 /* Return true if GS is a GIMPLE_RESX. */
5951 static inline bool
5952 is_gimple_resx (const_gimple gs)
5954 return gimple_code (gs) == GIMPLE_RESX;
5957 /* Return the type of the main expression computed by STMT. Return
5958 void_type_node if the statement computes nothing. */
5960 static inline tree
5961 gimple_expr_type (const_gimple stmt)
5963 enum gimple_code code = gimple_code (stmt);
5964 /* In general we want to pass out a type that can be substituted
5965 for both the RHS and the LHS types if there is a possibly
5966 useless conversion involved. That means returning the
5967 original RHS type as far as we can reconstruct it. */
5968 if (code == GIMPLE_CALL)
5970 const gcall *call_stmt = as_a <const gcall *> (stmt);
5971 if (gimple_call_internal_p (call_stmt)
5972 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
5973 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
5974 else
5975 return gimple_call_return_type (call_stmt);
5977 else if (code == GIMPLE_ASSIGN)
5979 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
5980 return TREE_TYPE (gimple_assign_rhs1 (stmt));
5981 else
5982 /* As fallback use the type of the LHS. */
5983 return TREE_TYPE (gimple_get_lhs (stmt));
5985 else if (code == GIMPLE_COND)
5986 return boolean_type_node;
5987 else
5988 return void_type_node;
5991 /* Enum and arrays used for allocation stats. Keep in sync with
5992 gimple.c:gimple_alloc_kind_names. */
5993 enum gimple_alloc_kind
5995 gimple_alloc_kind_assign, /* Assignments. */
5996 gimple_alloc_kind_phi, /* PHI nodes. */
5997 gimple_alloc_kind_cond, /* Conditionals. */
5998 gimple_alloc_kind_rest, /* Everything else. */
5999 gimple_alloc_kind_all
6002 extern int gimple_alloc_counts[];
6003 extern int gimple_alloc_sizes[];
6005 /* Return the allocation kind for a given stmt CODE. */
6006 static inline enum gimple_alloc_kind
6007 gimple_alloc_kind (enum gimple_code code)
6009 switch (code)
6011 case GIMPLE_ASSIGN:
6012 return gimple_alloc_kind_assign;
6013 case GIMPLE_PHI:
6014 return gimple_alloc_kind_phi;
6015 case GIMPLE_COND:
6016 return gimple_alloc_kind_cond;
6017 default:
6018 return gimple_alloc_kind_rest;
6022 /* Return true if a location should not be emitted for this statement
6023 by annotate_all_with_location. */
6025 static inline bool
6026 gimple_do_not_emit_location_p (gimple g)
6028 return gimple_plf (g, GF_PLF_1);
6031 /* Mark statement G so a location will not be emitted by
6032 annotate_one_with_location. */
6034 static inline void
6035 gimple_set_do_not_emit_location (gimple g)
6037 /* The PLF flags are initialized to 0 when a new tuple is created,
6038 so no need to initialize it anywhere. */
6039 gimple_set_plf (g, GF_PLF_1, true);
6043 /* Macros for showing usage statistics. */
6044 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6045 ? (x) \
6046 : ((x) < 1024*1024*10 \
6047 ? (x) / 1024 \
6048 : (x) / (1024*1024))))
6050 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6052 #endif /* GCC_GIMPLE_H */