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