* config/sparc/sparc.c (sparc_option_override): Set MASK_FSMULD flag
[official-gcc.git] / gcc / gimple.h
blob2d81eedab4ade2b63e85ce76b04ef0ba1027ef87
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2017 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 \
50 ATTRIBUTE_COLD;
52 #define GIMPLE_CHECK(GS, CODE) \
53 do { \
54 const gimple *__gs = (GS); \
55 if (gimple_code (__gs) != (CODE)) \
56 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
57 (CODE), ERROR_MARK); \
58 } while (0)
59 template <typename T>
60 static inline T
61 GIMPLE_CHECK2(const gimple *gs,
62 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
63 const char *file = __builtin_FILE (),
64 int line = __builtin_LINE (),
65 const char *fun = __builtin_FUNCTION ())
66 #else
67 const char *file = __FILE__,
68 int line = __LINE__,
69 const char *fun = NULL)
70 #endif
72 T ret = dyn_cast <T> (gs);
73 if (!ret)
74 gimple_check_failed (gs, file, line, fun,
75 remove_pointer<T>::type::code_, ERROR_MARK);
76 return ret;
78 template <typename T>
79 static inline T
80 GIMPLE_CHECK2(gimple *gs,
81 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
82 const char *file = __builtin_FILE (),
83 int line = __builtin_LINE (),
84 const char *fun = __builtin_FUNCTION ())
85 #else
86 const char *file = __FILE__,
87 int line = __LINE__,
88 const char *fun = NULL)
89 #endif
91 T ret = dyn_cast <T> (gs);
92 if (!ret)
93 gimple_check_failed (gs, file, line, fun,
94 remove_pointer<T>::type::code_, ERROR_MARK);
95 return ret;
97 #else /* not ENABLE_GIMPLE_CHECKING */
98 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
99 #define GIMPLE_CHECK(GS, CODE) (void)0
100 template <typename T>
101 static inline T
102 GIMPLE_CHECK2(gimple *gs)
104 return as_a <T> (gs);
106 template <typename T>
107 static inline T
108 GIMPLE_CHECK2(const gimple *gs)
110 return as_a <T> (gs);
112 #endif
114 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
115 get_gimple_rhs_class. */
116 enum gimple_rhs_class
118 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
119 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
120 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
121 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
122 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
123 name, a _DECL, a _REF, etc. */
126 /* Specific flags for individual GIMPLE statements. These flags are
127 always stored in gimple.subcode and they may only be
128 defined for statement codes that do not use subcodes.
130 Values for the masks can overlap as long as the overlapping values
131 are never used in the same statement class.
133 The maximum mask value that can be defined is 1 << 15 (i.e., each
134 statement code can hold up to 16 bitflags).
136 Keep this list sorted. */
137 enum gf_mask {
138 GF_ASM_INPUT = 1 << 0,
139 GF_ASM_VOLATILE = 1 << 1,
140 GF_CALL_FROM_THUNK = 1 << 0,
141 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
142 GF_CALL_TAILCALL = 1 << 2,
143 GF_CALL_VA_ARG_PACK = 1 << 3,
144 GF_CALL_NOTHROW = 1 << 4,
145 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
146 GF_CALL_INTERNAL = 1 << 6,
147 GF_CALL_CTRL_ALTERING = 1 << 7,
148 GF_CALL_WITH_BOUNDS = 1 << 8,
149 GF_CALL_MUST_TAIL_CALL = 1 << 9,
150 GF_CALL_BY_DESCRIPTOR = 1 << 10,
151 GF_OMP_PARALLEL_COMBINED = 1 << 0,
152 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
153 GF_OMP_TASK_TASKLOOP = 1 << 0,
154 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
155 GF_OMP_FOR_KIND_FOR = 0,
156 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
157 GF_OMP_FOR_KIND_TASKLOOP = 2,
158 GF_OMP_FOR_KIND_CILKFOR = 3,
159 GF_OMP_FOR_KIND_OACC_LOOP = 4,
160 GF_OMP_FOR_KIND_GRID_LOOP = 5,
161 /* Flag for SIMD variants of OMP_FOR kinds. */
162 GF_OMP_FOR_SIMD = 1 << 3,
163 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
164 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
165 GF_OMP_FOR_COMBINED = 1 << 4,
166 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
167 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
168 statements. */
169 GF_OMP_FOR_GRID_PHONY = 1 << 6,
170 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
171 loop statements. */
172 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6,
173 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7,
174 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
175 GF_OMP_TARGET_KIND_REGION = 0,
176 GF_OMP_TARGET_KIND_DATA = 1,
177 GF_OMP_TARGET_KIND_UPDATE = 2,
178 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
179 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
180 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
181 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
182 GF_OMP_TARGET_KIND_OACC_DATA = 7,
183 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
184 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
185 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
186 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
187 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
189 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
190 a thread synchronization via some sort of barrier. The exact barrier
191 that would otherwise be emitted is dependent on the OMP statement with
192 which this return is associated. */
193 GF_OMP_RETURN_NOWAIT = 1 << 0,
195 GF_OMP_SECTION_LAST = 1 << 0,
196 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
197 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
198 GF_PREDICT_TAKEN = 1 << 15
201 /* Currently, there are only two types of gimple debug stmt. Others are
202 envisioned, for example, to enable the generation of is_stmt notes
203 in line number information, to mark sequence points, etc. This
204 subcode is to be used to tell them apart. */
205 enum gimple_debug_subcode {
206 GIMPLE_DEBUG_BIND = 0,
207 GIMPLE_DEBUG_SOURCE_BIND = 1
210 /* Masks for selecting a pass local flag (PLF) to work on. These
211 masks are used by gimple_set_plf and gimple_plf. */
212 enum plf_mask {
213 GF_PLF_1 = 1 << 0,
214 GF_PLF_2 = 1 << 1
217 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
218 are for 64 bit hosts. */
220 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
221 chain_next ("%h.next"), variable_size))
222 gimple
224 /* [ WORD 1 ]
225 Main identifying code for a tuple. */
226 ENUM_BITFIELD(gimple_code) code : 8;
228 /* Nonzero if a warning should not be emitted on this tuple. */
229 unsigned int no_warning : 1;
231 /* Nonzero if this tuple has been visited. Passes are responsible
232 for clearing this bit before using it. */
233 unsigned int visited : 1;
235 /* Nonzero if this tuple represents a non-temporal move. */
236 unsigned int nontemporal_move : 1;
238 /* Pass local flags. These flags are free for any pass to use as
239 they see fit. Passes should not assume that these flags contain
240 any useful value when the pass starts. Any initial state that
241 the pass requires should be set on entry to the pass. See
242 gimple_set_plf and gimple_plf for usage. */
243 unsigned int plf : 2;
245 /* Nonzero if this statement has been modified and needs to have its
246 operands rescanned. */
247 unsigned modified : 1;
249 /* Nonzero if this statement contains volatile operands. */
250 unsigned has_volatile_ops : 1;
252 /* Padding to get subcode to 16 bit alignment. */
253 unsigned pad : 1;
255 /* The SUBCODE field can be used for tuple-specific flags for tuples
256 that do not require subcodes. Note that SUBCODE should be at
257 least as wide as tree codes, as several tuples store tree codes
258 in there. */
259 unsigned int subcode : 16;
261 /* UID of this statement. This is used by passes that want to
262 assign IDs to statements. It must be assigned and used by each
263 pass. By default it should be assumed to contain garbage. */
264 unsigned uid;
266 /* [ WORD 2 ]
267 Locus information for debug info. */
268 location_t location;
270 /* Number of operands in this tuple. */
271 unsigned num_ops;
273 /* [ WORD 3 ]
274 Basic block holding this statement. */
275 basic_block bb;
277 /* [ WORD 4-5 ]
278 Linked lists of gimple statements. The next pointers form
279 a NULL terminated list, the prev pointers are a cyclic list.
280 A gimple statement is hence also a double-ended list of
281 statements, with the pointer itself being the first element,
282 and the prev pointer being the last. */
283 gimple *next;
284 gimple *GTY((skip)) prev;
288 /* Base structure for tuples with operands. */
290 /* This gimple subclass has no tag value. */
291 struct GTY(())
292 gimple_statement_with_ops_base : public gimple
294 /* [ WORD 1-6 ] : base class */
296 /* [ WORD 7 ]
297 SSA operand vectors. NOTE: It should be possible to
298 amalgamate these vectors with the operand vector OP. However,
299 the SSA operand vectors are organized differently and contain
300 more information (like immediate use chaining). */
301 struct use_optype_d GTY((skip (""))) *use_ops;
305 /* Statements that take register operands. */
307 struct GTY((tag("GSS_WITH_OPS")))
308 gimple_statement_with_ops : public gimple_statement_with_ops_base
310 /* [ WORD 1-7 ] : base class */
312 /* [ WORD 8 ]
313 Operand vector. NOTE! This must always be the last field
314 of this structure. In particular, this means that this
315 structure cannot be embedded inside another one. */
316 tree GTY((length ("%h.num_ops"))) op[1];
320 /* Base for statements that take both memory and register operands. */
322 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
323 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
325 /* [ WORD 1-7 ] : base class */
327 /* [ WORD 8-9 ]
328 Virtual operands for this statement. The GC will pick them
329 up via the ssa_names array. */
330 tree GTY((skip (""))) vdef;
331 tree GTY((skip (""))) vuse;
335 /* Statements that take both memory and register operands. */
337 struct GTY((tag("GSS_WITH_MEM_OPS")))
338 gimple_statement_with_memory_ops :
339 public gimple_statement_with_memory_ops_base
341 /* [ WORD 1-9 ] : base class */
343 /* [ WORD 10 ]
344 Operand vector. NOTE! This must always be the last field
345 of this structure. In particular, this means that this
346 structure cannot be embedded inside another one. */
347 tree GTY((length ("%h.num_ops"))) op[1];
351 /* Call statements that take both memory and register operands. */
353 struct GTY((tag("GSS_CALL")))
354 gcall : public gimple_statement_with_memory_ops_base
356 /* [ WORD 1-9 ] : base class */
358 /* [ WORD 10-13 ] */
359 struct pt_solution call_used;
360 struct pt_solution call_clobbered;
362 /* [ WORD 14 ] */
363 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
364 tree GTY ((tag ("0"))) fntype;
365 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
366 } u;
368 /* [ WORD 15 ]
369 Operand vector. NOTE! This must always be the last field
370 of this structure. In particular, this means that this
371 structure cannot be embedded inside another one. */
372 tree GTY((length ("%h.num_ops"))) op[1];
374 static const enum gimple_code code_ = GIMPLE_CALL;
378 /* OMP statements. */
380 struct GTY((tag("GSS_OMP")))
381 gimple_statement_omp : public gimple
383 /* [ WORD 1-6 ] : base class */
385 /* [ WORD 7 ] */
386 gimple_seq body;
390 /* GIMPLE_BIND */
392 struct GTY((tag("GSS_BIND")))
393 gbind : public gimple
395 /* [ WORD 1-6 ] : base class */
397 /* [ WORD 7 ]
398 Variables declared in this scope. */
399 tree vars;
401 /* [ WORD 8 ]
402 This is different than the BLOCK field in gimple,
403 which is analogous to TREE_BLOCK (i.e., the lexical block holding
404 this statement). This field is the equivalent of BIND_EXPR_BLOCK
405 in tree land (i.e., the lexical scope defined by this bind). See
406 gimple-low.c. */
407 tree block;
409 /* [ WORD 9 ] */
410 gimple_seq body;
414 /* GIMPLE_CATCH */
416 struct GTY((tag("GSS_CATCH")))
417 gcatch : public gimple
419 /* [ WORD 1-6 ] : base class */
421 /* [ WORD 7 ] */
422 tree types;
424 /* [ WORD 8 ] */
425 gimple_seq handler;
429 /* GIMPLE_EH_FILTER */
431 struct GTY((tag("GSS_EH_FILTER")))
432 geh_filter : public gimple
434 /* [ WORD 1-6 ] : base class */
436 /* [ WORD 7 ]
437 Filter types. */
438 tree types;
440 /* [ WORD 8 ]
441 Failure actions. */
442 gimple_seq failure;
445 /* GIMPLE_EH_ELSE */
447 struct GTY((tag("GSS_EH_ELSE")))
448 geh_else : public gimple
450 /* [ WORD 1-6 ] : base class */
452 /* [ WORD 7,8 ] */
453 gimple_seq n_body, e_body;
456 /* GIMPLE_EH_MUST_NOT_THROW */
458 struct GTY((tag("GSS_EH_MNT")))
459 geh_mnt : public gimple
461 /* [ WORD 1-6 ] : base class */
463 /* [ WORD 7 ] Abort function decl. */
464 tree fndecl;
467 /* GIMPLE_PHI */
469 struct GTY((tag("GSS_PHI")))
470 gphi : public gimple
472 /* [ WORD 1-6 ] : base class */
474 /* [ WORD 7 ] */
475 unsigned capacity;
476 unsigned nargs;
478 /* [ WORD 8 ] */
479 tree result;
481 /* [ WORD 9 ] */
482 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
486 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
488 struct GTY((tag("GSS_EH_CTRL")))
489 gimple_statement_eh_ctrl : public gimple
491 /* [ WORD 1-6 ] : base class */
493 /* [ WORD 7 ]
494 Exception region number. */
495 int region;
498 struct GTY((tag("GSS_EH_CTRL")))
499 gresx : public gimple_statement_eh_ctrl
501 /* No extra fields; adds invariant:
502 stmt->code == GIMPLE_RESX. */
505 struct GTY((tag("GSS_EH_CTRL")))
506 geh_dispatch : public gimple_statement_eh_ctrl
508 /* No extra fields; adds invariant:
509 stmt->code == GIMPLE_EH_DISPATH. */
513 /* GIMPLE_TRY */
515 struct GTY((tag("GSS_TRY")))
516 gtry : public gimple
518 /* [ WORD 1-6 ] : base class */
520 /* [ WORD 7 ]
521 Expression to evaluate. */
522 gimple_seq eval;
524 /* [ WORD 8 ]
525 Cleanup expression. */
526 gimple_seq cleanup;
529 /* Kind of GIMPLE_TRY statements. */
530 enum gimple_try_flags
532 /* A try/catch. */
533 GIMPLE_TRY_CATCH = 1 << 0,
535 /* A try/finally. */
536 GIMPLE_TRY_FINALLY = 1 << 1,
537 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
539 /* Analogous to TRY_CATCH_IS_CLEANUP. */
540 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
543 /* GIMPLE_WITH_CLEANUP_EXPR */
545 struct GTY((tag("GSS_WCE")))
546 gimple_statement_wce : public gimple
548 /* [ WORD 1-6 ] : base class */
550 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
551 executed if an exception is thrown, not on normal exit of its
552 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
553 in TARGET_EXPRs. */
555 /* [ WORD 7 ]
556 Cleanup expression. */
557 gimple_seq cleanup;
561 /* GIMPLE_ASM */
563 struct GTY((tag("GSS_ASM")))
564 gasm : public gimple_statement_with_memory_ops_base
566 /* [ WORD 1-9 ] : base class */
568 /* [ WORD 10 ]
569 __asm__ statement. */
570 const char *string;
572 /* [ WORD 11 ]
573 Number of inputs, outputs, clobbers, labels. */
574 unsigned char ni;
575 unsigned char no;
576 unsigned char nc;
577 unsigned char nl;
579 /* [ WORD 12 ]
580 Operand vector. NOTE! This must always be the last field
581 of this structure. In particular, this means that this
582 structure cannot be embedded inside another one. */
583 tree GTY((length ("%h.num_ops"))) op[1];
586 /* GIMPLE_OMP_CRITICAL */
588 struct GTY((tag("GSS_OMP_CRITICAL")))
589 gomp_critical : public gimple_statement_omp
591 /* [ WORD 1-7 ] : base class */
593 /* [ WORD 8 ] */
594 tree clauses;
596 /* [ WORD 9 ]
597 Critical section name. */
598 tree name;
602 struct GTY(()) gimple_omp_for_iter {
603 /* Condition code. */
604 enum tree_code cond;
606 /* Index variable. */
607 tree index;
609 /* Initial value. */
610 tree initial;
612 /* Final value. */
613 tree final;
615 /* Increment. */
616 tree incr;
619 /* GIMPLE_OMP_FOR */
621 struct GTY((tag("GSS_OMP_FOR")))
622 gomp_for : public gimple_statement_omp
624 /* [ WORD 1-7 ] : base class */
626 /* [ WORD 8 ] */
627 tree clauses;
629 /* [ WORD 9 ]
630 Number of elements in iter array. */
631 size_t collapse;
633 /* [ WORD 10 ] */
634 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
636 /* [ WORD 11 ]
637 Pre-body evaluated before the loop body begins. */
638 gimple_seq pre_body;
642 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
644 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
645 gimple_statement_omp_parallel_layout : public gimple_statement_omp
647 /* [ WORD 1-7 ] : base class */
649 /* [ WORD 8 ]
650 Clauses. */
651 tree clauses;
653 /* [ WORD 9 ]
654 Child function holding the body of the parallel region. */
655 tree child_fn;
657 /* [ WORD 10 ]
658 Shared data argument. */
659 tree data_arg;
662 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
663 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
664 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
666 /* No extra fields; adds invariant:
667 stmt->code == GIMPLE_OMP_PARALLEL
668 || stmt->code == GIMPLE_OMP_TASK. */
671 /* GIMPLE_OMP_PARALLEL */
672 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
673 gomp_parallel : public gimple_statement_omp_taskreg
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_PARALLEL. */
679 /* GIMPLE_OMP_TARGET */
680 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
681 gomp_target : public gimple_statement_omp_parallel_layout
683 /* No extra fields; adds invariant:
684 stmt->code == GIMPLE_OMP_TARGET. */
687 /* GIMPLE_OMP_TASK */
689 struct GTY((tag("GSS_OMP_TASK")))
690 gomp_task : public gimple_statement_omp_taskreg
692 /* [ WORD 1-10 ] : base class */
694 /* [ WORD 11 ]
695 Child function holding firstprivate initialization if needed. */
696 tree copy_fn;
698 /* [ WORD 12-13 ]
699 Size and alignment in bytes of the argument data block. */
700 tree arg_size;
701 tree arg_align;
705 /* GIMPLE_OMP_SECTION */
706 /* Uses struct gimple_statement_omp. */
709 /* GIMPLE_OMP_SECTIONS */
711 struct GTY((tag("GSS_OMP_SECTIONS")))
712 gomp_sections : public gimple_statement_omp
714 /* [ WORD 1-7 ] : base class */
716 /* [ WORD 8 ] */
717 tree clauses;
719 /* [ WORD 9 ]
720 The control variable used for deciding which of the sections to
721 execute. */
722 tree control;
725 /* GIMPLE_OMP_CONTINUE.
727 Note: This does not inherit from gimple_statement_omp, because we
728 do not need the body field. */
730 struct GTY((tag("GSS_OMP_CONTINUE")))
731 gomp_continue : public gimple
733 /* [ WORD 1-6 ] : base class */
735 /* [ WORD 7 ] */
736 tree control_def;
738 /* [ WORD 8 ] */
739 tree control_use;
742 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
744 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
745 gimple_statement_omp_single_layout : public gimple_statement_omp
747 /* [ WORD 1-7 ] : base class */
749 /* [ WORD 8 ] */
750 tree clauses;
753 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
754 gomp_single : public gimple_statement_omp_single_layout
756 /* No extra fields; adds invariant:
757 stmt->code == GIMPLE_OMP_SINGLE. */
760 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
761 gomp_teams : public gimple_statement_omp_single_layout
763 /* No extra fields; adds invariant:
764 stmt->code == GIMPLE_OMP_TEAMS. */
767 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
768 gomp_ordered : public gimple_statement_omp_single_layout
770 /* No extra fields; adds invariant:
771 stmt->code == GIMPLE_OMP_ORDERED. */
775 /* GIMPLE_OMP_ATOMIC_LOAD.
776 Note: This is based on gimple, not g_s_omp, because g_s_omp
777 contains a sequence, which we don't need here. */
779 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
780 gomp_atomic_load : public gimple
782 /* [ WORD 1-6 ] : base class */
784 /* [ WORD 7-8 ] */
785 tree rhs, lhs;
788 /* GIMPLE_OMP_ATOMIC_STORE.
789 See note on GIMPLE_OMP_ATOMIC_LOAD. */
791 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
792 gimple_statement_omp_atomic_store_layout : public gimple
794 /* [ WORD 1-6 ] : base class */
796 /* [ WORD 7 ] */
797 tree val;
800 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 gomp_atomic_store :
802 public gimple_statement_omp_atomic_store_layout
804 /* No extra fields; adds invariant:
805 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
808 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
809 gimple_statement_omp_return :
810 public gimple_statement_omp_atomic_store_layout
812 /* No extra fields; adds invariant:
813 stmt->code == GIMPLE_OMP_RETURN. */
816 /* GIMPLE_TRANSACTION. */
818 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
820 /* The __transaction_atomic was declared [[outer]] or it is
821 __transaction_relaxed. */
822 #define GTMA_IS_OUTER (1u << 0)
823 #define GTMA_IS_RELAXED (1u << 1)
824 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
826 /* The transaction is seen to not have an abort. */
827 #define GTMA_HAVE_ABORT (1u << 2)
828 /* The transaction is seen to have loads or stores. */
829 #define GTMA_HAVE_LOAD (1u << 3)
830 #define GTMA_HAVE_STORE (1u << 4)
831 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
832 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
833 /* The transaction WILL enter serial irrevocable mode.
834 An irrevocable block post-dominates the entire transaction, such
835 that all invocations of the transaction will go serial-irrevocable.
836 In such case, we don't bother instrumenting the transaction, and
837 tell the runtime that it should begin the transaction in
838 serial-irrevocable mode. */
839 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
840 /* The transaction contains no instrumentation code whatsover, most
841 likely because it is guaranteed to go irrevocable upon entry. */
842 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
844 struct GTY((tag("GSS_TRANSACTION")))
845 gtransaction : public gimple_statement_with_memory_ops_base
847 /* [ WORD 1-9 ] : base class */
849 /* [ WORD 10 ] */
850 gimple_seq body;
852 /* [ WORD 11-13 ] */
853 tree label_norm;
854 tree label_uninst;
855 tree label_over;
858 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
859 enum gimple_statement_structure_enum {
860 #include "gsstruct.def"
861 LAST_GSS_ENUM
863 #undef DEFGSSTRUCT
865 /* A statement with the invariant that
866 stmt->code == GIMPLE_COND
867 i.e. a conditional jump statement. */
869 struct GTY((tag("GSS_WITH_OPS")))
870 gcond : public gimple_statement_with_ops
872 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
873 static const enum gimple_code code_ = GIMPLE_COND;
876 /* A statement with the invariant that
877 stmt->code == GIMPLE_DEBUG
878 i.e. a debug statement. */
880 struct GTY((tag("GSS_WITH_OPS")))
881 gdebug : public gimple_statement_with_ops
883 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
886 /* A statement with the invariant that
887 stmt->code == GIMPLE_GOTO
888 i.e. a goto statement. */
890 struct GTY((tag("GSS_WITH_OPS")))
891 ggoto : public gimple_statement_with_ops
893 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
896 /* A statement with the invariant that
897 stmt->code == GIMPLE_LABEL
898 i.e. a label statement. */
900 struct GTY((tag("GSS_WITH_OPS")))
901 glabel : public gimple_statement_with_ops
903 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
906 /* A statement with the invariant that
907 stmt->code == GIMPLE_SWITCH
908 i.e. a switch statement. */
910 struct GTY((tag("GSS_WITH_OPS")))
911 gswitch : public gimple_statement_with_ops
913 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
916 /* A statement with the invariant that
917 stmt->code == GIMPLE_ASSIGN
918 i.e. an assignment statement. */
920 struct GTY((tag("GSS_WITH_MEM_OPS")))
921 gassign : public gimple_statement_with_memory_ops
923 static const enum gimple_code code_ = GIMPLE_ASSIGN;
924 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
927 /* A statement with the invariant that
928 stmt->code == GIMPLE_RETURN
929 i.e. a return statement. */
931 struct GTY((tag("GSS_WITH_MEM_OPS")))
932 greturn : public gimple_statement_with_memory_ops
934 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
937 template <>
938 template <>
939 inline bool
940 is_a_helper <gasm *>::test (gimple *gs)
942 return gs->code == GIMPLE_ASM;
945 template <>
946 template <>
947 inline bool
948 is_a_helper <gassign *>::test (gimple *gs)
950 return gs->code == GIMPLE_ASSIGN;
953 template <>
954 template <>
955 inline bool
956 is_a_helper <const gassign *>::test (const gimple *gs)
958 return gs->code == GIMPLE_ASSIGN;
961 template <>
962 template <>
963 inline bool
964 is_a_helper <gbind *>::test (gimple *gs)
966 return gs->code == GIMPLE_BIND;
969 template <>
970 template <>
971 inline bool
972 is_a_helper <gcall *>::test (gimple *gs)
974 return gs->code == GIMPLE_CALL;
977 template <>
978 template <>
979 inline bool
980 is_a_helper <gcatch *>::test (gimple *gs)
982 return gs->code == GIMPLE_CATCH;
985 template <>
986 template <>
987 inline bool
988 is_a_helper <gcond *>::test (gimple *gs)
990 return gs->code == GIMPLE_COND;
993 template <>
994 template <>
995 inline bool
996 is_a_helper <const gcond *>::test (const gimple *gs)
998 return gs->code == GIMPLE_COND;
1001 template <>
1002 template <>
1003 inline bool
1004 is_a_helper <gdebug *>::test (gimple *gs)
1006 return gs->code == GIMPLE_DEBUG;
1009 template <>
1010 template <>
1011 inline bool
1012 is_a_helper <ggoto *>::test (gimple *gs)
1014 return gs->code == GIMPLE_GOTO;
1017 template <>
1018 template <>
1019 inline bool
1020 is_a_helper <glabel *>::test (gimple *gs)
1022 return gs->code == GIMPLE_LABEL;
1025 template <>
1026 template <>
1027 inline bool
1028 is_a_helper <gresx *>::test (gimple *gs)
1030 return gs->code == GIMPLE_RESX;
1033 template <>
1034 template <>
1035 inline bool
1036 is_a_helper <geh_dispatch *>::test (gimple *gs)
1038 return gs->code == GIMPLE_EH_DISPATCH;
1041 template <>
1042 template <>
1043 inline bool
1044 is_a_helper <geh_else *>::test (gimple *gs)
1046 return gs->code == GIMPLE_EH_ELSE;
1049 template <>
1050 template <>
1051 inline bool
1052 is_a_helper <geh_filter *>::test (gimple *gs)
1054 return gs->code == GIMPLE_EH_FILTER;
1057 template <>
1058 template <>
1059 inline bool
1060 is_a_helper <geh_mnt *>::test (gimple *gs)
1062 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1065 template <>
1066 template <>
1067 inline bool
1068 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1070 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1073 template <>
1074 template <>
1075 inline bool
1076 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1078 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1081 template <>
1082 template <>
1083 inline bool
1084 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1086 return gs->code == GIMPLE_OMP_RETURN;
1089 template <>
1090 template <>
1091 inline bool
1092 is_a_helper <gomp_continue *>::test (gimple *gs)
1094 return gs->code == GIMPLE_OMP_CONTINUE;
1097 template <>
1098 template <>
1099 inline bool
1100 is_a_helper <gomp_critical *>::test (gimple *gs)
1102 return gs->code == GIMPLE_OMP_CRITICAL;
1105 template <>
1106 template <>
1107 inline bool
1108 is_a_helper <gomp_ordered *>::test (gimple *gs)
1110 return gs->code == GIMPLE_OMP_ORDERED;
1113 template <>
1114 template <>
1115 inline bool
1116 is_a_helper <gomp_for *>::test (gimple *gs)
1118 return gs->code == GIMPLE_OMP_FOR;
1121 template <>
1122 template <>
1123 inline bool
1124 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1126 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1129 template <>
1130 template <>
1131 inline bool
1132 is_a_helper <gomp_parallel *>::test (gimple *gs)
1134 return gs->code == GIMPLE_OMP_PARALLEL;
1137 template <>
1138 template <>
1139 inline bool
1140 is_a_helper <gomp_target *>::test (gimple *gs)
1142 return gs->code == GIMPLE_OMP_TARGET;
1145 template <>
1146 template <>
1147 inline bool
1148 is_a_helper <gomp_sections *>::test (gimple *gs)
1150 return gs->code == GIMPLE_OMP_SECTIONS;
1153 template <>
1154 template <>
1155 inline bool
1156 is_a_helper <gomp_single *>::test (gimple *gs)
1158 return gs->code == GIMPLE_OMP_SINGLE;
1161 template <>
1162 template <>
1163 inline bool
1164 is_a_helper <gomp_teams *>::test (gimple *gs)
1166 return gs->code == GIMPLE_OMP_TEAMS;
1169 template <>
1170 template <>
1171 inline bool
1172 is_a_helper <gomp_task *>::test (gimple *gs)
1174 return gs->code == GIMPLE_OMP_TASK;
1177 template <>
1178 template <>
1179 inline bool
1180 is_a_helper <gphi *>::test (gimple *gs)
1182 return gs->code == GIMPLE_PHI;
1185 template <>
1186 template <>
1187 inline bool
1188 is_a_helper <greturn *>::test (gimple *gs)
1190 return gs->code == GIMPLE_RETURN;
1193 template <>
1194 template <>
1195 inline bool
1196 is_a_helper <gswitch *>::test (gimple *gs)
1198 return gs->code == GIMPLE_SWITCH;
1201 template <>
1202 template <>
1203 inline bool
1204 is_a_helper <gtransaction *>::test (gimple *gs)
1206 return gs->code == GIMPLE_TRANSACTION;
1209 template <>
1210 template <>
1211 inline bool
1212 is_a_helper <gtry *>::test (gimple *gs)
1214 return gs->code == GIMPLE_TRY;
1217 template <>
1218 template <>
1219 inline bool
1220 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1222 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1225 template <>
1226 template <>
1227 inline bool
1228 is_a_helper <const gasm *>::test (const gimple *gs)
1230 return gs->code == GIMPLE_ASM;
1233 template <>
1234 template <>
1235 inline bool
1236 is_a_helper <const gbind *>::test (const gimple *gs)
1238 return gs->code == GIMPLE_BIND;
1241 template <>
1242 template <>
1243 inline bool
1244 is_a_helper <const gcall *>::test (const gimple *gs)
1246 return gs->code == GIMPLE_CALL;
1249 template <>
1250 template <>
1251 inline bool
1252 is_a_helper <const gcatch *>::test (const gimple *gs)
1254 return gs->code == GIMPLE_CATCH;
1257 template <>
1258 template <>
1259 inline bool
1260 is_a_helper <const gresx *>::test (const gimple *gs)
1262 return gs->code == GIMPLE_RESX;
1265 template <>
1266 template <>
1267 inline bool
1268 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1270 return gs->code == GIMPLE_EH_DISPATCH;
1273 template <>
1274 template <>
1275 inline bool
1276 is_a_helper <const geh_filter *>::test (const gimple *gs)
1278 return gs->code == GIMPLE_EH_FILTER;
1281 template <>
1282 template <>
1283 inline bool
1284 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1286 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1289 template <>
1290 template <>
1291 inline bool
1292 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1294 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1297 template <>
1298 template <>
1299 inline bool
1300 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1302 return gs->code == GIMPLE_OMP_RETURN;
1305 template <>
1306 template <>
1307 inline bool
1308 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1310 return gs->code == GIMPLE_OMP_CONTINUE;
1313 template <>
1314 template <>
1315 inline bool
1316 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1318 return gs->code == GIMPLE_OMP_CRITICAL;
1321 template <>
1322 template <>
1323 inline bool
1324 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1326 return gs->code == GIMPLE_OMP_ORDERED;
1329 template <>
1330 template <>
1331 inline bool
1332 is_a_helper <const gomp_for *>::test (const gimple *gs)
1334 return gs->code == GIMPLE_OMP_FOR;
1337 template <>
1338 template <>
1339 inline bool
1340 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1342 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1345 template <>
1346 template <>
1347 inline bool
1348 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1350 return gs->code == GIMPLE_OMP_PARALLEL;
1353 template <>
1354 template <>
1355 inline bool
1356 is_a_helper <const gomp_target *>::test (const gimple *gs)
1358 return gs->code == GIMPLE_OMP_TARGET;
1361 template <>
1362 template <>
1363 inline bool
1364 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1366 return gs->code == GIMPLE_OMP_SECTIONS;
1369 template <>
1370 template <>
1371 inline bool
1372 is_a_helper <const gomp_single *>::test (const gimple *gs)
1374 return gs->code == GIMPLE_OMP_SINGLE;
1377 template <>
1378 template <>
1379 inline bool
1380 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1382 return gs->code == GIMPLE_OMP_TEAMS;
1385 template <>
1386 template <>
1387 inline bool
1388 is_a_helper <const gomp_task *>::test (const gimple *gs)
1390 return gs->code == GIMPLE_OMP_TASK;
1393 template <>
1394 template <>
1395 inline bool
1396 is_a_helper <const gphi *>::test (const gimple *gs)
1398 return gs->code == GIMPLE_PHI;
1401 template <>
1402 template <>
1403 inline bool
1404 is_a_helper <const gtransaction *>::test (const gimple *gs)
1406 return gs->code == GIMPLE_TRANSACTION;
1409 /* Offset in bytes to the location of the operand vector.
1410 Zero if there is no operand vector for this tuple structure. */
1411 extern size_t const gimple_ops_offset_[];
1413 /* Map GIMPLE codes to GSS codes. */
1414 extern enum gimple_statement_structure_enum const gss_for_code_[];
1416 /* This variable holds the currently expanded gimple statement for purposes
1417 of comminucating the profile info to the builtin expanders. */
1418 extern gimple *currently_expanding_gimple_stmt;
1420 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1421 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1422 greturn *gimple_build_return (tree);
1423 void gimple_call_reset_alias_info (gcall *);
1424 gcall *gimple_build_call_vec (tree, vec<tree> );
1425 gcall *gimple_build_call (tree, unsigned, ...);
1426 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1427 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1428 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1429 gcall *gimple_build_call_from_tree (tree);
1430 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1431 gassign *gimple_build_assign (tree, enum tree_code,
1432 tree, tree, tree CXX_MEM_STAT_INFO);
1433 gassign *gimple_build_assign (tree, enum tree_code,
1434 tree, tree CXX_MEM_STAT_INFO);
1435 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1436 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1437 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1438 void gimple_cond_set_condition_from_tree (gcond *, tree);
1439 glabel *gimple_build_label (tree label);
1440 ggoto *gimple_build_goto (tree dest);
1441 gimple *gimple_build_nop (void);
1442 gbind *gimple_build_bind (tree, gimple_seq, tree);
1443 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1444 vec<tree, va_gc> *, vec<tree, va_gc> *,
1445 vec<tree, va_gc> *);
1446 gcatch *gimple_build_catch (tree, gimple_seq);
1447 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1448 geh_mnt *gimple_build_eh_must_not_throw (tree);
1449 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1450 gtry *gimple_build_try (gimple_seq, gimple_seq,
1451 enum gimple_try_flags);
1452 gimple *gimple_build_wce (gimple_seq);
1453 gresx *gimple_build_resx (int);
1454 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1455 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1456 geh_dispatch *gimple_build_eh_dispatch (int);
1457 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1458 #define gimple_build_debug_bind(var,val,stmt) \
1459 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1460 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1461 #define gimple_build_debug_source_bind(var,val,stmt) \
1462 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1463 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1464 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1465 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1466 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1467 tree, tree);
1468 gimple *gimple_build_omp_section (gimple_seq);
1469 gimple *gimple_build_omp_master (gimple_seq);
1470 gimple *gimple_build_omp_grid_body (gimple_seq);
1471 gimple *gimple_build_omp_taskgroup (gimple_seq);
1472 gomp_continue *gimple_build_omp_continue (tree, tree);
1473 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1474 gimple *gimple_build_omp_return (bool);
1475 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1476 gimple *gimple_build_omp_sections_switch (void);
1477 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1478 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1479 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1480 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1481 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1482 gtransaction *gimple_build_transaction (gimple_seq);
1483 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1484 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1485 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1486 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1487 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1488 location_t);
1489 extern void annotate_all_with_location (gimple_seq, location_t);
1490 bool empty_body_p (gimple_seq);
1491 gimple_seq gimple_seq_copy (gimple_seq);
1492 bool gimple_call_same_target_p (const gimple *, const gimple *);
1493 int gimple_call_flags (const gimple *);
1494 int gimple_call_arg_flags (const gcall *, unsigned);
1495 int gimple_call_return_flags (const gcall *);
1496 bool gimple_assign_copy_p (gimple *);
1497 bool gimple_assign_ssa_name_copy_p (gimple *);
1498 bool gimple_assign_unary_nop_p (gimple *);
1499 void gimple_set_bb (gimple *, basic_block);
1500 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1501 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1502 tree, tree, tree);
1503 tree gimple_get_lhs (const gimple *);
1504 void gimple_set_lhs (gimple *, tree);
1505 gimple *gimple_copy (gimple *);
1506 bool gimple_has_side_effects (const gimple *);
1507 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1508 bool gimple_could_trap_p (gimple *);
1509 bool gimple_assign_rhs_could_trap_p (gimple *);
1510 extern void dump_gimple_statistics (void);
1511 unsigned get_gimple_rhs_num_ops (enum tree_code);
1512 extern tree canonicalize_cond_expr_cond (tree);
1513 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1514 extern bool gimple_compare_field_offset (tree, tree);
1515 extern tree gimple_unsigned_type (tree);
1516 extern tree gimple_signed_type (tree);
1517 extern alias_set_type gimple_get_alias_set (tree);
1518 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1519 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1520 extern combined_fn gimple_call_combined_fn (const gimple *);
1521 extern bool gimple_call_builtin_p (const gimple *);
1522 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1523 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1524 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1525 extern void dump_decl_set (FILE *, bitmap);
1526 extern bool nonfreeing_call_p (gimple *);
1527 extern bool nonbarrier_call_p (gimple *);
1528 extern bool infer_nonnull_range (gimple *, tree);
1529 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1530 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1531 extern void sort_case_labels (vec<tree>);
1532 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1533 extern void gimple_seq_set_location (gimple_seq, location_t);
1534 extern void gimple_seq_discard (gimple_seq);
1535 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1536 extern bool gimple_inexpensive_call_p (gcall *);
1537 extern bool stmt_can_terminate_bb_p (gimple *);
1539 /* Formal (expression) temporary table handling: multiple occurrences of
1540 the same scalar expression are evaluated into the same temporary. */
1542 typedef struct gimple_temp_hash_elt
1544 tree val; /* Key */
1545 tree temp; /* Value */
1546 } elt_t;
1548 /* Get the number of the next statement uid to be allocated. */
1549 static inline unsigned int
1550 gimple_stmt_max_uid (struct function *fn)
1552 return fn->last_stmt_uid;
1555 /* Set the number of the next statement uid to be allocated. */
1556 static inline void
1557 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1559 fn->last_stmt_uid = maxid;
1562 /* Set the number of the next statement uid to be allocated. */
1563 static inline unsigned int
1564 inc_gimple_stmt_max_uid (struct function *fn)
1566 return fn->last_stmt_uid++;
1569 /* Return the first node in GIMPLE sequence S. */
1571 static inline gimple_seq_node
1572 gimple_seq_first (gimple_seq s)
1574 return s;
1578 /* Return the first statement in GIMPLE sequence S. */
1580 static inline gimple *
1581 gimple_seq_first_stmt (gimple_seq s)
1583 gimple_seq_node n = gimple_seq_first (s);
1584 return n;
1587 /* Return the first statement in GIMPLE sequence S as a gbind *,
1588 verifying that it has code GIMPLE_BIND in a checked build. */
1590 static inline gbind *
1591 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1593 gimple_seq_node n = gimple_seq_first (s);
1594 return as_a <gbind *> (n);
1598 /* Return the last node in GIMPLE sequence S. */
1600 static inline gimple_seq_node
1601 gimple_seq_last (gimple_seq s)
1603 return s ? s->prev : NULL;
1607 /* Return the last statement in GIMPLE sequence S. */
1609 static inline gimple *
1610 gimple_seq_last_stmt (gimple_seq s)
1612 gimple_seq_node n = gimple_seq_last (s);
1613 return n;
1617 /* Set the last node in GIMPLE sequence *PS to LAST. */
1619 static inline void
1620 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1622 (*ps)->prev = last;
1626 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1628 static inline void
1629 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1631 *ps = first;
1635 /* Return true if GIMPLE sequence S is empty. */
1637 static inline bool
1638 gimple_seq_empty_p (gimple_seq s)
1640 return s == NULL;
1643 /* Allocate a new sequence and initialize its first element with STMT. */
1645 static inline gimple_seq
1646 gimple_seq_alloc_with_stmt (gimple *stmt)
1648 gimple_seq seq = NULL;
1649 gimple_seq_add_stmt (&seq, stmt);
1650 return seq;
1654 /* Returns the sequence of statements in BB. */
1656 static inline gimple_seq
1657 bb_seq (const_basic_block bb)
1659 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1662 static inline gimple_seq *
1663 bb_seq_addr (basic_block bb)
1665 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1668 /* Sets the sequence of statements in BB to SEQ. */
1670 static inline void
1671 set_bb_seq (basic_block bb, gimple_seq seq)
1673 gcc_checking_assert (!(bb->flags & BB_RTL));
1674 bb->il.gimple.seq = seq;
1678 /* Return the code for GIMPLE statement G. */
1680 static inline enum gimple_code
1681 gimple_code (const gimple *g)
1683 return g->code;
1687 /* Return the GSS code used by a GIMPLE code. */
1689 static inline enum gimple_statement_structure_enum
1690 gss_for_code (enum gimple_code code)
1692 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1693 return gss_for_code_[code];
1697 /* Return which GSS code is used by GS. */
1699 static inline enum gimple_statement_structure_enum
1700 gimple_statement_structure (gimple *gs)
1702 return gss_for_code (gimple_code (gs));
1706 /* Return true if statement G has sub-statements. This is only true for
1707 High GIMPLE statements. */
1709 static inline bool
1710 gimple_has_substatements (gimple *g)
1712 switch (gimple_code (g))
1714 case GIMPLE_BIND:
1715 case GIMPLE_CATCH:
1716 case GIMPLE_EH_FILTER:
1717 case GIMPLE_EH_ELSE:
1718 case GIMPLE_TRY:
1719 case GIMPLE_OMP_FOR:
1720 case GIMPLE_OMP_MASTER:
1721 case GIMPLE_OMP_TASKGROUP:
1722 case GIMPLE_OMP_ORDERED:
1723 case GIMPLE_OMP_SECTION:
1724 case GIMPLE_OMP_PARALLEL:
1725 case GIMPLE_OMP_TASK:
1726 case GIMPLE_OMP_SECTIONS:
1727 case GIMPLE_OMP_SINGLE:
1728 case GIMPLE_OMP_TARGET:
1729 case GIMPLE_OMP_TEAMS:
1730 case GIMPLE_OMP_CRITICAL:
1731 case GIMPLE_WITH_CLEANUP_EXPR:
1732 case GIMPLE_TRANSACTION:
1733 case GIMPLE_OMP_GRID_BODY:
1734 return true;
1736 default:
1737 return false;
1742 /* Return the basic block holding statement G. */
1744 static inline basic_block
1745 gimple_bb (const gimple *g)
1747 return g->bb;
1751 /* Return the lexical scope block holding statement G. */
1753 static inline tree
1754 gimple_block (const gimple *g)
1756 return LOCATION_BLOCK (g->location);
1760 /* Set BLOCK to be the lexical scope block holding statement G. */
1762 static inline void
1763 gimple_set_block (gimple *g, tree block)
1765 g->location = set_block (g->location, block);
1769 /* Return location information for statement G. */
1771 static inline location_t
1772 gimple_location (const gimple *g)
1774 return g->location;
1777 /* Return location information for statement G if g is not NULL.
1778 Otherwise, UNKNOWN_LOCATION is returned. */
1780 static inline location_t
1781 gimple_location_safe (const gimple *g)
1783 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1786 /* Set location information for statement G. */
1788 static inline void
1789 gimple_set_location (gimple *g, location_t location)
1791 g->location = location;
1795 /* Return true if G contains location information. */
1797 static inline bool
1798 gimple_has_location (const gimple *g)
1800 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1804 /* Return the file name of the location of STMT. */
1806 static inline const char *
1807 gimple_filename (const gimple *stmt)
1809 return LOCATION_FILE (gimple_location (stmt));
1813 /* Return the line number of the location of STMT. */
1815 static inline int
1816 gimple_lineno (const gimple *stmt)
1818 return LOCATION_LINE (gimple_location (stmt));
1822 /* Determine whether SEQ is a singleton. */
1824 static inline bool
1825 gimple_seq_singleton_p (gimple_seq seq)
1827 return ((gimple_seq_first (seq) != NULL)
1828 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1831 /* Return true if no warnings should be emitted for statement STMT. */
1833 static inline bool
1834 gimple_no_warning_p (const gimple *stmt)
1836 return stmt->no_warning;
1839 /* Set the no_warning flag of STMT to NO_WARNING. */
1841 static inline void
1842 gimple_set_no_warning (gimple *stmt, bool no_warning)
1844 stmt->no_warning = (unsigned) no_warning;
1847 /* Set the visited status on statement STMT to VISITED_P.
1849 Please note that this 'visited' property of the gimple statement is
1850 supposed to be undefined at pass boundaries. This means that a
1851 given pass should not assume it contains any useful value when the
1852 pass starts and thus can set it to any value it sees fit.
1854 You can learn more about the visited property of the gimple
1855 statement by reading the comments of the 'visited' data member of
1856 struct gimple.
1859 static inline void
1860 gimple_set_visited (gimple *stmt, bool visited_p)
1862 stmt->visited = (unsigned) visited_p;
1866 /* Return the visited status for statement STMT.
1868 Please note that this 'visited' property of the gimple statement is
1869 supposed to be undefined at pass boundaries. This means that a
1870 given pass should not assume it contains any useful value when the
1871 pass starts and thus can set it to any value it sees fit.
1873 You can learn more about the visited property of the gimple
1874 statement by reading the comments of the 'visited' data member of
1875 struct gimple. */
1877 static inline bool
1878 gimple_visited_p (gimple *stmt)
1880 return stmt->visited;
1884 /* Set pass local flag PLF on statement STMT to VAL_P.
1886 Please note that this PLF property of the gimple statement is
1887 supposed to be undefined at pass boundaries. This means that a
1888 given pass should not assume it contains any useful value when the
1889 pass starts and thus can set it to any value it sees fit.
1891 You can learn more about the PLF property by reading the comment of
1892 the 'plf' data member of struct gimple_statement_structure. */
1894 static inline void
1895 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1897 if (val_p)
1898 stmt->plf |= (unsigned int) plf;
1899 else
1900 stmt->plf &= ~((unsigned int) plf);
1904 /* Return the value of pass local flag PLF on statement STMT.
1906 Please note that this 'plf' property of the gimple statement is
1907 supposed to be undefined at pass boundaries. This means that a
1908 given pass should not assume it contains any useful value when the
1909 pass starts and thus can set it to any value it sees fit.
1911 You can learn more about the plf property by reading the comment of
1912 the 'plf' data member of struct gimple_statement_structure. */
1914 static inline unsigned int
1915 gimple_plf (gimple *stmt, enum plf_mask plf)
1917 return stmt->plf & ((unsigned int) plf);
1921 /* Set the UID of statement.
1923 Please note that this UID property is supposed to be undefined at
1924 pass boundaries. This means that a given pass should not assume it
1925 contains any useful value when the pass starts and thus can set it
1926 to any value it sees fit. */
1928 static inline void
1929 gimple_set_uid (gimple *g, unsigned uid)
1931 g->uid = uid;
1935 /* Return the UID of statement.
1937 Please note that this UID property is supposed to be undefined at
1938 pass boundaries. This means that a given pass should not assume it
1939 contains any useful value when the pass starts and thus can set it
1940 to any value it sees fit. */
1942 static inline unsigned
1943 gimple_uid (const gimple *g)
1945 return g->uid;
1949 /* Make statement G a singleton sequence. */
1951 static inline void
1952 gimple_init_singleton (gimple *g)
1954 g->next = NULL;
1955 g->prev = g;
1959 /* Return true if GIMPLE statement G has register or memory operands. */
1961 static inline bool
1962 gimple_has_ops (const gimple *g)
1964 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1967 template <>
1968 template <>
1969 inline bool
1970 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1972 return gimple_has_ops (gs);
1975 template <>
1976 template <>
1977 inline bool
1978 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1980 return gimple_has_ops (gs);
1983 /* Return true if GIMPLE statement G has memory operands. */
1985 static inline bool
1986 gimple_has_mem_ops (const gimple *g)
1988 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1991 template <>
1992 template <>
1993 inline bool
1994 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1996 return gimple_has_mem_ops (gs);
1999 template <>
2000 template <>
2001 inline bool
2002 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2004 return gimple_has_mem_ops (gs);
2007 /* Return the set of USE operands for statement G. */
2009 static inline struct use_optype_d *
2010 gimple_use_ops (const gimple *g)
2012 const gimple_statement_with_ops *ops_stmt =
2013 dyn_cast <const gimple_statement_with_ops *> (g);
2014 if (!ops_stmt)
2015 return NULL;
2016 return ops_stmt->use_ops;
2020 /* Set USE to be the set of USE operands for statement G. */
2022 static inline void
2023 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2025 gimple_statement_with_ops *ops_stmt =
2026 as_a <gimple_statement_with_ops *> (g);
2027 ops_stmt->use_ops = use;
2031 /* Return the single VUSE operand of the statement G. */
2033 static inline tree
2034 gimple_vuse (const gimple *g)
2036 const gimple_statement_with_memory_ops *mem_ops_stmt =
2037 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2038 if (!mem_ops_stmt)
2039 return NULL_TREE;
2040 return mem_ops_stmt->vuse;
2043 /* Return the single VDEF operand of the statement G. */
2045 static inline tree
2046 gimple_vdef (const gimple *g)
2048 const gimple_statement_with_memory_ops *mem_ops_stmt =
2049 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2050 if (!mem_ops_stmt)
2051 return NULL_TREE;
2052 return mem_ops_stmt->vdef;
2055 /* Return the single VUSE operand of the statement G. */
2057 static inline tree *
2058 gimple_vuse_ptr (gimple *g)
2060 gimple_statement_with_memory_ops *mem_ops_stmt =
2061 dyn_cast <gimple_statement_with_memory_ops *> (g);
2062 if (!mem_ops_stmt)
2063 return NULL;
2064 return &mem_ops_stmt->vuse;
2067 /* Return the single VDEF operand of the statement G. */
2069 static inline tree *
2070 gimple_vdef_ptr (gimple *g)
2072 gimple_statement_with_memory_ops *mem_ops_stmt =
2073 dyn_cast <gimple_statement_with_memory_ops *> (g);
2074 if (!mem_ops_stmt)
2075 return NULL;
2076 return &mem_ops_stmt->vdef;
2079 /* Set the single VUSE operand of the statement G. */
2081 static inline void
2082 gimple_set_vuse (gimple *g, tree vuse)
2084 gimple_statement_with_memory_ops *mem_ops_stmt =
2085 as_a <gimple_statement_with_memory_ops *> (g);
2086 mem_ops_stmt->vuse = vuse;
2089 /* Set the single VDEF operand of the statement G. */
2091 static inline void
2092 gimple_set_vdef (gimple *g, tree vdef)
2094 gimple_statement_with_memory_ops *mem_ops_stmt =
2095 as_a <gimple_statement_with_memory_ops *> (g);
2096 mem_ops_stmt->vdef = vdef;
2100 /* Return true if statement G has operands and the modified field has
2101 been set. */
2103 static inline bool
2104 gimple_modified_p (const gimple *g)
2106 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2110 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2111 a MODIFIED field. */
2113 static inline void
2114 gimple_set_modified (gimple *s, bool modifiedp)
2116 if (gimple_has_ops (s))
2117 s->modified = (unsigned) modifiedp;
2121 /* Return the tree code for the expression computed by STMT. This is
2122 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2123 GIMPLE_CALL, return CALL_EXPR as the expression code for
2124 consistency. This is useful when the caller needs to deal with the
2125 three kinds of computation that GIMPLE supports. */
2127 static inline enum tree_code
2128 gimple_expr_code (const gimple *stmt)
2130 enum gimple_code code = gimple_code (stmt);
2131 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2132 return (enum tree_code) stmt->subcode;
2133 else
2135 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2136 return CALL_EXPR;
2141 /* Return true if statement STMT contains volatile operands. */
2143 static inline bool
2144 gimple_has_volatile_ops (const gimple *stmt)
2146 if (gimple_has_mem_ops (stmt))
2147 return stmt->has_volatile_ops;
2148 else
2149 return false;
2153 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2155 static inline void
2156 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2158 if (gimple_has_mem_ops (stmt))
2159 stmt->has_volatile_ops = (unsigned) volatilep;
2162 /* Return true if STMT is in a transaction. */
2164 static inline bool
2165 gimple_in_transaction (const gimple *stmt)
2167 return bb_in_transaction (gimple_bb (stmt));
2170 /* Return true if statement STMT may access memory. */
2172 static inline bool
2173 gimple_references_memory_p (gimple *stmt)
2175 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2179 /* Return the subcode for OMP statement S. */
2181 static inline unsigned
2182 gimple_omp_subcode (const gimple *s)
2184 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2185 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2186 return s->subcode;
2189 /* Set the subcode for OMP statement S to SUBCODE. */
2191 static inline void
2192 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2194 /* We only have 16 bits for the subcode. Assert that we are not
2195 overflowing it. */
2196 gcc_gimple_checking_assert (subcode < (1 << 16));
2197 s->subcode = subcode;
2200 /* Set the nowait flag on OMP_RETURN statement S. */
2202 static inline void
2203 gimple_omp_return_set_nowait (gimple *s)
2205 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2206 s->subcode |= GF_OMP_RETURN_NOWAIT;
2210 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2211 flag set. */
2213 static inline bool
2214 gimple_omp_return_nowait_p (const gimple *g)
2216 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2217 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2221 /* Set the LHS of OMP return. */
2223 static inline void
2224 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2226 gimple_statement_omp_return *omp_return_stmt =
2227 as_a <gimple_statement_omp_return *> (g);
2228 omp_return_stmt->val = lhs;
2232 /* Get the LHS of OMP return. */
2234 static inline tree
2235 gimple_omp_return_lhs (const gimple *g)
2237 const gimple_statement_omp_return *omp_return_stmt =
2238 as_a <const gimple_statement_omp_return *> (g);
2239 return omp_return_stmt->val;
2243 /* Return a pointer to the LHS of OMP return. */
2245 static inline tree *
2246 gimple_omp_return_lhs_ptr (gimple *g)
2248 gimple_statement_omp_return *omp_return_stmt =
2249 as_a <gimple_statement_omp_return *> (g);
2250 return &omp_return_stmt->val;
2254 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2255 flag set. */
2257 static inline bool
2258 gimple_omp_section_last_p (const gimple *g)
2260 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2261 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2265 /* Set the GF_OMP_SECTION_LAST flag on G. */
2267 static inline void
2268 gimple_omp_section_set_last (gimple *g)
2270 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2271 g->subcode |= GF_OMP_SECTION_LAST;
2275 /* Return true if OMP parallel statement G has the
2276 GF_OMP_PARALLEL_COMBINED flag set. */
2278 static inline bool
2279 gimple_omp_parallel_combined_p (const gimple *g)
2281 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2282 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2286 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2287 value of COMBINED_P. */
2289 static inline void
2290 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2292 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2293 if (combined_p)
2294 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2295 else
2296 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2300 /* Return true if OMP atomic load/store statement G has the
2301 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2303 static inline bool
2304 gimple_omp_atomic_need_value_p (const gimple *g)
2306 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2307 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2308 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2312 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2314 static inline void
2315 gimple_omp_atomic_set_need_value (gimple *g)
2317 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2318 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2319 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2323 /* Return true if OMP atomic load/store statement G has the
2324 GF_OMP_ATOMIC_SEQ_CST flag set. */
2326 static inline bool
2327 gimple_omp_atomic_seq_cst_p (const gimple *g)
2329 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2330 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2331 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2335 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2337 static inline void
2338 gimple_omp_atomic_set_seq_cst (gimple *g)
2340 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2341 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2342 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2346 /* Return the number of operands for statement GS. */
2348 static inline unsigned
2349 gimple_num_ops (const gimple *gs)
2351 return gs->num_ops;
2355 /* Set the number of operands for statement GS. */
2357 static inline void
2358 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2360 gs->num_ops = num_ops;
2364 /* Return the array of operands for statement GS. */
2366 static inline tree *
2367 gimple_ops (gimple *gs)
2369 size_t off;
2371 /* All the tuples have their operand vector at the very bottom
2372 of the structure. Note that those structures that do not
2373 have an operand vector have a zero offset. */
2374 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2375 gcc_gimple_checking_assert (off != 0);
2377 return (tree *) ((char *) gs + off);
2381 /* Return operand I for statement GS. */
2383 static inline tree
2384 gimple_op (const gimple *gs, unsigned i)
2386 if (gimple_has_ops (gs))
2388 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2389 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2391 else
2392 return NULL_TREE;
2395 /* Return a pointer to operand I for statement GS. */
2397 static inline tree *
2398 gimple_op_ptr (gimple *gs, unsigned i)
2400 if (gimple_has_ops (gs))
2402 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2403 return gimple_ops (gs) + i;
2405 else
2406 return NULL;
2409 /* Set operand I of statement GS to OP. */
2411 static inline void
2412 gimple_set_op (gimple *gs, unsigned i, tree op)
2414 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2416 /* Note. It may be tempting to assert that OP matches
2417 is_gimple_operand, but that would be wrong. Different tuples
2418 accept slightly different sets of tree operands. Each caller
2419 should perform its own validation. */
2420 gimple_ops (gs)[i] = op;
2423 /* Return true if GS is a GIMPLE_ASSIGN. */
2425 static inline bool
2426 is_gimple_assign (const gimple *gs)
2428 return gimple_code (gs) == GIMPLE_ASSIGN;
2431 /* Determine if expression CODE is one of the valid expressions that can
2432 be used on the RHS of GIMPLE assignments. */
2434 static inline enum gimple_rhs_class
2435 get_gimple_rhs_class (enum tree_code code)
2437 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2440 /* Return the LHS of assignment statement GS. */
2442 static inline tree
2443 gimple_assign_lhs (const gassign *gs)
2445 return gs->op[0];
2448 static inline tree
2449 gimple_assign_lhs (const gimple *gs)
2451 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2452 return gimple_assign_lhs (ass);
2456 /* Return a pointer to the LHS of assignment statement GS. */
2458 static inline tree *
2459 gimple_assign_lhs_ptr (gassign *gs)
2461 return &gs->op[0];
2464 static inline tree *
2465 gimple_assign_lhs_ptr (gimple *gs)
2467 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2468 return gimple_assign_lhs_ptr (ass);
2472 /* Set LHS to be the LHS operand of assignment statement GS. */
2474 static inline void
2475 gimple_assign_set_lhs (gassign *gs, tree lhs)
2477 gs->op[0] = lhs;
2479 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2480 SSA_NAME_DEF_STMT (lhs) = gs;
2483 static inline void
2484 gimple_assign_set_lhs (gimple *gs, tree lhs)
2486 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2487 gimple_assign_set_lhs (ass, lhs);
2491 /* Return the first operand on the RHS of assignment statement GS. */
2493 static inline tree
2494 gimple_assign_rhs1 (const gassign *gs)
2496 return gs->op[1];
2499 static inline tree
2500 gimple_assign_rhs1 (const gimple *gs)
2502 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2503 return gimple_assign_rhs1 (ass);
2507 /* Return a pointer to the first operand on the RHS of assignment
2508 statement GS. */
2510 static inline tree *
2511 gimple_assign_rhs1_ptr (gassign *gs)
2513 return &gs->op[1];
2516 static inline tree *
2517 gimple_assign_rhs1_ptr (gimple *gs)
2519 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2520 return gimple_assign_rhs1_ptr (ass);
2523 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2525 static inline void
2526 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2528 gs->op[1] = rhs;
2531 static inline void
2532 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2534 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2535 gimple_assign_set_rhs1 (ass, rhs);
2539 /* Return the second operand on the RHS of assignment statement GS.
2540 If GS does not have two operands, NULL is returned instead. */
2542 static inline tree
2543 gimple_assign_rhs2 (const gassign *gs)
2545 if (gimple_num_ops (gs) >= 3)
2546 return gs->op[2];
2547 else
2548 return NULL_TREE;
2551 static inline tree
2552 gimple_assign_rhs2 (const gimple *gs)
2554 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2555 return gimple_assign_rhs2 (ass);
2559 /* Return a pointer to the second operand on the RHS of assignment
2560 statement GS. */
2562 static inline tree *
2563 gimple_assign_rhs2_ptr (gassign *gs)
2565 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2566 return &gs->op[2];
2569 static inline tree *
2570 gimple_assign_rhs2_ptr (gimple *gs)
2572 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2573 return gimple_assign_rhs2_ptr (ass);
2577 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2579 static inline void
2580 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2582 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2583 gs->op[2] = rhs;
2586 static inline void
2587 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2589 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2590 return gimple_assign_set_rhs2 (ass, rhs);
2593 /* Return the third operand on the RHS of assignment statement GS.
2594 If GS does not have two operands, NULL is returned instead. */
2596 static inline tree
2597 gimple_assign_rhs3 (const gassign *gs)
2599 if (gimple_num_ops (gs) >= 4)
2600 return gs->op[3];
2601 else
2602 return NULL_TREE;
2605 static inline tree
2606 gimple_assign_rhs3 (const gimple *gs)
2608 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2609 return gimple_assign_rhs3 (ass);
2612 /* Return a pointer to the third operand on the RHS of assignment
2613 statement GS. */
2615 static inline tree *
2616 gimple_assign_rhs3_ptr (gimple *gs)
2618 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2619 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2620 return &ass->op[3];
2624 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2626 static inline void
2627 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2629 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2630 gs->op[3] = rhs;
2633 static inline void
2634 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2636 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2637 gimple_assign_set_rhs3 (ass, rhs);
2641 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2642 which expect to see only two operands. */
2644 static inline void
2645 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2646 tree op1, tree op2)
2648 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2651 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2652 which expect to see only one operands. */
2654 static inline void
2655 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2656 tree op1)
2658 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2661 /* Returns true if GS is a nontemporal move. */
2663 static inline bool
2664 gimple_assign_nontemporal_move_p (const gassign *gs)
2666 return gs->nontemporal_move;
2669 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2671 static inline void
2672 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2674 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2675 gs->nontemporal_move = nontemporal;
2679 /* Return the code of the expression computed on the rhs of assignment
2680 statement GS. In case that the RHS is a single object, returns the
2681 tree code of the object. */
2683 static inline enum tree_code
2684 gimple_assign_rhs_code (const gassign *gs)
2686 enum tree_code code = (enum tree_code) gs->subcode;
2687 /* While we initially set subcode to the TREE_CODE of the rhs for
2688 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2689 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2690 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2691 code = TREE_CODE (gs->op[1]);
2693 return code;
2696 static inline enum tree_code
2697 gimple_assign_rhs_code (const gimple *gs)
2699 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2700 return gimple_assign_rhs_code (ass);
2704 /* Set CODE to be the code for the expression computed on the RHS of
2705 assignment S. */
2707 static inline void
2708 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2710 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2711 s->subcode = code;
2715 /* Return the gimple rhs class of the code of the expression computed on
2716 the rhs of assignment statement GS.
2717 This will never return GIMPLE_INVALID_RHS. */
2719 static inline enum gimple_rhs_class
2720 gimple_assign_rhs_class (const gimple *gs)
2722 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2725 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2726 there is no operator associated with the assignment itself.
2727 Unlike gimple_assign_copy_p, this predicate returns true for
2728 any RHS operand, including those that perform an operation
2729 and do not have the semantics of a copy, such as COND_EXPR. */
2731 static inline bool
2732 gimple_assign_single_p (const gimple *gs)
2734 return (is_gimple_assign (gs)
2735 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2738 /* Return true if GS performs a store to its lhs. */
2740 static inline bool
2741 gimple_store_p (const gimple *gs)
2743 tree lhs = gimple_get_lhs (gs);
2744 return lhs && !is_gimple_reg (lhs);
2747 /* Return true if GS is an assignment that loads from its rhs1. */
2749 static inline bool
2750 gimple_assign_load_p (const gimple *gs)
2752 tree rhs;
2753 if (!gimple_assign_single_p (gs))
2754 return false;
2755 rhs = gimple_assign_rhs1 (gs);
2756 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2757 return true;
2758 rhs = get_base_address (rhs);
2759 return (DECL_P (rhs)
2760 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2764 /* Return true if S is a type-cast assignment. */
2766 static inline bool
2767 gimple_assign_cast_p (const gimple *s)
2769 if (is_gimple_assign (s))
2771 enum tree_code sc = gimple_assign_rhs_code (s);
2772 return CONVERT_EXPR_CODE_P (sc)
2773 || sc == VIEW_CONVERT_EXPR
2774 || sc == FIX_TRUNC_EXPR;
2777 return false;
2780 /* Return true if S is a clobber statement. */
2782 static inline bool
2783 gimple_clobber_p (const gimple *s)
2785 return gimple_assign_single_p (s)
2786 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2789 /* Return true if GS is a GIMPLE_CALL. */
2791 static inline bool
2792 is_gimple_call (const gimple *gs)
2794 return gimple_code (gs) == GIMPLE_CALL;
2797 /* Return the LHS of call statement GS. */
2799 static inline tree
2800 gimple_call_lhs (const gcall *gs)
2802 return gs->op[0];
2805 static inline tree
2806 gimple_call_lhs (const gimple *gs)
2808 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2809 return gimple_call_lhs (gc);
2813 /* Return a pointer to the LHS of call statement GS. */
2815 static inline tree *
2816 gimple_call_lhs_ptr (gcall *gs)
2818 return &gs->op[0];
2821 static inline tree *
2822 gimple_call_lhs_ptr (gimple *gs)
2824 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2825 return gimple_call_lhs_ptr (gc);
2829 /* Set LHS to be the LHS operand of call statement GS. */
2831 static inline void
2832 gimple_call_set_lhs (gcall *gs, tree lhs)
2834 gs->op[0] = lhs;
2835 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2836 SSA_NAME_DEF_STMT (lhs) = gs;
2839 static inline void
2840 gimple_call_set_lhs (gimple *gs, tree lhs)
2842 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2843 gimple_call_set_lhs (gc, lhs);
2847 /* Return true if call GS calls an internal-only function, as enumerated
2848 by internal_fn. */
2850 static inline bool
2851 gimple_call_internal_p (const gcall *gs)
2853 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2856 static inline bool
2857 gimple_call_internal_p (const gimple *gs)
2859 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2860 return gimple_call_internal_p (gc);
2864 /* Return true if call GS is marked as instrumented by
2865 Pointer Bounds Checker. */
2867 static inline bool
2868 gimple_call_with_bounds_p (const gcall *gs)
2870 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2873 static inline bool
2874 gimple_call_with_bounds_p (const gimple *gs)
2876 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2877 return gimple_call_with_bounds_p (gc);
2881 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2882 Pointer Bounds Checker. */
2884 static inline void
2885 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2887 if (with_bounds)
2888 gs->subcode |= GF_CALL_WITH_BOUNDS;
2889 else
2890 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2893 static inline void
2894 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2896 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2897 gimple_call_set_with_bounds (gc, with_bounds);
2901 /* Return the target of internal call GS. */
2903 static inline enum internal_fn
2904 gimple_call_internal_fn (const gcall *gs)
2906 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2907 return gs->u.internal_fn;
2910 static inline enum internal_fn
2911 gimple_call_internal_fn (const gimple *gs)
2913 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2914 return gimple_call_internal_fn (gc);
2917 /* Return true, if this internal gimple call is unique. */
2919 static inline bool
2920 gimple_call_internal_unique_p (const gcall *gs)
2922 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2925 static inline bool
2926 gimple_call_internal_unique_p (const gimple *gs)
2928 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2929 return gimple_call_internal_unique_p (gc);
2932 /* Return true if GS is an internal function FN. */
2934 static inline bool
2935 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2937 return (is_gimple_call (gs)
2938 && gimple_call_internal_p (gs)
2939 && gimple_call_internal_fn (gs) == fn);
2942 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2943 that could alter control flow. */
2945 static inline void
2946 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2948 if (ctrl_altering_p)
2949 s->subcode |= GF_CALL_CTRL_ALTERING;
2950 else
2951 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2954 static inline void
2955 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2957 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2958 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2961 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2962 flag is set. Such call could not be a stmt in the middle of a bb. */
2964 static inline bool
2965 gimple_call_ctrl_altering_p (const gcall *gs)
2967 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2970 static inline bool
2971 gimple_call_ctrl_altering_p (const gimple *gs)
2973 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2974 return gimple_call_ctrl_altering_p (gc);
2978 /* Return the function type of the function called by GS. */
2980 static inline tree
2981 gimple_call_fntype (const gcall *gs)
2983 if (gimple_call_internal_p (gs))
2984 return NULL_TREE;
2985 return gs->u.fntype;
2988 static inline tree
2989 gimple_call_fntype (const gimple *gs)
2991 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2992 return gimple_call_fntype (call_stmt);
2995 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2997 static inline void
2998 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3000 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3001 call_stmt->u.fntype = fntype;
3005 /* Return the tree node representing the function called by call
3006 statement GS. */
3008 static inline tree
3009 gimple_call_fn (const gcall *gs)
3011 return gs->op[1];
3014 static inline tree
3015 gimple_call_fn (const gimple *gs)
3017 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3018 return gimple_call_fn (gc);
3021 /* Return a pointer to the tree node representing the function called by call
3022 statement GS. */
3024 static inline tree *
3025 gimple_call_fn_ptr (gcall *gs)
3027 return &gs->op[1];
3030 static inline tree *
3031 gimple_call_fn_ptr (gimple *gs)
3033 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3034 return gimple_call_fn_ptr (gc);
3038 /* Set FN to be the function called by call statement GS. */
3040 static inline void
3041 gimple_call_set_fn (gcall *gs, tree fn)
3043 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3044 gs->op[1] = fn;
3048 /* Set FNDECL to be the function called by call statement GS. */
3050 static inline void
3051 gimple_call_set_fndecl (gcall *gs, tree decl)
3053 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3054 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3055 build_pointer_type (TREE_TYPE (decl)), decl);
3058 static inline void
3059 gimple_call_set_fndecl (gimple *gs, tree decl)
3061 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3062 gimple_call_set_fndecl (gc, decl);
3066 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3068 static inline void
3069 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3071 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3072 call_stmt->u.internal_fn = fn;
3076 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3077 Otherwise return NULL. This function is analogous to
3078 get_callee_fndecl in tree land. */
3080 static inline tree
3081 gimple_call_fndecl (const gcall *gs)
3083 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3086 static inline tree
3087 gimple_call_fndecl (const gimple *gs)
3089 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3090 return gimple_call_fndecl (gc);
3094 /* Return the type returned by call statement GS. */
3096 static inline tree
3097 gimple_call_return_type (const gcall *gs)
3099 tree type = gimple_call_fntype (gs);
3101 if (type == NULL_TREE)
3102 return TREE_TYPE (gimple_call_lhs (gs));
3104 /* The type returned by a function is the type of its
3105 function type. */
3106 return TREE_TYPE (type);
3110 /* Return the static chain for call statement GS. */
3112 static inline tree
3113 gimple_call_chain (const gcall *gs)
3115 return gs->op[2];
3118 static inline tree
3119 gimple_call_chain (const gimple *gs)
3121 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3122 return gimple_call_chain (gc);
3126 /* Return a pointer to the static chain for call statement CALL_STMT. */
3128 static inline tree *
3129 gimple_call_chain_ptr (gcall *call_stmt)
3131 return &call_stmt->op[2];
3134 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3136 static inline void
3137 gimple_call_set_chain (gcall *call_stmt, tree chain)
3139 call_stmt->op[2] = chain;
3143 /* Return the number of arguments used by call statement GS. */
3145 static inline unsigned
3146 gimple_call_num_args (const gcall *gs)
3148 return gimple_num_ops (gs) - 3;
3151 static inline unsigned
3152 gimple_call_num_args (const gimple *gs)
3154 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3155 return gimple_call_num_args (gc);
3159 /* Return the argument at position INDEX for call statement GS. */
3161 static inline tree
3162 gimple_call_arg (const gcall *gs, unsigned index)
3164 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3165 return gs->op[index + 3];
3168 static inline tree
3169 gimple_call_arg (const gimple *gs, unsigned index)
3171 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3172 return gimple_call_arg (gc, index);
3176 /* Return a pointer to the argument at position INDEX for call
3177 statement GS. */
3179 static inline tree *
3180 gimple_call_arg_ptr (gcall *gs, unsigned index)
3182 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3183 return &gs->op[index + 3];
3186 static inline tree *
3187 gimple_call_arg_ptr (gimple *gs, unsigned index)
3189 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3190 return gimple_call_arg_ptr (gc, index);
3194 /* Set ARG to be the argument at position INDEX for call statement GS. */
3196 static inline void
3197 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3199 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3200 gs->op[index + 3] = arg;
3203 static inline void
3204 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3206 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3207 gimple_call_set_arg (gc, index, arg);
3211 /* If TAIL_P is true, mark call statement S as being a tail call
3212 (i.e., a call just before the exit of a function). These calls are
3213 candidate for tail call optimization. */
3215 static inline void
3216 gimple_call_set_tail (gcall *s, bool tail_p)
3218 if (tail_p)
3219 s->subcode |= GF_CALL_TAILCALL;
3220 else
3221 s->subcode &= ~GF_CALL_TAILCALL;
3225 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3227 static inline bool
3228 gimple_call_tail_p (gcall *s)
3230 return (s->subcode & GF_CALL_TAILCALL) != 0;
3233 /* Mark (or clear) call statement S as requiring tail call optimization. */
3235 static inline void
3236 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3238 if (must_tail_p)
3239 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3240 else
3241 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3244 /* Return true if call statement has been marked as requiring
3245 tail call optimization. */
3247 static inline bool
3248 gimple_call_must_tail_p (const gcall *s)
3250 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3253 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3254 slot optimization. This transformation uses the target of the call
3255 expansion as the return slot for calls that return in memory. */
3257 static inline void
3258 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3260 if (return_slot_opt_p)
3261 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3262 else
3263 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3267 /* Return true if S is marked for return slot optimization. */
3269 static inline bool
3270 gimple_call_return_slot_opt_p (gcall *s)
3272 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3276 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3277 thunk to the thunked-to function. */
3279 static inline void
3280 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3282 if (from_thunk_p)
3283 s->subcode |= GF_CALL_FROM_THUNK;
3284 else
3285 s->subcode &= ~GF_CALL_FROM_THUNK;
3289 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3291 static inline bool
3292 gimple_call_from_thunk_p (gcall *s)
3294 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3298 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3299 argument pack in its argument list. */
3301 static inline void
3302 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3304 if (pass_arg_pack_p)
3305 s->subcode |= GF_CALL_VA_ARG_PACK;
3306 else
3307 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3311 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3312 argument pack in its argument list. */
3314 static inline bool
3315 gimple_call_va_arg_pack_p (gcall *s)
3317 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3321 /* Return true if S is a noreturn call. */
3323 static inline bool
3324 gimple_call_noreturn_p (const gcall *s)
3326 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3329 static inline bool
3330 gimple_call_noreturn_p (const gimple *s)
3332 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3333 return gimple_call_noreturn_p (gc);
3337 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3338 even if the called function can throw in other cases. */
3340 static inline void
3341 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3343 if (nothrow_p)
3344 s->subcode |= GF_CALL_NOTHROW;
3345 else
3346 s->subcode &= ~GF_CALL_NOTHROW;
3349 /* Return true if S is a nothrow call. */
3351 static inline bool
3352 gimple_call_nothrow_p (gcall *s)
3354 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3357 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3358 is known to be emitted for VLA objects. Those are wrapped by
3359 stack_save/stack_restore calls and hence can't lead to unbounded
3360 stack growth even when they occur in loops. */
3362 static inline void
3363 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3365 if (for_var)
3366 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3367 else
3368 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3371 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3373 static inline bool
3374 gimple_call_alloca_for_var_p (gcall *s)
3376 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3379 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3380 pointers to nested function are descriptors instead of trampolines. */
3382 static inline void
3383 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3385 if (by_descriptor_p)
3386 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3387 else
3388 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3391 /* Return true if S is a by-descriptor call. */
3393 static inline bool
3394 gimple_call_by_descriptor_p (gcall *s)
3396 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3399 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3401 static inline void
3402 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3404 dest_call->subcode = orig_call->subcode;
3408 /* Return a pointer to the points-to solution for the set of call-used
3409 variables of the call CALL_STMT. */
3411 static inline struct pt_solution *
3412 gimple_call_use_set (gcall *call_stmt)
3414 return &call_stmt->call_used;
3418 /* Return a pointer to the points-to solution for the set of call-used
3419 variables of the call CALL_STMT. */
3421 static inline struct pt_solution *
3422 gimple_call_clobber_set (gcall *call_stmt)
3424 return &call_stmt->call_clobbered;
3428 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3429 non-NULL lhs. */
3431 static inline bool
3432 gimple_has_lhs (gimple *stmt)
3434 if (is_gimple_assign (stmt))
3435 return true;
3436 if (gcall *call = dyn_cast <gcall *> (stmt))
3437 return gimple_call_lhs (call) != NULL_TREE;
3438 return false;
3442 /* Return the code of the predicate computed by conditional statement GS. */
3444 static inline enum tree_code
3445 gimple_cond_code (const gcond *gs)
3447 return (enum tree_code) gs->subcode;
3450 static inline enum tree_code
3451 gimple_cond_code (const gimple *gs)
3453 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3454 return gimple_cond_code (gc);
3458 /* Set CODE to be the predicate code for the conditional statement GS. */
3460 static inline void
3461 gimple_cond_set_code (gcond *gs, enum tree_code code)
3463 gs->subcode = code;
3467 /* Return the LHS of the predicate computed by conditional statement GS. */
3469 static inline tree
3470 gimple_cond_lhs (const gcond *gs)
3472 return gs->op[0];
3475 static inline tree
3476 gimple_cond_lhs (const gimple *gs)
3478 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3479 return gimple_cond_lhs (gc);
3482 /* Return the pointer to the LHS of the predicate computed by conditional
3483 statement GS. */
3485 static inline tree *
3486 gimple_cond_lhs_ptr (gcond *gs)
3488 return &gs->op[0];
3491 /* Set LHS to be the LHS operand of the predicate computed by
3492 conditional statement GS. */
3494 static inline void
3495 gimple_cond_set_lhs (gcond *gs, tree lhs)
3497 gs->op[0] = lhs;
3501 /* Return the RHS operand of the predicate computed by conditional GS. */
3503 static inline tree
3504 gimple_cond_rhs (const gcond *gs)
3506 return gs->op[1];
3509 static inline tree
3510 gimple_cond_rhs (const gimple *gs)
3512 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3513 return gimple_cond_rhs (gc);
3516 /* Return the pointer to the RHS operand of the predicate computed by
3517 conditional GS. */
3519 static inline tree *
3520 gimple_cond_rhs_ptr (gcond *gs)
3522 return &gs->op[1];
3526 /* Set RHS to be the RHS operand of the predicate computed by
3527 conditional statement GS. */
3529 static inline void
3530 gimple_cond_set_rhs (gcond *gs, tree rhs)
3532 gs->op[1] = rhs;
3536 /* Return the label used by conditional statement GS when its
3537 predicate evaluates to true. */
3539 static inline tree
3540 gimple_cond_true_label (const gcond *gs)
3542 return gs->op[2];
3546 /* Set LABEL to be the label used by conditional statement GS when its
3547 predicate evaluates to true. */
3549 static inline void
3550 gimple_cond_set_true_label (gcond *gs, tree label)
3552 gs->op[2] = label;
3556 /* Set LABEL to be the label used by conditional statement GS when its
3557 predicate evaluates to false. */
3559 static inline void
3560 gimple_cond_set_false_label (gcond *gs, tree label)
3562 gs->op[3] = label;
3566 /* Return the label used by conditional statement GS when its
3567 predicate evaluates to false. */
3569 static inline tree
3570 gimple_cond_false_label (const gcond *gs)
3572 return gs->op[3];
3576 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3578 static inline void
3579 gimple_cond_make_false (gcond *gs)
3581 gimple_cond_set_lhs (gs, boolean_false_node);
3582 gimple_cond_set_rhs (gs, boolean_false_node);
3583 gs->subcode = NE_EXPR;
3587 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3589 static inline void
3590 gimple_cond_make_true (gcond *gs)
3592 gimple_cond_set_lhs (gs, boolean_true_node);
3593 gimple_cond_set_rhs (gs, boolean_false_node);
3594 gs->subcode = NE_EXPR;
3597 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3598 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3600 static inline bool
3601 gimple_cond_true_p (const gcond *gs)
3603 tree lhs = gimple_cond_lhs (gs);
3604 tree rhs = gimple_cond_rhs (gs);
3605 enum tree_code code = gimple_cond_code (gs);
3607 if (lhs != boolean_true_node && lhs != boolean_false_node)
3608 return false;
3610 if (rhs != boolean_true_node && rhs != boolean_false_node)
3611 return false;
3613 if (code == NE_EXPR && lhs != rhs)
3614 return true;
3616 if (code == EQ_EXPR && lhs == rhs)
3617 return true;
3619 return false;
3622 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3623 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3625 static inline bool
3626 gimple_cond_false_p (const gcond *gs)
3628 tree lhs = gimple_cond_lhs (gs);
3629 tree rhs = gimple_cond_rhs (gs);
3630 enum tree_code code = gimple_cond_code (gs);
3632 if (lhs != boolean_true_node && lhs != boolean_false_node)
3633 return false;
3635 if (rhs != boolean_true_node && rhs != boolean_false_node)
3636 return false;
3638 if (code == NE_EXPR && lhs == rhs)
3639 return true;
3641 if (code == EQ_EXPR && lhs != rhs)
3642 return true;
3644 return false;
3647 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3649 static inline void
3650 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3651 tree rhs)
3653 gimple_cond_set_code (stmt, code);
3654 gimple_cond_set_lhs (stmt, lhs);
3655 gimple_cond_set_rhs (stmt, rhs);
3658 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3660 static inline tree
3661 gimple_label_label (const glabel *gs)
3663 return gs->op[0];
3667 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3668 GS. */
3670 static inline void
3671 gimple_label_set_label (glabel *gs, tree label)
3673 gs->op[0] = label;
3677 /* Return the destination of the unconditional jump GS. */
3679 static inline tree
3680 gimple_goto_dest (const gimple *gs)
3682 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3683 return gimple_op (gs, 0);
3687 /* Set DEST to be the destination of the unconditonal jump GS. */
3689 static inline void
3690 gimple_goto_set_dest (ggoto *gs, tree dest)
3692 gs->op[0] = dest;
3696 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3698 static inline tree
3699 gimple_bind_vars (const gbind *bind_stmt)
3701 return bind_stmt->vars;
3705 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3706 statement GS. */
3708 static inline void
3709 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3711 bind_stmt->vars = vars;
3715 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3716 statement GS. */
3718 static inline void
3719 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3721 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3725 static inline gimple_seq *
3726 gimple_bind_body_ptr (gbind *bind_stmt)
3728 return &bind_stmt->body;
3731 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3733 static inline gimple_seq
3734 gimple_bind_body (gbind *gs)
3736 return *gimple_bind_body_ptr (gs);
3740 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3741 statement GS. */
3743 static inline void
3744 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3746 bind_stmt->body = seq;
3750 /* Append a statement to the end of a GIMPLE_BIND's body. */
3752 static inline void
3753 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3755 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3759 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3761 static inline void
3762 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3764 gimple_seq_add_seq (&bind_stmt->body, seq);
3768 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3769 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3771 static inline tree
3772 gimple_bind_block (const gbind *bind_stmt)
3774 return bind_stmt->block;
3778 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3779 statement GS. */
3781 static inline void
3782 gimple_bind_set_block (gbind *bind_stmt, tree block)
3784 gcc_gimple_checking_assert (block == NULL_TREE
3785 || TREE_CODE (block) == BLOCK);
3786 bind_stmt->block = block;
3790 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3792 static inline unsigned
3793 gimple_asm_ninputs (const gasm *asm_stmt)
3795 return asm_stmt->ni;
3799 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3801 static inline unsigned
3802 gimple_asm_noutputs (const gasm *asm_stmt)
3804 return asm_stmt->no;
3808 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3810 static inline unsigned
3811 gimple_asm_nclobbers (const gasm *asm_stmt)
3813 return asm_stmt->nc;
3816 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3818 static inline unsigned
3819 gimple_asm_nlabels (const gasm *asm_stmt)
3821 return asm_stmt->nl;
3824 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3826 static inline tree
3827 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3829 gcc_gimple_checking_assert (index < asm_stmt->ni);
3830 return asm_stmt->op[index + asm_stmt->no];
3833 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3835 static inline void
3836 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3838 gcc_gimple_checking_assert (index < asm_stmt->ni
3839 && TREE_CODE (in_op) == TREE_LIST);
3840 asm_stmt->op[index + asm_stmt->no] = in_op;
3844 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3846 static inline tree
3847 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3849 gcc_gimple_checking_assert (index < asm_stmt->no);
3850 return asm_stmt->op[index];
3853 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3855 static inline void
3856 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3858 gcc_gimple_checking_assert (index < asm_stmt->no
3859 && TREE_CODE (out_op) == TREE_LIST);
3860 asm_stmt->op[index] = out_op;
3864 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3866 static inline tree
3867 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3869 gcc_gimple_checking_assert (index < asm_stmt->nc);
3870 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3874 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3876 static inline void
3877 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3879 gcc_gimple_checking_assert (index < asm_stmt->nc
3880 && TREE_CODE (clobber_op) == TREE_LIST);
3881 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3884 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3886 static inline tree
3887 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3889 gcc_gimple_checking_assert (index < asm_stmt->nl);
3890 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3893 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3895 static inline void
3896 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3898 gcc_gimple_checking_assert (index < asm_stmt->nl
3899 && TREE_CODE (label_op) == TREE_LIST);
3900 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3903 /* Return the string representing the assembly instruction in
3904 GIMPLE_ASM ASM_STMT. */
3906 static inline const char *
3907 gimple_asm_string (const gasm *asm_stmt)
3909 return asm_stmt->string;
3913 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3915 static inline bool
3916 gimple_asm_volatile_p (const gasm *asm_stmt)
3918 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3922 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3924 static inline void
3925 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3927 if (volatile_p)
3928 asm_stmt->subcode |= GF_ASM_VOLATILE;
3929 else
3930 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3934 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3936 static inline void
3937 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3939 if (input_p)
3940 asm_stmt->subcode |= GF_ASM_INPUT;
3941 else
3942 asm_stmt->subcode &= ~GF_ASM_INPUT;
3946 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3948 static inline bool
3949 gimple_asm_input_p (const gasm *asm_stmt)
3951 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3955 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3957 static inline tree
3958 gimple_catch_types (const gcatch *catch_stmt)
3960 return catch_stmt->types;
3964 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3966 static inline tree *
3967 gimple_catch_types_ptr (gcatch *catch_stmt)
3969 return &catch_stmt->types;
3973 /* Return a pointer to the GIMPLE sequence representing the body of
3974 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3976 static inline gimple_seq *
3977 gimple_catch_handler_ptr (gcatch *catch_stmt)
3979 return &catch_stmt->handler;
3983 /* Return the GIMPLE sequence representing the body of the handler of
3984 GIMPLE_CATCH statement CATCH_STMT. */
3986 static inline gimple_seq
3987 gimple_catch_handler (gcatch *catch_stmt)
3989 return *gimple_catch_handler_ptr (catch_stmt);
3993 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3995 static inline void
3996 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3998 catch_stmt->types = t;
4002 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4004 static inline void
4005 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4007 catch_stmt->handler = handler;
4011 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4013 static inline tree
4014 gimple_eh_filter_types (const gimple *gs)
4016 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4017 return eh_filter_stmt->types;
4021 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4022 GS. */
4024 static inline tree *
4025 gimple_eh_filter_types_ptr (gimple *gs)
4027 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4028 return &eh_filter_stmt->types;
4032 /* Return a pointer to the sequence of statement to execute when
4033 GIMPLE_EH_FILTER statement fails. */
4035 static inline gimple_seq *
4036 gimple_eh_filter_failure_ptr (gimple *gs)
4038 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4039 return &eh_filter_stmt->failure;
4043 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4044 statement fails. */
4046 static inline gimple_seq
4047 gimple_eh_filter_failure (gimple *gs)
4049 return *gimple_eh_filter_failure_ptr (gs);
4053 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4054 EH_FILTER_STMT. */
4056 static inline void
4057 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4059 eh_filter_stmt->types = types;
4063 /* Set FAILURE to be the sequence of statements to execute on failure
4064 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4066 static inline void
4067 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4068 gimple_seq failure)
4070 eh_filter_stmt->failure = failure;
4073 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4075 static inline tree
4076 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4078 return eh_mnt_stmt->fndecl;
4081 /* Set the function decl to be called by GS to DECL. */
4083 static inline void
4084 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4085 tree decl)
4087 eh_mnt_stmt->fndecl = decl;
4090 /* GIMPLE_EH_ELSE accessors. */
4092 static inline gimple_seq *
4093 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4095 return &eh_else_stmt->n_body;
4098 static inline gimple_seq
4099 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4101 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4104 static inline gimple_seq *
4105 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4107 return &eh_else_stmt->e_body;
4110 static inline gimple_seq
4111 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4113 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4116 static inline void
4117 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4119 eh_else_stmt->n_body = seq;
4122 static inline void
4123 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4125 eh_else_stmt->e_body = seq;
4128 /* GIMPLE_TRY accessors. */
4130 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4131 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4133 static inline enum gimple_try_flags
4134 gimple_try_kind (const gimple *gs)
4136 GIMPLE_CHECK (gs, GIMPLE_TRY);
4137 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4141 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4143 static inline void
4144 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4146 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4147 || kind == GIMPLE_TRY_FINALLY);
4148 if (gimple_try_kind (gs) != kind)
4149 gs->subcode = (unsigned int) kind;
4153 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4155 static inline bool
4156 gimple_try_catch_is_cleanup (const gimple *gs)
4158 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4159 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4163 /* Return a pointer to the sequence of statements used as the
4164 body for GIMPLE_TRY GS. */
4166 static inline gimple_seq *
4167 gimple_try_eval_ptr (gimple *gs)
4169 gtry *try_stmt = as_a <gtry *> (gs);
4170 return &try_stmt->eval;
4174 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4176 static inline gimple_seq
4177 gimple_try_eval (gimple *gs)
4179 return *gimple_try_eval_ptr (gs);
4183 /* Return a pointer to the sequence of statements used as the cleanup body for
4184 GIMPLE_TRY GS. */
4186 static inline gimple_seq *
4187 gimple_try_cleanup_ptr (gimple *gs)
4189 gtry *try_stmt = as_a <gtry *> (gs);
4190 return &try_stmt->cleanup;
4194 /* Return the sequence of statements used as the cleanup body for
4195 GIMPLE_TRY GS. */
4197 static inline gimple_seq
4198 gimple_try_cleanup (gimple *gs)
4200 return *gimple_try_cleanup_ptr (gs);
4204 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4206 static inline void
4207 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4209 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4210 if (catch_is_cleanup)
4211 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4212 else
4213 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4217 /* Set EVAL to be the sequence of statements to use as the body for
4218 GIMPLE_TRY TRY_STMT. */
4220 static inline void
4221 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4223 try_stmt->eval = eval;
4227 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4228 body for GIMPLE_TRY TRY_STMT. */
4230 static inline void
4231 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4233 try_stmt->cleanup = cleanup;
4237 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4239 static inline gimple_seq *
4240 gimple_wce_cleanup_ptr (gimple *gs)
4242 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4243 return &wce_stmt->cleanup;
4247 /* Return the cleanup sequence for cleanup statement GS. */
4249 static inline gimple_seq
4250 gimple_wce_cleanup (gimple *gs)
4252 return *gimple_wce_cleanup_ptr (gs);
4256 /* Set CLEANUP to be the cleanup sequence for GS. */
4258 static inline void
4259 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4261 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4262 wce_stmt->cleanup = cleanup;
4266 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4268 static inline bool
4269 gimple_wce_cleanup_eh_only (const gimple *gs)
4271 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4272 return gs->subcode != 0;
4276 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4278 static inline void
4279 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4281 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4282 gs->subcode = (unsigned int) eh_only_p;
4286 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4288 static inline unsigned
4289 gimple_phi_capacity (const gimple *gs)
4291 const gphi *phi_stmt = as_a <const gphi *> (gs);
4292 return phi_stmt->capacity;
4296 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4297 be exactly the number of incoming edges for the basic block holding
4298 GS. */
4300 static inline unsigned
4301 gimple_phi_num_args (const gimple *gs)
4303 const gphi *phi_stmt = as_a <const gphi *> (gs);
4304 return phi_stmt->nargs;
4308 /* Return the SSA name created by GIMPLE_PHI GS. */
4310 static inline tree
4311 gimple_phi_result (const gphi *gs)
4313 return gs->result;
4316 static inline tree
4317 gimple_phi_result (const gimple *gs)
4319 const gphi *phi_stmt = as_a <const gphi *> (gs);
4320 return gimple_phi_result (phi_stmt);
4323 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4325 static inline tree *
4326 gimple_phi_result_ptr (gphi *gs)
4328 return &gs->result;
4331 static inline tree *
4332 gimple_phi_result_ptr (gimple *gs)
4334 gphi *phi_stmt = as_a <gphi *> (gs);
4335 return gimple_phi_result_ptr (phi_stmt);
4338 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4340 static inline void
4341 gimple_phi_set_result (gphi *phi, tree result)
4343 phi->result = result;
4344 if (result && TREE_CODE (result) == SSA_NAME)
4345 SSA_NAME_DEF_STMT (result) = phi;
4349 /* Return the PHI argument corresponding to incoming edge INDEX for
4350 GIMPLE_PHI GS. */
4352 static inline struct phi_arg_d *
4353 gimple_phi_arg (gphi *gs, unsigned index)
4355 gcc_gimple_checking_assert (index < gs->nargs);
4356 return &(gs->args[index]);
4359 static inline struct phi_arg_d *
4360 gimple_phi_arg (gimple *gs, unsigned index)
4362 gphi *phi_stmt = as_a <gphi *> (gs);
4363 return gimple_phi_arg (phi_stmt, index);
4366 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4367 for GIMPLE_PHI PHI. */
4369 static inline void
4370 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4372 gcc_gimple_checking_assert (index < phi->nargs);
4373 phi->args[index] = *phiarg;
4376 /* Return the PHI nodes for basic block BB, or NULL if there are no
4377 PHI nodes. */
4379 static inline gimple_seq
4380 phi_nodes (const_basic_block bb)
4382 gcc_checking_assert (!(bb->flags & BB_RTL));
4383 return bb->il.gimple.phi_nodes;
4386 /* Return a pointer to the PHI nodes for basic block BB. */
4388 static inline gimple_seq *
4389 phi_nodes_ptr (basic_block bb)
4391 gcc_checking_assert (!(bb->flags & BB_RTL));
4392 return &bb->il.gimple.phi_nodes;
4395 /* Return the tree operand for argument I of PHI node GS. */
4397 static inline tree
4398 gimple_phi_arg_def (gphi *gs, size_t index)
4400 return gimple_phi_arg (gs, index)->def;
4403 static inline tree
4404 gimple_phi_arg_def (gimple *gs, size_t index)
4406 return gimple_phi_arg (gs, index)->def;
4410 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4412 static inline tree *
4413 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4415 return &gimple_phi_arg (phi, index)->def;
4418 /* Return the edge associated with argument I of phi node PHI. */
4420 static inline edge
4421 gimple_phi_arg_edge (gphi *phi, size_t i)
4423 return EDGE_PRED (gimple_bb (phi), i);
4426 /* Return the source location of gimple argument I of phi node PHI. */
4428 static inline source_location
4429 gimple_phi_arg_location (gphi *phi, size_t i)
4431 return gimple_phi_arg (phi, i)->locus;
4434 /* Return the source location of the argument on edge E of phi node PHI. */
4436 static inline source_location
4437 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4439 return gimple_phi_arg (phi, e->dest_idx)->locus;
4442 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4444 static inline void
4445 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4447 gimple_phi_arg (phi, i)->locus = loc;
4450 /* Return TRUE if argument I of phi node PHI has a location record. */
4452 static inline bool
4453 gimple_phi_arg_has_location (gphi *phi, size_t i)
4455 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4459 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4461 static inline int
4462 gimple_resx_region (const gresx *resx_stmt)
4464 return resx_stmt->region;
4467 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4469 static inline void
4470 gimple_resx_set_region (gresx *resx_stmt, int region)
4472 resx_stmt->region = region;
4475 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4477 static inline int
4478 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4480 return eh_dispatch_stmt->region;
4483 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4484 EH_DISPATCH_STMT. */
4486 static inline void
4487 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4489 eh_dispatch_stmt->region = region;
4492 /* Return the number of labels associated with the switch statement GS. */
4494 static inline unsigned
4495 gimple_switch_num_labels (const gswitch *gs)
4497 unsigned num_ops;
4498 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4499 num_ops = gimple_num_ops (gs);
4500 gcc_gimple_checking_assert (num_ops > 1);
4501 return num_ops - 1;
4505 /* Set NLABELS to be the number of labels for the switch statement GS. */
4507 static inline void
4508 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4510 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4511 gimple_set_num_ops (g, nlabels + 1);
4515 /* Return the index variable used by the switch statement GS. */
4517 static inline tree
4518 gimple_switch_index (const gswitch *gs)
4520 return gs->op[0];
4524 /* Return a pointer to the index variable for the switch statement GS. */
4526 static inline tree *
4527 gimple_switch_index_ptr (gswitch *gs)
4529 return &gs->op[0];
4533 /* Set INDEX to be the index variable for switch statement GS. */
4535 static inline void
4536 gimple_switch_set_index (gswitch *gs, tree index)
4538 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4539 gs->op[0] = index;
4543 /* Return the label numbered INDEX. The default label is 0, followed by any
4544 labels in a switch statement. */
4546 static inline tree
4547 gimple_switch_label (const gswitch *gs, unsigned index)
4549 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4550 return gs->op[index + 1];
4553 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4555 static inline void
4556 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4558 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4559 && (label == NULL_TREE
4560 || TREE_CODE (label) == CASE_LABEL_EXPR));
4561 gs->op[index + 1] = label;
4564 /* Return the default label for a switch statement. */
4566 static inline tree
4567 gimple_switch_default_label (const gswitch *gs)
4569 tree label = gimple_switch_label (gs, 0);
4570 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4571 return label;
4574 /* Set the default label for a switch statement. */
4576 static inline void
4577 gimple_switch_set_default_label (gswitch *gs, tree label)
4579 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4580 gimple_switch_set_label (gs, 0, label);
4583 /* Return true if GS is a GIMPLE_DEBUG statement. */
4585 static inline bool
4586 is_gimple_debug (const gimple *gs)
4588 return gimple_code (gs) == GIMPLE_DEBUG;
4591 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4593 static inline bool
4594 gimple_debug_bind_p (const gimple *s)
4596 if (is_gimple_debug (s))
4597 return s->subcode == GIMPLE_DEBUG_BIND;
4599 return false;
4602 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4604 static inline tree
4605 gimple_debug_bind_get_var (gimple *dbg)
4607 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4608 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4609 return gimple_op (dbg, 0);
4612 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4613 statement. */
4615 static inline tree
4616 gimple_debug_bind_get_value (gimple *dbg)
4618 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4619 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4620 return gimple_op (dbg, 1);
4623 /* Return a pointer to the value bound to the variable in a
4624 GIMPLE_DEBUG bind statement. */
4626 static inline tree *
4627 gimple_debug_bind_get_value_ptr (gimple *dbg)
4629 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4630 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4631 return gimple_op_ptr (dbg, 1);
4634 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4636 static inline void
4637 gimple_debug_bind_set_var (gimple *dbg, tree var)
4639 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4640 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4641 gimple_set_op (dbg, 0, var);
4644 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4645 statement. */
4647 static inline void
4648 gimple_debug_bind_set_value (gimple *dbg, tree value)
4650 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4651 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4652 gimple_set_op (dbg, 1, value);
4655 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4656 optimized away. */
4657 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4659 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4660 statement. */
4662 static inline void
4663 gimple_debug_bind_reset_value (gimple *dbg)
4665 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4666 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4667 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4670 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4671 value. */
4673 static inline bool
4674 gimple_debug_bind_has_value_p (gimple *dbg)
4676 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4677 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4678 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4681 #undef GIMPLE_DEBUG_BIND_NOVALUE
4683 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4685 static inline bool
4686 gimple_debug_source_bind_p (const gimple *s)
4688 if (is_gimple_debug (s))
4689 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4691 return false;
4694 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4696 static inline tree
4697 gimple_debug_source_bind_get_var (gimple *dbg)
4699 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4700 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4701 return gimple_op (dbg, 0);
4704 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4705 statement. */
4707 static inline tree
4708 gimple_debug_source_bind_get_value (gimple *dbg)
4710 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4711 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4712 return gimple_op (dbg, 1);
4715 /* Return a pointer to the value bound to the variable in a
4716 GIMPLE_DEBUG source bind statement. */
4718 static inline tree *
4719 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4721 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4722 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4723 return gimple_op_ptr (dbg, 1);
4726 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4728 static inline void
4729 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4731 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4732 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4733 gimple_set_op (dbg, 0, var);
4736 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4737 statement. */
4739 static inline void
4740 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4742 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4743 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4744 gimple_set_op (dbg, 1, value);
4747 /* Return the line number for EXPR, or return -1 if we have no line
4748 number information for it. */
4749 static inline int
4750 get_lineno (const gimple *stmt)
4752 location_t loc;
4754 if (!stmt)
4755 return -1;
4757 loc = gimple_location (stmt);
4758 if (loc == UNKNOWN_LOCATION)
4759 return -1;
4761 return LOCATION_LINE (loc);
4764 /* Return a pointer to the body for the OMP statement GS. */
4766 static inline gimple_seq *
4767 gimple_omp_body_ptr (gimple *gs)
4769 return &static_cast <gimple_statement_omp *> (gs)->body;
4772 /* Return the body for the OMP statement GS. */
4774 static inline gimple_seq
4775 gimple_omp_body (gimple *gs)
4777 return *gimple_omp_body_ptr (gs);
4780 /* Set BODY to be the body for the OMP statement GS. */
4782 static inline void
4783 gimple_omp_set_body (gimple *gs, gimple_seq body)
4785 static_cast <gimple_statement_omp *> (gs)->body = body;
4789 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4791 static inline tree
4792 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4794 return crit_stmt->name;
4798 /* Return a pointer to the name associated with OMP critical statement
4799 CRIT_STMT. */
4801 static inline tree *
4802 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4804 return &crit_stmt->name;
4808 /* Set NAME to be the name associated with OMP critical statement
4809 CRIT_STMT. */
4811 static inline void
4812 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4814 crit_stmt->name = name;
4818 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4820 static inline tree
4821 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4823 return crit_stmt->clauses;
4827 /* Return a pointer to the clauses associated with OMP critical statement
4828 CRIT_STMT. */
4830 static inline tree *
4831 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4833 return &crit_stmt->clauses;
4837 /* Set CLAUSES to be the clauses associated with OMP critical statement
4838 CRIT_STMT. */
4840 static inline void
4841 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4843 crit_stmt->clauses = clauses;
4847 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4849 static inline tree
4850 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4852 return ord_stmt->clauses;
4856 /* Return a pointer to the clauses associated with OMP ordered statement
4857 ORD_STMT. */
4859 static inline tree *
4860 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4862 return &ord_stmt->clauses;
4866 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4867 ORD_STMT. */
4869 static inline void
4870 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4872 ord_stmt->clauses = clauses;
4876 /* Return the kind of the OMP_FOR statemement G. */
4878 static inline int
4879 gimple_omp_for_kind (const gimple *g)
4881 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4882 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4886 /* Set the kind of the OMP_FOR statement G. */
4888 static inline void
4889 gimple_omp_for_set_kind (gomp_for *g, int kind)
4891 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4892 | (kind & GF_OMP_FOR_KIND_MASK);
4896 /* Return true if OMP_FOR statement G has the
4897 GF_OMP_FOR_COMBINED flag set. */
4899 static inline bool
4900 gimple_omp_for_combined_p (const gimple *g)
4902 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4903 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4907 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4908 the boolean value of COMBINED_P. */
4910 static inline void
4911 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4913 if (combined_p)
4914 g->subcode |= GF_OMP_FOR_COMBINED;
4915 else
4916 g->subcode &= ~GF_OMP_FOR_COMBINED;
4920 /* Return true if the OMP_FOR statement G has the
4921 GF_OMP_FOR_COMBINED_INTO flag set. */
4923 static inline bool
4924 gimple_omp_for_combined_into_p (const gimple *g)
4926 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4927 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4931 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4932 on the boolean value of COMBINED_P. */
4934 static inline void
4935 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4937 if (combined_p)
4938 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4939 else
4940 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4944 /* Return the clauses associated with the OMP_FOR statement GS. */
4946 static inline tree
4947 gimple_omp_for_clauses (const gimple *gs)
4949 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4950 return omp_for_stmt->clauses;
4954 /* Return a pointer to the clauses associated with the OMP_FOR statement
4955 GS. */
4957 static inline tree *
4958 gimple_omp_for_clauses_ptr (gimple *gs)
4960 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4961 return &omp_for_stmt->clauses;
4965 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4966 GS. */
4968 static inline void
4969 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4971 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4972 omp_for_stmt->clauses = clauses;
4976 /* Get the collapse count of the OMP_FOR statement GS. */
4978 static inline size_t
4979 gimple_omp_for_collapse (gimple *gs)
4981 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4982 return omp_for_stmt->collapse;
4986 /* Return the condition code associated with the OMP_FOR statement GS. */
4988 static inline enum tree_code
4989 gimple_omp_for_cond (const gimple *gs, size_t i)
4991 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4992 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4993 return omp_for_stmt->iter[i].cond;
4997 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4999 static inline void
5000 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5002 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5003 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5004 && i < omp_for_stmt->collapse);
5005 omp_for_stmt->iter[i].cond = cond;
5009 /* Return the index variable for the OMP_FOR statement GS. */
5011 static inline tree
5012 gimple_omp_for_index (const gimple *gs, size_t i)
5014 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5015 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5016 return omp_for_stmt->iter[i].index;
5020 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5022 static inline tree *
5023 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5025 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5026 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5027 return &omp_for_stmt->iter[i].index;
5031 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5033 static inline void
5034 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5036 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5037 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5038 omp_for_stmt->iter[i].index = index;
5042 /* Return the initial value for the OMP_FOR statement GS. */
5044 static inline tree
5045 gimple_omp_for_initial (const gimple *gs, size_t i)
5047 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5048 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5049 return omp_for_stmt->iter[i].initial;
5053 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5055 static inline tree *
5056 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5058 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5059 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5060 return &omp_for_stmt->iter[i].initial;
5064 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5066 static inline void
5067 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5069 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5070 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5071 omp_for_stmt->iter[i].initial = initial;
5075 /* Return the final value for the OMP_FOR statement GS. */
5077 static inline tree
5078 gimple_omp_for_final (const gimple *gs, size_t i)
5080 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5081 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5082 return omp_for_stmt->iter[i].final;
5086 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5088 static inline tree *
5089 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5091 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5092 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5093 return &omp_for_stmt->iter[i].final;
5097 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5099 static inline void
5100 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5102 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5103 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5104 omp_for_stmt->iter[i].final = final;
5108 /* Return the increment value for the OMP_FOR statement GS. */
5110 static inline tree
5111 gimple_omp_for_incr (const gimple *gs, size_t i)
5113 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5114 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5115 return omp_for_stmt->iter[i].incr;
5119 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5121 static inline tree *
5122 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5124 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5125 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5126 return &omp_for_stmt->iter[i].incr;
5130 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5132 static inline void
5133 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5135 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5136 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5137 omp_for_stmt->iter[i].incr = incr;
5141 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5142 statement GS starts. */
5144 static inline gimple_seq *
5145 gimple_omp_for_pre_body_ptr (gimple *gs)
5147 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5148 return &omp_for_stmt->pre_body;
5152 /* Return the sequence of statements to execute before the OMP_FOR
5153 statement GS starts. */
5155 static inline gimple_seq
5156 gimple_omp_for_pre_body (gimple *gs)
5158 return *gimple_omp_for_pre_body_ptr (gs);
5162 /* Set PRE_BODY to be the sequence of statements to execute before the
5163 OMP_FOR statement GS starts. */
5165 static inline void
5166 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5168 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5169 omp_for_stmt->pre_body = pre_body;
5172 /* Return the kernel_phony of OMP_FOR statement. */
5174 static inline bool
5175 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5177 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5178 != GF_OMP_FOR_KIND_GRID_LOOP);
5179 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5182 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5184 static inline void
5185 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5187 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5188 != GF_OMP_FOR_KIND_GRID_LOOP);
5189 if (value)
5190 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5191 else
5192 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5195 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5197 static inline bool
5198 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5200 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5201 == GF_OMP_FOR_KIND_GRID_LOOP);
5202 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5205 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5207 static inline void
5208 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5210 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5211 == GF_OMP_FOR_KIND_GRID_LOOP);
5212 if (value)
5213 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5214 else
5215 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5218 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5219 groups. */
5221 static inline bool
5222 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5224 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5225 == GF_OMP_FOR_KIND_GRID_LOOP);
5226 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5229 /* Set group_iter flag of OMP_FOR to VALUE. */
5231 static inline void
5232 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5234 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5235 == GF_OMP_FOR_KIND_GRID_LOOP);
5236 if (value)
5237 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5238 else
5239 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5242 /* Return the clauses associated with OMP_PARALLEL GS. */
5244 static inline tree
5245 gimple_omp_parallel_clauses (const gimple *gs)
5247 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5248 return omp_parallel_stmt->clauses;
5252 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5254 static inline tree *
5255 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5257 return &omp_parallel_stmt->clauses;
5261 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5263 static inline void
5264 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5265 tree clauses)
5267 omp_parallel_stmt->clauses = clauses;
5271 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5273 static inline tree
5274 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5276 return omp_parallel_stmt->child_fn;
5279 /* Return a pointer to the child function used to hold the body of
5280 OMP_PARALLEL_STMT. */
5282 static inline tree *
5283 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5285 return &omp_parallel_stmt->child_fn;
5289 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5291 static inline void
5292 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5293 tree child_fn)
5295 omp_parallel_stmt->child_fn = child_fn;
5299 /* Return the artificial argument used to send variables and values
5300 from the parent to the children threads in OMP_PARALLEL_STMT. */
5302 static inline tree
5303 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5305 return omp_parallel_stmt->data_arg;
5309 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5311 static inline tree *
5312 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5314 return &omp_parallel_stmt->data_arg;
5318 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5320 static inline void
5321 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5322 tree data_arg)
5324 omp_parallel_stmt->data_arg = data_arg;
5327 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5329 static inline bool
5330 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5332 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5335 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5337 static inline void
5338 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5340 if (value)
5341 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5342 else
5343 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5346 /* Return the clauses associated with OMP_TASK GS. */
5348 static inline tree
5349 gimple_omp_task_clauses (const gimple *gs)
5351 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5352 return omp_task_stmt->clauses;
5356 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5358 static inline tree *
5359 gimple_omp_task_clauses_ptr (gimple *gs)
5361 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5362 return &omp_task_stmt->clauses;
5366 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5367 GS. */
5369 static inline void
5370 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5372 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5373 omp_task_stmt->clauses = clauses;
5377 /* Return true if OMP task statement G has the
5378 GF_OMP_TASK_TASKLOOP flag set. */
5380 static inline bool
5381 gimple_omp_task_taskloop_p (const gimple *g)
5383 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5384 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5388 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5389 value of TASKLOOP_P. */
5391 static inline void
5392 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5394 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5395 if (taskloop_p)
5396 g->subcode |= GF_OMP_TASK_TASKLOOP;
5397 else
5398 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5402 /* Return the child function used to hold the body of OMP_TASK GS. */
5404 static inline tree
5405 gimple_omp_task_child_fn (const gimple *gs)
5407 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5408 return omp_task_stmt->child_fn;
5411 /* Return a pointer to the child function used to hold the body of
5412 OMP_TASK GS. */
5414 static inline tree *
5415 gimple_omp_task_child_fn_ptr (gimple *gs)
5417 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5418 return &omp_task_stmt->child_fn;
5422 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5424 static inline void
5425 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5427 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5428 omp_task_stmt->child_fn = child_fn;
5432 /* Return the artificial argument used to send variables and values
5433 from the parent to the children threads in OMP_TASK GS. */
5435 static inline tree
5436 gimple_omp_task_data_arg (const gimple *gs)
5438 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5439 return omp_task_stmt->data_arg;
5443 /* Return a pointer to the data argument for OMP_TASK GS. */
5445 static inline tree *
5446 gimple_omp_task_data_arg_ptr (gimple *gs)
5448 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5449 return &omp_task_stmt->data_arg;
5453 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5455 static inline void
5456 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5458 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5459 omp_task_stmt->data_arg = data_arg;
5463 /* Return the clauses associated with OMP_TASK GS. */
5465 static inline tree
5466 gimple_omp_taskreg_clauses (const gimple *gs)
5468 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5469 = as_a <const gimple_statement_omp_taskreg *> (gs);
5470 return omp_taskreg_stmt->clauses;
5474 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5476 static inline tree *
5477 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5479 gimple_statement_omp_taskreg *omp_taskreg_stmt
5480 = as_a <gimple_statement_omp_taskreg *> (gs);
5481 return &omp_taskreg_stmt->clauses;
5485 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5486 GS. */
5488 static inline void
5489 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5491 gimple_statement_omp_taskreg *omp_taskreg_stmt
5492 = as_a <gimple_statement_omp_taskreg *> (gs);
5493 omp_taskreg_stmt->clauses = clauses;
5497 /* Return the child function used to hold the body of OMP_TASK GS. */
5499 static inline tree
5500 gimple_omp_taskreg_child_fn (const gimple *gs)
5502 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5503 = as_a <const gimple_statement_omp_taskreg *> (gs);
5504 return omp_taskreg_stmt->child_fn;
5507 /* Return a pointer to the child function used to hold the body of
5508 OMP_TASK GS. */
5510 static inline tree *
5511 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5513 gimple_statement_omp_taskreg *omp_taskreg_stmt
5514 = as_a <gimple_statement_omp_taskreg *> (gs);
5515 return &omp_taskreg_stmt->child_fn;
5519 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5521 static inline void
5522 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5524 gimple_statement_omp_taskreg *omp_taskreg_stmt
5525 = as_a <gimple_statement_omp_taskreg *> (gs);
5526 omp_taskreg_stmt->child_fn = child_fn;
5530 /* Return the artificial argument used to send variables and values
5531 from the parent to the children threads in OMP_TASK GS. */
5533 static inline tree
5534 gimple_omp_taskreg_data_arg (const gimple *gs)
5536 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5537 = as_a <const gimple_statement_omp_taskreg *> (gs);
5538 return omp_taskreg_stmt->data_arg;
5542 /* Return a pointer to the data argument for OMP_TASK GS. */
5544 static inline tree *
5545 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5547 gimple_statement_omp_taskreg *omp_taskreg_stmt
5548 = as_a <gimple_statement_omp_taskreg *> (gs);
5549 return &omp_taskreg_stmt->data_arg;
5553 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5555 static inline void
5556 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5558 gimple_statement_omp_taskreg *omp_taskreg_stmt
5559 = as_a <gimple_statement_omp_taskreg *> (gs);
5560 omp_taskreg_stmt->data_arg = data_arg;
5564 /* Return the copy function used to hold the body of OMP_TASK GS. */
5566 static inline tree
5567 gimple_omp_task_copy_fn (const gimple *gs)
5569 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5570 return omp_task_stmt->copy_fn;
5573 /* Return a pointer to the copy function used to hold the body of
5574 OMP_TASK GS. */
5576 static inline tree *
5577 gimple_omp_task_copy_fn_ptr (gimple *gs)
5579 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5580 return &omp_task_stmt->copy_fn;
5584 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5586 static inline void
5587 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5589 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5590 omp_task_stmt->copy_fn = copy_fn;
5594 /* Return size of the data block in bytes in OMP_TASK GS. */
5596 static inline tree
5597 gimple_omp_task_arg_size (const gimple *gs)
5599 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5600 return omp_task_stmt->arg_size;
5604 /* Return a pointer to the data block size for OMP_TASK GS. */
5606 static inline tree *
5607 gimple_omp_task_arg_size_ptr (gimple *gs)
5609 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5610 return &omp_task_stmt->arg_size;
5614 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5616 static inline void
5617 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5619 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5620 omp_task_stmt->arg_size = arg_size;
5624 /* Return align of the data block in bytes in OMP_TASK GS. */
5626 static inline tree
5627 gimple_omp_task_arg_align (const gimple *gs)
5629 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5630 return omp_task_stmt->arg_align;
5634 /* Return a pointer to the data block align for OMP_TASK GS. */
5636 static inline tree *
5637 gimple_omp_task_arg_align_ptr (gimple *gs)
5639 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5640 return &omp_task_stmt->arg_align;
5644 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5646 static inline void
5647 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5649 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5650 omp_task_stmt->arg_align = arg_align;
5654 /* Return the clauses associated with OMP_SINGLE GS. */
5656 static inline tree
5657 gimple_omp_single_clauses (const gimple *gs)
5659 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5660 return omp_single_stmt->clauses;
5664 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5666 static inline tree *
5667 gimple_omp_single_clauses_ptr (gimple *gs)
5669 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5670 return &omp_single_stmt->clauses;
5674 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5676 static inline void
5677 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5679 omp_single_stmt->clauses = clauses;
5683 /* Return the clauses associated with OMP_TARGET GS. */
5685 static inline tree
5686 gimple_omp_target_clauses (const gimple *gs)
5688 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5689 return omp_target_stmt->clauses;
5693 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5695 static inline tree *
5696 gimple_omp_target_clauses_ptr (gimple *gs)
5698 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5699 return &omp_target_stmt->clauses;
5703 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5705 static inline void
5706 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5707 tree clauses)
5709 omp_target_stmt->clauses = clauses;
5713 /* Return the kind of the OMP_TARGET G. */
5715 static inline int
5716 gimple_omp_target_kind (const gimple *g)
5718 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5719 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5723 /* Set the kind of the OMP_TARGET G. */
5725 static inline void
5726 gimple_omp_target_set_kind (gomp_target *g, int kind)
5728 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5729 | (kind & GF_OMP_TARGET_KIND_MASK);
5733 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5735 static inline tree
5736 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5738 return omp_target_stmt->child_fn;
5741 /* Return a pointer to the child function used to hold the body of
5742 OMP_TARGET_STMT. */
5744 static inline tree *
5745 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5747 return &omp_target_stmt->child_fn;
5751 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5753 static inline void
5754 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5755 tree child_fn)
5757 omp_target_stmt->child_fn = child_fn;
5761 /* Return the artificial argument used to send variables and values
5762 from the parent to the children threads in OMP_TARGET_STMT. */
5764 static inline tree
5765 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5767 return omp_target_stmt->data_arg;
5771 /* Return a pointer to the data argument for OMP_TARGET GS. */
5773 static inline tree *
5774 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5776 return &omp_target_stmt->data_arg;
5780 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5782 static inline void
5783 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5784 tree data_arg)
5786 omp_target_stmt->data_arg = data_arg;
5790 /* Return the clauses associated with OMP_TEAMS GS. */
5792 static inline tree
5793 gimple_omp_teams_clauses (const gimple *gs)
5795 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5796 return omp_teams_stmt->clauses;
5800 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5802 static inline tree *
5803 gimple_omp_teams_clauses_ptr (gimple *gs)
5805 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5806 return &omp_teams_stmt->clauses;
5810 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5812 static inline void
5813 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5815 omp_teams_stmt->clauses = clauses;
5818 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5820 static inline bool
5821 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5823 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5826 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5828 static inline void
5829 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5831 if (value)
5832 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5833 else
5834 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5837 /* Return the clauses associated with OMP_SECTIONS GS. */
5839 static inline tree
5840 gimple_omp_sections_clauses (const gimple *gs)
5842 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5843 return omp_sections_stmt->clauses;
5847 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5849 static inline tree *
5850 gimple_omp_sections_clauses_ptr (gimple *gs)
5852 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5853 return &omp_sections_stmt->clauses;
5857 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5858 GS. */
5860 static inline void
5861 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5863 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5864 omp_sections_stmt->clauses = clauses;
5868 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5869 in GS. */
5871 static inline tree
5872 gimple_omp_sections_control (const gimple *gs)
5874 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5875 return omp_sections_stmt->control;
5879 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5880 GS. */
5882 static inline tree *
5883 gimple_omp_sections_control_ptr (gimple *gs)
5885 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5886 return &omp_sections_stmt->control;
5890 /* Set CONTROL to be the set of clauses associated with the
5891 GIMPLE_OMP_SECTIONS in GS. */
5893 static inline void
5894 gimple_omp_sections_set_control (gimple *gs, tree control)
5896 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5897 omp_sections_stmt->control = control;
5901 /* Set the value being stored in an atomic store. */
5903 static inline void
5904 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5906 store_stmt->val = val;
5910 /* Return the value being stored in an atomic store. */
5912 static inline tree
5913 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5915 return store_stmt->val;
5919 /* Return a pointer to the value being stored in an atomic store. */
5921 static inline tree *
5922 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5924 return &store_stmt->val;
5928 /* Set the LHS of an atomic load. */
5930 static inline void
5931 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5933 load_stmt->lhs = lhs;
5937 /* Get the LHS of an atomic load. */
5939 static inline tree
5940 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5942 return load_stmt->lhs;
5946 /* Return a pointer to the LHS of an atomic load. */
5948 static inline tree *
5949 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5951 return &load_stmt->lhs;
5955 /* Set the RHS of an atomic load. */
5957 static inline void
5958 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5960 load_stmt->rhs = rhs;
5964 /* Get the RHS of an atomic load. */
5966 static inline tree
5967 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5969 return load_stmt->rhs;
5973 /* Return a pointer to the RHS of an atomic load. */
5975 static inline tree *
5976 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5978 return &load_stmt->rhs;
5982 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5984 static inline tree
5985 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5987 return cont_stmt->control_def;
5990 /* The same as above, but return the address. */
5992 static inline tree *
5993 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5995 return &cont_stmt->control_def;
5998 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6000 static inline void
6001 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6003 cont_stmt->control_def = def;
6007 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6009 static inline tree
6010 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6012 return cont_stmt->control_use;
6016 /* The same as above, but return the address. */
6018 static inline tree *
6019 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6021 return &cont_stmt->control_use;
6025 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6027 static inline void
6028 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6030 cont_stmt->control_use = use;
6033 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6034 TRANSACTION_STMT. */
6036 static inline gimple_seq *
6037 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6039 return &transaction_stmt->body;
6042 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6044 static inline gimple_seq
6045 gimple_transaction_body (gtransaction *transaction_stmt)
6047 return transaction_stmt->body;
6050 /* Return the label associated with a GIMPLE_TRANSACTION. */
6052 static inline tree
6053 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6055 return transaction_stmt->label_norm;
6058 static inline tree *
6059 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6061 return &transaction_stmt->label_norm;
6064 static inline tree
6065 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6067 return transaction_stmt->label_uninst;
6070 static inline tree *
6071 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6073 return &transaction_stmt->label_uninst;
6076 static inline tree
6077 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6079 return transaction_stmt->label_over;
6082 static inline tree *
6083 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6085 return &transaction_stmt->label_over;
6088 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6090 static inline unsigned int
6091 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6093 return transaction_stmt->subcode;
6096 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6097 TRANSACTION_STMT. */
6099 static inline void
6100 gimple_transaction_set_body (gtransaction *transaction_stmt,
6101 gimple_seq body)
6103 transaction_stmt->body = body;
6106 /* Set the label associated with a GIMPLE_TRANSACTION. */
6108 static inline void
6109 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6111 transaction_stmt->label_norm = label;
6114 static inline void
6115 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6117 transaction_stmt->label_uninst = label;
6120 static inline void
6121 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6123 transaction_stmt->label_over = label;
6126 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6128 static inline void
6129 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6130 unsigned int subcode)
6132 transaction_stmt->subcode = subcode;
6135 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6137 static inline tree *
6138 gimple_return_retval_ptr (greturn *gs)
6140 return &gs->op[0];
6143 /* Return the return value for GIMPLE_RETURN GS. */
6145 static inline tree
6146 gimple_return_retval (const greturn *gs)
6148 return gs->op[0];
6152 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6154 static inline void
6155 gimple_return_set_retval (greturn *gs, tree retval)
6157 gs->op[0] = retval;
6161 /* Return the return bounds for GIMPLE_RETURN GS. */
6163 static inline tree
6164 gimple_return_retbnd (const gimple *gs)
6166 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6167 return gimple_op (gs, 1);
6171 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6173 static inline void
6174 gimple_return_set_retbnd (gimple *gs, tree retval)
6176 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6177 gimple_set_op (gs, 1, retval);
6181 /* Returns true when the gimple statement STMT is any of the OMP types. */
6183 #define CASE_GIMPLE_OMP \
6184 case GIMPLE_OMP_PARALLEL: \
6185 case GIMPLE_OMP_TASK: \
6186 case GIMPLE_OMP_FOR: \
6187 case GIMPLE_OMP_SECTIONS: \
6188 case GIMPLE_OMP_SECTIONS_SWITCH: \
6189 case GIMPLE_OMP_SINGLE: \
6190 case GIMPLE_OMP_TARGET: \
6191 case GIMPLE_OMP_TEAMS: \
6192 case GIMPLE_OMP_SECTION: \
6193 case GIMPLE_OMP_MASTER: \
6194 case GIMPLE_OMP_TASKGROUP: \
6195 case GIMPLE_OMP_ORDERED: \
6196 case GIMPLE_OMP_CRITICAL: \
6197 case GIMPLE_OMP_RETURN: \
6198 case GIMPLE_OMP_ATOMIC_LOAD: \
6199 case GIMPLE_OMP_ATOMIC_STORE: \
6200 case GIMPLE_OMP_CONTINUE: \
6201 case GIMPLE_OMP_GRID_BODY
6203 static inline bool
6204 is_gimple_omp (const gimple *stmt)
6206 switch (gimple_code (stmt))
6208 CASE_GIMPLE_OMP:
6209 return true;
6210 default:
6211 return false;
6215 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6216 specifically. */
6218 static inline bool
6219 is_gimple_omp_oacc (const gimple *stmt)
6221 gcc_assert (is_gimple_omp (stmt));
6222 switch (gimple_code (stmt))
6224 case GIMPLE_OMP_FOR:
6225 switch (gimple_omp_for_kind (stmt))
6227 case GF_OMP_FOR_KIND_OACC_LOOP:
6228 return true;
6229 default:
6230 return false;
6232 case GIMPLE_OMP_TARGET:
6233 switch (gimple_omp_target_kind (stmt))
6235 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6236 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6237 case GF_OMP_TARGET_KIND_OACC_DATA:
6238 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6239 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6240 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6241 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6242 return true;
6243 default:
6244 return false;
6246 default:
6247 return false;
6252 /* Return true if the OMP gimple statement STMT is offloaded. */
6254 static inline bool
6255 is_gimple_omp_offloaded (const gimple *stmt)
6257 gcc_assert (is_gimple_omp (stmt));
6258 switch (gimple_code (stmt))
6260 case GIMPLE_OMP_TARGET:
6261 switch (gimple_omp_target_kind (stmt))
6263 case GF_OMP_TARGET_KIND_REGION:
6264 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6265 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6266 return true;
6267 default:
6268 return false;
6270 default:
6271 return false;
6276 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6278 static inline bool
6279 gimple_nop_p (const gimple *g)
6281 return gimple_code (g) == GIMPLE_NOP;
6285 /* Return true if GS is a GIMPLE_RESX. */
6287 static inline bool
6288 is_gimple_resx (const gimple *gs)
6290 return gimple_code (gs) == GIMPLE_RESX;
6293 /* Return the type of the main expression computed by STMT. Return
6294 void_type_node if the statement computes nothing. */
6296 static inline tree
6297 gimple_expr_type (const gimple *stmt)
6299 enum gimple_code code = gimple_code (stmt);
6300 /* In general we want to pass out a type that can be substituted
6301 for both the RHS and the LHS types if there is a possibly
6302 useless conversion involved. That means returning the
6303 original RHS type as far as we can reconstruct it. */
6304 if (code == GIMPLE_CALL)
6306 const gcall *call_stmt = as_a <const gcall *> (stmt);
6307 if (gimple_call_internal_p (call_stmt)
6308 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6309 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6310 else
6311 return gimple_call_return_type (call_stmt);
6313 else if (code == GIMPLE_ASSIGN)
6315 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6316 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6317 else
6318 /* As fallback use the type of the LHS. */
6319 return TREE_TYPE (gimple_get_lhs (stmt));
6321 else if (code == GIMPLE_COND)
6322 return boolean_type_node;
6323 else
6324 return void_type_node;
6327 /* Enum and arrays used for allocation stats. Keep in sync with
6328 gimple.c:gimple_alloc_kind_names. */
6329 enum gimple_alloc_kind
6331 gimple_alloc_kind_assign, /* Assignments. */
6332 gimple_alloc_kind_phi, /* PHI nodes. */
6333 gimple_alloc_kind_cond, /* Conditionals. */
6334 gimple_alloc_kind_rest, /* Everything else. */
6335 gimple_alloc_kind_all
6338 extern int gimple_alloc_counts[];
6339 extern int gimple_alloc_sizes[];
6341 /* Return the allocation kind for a given stmt CODE. */
6342 static inline enum gimple_alloc_kind
6343 gimple_alloc_kind (enum gimple_code code)
6345 switch (code)
6347 case GIMPLE_ASSIGN:
6348 return gimple_alloc_kind_assign;
6349 case GIMPLE_PHI:
6350 return gimple_alloc_kind_phi;
6351 case GIMPLE_COND:
6352 return gimple_alloc_kind_cond;
6353 default:
6354 return gimple_alloc_kind_rest;
6358 /* Return true if a location should not be emitted for this statement
6359 by annotate_all_with_location. */
6361 static inline bool
6362 gimple_do_not_emit_location_p (gimple *g)
6364 return gimple_plf (g, GF_PLF_1);
6367 /* Mark statement G so a location will not be emitted by
6368 annotate_one_with_location. */
6370 static inline void
6371 gimple_set_do_not_emit_location (gimple *g)
6373 /* The PLF flags are initialized to 0 when a new tuple is created,
6374 so no need to initialize it anywhere. */
6375 gimple_set_plf (g, GF_PLF_1, true);
6379 /* Macros for showing usage statistics. */
6380 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6381 ? (x) \
6382 : ((x) < 1024*1024*10 \
6383 ? (x) / 1024 \
6384 : (x) / (1024*1024))))
6386 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6388 #endif /* GCC_GIMPLE_H */