PR rtl-optimization/82913
[official-gcc.git] / gcc / gimple.h
blob334def89398edcc6908662de735796057b074be3
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_CALL_NOCF_CHECK = 1 << 11,
152 GF_OMP_PARALLEL_COMBINED = 1 << 0,
153 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
154 GF_OMP_TASK_TASKLOOP = 1 << 0,
155 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
156 GF_OMP_FOR_KIND_FOR = 0,
157 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
158 GF_OMP_FOR_KIND_TASKLOOP = 2,
159 GF_OMP_FOR_KIND_CILKFOR = 3,
160 GF_OMP_FOR_KIND_OACC_LOOP = 4,
161 GF_OMP_FOR_KIND_GRID_LOOP = 5,
162 /* Flag for SIMD variants of OMP_FOR kinds. */
163 GF_OMP_FOR_SIMD = 1 << 3,
164 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
165 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
166 GF_OMP_FOR_COMBINED = 1 << 4,
167 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
168 /* The following flag must not be used on GF_OMP_FOR_KIND_GRID_LOOP loop
169 statements. */
170 GF_OMP_FOR_GRID_PHONY = 1 << 6,
171 /* The following two flags should only be set on GF_OMP_FOR_KIND_GRID_LOOP
172 loop statements. */
173 GF_OMP_FOR_GRID_INTRA_GROUP = 1 << 6,
174 GF_OMP_FOR_GRID_GROUP_ITER = 1 << 7,
175 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
176 GF_OMP_TARGET_KIND_REGION = 0,
177 GF_OMP_TARGET_KIND_DATA = 1,
178 GF_OMP_TARGET_KIND_UPDATE = 2,
179 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
180 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
181 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
182 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
183 GF_OMP_TARGET_KIND_OACC_DATA = 7,
184 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
185 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
186 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
187 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
188 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
190 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
191 a thread synchronization via some sort of barrier. The exact barrier
192 that would otherwise be emitted is dependent on the OMP statement with
193 which this return is associated. */
194 GF_OMP_RETURN_NOWAIT = 1 << 0,
196 GF_OMP_SECTION_LAST = 1 << 0,
197 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
198 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
199 GF_PREDICT_TAKEN = 1 << 15
202 /* Currently, there are only two types of gimple debug stmt. Others are
203 envisioned, for example, to enable the generation of is_stmt notes
204 in line number information, to mark sequence points, etc. This
205 subcode is to be used to tell them apart. */
206 enum gimple_debug_subcode {
207 GIMPLE_DEBUG_BIND = 0,
208 GIMPLE_DEBUG_SOURCE_BIND = 1
211 /* Masks for selecting a pass local flag (PLF) to work on. These
212 masks are used by gimple_set_plf and gimple_plf. */
213 enum plf_mask {
214 GF_PLF_1 = 1 << 0,
215 GF_PLF_2 = 1 << 1
218 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
219 are for 64 bit hosts. */
221 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
222 chain_next ("%h.next"), variable_size))
223 gimple
225 /* [ WORD 1 ]
226 Main identifying code for a tuple. */
227 ENUM_BITFIELD(gimple_code) code : 8;
229 /* Nonzero if a warning should not be emitted on this tuple. */
230 unsigned int no_warning : 1;
232 /* Nonzero if this tuple has been visited. Passes are responsible
233 for clearing this bit before using it. */
234 unsigned int visited : 1;
236 /* Nonzero if this tuple represents a non-temporal move. */
237 unsigned int nontemporal_move : 1;
239 /* Pass local flags. These flags are free for any pass to use as
240 they see fit. Passes should not assume that these flags contain
241 any useful value when the pass starts. Any initial state that
242 the pass requires should be set on entry to the pass. See
243 gimple_set_plf and gimple_plf for usage. */
244 unsigned int plf : 2;
246 /* Nonzero if this statement has been modified and needs to have its
247 operands rescanned. */
248 unsigned modified : 1;
250 /* Nonzero if this statement contains volatile operands. */
251 unsigned has_volatile_ops : 1;
253 /* Padding to get subcode to 16 bit alignment. */
254 unsigned pad : 1;
256 /* The SUBCODE field can be used for tuple-specific flags for tuples
257 that do not require subcodes. Note that SUBCODE should be at
258 least as wide as tree codes, as several tuples store tree codes
259 in there. */
260 unsigned int subcode : 16;
262 /* UID of this statement. This is used by passes that want to
263 assign IDs to statements. It must be assigned and used by each
264 pass. By default it should be assumed to contain garbage. */
265 unsigned uid;
267 /* [ WORD 2 ]
268 Locus information for debug info. */
269 location_t location;
271 /* Number of operands in this tuple. */
272 unsigned num_ops;
274 /* [ WORD 3 ]
275 Basic block holding this statement. */
276 basic_block bb;
278 /* [ WORD 4-5 ]
279 Linked lists of gimple statements. The next pointers form
280 a NULL terminated list, the prev pointers are a cyclic list.
281 A gimple statement is hence also a double-ended list of
282 statements, with the pointer itself being the first element,
283 and the prev pointer being the last. */
284 gimple *next;
285 gimple *GTY((skip)) prev;
289 /* Base structure for tuples with operands. */
291 /* This gimple subclass has no tag value. */
292 struct GTY(())
293 gimple_statement_with_ops_base : public gimple
295 /* [ WORD 1-6 ] : base class */
297 /* [ WORD 7 ]
298 SSA operand vectors. NOTE: It should be possible to
299 amalgamate these vectors with the operand vector OP. However,
300 the SSA operand vectors are organized differently and contain
301 more information (like immediate use chaining). */
302 struct use_optype_d GTY((skip (""))) *use_ops;
306 /* Statements that take register operands. */
308 struct GTY((tag("GSS_WITH_OPS")))
309 gimple_statement_with_ops : public gimple_statement_with_ops_base
311 /* [ WORD 1-7 ] : base class */
313 /* [ WORD 8 ]
314 Operand vector. NOTE! This must always be the last field
315 of this structure. In particular, this means that this
316 structure cannot be embedded inside another one. */
317 tree GTY((length ("%h.num_ops"))) op[1];
321 /* Base for statements that take both memory and register operands. */
323 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
324 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
326 /* [ WORD 1-7 ] : base class */
328 /* [ WORD 8-9 ]
329 Virtual operands for this statement. The GC will pick them
330 up via the ssa_names array. */
331 tree GTY((skip (""))) vdef;
332 tree GTY((skip (""))) vuse;
336 /* Statements that take both memory and register operands. */
338 struct GTY((tag("GSS_WITH_MEM_OPS")))
339 gimple_statement_with_memory_ops :
340 public gimple_statement_with_memory_ops_base
342 /* [ WORD 1-9 ] : base class */
344 /* [ WORD 10 ]
345 Operand vector. NOTE! This must always be the last field
346 of this structure. In particular, this means that this
347 structure cannot be embedded inside another one. */
348 tree GTY((length ("%h.num_ops"))) op[1];
352 /* Call statements that take both memory and register operands. */
354 struct GTY((tag("GSS_CALL")))
355 gcall : public gimple_statement_with_memory_ops_base
357 /* [ WORD 1-9 ] : base class */
359 /* [ WORD 10-13 ] */
360 struct pt_solution call_used;
361 struct pt_solution call_clobbered;
363 /* [ WORD 14 ] */
364 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
365 tree GTY ((tag ("0"))) fntype;
366 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
367 } u;
369 /* [ WORD 15 ]
370 Operand vector. NOTE! This must always be the last field
371 of this structure. In particular, this means that this
372 structure cannot be embedded inside another one. */
373 tree GTY((length ("%h.num_ops"))) op[1];
375 static const enum gimple_code code_ = GIMPLE_CALL;
379 /* OMP statements. */
381 struct GTY((tag("GSS_OMP")))
382 gimple_statement_omp : public gimple
384 /* [ WORD 1-6 ] : base class */
386 /* [ WORD 7 ] */
387 gimple_seq body;
391 /* GIMPLE_BIND */
393 struct GTY((tag("GSS_BIND")))
394 gbind : public gimple
396 /* [ WORD 1-6 ] : base class */
398 /* [ WORD 7 ]
399 Variables declared in this scope. */
400 tree vars;
402 /* [ WORD 8 ]
403 This is different than the BLOCK field in gimple,
404 which is analogous to TREE_BLOCK (i.e., the lexical block holding
405 this statement). This field is the equivalent of BIND_EXPR_BLOCK
406 in tree land (i.e., the lexical scope defined by this bind). See
407 gimple-low.c. */
408 tree block;
410 /* [ WORD 9 ] */
411 gimple_seq body;
415 /* GIMPLE_CATCH */
417 struct GTY((tag("GSS_CATCH")))
418 gcatch : public gimple
420 /* [ WORD 1-6 ] : base class */
422 /* [ WORD 7 ] */
423 tree types;
425 /* [ WORD 8 ] */
426 gimple_seq handler;
430 /* GIMPLE_EH_FILTER */
432 struct GTY((tag("GSS_EH_FILTER")))
433 geh_filter : public gimple
435 /* [ WORD 1-6 ] : base class */
437 /* [ WORD 7 ]
438 Filter types. */
439 tree types;
441 /* [ WORD 8 ]
442 Failure actions. */
443 gimple_seq failure;
446 /* GIMPLE_EH_ELSE */
448 struct GTY((tag("GSS_EH_ELSE")))
449 geh_else : public gimple
451 /* [ WORD 1-6 ] : base class */
453 /* [ WORD 7,8 ] */
454 gimple_seq n_body, e_body;
457 /* GIMPLE_EH_MUST_NOT_THROW */
459 struct GTY((tag("GSS_EH_MNT")))
460 geh_mnt : public gimple
462 /* [ WORD 1-6 ] : base class */
464 /* [ WORD 7 ] Abort function decl. */
465 tree fndecl;
468 /* GIMPLE_PHI */
470 struct GTY((tag("GSS_PHI")))
471 gphi : public gimple
473 /* [ WORD 1-6 ] : base class */
475 /* [ WORD 7 ] */
476 unsigned capacity;
477 unsigned nargs;
479 /* [ WORD 8 ] */
480 tree result;
482 /* [ WORD 9 ] */
483 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
487 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
489 struct GTY((tag("GSS_EH_CTRL")))
490 gimple_statement_eh_ctrl : public gimple
492 /* [ WORD 1-6 ] : base class */
494 /* [ WORD 7 ]
495 Exception region number. */
496 int region;
499 struct GTY((tag("GSS_EH_CTRL")))
500 gresx : public gimple_statement_eh_ctrl
502 /* No extra fields; adds invariant:
503 stmt->code == GIMPLE_RESX. */
506 struct GTY((tag("GSS_EH_CTRL")))
507 geh_dispatch : public gimple_statement_eh_ctrl
509 /* No extra fields; adds invariant:
510 stmt->code == GIMPLE_EH_DISPATH. */
514 /* GIMPLE_TRY */
516 struct GTY((tag("GSS_TRY")))
517 gtry : public gimple
519 /* [ WORD 1-6 ] : base class */
521 /* [ WORD 7 ]
522 Expression to evaluate. */
523 gimple_seq eval;
525 /* [ WORD 8 ]
526 Cleanup expression. */
527 gimple_seq cleanup;
530 /* Kind of GIMPLE_TRY statements. */
531 enum gimple_try_flags
533 /* A try/catch. */
534 GIMPLE_TRY_CATCH = 1 << 0,
536 /* A try/finally. */
537 GIMPLE_TRY_FINALLY = 1 << 1,
538 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
540 /* Analogous to TRY_CATCH_IS_CLEANUP. */
541 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
544 /* GIMPLE_WITH_CLEANUP_EXPR */
546 struct GTY((tag("GSS_WCE")))
547 gimple_statement_wce : public gimple
549 /* [ WORD 1-6 ] : base class */
551 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
552 executed if an exception is thrown, not on normal exit of its
553 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
554 in TARGET_EXPRs. */
556 /* [ WORD 7 ]
557 Cleanup expression. */
558 gimple_seq cleanup;
562 /* GIMPLE_ASM */
564 struct GTY((tag("GSS_ASM")))
565 gasm : public gimple_statement_with_memory_ops_base
567 /* [ WORD 1-9 ] : base class */
569 /* [ WORD 10 ]
570 __asm__ statement. */
571 const char *string;
573 /* [ WORD 11 ]
574 Number of inputs, outputs, clobbers, labels. */
575 unsigned char ni;
576 unsigned char no;
577 unsigned char nc;
578 unsigned char nl;
580 /* [ WORD 12 ]
581 Operand vector. NOTE! This must always be the last field
582 of this structure. In particular, this means that this
583 structure cannot be embedded inside another one. */
584 tree GTY((length ("%h.num_ops"))) op[1];
587 /* GIMPLE_OMP_CRITICAL */
589 struct GTY((tag("GSS_OMP_CRITICAL")))
590 gomp_critical : public gimple_statement_omp
592 /* [ WORD 1-7 ] : base class */
594 /* [ WORD 8 ] */
595 tree clauses;
597 /* [ WORD 9 ]
598 Critical section name. */
599 tree name;
603 struct GTY(()) gimple_omp_for_iter {
604 /* Condition code. */
605 enum tree_code cond;
607 /* Index variable. */
608 tree index;
610 /* Initial value. */
611 tree initial;
613 /* Final value. */
614 tree final;
616 /* Increment. */
617 tree incr;
620 /* GIMPLE_OMP_FOR */
622 struct GTY((tag("GSS_OMP_FOR")))
623 gomp_for : public gimple_statement_omp
625 /* [ WORD 1-7 ] : base class */
627 /* [ WORD 8 ] */
628 tree clauses;
630 /* [ WORD 9 ]
631 Number of elements in iter array. */
632 size_t collapse;
634 /* [ WORD 10 ] */
635 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
637 /* [ WORD 11 ]
638 Pre-body evaluated before the loop body begins. */
639 gimple_seq pre_body;
643 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
645 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
646 gimple_statement_omp_parallel_layout : public gimple_statement_omp
648 /* [ WORD 1-7 ] : base class */
650 /* [ WORD 8 ]
651 Clauses. */
652 tree clauses;
654 /* [ WORD 9 ]
655 Child function holding the body of the parallel region. */
656 tree child_fn;
658 /* [ WORD 10 ]
659 Shared data argument. */
660 tree data_arg;
663 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL
669 || stmt->code == GIMPLE_OMP_TASK. */
672 /* GIMPLE_OMP_PARALLEL */
673 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
674 gomp_parallel : public gimple_statement_omp_taskreg
676 /* No extra fields; adds invariant:
677 stmt->code == GIMPLE_OMP_PARALLEL. */
680 /* GIMPLE_OMP_TARGET */
681 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
682 gomp_target : public gimple_statement_omp_parallel_layout
684 /* No extra fields; adds invariant:
685 stmt->code == GIMPLE_OMP_TARGET. */
688 /* GIMPLE_OMP_TASK */
690 struct GTY((tag("GSS_OMP_TASK")))
691 gomp_task : public gimple_statement_omp_taskreg
693 /* [ WORD 1-10 ] : base class */
695 /* [ WORD 11 ]
696 Child function holding firstprivate initialization if needed. */
697 tree copy_fn;
699 /* [ WORD 12-13 ]
700 Size and alignment in bytes of the argument data block. */
701 tree arg_size;
702 tree arg_align;
706 /* GIMPLE_OMP_SECTION */
707 /* Uses struct gimple_statement_omp. */
710 /* GIMPLE_OMP_SECTIONS */
712 struct GTY((tag("GSS_OMP_SECTIONS")))
713 gomp_sections : public gimple_statement_omp
715 /* [ WORD 1-7 ] : base class */
717 /* [ WORD 8 ] */
718 tree clauses;
720 /* [ WORD 9 ]
721 The control variable used for deciding which of the sections to
722 execute. */
723 tree control;
726 /* GIMPLE_OMP_CONTINUE.
728 Note: This does not inherit from gimple_statement_omp, because we
729 do not need the body field. */
731 struct GTY((tag("GSS_OMP_CONTINUE")))
732 gomp_continue : public gimple
734 /* [ WORD 1-6 ] : base class */
736 /* [ WORD 7 ] */
737 tree control_def;
739 /* [ WORD 8 ] */
740 tree control_use;
743 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gimple_statement_omp_single_layout : public gimple_statement_omp
748 /* [ WORD 1-7 ] : base class */
750 /* [ WORD 8 ] */
751 tree clauses;
754 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
755 gomp_single : public gimple_statement_omp_single_layout
757 /* No extra fields; adds invariant:
758 stmt->code == GIMPLE_OMP_SINGLE. */
761 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
762 gomp_teams : public gimple_statement_omp_single_layout
764 /* No extra fields; adds invariant:
765 stmt->code == GIMPLE_OMP_TEAMS. */
768 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
769 gomp_ordered : public gimple_statement_omp_single_layout
771 /* No extra fields; adds invariant:
772 stmt->code == GIMPLE_OMP_ORDERED. */
776 /* GIMPLE_OMP_ATOMIC_LOAD.
777 Note: This is based on gimple, not g_s_omp, because g_s_omp
778 contains a sequence, which we don't need here. */
780 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
781 gomp_atomic_load : public gimple
783 /* [ WORD 1-6 ] : base class */
785 /* [ WORD 7-8 ] */
786 tree rhs, lhs;
789 /* GIMPLE_OMP_ATOMIC_STORE.
790 See note on GIMPLE_OMP_ATOMIC_LOAD. */
792 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
793 gimple_statement_omp_atomic_store_layout : public gimple
795 /* [ WORD 1-6 ] : base class */
797 /* [ WORD 7 ] */
798 tree val;
801 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
802 gomp_atomic_store :
803 public gimple_statement_omp_atomic_store_layout
805 /* No extra fields; adds invariant:
806 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
809 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
810 gimple_statement_omp_return :
811 public gimple_statement_omp_atomic_store_layout
813 /* No extra fields; adds invariant:
814 stmt->code == GIMPLE_OMP_RETURN. */
817 /* GIMPLE_TRANSACTION. */
819 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
821 /* The __transaction_atomic was declared [[outer]] or it is
822 __transaction_relaxed. */
823 #define GTMA_IS_OUTER (1u << 0)
824 #define GTMA_IS_RELAXED (1u << 1)
825 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
827 /* The transaction is seen to not have an abort. */
828 #define GTMA_HAVE_ABORT (1u << 2)
829 /* The transaction is seen to have loads or stores. */
830 #define GTMA_HAVE_LOAD (1u << 3)
831 #define GTMA_HAVE_STORE (1u << 4)
832 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
833 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
834 /* The transaction WILL enter serial irrevocable mode.
835 An irrevocable block post-dominates the entire transaction, such
836 that all invocations of the transaction will go serial-irrevocable.
837 In such case, we don't bother instrumenting the transaction, and
838 tell the runtime that it should begin the transaction in
839 serial-irrevocable mode. */
840 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
841 /* The transaction contains no instrumentation code whatsover, most
842 likely because it is guaranteed to go irrevocable upon entry. */
843 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
845 struct GTY((tag("GSS_TRANSACTION")))
846 gtransaction : public gimple_statement_with_memory_ops_base
848 /* [ WORD 1-9 ] : base class */
850 /* [ WORD 10 ] */
851 gimple_seq body;
853 /* [ WORD 11-13 ] */
854 tree label_norm;
855 tree label_uninst;
856 tree label_over;
859 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
860 enum gimple_statement_structure_enum {
861 #include "gsstruct.def"
862 LAST_GSS_ENUM
864 #undef DEFGSSTRUCT
866 /* A statement with the invariant that
867 stmt->code == GIMPLE_COND
868 i.e. a conditional jump statement. */
870 struct GTY((tag("GSS_WITH_OPS")))
871 gcond : public gimple_statement_with_ops
873 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
874 static const enum gimple_code code_ = GIMPLE_COND;
877 /* A statement with the invariant that
878 stmt->code == GIMPLE_DEBUG
879 i.e. a debug statement. */
881 struct GTY((tag("GSS_WITH_OPS")))
882 gdebug : public gimple_statement_with_ops
884 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
887 /* A statement with the invariant that
888 stmt->code == GIMPLE_GOTO
889 i.e. a goto statement. */
891 struct GTY((tag("GSS_WITH_OPS")))
892 ggoto : public gimple_statement_with_ops
894 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
897 /* A statement with the invariant that
898 stmt->code == GIMPLE_LABEL
899 i.e. a label statement. */
901 struct GTY((tag("GSS_WITH_OPS")))
902 glabel : public gimple_statement_with_ops
904 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
907 /* A statement with the invariant that
908 stmt->code == GIMPLE_SWITCH
909 i.e. a switch statement. */
911 struct GTY((tag("GSS_WITH_OPS")))
912 gswitch : public gimple_statement_with_ops
914 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
917 /* A statement with the invariant that
918 stmt->code == GIMPLE_ASSIGN
919 i.e. an assignment statement. */
921 struct GTY((tag("GSS_WITH_MEM_OPS")))
922 gassign : public gimple_statement_with_memory_ops
924 static const enum gimple_code code_ = GIMPLE_ASSIGN;
925 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
928 /* A statement with the invariant that
929 stmt->code == GIMPLE_RETURN
930 i.e. a return statement. */
932 struct GTY((tag("GSS_WITH_MEM_OPS")))
933 greturn : public gimple_statement_with_memory_ops
935 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
938 template <>
939 template <>
940 inline bool
941 is_a_helper <gasm *>::test (gimple *gs)
943 return gs->code == GIMPLE_ASM;
946 template <>
947 template <>
948 inline bool
949 is_a_helper <gassign *>::test (gimple *gs)
951 return gs->code == GIMPLE_ASSIGN;
954 template <>
955 template <>
956 inline bool
957 is_a_helper <const gassign *>::test (const gimple *gs)
959 return gs->code == GIMPLE_ASSIGN;
962 template <>
963 template <>
964 inline bool
965 is_a_helper <gbind *>::test (gimple *gs)
967 return gs->code == GIMPLE_BIND;
970 template <>
971 template <>
972 inline bool
973 is_a_helper <gcall *>::test (gimple *gs)
975 return gs->code == GIMPLE_CALL;
978 template <>
979 template <>
980 inline bool
981 is_a_helper <gcatch *>::test (gimple *gs)
983 return gs->code == GIMPLE_CATCH;
986 template <>
987 template <>
988 inline bool
989 is_a_helper <gcond *>::test (gimple *gs)
991 return gs->code == GIMPLE_COND;
994 template <>
995 template <>
996 inline bool
997 is_a_helper <const gcond *>::test (const gimple *gs)
999 return gs->code == GIMPLE_COND;
1002 template <>
1003 template <>
1004 inline bool
1005 is_a_helper <gdebug *>::test (gimple *gs)
1007 return gs->code == GIMPLE_DEBUG;
1010 template <>
1011 template <>
1012 inline bool
1013 is_a_helper <ggoto *>::test (gimple *gs)
1015 return gs->code == GIMPLE_GOTO;
1018 template <>
1019 template <>
1020 inline bool
1021 is_a_helper <glabel *>::test (gimple *gs)
1023 return gs->code == GIMPLE_LABEL;
1026 template <>
1027 template <>
1028 inline bool
1029 is_a_helper <gresx *>::test (gimple *gs)
1031 return gs->code == GIMPLE_RESX;
1034 template <>
1035 template <>
1036 inline bool
1037 is_a_helper <geh_dispatch *>::test (gimple *gs)
1039 return gs->code == GIMPLE_EH_DISPATCH;
1042 template <>
1043 template <>
1044 inline bool
1045 is_a_helper <geh_else *>::test (gimple *gs)
1047 return gs->code == GIMPLE_EH_ELSE;
1050 template <>
1051 template <>
1052 inline bool
1053 is_a_helper <geh_filter *>::test (gimple *gs)
1055 return gs->code == GIMPLE_EH_FILTER;
1058 template <>
1059 template <>
1060 inline bool
1061 is_a_helper <geh_mnt *>::test (gimple *gs)
1063 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1066 template <>
1067 template <>
1068 inline bool
1069 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1071 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1074 template <>
1075 template <>
1076 inline bool
1077 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1079 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1082 template <>
1083 template <>
1084 inline bool
1085 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1087 return gs->code == GIMPLE_OMP_RETURN;
1090 template <>
1091 template <>
1092 inline bool
1093 is_a_helper <gomp_continue *>::test (gimple *gs)
1095 return gs->code == GIMPLE_OMP_CONTINUE;
1098 template <>
1099 template <>
1100 inline bool
1101 is_a_helper <gomp_critical *>::test (gimple *gs)
1103 return gs->code == GIMPLE_OMP_CRITICAL;
1106 template <>
1107 template <>
1108 inline bool
1109 is_a_helper <gomp_ordered *>::test (gimple *gs)
1111 return gs->code == GIMPLE_OMP_ORDERED;
1114 template <>
1115 template <>
1116 inline bool
1117 is_a_helper <gomp_for *>::test (gimple *gs)
1119 return gs->code == GIMPLE_OMP_FOR;
1122 template <>
1123 template <>
1124 inline bool
1125 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1127 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1130 template <>
1131 template <>
1132 inline bool
1133 is_a_helper <gomp_parallel *>::test (gimple *gs)
1135 return gs->code == GIMPLE_OMP_PARALLEL;
1138 template <>
1139 template <>
1140 inline bool
1141 is_a_helper <gomp_target *>::test (gimple *gs)
1143 return gs->code == GIMPLE_OMP_TARGET;
1146 template <>
1147 template <>
1148 inline bool
1149 is_a_helper <gomp_sections *>::test (gimple *gs)
1151 return gs->code == GIMPLE_OMP_SECTIONS;
1154 template <>
1155 template <>
1156 inline bool
1157 is_a_helper <gomp_single *>::test (gimple *gs)
1159 return gs->code == GIMPLE_OMP_SINGLE;
1162 template <>
1163 template <>
1164 inline bool
1165 is_a_helper <gomp_teams *>::test (gimple *gs)
1167 return gs->code == GIMPLE_OMP_TEAMS;
1170 template <>
1171 template <>
1172 inline bool
1173 is_a_helper <gomp_task *>::test (gimple *gs)
1175 return gs->code == GIMPLE_OMP_TASK;
1178 template <>
1179 template <>
1180 inline bool
1181 is_a_helper <gphi *>::test (gimple *gs)
1183 return gs->code == GIMPLE_PHI;
1186 template <>
1187 template <>
1188 inline bool
1189 is_a_helper <greturn *>::test (gimple *gs)
1191 return gs->code == GIMPLE_RETURN;
1194 template <>
1195 template <>
1196 inline bool
1197 is_a_helper <gswitch *>::test (gimple *gs)
1199 return gs->code == GIMPLE_SWITCH;
1202 template <>
1203 template <>
1204 inline bool
1205 is_a_helper <gtransaction *>::test (gimple *gs)
1207 return gs->code == GIMPLE_TRANSACTION;
1210 template <>
1211 template <>
1212 inline bool
1213 is_a_helper <gtry *>::test (gimple *gs)
1215 return gs->code == GIMPLE_TRY;
1218 template <>
1219 template <>
1220 inline bool
1221 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1223 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1226 template <>
1227 template <>
1228 inline bool
1229 is_a_helper <const gasm *>::test (const gimple *gs)
1231 return gs->code == GIMPLE_ASM;
1234 template <>
1235 template <>
1236 inline bool
1237 is_a_helper <const gbind *>::test (const gimple *gs)
1239 return gs->code == GIMPLE_BIND;
1242 template <>
1243 template <>
1244 inline bool
1245 is_a_helper <const gcall *>::test (const gimple *gs)
1247 return gs->code == GIMPLE_CALL;
1250 template <>
1251 template <>
1252 inline bool
1253 is_a_helper <const gcatch *>::test (const gimple *gs)
1255 return gs->code == GIMPLE_CATCH;
1258 template <>
1259 template <>
1260 inline bool
1261 is_a_helper <const gresx *>::test (const gimple *gs)
1263 return gs->code == GIMPLE_RESX;
1266 template <>
1267 template <>
1268 inline bool
1269 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1271 return gs->code == GIMPLE_EH_DISPATCH;
1274 template <>
1275 template <>
1276 inline bool
1277 is_a_helper <const geh_filter *>::test (const gimple *gs)
1279 return gs->code == GIMPLE_EH_FILTER;
1282 template <>
1283 template <>
1284 inline bool
1285 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1287 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1290 template <>
1291 template <>
1292 inline bool
1293 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1295 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1298 template <>
1299 template <>
1300 inline bool
1301 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1303 return gs->code == GIMPLE_OMP_RETURN;
1306 template <>
1307 template <>
1308 inline bool
1309 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1311 return gs->code == GIMPLE_OMP_CONTINUE;
1314 template <>
1315 template <>
1316 inline bool
1317 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1319 return gs->code == GIMPLE_OMP_CRITICAL;
1322 template <>
1323 template <>
1324 inline bool
1325 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1327 return gs->code == GIMPLE_OMP_ORDERED;
1330 template <>
1331 template <>
1332 inline bool
1333 is_a_helper <const gomp_for *>::test (const gimple *gs)
1335 return gs->code == GIMPLE_OMP_FOR;
1338 template <>
1339 template <>
1340 inline bool
1341 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1343 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1346 template <>
1347 template <>
1348 inline bool
1349 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1351 return gs->code == GIMPLE_OMP_PARALLEL;
1354 template <>
1355 template <>
1356 inline bool
1357 is_a_helper <const gomp_target *>::test (const gimple *gs)
1359 return gs->code == GIMPLE_OMP_TARGET;
1362 template <>
1363 template <>
1364 inline bool
1365 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1367 return gs->code == GIMPLE_OMP_SECTIONS;
1370 template <>
1371 template <>
1372 inline bool
1373 is_a_helper <const gomp_single *>::test (const gimple *gs)
1375 return gs->code == GIMPLE_OMP_SINGLE;
1378 template <>
1379 template <>
1380 inline bool
1381 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1383 return gs->code == GIMPLE_OMP_TEAMS;
1386 template <>
1387 template <>
1388 inline bool
1389 is_a_helper <const gomp_task *>::test (const gimple *gs)
1391 return gs->code == GIMPLE_OMP_TASK;
1394 template <>
1395 template <>
1396 inline bool
1397 is_a_helper <const gphi *>::test (const gimple *gs)
1399 return gs->code == GIMPLE_PHI;
1402 template <>
1403 template <>
1404 inline bool
1405 is_a_helper <const gtransaction *>::test (const gimple *gs)
1407 return gs->code == GIMPLE_TRANSACTION;
1410 /* Offset in bytes to the location of the operand vector.
1411 Zero if there is no operand vector for this tuple structure. */
1412 extern size_t const gimple_ops_offset_[];
1414 /* Map GIMPLE codes to GSS codes. */
1415 extern enum gimple_statement_structure_enum const gss_for_code_[];
1417 /* This variable holds the currently expanded gimple statement for purposes
1418 of comminucating the profile info to the builtin expanders. */
1419 extern gimple *currently_expanding_gimple_stmt;
1421 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
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, 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 (tree, tree, gimple * CXX_MEM_STAT_INFO);
1458 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1459 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1460 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1461 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1462 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1463 tree, tree);
1464 gimple *gimple_build_omp_section (gimple_seq);
1465 gimple *gimple_build_omp_master (gimple_seq);
1466 gimple *gimple_build_omp_grid_body (gimple_seq);
1467 gimple *gimple_build_omp_taskgroup (gimple_seq);
1468 gomp_continue *gimple_build_omp_continue (tree, tree);
1469 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1470 gimple *gimple_build_omp_return (bool);
1471 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1472 gimple *gimple_build_omp_sections_switch (void);
1473 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1474 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1475 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1476 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1477 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1478 gtransaction *gimple_build_transaction (gimple_seq);
1479 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1480 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1481 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1482 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1483 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1484 location_t);
1485 extern void annotate_all_with_location (gimple_seq, location_t);
1486 bool empty_body_p (gimple_seq);
1487 gimple_seq gimple_seq_copy (gimple_seq);
1488 bool gimple_call_same_target_p (const gimple *, const gimple *);
1489 int gimple_call_flags (const gimple *);
1490 int gimple_call_arg_flags (const gcall *, unsigned);
1491 int gimple_call_return_flags (const gcall *);
1492 bool gimple_assign_copy_p (gimple *);
1493 bool gimple_assign_ssa_name_copy_p (gimple *);
1494 bool gimple_assign_unary_nop_p (gimple *);
1495 void gimple_set_bb (gimple *, basic_block);
1496 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1497 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1498 tree, tree, tree);
1499 tree gimple_get_lhs (const gimple *);
1500 void gimple_set_lhs (gimple *, tree);
1501 gimple *gimple_copy (gimple *);
1502 bool gimple_has_side_effects (const gimple *);
1503 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1504 bool gimple_could_trap_p (gimple *);
1505 bool gimple_assign_rhs_could_trap_p (gimple *);
1506 extern void dump_gimple_statistics (void);
1507 unsigned get_gimple_rhs_num_ops (enum tree_code);
1508 extern tree canonicalize_cond_expr_cond (tree);
1509 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1510 extern bool gimple_compare_field_offset (tree, tree);
1511 extern tree gimple_unsigned_type (tree);
1512 extern tree gimple_signed_type (tree);
1513 extern alias_set_type gimple_get_alias_set (tree);
1514 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1515 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1516 extern combined_fn gimple_call_combined_fn (const gimple *);
1517 extern bool gimple_call_builtin_p (const gimple *);
1518 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1519 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1520 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1521 extern void dump_decl_set (FILE *, bitmap);
1522 extern bool nonfreeing_call_p (gimple *);
1523 extern bool nonbarrier_call_p (gimple *);
1524 extern bool infer_nonnull_range (gimple *, tree);
1525 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1526 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1527 extern void sort_case_labels (vec<tree>);
1528 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1529 extern void gimple_seq_set_location (gimple_seq, location_t);
1530 extern void gimple_seq_discard (gimple_seq);
1531 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1532 extern bool gimple_inexpensive_call_p (gcall *);
1533 extern bool stmt_can_terminate_bb_p (gimple *);
1535 /* Formal (expression) temporary table handling: multiple occurrences of
1536 the same scalar expression are evaluated into the same temporary. */
1538 typedef struct gimple_temp_hash_elt
1540 tree val; /* Key */
1541 tree temp; /* Value */
1542 } elt_t;
1544 /* Get the number of the next statement uid to be allocated. */
1545 static inline unsigned int
1546 gimple_stmt_max_uid (struct function *fn)
1548 return fn->last_stmt_uid;
1551 /* Set the number of the next statement uid to be allocated. */
1552 static inline void
1553 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1555 fn->last_stmt_uid = maxid;
1558 /* Set the number of the next statement uid to be allocated. */
1559 static inline unsigned int
1560 inc_gimple_stmt_max_uid (struct function *fn)
1562 return fn->last_stmt_uid++;
1565 /* Return the first node in GIMPLE sequence S. */
1567 static inline gimple_seq_node
1568 gimple_seq_first (gimple_seq s)
1570 return s;
1574 /* Return the first statement in GIMPLE sequence S. */
1576 static inline gimple *
1577 gimple_seq_first_stmt (gimple_seq s)
1579 gimple_seq_node n = gimple_seq_first (s);
1580 return n;
1583 /* Return the first statement in GIMPLE sequence S as a gbind *,
1584 verifying that it has code GIMPLE_BIND in a checked build. */
1586 static inline gbind *
1587 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1589 gimple_seq_node n = gimple_seq_first (s);
1590 return as_a <gbind *> (n);
1594 /* Return the last node in GIMPLE sequence S. */
1596 static inline gimple_seq_node
1597 gimple_seq_last (gimple_seq s)
1599 return s ? s->prev : NULL;
1603 /* Return the last statement in GIMPLE sequence S. */
1605 static inline gimple *
1606 gimple_seq_last_stmt (gimple_seq s)
1608 gimple_seq_node n = gimple_seq_last (s);
1609 return n;
1613 /* Set the last node in GIMPLE sequence *PS to LAST. */
1615 static inline void
1616 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1618 (*ps)->prev = last;
1622 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1624 static inline void
1625 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1627 *ps = first;
1631 /* Return true if GIMPLE sequence S is empty. */
1633 static inline bool
1634 gimple_seq_empty_p (gimple_seq s)
1636 return s == NULL;
1639 /* Allocate a new sequence and initialize its first element with STMT. */
1641 static inline gimple_seq
1642 gimple_seq_alloc_with_stmt (gimple *stmt)
1644 gimple_seq seq = NULL;
1645 gimple_seq_add_stmt (&seq, stmt);
1646 return seq;
1650 /* Returns the sequence of statements in BB. */
1652 static inline gimple_seq
1653 bb_seq (const_basic_block bb)
1655 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1658 static inline gimple_seq *
1659 bb_seq_addr (basic_block bb)
1661 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1664 /* Sets the sequence of statements in BB to SEQ. */
1666 static inline void
1667 set_bb_seq (basic_block bb, gimple_seq seq)
1669 gcc_checking_assert (!(bb->flags & BB_RTL));
1670 bb->il.gimple.seq = seq;
1674 /* Return the code for GIMPLE statement G. */
1676 static inline enum gimple_code
1677 gimple_code (const gimple *g)
1679 return g->code;
1683 /* Return the GSS code used by a GIMPLE code. */
1685 static inline enum gimple_statement_structure_enum
1686 gss_for_code (enum gimple_code code)
1688 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1689 return gss_for_code_[code];
1693 /* Return which GSS code is used by GS. */
1695 static inline enum gimple_statement_structure_enum
1696 gimple_statement_structure (gimple *gs)
1698 return gss_for_code (gimple_code (gs));
1702 /* Return true if statement G has sub-statements. This is only true for
1703 High GIMPLE statements. */
1705 static inline bool
1706 gimple_has_substatements (gimple *g)
1708 switch (gimple_code (g))
1710 case GIMPLE_BIND:
1711 case GIMPLE_CATCH:
1712 case GIMPLE_EH_FILTER:
1713 case GIMPLE_EH_ELSE:
1714 case GIMPLE_TRY:
1715 case GIMPLE_OMP_FOR:
1716 case GIMPLE_OMP_MASTER:
1717 case GIMPLE_OMP_TASKGROUP:
1718 case GIMPLE_OMP_ORDERED:
1719 case GIMPLE_OMP_SECTION:
1720 case GIMPLE_OMP_PARALLEL:
1721 case GIMPLE_OMP_TASK:
1722 case GIMPLE_OMP_SECTIONS:
1723 case GIMPLE_OMP_SINGLE:
1724 case GIMPLE_OMP_TARGET:
1725 case GIMPLE_OMP_TEAMS:
1726 case GIMPLE_OMP_CRITICAL:
1727 case GIMPLE_WITH_CLEANUP_EXPR:
1728 case GIMPLE_TRANSACTION:
1729 case GIMPLE_OMP_GRID_BODY:
1730 return true;
1732 default:
1733 return false;
1738 /* Return the basic block holding statement G. */
1740 static inline basic_block
1741 gimple_bb (const gimple *g)
1743 return g->bb;
1747 /* Return the lexical scope block holding statement G. */
1749 static inline tree
1750 gimple_block (const gimple *g)
1752 return LOCATION_BLOCK (g->location);
1756 /* Set BLOCK to be the lexical scope block holding statement G. */
1758 static inline void
1759 gimple_set_block (gimple *g, tree block)
1761 g->location = set_block (g->location, block);
1765 /* Return location information for statement G. */
1767 static inline location_t
1768 gimple_location (const gimple *g)
1770 return g->location;
1773 /* Return location information for statement G if g is not NULL.
1774 Otherwise, UNKNOWN_LOCATION is returned. */
1776 static inline location_t
1777 gimple_location_safe (const gimple *g)
1779 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1782 /* Set location information for statement G. */
1784 static inline void
1785 gimple_set_location (gimple *g, location_t location)
1787 g->location = location;
1791 /* Return true if G contains location information. */
1793 static inline bool
1794 gimple_has_location (const gimple *g)
1796 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1800 /* Return the file name of the location of STMT. */
1802 static inline const char *
1803 gimple_filename (const gimple *stmt)
1805 return LOCATION_FILE (gimple_location (stmt));
1809 /* Return the line number of the location of STMT. */
1811 static inline int
1812 gimple_lineno (const gimple *stmt)
1814 return LOCATION_LINE (gimple_location (stmt));
1818 /* Determine whether SEQ is a singleton. */
1820 static inline bool
1821 gimple_seq_singleton_p (gimple_seq seq)
1823 return ((gimple_seq_first (seq) != NULL)
1824 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1827 /* Return true if no warnings should be emitted for statement STMT. */
1829 static inline bool
1830 gimple_no_warning_p (const gimple *stmt)
1832 return stmt->no_warning;
1835 /* Set the no_warning flag of STMT to NO_WARNING. */
1837 static inline void
1838 gimple_set_no_warning (gimple *stmt, bool no_warning)
1840 stmt->no_warning = (unsigned) no_warning;
1843 /* Set the visited status on statement STMT to VISITED_P.
1845 Please note that this 'visited' property of the gimple statement is
1846 supposed to be undefined at pass boundaries. This means that a
1847 given pass should not assume it contains any useful value when the
1848 pass starts and thus can set it to any value it sees fit.
1850 You can learn more about the visited property of the gimple
1851 statement by reading the comments of the 'visited' data member of
1852 struct gimple.
1855 static inline void
1856 gimple_set_visited (gimple *stmt, bool visited_p)
1858 stmt->visited = (unsigned) visited_p;
1862 /* Return the visited status for statement STMT.
1864 Please note that this 'visited' property of the gimple statement is
1865 supposed to be undefined at pass boundaries. This means that a
1866 given pass should not assume it contains any useful value when the
1867 pass starts and thus can set it to any value it sees fit.
1869 You can learn more about the visited property of the gimple
1870 statement by reading the comments of the 'visited' data member of
1871 struct gimple. */
1873 static inline bool
1874 gimple_visited_p (gimple *stmt)
1876 return stmt->visited;
1880 /* Set pass local flag PLF on statement STMT to VAL_P.
1882 Please note that this PLF property of the gimple statement is
1883 supposed to be undefined at pass boundaries. This means that a
1884 given pass should not assume it contains any useful value when the
1885 pass starts and thus can set it to any value it sees fit.
1887 You can learn more about the PLF property by reading the comment of
1888 the 'plf' data member of struct gimple_statement_structure. */
1890 static inline void
1891 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1893 if (val_p)
1894 stmt->plf |= (unsigned int) plf;
1895 else
1896 stmt->plf &= ~((unsigned int) plf);
1900 /* Return the value of pass local flag PLF on statement STMT.
1902 Please note that this 'plf' property of the gimple statement is
1903 supposed to be undefined at pass boundaries. This means that a
1904 given pass should not assume it contains any useful value when the
1905 pass starts and thus can set it to any value it sees fit.
1907 You can learn more about the plf property by reading the comment of
1908 the 'plf' data member of struct gimple_statement_structure. */
1910 static inline unsigned int
1911 gimple_plf (gimple *stmt, enum plf_mask plf)
1913 return stmt->plf & ((unsigned int) plf);
1917 /* Set the UID of statement.
1919 Please note that this UID property is supposed to be undefined at
1920 pass boundaries. This means that a given pass should not assume it
1921 contains any useful value when the pass starts and thus can set it
1922 to any value it sees fit. */
1924 static inline void
1925 gimple_set_uid (gimple *g, unsigned uid)
1927 g->uid = uid;
1931 /* Return the UID of statement.
1933 Please note that this UID property is supposed to be undefined at
1934 pass boundaries. This means that a given pass should not assume it
1935 contains any useful value when the pass starts and thus can set it
1936 to any value it sees fit. */
1938 static inline unsigned
1939 gimple_uid (const gimple *g)
1941 return g->uid;
1945 /* Make statement G a singleton sequence. */
1947 static inline void
1948 gimple_init_singleton (gimple *g)
1950 g->next = NULL;
1951 g->prev = g;
1955 /* Return true if GIMPLE statement G has register or memory operands. */
1957 static inline bool
1958 gimple_has_ops (const gimple *g)
1960 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1963 template <>
1964 template <>
1965 inline bool
1966 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1968 return gimple_has_ops (gs);
1971 template <>
1972 template <>
1973 inline bool
1974 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1976 return gimple_has_ops (gs);
1979 /* Return true if GIMPLE statement G has memory operands. */
1981 static inline bool
1982 gimple_has_mem_ops (const gimple *g)
1984 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1987 template <>
1988 template <>
1989 inline bool
1990 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1992 return gimple_has_mem_ops (gs);
1995 template <>
1996 template <>
1997 inline bool
1998 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
2000 return gimple_has_mem_ops (gs);
2003 /* Return the set of USE operands for statement G. */
2005 static inline struct use_optype_d *
2006 gimple_use_ops (const gimple *g)
2008 const gimple_statement_with_ops *ops_stmt =
2009 dyn_cast <const gimple_statement_with_ops *> (g);
2010 if (!ops_stmt)
2011 return NULL;
2012 return ops_stmt->use_ops;
2016 /* Set USE to be the set of USE operands for statement G. */
2018 static inline void
2019 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2021 gimple_statement_with_ops *ops_stmt =
2022 as_a <gimple_statement_with_ops *> (g);
2023 ops_stmt->use_ops = use;
2027 /* Return the single VUSE operand of the statement G. */
2029 static inline tree
2030 gimple_vuse (const gimple *g)
2032 const gimple_statement_with_memory_ops *mem_ops_stmt =
2033 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2034 if (!mem_ops_stmt)
2035 return NULL_TREE;
2036 return mem_ops_stmt->vuse;
2039 /* Return the single VDEF operand of the statement G. */
2041 static inline tree
2042 gimple_vdef (const gimple *g)
2044 const gimple_statement_with_memory_ops *mem_ops_stmt =
2045 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2046 if (!mem_ops_stmt)
2047 return NULL_TREE;
2048 return mem_ops_stmt->vdef;
2051 /* Return the single VUSE operand of the statement G. */
2053 static inline tree *
2054 gimple_vuse_ptr (gimple *g)
2056 gimple_statement_with_memory_ops *mem_ops_stmt =
2057 dyn_cast <gimple_statement_with_memory_ops *> (g);
2058 if (!mem_ops_stmt)
2059 return NULL;
2060 return &mem_ops_stmt->vuse;
2063 /* Return the single VDEF operand of the statement G. */
2065 static inline tree *
2066 gimple_vdef_ptr (gimple *g)
2068 gimple_statement_with_memory_ops *mem_ops_stmt =
2069 dyn_cast <gimple_statement_with_memory_ops *> (g);
2070 if (!mem_ops_stmt)
2071 return NULL;
2072 return &mem_ops_stmt->vdef;
2075 /* Set the single VUSE operand of the statement G. */
2077 static inline void
2078 gimple_set_vuse (gimple *g, tree vuse)
2080 gimple_statement_with_memory_ops *mem_ops_stmt =
2081 as_a <gimple_statement_with_memory_ops *> (g);
2082 mem_ops_stmt->vuse = vuse;
2085 /* Set the single VDEF operand of the statement G. */
2087 static inline void
2088 gimple_set_vdef (gimple *g, tree vdef)
2090 gimple_statement_with_memory_ops *mem_ops_stmt =
2091 as_a <gimple_statement_with_memory_ops *> (g);
2092 mem_ops_stmt->vdef = vdef;
2096 /* Return true if statement G has operands and the modified field has
2097 been set. */
2099 static inline bool
2100 gimple_modified_p (const gimple *g)
2102 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2106 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2107 a MODIFIED field. */
2109 static inline void
2110 gimple_set_modified (gimple *s, bool modifiedp)
2112 if (gimple_has_ops (s))
2113 s->modified = (unsigned) modifiedp;
2117 /* Return the tree code for the expression computed by STMT. This is
2118 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2119 GIMPLE_CALL, return CALL_EXPR as the expression code for
2120 consistency. This is useful when the caller needs to deal with the
2121 three kinds of computation that GIMPLE supports. */
2123 static inline enum tree_code
2124 gimple_expr_code (const gimple *stmt)
2126 enum gimple_code code = gimple_code (stmt);
2127 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2128 return (enum tree_code) stmt->subcode;
2129 else
2131 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2132 return CALL_EXPR;
2137 /* Return true if statement STMT contains volatile operands. */
2139 static inline bool
2140 gimple_has_volatile_ops (const gimple *stmt)
2142 if (gimple_has_mem_ops (stmt))
2143 return stmt->has_volatile_ops;
2144 else
2145 return false;
2149 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2151 static inline void
2152 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2154 if (gimple_has_mem_ops (stmt))
2155 stmt->has_volatile_ops = (unsigned) volatilep;
2158 /* Return true if STMT is in a transaction. */
2160 static inline bool
2161 gimple_in_transaction (const gimple *stmt)
2163 return bb_in_transaction (gimple_bb (stmt));
2166 /* Return true if statement STMT may access memory. */
2168 static inline bool
2169 gimple_references_memory_p (gimple *stmt)
2171 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2175 /* Return the subcode for OMP statement S. */
2177 static inline unsigned
2178 gimple_omp_subcode (const gimple *s)
2180 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2181 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2182 return s->subcode;
2185 /* Set the subcode for OMP statement S to SUBCODE. */
2187 static inline void
2188 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2190 /* We only have 16 bits for the subcode. Assert that we are not
2191 overflowing it. */
2192 gcc_gimple_checking_assert (subcode < (1 << 16));
2193 s->subcode = subcode;
2196 /* Set the nowait flag on OMP_RETURN statement S. */
2198 static inline void
2199 gimple_omp_return_set_nowait (gimple *s)
2201 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2202 s->subcode |= GF_OMP_RETURN_NOWAIT;
2206 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2207 flag set. */
2209 static inline bool
2210 gimple_omp_return_nowait_p (const gimple *g)
2212 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2213 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2217 /* Set the LHS of OMP return. */
2219 static inline void
2220 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2222 gimple_statement_omp_return *omp_return_stmt =
2223 as_a <gimple_statement_omp_return *> (g);
2224 omp_return_stmt->val = lhs;
2228 /* Get the LHS of OMP return. */
2230 static inline tree
2231 gimple_omp_return_lhs (const gimple *g)
2233 const gimple_statement_omp_return *omp_return_stmt =
2234 as_a <const gimple_statement_omp_return *> (g);
2235 return omp_return_stmt->val;
2239 /* Return a pointer to the LHS of OMP return. */
2241 static inline tree *
2242 gimple_omp_return_lhs_ptr (gimple *g)
2244 gimple_statement_omp_return *omp_return_stmt =
2245 as_a <gimple_statement_omp_return *> (g);
2246 return &omp_return_stmt->val;
2250 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2251 flag set. */
2253 static inline bool
2254 gimple_omp_section_last_p (const gimple *g)
2256 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2257 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2261 /* Set the GF_OMP_SECTION_LAST flag on G. */
2263 static inline void
2264 gimple_omp_section_set_last (gimple *g)
2266 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2267 g->subcode |= GF_OMP_SECTION_LAST;
2271 /* Return true if OMP parallel statement G has the
2272 GF_OMP_PARALLEL_COMBINED flag set. */
2274 static inline bool
2275 gimple_omp_parallel_combined_p (const gimple *g)
2277 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2278 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2282 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2283 value of COMBINED_P. */
2285 static inline void
2286 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2288 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2289 if (combined_p)
2290 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2291 else
2292 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2296 /* Return true if OMP atomic load/store statement G has the
2297 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2299 static inline bool
2300 gimple_omp_atomic_need_value_p (const gimple *g)
2302 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2303 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2304 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2308 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2310 static inline void
2311 gimple_omp_atomic_set_need_value (gimple *g)
2313 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2314 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2315 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2319 /* Return true if OMP atomic load/store statement G has the
2320 GF_OMP_ATOMIC_SEQ_CST flag set. */
2322 static inline bool
2323 gimple_omp_atomic_seq_cst_p (const gimple *g)
2325 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2326 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2327 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2331 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2333 static inline void
2334 gimple_omp_atomic_set_seq_cst (gimple *g)
2336 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2337 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2338 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2342 /* Return the number of operands for statement GS. */
2344 static inline unsigned
2345 gimple_num_ops (const gimple *gs)
2347 return gs->num_ops;
2351 /* Set the number of operands for statement GS. */
2353 static inline void
2354 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2356 gs->num_ops = num_ops;
2360 /* Return the array of operands for statement GS. */
2362 static inline tree *
2363 gimple_ops (gimple *gs)
2365 size_t off;
2367 /* All the tuples have their operand vector at the very bottom
2368 of the structure. Note that those structures that do not
2369 have an operand vector have a zero offset. */
2370 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2371 gcc_gimple_checking_assert (off != 0);
2373 return (tree *) ((char *) gs + off);
2377 /* Return operand I for statement GS. */
2379 static inline tree
2380 gimple_op (const gimple *gs, unsigned i)
2382 if (gimple_has_ops (gs))
2384 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2385 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2387 else
2388 return NULL_TREE;
2391 /* Return a pointer to operand I for statement GS. */
2393 static inline tree *
2394 gimple_op_ptr (gimple *gs, unsigned i)
2396 if (gimple_has_ops (gs))
2398 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2399 return gimple_ops (gs) + i;
2401 else
2402 return NULL;
2405 /* Set operand I of statement GS to OP. */
2407 static inline void
2408 gimple_set_op (gimple *gs, unsigned i, tree op)
2410 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2412 /* Note. It may be tempting to assert that OP matches
2413 is_gimple_operand, but that would be wrong. Different tuples
2414 accept slightly different sets of tree operands. Each caller
2415 should perform its own validation. */
2416 gimple_ops (gs)[i] = op;
2419 /* Return true if GS is a GIMPLE_ASSIGN. */
2421 static inline bool
2422 is_gimple_assign (const gimple *gs)
2424 return gimple_code (gs) == GIMPLE_ASSIGN;
2427 /* Determine if expression CODE is one of the valid expressions that can
2428 be used on the RHS of GIMPLE assignments. */
2430 static inline enum gimple_rhs_class
2431 get_gimple_rhs_class (enum tree_code code)
2433 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2436 /* Return the LHS of assignment statement GS. */
2438 static inline tree
2439 gimple_assign_lhs (const gassign *gs)
2441 return gs->op[0];
2444 static inline tree
2445 gimple_assign_lhs (const gimple *gs)
2447 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2448 return gimple_assign_lhs (ass);
2452 /* Return a pointer to the LHS of assignment statement GS. */
2454 static inline tree *
2455 gimple_assign_lhs_ptr (gassign *gs)
2457 return &gs->op[0];
2460 static inline tree *
2461 gimple_assign_lhs_ptr (gimple *gs)
2463 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2464 return gimple_assign_lhs_ptr (ass);
2468 /* Set LHS to be the LHS operand of assignment statement GS. */
2470 static inline void
2471 gimple_assign_set_lhs (gassign *gs, tree lhs)
2473 gs->op[0] = lhs;
2475 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2476 SSA_NAME_DEF_STMT (lhs) = gs;
2479 static inline void
2480 gimple_assign_set_lhs (gimple *gs, tree lhs)
2482 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2483 gimple_assign_set_lhs (ass, lhs);
2487 /* Return the first operand on the RHS of assignment statement GS. */
2489 static inline tree
2490 gimple_assign_rhs1 (const gassign *gs)
2492 return gs->op[1];
2495 static inline tree
2496 gimple_assign_rhs1 (const gimple *gs)
2498 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2499 return gimple_assign_rhs1 (ass);
2503 /* Return a pointer to the first operand on the RHS of assignment
2504 statement GS. */
2506 static inline tree *
2507 gimple_assign_rhs1_ptr (gassign *gs)
2509 return &gs->op[1];
2512 static inline tree *
2513 gimple_assign_rhs1_ptr (gimple *gs)
2515 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2516 return gimple_assign_rhs1_ptr (ass);
2519 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2521 static inline void
2522 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2524 gs->op[1] = rhs;
2527 static inline void
2528 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2530 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2531 gimple_assign_set_rhs1 (ass, rhs);
2535 /* Return the second operand on the RHS of assignment statement GS.
2536 If GS does not have two operands, NULL is returned instead. */
2538 static inline tree
2539 gimple_assign_rhs2 (const gassign *gs)
2541 if (gimple_num_ops (gs) >= 3)
2542 return gs->op[2];
2543 else
2544 return NULL_TREE;
2547 static inline tree
2548 gimple_assign_rhs2 (const gimple *gs)
2550 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2551 return gimple_assign_rhs2 (ass);
2555 /* Return a pointer to the second operand on the RHS of assignment
2556 statement GS. */
2558 static inline tree *
2559 gimple_assign_rhs2_ptr (gassign *gs)
2561 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2562 return &gs->op[2];
2565 static inline tree *
2566 gimple_assign_rhs2_ptr (gimple *gs)
2568 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2569 return gimple_assign_rhs2_ptr (ass);
2573 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2575 static inline void
2576 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2578 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2579 gs->op[2] = rhs;
2582 static inline void
2583 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2585 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2586 return gimple_assign_set_rhs2 (ass, rhs);
2589 /* Return the third operand on the RHS of assignment statement GS.
2590 If GS does not have two operands, NULL is returned instead. */
2592 static inline tree
2593 gimple_assign_rhs3 (const gassign *gs)
2595 if (gimple_num_ops (gs) >= 4)
2596 return gs->op[3];
2597 else
2598 return NULL_TREE;
2601 static inline tree
2602 gimple_assign_rhs3 (const gimple *gs)
2604 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2605 return gimple_assign_rhs3 (ass);
2608 /* Return a pointer to the third operand on the RHS of assignment
2609 statement GS. */
2611 static inline tree *
2612 gimple_assign_rhs3_ptr (gimple *gs)
2614 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2615 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2616 return &ass->op[3];
2620 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2622 static inline void
2623 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2625 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2626 gs->op[3] = rhs;
2629 static inline void
2630 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2632 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2633 gimple_assign_set_rhs3 (ass, rhs);
2637 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2638 which expect to see only two operands. */
2640 static inline void
2641 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2642 tree op1, tree op2)
2644 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2647 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2648 which expect to see only one operands. */
2650 static inline void
2651 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2652 tree op1)
2654 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2657 /* Returns true if GS is a nontemporal move. */
2659 static inline bool
2660 gimple_assign_nontemporal_move_p (const gassign *gs)
2662 return gs->nontemporal_move;
2665 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2667 static inline void
2668 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2670 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2671 gs->nontemporal_move = nontemporal;
2675 /* Return the code of the expression computed on the rhs of assignment
2676 statement GS. In case that the RHS is a single object, returns the
2677 tree code of the object. */
2679 static inline enum tree_code
2680 gimple_assign_rhs_code (const gassign *gs)
2682 enum tree_code code = (enum tree_code) gs->subcode;
2683 /* While we initially set subcode to the TREE_CODE of the rhs for
2684 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2685 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2686 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2687 code = TREE_CODE (gs->op[1]);
2689 return code;
2692 static inline enum tree_code
2693 gimple_assign_rhs_code (const gimple *gs)
2695 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2696 return gimple_assign_rhs_code (ass);
2700 /* Set CODE to be the code for the expression computed on the RHS of
2701 assignment S. */
2703 static inline void
2704 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2706 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2707 s->subcode = code;
2711 /* Return the gimple rhs class of the code of the expression computed on
2712 the rhs of assignment statement GS.
2713 This will never return GIMPLE_INVALID_RHS. */
2715 static inline enum gimple_rhs_class
2716 gimple_assign_rhs_class (const gimple *gs)
2718 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2721 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2722 there is no operator associated with the assignment itself.
2723 Unlike gimple_assign_copy_p, this predicate returns true for
2724 any RHS operand, including those that perform an operation
2725 and do not have the semantics of a copy, such as COND_EXPR. */
2727 static inline bool
2728 gimple_assign_single_p (const gimple *gs)
2730 return (is_gimple_assign (gs)
2731 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2734 /* Return true if GS performs a store to its lhs. */
2736 static inline bool
2737 gimple_store_p (const gimple *gs)
2739 tree lhs = gimple_get_lhs (gs);
2740 return lhs && !is_gimple_reg (lhs);
2743 /* Return true if GS is an assignment that loads from its rhs1. */
2745 static inline bool
2746 gimple_assign_load_p (const gimple *gs)
2748 tree rhs;
2749 if (!gimple_assign_single_p (gs))
2750 return false;
2751 rhs = gimple_assign_rhs1 (gs);
2752 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2753 return true;
2754 rhs = get_base_address (rhs);
2755 return (DECL_P (rhs)
2756 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2760 /* Return true if S is a type-cast assignment. */
2762 static inline bool
2763 gimple_assign_cast_p (const gimple *s)
2765 if (is_gimple_assign (s))
2767 enum tree_code sc = gimple_assign_rhs_code (s);
2768 return CONVERT_EXPR_CODE_P (sc)
2769 || sc == VIEW_CONVERT_EXPR
2770 || sc == FIX_TRUNC_EXPR;
2773 return false;
2776 /* Return true if S is a clobber statement. */
2778 static inline bool
2779 gimple_clobber_p (const gimple *s)
2781 return gimple_assign_single_p (s)
2782 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2785 /* Return true if GS is a GIMPLE_CALL. */
2787 static inline bool
2788 is_gimple_call (const gimple *gs)
2790 return gimple_code (gs) == GIMPLE_CALL;
2793 /* Return the LHS of call statement GS. */
2795 static inline tree
2796 gimple_call_lhs (const gcall *gs)
2798 return gs->op[0];
2801 static inline tree
2802 gimple_call_lhs (const gimple *gs)
2804 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2805 return gimple_call_lhs (gc);
2809 /* Return a pointer to the LHS of call statement GS. */
2811 static inline tree *
2812 gimple_call_lhs_ptr (gcall *gs)
2814 return &gs->op[0];
2817 static inline tree *
2818 gimple_call_lhs_ptr (gimple *gs)
2820 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2821 return gimple_call_lhs_ptr (gc);
2825 /* Set LHS to be the LHS operand of call statement GS. */
2827 static inline void
2828 gimple_call_set_lhs (gcall *gs, tree lhs)
2830 gs->op[0] = lhs;
2831 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2832 SSA_NAME_DEF_STMT (lhs) = gs;
2835 static inline void
2836 gimple_call_set_lhs (gimple *gs, tree lhs)
2838 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2839 gimple_call_set_lhs (gc, lhs);
2843 /* Return true if call GS calls an internal-only function, as enumerated
2844 by internal_fn. */
2846 static inline bool
2847 gimple_call_internal_p (const gcall *gs)
2849 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2852 static inline bool
2853 gimple_call_internal_p (const gimple *gs)
2855 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2856 return gimple_call_internal_p (gc);
2860 /* Return true if call GS is marked as instrumented by
2861 Pointer Bounds Checker. */
2863 static inline bool
2864 gimple_call_with_bounds_p (const gcall *gs)
2866 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2869 static inline bool
2870 gimple_call_with_bounds_p (const gimple *gs)
2872 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2873 return gimple_call_with_bounds_p (gc);
2877 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2878 Pointer Bounds Checker. */
2880 static inline void
2881 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2883 if (with_bounds)
2884 gs->subcode |= GF_CALL_WITH_BOUNDS;
2885 else
2886 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2889 static inline void
2890 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2892 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2893 gimple_call_set_with_bounds (gc, with_bounds);
2897 /* Return true if call GS is marked as nocf_check. */
2899 static inline bool
2900 gimple_call_nocf_check_p (const gcall *gs)
2902 return (gs->subcode & GF_CALL_NOCF_CHECK) != 0;
2905 /* Mark statement GS as nocf_check call. */
2907 static inline void
2908 gimple_call_set_nocf_check (gcall *gs, bool nocf_check)
2910 if (nocf_check)
2911 gs->subcode |= GF_CALL_NOCF_CHECK;
2912 else
2913 gs->subcode &= ~GF_CALL_NOCF_CHECK;
2916 /* Return the target of internal call GS. */
2918 static inline enum internal_fn
2919 gimple_call_internal_fn (const gcall *gs)
2921 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2922 return gs->u.internal_fn;
2925 static inline enum internal_fn
2926 gimple_call_internal_fn (const gimple *gs)
2928 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2929 return gimple_call_internal_fn (gc);
2932 /* Return true, if this internal gimple call is unique. */
2934 static inline bool
2935 gimple_call_internal_unique_p (const gcall *gs)
2937 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2940 static inline bool
2941 gimple_call_internal_unique_p (const gimple *gs)
2943 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2944 return gimple_call_internal_unique_p (gc);
2947 /* Return true if GS is an internal function FN. */
2949 static inline bool
2950 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2952 return (is_gimple_call (gs)
2953 && gimple_call_internal_p (gs)
2954 && gimple_call_internal_fn (gs) == fn);
2957 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2958 that could alter control flow. */
2960 static inline void
2961 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2963 if (ctrl_altering_p)
2964 s->subcode |= GF_CALL_CTRL_ALTERING;
2965 else
2966 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2969 static inline void
2970 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2972 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2973 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2976 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2977 flag is set. Such call could not be a stmt in the middle of a bb. */
2979 static inline bool
2980 gimple_call_ctrl_altering_p (const gcall *gs)
2982 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2985 static inline bool
2986 gimple_call_ctrl_altering_p (const gimple *gs)
2988 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2989 return gimple_call_ctrl_altering_p (gc);
2993 /* Return the function type of the function called by GS. */
2995 static inline tree
2996 gimple_call_fntype (const gcall *gs)
2998 if (gimple_call_internal_p (gs))
2999 return NULL_TREE;
3000 return gs->u.fntype;
3003 static inline tree
3004 gimple_call_fntype (const gimple *gs)
3006 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
3007 return gimple_call_fntype (call_stmt);
3010 /* Set the type of the function called by CALL_STMT to FNTYPE. */
3012 static inline void
3013 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
3015 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
3016 call_stmt->u.fntype = fntype;
3020 /* Return the tree node representing the function called by call
3021 statement GS. */
3023 static inline tree
3024 gimple_call_fn (const gcall *gs)
3026 return gs->op[1];
3029 static inline tree
3030 gimple_call_fn (const gimple *gs)
3032 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3033 return gimple_call_fn (gc);
3036 /* Return a pointer to the tree node representing the function called by call
3037 statement GS. */
3039 static inline tree *
3040 gimple_call_fn_ptr (gcall *gs)
3042 return &gs->op[1];
3045 static inline tree *
3046 gimple_call_fn_ptr (gimple *gs)
3048 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3049 return gimple_call_fn_ptr (gc);
3053 /* Set FN to be the function called by call statement GS. */
3055 static inline void
3056 gimple_call_set_fn (gcall *gs, tree fn)
3058 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3059 gs->op[1] = fn;
3063 /* Set FNDECL to be the function called by call statement GS. */
3065 static inline void
3066 gimple_call_set_fndecl (gcall *gs, tree decl)
3068 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3069 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3070 build_pointer_type (TREE_TYPE (decl)), decl);
3073 static inline void
3074 gimple_call_set_fndecl (gimple *gs, tree decl)
3076 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3077 gimple_call_set_fndecl (gc, decl);
3081 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3083 static inline void
3084 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3086 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3087 call_stmt->u.internal_fn = fn;
3091 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3092 Otherwise return NULL. This function is analogous to
3093 get_callee_fndecl in tree land. */
3095 static inline tree
3096 gimple_call_fndecl (const gcall *gs)
3098 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3101 static inline tree
3102 gimple_call_fndecl (const gimple *gs)
3104 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3105 return gimple_call_fndecl (gc);
3109 /* Return the type returned by call statement GS. */
3111 static inline tree
3112 gimple_call_return_type (const gcall *gs)
3114 tree type = gimple_call_fntype (gs);
3116 if (type == NULL_TREE)
3117 return TREE_TYPE (gimple_call_lhs (gs));
3119 /* The type returned by a function is the type of its
3120 function type. */
3121 return TREE_TYPE (type);
3125 /* Return the static chain for call statement GS. */
3127 static inline tree
3128 gimple_call_chain (const gcall *gs)
3130 return gs->op[2];
3133 static inline tree
3134 gimple_call_chain (const gimple *gs)
3136 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3137 return gimple_call_chain (gc);
3141 /* Return a pointer to the static chain for call statement CALL_STMT. */
3143 static inline tree *
3144 gimple_call_chain_ptr (gcall *call_stmt)
3146 return &call_stmt->op[2];
3149 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3151 static inline void
3152 gimple_call_set_chain (gcall *call_stmt, tree chain)
3154 call_stmt->op[2] = chain;
3158 /* Return the number of arguments used by call statement GS. */
3160 static inline unsigned
3161 gimple_call_num_args (const gcall *gs)
3163 return gimple_num_ops (gs) - 3;
3166 static inline unsigned
3167 gimple_call_num_args (const gimple *gs)
3169 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3170 return gimple_call_num_args (gc);
3174 /* Return the argument at position INDEX for call statement GS. */
3176 static inline tree
3177 gimple_call_arg (const gcall *gs, unsigned index)
3179 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3180 return gs->op[index + 3];
3183 static inline tree
3184 gimple_call_arg (const gimple *gs, unsigned index)
3186 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3187 return gimple_call_arg (gc, index);
3191 /* Return a pointer to the argument at position INDEX for call
3192 statement GS. */
3194 static inline tree *
3195 gimple_call_arg_ptr (gcall *gs, unsigned index)
3197 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3198 return &gs->op[index + 3];
3201 static inline tree *
3202 gimple_call_arg_ptr (gimple *gs, unsigned index)
3204 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3205 return gimple_call_arg_ptr (gc, index);
3209 /* Set ARG to be the argument at position INDEX for call statement GS. */
3211 static inline void
3212 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3214 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3215 gs->op[index + 3] = arg;
3218 static inline void
3219 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3221 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3222 gimple_call_set_arg (gc, index, arg);
3226 /* If TAIL_P is true, mark call statement S as being a tail call
3227 (i.e., a call just before the exit of a function). These calls are
3228 candidate for tail call optimization. */
3230 static inline void
3231 gimple_call_set_tail (gcall *s, bool tail_p)
3233 if (tail_p)
3234 s->subcode |= GF_CALL_TAILCALL;
3235 else
3236 s->subcode &= ~GF_CALL_TAILCALL;
3240 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3242 static inline bool
3243 gimple_call_tail_p (gcall *s)
3245 return (s->subcode & GF_CALL_TAILCALL) != 0;
3248 /* Mark (or clear) call statement S as requiring tail call optimization. */
3250 static inline void
3251 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3253 if (must_tail_p)
3254 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3255 else
3256 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3259 /* Return true if call statement has been marked as requiring
3260 tail call optimization. */
3262 static inline bool
3263 gimple_call_must_tail_p (const gcall *s)
3265 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3268 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3269 slot optimization. This transformation uses the target of the call
3270 expansion as the return slot for calls that return in memory. */
3272 static inline void
3273 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3275 if (return_slot_opt_p)
3276 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3277 else
3278 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3282 /* Return true if S is marked for return slot optimization. */
3284 static inline bool
3285 gimple_call_return_slot_opt_p (gcall *s)
3287 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3291 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3292 thunk to the thunked-to function. */
3294 static inline void
3295 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3297 if (from_thunk_p)
3298 s->subcode |= GF_CALL_FROM_THUNK;
3299 else
3300 s->subcode &= ~GF_CALL_FROM_THUNK;
3304 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3306 static inline bool
3307 gimple_call_from_thunk_p (gcall *s)
3309 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3313 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3314 argument pack in its argument list. */
3316 static inline void
3317 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3319 if (pass_arg_pack_p)
3320 s->subcode |= GF_CALL_VA_ARG_PACK;
3321 else
3322 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3326 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3327 argument pack in its argument list. */
3329 static inline bool
3330 gimple_call_va_arg_pack_p (gcall *s)
3332 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3336 /* Return true if S is a noreturn call. */
3338 static inline bool
3339 gimple_call_noreturn_p (const gcall *s)
3341 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3344 static inline bool
3345 gimple_call_noreturn_p (const gimple *s)
3347 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3348 return gimple_call_noreturn_p (gc);
3352 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3353 even if the called function can throw in other cases. */
3355 static inline void
3356 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3358 if (nothrow_p)
3359 s->subcode |= GF_CALL_NOTHROW;
3360 else
3361 s->subcode &= ~GF_CALL_NOTHROW;
3364 /* Return true if S is a nothrow call. */
3366 static inline bool
3367 gimple_call_nothrow_p (gcall *s)
3369 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3372 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3373 is known to be emitted for VLA objects. Those are wrapped by
3374 stack_save/stack_restore calls and hence can't lead to unbounded
3375 stack growth even when they occur in loops. */
3377 static inline void
3378 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3380 if (for_var)
3381 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3382 else
3383 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3386 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3388 static inline bool
3389 gimple_call_alloca_for_var_p (gcall *s)
3391 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3394 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3395 pointers to nested function are descriptors instead of trampolines. */
3397 static inline void
3398 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3400 if (by_descriptor_p)
3401 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3402 else
3403 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3406 /* Return true if S is a by-descriptor call. */
3408 static inline bool
3409 gimple_call_by_descriptor_p (gcall *s)
3411 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3414 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3416 static inline void
3417 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3419 dest_call->subcode = orig_call->subcode;
3423 /* Return a pointer to the points-to solution for the set of call-used
3424 variables of the call CALL_STMT. */
3426 static inline struct pt_solution *
3427 gimple_call_use_set (gcall *call_stmt)
3429 return &call_stmt->call_used;
3433 /* Return a pointer to the points-to solution for the set of call-used
3434 variables of the call CALL_STMT. */
3436 static inline struct pt_solution *
3437 gimple_call_clobber_set (gcall *call_stmt)
3439 return &call_stmt->call_clobbered;
3443 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3444 non-NULL lhs. */
3446 static inline bool
3447 gimple_has_lhs (gimple *stmt)
3449 if (is_gimple_assign (stmt))
3450 return true;
3451 if (gcall *call = dyn_cast <gcall *> (stmt))
3452 return gimple_call_lhs (call) != NULL_TREE;
3453 return false;
3457 /* Return the code of the predicate computed by conditional statement GS. */
3459 static inline enum tree_code
3460 gimple_cond_code (const gcond *gs)
3462 return (enum tree_code) gs->subcode;
3465 static inline enum tree_code
3466 gimple_cond_code (const gimple *gs)
3468 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3469 return gimple_cond_code (gc);
3473 /* Set CODE to be the predicate code for the conditional statement GS. */
3475 static inline void
3476 gimple_cond_set_code (gcond *gs, enum tree_code code)
3478 gs->subcode = code;
3482 /* Return the LHS of the predicate computed by conditional statement GS. */
3484 static inline tree
3485 gimple_cond_lhs (const gcond *gs)
3487 return gs->op[0];
3490 static inline tree
3491 gimple_cond_lhs (const gimple *gs)
3493 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3494 return gimple_cond_lhs (gc);
3497 /* Return the pointer to the LHS of the predicate computed by conditional
3498 statement GS. */
3500 static inline tree *
3501 gimple_cond_lhs_ptr (gcond *gs)
3503 return &gs->op[0];
3506 /* Set LHS to be the LHS operand of the predicate computed by
3507 conditional statement GS. */
3509 static inline void
3510 gimple_cond_set_lhs (gcond *gs, tree lhs)
3512 gs->op[0] = lhs;
3516 /* Return the RHS operand of the predicate computed by conditional GS. */
3518 static inline tree
3519 gimple_cond_rhs (const gcond *gs)
3521 return gs->op[1];
3524 static inline tree
3525 gimple_cond_rhs (const gimple *gs)
3527 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3528 return gimple_cond_rhs (gc);
3531 /* Return the pointer to the RHS operand of the predicate computed by
3532 conditional GS. */
3534 static inline tree *
3535 gimple_cond_rhs_ptr (gcond *gs)
3537 return &gs->op[1];
3541 /* Set RHS to be the RHS operand of the predicate computed by
3542 conditional statement GS. */
3544 static inline void
3545 gimple_cond_set_rhs (gcond *gs, tree rhs)
3547 gs->op[1] = rhs;
3551 /* Return the label used by conditional statement GS when its
3552 predicate evaluates to true. */
3554 static inline tree
3555 gimple_cond_true_label (const gcond *gs)
3557 return gs->op[2];
3561 /* Set LABEL to be the label used by conditional statement GS when its
3562 predicate evaluates to true. */
3564 static inline void
3565 gimple_cond_set_true_label (gcond *gs, tree label)
3567 gs->op[2] = label;
3571 /* Set LABEL to be the label used by conditional statement GS when its
3572 predicate evaluates to false. */
3574 static inline void
3575 gimple_cond_set_false_label (gcond *gs, tree label)
3577 gs->op[3] = label;
3581 /* Return the label used by conditional statement GS when its
3582 predicate evaluates to false. */
3584 static inline tree
3585 gimple_cond_false_label (const gcond *gs)
3587 return gs->op[3];
3591 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3593 static inline void
3594 gimple_cond_make_false (gcond *gs)
3596 gimple_cond_set_lhs (gs, boolean_false_node);
3597 gimple_cond_set_rhs (gs, boolean_false_node);
3598 gs->subcode = NE_EXPR;
3602 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3604 static inline void
3605 gimple_cond_make_true (gcond *gs)
3607 gimple_cond_set_lhs (gs, boolean_true_node);
3608 gimple_cond_set_rhs (gs, boolean_false_node);
3609 gs->subcode = NE_EXPR;
3612 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3613 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3615 static inline bool
3616 gimple_cond_true_p (const gcond *gs)
3618 tree lhs = gimple_cond_lhs (gs);
3619 tree rhs = gimple_cond_rhs (gs);
3620 enum tree_code code = gimple_cond_code (gs);
3622 if (lhs != boolean_true_node && lhs != boolean_false_node)
3623 return false;
3625 if (rhs != boolean_true_node && rhs != boolean_false_node)
3626 return false;
3628 if (code == NE_EXPR && lhs != rhs)
3629 return true;
3631 if (code == EQ_EXPR && lhs == rhs)
3632 return true;
3634 return false;
3637 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3638 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3640 static inline bool
3641 gimple_cond_false_p (const gcond *gs)
3643 tree lhs = gimple_cond_lhs (gs);
3644 tree rhs = gimple_cond_rhs (gs);
3645 enum tree_code code = gimple_cond_code (gs);
3647 if (lhs != boolean_true_node && lhs != boolean_false_node)
3648 return false;
3650 if (rhs != boolean_true_node && rhs != boolean_false_node)
3651 return false;
3653 if (code == NE_EXPR && lhs == rhs)
3654 return true;
3656 if (code == EQ_EXPR && lhs != rhs)
3657 return true;
3659 return false;
3662 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3664 static inline void
3665 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3666 tree rhs)
3668 gimple_cond_set_code (stmt, code);
3669 gimple_cond_set_lhs (stmt, lhs);
3670 gimple_cond_set_rhs (stmt, rhs);
3673 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3675 static inline tree
3676 gimple_label_label (const glabel *gs)
3678 return gs->op[0];
3682 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3683 GS. */
3685 static inline void
3686 gimple_label_set_label (glabel *gs, tree label)
3688 gs->op[0] = label;
3692 /* Return the destination of the unconditional jump GS. */
3694 static inline tree
3695 gimple_goto_dest (const gimple *gs)
3697 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3698 return gimple_op (gs, 0);
3702 /* Set DEST to be the destination of the unconditonal jump GS. */
3704 static inline void
3705 gimple_goto_set_dest (ggoto *gs, tree dest)
3707 gs->op[0] = dest;
3711 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3713 static inline tree
3714 gimple_bind_vars (const gbind *bind_stmt)
3716 return bind_stmt->vars;
3720 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3721 statement GS. */
3723 static inline void
3724 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3726 bind_stmt->vars = vars;
3730 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3731 statement GS. */
3733 static inline void
3734 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3736 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3740 static inline gimple_seq *
3741 gimple_bind_body_ptr (gbind *bind_stmt)
3743 return &bind_stmt->body;
3746 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3748 static inline gimple_seq
3749 gimple_bind_body (gbind *gs)
3751 return *gimple_bind_body_ptr (gs);
3755 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3756 statement GS. */
3758 static inline void
3759 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3761 bind_stmt->body = seq;
3765 /* Append a statement to the end of a GIMPLE_BIND's body. */
3767 static inline void
3768 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3770 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3774 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3776 static inline void
3777 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3779 gimple_seq_add_seq (&bind_stmt->body, seq);
3783 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3784 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3786 static inline tree
3787 gimple_bind_block (const gbind *bind_stmt)
3789 return bind_stmt->block;
3793 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3794 statement GS. */
3796 static inline void
3797 gimple_bind_set_block (gbind *bind_stmt, tree block)
3799 gcc_gimple_checking_assert (block == NULL_TREE
3800 || TREE_CODE (block) == BLOCK);
3801 bind_stmt->block = block;
3805 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3807 static inline unsigned
3808 gimple_asm_ninputs (const gasm *asm_stmt)
3810 return asm_stmt->ni;
3814 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3816 static inline unsigned
3817 gimple_asm_noutputs (const gasm *asm_stmt)
3819 return asm_stmt->no;
3823 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3825 static inline unsigned
3826 gimple_asm_nclobbers (const gasm *asm_stmt)
3828 return asm_stmt->nc;
3831 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3833 static inline unsigned
3834 gimple_asm_nlabels (const gasm *asm_stmt)
3836 return asm_stmt->nl;
3839 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3841 static inline tree
3842 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3844 gcc_gimple_checking_assert (index < asm_stmt->ni);
3845 return asm_stmt->op[index + asm_stmt->no];
3848 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3850 static inline void
3851 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3853 gcc_gimple_checking_assert (index < asm_stmt->ni
3854 && TREE_CODE (in_op) == TREE_LIST);
3855 asm_stmt->op[index + asm_stmt->no] = in_op;
3859 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3861 static inline tree
3862 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3864 gcc_gimple_checking_assert (index < asm_stmt->no);
3865 return asm_stmt->op[index];
3868 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3870 static inline void
3871 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3873 gcc_gimple_checking_assert (index < asm_stmt->no
3874 && TREE_CODE (out_op) == TREE_LIST);
3875 asm_stmt->op[index] = out_op;
3879 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3881 static inline tree
3882 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3884 gcc_gimple_checking_assert (index < asm_stmt->nc);
3885 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3889 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3891 static inline void
3892 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3894 gcc_gimple_checking_assert (index < asm_stmt->nc
3895 && TREE_CODE (clobber_op) == TREE_LIST);
3896 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3899 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3901 static inline tree
3902 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3904 gcc_gimple_checking_assert (index < asm_stmt->nl);
3905 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3908 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3910 static inline void
3911 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3913 gcc_gimple_checking_assert (index < asm_stmt->nl
3914 && TREE_CODE (label_op) == TREE_LIST);
3915 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3918 /* Return the string representing the assembly instruction in
3919 GIMPLE_ASM ASM_STMT. */
3921 static inline const char *
3922 gimple_asm_string (const gasm *asm_stmt)
3924 return asm_stmt->string;
3928 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3930 static inline bool
3931 gimple_asm_volatile_p (const gasm *asm_stmt)
3933 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3937 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3939 static inline void
3940 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3942 if (volatile_p)
3943 asm_stmt->subcode |= GF_ASM_VOLATILE;
3944 else
3945 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3949 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3951 static inline void
3952 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3954 if (input_p)
3955 asm_stmt->subcode |= GF_ASM_INPUT;
3956 else
3957 asm_stmt->subcode &= ~GF_ASM_INPUT;
3961 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3963 static inline bool
3964 gimple_asm_input_p (const gasm *asm_stmt)
3966 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3970 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3972 static inline tree
3973 gimple_catch_types (const gcatch *catch_stmt)
3975 return catch_stmt->types;
3979 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3981 static inline tree *
3982 gimple_catch_types_ptr (gcatch *catch_stmt)
3984 return &catch_stmt->types;
3988 /* Return a pointer to the GIMPLE sequence representing the body of
3989 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3991 static inline gimple_seq *
3992 gimple_catch_handler_ptr (gcatch *catch_stmt)
3994 return &catch_stmt->handler;
3998 /* Return the GIMPLE sequence representing the body of the handler of
3999 GIMPLE_CATCH statement CATCH_STMT. */
4001 static inline gimple_seq
4002 gimple_catch_handler (gcatch *catch_stmt)
4004 return *gimple_catch_handler_ptr (catch_stmt);
4008 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
4010 static inline void
4011 gimple_catch_set_types (gcatch *catch_stmt, tree t)
4013 catch_stmt->types = t;
4017 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
4019 static inline void
4020 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4022 catch_stmt->handler = handler;
4026 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4028 static inline tree
4029 gimple_eh_filter_types (const gimple *gs)
4031 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4032 return eh_filter_stmt->types;
4036 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4037 GS. */
4039 static inline tree *
4040 gimple_eh_filter_types_ptr (gimple *gs)
4042 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4043 return &eh_filter_stmt->types;
4047 /* Return a pointer to the sequence of statement to execute when
4048 GIMPLE_EH_FILTER statement fails. */
4050 static inline gimple_seq *
4051 gimple_eh_filter_failure_ptr (gimple *gs)
4053 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4054 return &eh_filter_stmt->failure;
4058 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4059 statement fails. */
4061 static inline gimple_seq
4062 gimple_eh_filter_failure (gimple *gs)
4064 return *gimple_eh_filter_failure_ptr (gs);
4068 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4069 EH_FILTER_STMT. */
4071 static inline void
4072 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4074 eh_filter_stmt->types = types;
4078 /* Set FAILURE to be the sequence of statements to execute on failure
4079 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4081 static inline void
4082 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4083 gimple_seq failure)
4085 eh_filter_stmt->failure = failure;
4088 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4090 static inline tree
4091 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4093 return eh_mnt_stmt->fndecl;
4096 /* Set the function decl to be called by GS to DECL. */
4098 static inline void
4099 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4100 tree decl)
4102 eh_mnt_stmt->fndecl = decl;
4105 /* GIMPLE_EH_ELSE accessors. */
4107 static inline gimple_seq *
4108 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4110 return &eh_else_stmt->n_body;
4113 static inline gimple_seq
4114 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4116 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4119 static inline gimple_seq *
4120 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4122 return &eh_else_stmt->e_body;
4125 static inline gimple_seq
4126 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4128 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4131 static inline void
4132 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4134 eh_else_stmt->n_body = seq;
4137 static inline void
4138 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4140 eh_else_stmt->e_body = seq;
4143 /* GIMPLE_TRY accessors. */
4145 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4146 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4148 static inline enum gimple_try_flags
4149 gimple_try_kind (const gimple *gs)
4151 GIMPLE_CHECK (gs, GIMPLE_TRY);
4152 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4156 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4158 static inline void
4159 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4161 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4162 || kind == GIMPLE_TRY_FINALLY);
4163 if (gimple_try_kind (gs) != kind)
4164 gs->subcode = (unsigned int) kind;
4168 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4170 static inline bool
4171 gimple_try_catch_is_cleanup (const gimple *gs)
4173 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4174 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4178 /* Return a pointer to the sequence of statements used as the
4179 body for GIMPLE_TRY GS. */
4181 static inline gimple_seq *
4182 gimple_try_eval_ptr (gimple *gs)
4184 gtry *try_stmt = as_a <gtry *> (gs);
4185 return &try_stmt->eval;
4189 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4191 static inline gimple_seq
4192 gimple_try_eval (gimple *gs)
4194 return *gimple_try_eval_ptr (gs);
4198 /* Return a pointer to the sequence of statements used as the cleanup body for
4199 GIMPLE_TRY GS. */
4201 static inline gimple_seq *
4202 gimple_try_cleanup_ptr (gimple *gs)
4204 gtry *try_stmt = as_a <gtry *> (gs);
4205 return &try_stmt->cleanup;
4209 /* Return the sequence of statements used as the cleanup body for
4210 GIMPLE_TRY GS. */
4212 static inline gimple_seq
4213 gimple_try_cleanup (gimple *gs)
4215 return *gimple_try_cleanup_ptr (gs);
4219 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4221 static inline void
4222 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4224 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4225 if (catch_is_cleanup)
4226 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4227 else
4228 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4232 /* Set EVAL to be the sequence of statements to use as the body for
4233 GIMPLE_TRY TRY_STMT. */
4235 static inline void
4236 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4238 try_stmt->eval = eval;
4242 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4243 body for GIMPLE_TRY TRY_STMT. */
4245 static inline void
4246 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4248 try_stmt->cleanup = cleanup;
4252 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4254 static inline gimple_seq *
4255 gimple_wce_cleanup_ptr (gimple *gs)
4257 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4258 return &wce_stmt->cleanup;
4262 /* Return the cleanup sequence for cleanup statement GS. */
4264 static inline gimple_seq
4265 gimple_wce_cleanup (gimple *gs)
4267 return *gimple_wce_cleanup_ptr (gs);
4271 /* Set CLEANUP to be the cleanup sequence for GS. */
4273 static inline void
4274 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4276 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4277 wce_stmt->cleanup = cleanup;
4281 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4283 static inline bool
4284 gimple_wce_cleanup_eh_only (const gimple *gs)
4286 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4287 return gs->subcode != 0;
4291 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4293 static inline void
4294 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4296 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4297 gs->subcode = (unsigned int) eh_only_p;
4301 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4303 static inline unsigned
4304 gimple_phi_capacity (const gimple *gs)
4306 const gphi *phi_stmt = as_a <const gphi *> (gs);
4307 return phi_stmt->capacity;
4311 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4312 be exactly the number of incoming edges for the basic block holding
4313 GS. */
4315 static inline unsigned
4316 gimple_phi_num_args (const gimple *gs)
4318 const gphi *phi_stmt = as_a <const gphi *> (gs);
4319 return phi_stmt->nargs;
4323 /* Return the SSA name created by GIMPLE_PHI GS. */
4325 static inline tree
4326 gimple_phi_result (const gphi *gs)
4328 return gs->result;
4331 static inline tree
4332 gimple_phi_result (const gimple *gs)
4334 const gphi *phi_stmt = as_a <const gphi *> (gs);
4335 return gimple_phi_result (phi_stmt);
4338 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4340 static inline tree *
4341 gimple_phi_result_ptr (gphi *gs)
4343 return &gs->result;
4346 static inline tree *
4347 gimple_phi_result_ptr (gimple *gs)
4349 gphi *phi_stmt = as_a <gphi *> (gs);
4350 return gimple_phi_result_ptr (phi_stmt);
4353 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4355 static inline void
4356 gimple_phi_set_result (gphi *phi, tree result)
4358 phi->result = result;
4359 if (result && TREE_CODE (result) == SSA_NAME)
4360 SSA_NAME_DEF_STMT (result) = phi;
4364 /* Return the PHI argument corresponding to incoming edge INDEX for
4365 GIMPLE_PHI GS. */
4367 static inline struct phi_arg_d *
4368 gimple_phi_arg (gphi *gs, unsigned index)
4370 gcc_gimple_checking_assert (index < gs->nargs);
4371 return &(gs->args[index]);
4374 static inline struct phi_arg_d *
4375 gimple_phi_arg (gimple *gs, unsigned index)
4377 gphi *phi_stmt = as_a <gphi *> (gs);
4378 return gimple_phi_arg (phi_stmt, index);
4381 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4382 for GIMPLE_PHI PHI. */
4384 static inline void
4385 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4387 gcc_gimple_checking_assert (index < phi->nargs);
4388 phi->args[index] = *phiarg;
4391 /* Return the PHI nodes for basic block BB, or NULL if there are no
4392 PHI nodes. */
4394 static inline gimple_seq
4395 phi_nodes (const_basic_block bb)
4397 gcc_checking_assert (!(bb->flags & BB_RTL));
4398 return bb->il.gimple.phi_nodes;
4401 /* Return a pointer to the PHI nodes for basic block BB. */
4403 static inline gimple_seq *
4404 phi_nodes_ptr (basic_block bb)
4406 gcc_checking_assert (!(bb->flags & BB_RTL));
4407 return &bb->il.gimple.phi_nodes;
4410 /* Return the tree operand for argument I of PHI node GS. */
4412 static inline tree
4413 gimple_phi_arg_def (gphi *gs, size_t index)
4415 return gimple_phi_arg (gs, index)->def;
4418 static inline tree
4419 gimple_phi_arg_def (gimple *gs, size_t index)
4421 return gimple_phi_arg (gs, index)->def;
4425 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4427 static inline tree *
4428 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4430 return &gimple_phi_arg (phi, index)->def;
4433 /* Return the edge associated with argument I of phi node PHI. */
4435 static inline edge
4436 gimple_phi_arg_edge (gphi *phi, size_t i)
4438 return EDGE_PRED (gimple_bb (phi), i);
4441 /* Return the source location of gimple argument I of phi node PHI. */
4443 static inline source_location
4444 gimple_phi_arg_location (gphi *phi, size_t i)
4446 return gimple_phi_arg (phi, i)->locus;
4449 /* Return the source location of the argument on edge E of phi node PHI. */
4451 static inline source_location
4452 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4454 return gimple_phi_arg (phi, e->dest_idx)->locus;
4457 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4459 static inline void
4460 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4462 gimple_phi_arg (phi, i)->locus = loc;
4465 /* Return TRUE if argument I of phi node PHI has a location record. */
4467 static inline bool
4468 gimple_phi_arg_has_location (gphi *phi, size_t i)
4470 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4474 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4476 static inline int
4477 gimple_resx_region (const gresx *resx_stmt)
4479 return resx_stmt->region;
4482 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4484 static inline void
4485 gimple_resx_set_region (gresx *resx_stmt, int region)
4487 resx_stmt->region = region;
4490 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4492 static inline int
4493 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4495 return eh_dispatch_stmt->region;
4498 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4499 EH_DISPATCH_STMT. */
4501 static inline void
4502 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4504 eh_dispatch_stmt->region = region;
4507 /* Return the number of labels associated with the switch statement GS. */
4509 static inline unsigned
4510 gimple_switch_num_labels (const gswitch *gs)
4512 unsigned num_ops;
4513 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4514 num_ops = gimple_num_ops (gs);
4515 gcc_gimple_checking_assert (num_ops > 1);
4516 return num_ops - 1;
4520 /* Set NLABELS to be the number of labels for the switch statement GS. */
4522 static inline void
4523 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4525 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4526 gimple_set_num_ops (g, nlabels + 1);
4530 /* Return the index variable used by the switch statement GS. */
4532 static inline tree
4533 gimple_switch_index (const gswitch *gs)
4535 return gs->op[0];
4539 /* Return a pointer to the index variable for the switch statement GS. */
4541 static inline tree *
4542 gimple_switch_index_ptr (gswitch *gs)
4544 return &gs->op[0];
4548 /* Set INDEX to be the index variable for switch statement GS. */
4550 static inline void
4551 gimple_switch_set_index (gswitch *gs, tree index)
4553 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4554 gs->op[0] = index;
4558 /* Return the label numbered INDEX. The default label is 0, followed by any
4559 labels in a switch statement. */
4561 static inline tree
4562 gimple_switch_label (const gswitch *gs, unsigned index)
4564 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4565 return gs->op[index + 1];
4568 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4570 static inline void
4571 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4573 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4574 && (label == NULL_TREE
4575 || TREE_CODE (label) == CASE_LABEL_EXPR));
4576 gs->op[index + 1] = label;
4579 /* Return the default label for a switch statement. */
4581 static inline tree
4582 gimple_switch_default_label (const gswitch *gs)
4584 tree label = gimple_switch_label (gs, 0);
4585 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4586 return label;
4589 /* Set the default label for a switch statement. */
4591 static inline void
4592 gimple_switch_set_default_label (gswitch *gs, tree label)
4594 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4595 gimple_switch_set_label (gs, 0, label);
4598 /* Return true if GS is a GIMPLE_DEBUG statement. */
4600 static inline bool
4601 is_gimple_debug (const gimple *gs)
4603 return gimple_code (gs) == GIMPLE_DEBUG;
4606 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4608 static inline bool
4609 gimple_debug_bind_p (const gimple *s)
4611 if (is_gimple_debug (s))
4612 return s->subcode == GIMPLE_DEBUG_BIND;
4614 return false;
4617 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4619 static inline tree
4620 gimple_debug_bind_get_var (gimple *dbg)
4622 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4623 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4624 return gimple_op (dbg, 0);
4627 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4628 statement. */
4630 static inline tree
4631 gimple_debug_bind_get_value (gimple *dbg)
4633 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4634 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4635 return gimple_op (dbg, 1);
4638 /* Return a pointer to the value bound to the variable in a
4639 GIMPLE_DEBUG bind statement. */
4641 static inline tree *
4642 gimple_debug_bind_get_value_ptr (gimple *dbg)
4644 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4645 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4646 return gimple_op_ptr (dbg, 1);
4649 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4651 static inline void
4652 gimple_debug_bind_set_var (gimple *dbg, tree var)
4654 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4655 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4656 gimple_set_op (dbg, 0, var);
4659 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4660 statement. */
4662 static inline void
4663 gimple_debug_bind_set_value (gimple *dbg, tree value)
4665 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4666 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4667 gimple_set_op (dbg, 1, value);
4670 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4671 optimized away. */
4672 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4674 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4675 statement. */
4677 static inline void
4678 gimple_debug_bind_reset_value (gimple *dbg)
4680 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4681 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4682 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4685 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4686 value. */
4688 static inline bool
4689 gimple_debug_bind_has_value_p (gimple *dbg)
4691 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4692 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4693 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4696 #undef GIMPLE_DEBUG_BIND_NOVALUE
4698 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4700 static inline bool
4701 gimple_debug_source_bind_p (const gimple *s)
4703 if (is_gimple_debug (s))
4704 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4706 return false;
4709 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4711 static inline tree
4712 gimple_debug_source_bind_get_var (gimple *dbg)
4714 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4715 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4716 return gimple_op (dbg, 0);
4719 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4720 statement. */
4722 static inline tree
4723 gimple_debug_source_bind_get_value (gimple *dbg)
4725 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4726 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4727 return gimple_op (dbg, 1);
4730 /* Return a pointer to the value bound to the variable in a
4731 GIMPLE_DEBUG source bind statement. */
4733 static inline tree *
4734 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4736 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4737 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4738 return gimple_op_ptr (dbg, 1);
4741 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4743 static inline void
4744 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4746 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4747 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4748 gimple_set_op (dbg, 0, var);
4751 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4752 statement. */
4754 static inline void
4755 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4757 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4758 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4759 gimple_set_op (dbg, 1, value);
4762 /* Return the line number for EXPR, or return -1 if we have no line
4763 number information for it. */
4764 static inline int
4765 get_lineno (const gimple *stmt)
4767 location_t loc;
4769 if (!stmt)
4770 return -1;
4772 loc = gimple_location (stmt);
4773 if (loc == UNKNOWN_LOCATION)
4774 return -1;
4776 return LOCATION_LINE (loc);
4779 /* Return a pointer to the body for the OMP statement GS. */
4781 static inline gimple_seq *
4782 gimple_omp_body_ptr (gimple *gs)
4784 return &static_cast <gimple_statement_omp *> (gs)->body;
4787 /* Return the body for the OMP statement GS. */
4789 static inline gimple_seq
4790 gimple_omp_body (gimple *gs)
4792 return *gimple_omp_body_ptr (gs);
4795 /* Set BODY to be the body for the OMP statement GS. */
4797 static inline void
4798 gimple_omp_set_body (gimple *gs, gimple_seq body)
4800 static_cast <gimple_statement_omp *> (gs)->body = body;
4804 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4806 static inline tree
4807 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4809 return crit_stmt->name;
4813 /* Return a pointer to the name associated with OMP critical statement
4814 CRIT_STMT. */
4816 static inline tree *
4817 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4819 return &crit_stmt->name;
4823 /* Set NAME to be the name associated with OMP critical statement
4824 CRIT_STMT. */
4826 static inline void
4827 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4829 crit_stmt->name = name;
4833 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4835 static inline tree
4836 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4838 return crit_stmt->clauses;
4842 /* Return a pointer to the clauses associated with OMP critical statement
4843 CRIT_STMT. */
4845 static inline tree *
4846 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4848 return &crit_stmt->clauses;
4852 /* Set CLAUSES to be the clauses associated with OMP critical statement
4853 CRIT_STMT. */
4855 static inline void
4856 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4858 crit_stmt->clauses = clauses;
4862 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4864 static inline tree
4865 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4867 return ord_stmt->clauses;
4871 /* Return a pointer to the clauses associated with OMP ordered statement
4872 ORD_STMT. */
4874 static inline tree *
4875 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4877 return &ord_stmt->clauses;
4881 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4882 ORD_STMT. */
4884 static inline void
4885 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4887 ord_stmt->clauses = clauses;
4891 /* Return the kind of the OMP_FOR statemement G. */
4893 static inline int
4894 gimple_omp_for_kind (const gimple *g)
4896 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4897 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4901 /* Set the kind of the OMP_FOR statement G. */
4903 static inline void
4904 gimple_omp_for_set_kind (gomp_for *g, int kind)
4906 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4907 | (kind & GF_OMP_FOR_KIND_MASK);
4911 /* Return true if OMP_FOR statement G has the
4912 GF_OMP_FOR_COMBINED flag set. */
4914 static inline bool
4915 gimple_omp_for_combined_p (const gimple *g)
4917 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4918 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4922 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4923 the boolean value of COMBINED_P. */
4925 static inline void
4926 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4928 if (combined_p)
4929 g->subcode |= GF_OMP_FOR_COMBINED;
4930 else
4931 g->subcode &= ~GF_OMP_FOR_COMBINED;
4935 /* Return true if the OMP_FOR statement G has the
4936 GF_OMP_FOR_COMBINED_INTO flag set. */
4938 static inline bool
4939 gimple_omp_for_combined_into_p (const gimple *g)
4941 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4942 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4946 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4947 on the boolean value of COMBINED_P. */
4949 static inline void
4950 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4952 if (combined_p)
4953 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4954 else
4955 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4959 /* Return the clauses associated with the OMP_FOR statement GS. */
4961 static inline tree
4962 gimple_omp_for_clauses (const gimple *gs)
4964 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4965 return omp_for_stmt->clauses;
4969 /* Return a pointer to the clauses associated with the OMP_FOR statement
4970 GS. */
4972 static inline tree *
4973 gimple_omp_for_clauses_ptr (gimple *gs)
4975 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4976 return &omp_for_stmt->clauses;
4980 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4981 GS. */
4983 static inline void
4984 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4986 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4987 omp_for_stmt->clauses = clauses;
4991 /* Get the collapse count of the OMP_FOR statement GS. */
4993 static inline size_t
4994 gimple_omp_for_collapse (gimple *gs)
4996 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4997 return omp_for_stmt->collapse;
5001 /* Return the condition code associated with the OMP_FOR statement GS. */
5003 static inline enum tree_code
5004 gimple_omp_for_cond (const gimple *gs, size_t i)
5006 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5007 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5008 return omp_for_stmt->iter[i].cond;
5012 /* Set COND to be the condition code for the OMP_FOR statement GS. */
5014 static inline void
5015 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
5017 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5018 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
5019 && i < omp_for_stmt->collapse);
5020 omp_for_stmt->iter[i].cond = cond;
5024 /* Return the index variable for the OMP_FOR statement GS. */
5026 static inline tree
5027 gimple_omp_for_index (const gimple *gs, size_t i)
5029 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5030 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5031 return omp_for_stmt->iter[i].index;
5035 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5037 static inline tree *
5038 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5040 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5041 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5042 return &omp_for_stmt->iter[i].index;
5046 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5048 static inline void
5049 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5051 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5052 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5053 omp_for_stmt->iter[i].index = index;
5057 /* Return the initial value for the OMP_FOR statement GS. */
5059 static inline tree
5060 gimple_omp_for_initial (const gimple *gs, size_t i)
5062 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5063 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5064 return omp_for_stmt->iter[i].initial;
5068 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5070 static inline tree *
5071 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5073 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5074 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5075 return &omp_for_stmt->iter[i].initial;
5079 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5081 static inline void
5082 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5084 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5085 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5086 omp_for_stmt->iter[i].initial = initial;
5090 /* Return the final value for the OMP_FOR statement GS. */
5092 static inline tree
5093 gimple_omp_for_final (const gimple *gs, size_t i)
5095 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5096 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5097 return omp_for_stmt->iter[i].final;
5101 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5103 static inline tree *
5104 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5106 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5107 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5108 return &omp_for_stmt->iter[i].final;
5112 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5114 static inline void
5115 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5117 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5118 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5119 omp_for_stmt->iter[i].final = final;
5123 /* Return the increment value for the OMP_FOR statement GS. */
5125 static inline tree
5126 gimple_omp_for_incr (const gimple *gs, size_t i)
5128 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5129 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5130 return omp_for_stmt->iter[i].incr;
5134 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5136 static inline tree *
5137 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5139 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5140 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5141 return &omp_for_stmt->iter[i].incr;
5145 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5147 static inline void
5148 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5150 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5151 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5152 omp_for_stmt->iter[i].incr = incr;
5156 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5157 statement GS starts. */
5159 static inline gimple_seq *
5160 gimple_omp_for_pre_body_ptr (gimple *gs)
5162 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5163 return &omp_for_stmt->pre_body;
5167 /* Return the sequence of statements to execute before the OMP_FOR
5168 statement GS starts. */
5170 static inline gimple_seq
5171 gimple_omp_for_pre_body (gimple *gs)
5173 return *gimple_omp_for_pre_body_ptr (gs);
5177 /* Set PRE_BODY to be the sequence of statements to execute before the
5178 OMP_FOR statement GS starts. */
5180 static inline void
5181 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5183 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5184 omp_for_stmt->pre_body = pre_body;
5187 /* Return the kernel_phony of OMP_FOR statement. */
5189 static inline bool
5190 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5192 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5193 != GF_OMP_FOR_KIND_GRID_LOOP);
5194 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5197 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5199 static inline void
5200 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5202 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5203 != GF_OMP_FOR_KIND_GRID_LOOP);
5204 if (value)
5205 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5206 else
5207 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5210 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5212 static inline bool
5213 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5215 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5216 == GF_OMP_FOR_KIND_GRID_LOOP);
5217 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5220 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5222 static inline void
5223 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5225 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5226 == GF_OMP_FOR_KIND_GRID_LOOP);
5227 if (value)
5228 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5229 else
5230 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5233 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5234 groups. */
5236 static inline bool
5237 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5239 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5240 == GF_OMP_FOR_KIND_GRID_LOOP);
5241 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5244 /* Set group_iter flag of OMP_FOR to VALUE. */
5246 static inline void
5247 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5249 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5250 == GF_OMP_FOR_KIND_GRID_LOOP);
5251 if (value)
5252 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5253 else
5254 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5257 /* Return the clauses associated with OMP_PARALLEL GS. */
5259 static inline tree
5260 gimple_omp_parallel_clauses (const gimple *gs)
5262 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5263 return omp_parallel_stmt->clauses;
5267 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5269 static inline tree *
5270 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5272 return &omp_parallel_stmt->clauses;
5276 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5278 static inline void
5279 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5280 tree clauses)
5282 omp_parallel_stmt->clauses = clauses;
5286 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5288 static inline tree
5289 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5291 return omp_parallel_stmt->child_fn;
5294 /* Return a pointer to the child function used to hold the body of
5295 OMP_PARALLEL_STMT. */
5297 static inline tree *
5298 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5300 return &omp_parallel_stmt->child_fn;
5304 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5306 static inline void
5307 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5308 tree child_fn)
5310 omp_parallel_stmt->child_fn = child_fn;
5314 /* Return the artificial argument used to send variables and values
5315 from the parent to the children threads in OMP_PARALLEL_STMT. */
5317 static inline tree
5318 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5320 return omp_parallel_stmt->data_arg;
5324 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5326 static inline tree *
5327 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5329 return &omp_parallel_stmt->data_arg;
5333 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5335 static inline void
5336 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5337 tree data_arg)
5339 omp_parallel_stmt->data_arg = data_arg;
5342 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5344 static inline bool
5345 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5347 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5350 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5352 static inline void
5353 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5355 if (value)
5356 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5357 else
5358 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5361 /* Return the clauses associated with OMP_TASK GS. */
5363 static inline tree
5364 gimple_omp_task_clauses (const gimple *gs)
5366 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5367 return omp_task_stmt->clauses;
5371 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5373 static inline tree *
5374 gimple_omp_task_clauses_ptr (gimple *gs)
5376 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5377 return &omp_task_stmt->clauses;
5381 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5382 GS. */
5384 static inline void
5385 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5387 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5388 omp_task_stmt->clauses = clauses;
5392 /* Return true if OMP task statement G has the
5393 GF_OMP_TASK_TASKLOOP flag set. */
5395 static inline bool
5396 gimple_omp_task_taskloop_p (const gimple *g)
5398 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5399 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5403 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5404 value of TASKLOOP_P. */
5406 static inline void
5407 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5409 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5410 if (taskloop_p)
5411 g->subcode |= GF_OMP_TASK_TASKLOOP;
5412 else
5413 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5417 /* Return the child function used to hold the body of OMP_TASK GS. */
5419 static inline tree
5420 gimple_omp_task_child_fn (const gimple *gs)
5422 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5423 return omp_task_stmt->child_fn;
5426 /* Return a pointer to the child function used to hold the body of
5427 OMP_TASK GS. */
5429 static inline tree *
5430 gimple_omp_task_child_fn_ptr (gimple *gs)
5432 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5433 return &omp_task_stmt->child_fn;
5437 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5439 static inline void
5440 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5442 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5443 omp_task_stmt->child_fn = child_fn;
5447 /* Return the artificial argument used to send variables and values
5448 from the parent to the children threads in OMP_TASK GS. */
5450 static inline tree
5451 gimple_omp_task_data_arg (const gimple *gs)
5453 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5454 return omp_task_stmt->data_arg;
5458 /* Return a pointer to the data argument for OMP_TASK GS. */
5460 static inline tree *
5461 gimple_omp_task_data_arg_ptr (gimple *gs)
5463 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5464 return &omp_task_stmt->data_arg;
5468 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5470 static inline void
5471 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5473 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5474 omp_task_stmt->data_arg = data_arg;
5478 /* Return the clauses associated with OMP_TASK GS. */
5480 static inline tree
5481 gimple_omp_taskreg_clauses (const gimple *gs)
5483 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5484 = as_a <const gimple_statement_omp_taskreg *> (gs);
5485 return omp_taskreg_stmt->clauses;
5489 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5491 static inline tree *
5492 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5494 gimple_statement_omp_taskreg *omp_taskreg_stmt
5495 = as_a <gimple_statement_omp_taskreg *> (gs);
5496 return &omp_taskreg_stmt->clauses;
5500 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5501 GS. */
5503 static inline void
5504 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5506 gimple_statement_omp_taskreg *omp_taskreg_stmt
5507 = as_a <gimple_statement_omp_taskreg *> (gs);
5508 omp_taskreg_stmt->clauses = clauses;
5512 /* Return the child function used to hold the body of OMP_TASK GS. */
5514 static inline tree
5515 gimple_omp_taskreg_child_fn (const gimple *gs)
5517 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5518 = as_a <const gimple_statement_omp_taskreg *> (gs);
5519 return omp_taskreg_stmt->child_fn;
5522 /* Return a pointer to the child function used to hold the body of
5523 OMP_TASK GS. */
5525 static inline tree *
5526 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5528 gimple_statement_omp_taskreg *omp_taskreg_stmt
5529 = as_a <gimple_statement_omp_taskreg *> (gs);
5530 return &omp_taskreg_stmt->child_fn;
5534 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5536 static inline void
5537 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5539 gimple_statement_omp_taskreg *omp_taskreg_stmt
5540 = as_a <gimple_statement_omp_taskreg *> (gs);
5541 omp_taskreg_stmt->child_fn = child_fn;
5545 /* Return the artificial argument used to send variables and values
5546 from the parent to the children threads in OMP_TASK GS. */
5548 static inline tree
5549 gimple_omp_taskreg_data_arg (const gimple *gs)
5551 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5552 = as_a <const gimple_statement_omp_taskreg *> (gs);
5553 return omp_taskreg_stmt->data_arg;
5557 /* Return a pointer to the data argument for OMP_TASK GS. */
5559 static inline tree *
5560 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5562 gimple_statement_omp_taskreg *omp_taskreg_stmt
5563 = as_a <gimple_statement_omp_taskreg *> (gs);
5564 return &omp_taskreg_stmt->data_arg;
5568 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5570 static inline void
5571 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5573 gimple_statement_omp_taskreg *omp_taskreg_stmt
5574 = as_a <gimple_statement_omp_taskreg *> (gs);
5575 omp_taskreg_stmt->data_arg = data_arg;
5579 /* Return the copy function used to hold the body of OMP_TASK GS. */
5581 static inline tree
5582 gimple_omp_task_copy_fn (const gimple *gs)
5584 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5585 return omp_task_stmt->copy_fn;
5588 /* Return a pointer to the copy function used to hold the body of
5589 OMP_TASK GS. */
5591 static inline tree *
5592 gimple_omp_task_copy_fn_ptr (gimple *gs)
5594 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5595 return &omp_task_stmt->copy_fn;
5599 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5601 static inline void
5602 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5604 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5605 omp_task_stmt->copy_fn = copy_fn;
5609 /* Return size of the data block in bytes in OMP_TASK GS. */
5611 static inline tree
5612 gimple_omp_task_arg_size (const gimple *gs)
5614 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5615 return omp_task_stmt->arg_size;
5619 /* Return a pointer to the data block size for OMP_TASK GS. */
5621 static inline tree *
5622 gimple_omp_task_arg_size_ptr (gimple *gs)
5624 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5625 return &omp_task_stmt->arg_size;
5629 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5631 static inline void
5632 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5634 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5635 omp_task_stmt->arg_size = arg_size;
5639 /* Return align of the data block in bytes in OMP_TASK GS. */
5641 static inline tree
5642 gimple_omp_task_arg_align (const gimple *gs)
5644 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5645 return omp_task_stmt->arg_align;
5649 /* Return a pointer to the data block align for OMP_TASK GS. */
5651 static inline tree *
5652 gimple_omp_task_arg_align_ptr (gimple *gs)
5654 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5655 return &omp_task_stmt->arg_align;
5659 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5661 static inline void
5662 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5664 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5665 omp_task_stmt->arg_align = arg_align;
5669 /* Return the clauses associated with OMP_SINGLE GS. */
5671 static inline tree
5672 gimple_omp_single_clauses (const gimple *gs)
5674 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5675 return omp_single_stmt->clauses;
5679 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5681 static inline tree *
5682 gimple_omp_single_clauses_ptr (gimple *gs)
5684 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5685 return &omp_single_stmt->clauses;
5689 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5691 static inline void
5692 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5694 omp_single_stmt->clauses = clauses;
5698 /* Return the clauses associated with OMP_TARGET GS. */
5700 static inline tree
5701 gimple_omp_target_clauses (const gimple *gs)
5703 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5704 return omp_target_stmt->clauses;
5708 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5710 static inline tree *
5711 gimple_omp_target_clauses_ptr (gimple *gs)
5713 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5714 return &omp_target_stmt->clauses;
5718 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5720 static inline void
5721 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5722 tree clauses)
5724 omp_target_stmt->clauses = clauses;
5728 /* Return the kind of the OMP_TARGET G. */
5730 static inline int
5731 gimple_omp_target_kind (const gimple *g)
5733 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5734 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5738 /* Set the kind of the OMP_TARGET G. */
5740 static inline void
5741 gimple_omp_target_set_kind (gomp_target *g, int kind)
5743 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5744 | (kind & GF_OMP_TARGET_KIND_MASK);
5748 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5750 static inline tree
5751 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5753 return omp_target_stmt->child_fn;
5756 /* Return a pointer to the child function used to hold the body of
5757 OMP_TARGET_STMT. */
5759 static inline tree *
5760 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5762 return &omp_target_stmt->child_fn;
5766 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5768 static inline void
5769 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5770 tree child_fn)
5772 omp_target_stmt->child_fn = child_fn;
5776 /* Return the artificial argument used to send variables and values
5777 from the parent to the children threads in OMP_TARGET_STMT. */
5779 static inline tree
5780 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5782 return omp_target_stmt->data_arg;
5786 /* Return a pointer to the data argument for OMP_TARGET GS. */
5788 static inline tree *
5789 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5791 return &omp_target_stmt->data_arg;
5795 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5797 static inline void
5798 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5799 tree data_arg)
5801 omp_target_stmt->data_arg = data_arg;
5805 /* Return the clauses associated with OMP_TEAMS GS. */
5807 static inline tree
5808 gimple_omp_teams_clauses (const gimple *gs)
5810 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5811 return omp_teams_stmt->clauses;
5815 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5817 static inline tree *
5818 gimple_omp_teams_clauses_ptr (gimple *gs)
5820 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5821 return &omp_teams_stmt->clauses;
5825 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5827 static inline void
5828 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5830 omp_teams_stmt->clauses = clauses;
5833 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5835 static inline bool
5836 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5838 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5841 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5843 static inline void
5844 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5846 if (value)
5847 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5848 else
5849 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5852 /* Return the clauses associated with OMP_SECTIONS GS. */
5854 static inline tree
5855 gimple_omp_sections_clauses (const gimple *gs)
5857 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5858 return omp_sections_stmt->clauses;
5862 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5864 static inline tree *
5865 gimple_omp_sections_clauses_ptr (gimple *gs)
5867 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5868 return &omp_sections_stmt->clauses;
5872 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5873 GS. */
5875 static inline void
5876 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5878 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5879 omp_sections_stmt->clauses = clauses;
5883 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5884 in GS. */
5886 static inline tree
5887 gimple_omp_sections_control (const gimple *gs)
5889 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5890 return omp_sections_stmt->control;
5894 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5895 GS. */
5897 static inline tree *
5898 gimple_omp_sections_control_ptr (gimple *gs)
5900 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5901 return &omp_sections_stmt->control;
5905 /* Set CONTROL to be the set of clauses associated with the
5906 GIMPLE_OMP_SECTIONS in GS. */
5908 static inline void
5909 gimple_omp_sections_set_control (gimple *gs, tree control)
5911 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5912 omp_sections_stmt->control = control;
5916 /* Set the value being stored in an atomic store. */
5918 static inline void
5919 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5921 store_stmt->val = val;
5925 /* Return the value being stored in an atomic store. */
5927 static inline tree
5928 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5930 return store_stmt->val;
5934 /* Return a pointer to the value being stored in an atomic store. */
5936 static inline tree *
5937 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5939 return &store_stmt->val;
5943 /* Set the LHS of an atomic load. */
5945 static inline void
5946 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5948 load_stmt->lhs = lhs;
5952 /* Get the LHS of an atomic load. */
5954 static inline tree
5955 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5957 return load_stmt->lhs;
5961 /* Return a pointer to the LHS of an atomic load. */
5963 static inline tree *
5964 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5966 return &load_stmt->lhs;
5970 /* Set the RHS of an atomic load. */
5972 static inline void
5973 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5975 load_stmt->rhs = rhs;
5979 /* Get the RHS of an atomic load. */
5981 static inline tree
5982 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5984 return load_stmt->rhs;
5988 /* Return a pointer to the RHS of an atomic load. */
5990 static inline tree *
5991 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5993 return &load_stmt->rhs;
5997 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5999 static inline tree
6000 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
6002 return cont_stmt->control_def;
6005 /* The same as above, but return the address. */
6007 static inline tree *
6008 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
6010 return &cont_stmt->control_def;
6013 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
6015 static inline void
6016 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
6018 cont_stmt->control_def = def;
6022 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6024 static inline tree
6025 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6027 return cont_stmt->control_use;
6031 /* The same as above, but return the address. */
6033 static inline tree *
6034 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6036 return &cont_stmt->control_use;
6040 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6042 static inline void
6043 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6045 cont_stmt->control_use = use;
6048 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6049 TRANSACTION_STMT. */
6051 static inline gimple_seq *
6052 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6054 return &transaction_stmt->body;
6057 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6059 static inline gimple_seq
6060 gimple_transaction_body (gtransaction *transaction_stmt)
6062 return transaction_stmt->body;
6065 /* Return the label associated with a GIMPLE_TRANSACTION. */
6067 static inline tree
6068 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6070 return transaction_stmt->label_norm;
6073 static inline tree *
6074 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6076 return &transaction_stmt->label_norm;
6079 static inline tree
6080 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6082 return transaction_stmt->label_uninst;
6085 static inline tree *
6086 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6088 return &transaction_stmt->label_uninst;
6091 static inline tree
6092 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6094 return transaction_stmt->label_over;
6097 static inline tree *
6098 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6100 return &transaction_stmt->label_over;
6103 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6105 static inline unsigned int
6106 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6108 return transaction_stmt->subcode;
6111 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6112 TRANSACTION_STMT. */
6114 static inline void
6115 gimple_transaction_set_body (gtransaction *transaction_stmt,
6116 gimple_seq body)
6118 transaction_stmt->body = body;
6121 /* Set the label associated with a GIMPLE_TRANSACTION. */
6123 static inline void
6124 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6126 transaction_stmt->label_norm = label;
6129 static inline void
6130 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6132 transaction_stmt->label_uninst = label;
6135 static inline void
6136 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6138 transaction_stmt->label_over = label;
6141 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6143 static inline void
6144 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6145 unsigned int subcode)
6147 transaction_stmt->subcode = subcode;
6150 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6152 static inline tree *
6153 gimple_return_retval_ptr (greturn *gs)
6155 return &gs->op[0];
6158 /* Return the return value for GIMPLE_RETURN GS. */
6160 static inline tree
6161 gimple_return_retval (const greturn *gs)
6163 return gs->op[0];
6167 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6169 static inline void
6170 gimple_return_set_retval (greturn *gs, tree retval)
6172 gs->op[0] = retval;
6176 /* Return the return bounds for GIMPLE_RETURN GS. */
6178 static inline tree
6179 gimple_return_retbnd (const gimple *gs)
6181 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6182 return gimple_op (gs, 1);
6186 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6188 static inline void
6189 gimple_return_set_retbnd (gimple *gs, tree retval)
6191 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6192 gimple_set_op (gs, 1, retval);
6196 /* Returns true when the gimple statement STMT is any of the OMP types. */
6198 #define CASE_GIMPLE_OMP \
6199 case GIMPLE_OMP_PARALLEL: \
6200 case GIMPLE_OMP_TASK: \
6201 case GIMPLE_OMP_FOR: \
6202 case GIMPLE_OMP_SECTIONS: \
6203 case GIMPLE_OMP_SECTIONS_SWITCH: \
6204 case GIMPLE_OMP_SINGLE: \
6205 case GIMPLE_OMP_TARGET: \
6206 case GIMPLE_OMP_TEAMS: \
6207 case GIMPLE_OMP_SECTION: \
6208 case GIMPLE_OMP_MASTER: \
6209 case GIMPLE_OMP_TASKGROUP: \
6210 case GIMPLE_OMP_ORDERED: \
6211 case GIMPLE_OMP_CRITICAL: \
6212 case GIMPLE_OMP_RETURN: \
6213 case GIMPLE_OMP_ATOMIC_LOAD: \
6214 case GIMPLE_OMP_ATOMIC_STORE: \
6215 case GIMPLE_OMP_CONTINUE: \
6216 case GIMPLE_OMP_GRID_BODY
6218 static inline bool
6219 is_gimple_omp (const gimple *stmt)
6221 switch (gimple_code (stmt))
6223 CASE_GIMPLE_OMP:
6224 return true;
6225 default:
6226 return false;
6230 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6231 specifically. */
6233 static inline bool
6234 is_gimple_omp_oacc (const gimple *stmt)
6236 gcc_assert (is_gimple_omp (stmt));
6237 switch (gimple_code (stmt))
6239 case GIMPLE_OMP_FOR:
6240 switch (gimple_omp_for_kind (stmt))
6242 case GF_OMP_FOR_KIND_OACC_LOOP:
6243 return true;
6244 default:
6245 return false;
6247 case GIMPLE_OMP_TARGET:
6248 switch (gimple_omp_target_kind (stmt))
6250 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6251 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6252 case GF_OMP_TARGET_KIND_OACC_DATA:
6253 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6254 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6255 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6256 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6257 return true;
6258 default:
6259 return false;
6261 default:
6262 return false;
6267 /* Return true if the OMP gimple statement STMT is offloaded. */
6269 static inline bool
6270 is_gimple_omp_offloaded (const gimple *stmt)
6272 gcc_assert (is_gimple_omp (stmt));
6273 switch (gimple_code (stmt))
6275 case GIMPLE_OMP_TARGET:
6276 switch (gimple_omp_target_kind (stmt))
6278 case GF_OMP_TARGET_KIND_REGION:
6279 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6280 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6281 return true;
6282 default:
6283 return false;
6285 default:
6286 return false;
6291 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6293 static inline bool
6294 gimple_nop_p (const gimple *g)
6296 return gimple_code (g) == GIMPLE_NOP;
6300 /* Return true if GS is a GIMPLE_RESX. */
6302 static inline bool
6303 is_gimple_resx (const gimple *gs)
6305 return gimple_code (gs) == GIMPLE_RESX;
6308 /* Return the type of the main expression computed by STMT. Return
6309 void_type_node if the statement computes nothing. */
6311 static inline tree
6312 gimple_expr_type (const gimple *stmt)
6314 enum gimple_code code = gimple_code (stmt);
6315 /* In general we want to pass out a type that can be substituted
6316 for both the RHS and the LHS types if there is a possibly
6317 useless conversion involved. That means returning the
6318 original RHS type as far as we can reconstruct it. */
6319 if (code == GIMPLE_CALL)
6321 const gcall *call_stmt = as_a <const gcall *> (stmt);
6322 if (gimple_call_internal_p (call_stmt)
6323 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6324 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6325 else
6326 return gimple_call_return_type (call_stmt);
6328 else if (code == GIMPLE_ASSIGN)
6330 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6331 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6332 else
6333 /* As fallback use the type of the LHS. */
6334 return TREE_TYPE (gimple_get_lhs (stmt));
6336 else if (code == GIMPLE_COND)
6337 return boolean_type_node;
6338 else
6339 return void_type_node;
6342 /* Enum and arrays used for allocation stats. Keep in sync with
6343 gimple.c:gimple_alloc_kind_names. */
6344 enum gimple_alloc_kind
6346 gimple_alloc_kind_assign, /* Assignments. */
6347 gimple_alloc_kind_phi, /* PHI nodes. */
6348 gimple_alloc_kind_cond, /* Conditionals. */
6349 gimple_alloc_kind_rest, /* Everything else. */
6350 gimple_alloc_kind_all
6353 extern int gimple_alloc_counts[];
6354 extern int gimple_alloc_sizes[];
6356 /* Return the allocation kind for a given stmt CODE. */
6357 static inline enum gimple_alloc_kind
6358 gimple_alloc_kind (enum gimple_code code)
6360 switch (code)
6362 case GIMPLE_ASSIGN:
6363 return gimple_alloc_kind_assign;
6364 case GIMPLE_PHI:
6365 return gimple_alloc_kind_phi;
6366 case GIMPLE_COND:
6367 return gimple_alloc_kind_cond;
6368 default:
6369 return gimple_alloc_kind_rest;
6373 /* Return true if a location should not be emitted for this statement
6374 by annotate_all_with_location. */
6376 static inline bool
6377 gimple_do_not_emit_location_p (gimple *g)
6379 return gimple_plf (g, GF_PLF_1);
6382 /* Mark statement G so a location will not be emitted by
6383 annotate_one_with_location. */
6385 static inline void
6386 gimple_set_do_not_emit_location (gimple *g)
6388 /* The PLF flags are initialized to 0 when a new tuple is created,
6389 so no need to initialize it anywhere. */
6390 gimple_set_plf (g, GF_PLF_1, true);
6394 /* Macros for showing usage statistics. */
6395 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6396 ? (x) \
6397 : ((x) < 1024*1024*10 \
6398 ? (x) / 1024 \
6399 : (x) / (1024*1024))))
6401 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6403 #endif /* GCC_GIMPLE_H */