2017-10-16 Tamar Christina <tamar.christina@arm.com>
[official-gcc.git] / gcc / gimple.h
blob6213c49b91f4613b6b3e6795815809b451e5a543
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 gimple *gimple_alloc (enum gimple_code, unsigned CXX_MEM_STAT_INFO);
1421 greturn *gimple_build_return (tree);
1422 void gimple_call_reset_alias_info (gcall *);
1423 gcall *gimple_build_call_vec (tree, vec<tree> );
1424 gcall *gimple_build_call (tree, unsigned, ...);
1425 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1426 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1427 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1428 gcall *gimple_build_call_from_tree (tree);
1429 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1430 gassign *gimple_build_assign (tree, enum tree_code,
1431 tree, tree, tree CXX_MEM_STAT_INFO);
1432 gassign *gimple_build_assign (tree, enum tree_code,
1433 tree, tree CXX_MEM_STAT_INFO);
1434 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1435 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1436 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1437 void gimple_cond_set_condition_from_tree (gcond *, tree);
1438 glabel *gimple_build_label (tree label);
1439 ggoto *gimple_build_goto (tree dest);
1440 gimple *gimple_build_nop (void);
1441 gbind *gimple_build_bind (tree, gimple_seq, tree);
1442 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1443 vec<tree, va_gc> *, vec<tree, va_gc> *,
1444 vec<tree, va_gc> *);
1445 gcatch *gimple_build_catch (tree, gimple_seq);
1446 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1447 geh_mnt *gimple_build_eh_must_not_throw (tree);
1448 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1449 gtry *gimple_build_try (gimple_seq, gimple_seq,
1450 enum gimple_try_flags);
1451 gimple *gimple_build_wce (gimple_seq);
1452 gresx *gimple_build_resx (int);
1453 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1454 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1455 geh_dispatch *gimple_build_eh_dispatch (int);
1456 gdebug *gimple_build_debug_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1457 gdebug *gimple_build_debug_source_bind (tree, tree, gimple * CXX_MEM_STAT_INFO);
1458 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1459 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1460 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1461 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1462 tree, tree);
1463 gimple *gimple_build_omp_section (gimple_seq);
1464 gimple *gimple_build_omp_master (gimple_seq);
1465 gimple *gimple_build_omp_grid_body (gimple_seq);
1466 gimple *gimple_build_omp_taskgroup (gimple_seq);
1467 gomp_continue *gimple_build_omp_continue (tree, tree);
1468 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1469 gimple *gimple_build_omp_return (bool);
1470 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1471 gimple *gimple_build_omp_sections_switch (void);
1472 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1473 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1474 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1475 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1476 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1477 gtransaction *gimple_build_transaction (gimple_seq);
1478 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1479 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1480 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1481 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1482 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1483 location_t);
1484 extern void annotate_all_with_location (gimple_seq, location_t);
1485 bool empty_body_p (gimple_seq);
1486 gimple_seq gimple_seq_copy (gimple_seq);
1487 bool gimple_call_same_target_p (const gimple *, const gimple *);
1488 int gimple_call_flags (const gimple *);
1489 int gimple_call_arg_flags (const gcall *, unsigned);
1490 int gimple_call_return_flags (const gcall *);
1491 bool gimple_assign_copy_p (gimple *);
1492 bool gimple_assign_ssa_name_copy_p (gimple *);
1493 bool gimple_assign_unary_nop_p (gimple *);
1494 void gimple_set_bb (gimple *, basic_block);
1495 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1496 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1497 tree, tree, tree);
1498 tree gimple_get_lhs (const gimple *);
1499 void gimple_set_lhs (gimple *, tree);
1500 gimple *gimple_copy (gimple *);
1501 bool gimple_has_side_effects (const gimple *);
1502 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1503 bool gimple_could_trap_p (gimple *);
1504 bool gimple_assign_rhs_could_trap_p (gimple *);
1505 extern void dump_gimple_statistics (void);
1506 unsigned get_gimple_rhs_num_ops (enum tree_code);
1507 extern tree canonicalize_cond_expr_cond (tree);
1508 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1509 extern bool gimple_compare_field_offset (tree, tree);
1510 extern tree gimple_unsigned_type (tree);
1511 extern tree gimple_signed_type (tree);
1512 extern alias_set_type gimple_get_alias_set (tree);
1513 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1514 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1515 extern combined_fn gimple_call_combined_fn (const gimple *);
1516 extern bool gimple_call_builtin_p (const gimple *);
1517 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1518 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1519 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1520 extern void dump_decl_set (FILE *, bitmap);
1521 extern bool nonfreeing_call_p (gimple *);
1522 extern bool nonbarrier_call_p (gimple *);
1523 extern bool infer_nonnull_range (gimple *, tree);
1524 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1525 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1526 extern void sort_case_labels (vec<tree>);
1527 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1528 extern void gimple_seq_set_location (gimple_seq, location_t);
1529 extern void gimple_seq_discard (gimple_seq);
1530 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1531 extern bool gimple_inexpensive_call_p (gcall *);
1532 extern bool stmt_can_terminate_bb_p (gimple *);
1534 /* Formal (expression) temporary table handling: multiple occurrences of
1535 the same scalar expression are evaluated into the same temporary. */
1537 typedef struct gimple_temp_hash_elt
1539 tree val; /* Key */
1540 tree temp; /* Value */
1541 } elt_t;
1543 /* Get the number of the next statement uid to be allocated. */
1544 static inline unsigned int
1545 gimple_stmt_max_uid (struct function *fn)
1547 return fn->last_stmt_uid;
1550 /* Set the number of the next statement uid to be allocated. */
1551 static inline void
1552 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1554 fn->last_stmt_uid = maxid;
1557 /* Set the number of the next statement uid to be allocated. */
1558 static inline unsigned int
1559 inc_gimple_stmt_max_uid (struct function *fn)
1561 return fn->last_stmt_uid++;
1564 /* Return the first node in GIMPLE sequence S. */
1566 static inline gimple_seq_node
1567 gimple_seq_first (gimple_seq s)
1569 return s;
1573 /* Return the first statement in GIMPLE sequence S. */
1575 static inline gimple *
1576 gimple_seq_first_stmt (gimple_seq s)
1578 gimple_seq_node n = gimple_seq_first (s);
1579 return n;
1582 /* Return the first statement in GIMPLE sequence S as a gbind *,
1583 verifying that it has code GIMPLE_BIND in a checked build. */
1585 static inline gbind *
1586 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1588 gimple_seq_node n = gimple_seq_first (s);
1589 return as_a <gbind *> (n);
1593 /* Return the last node in GIMPLE sequence S. */
1595 static inline gimple_seq_node
1596 gimple_seq_last (gimple_seq s)
1598 return s ? s->prev : NULL;
1602 /* Return the last statement in GIMPLE sequence S. */
1604 static inline gimple *
1605 gimple_seq_last_stmt (gimple_seq s)
1607 gimple_seq_node n = gimple_seq_last (s);
1608 return n;
1612 /* Set the last node in GIMPLE sequence *PS to LAST. */
1614 static inline void
1615 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1617 (*ps)->prev = last;
1621 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1623 static inline void
1624 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1626 *ps = first;
1630 /* Return true if GIMPLE sequence S is empty. */
1632 static inline bool
1633 gimple_seq_empty_p (gimple_seq s)
1635 return s == NULL;
1638 /* Allocate a new sequence and initialize its first element with STMT. */
1640 static inline gimple_seq
1641 gimple_seq_alloc_with_stmt (gimple *stmt)
1643 gimple_seq seq = NULL;
1644 gimple_seq_add_stmt (&seq, stmt);
1645 return seq;
1649 /* Returns the sequence of statements in BB. */
1651 static inline gimple_seq
1652 bb_seq (const_basic_block bb)
1654 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1657 static inline gimple_seq *
1658 bb_seq_addr (basic_block bb)
1660 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1663 /* Sets the sequence of statements in BB to SEQ. */
1665 static inline void
1666 set_bb_seq (basic_block bb, gimple_seq seq)
1668 gcc_checking_assert (!(bb->flags & BB_RTL));
1669 bb->il.gimple.seq = seq;
1673 /* Return the code for GIMPLE statement G. */
1675 static inline enum gimple_code
1676 gimple_code (const gimple *g)
1678 return g->code;
1682 /* Return the GSS code used by a GIMPLE code. */
1684 static inline enum gimple_statement_structure_enum
1685 gss_for_code (enum gimple_code code)
1687 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1688 return gss_for_code_[code];
1692 /* Return which GSS code is used by GS. */
1694 static inline enum gimple_statement_structure_enum
1695 gimple_statement_structure (gimple *gs)
1697 return gss_for_code (gimple_code (gs));
1701 /* Return true if statement G has sub-statements. This is only true for
1702 High GIMPLE statements. */
1704 static inline bool
1705 gimple_has_substatements (gimple *g)
1707 switch (gimple_code (g))
1709 case GIMPLE_BIND:
1710 case GIMPLE_CATCH:
1711 case GIMPLE_EH_FILTER:
1712 case GIMPLE_EH_ELSE:
1713 case GIMPLE_TRY:
1714 case GIMPLE_OMP_FOR:
1715 case GIMPLE_OMP_MASTER:
1716 case GIMPLE_OMP_TASKGROUP:
1717 case GIMPLE_OMP_ORDERED:
1718 case GIMPLE_OMP_SECTION:
1719 case GIMPLE_OMP_PARALLEL:
1720 case GIMPLE_OMP_TASK:
1721 case GIMPLE_OMP_SECTIONS:
1722 case GIMPLE_OMP_SINGLE:
1723 case GIMPLE_OMP_TARGET:
1724 case GIMPLE_OMP_TEAMS:
1725 case GIMPLE_OMP_CRITICAL:
1726 case GIMPLE_WITH_CLEANUP_EXPR:
1727 case GIMPLE_TRANSACTION:
1728 case GIMPLE_OMP_GRID_BODY:
1729 return true;
1731 default:
1732 return false;
1737 /* Return the basic block holding statement G. */
1739 static inline basic_block
1740 gimple_bb (const gimple *g)
1742 return g->bb;
1746 /* Return the lexical scope block holding statement G. */
1748 static inline tree
1749 gimple_block (const gimple *g)
1751 return LOCATION_BLOCK (g->location);
1755 /* Set BLOCK to be the lexical scope block holding statement G. */
1757 static inline void
1758 gimple_set_block (gimple *g, tree block)
1760 g->location = set_block (g->location, block);
1764 /* Return location information for statement G. */
1766 static inline location_t
1767 gimple_location (const gimple *g)
1769 return g->location;
1772 /* Return location information for statement G if g is not NULL.
1773 Otherwise, UNKNOWN_LOCATION is returned. */
1775 static inline location_t
1776 gimple_location_safe (const gimple *g)
1778 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1781 /* Set location information for statement G. */
1783 static inline void
1784 gimple_set_location (gimple *g, location_t location)
1786 g->location = location;
1790 /* Return true if G contains location information. */
1792 static inline bool
1793 gimple_has_location (const gimple *g)
1795 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1799 /* Return the file name of the location of STMT. */
1801 static inline const char *
1802 gimple_filename (const gimple *stmt)
1804 return LOCATION_FILE (gimple_location (stmt));
1808 /* Return the line number of the location of STMT. */
1810 static inline int
1811 gimple_lineno (const gimple *stmt)
1813 return LOCATION_LINE (gimple_location (stmt));
1817 /* Determine whether SEQ is a singleton. */
1819 static inline bool
1820 gimple_seq_singleton_p (gimple_seq seq)
1822 return ((gimple_seq_first (seq) != NULL)
1823 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1826 /* Return true if no warnings should be emitted for statement STMT. */
1828 static inline bool
1829 gimple_no_warning_p (const gimple *stmt)
1831 return stmt->no_warning;
1834 /* Set the no_warning flag of STMT to NO_WARNING. */
1836 static inline void
1837 gimple_set_no_warning (gimple *stmt, bool no_warning)
1839 stmt->no_warning = (unsigned) no_warning;
1842 /* Set the visited status on statement STMT to VISITED_P.
1844 Please note that this 'visited' property of the gimple statement is
1845 supposed to be undefined at pass boundaries. This means that a
1846 given pass should not assume it contains any useful value when the
1847 pass starts and thus can set it to any value it sees fit.
1849 You can learn more about the visited property of the gimple
1850 statement by reading the comments of the 'visited' data member of
1851 struct gimple.
1854 static inline void
1855 gimple_set_visited (gimple *stmt, bool visited_p)
1857 stmt->visited = (unsigned) visited_p;
1861 /* Return the visited status for statement STMT.
1863 Please note that this 'visited' property of the gimple statement is
1864 supposed to be undefined at pass boundaries. This means that a
1865 given pass should not assume it contains any useful value when the
1866 pass starts and thus can set it to any value it sees fit.
1868 You can learn more about the visited property of the gimple
1869 statement by reading the comments of the 'visited' data member of
1870 struct gimple. */
1872 static inline bool
1873 gimple_visited_p (gimple *stmt)
1875 return stmt->visited;
1879 /* Set pass local flag PLF on statement STMT to VAL_P.
1881 Please note that this PLF property of the gimple statement is
1882 supposed to be undefined at pass boundaries. This means that a
1883 given pass should not assume it contains any useful value when the
1884 pass starts and thus can set it to any value it sees fit.
1886 You can learn more about the PLF property by reading the comment of
1887 the 'plf' data member of struct gimple_statement_structure. */
1889 static inline void
1890 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1892 if (val_p)
1893 stmt->plf |= (unsigned int) plf;
1894 else
1895 stmt->plf &= ~((unsigned int) plf);
1899 /* Return the value of pass local flag PLF on statement STMT.
1901 Please note that this 'plf' property of the gimple statement is
1902 supposed to be undefined at pass boundaries. This means that a
1903 given pass should not assume it contains any useful value when the
1904 pass starts and thus can set it to any value it sees fit.
1906 You can learn more about the plf property by reading the comment of
1907 the 'plf' data member of struct gimple_statement_structure. */
1909 static inline unsigned int
1910 gimple_plf (gimple *stmt, enum plf_mask plf)
1912 return stmt->plf & ((unsigned int) plf);
1916 /* Set the UID of statement.
1918 Please note that this UID property is supposed to be undefined at
1919 pass boundaries. This means that a given pass should not assume it
1920 contains any useful value when the pass starts and thus can set it
1921 to any value it sees fit. */
1923 static inline void
1924 gimple_set_uid (gimple *g, unsigned uid)
1926 g->uid = uid;
1930 /* Return the UID of statement.
1932 Please note that this UID property is supposed to be undefined at
1933 pass boundaries. This means that a given pass should not assume it
1934 contains any useful value when the pass starts and thus can set it
1935 to any value it sees fit. */
1937 static inline unsigned
1938 gimple_uid (const gimple *g)
1940 return g->uid;
1944 /* Make statement G a singleton sequence. */
1946 static inline void
1947 gimple_init_singleton (gimple *g)
1949 g->next = NULL;
1950 g->prev = g;
1954 /* Return true if GIMPLE statement G has register or memory operands. */
1956 static inline bool
1957 gimple_has_ops (const gimple *g)
1959 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1962 template <>
1963 template <>
1964 inline bool
1965 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1967 return gimple_has_ops (gs);
1970 template <>
1971 template <>
1972 inline bool
1973 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1975 return gimple_has_ops (gs);
1978 /* Return true if GIMPLE statement G has memory operands. */
1980 static inline bool
1981 gimple_has_mem_ops (const gimple *g)
1983 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1986 template <>
1987 template <>
1988 inline bool
1989 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1991 return gimple_has_mem_ops (gs);
1994 template <>
1995 template <>
1996 inline bool
1997 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1999 return gimple_has_mem_ops (gs);
2002 /* Return the set of USE operands for statement G. */
2004 static inline struct use_optype_d *
2005 gimple_use_ops (const gimple *g)
2007 const gimple_statement_with_ops *ops_stmt =
2008 dyn_cast <const gimple_statement_with_ops *> (g);
2009 if (!ops_stmt)
2010 return NULL;
2011 return ops_stmt->use_ops;
2015 /* Set USE to be the set of USE operands for statement G. */
2017 static inline void
2018 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2020 gimple_statement_with_ops *ops_stmt =
2021 as_a <gimple_statement_with_ops *> (g);
2022 ops_stmt->use_ops = use;
2026 /* Return the single VUSE operand of the statement G. */
2028 static inline tree
2029 gimple_vuse (const gimple *g)
2031 const gimple_statement_with_memory_ops *mem_ops_stmt =
2032 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2033 if (!mem_ops_stmt)
2034 return NULL_TREE;
2035 return mem_ops_stmt->vuse;
2038 /* Return the single VDEF operand of the statement G. */
2040 static inline tree
2041 gimple_vdef (const gimple *g)
2043 const gimple_statement_with_memory_ops *mem_ops_stmt =
2044 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2045 if (!mem_ops_stmt)
2046 return NULL_TREE;
2047 return mem_ops_stmt->vdef;
2050 /* Return the single VUSE operand of the statement G. */
2052 static inline tree *
2053 gimple_vuse_ptr (gimple *g)
2055 gimple_statement_with_memory_ops *mem_ops_stmt =
2056 dyn_cast <gimple_statement_with_memory_ops *> (g);
2057 if (!mem_ops_stmt)
2058 return NULL;
2059 return &mem_ops_stmt->vuse;
2062 /* Return the single VDEF operand of the statement G. */
2064 static inline tree *
2065 gimple_vdef_ptr (gimple *g)
2067 gimple_statement_with_memory_ops *mem_ops_stmt =
2068 dyn_cast <gimple_statement_with_memory_ops *> (g);
2069 if (!mem_ops_stmt)
2070 return NULL;
2071 return &mem_ops_stmt->vdef;
2074 /* Set the single VUSE operand of the statement G. */
2076 static inline void
2077 gimple_set_vuse (gimple *g, tree vuse)
2079 gimple_statement_with_memory_ops *mem_ops_stmt =
2080 as_a <gimple_statement_with_memory_ops *> (g);
2081 mem_ops_stmt->vuse = vuse;
2084 /* Set the single VDEF operand of the statement G. */
2086 static inline void
2087 gimple_set_vdef (gimple *g, tree vdef)
2089 gimple_statement_with_memory_ops *mem_ops_stmt =
2090 as_a <gimple_statement_with_memory_ops *> (g);
2091 mem_ops_stmt->vdef = vdef;
2095 /* Return true if statement G has operands and the modified field has
2096 been set. */
2098 static inline bool
2099 gimple_modified_p (const gimple *g)
2101 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2105 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2106 a MODIFIED field. */
2108 static inline void
2109 gimple_set_modified (gimple *s, bool modifiedp)
2111 if (gimple_has_ops (s))
2112 s->modified = (unsigned) modifiedp;
2116 /* Return the tree code for the expression computed by STMT. This is
2117 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2118 GIMPLE_CALL, return CALL_EXPR as the expression code for
2119 consistency. This is useful when the caller needs to deal with the
2120 three kinds of computation that GIMPLE supports. */
2122 static inline enum tree_code
2123 gimple_expr_code (const gimple *stmt)
2125 enum gimple_code code = gimple_code (stmt);
2126 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2127 return (enum tree_code) stmt->subcode;
2128 else
2130 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2131 return CALL_EXPR;
2136 /* Return true if statement STMT contains volatile operands. */
2138 static inline bool
2139 gimple_has_volatile_ops (const gimple *stmt)
2141 if (gimple_has_mem_ops (stmt))
2142 return stmt->has_volatile_ops;
2143 else
2144 return false;
2148 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2150 static inline void
2151 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2153 if (gimple_has_mem_ops (stmt))
2154 stmt->has_volatile_ops = (unsigned) volatilep;
2157 /* Return true if STMT is in a transaction. */
2159 static inline bool
2160 gimple_in_transaction (const gimple *stmt)
2162 return bb_in_transaction (gimple_bb (stmt));
2165 /* Return true if statement STMT may access memory. */
2167 static inline bool
2168 gimple_references_memory_p (gimple *stmt)
2170 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2174 /* Return the subcode for OMP statement S. */
2176 static inline unsigned
2177 gimple_omp_subcode (const gimple *s)
2179 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2180 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2181 return s->subcode;
2184 /* Set the subcode for OMP statement S to SUBCODE. */
2186 static inline void
2187 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2189 /* We only have 16 bits for the subcode. Assert that we are not
2190 overflowing it. */
2191 gcc_gimple_checking_assert (subcode < (1 << 16));
2192 s->subcode = subcode;
2195 /* Set the nowait flag on OMP_RETURN statement S. */
2197 static inline void
2198 gimple_omp_return_set_nowait (gimple *s)
2200 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2201 s->subcode |= GF_OMP_RETURN_NOWAIT;
2205 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2206 flag set. */
2208 static inline bool
2209 gimple_omp_return_nowait_p (const gimple *g)
2211 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2212 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2216 /* Set the LHS of OMP return. */
2218 static inline void
2219 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2221 gimple_statement_omp_return *omp_return_stmt =
2222 as_a <gimple_statement_omp_return *> (g);
2223 omp_return_stmt->val = lhs;
2227 /* Get the LHS of OMP return. */
2229 static inline tree
2230 gimple_omp_return_lhs (const gimple *g)
2232 const gimple_statement_omp_return *omp_return_stmt =
2233 as_a <const gimple_statement_omp_return *> (g);
2234 return omp_return_stmt->val;
2238 /* Return a pointer to the LHS of OMP return. */
2240 static inline tree *
2241 gimple_omp_return_lhs_ptr (gimple *g)
2243 gimple_statement_omp_return *omp_return_stmt =
2244 as_a <gimple_statement_omp_return *> (g);
2245 return &omp_return_stmt->val;
2249 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2250 flag set. */
2252 static inline bool
2253 gimple_omp_section_last_p (const gimple *g)
2255 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2256 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2260 /* Set the GF_OMP_SECTION_LAST flag on G. */
2262 static inline void
2263 gimple_omp_section_set_last (gimple *g)
2265 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2266 g->subcode |= GF_OMP_SECTION_LAST;
2270 /* Return true if OMP parallel statement G has the
2271 GF_OMP_PARALLEL_COMBINED flag set. */
2273 static inline bool
2274 gimple_omp_parallel_combined_p (const gimple *g)
2276 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2277 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2281 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2282 value of COMBINED_P. */
2284 static inline void
2285 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2287 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2288 if (combined_p)
2289 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2290 else
2291 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2295 /* Return true if OMP atomic load/store statement G has the
2296 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2298 static inline bool
2299 gimple_omp_atomic_need_value_p (const gimple *g)
2301 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2302 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2303 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2307 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2309 static inline void
2310 gimple_omp_atomic_set_need_value (gimple *g)
2312 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2313 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2314 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2318 /* Return true if OMP atomic load/store statement G has the
2319 GF_OMP_ATOMIC_SEQ_CST flag set. */
2321 static inline bool
2322 gimple_omp_atomic_seq_cst_p (const gimple *g)
2324 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2325 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2326 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2330 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2332 static inline void
2333 gimple_omp_atomic_set_seq_cst (gimple *g)
2335 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2336 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2337 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2341 /* Return the number of operands for statement GS. */
2343 static inline unsigned
2344 gimple_num_ops (const gimple *gs)
2346 return gs->num_ops;
2350 /* Set the number of operands for statement GS. */
2352 static inline void
2353 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2355 gs->num_ops = num_ops;
2359 /* Return the array of operands for statement GS. */
2361 static inline tree *
2362 gimple_ops (gimple *gs)
2364 size_t off;
2366 /* All the tuples have their operand vector at the very bottom
2367 of the structure. Note that those structures that do not
2368 have an operand vector have a zero offset. */
2369 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2370 gcc_gimple_checking_assert (off != 0);
2372 return (tree *) ((char *) gs + off);
2376 /* Return operand I for statement GS. */
2378 static inline tree
2379 gimple_op (const gimple *gs, unsigned i)
2381 if (gimple_has_ops (gs))
2383 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2384 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2386 else
2387 return NULL_TREE;
2390 /* Return a pointer to operand I for statement GS. */
2392 static inline tree *
2393 gimple_op_ptr (gimple *gs, unsigned i)
2395 if (gimple_has_ops (gs))
2397 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2398 return gimple_ops (gs) + i;
2400 else
2401 return NULL;
2404 /* Set operand I of statement GS to OP. */
2406 static inline void
2407 gimple_set_op (gimple *gs, unsigned i, tree op)
2409 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2411 /* Note. It may be tempting to assert that OP matches
2412 is_gimple_operand, but that would be wrong. Different tuples
2413 accept slightly different sets of tree operands. Each caller
2414 should perform its own validation. */
2415 gimple_ops (gs)[i] = op;
2418 /* Return true if GS is a GIMPLE_ASSIGN. */
2420 static inline bool
2421 is_gimple_assign (const gimple *gs)
2423 return gimple_code (gs) == GIMPLE_ASSIGN;
2426 /* Determine if expression CODE is one of the valid expressions that can
2427 be used on the RHS of GIMPLE assignments. */
2429 static inline enum gimple_rhs_class
2430 get_gimple_rhs_class (enum tree_code code)
2432 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2435 /* Return the LHS of assignment statement GS. */
2437 static inline tree
2438 gimple_assign_lhs (const gassign *gs)
2440 return gs->op[0];
2443 static inline tree
2444 gimple_assign_lhs (const gimple *gs)
2446 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2447 return gimple_assign_lhs (ass);
2451 /* Return a pointer to the LHS of assignment statement GS. */
2453 static inline tree *
2454 gimple_assign_lhs_ptr (gassign *gs)
2456 return &gs->op[0];
2459 static inline tree *
2460 gimple_assign_lhs_ptr (gimple *gs)
2462 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2463 return gimple_assign_lhs_ptr (ass);
2467 /* Set LHS to be the LHS operand of assignment statement GS. */
2469 static inline void
2470 gimple_assign_set_lhs (gassign *gs, tree lhs)
2472 gs->op[0] = lhs;
2474 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2475 SSA_NAME_DEF_STMT (lhs) = gs;
2478 static inline void
2479 gimple_assign_set_lhs (gimple *gs, tree lhs)
2481 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2482 gimple_assign_set_lhs (ass, lhs);
2486 /* Return the first operand on the RHS of assignment statement GS. */
2488 static inline tree
2489 gimple_assign_rhs1 (const gassign *gs)
2491 return gs->op[1];
2494 static inline tree
2495 gimple_assign_rhs1 (const gimple *gs)
2497 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2498 return gimple_assign_rhs1 (ass);
2502 /* Return a pointer to the first operand on the RHS of assignment
2503 statement GS. */
2505 static inline tree *
2506 gimple_assign_rhs1_ptr (gassign *gs)
2508 return &gs->op[1];
2511 static inline tree *
2512 gimple_assign_rhs1_ptr (gimple *gs)
2514 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2515 return gimple_assign_rhs1_ptr (ass);
2518 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2520 static inline void
2521 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2523 gs->op[1] = rhs;
2526 static inline void
2527 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2529 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2530 gimple_assign_set_rhs1 (ass, rhs);
2534 /* Return the second operand on the RHS of assignment statement GS.
2535 If GS does not have two operands, NULL is returned instead. */
2537 static inline tree
2538 gimple_assign_rhs2 (const gassign *gs)
2540 if (gimple_num_ops (gs) >= 3)
2541 return gs->op[2];
2542 else
2543 return NULL_TREE;
2546 static inline tree
2547 gimple_assign_rhs2 (const gimple *gs)
2549 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2550 return gimple_assign_rhs2 (ass);
2554 /* Return a pointer to the second operand on the RHS of assignment
2555 statement GS. */
2557 static inline tree *
2558 gimple_assign_rhs2_ptr (gassign *gs)
2560 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2561 return &gs->op[2];
2564 static inline tree *
2565 gimple_assign_rhs2_ptr (gimple *gs)
2567 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2568 return gimple_assign_rhs2_ptr (ass);
2572 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2574 static inline void
2575 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2577 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2578 gs->op[2] = rhs;
2581 static inline void
2582 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2584 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2585 return gimple_assign_set_rhs2 (ass, rhs);
2588 /* Return the third operand on the RHS of assignment statement GS.
2589 If GS does not have two operands, NULL is returned instead. */
2591 static inline tree
2592 gimple_assign_rhs3 (const gassign *gs)
2594 if (gimple_num_ops (gs) >= 4)
2595 return gs->op[3];
2596 else
2597 return NULL_TREE;
2600 static inline tree
2601 gimple_assign_rhs3 (const gimple *gs)
2603 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2604 return gimple_assign_rhs3 (ass);
2607 /* Return a pointer to the third operand on the RHS of assignment
2608 statement GS. */
2610 static inline tree *
2611 gimple_assign_rhs3_ptr (gimple *gs)
2613 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2614 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2615 return &ass->op[3];
2619 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2621 static inline void
2622 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2624 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2625 gs->op[3] = rhs;
2628 static inline void
2629 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2631 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2632 gimple_assign_set_rhs3 (ass, rhs);
2636 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2637 which expect to see only two operands. */
2639 static inline void
2640 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2641 tree op1, tree op2)
2643 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2646 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2647 which expect to see only one operands. */
2649 static inline void
2650 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2651 tree op1)
2653 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2656 /* Returns true if GS is a nontemporal move. */
2658 static inline bool
2659 gimple_assign_nontemporal_move_p (const gassign *gs)
2661 return gs->nontemporal_move;
2664 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2666 static inline void
2667 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2669 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2670 gs->nontemporal_move = nontemporal;
2674 /* Return the code of the expression computed on the rhs of assignment
2675 statement GS. In case that the RHS is a single object, returns the
2676 tree code of the object. */
2678 static inline enum tree_code
2679 gimple_assign_rhs_code (const gassign *gs)
2681 enum tree_code code = (enum tree_code) gs->subcode;
2682 /* While we initially set subcode to the TREE_CODE of the rhs for
2683 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2684 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2685 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2686 code = TREE_CODE (gs->op[1]);
2688 return code;
2691 static inline enum tree_code
2692 gimple_assign_rhs_code (const gimple *gs)
2694 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2695 return gimple_assign_rhs_code (ass);
2699 /* Set CODE to be the code for the expression computed on the RHS of
2700 assignment S. */
2702 static inline void
2703 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2705 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2706 s->subcode = code;
2710 /* Return the gimple rhs class of the code of the expression computed on
2711 the rhs of assignment statement GS.
2712 This will never return GIMPLE_INVALID_RHS. */
2714 static inline enum gimple_rhs_class
2715 gimple_assign_rhs_class (const gimple *gs)
2717 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2720 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2721 there is no operator associated with the assignment itself.
2722 Unlike gimple_assign_copy_p, this predicate returns true for
2723 any RHS operand, including those that perform an operation
2724 and do not have the semantics of a copy, such as COND_EXPR. */
2726 static inline bool
2727 gimple_assign_single_p (const gimple *gs)
2729 return (is_gimple_assign (gs)
2730 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2733 /* Return true if GS performs a store to its lhs. */
2735 static inline bool
2736 gimple_store_p (const gimple *gs)
2738 tree lhs = gimple_get_lhs (gs);
2739 return lhs && !is_gimple_reg (lhs);
2742 /* Return true if GS is an assignment that loads from its rhs1. */
2744 static inline bool
2745 gimple_assign_load_p (const gimple *gs)
2747 tree rhs;
2748 if (!gimple_assign_single_p (gs))
2749 return false;
2750 rhs = gimple_assign_rhs1 (gs);
2751 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2752 return true;
2753 rhs = get_base_address (rhs);
2754 return (DECL_P (rhs)
2755 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2759 /* Return true if S is a type-cast assignment. */
2761 static inline bool
2762 gimple_assign_cast_p (const gimple *s)
2764 if (is_gimple_assign (s))
2766 enum tree_code sc = gimple_assign_rhs_code (s);
2767 return CONVERT_EXPR_CODE_P (sc)
2768 || sc == VIEW_CONVERT_EXPR
2769 || sc == FIX_TRUNC_EXPR;
2772 return false;
2775 /* Return true if S is a clobber statement. */
2777 static inline bool
2778 gimple_clobber_p (const gimple *s)
2780 return gimple_assign_single_p (s)
2781 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2784 /* Return true if GS is a GIMPLE_CALL. */
2786 static inline bool
2787 is_gimple_call (const gimple *gs)
2789 return gimple_code (gs) == GIMPLE_CALL;
2792 /* Return the LHS of call statement GS. */
2794 static inline tree
2795 gimple_call_lhs (const gcall *gs)
2797 return gs->op[0];
2800 static inline tree
2801 gimple_call_lhs (const gimple *gs)
2803 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2804 return gimple_call_lhs (gc);
2808 /* Return a pointer to the LHS of call statement GS. */
2810 static inline tree *
2811 gimple_call_lhs_ptr (gcall *gs)
2813 return &gs->op[0];
2816 static inline tree *
2817 gimple_call_lhs_ptr (gimple *gs)
2819 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2820 return gimple_call_lhs_ptr (gc);
2824 /* Set LHS to be the LHS operand of call statement GS. */
2826 static inline void
2827 gimple_call_set_lhs (gcall *gs, tree lhs)
2829 gs->op[0] = lhs;
2830 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2831 SSA_NAME_DEF_STMT (lhs) = gs;
2834 static inline void
2835 gimple_call_set_lhs (gimple *gs, tree lhs)
2837 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2838 gimple_call_set_lhs (gc, lhs);
2842 /* Return true if call GS calls an internal-only function, as enumerated
2843 by internal_fn. */
2845 static inline bool
2846 gimple_call_internal_p (const gcall *gs)
2848 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2851 static inline bool
2852 gimple_call_internal_p (const gimple *gs)
2854 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2855 return gimple_call_internal_p (gc);
2859 /* Return true if call GS is marked as instrumented by
2860 Pointer Bounds Checker. */
2862 static inline bool
2863 gimple_call_with_bounds_p (const gcall *gs)
2865 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2868 static inline bool
2869 gimple_call_with_bounds_p (const gimple *gs)
2871 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2872 return gimple_call_with_bounds_p (gc);
2876 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2877 Pointer Bounds Checker. */
2879 static inline void
2880 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2882 if (with_bounds)
2883 gs->subcode |= GF_CALL_WITH_BOUNDS;
2884 else
2885 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2888 static inline void
2889 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2891 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2892 gimple_call_set_with_bounds (gc, with_bounds);
2896 /* Return the target of internal call GS. */
2898 static inline enum internal_fn
2899 gimple_call_internal_fn (const gcall *gs)
2901 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2902 return gs->u.internal_fn;
2905 static inline enum internal_fn
2906 gimple_call_internal_fn (const gimple *gs)
2908 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2909 return gimple_call_internal_fn (gc);
2912 /* Return true, if this internal gimple call is unique. */
2914 static inline bool
2915 gimple_call_internal_unique_p (const gcall *gs)
2917 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2920 static inline bool
2921 gimple_call_internal_unique_p (const gimple *gs)
2923 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2924 return gimple_call_internal_unique_p (gc);
2927 /* Return true if GS is an internal function FN. */
2929 static inline bool
2930 gimple_call_internal_p (const gimple *gs, internal_fn fn)
2932 return (is_gimple_call (gs)
2933 && gimple_call_internal_p (gs)
2934 && gimple_call_internal_fn (gs) == fn);
2937 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2938 that could alter control flow. */
2940 static inline void
2941 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2943 if (ctrl_altering_p)
2944 s->subcode |= GF_CALL_CTRL_ALTERING;
2945 else
2946 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2949 static inline void
2950 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2952 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2953 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2956 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2957 flag is set. Such call could not be a stmt in the middle of a bb. */
2959 static inline bool
2960 gimple_call_ctrl_altering_p (const gcall *gs)
2962 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2965 static inline bool
2966 gimple_call_ctrl_altering_p (const gimple *gs)
2968 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2969 return gimple_call_ctrl_altering_p (gc);
2973 /* Return the function type of the function called by GS. */
2975 static inline tree
2976 gimple_call_fntype (const gcall *gs)
2978 if (gimple_call_internal_p (gs))
2979 return NULL_TREE;
2980 return gs->u.fntype;
2983 static inline tree
2984 gimple_call_fntype (const gimple *gs)
2986 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2987 return gimple_call_fntype (call_stmt);
2990 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2992 static inline void
2993 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2995 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2996 call_stmt->u.fntype = fntype;
3000 /* Return the tree node representing the function called by call
3001 statement GS. */
3003 static inline tree
3004 gimple_call_fn (const gcall *gs)
3006 return gs->op[1];
3009 static inline tree
3010 gimple_call_fn (const gimple *gs)
3012 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3013 return gimple_call_fn (gc);
3016 /* Return a pointer to the tree node representing the function called by call
3017 statement GS. */
3019 static inline tree *
3020 gimple_call_fn_ptr (gcall *gs)
3022 return &gs->op[1];
3025 static inline tree *
3026 gimple_call_fn_ptr (gimple *gs)
3028 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3029 return gimple_call_fn_ptr (gc);
3033 /* Set FN to be the function called by call statement GS. */
3035 static inline void
3036 gimple_call_set_fn (gcall *gs, tree fn)
3038 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3039 gs->op[1] = fn;
3043 /* Set FNDECL to be the function called by call statement GS. */
3045 static inline void
3046 gimple_call_set_fndecl (gcall *gs, tree decl)
3048 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3049 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3050 build_pointer_type (TREE_TYPE (decl)), decl);
3053 static inline void
3054 gimple_call_set_fndecl (gimple *gs, tree decl)
3056 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3057 gimple_call_set_fndecl (gc, decl);
3061 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3063 static inline void
3064 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3066 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3067 call_stmt->u.internal_fn = fn;
3071 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3072 Otherwise return NULL. This function is analogous to
3073 get_callee_fndecl in tree land. */
3075 static inline tree
3076 gimple_call_fndecl (const gcall *gs)
3078 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3081 static inline tree
3082 gimple_call_fndecl (const gimple *gs)
3084 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3085 return gimple_call_fndecl (gc);
3089 /* Return the type returned by call statement GS. */
3091 static inline tree
3092 gimple_call_return_type (const gcall *gs)
3094 tree type = gimple_call_fntype (gs);
3096 if (type == NULL_TREE)
3097 return TREE_TYPE (gimple_call_lhs (gs));
3099 /* The type returned by a function is the type of its
3100 function type. */
3101 return TREE_TYPE (type);
3105 /* Return the static chain for call statement GS. */
3107 static inline tree
3108 gimple_call_chain (const gcall *gs)
3110 return gs->op[2];
3113 static inline tree
3114 gimple_call_chain (const gimple *gs)
3116 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3117 return gimple_call_chain (gc);
3121 /* Return a pointer to the static chain for call statement CALL_STMT. */
3123 static inline tree *
3124 gimple_call_chain_ptr (gcall *call_stmt)
3126 return &call_stmt->op[2];
3129 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3131 static inline void
3132 gimple_call_set_chain (gcall *call_stmt, tree chain)
3134 call_stmt->op[2] = chain;
3138 /* Return the number of arguments used by call statement GS. */
3140 static inline unsigned
3141 gimple_call_num_args (const gcall *gs)
3143 return gimple_num_ops (gs) - 3;
3146 static inline unsigned
3147 gimple_call_num_args (const gimple *gs)
3149 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3150 return gimple_call_num_args (gc);
3154 /* Return the argument at position INDEX for call statement GS. */
3156 static inline tree
3157 gimple_call_arg (const gcall *gs, unsigned index)
3159 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3160 return gs->op[index + 3];
3163 static inline tree
3164 gimple_call_arg (const gimple *gs, unsigned index)
3166 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3167 return gimple_call_arg (gc, index);
3171 /* Return a pointer to the argument at position INDEX for call
3172 statement GS. */
3174 static inline tree *
3175 gimple_call_arg_ptr (gcall *gs, unsigned index)
3177 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3178 return &gs->op[index + 3];
3181 static inline tree *
3182 gimple_call_arg_ptr (gimple *gs, unsigned index)
3184 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3185 return gimple_call_arg_ptr (gc, index);
3189 /* Set ARG to be the argument at position INDEX for call statement GS. */
3191 static inline void
3192 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3194 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3195 gs->op[index + 3] = arg;
3198 static inline void
3199 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3201 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3202 gimple_call_set_arg (gc, index, arg);
3206 /* If TAIL_P is true, mark call statement S as being a tail call
3207 (i.e., a call just before the exit of a function). These calls are
3208 candidate for tail call optimization. */
3210 static inline void
3211 gimple_call_set_tail (gcall *s, bool tail_p)
3213 if (tail_p)
3214 s->subcode |= GF_CALL_TAILCALL;
3215 else
3216 s->subcode &= ~GF_CALL_TAILCALL;
3220 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3222 static inline bool
3223 gimple_call_tail_p (gcall *s)
3225 return (s->subcode & GF_CALL_TAILCALL) != 0;
3228 /* Mark (or clear) call statement S as requiring tail call optimization. */
3230 static inline void
3231 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3233 if (must_tail_p)
3234 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3235 else
3236 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3239 /* Return true if call statement has been marked as requiring
3240 tail call optimization. */
3242 static inline bool
3243 gimple_call_must_tail_p (const gcall *s)
3245 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3248 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3249 slot optimization. This transformation uses the target of the call
3250 expansion as the return slot for calls that return in memory. */
3252 static inline void
3253 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3255 if (return_slot_opt_p)
3256 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3257 else
3258 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3262 /* Return true if S is marked for return slot optimization. */
3264 static inline bool
3265 gimple_call_return_slot_opt_p (gcall *s)
3267 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3271 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3272 thunk to the thunked-to function. */
3274 static inline void
3275 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3277 if (from_thunk_p)
3278 s->subcode |= GF_CALL_FROM_THUNK;
3279 else
3280 s->subcode &= ~GF_CALL_FROM_THUNK;
3284 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3286 static inline bool
3287 gimple_call_from_thunk_p (gcall *s)
3289 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3293 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3294 argument pack in its argument list. */
3296 static inline void
3297 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3299 if (pass_arg_pack_p)
3300 s->subcode |= GF_CALL_VA_ARG_PACK;
3301 else
3302 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3306 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3307 argument pack in its argument list. */
3309 static inline bool
3310 gimple_call_va_arg_pack_p (gcall *s)
3312 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3316 /* Return true if S is a noreturn call. */
3318 static inline bool
3319 gimple_call_noreturn_p (const gcall *s)
3321 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3324 static inline bool
3325 gimple_call_noreturn_p (const gimple *s)
3327 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3328 return gimple_call_noreturn_p (gc);
3332 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3333 even if the called function can throw in other cases. */
3335 static inline void
3336 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3338 if (nothrow_p)
3339 s->subcode |= GF_CALL_NOTHROW;
3340 else
3341 s->subcode &= ~GF_CALL_NOTHROW;
3344 /* Return true if S is a nothrow call. */
3346 static inline bool
3347 gimple_call_nothrow_p (gcall *s)
3349 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3352 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3353 is known to be emitted for VLA objects. Those are wrapped by
3354 stack_save/stack_restore calls and hence can't lead to unbounded
3355 stack growth even when they occur in loops. */
3357 static inline void
3358 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3360 if (for_var)
3361 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3362 else
3363 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3366 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3368 static inline bool
3369 gimple_call_alloca_for_var_p (gcall *s)
3371 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3374 /* If BY_DESCRIPTOR_P is true, GIMPLE_CALL S is an indirect call for which
3375 pointers to nested function are descriptors instead of trampolines. */
3377 static inline void
3378 gimple_call_set_by_descriptor (gcall *s, bool by_descriptor_p)
3380 if (by_descriptor_p)
3381 s->subcode |= GF_CALL_BY_DESCRIPTOR;
3382 else
3383 s->subcode &= ~GF_CALL_BY_DESCRIPTOR;
3386 /* Return true if S is a by-descriptor call. */
3388 static inline bool
3389 gimple_call_by_descriptor_p (gcall *s)
3391 return (s->subcode & GF_CALL_BY_DESCRIPTOR) != 0;
3394 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3396 static inline void
3397 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3399 dest_call->subcode = orig_call->subcode;
3403 /* Return a pointer to the points-to solution for the set of call-used
3404 variables of the call CALL_STMT. */
3406 static inline struct pt_solution *
3407 gimple_call_use_set (gcall *call_stmt)
3409 return &call_stmt->call_used;
3413 /* Return a pointer to the points-to solution for the set of call-used
3414 variables of the call CALL_STMT. */
3416 static inline struct pt_solution *
3417 gimple_call_clobber_set (gcall *call_stmt)
3419 return &call_stmt->call_clobbered;
3423 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3424 non-NULL lhs. */
3426 static inline bool
3427 gimple_has_lhs (gimple *stmt)
3429 if (is_gimple_assign (stmt))
3430 return true;
3431 if (gcall *call = dyn_cast <gcall *> (stmt))
3432 return gimple_call_lhs (call) != NULL_TREE;
3433 return false;
3437 /* Return the code of the predicate computed by conditional statement GS. */
3439 static inline enum tree_code
3440 gimple_cond_code (const gcond *gs)
3442 return (enum tree_code) gs->subcode;
3445 static inline enum tree_code
3446 gimple_cond_code (const gimple *gs)
3448 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3449 return gimple_cond_code (gc);
3453 /* Set CODE to be the predicate code for the conditional statement GS. */
3455 static inline void
3456 gimple_cond_set_code (gcond *gs, enum tree_code code)
3458 gs->subcode = code;
3462 /* Return the LHS of the predicate computed by conditional statement GS. */
3464 static inline tree
3465 gimple_cond_lhs (const gcond *gs)
3467 return gs->op[0];
3470 static inline tree
3471 gimple_cond_lhs (const gimple *gs)
3473 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3474 return gimple_cond_lhs (gc);
3477 /* Return the pointer to the LHS of the predicate computed by conditional
3478 statement GS. */
3480 static inline tree *
3481 gimple_cond_lhs_ptr (gcond *gs)
3483 return &gs->op[0];
3486 /* Set LHS to be the LHS operand of the predicate computed by
3487 conditional statement GS. */
3489 static inline void
3490 gimple_cond_set_lhs (gcond *gs, tree lhs)
3492 gs->op[0] = lhs;
3496 /* Return the RHS operand of the predicate computed by conditional GS. */
3498 static inline tree
3499 gimple_cond_rhs (const gcond *gs)
3501 return gs->op[1];
3504 static inline tree
3505 gimple_cond_rhs (const gimple *gs)
3507 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3508 return gimple_cond_rhs (gc);
3511 /* Return the pointer to the RHS operand of the predicate computed by
3512 conditional GS. */
3514 static inline tree *
3515 gimple_cond_rhs_ptr (gcond *gs)
3517 return &gs->op[1];
3521 /* Set RHS to be the RHS operand of the predicate computed by
3522 conditional statement GS. */
3524 static inline void
3525 gimple_cond_set_rhs (gcond *gs, tree rhs)
3527 gs->op[1] = rhs;
3531 /* Return the label used by conditional statement GS when its
3532 predicate evaluates to true. */
3534 static inline tree
3535 gimple_cond_true_label (const gcond *gs)
3537 return gs->op[2];
3541 /* Set LABEL to be the label used by conditional statement GS when its
3542 predicate evaluates to true. */
3544 static inline void
3545 gimple_cond_set_true_label (gcond *gs, tree label)
3547 gs->op[2] = label;
3551 /* Set LABEL to be the label used by conditional statement GS when its
3552 predicate evaluates to false. */
3554 static inline void
3555 gimple_cond_set_false_label (gcond *gs, tree label)
3557 gs->op[3] = label;
3561 /* Return the label used by conditional statement GS when its
3562 predicate evaluates to false. */
3564 static inline tree
3565 gimple_cond_false_label (const gcond *gs)
3567 return gs->op[3];
3571 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3573 static inline void
3574 gimple_cond_make_false (gcond *gs)
3576 gimple_cond_set_lhs (gs, boolean_false_node);
3577 gimple_cond_set_rhs (gs, boolean_false_node);
3578 gs->subcode = NE_EXPR;
3582 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3584 static inline void
3585 gimple_cond_make_true (gcond *gs)
3587 gimple_cond_set_lhs (gs, boolean_true_node);
3588 gimple_cond_set_rhs (gs, boolean_false_node);
3589 gs->subcode = NE_EXPR;
3592 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3593 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3595 static inline bool
3596 gimple_cond_true_p (const gcond *gs)
3598 tree lhs = gimple_cond_lhs (gs);
3599 tree rhs = gimple_cond_rhs (gs);
3600 enum tree_code code = gimple_cond_code (gs);
3602 if (lhs != boolean_true_node && lhs != boolean_false_node)
3603 return false;
3605 if (rhs != boolean_true_node && rhs != boolean_false_node)
3606 return false;
3608 if (code == NE_EXPR && lhs != rhs)
3609 return true;
3611 if (code == EQ_EXPR && lhs == rhs)
3612 return true;
3614 return false;
3617 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3618 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3620 static inline bool
3621 gimple_cond_false_p (const gcond *gs)
3623 tree lhs = gimple_cond_lhs (gs);
3624 tree rhs = gimple_cond_rhs (gs);
3625 enum tree_code code = gimple_cond_code (gs);
3627 if (lhs != boolean_true_node && lhs != boolean_false_node)
3628 return false;
3630 if (rhs != boolean_true_node && rhs != boolean_false_node)
3631 return false;
3633 if (code == NE_EXPR && lhs == rhs)
3634 return true;
3636 if (code == EQ_EXPR && lhs != rhs)
3637 return true;
3639 return false;
3642 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3644 static inline void
3645 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3646 tree rhs)
3648 gimple_cond_set_code (stmt, code);
3649 gimple_cond_set_lhs (stmt, lhs);
3650 gimple_cond_set_rhs (stmt, rhs);
3653 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3655 static inline tree
3656 gimple_label_label (const glabel *gs)
3658 return gs->op[0];
3662 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3663 GS. */
3665 static inline void
3666 gimple_label_set_label (glabel *gs, tree label)
3668 gs->op[0] = label;
3672 /* Return the destination of the unconditional jump GS. */
3674 static inline tree
3675 gimple_goto_dest (const gimple *gs)
3677 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3678 return gimple_op (gs, 0);
3682 /* Set DEST to be the destination of the unconditonal jump GS. */
3684 static inline void
3685 gimple_goto_set_dest (ggoto *gs, tree dest)
3687 gs->op[0] = dest;
3691 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3693 static inline tree
3694 gimple_bind_vars (const gbind *bind_stmt)
3696 return bind_stmt->vars;
3700 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3701 statement GS. */
3703 static inline void
3704 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3706 bind_stmt->vars = vars;
3710 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3711 statement GS. */
3713 static inline void
3714 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3716 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3720 static inline gimple_seq *
3721 gimple_bind_body_ptr (gbind *bind_stmt)
3723 return &bind_stmt->body;
3726 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3728 static inline gimple_seq
3729 gimple_bind_body (gbind *gs)
3731 return *gimple_bind_body_ptr (gs);
3735 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3736 statement GS. */
3738 static inline void
3739 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3741 bind_stmt->body = seq;
3745 /* Append a statement to the end of a GIMPLE_BIND's body. */
3747 static inline void
3748 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3750 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3754 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3756 static inline void
3757 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3759 gimple_seq_add_seq (&bind_stmt->body, seq);
3763 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3764 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3766 static inline tree
3767 gimple_bind_block (const gbind *bind_stmt)
3769 return bind_stmt->block;
3773 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3774 statement GS. */
3776 static inline void
3777 gimple_bind_set_block (gbind *bind_stmt, tree block)
3779 gcc_gimple_checking_assert (block == NULL_TREE
3780 || TREE_CODE (block) == BLOCK);
3781 bind_stmt->block = block;
3785 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3787 static inline unsigned
3788 gimple_asm_ninputs (const gasm *asm_stmt)
3790 return asm_stmt->ni;
3794 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3796 static inline unsigned
3797 gimple_asm_noutputs (const gasm *asm_stmt)
3799 return asm_stmt->no;
3803 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3805 static inline unsigned
3806 gimple_asm_nclobbers (const gasm *asm_stmt)
3808 return asm_stmt->nc;
3811 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3813 static inline unsigned
3814 gimple_asm_nlabels (const gasm *asm_stmt)
3816 return asm_stmt->nl;
3819 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3821 static inline tree
3822 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3824 gcc_gimple_checking_assert (index < asm_stmt->ni);
3825 return asm_stmt->op[index + asm_stmt->no];
3828 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3830 static inline void
3831 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3833 gcc_gimple_checking_assert (index < asm_stmt->ni
3834 && TREE_CODE (in_op) == TREE_LIST);
3835 asm_stmt->op[index + asm_stmt->no] = in_op;
3839 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3841 static inline tree
3842 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3844 gcc_gimple_checking_assert (index < asm_stmt->no);
3845 return asm_stmt->op[index];
3848 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3850 static inline void
3851 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3853 gcc_gimple_checking_assert (index < asm_stmt->no
3854 && TREE_CODE (out_op) == TREE_LIST);
3855 asm_stmt->op[index] = out_op;
3859 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3861 static inline tree
3862 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3864 gcc_gimple_checking_assert (index < asm_stmt->nc);
3865 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3869 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3871 static inline void
3872 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3874 gcc_gimple_checking_assert (index < asm_stmt->nc
3875 && TREE_CODE (clobber_op) == TREE_LIST);
3876 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3879 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3881 static inline tree
3882 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3884 gcc_gimple_checking_assert (index < asm_stmt->nl);
3885 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3888 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3890 static inline void
3891 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3893 gcc_gimple_checking_assert (index < asm_stmt->nl
3894 && TREE_CODE (label_op) == TREE_LIST);
3895 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3898 /* Return the string representing the assembly instruction in
3899 GIMPLE_ASM ASM_STMT. */
3901 static inline const char *
3902 gimple_asm_string (const gasm *asm_stmt)
3904 return asm_stmt->string;
3908 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3910 static inline bool
3911 gimple_asm_volatile_p (const gasm *asm_stmt)
3913 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3917 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3919 static inline void
3920 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3922 if (volatile_p)
3923 asm_stmt->subcode |= GF_ASM_VOLATILE;
3924 else
3925 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3929 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3931 static inline void
3932 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3934 if (input_p)
3935 asm_stmt->subcode |= GF_ASM_INPUT;
3936 else
3937 asm_stmt->subcode &= ~GF_ASM_INPUT;
3941 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3943 static inline bool
3944 gimple_asm_input_p (const gasm *asm_stmt)
3946 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3950 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3952 static inline tree
3953 gimple_catch_types (const gcatch *catch_stmt)
3955 return catch_stmt->types;
3959 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3961 static inline tree *
3962 gimple_catch_types_ptr (gcatch *catch_stmt)
3964 return &catch_stmt->types;
3968 /* Return a pointer to the GIMPLE sequence representing the body of
3969 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3971 static inline gimple_seq *
3972 gimple_catch_handler_ptr (gcatch *catch_stmt)
3974 return &catch_stmt->handler;
3978 /* Return the GIMPLE sequence representing the body of the handler of
3979 GIMPLE_CATCH statement CATCH_STMT. */
3981 static inline gimple_seq
3982 gimple_catch_handler (gcatch *catch_stmt)
3984 return *gimple_catch_handler_ptr (catch_stmt);
3988 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3990 static inline void
3991 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3993 catch_stmt->types = t;
3997 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3999 static inline void
4000 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
4002 catch_stmt->handler = handler;
4006 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
4008 static inline tree
4009 gimple_eh_filter_types (const gimple *gs)
4011 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
4012 return eh_filter_stmt->types;
4016 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
4017 GS. */
4019 static inline tree *
4020 gimple_eh_filter_types_ptr (gimple *gs)
4022 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4023 return &eh_filter_stmt->types;
4027 /* Return a pointer to the sequence of statement to execute when
4028 GIMPLE_EH_FILTER statement fails. */
4030 static inline gimple_seq *
4031 gimple_eh_filter_failure_ptr (gimple *gs)
4033 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4034 return &eh_filter_stmt->failure;
4038 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4039 statement fails. */
4041 static inline gimple_seq
4042 gimple_eh_filter_failure (gimple *gs)
4044 return *gimple_eh_filter_failure_ptr (gs);
4048 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4049 EH_FILTER_STMT. */
4051 static inline void
4052 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4054 eh_filter_stmt->types = types;
4058 /* Set FAILURE to be the sequence of statements to execute on failure
4059 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4061 static inline void
4062 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4063 gimple_seq failure)
4065 eh_filter_stmt->failure = failure;
4068 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4070 static inline tree
4071 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4073 return eh_mnt_stmt->fndecl;
4076 /* Set the function decl to be called by GS to DECL. */
4078 static inline void
4079 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4080 tree decl)
4082 eh_mnt_stmt->fndecl = decl;
4085 /* GIMPLE_EH_ELSE accessors. */
4087 static inline gimple_seq *
4088 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4090 return &eh_else_stmt->n_body;
4093 static inline gimple_seq
4094 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4096 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4099 static inline gimple_seq *
4100 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4102 return &eh_else_stmt->e_body;
4105 static inline gimple_seq
4106 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4108 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4111 static inline void
4112 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4114 eh_else_stmt->n_body = seq;
4117 static inline void
4118 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4120 eh_else_stmt->e_body = seq;
4123 /* GIMPLE_TRY accessors. */
4125 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4126 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4128 static inline enum gimple_try_flags
4129 gimple_try_kind (const gimple *gs)
4131 GIMPLE_CHECK (gs, GIMPLE_TRY);
4132 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4136 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4138 static inline void
4139 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4141 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4142 || kind == GIMPLE_TRY_FINALLY);
4143 if (gimple_try_kind (gs) != kind)
4144 gs->subcode = (unsigned int) kind;
4148 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4150 static inline bool
4151 gimple_try_catch_is_cleanup (const gimple *gs)
4153 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4154 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4158 /* Return a pointer to the sequence of statements used as the
4159 body for GIMPLE_TRY GS. */
4161 static inline gimple_seq *
4162 gimple_try_eval_ptr (gimple *gs)
4164 gtry *try_stmt = as_a <gtry *> (gs);
4165 return &try_stmt->eval;
4169 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4171 static inline gimple_seq
4172 gimple_try_eval (gimple *gs)
4174 return *gimple_try_eval_ptr (gs);
4178 /* Return a pointer to the sequence of statements used as the cleanup body for
4179 GIMPLE_TRY GS. */
4181 static inline gimple_seq *
4182 gimple_try_cleanup_ptr (gimple *gs)
4184 gtry *try_stmt = as_a <gtry *> (gs);
4185 return &try_stmt->cleanup;
4189 /* Return the sequence of statements used as the cleanup body for
4190 GIMPLE_TRY GS. */
4192 static inline gimple_seq
4193 gimple_try_cleanup (gimple *gs)
4195 return *gimple_try_cleanup_ptr (gs);
4199 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4201 static inline void
4202 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4204 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4205 if (catch_is_cleanup)
4206 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4207 else
4208 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4212 /* Set EVAL to be the sequence of statements to use as the body for
4213 GIMPLE_TRY TRY_STMT. */
4215 static inline void
4216 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4218 try_stmt->eval = eval;
4222 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4223 body for GIMPLE_TRY TRY_STMT. */
4225 static inline void
4226 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4228 try_stmt->cleanup = cleanup;
4232 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4234 static inline gimple_seq *
4235 gimple_wce_cleanup_ptr (gimple *gs)
4237 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4238 return &wce_stmt->cleanup;
4242 /* Return the cleanup sequence for cleanup statement GS. */
4244 static inline gimple_seq
4245 gimple_wce_cleanup (gimple *gs)
4247 return *gimple_wce_cleanup_ptr (gs);
4251 /* Set CLEANUP to be the cleanup sequence for GS. */
4253 static inline void
4254 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4256 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4257 wce_stmt->cleanup = cleanup;
4261 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4263 static inline bool
4264 gimple_wce_cleanup_eh_only (const gimple *gs)
4266 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4267 return gs->subcode != 0;
4271 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4273 static inline void
4274 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4276 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4277 gs->subcode = (unsigned int) eh_only_p;
4281 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4283 static inline unsigned
4284 gimple_phi_capacity (const gimple *gs)
4286 const gphi *phi_stmt = as_a <const gphi *> (gs);
4287 return phi_stmt->capacity;
4291 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4292 be exactly the number of incoming edges for the basic block holding
4293 GS. */
4295 static inline unsigned
4296 gimple_phi_num_args (const gimple *gs)
4298 const gphi *phi_stmt = as_a <const gphi *> (gs);
4299 return phi_stmt->nargs;
4303 /* Return the SSA name created by GIMPLE_PHI GS. */
4305 static inline tree
4306 gimple_phi_result (const gphi *gs)
4308 return gs->result;
4311 static inline tree
4312 gimple_phi_result (const gimple *gs)
4314 const gphi *phi_stmt = as_a <const gphi *> (gs);
4315 return gimple_phi_result (phi_stmt);
4318 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4320 static inline tree *
4321 gimple_phi_result_ptr (gphi *gs)
4323 return &gs->result;
4326 static inline tree *
4327 gimple_phi_result_ptr (gimple *gs)
4329 gphi *phi_stmt = as_a <gphi *> (gs);
4330 return gimple_phi_result_ptr (phi_stmt);
4333 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4335 static inline void
4336 gimple_phi_set_result (gphi *phi, tree result)
4338 phi->result = result;
4339 if (result && TREE_CODE (result) == SSA_NAME)
4340 SSA_NAME_DEF_STMT (result) = phi;
4344 /* Return the PHI argument corresponding to incoming edge INDEX for
4345 GIMPLE_PHI GS. */
4347 static inline struct phi_arg_d *
4348 gimple_phi_arg (gphi *gs, unsigned index)
4350 gcc_gimple_checking_assert (index < gs->nargs);
4351 return &(gs->args[index]);
4354 static inline struct phi_arg_d *
4355 gimple_phi_arg (gimple *gs, unsigned index)
4357 gphi *phi_stmt = as_a <gphi *> (gs);
4358 return gimple_phi_arg (phi_stmt, index);
4361 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4362 for GIMPLE_PHI PHI. */
4364 static inline void
4365 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4367 gcc_gimple_checking_assert (index < phi->nargs);
4368 phi->args[index] = *phiarg;
4371 /* Return the PHI nodes for basic block BB, or NULL if there are no
4372 PHI nodes. */
4374 static inline gimple_seq
4375 phi_nodes (const_basic_block bb)
4377 gcc_checking_assert (!(bb->flags & BB_RTL));
4378 return bb->il.gimple.phi_nodes;
4381 /* Return a pointer to the PHI nodes for basic block BB. */
4383 static inline gimple_seq *
4384 phi_nodes_ptr (basic_block bb)
4386 gcc_checking_assert (!(bb->flags & BB_RTL));
4387 return &bb->il.gimple.phi_nodes;
4390 /* Return the tree operand for argument I of PHI node GS. */
4392 static inline tree
4393 gimple_phi_arg_def (gphi *gs, size_t index)
4395 return gimple_phi_arg (gs, index)->def;
4398 static inline tree
4399 gimple_phi_arg_def (gimple *gs, size_t index)
4401 return gimple_phi_arg (gs, index)->def;
4405 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4407 static inline tree *
4408 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4410 return &gimple_phi_arg (phi, index)->def;
4413 /* Return the edge associated with argument I of phi node PHI. */
4415 static inline edge
4416 gimple_phi_arg_edge (gphi *phi, size_t i)
4418 return EDGE_PRED (gimple_bb (phi), i);
4421 /* Return the source location of gimple argument I of phi node PHI. */
4423 static inline source_location
4424 gimple_phi_arg_location (gphi *phi, size_t i)
4426 return gimple_phi_arg (phi, i)->locus;
4429 /* Return the source location of the argument on edge E of phi node PHI. */
4431 static inline source_location
4432 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4434 return gimple_phi_arg (phi, e->dest_idx)->locus;
4437 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4439 static inline void
4440 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4442 gimple_phi_arg (phi, i)->locus = loc;
4445 /* Return TRUE if argument I of phi node PHI has a location record. */
4447 static inline bool
4448 gimple_phi_arg_has_location (gphi *phi, size_t i)
4450 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4454 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4456 static inline int
4457 gimple_resx_region (const gresx *resx_stmt)
4459 return resx_stmt->region;
4462 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4464 static inline void
4465 gimple_resx_set_region (gresx *resx_stmt, int region)
4467 resx_stmt->region = region;
4470 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4472 static inline int
4473 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4475 return eh_dispatch_stmt->region;
4478 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4479 EH_DISPATCH_STMT. */
4481 static inline void
4482 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4484 eh_dispatch_stmt->region = region;
4487 /* Return the number of labels associated with the switch statement GS. */
4489 static inline unsigned
4490 gimple_switch_num_labels (const gswitch *gs)
4492 unsigned num_ops;
4493 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4494 num_ops = gimple_num_ops (gs);
4495 gcc_gimple_checking_assert (num_ops > 1);
4496 return num_ops - 1;
4500 /* Set NLABELS to be the number of labels for the switch statement GS. */
4502 static inline void
4503 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4505 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4506 gimple_set_num_ops (g, nlabels + 1);
4510 /* Return the index variable used by the switch statement GS. */
4512 static inline tree
4513 gimple_switch_index (const gswitch *gs)
4515 return gs->op[0];
4519 /* Return a pointer to the index variable for the switch statement GS. */
4521 static inline tree *
4522 gimple_switch_index_ptr (gswitch *gs)
4524 return &gs->op[0];
4528 /* Set INDEX to be the index variable for switch statement GS. */
4530 static inline void
4531 gimple_switch_set_index (gswitch *gs, tree index)
4533 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4534 gs->op[0] = index;
4538 /* Return the label numbered INDEX. The default label is 0, followed by any
4539 labels in a switch statement. */
4541 static inline tree
4542 gimple_switch_label (const gswitch *gs, unsigned index)
4544 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4545 return gs->op[index + 1];
4548 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4550 static inline void
4551 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4553 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4554 && (label == NULL_TREE
4555 || TREE_CODE (label) == CASE_LABEL_EXPR));
4556 gs->op[index + 1] = label;
4559 /* Return the default label for a switch statement. */
4561 static inline tree
4562 gimple_switch_default_label (const gswitch *gs)
4564 tree label = gimple_switch_label (gs, 0);
4565 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4566 return label;
4569 /* Set the default label for a switch statement. */
4571 static inline void
4572 gimple_switch_set_default_label (gswitch *gs, tree label)
4574 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4575 gimple_switch_set_label (gs, 0, label);
4578 /* Return true if GS is a GIMPLE_DEBUG statement. */
4580 static inline bool
4581 is_gimple_debug (const gimple *gs)
4583 return gimple_code (gs) == GIMPLE_DEBUG;
4586 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4588 static inline bool
4589 gimple_debug_bind_p (const gimple *s)
4591 if (is_gimple_debug (s))
4592 return s->subcode == GIMPLE_DEBUG_BIND;
4594 return false;
4597 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4599 static inline tree
4600 gimple_debug_bind_get_var (gimple *dbg)
4602 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4603 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4604 return gimple_op (dbg, 0);
4607 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4608 statement. */
4610 static inline tree
4611 gimple_debug_bind_get_value (gimple *dbg)
4613 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4614 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4615 return gimple_op (dbg, 1);
4618 /* Return a pointer to the value bound to the variable in a
4619 GIMPLE_DEBUG bind statement. */
4621 static inline tree *
4622 gimple_debug_bind_get_value_ptr (gimple *dbg)
4624 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4625 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4626 return gimple_op_ptr (dbg, 1);
4629 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4631 static inline void
4632 gimple_debug_bind_set_var (gimple *dbg, tree var)
4634 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4635 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4636 gimple_set_op (dbg, 0, var);
4639 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4640 statement. */
4642 static inline void
4643 gimple_debug_bind_set_value (gimple *dbg, tree value)
4645 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4646 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4647 gimple_set_op (dbg, 1, value);
4650 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4651 optimized away. */
4652 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4654 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4655 statement. */
4657 static inline void
4658 gimple_debug_bind_reset_value (gimple *dbg)
4660 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4661 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4662 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4665 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4666 value. */
4668 static inline bool
4669 gimple_debug_bind_has_value_p (gimple *dbg)
4671 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4672 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4673 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4676 #undef GIMPLE_DEBUG_BIND_NOVALUE
4678 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4680 static inline bool
4681 gimple_debug_source_bind_p (const gimple *s)
4683 if (is_gimple_debug (s))
4684 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4686 return false;
4689 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4691 static inline tree
4692 gimple_debug_source_bind_get_var (gimple *dbg)
4694 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4695 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4696 return gimple_op (dbg, 0);
4699 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4700 statement. */
4702 static inline tree
4703 gimple_debug_source_bind_get_value (gimple *dbg)
4705 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4706 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4707 return gimple_op (dbg, 1);
4710 /* Return a pointer to the value bound to the variable in a
4711 GIMPLE_DEBUG source bind statement. */
4713 static inline tree *
4714 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4716 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4717 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4718 return gimple_op_ptr (dbg, 1);
4721 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4723 static inline void
4724 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4726 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4727 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4728 gimple_set_op (dbg, 0, var);
4731 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4732 statement. */
4734 static inline void
4735 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4737 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4738 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4739 gimple_set_op (dbg, 1, value);
4742 /* Return the line number for EXPR, or return -1 if we have no line
4743 number information for it. */
4744 static inline int
4745 get_lineno (const gimple *stmt)
4747 location_t loc;
4749 if (!stmt)
4750 return -1;
4752 loc = gimple_location (stmt);
4753 if (loc == UNKNOWN_LOCATION)
4754 return -1;
4756 return LOCATION_LINE (loc);
4759 /* Return a pointer to the body for the OMP statement GS. */
4761 static inline gimple_seq *
4762 gimple_omp_body_ptr (gimple *gs)
4764 return &static_cast <gimple_statement_omp *> (gs)->body;
4767 /* Return the body for the OMP statement GS. */
4769 static inline gimple_seq
4770 gimple_omp_body (gimple *gs)
4772 return *gimple_omp_body_ptr (gs);
4775 /* Set BODY to be the body for the OMP statement GS. */
4777 static inline void
4778 gimple_omp_set_body (gimple *gs, gimple_seq body)
4780 static_cast <gimple_statement_omp *> (gs)->body = body;
4784 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4786 static inline tree
4787 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4789 return crit_stmt->name;
4793 /* Return a pointer to the name associated with OMP critical statement
4794 CRIT_STMT. */
4796 static inline tree *
4797 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4799 return &crit_stmt->name;
4803 /* Set NAME to be the name associated with OMP critical statement
4804 CRIT_STMT. */
4806 static inline void
4807 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4809 crit_stmt->name = name;
4813 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4815 static inline tree
4816 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4818 return crit_stmt->clauses;
4822 /* Return a pointer to the clauses associated with OMP critical statement
4823 CRIT_STMT. */
4825 static inline tree *
4826 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4828 return &crit_stmt->clauses;
4832 /* Set CLAUSES to be the clauses associated with OMP critical statement
4833 CRIT_STMT. */
4835 static inline void
4836 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4838 crit_stmt->clauses = clauses;
4842 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4844 static inline tree
4845 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4847 return ord_stmt->clauses;
4851 /* Return a pointer to the clauses associated with OMP ordered statement
4852 ORD_STMT. */
4854 static inline tree *
4855 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4857 return &ord_stmt->clauses;
4861 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4862 ORD_STMT. */
4864 static inline void
4865 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4867 ord_stmt->clauses = clauses;
4871 /* Return the kind of the OMP_FOR statemement G. */
4873 static inline int
4874 gimple_omp_for_kind (const gimple *g)
4876 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4877 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4881 /* Set the kind of the OMP_FOR statement G. */
4883 static inline void
4884 gimple_omp_for_set_kind (gomp_for *g, int kind)
4886 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4887 | (kind & GF_OMP_FOR_KIND_MASK);
4891 /* Return true if OMP_FOR statement G has the
4892 GF_OMP_FOR_COMBINED flag set. */
4894 static inline bool
4895 gimple_omp_for_combined_p (const gimple *g)
4897 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4898 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4902 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4903 the boolean value of COMBINED_P. */
4905 static inline void
4906 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4908 if (combined_p)
4909 g->subcode |= GF_OMP_FOR_COMBINED;
4910 else
4911 g->subcode &= ~GF_OMP_FOR_COMBINED;
4915 /* Return true if the OMP_FOR statement G has the
4916 GF_OMP_FOR_COMBINED_INTO flag set. */
4918 static inline bool
4919 gimple_omp_for_combined_into_p (const gimple *g)
4921 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4922 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4926 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4927 on the boolean value of COMBINED_P. */
4929 static inline void
4930 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4932 if (combined_p)
4933 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4934 else
4935 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4939 /* Return the clauses associated with the OMP_FOR statement GS. */
4941 static inline tree
4942 gimple_omp_for_clauses (const gimple *gs)
4944 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4945 return omp_for_stmt->clauses;
4949 /* Return a pointer to the clauses associated with the OMP_FOR statement
4950 GS. */
4952 static inline tree *
4953 gimple_omp_for_clauses_ptr (gimple *gs)
4955 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4956 return &omp_for_stmt->clauses;
4960 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4961 GS. */
4963 static inline void
4964 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4966 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4967 omp_for_stmt->clauses = clauses;
4971 /* Get the collapse count of the OMP_FOR statement GS. */
4973 static inline size_t
4974 gimple_omp_for_collapse (gimple *gs)
4976 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4977 return omp_for_stmt->collapse;
4981 /* Return the condition code associated with the OMP_FOR statement GS. */
4983 static inline enum tree_code
4984 gimple_omp_for_cond (const gimple *gs, size_t i)
4986 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4987 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4988 return omp_for_stmt->iter[i].cond;
4992 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4994 static inline void
4995 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4997 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4998 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4999 && i < omp_for_stmt->collapse);
5000 omp_for_stmt->iter[i].cond = cond;
5004 /* Return the index variable for the OMP_FOR statement GS. */
5006 static inline tree
5007 gimple_omp_for_index (const gimple *gs, size_t i)
5009 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5010 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5011 return omp_for_stmt->iter[i].index;
5015 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
5017 static inline tree *
5018 gimple_omp_for_index_ptr (gimple *gs, size_t i)
5020 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5021 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5022 return &omp_for_stmt->iter[i].index;
5026 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
5028 static inline void
5029 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
5031 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5032 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5033 omp_for_stmt->iter[i].index = index;
5037 /* Return the initial value for the OMP_FOR statement GS. */
5039 static inline tree
5040 gimple_omp_for_initial (const gimple *gs, size_t i)
5042 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5043 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5044 return omp_for_stmt->iter[i].initial;
5048 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
5050 static inline tree *
5051 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
5053 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5054 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5055 return &omp_for_stmt->iter[i].initial;
5059 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5061 static inline void
5062 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5064 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5065 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5066 omp_for_stmt->iter[i].initial = initial;
5070 /* Return the final value for the OMP_FOR statement GS. */
5072 static inline tree
5073 gimple_omp_for_final (const gimple *gs, size_t i)
5075 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5076 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5077 return omp_for_stmt->iter[i].final;
5081 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5083 static inline tree *
5084 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5086 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5087 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5088 return &omp_for_stmt->iter[i].final;
5092 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5094 static inline void
5095 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5097 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5098 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5099 omp_for_stmt->iter[i].final = final;
5103 /* Return the increment value for the OMP_FOR statement GS. */
5105 static inline tree
5106 gimple_omp_for_incr (const gimple *gs, size_t i)
5108 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5109 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5110 return omp_for_stmt->iter[i].incr;
5114 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5116 static inline tree *
5117 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5119 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5120 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5121 return &omp_for_stmt->iter[i].incr;
5125 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5127 static inline void
5128 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5130 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5131 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5132 omp_for_stmt->iter[i].incr = incr;
5136 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5137 statement GS starts. */
5139 static inline gimple_seq *
5140 gimple_omp_for_pre_body_ptr (gimple *gs)
5142 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5143 return &omp_for_stmt->pre_body;
5147 /* Return the sequence of statements to execute before the OMP_FOR
5148 statement GS starts. */
5150 static inline gimple_seq
5151 gimple_omp_for_pre_body (gimple *gs)
5153 return *gimple_omp_for_pre_body_ptr (gs);
5157 /* Set PRE_BODY to be the sequence of statements to execute before the
5158 OMP_FOR statement GS starts. */
5160 static inline void
5161 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5163 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5164 omp_for_stmt->pre_body = pre_body;
5167 /* Return the kernel_phony of OMP_FOR statement. */
5169 static inline bool
5170 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5172 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5173 != GF_OMP_FOR_KIND_GRID_LOOP);
5174 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5177 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5179 static inline void
5180 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5182 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5183 != GF_OMP_FOR_KIND_GRID_LOOP);
5184 if (value)
5185 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5186 else
5187 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5190 /* Return the kernel_intra_group of a GRID_LOOP OMP_FOR statement. */
5192 static inline bool
5193 gimple_omp_for_grid_intra_group (const gomp_for *omp_for)
5195 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5196 == GF_OMP_FOR_KIND_GRID_LOOP);
5197 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_INTRA_GROUP) != 0;
5200 /* Set kernel_intra_group flag of OMP_FOR to VALUE. */
5202 static inline void
5203 gimple_omp_for_set_grid_intra_group (gomp_for *omp_for, bool value)
5205 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5206 == GF_OMP_FOR_KIND_GRID_LOOP);
5207 if (value)
5208 omp_for->subcode |= GF_OMP_FOR_GRID_INTRA_GROUP;
5209 else
5210 omp_for->subcode &= ~GF_OMP_FOR_GRID_INTRA_GROUP;
5213 /* Return true if iterations of a grid OMP_FOR statement correspond to HSA
5214 groups. */
5216 static inline bool
5217 gimple_omp_for_grid_group_iter (const gomp_for *omp_for)
5219 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5220 == GF_OMP_FOR_KIND_GRID_LOOP);
5221 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_GROUP_ITER) != 0;
5224 /* Set group_iter flag of OMP_FOR to VALUE. */
5226 static inline void
5227 gimple_omp_for_set_grid_group_iter (gomp_for *omp_for, bool value)
5229 gcc_checking_assert (gimple_omp_for_kind (omp_for)
5230 == GF_OMP_FOR_KIND_GRID_LOOP);
5231 if (value)
5232 omp_for->subcode |= GF_OMP_FOR_GRID_GROUP_ITER;
5233 else
5234 omp_for->subcode &= ~GF_OMP_FOR_GRID_GROUP_ITER;
5237 /* Return the clauses associated with OMP_PARALLEL GS. */
5239 static inline tree
5240 gimple_omp_parallel_clauses (const gimple *gs)
5242 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5243 return omp_parallel_stmt->clauses;
5247 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5249 static inline tree *
5250 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5252 return &omp_parallel_stmt->clauses;
5256 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5258 static inline void
5259 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5260 tree clauses)
5262 omp_parallel_stmt->clauses = clauses;
5266 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5268 static inline tree
5269 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5271 return omp_parallel_stmt->child_fn;
5274 /* Return a pointer to the child function used to hold the body of
5275 OMP_PARALLEL_STMT. */
5277 static inline tree *
5278 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5280 return &omp_parallel_stmt->child_fn;
5284 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5286 static inline void
5287 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5288 tree child_fn)
5290 omp_parallel_stmt->child_fn = child_fn;
5294 /* Return the artificial argument used to send variables and values
5295 from the parent to the children threads in OMP_PARALLEL_STMT. */
5297 static inline tree
5298 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5300 return omp_parallel_stmt->data_arg;
5304 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5306 static inline tree *
5307 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5309 return &omp_parallel_stmt->data_arg;
5313 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5315 static inline void
5316 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5317 tree data_arg)
5319 omp_parallel_stmt->data_arg = data_arg;
5322 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5324 static inline bool
5325 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5327 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5330 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5332 static inline void
5333 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5335 if (value)
5336 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5337 else
5338 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5341 /* Return the clauses associated with OMP_TASK GS. */
5343 static inline tree
5344 gimple_omp_task_clauses (const gimple *gs)
5346 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5347 return omp_task_stmt->clauses;
5351 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5353 static inline tree *
5354 gimple_omp_task_clauses_ptr (gimple *gs)
5356 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5357 return &omp_task_stmt->clauses;
5361 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5362 GS. */
5364 static inline void
5365 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5367 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5368 omp_task_stmt->clauses = clauses;
5372 /* Return true if OMP task statement G has the
5373 GF_OMP_TASK_TASKLOOP flag set. */
5375 static inline bool
5376 gimple_omp_task_taskloop_p (const gimple *g)
5378 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5379 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5383 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5384 value of TASKLOOP_P. */
5386 static inline void
5387 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5389 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5390 if (taskloop_p)
5391 g->subcode |= GF_OMP_TASK_TASKLOOP;
5392 else
5393 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5397 /* Return the child function used to hold the body of OMP_TASK GS. */
5399 static inline tree
5400 gimple_omp_task_child_fn (const gimple *gs)
5402 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5403 return omp_task_stmt->child_fn;
5406 /* Return a pointer to the child function used to hold the body of
5407 OMP_TASK GS. */
5409 static inline tree *
5410 gimple_omp_task_child_fn_ptr (gimple *gs)
5412 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5413 return &omp_task_stmt->child_fn;
5417 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5419 static inline void
5420 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5422 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5423 omp_task_stmt->child_fn = child_fn;
5427 /* Return the artificial argument used to send variables and values
5428 from the parent to the children threads in OMP_TASK GS. */
5430 static inline tree
5431 gimple_omp_task_data_arg (const gimple *gs)
5433 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5434 return omp_task_stmt->data_arg;
5438 /* Return a pointer to the data argument for OMP_TASK GS. */
5440 static inline tree *
5441 gimple_omp_task_data_arg_ptr (gimple *gs)
5443 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5444 return &omp_task_stmt->data_arg;
5448 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5450 static inline void
5451 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5453 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5454 omp_task_stmt->data_arg = data_arg;
5458 /* Return the clauses associated with OMP_TASK GS. */
5460 static inline tree
5461 gimple_omp_taskreg_clauses (const gimple *gs)
5463 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5464 = as_a <const gimple_statement_omp_taskreg *> (gs);
5465 return omp_taskreg_stmt->clauses;
5469 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5471 static inline tree *
5472 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5474 gimple_statement_omp_taskreg *omp_taskreg_stmt
5475 = as_a <gimple_statement_omp_taskreg *> (gs);
5476 return &omp_taskreg_stmt->clauses;
5480 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5481 GS. */
5483 static inline void
5484 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5486 gimple_statement_omp_taskreg *omp_taskreg_stmt
5487 = as_a <gimple_statement_omp_taskreg *> (gs);
5488 omp_taskreg_stmt->clauses = clauses;
5492 /* Return the child function used to hold the body of OMP_TASK GS. */
5494 static inline tree
5495 gimple_omp_taskreg_child_fn (const gimple *gs)
5497 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5498 = as_a <const gimple_statement_omp_taskreg *> (gs);
5499 return omp_taskreg_stmt->child_fn;
5502 /* Return a pointer to the child function used to hold the body of
5503 OMP_TASK GS. */
5505 static inline tree *
5506 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5508 gimple_statement_omp_taskreg *omp_taskreg_stmt
5509 = as_a <gimple_statement_omp_taskreg *> (gs);
5510 return &omp_taskreg_stmt->child_fn;
5514 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5516 static inline void
5517 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5519 gimple_statement_omp_taskreg *omp_taskreg_stmt
5520 = as_a <gimple_statement_omp_taskreg *> (gs);
5521 omp_taskreg_stmt->child_fn = child_fn;
5525 /* Return the artificial argument used to send variables and values
5526 from the parent to the children threads in OMP_TASK GS. */
5528 static inline tree
5529 gimple_omp_taskreg_data_arg (const gimple *gs)
5531 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5532 = as_a <const gimple_statement_omp_taskreg *> (gs);
5533 return omp_taskreg_stmt->data_arg;
5537 /* Return a pointer to the data argument for OMP_TASK GS. */
5539 static inline tree *
5540 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5542 gimple_statement_omp_taskreg *omp_taskreg_stmt
5543 = as_a <gimple_statement_omp_taskreg *> (gs);
5544 return &omp_taskreg_stmt->data_arg;
5548 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5550 static inline void
5551 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5553 gimple_statement_omp_taskreg *omp_taskreg_stmt
5554 = as_a <gimple_statement_omp_taskreg *> (gs);
5555 omp_taskreg_stmt->data_arg = data_arg;
5559 /* Return the copy function used to hold the body of OMP_TASK GS. */
5561 static inline tree
5562 gimple_omp_task_copy_fn (const gimple *gs)
5564 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5565 return omp_task_stmt->copy_fn;
5568 /* Return a pointer to the copy function used to hold the body of
5569 OMP_TASK GS. */
5571 static inline tree *
5572 gimple_omp_task_copy_fn_ptr (gimple *gs)
5574 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5575 return &omp_task_stmt->copy_fn;
5579 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5581 static inline void
5582 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5584 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5585 omp_task_stmt->copy_fn = copy_fn;
5589 /* Return size of the data block in bytes in OMP_TASK GS. */
5591 static inline tree
5592 gimple_omp_task_arg_size (const gimple *gs)
5594 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5595 return omp_task_stmt->arg_size;
5599 /* Return a pointer to the data block size for OMP_TASK GS. */
5601 static inline tree *
5602 gimple_omp_task_arg_size_ptr (gimple *gs)
5604 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5605 return &omp_task_stmt->arg_size;
5609 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5611 static inline void
5612 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5614 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5615 omp_task_stmt->arg_size = arg_size;
5619 /* Return align of the data block in bytes in OMP_TASK GS. */
5621 static inline tree
5622 gimple_omp_task_arg_align (const gimple *gs)
5624 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5625 return omp_task_stmt->arg_align;
5629 /* Return a pointer to the data block align for OMP_TASK GS. */
5631 static inline tree *
5632 gimple_omp_task_arg_align_ptr (gimple *gs)
5634 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5635 return &omp_task_stmt->arg_align;
5639 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5641 static inline void
5642 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5644 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5645 omp_task_stmt->arg_align = arg_align;
5649 /* Return the clauses associated with OMP_SINGLE GS. */
5651 static inline tree
5652 gimple_omp_single_clauses (const gimple *gs)
5654 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5655 return omp_single_stmt->clauses;
5659 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5661 static inline tree *
5662 gimple_omp_single_clauses_ptr (gimple *gs)
5664 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5665 return &omp_single_stmt->clauses;
5669 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5671 static inline void
5672 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5674 omp_single_stmt->clauses = clauses;
5678 /* Return the clauses associated with OMP_TARGET GS. */
5680 static inline tree
5681 gimple_omp_target_clauses (const gimple *gs)
5683 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5684 return omp_target_stmt->clauses;
5688 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5690 static inline tree *
5691 gimple_omp_target_clauses_ptr (gimple *gs)
5693 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5694 return &omp_target_stmt->clauses;
5698 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5700 static inline void
5701 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5702 tree clauses)
5704 omp_target_stmt->clauses = clauses;
5708 /* Return the kind of the OMP_TARGET G. */
5710 static inline int
5711 gimple_omp_target_kind (const gimple *g)
5713 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5714 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5718 /* Set the kind of the OMP_TARGET G. */
5720 static inline void
5721 gimple_omp_target_set_kind (gomp_target *g, int kind)
5723 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5724 | (kind & GF_OMP_TARGET_KIND_MASK);
5728 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5730 static inline tree
5731 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5733 return omp_target_stmt->child_fn;
5736 /* Return a pointer to the child function used to hold the body of
5737 OMP_TARGET_STMT. */
5739 static inline tree *
5740 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5742 return &omp_target_stmt->child_fn;
5746 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5748 static inline void
5749 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5750 tree child_fn)
5752 omp_target_stmt->child_fn = child_fn;
5756 /* Return the artificial argument used to send variables and values
5757 from the parent to the children threads in OMP_TARGET_STMT. */
5759 static inline tree
5760 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5762 return omp_target_stmt->data_arg;
5766 /* Return a pointer to the data argument for OMP_TARGET GS. */
5768 static inline tree *
5769 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5771 return &omp_target_stmt->data_arg;
5775 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5777 static inline void
5778 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5779 tree data_arg)
5781 omp_target_stmt->data_arg = data_arg;
5785 /* Return the clauses associated with OMP_TEAMS GS. */
5787 static inline tree
5788 gimple_omp_teams_clauses (const gimple *gs)
5790 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5791 return omp_teams_stmt->clauses;
5795 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5797 static inline tree *
5798 gimple_omp_teams_clauses_ptr (gimple *gs)
5800 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5801 return &omp_teams_stmt->clauses;
5805 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5807 static inline void
5808 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5810 omp_teams_stmt->clauses = clauses;
5813 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5815 static inline bool
5816 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5818 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5821 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5823 static inline void
5824 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5826 if (value)
5827 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5828 else
5829 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5832 /* Return the clauses associated with OMP_SECTIONS GS. */
5834 static inline tree
5835 gimple_omp_sections_clauses (const gimple *gs)
5837 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5838 return omp_sections_stmt->clauses;
5842 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5844 static inline tree *
5845 gimple_omp_sections_clauses_ptr (gimple *gs)
5847 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5848 return &omp_sections_stmt->clauses;
5852 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5853 GS. */
5855 static inline void
5856 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5858 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5859 omp_sections_stmt->clauses = clauses;
5863 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5864 in GS. */
5866 static inline tree
5867 gimple_omp_sections_control (const gimple *gs)
5869 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5870 return omp_sections_stmt->control;
5874 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5875 GS. */
5877 static inline tree *
5878 gimple_omp_sections_control_ptr (gimple *gs)
5880 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5881 return &omp_sections_stmt->control;
5885 /* Set CONTROL to be the set of clauses associated with the
5886 GIMPLE_OMP_SECTIONS in GS. */
5888 static inline void
5889 gimple_omp_sections_set_control (gimple *gs, tree control)
5891 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5892 omp_sections_stmt->control = control;
5896 /* Set the value being stored in an atomic store. */
5898 static inline void
5899 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5901 store_stmt->val = val;
5905 /* Return the value being stored in an atomic store. */
5907 static inline tree
5908 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5910 return store_stmt->val;
5914 /* Return a pointer to the value being stored in an atomic store. */
5916 static inline tree *
5917 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5919 return &store_stmt->val;
5923 /* Set the LHS of an atomic load. */
5925 static inline void
5926 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5928 load_stmt->lhs = lhs;
5932 /* Get the LHS of an atomic load. */
5934 static inline tree
5935 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5937 return load_stmt->lhs;
5941 /* Return a pointer to the LHS of an atomic load. */
5943 static inline tree *
5944 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5946 return &load_stmt->lhs;
5950 /* Set the RHS of an atomic load. */
5952 static inline void
5953 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5955 load_stmt->rhs = rhs;
5959 /* Get the RHS of an atomic load. */
5961 static inline tree
5962 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5964 return load_stmt->rhs;
5968 /* Return a pointer to the RHS of an atomic load. */
5970 static inline tree *
5971 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5973 return &load_stmt->rhs;
5977 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5979 static inline tree
5980 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5982 return cont_stmt->control_def;
5985 /* The same as above, but return the address. */
5987 static inline tree *
5988 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5990 return &cont_stmt->control_def;
5993 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5995 static inline void
5996 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5998 cont_stmt->control_def = def;
6002 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6004 static inline tree
6005 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
6007 return cont_stmt->control_use;
6011 /* The same as above, but return the address. */
6013 static inline tree *
6014 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
6016 return &cont_stmt->control_use;
6020 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
6022 static inline void
6023 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
6025 cont_stmt->control_use = use;
6028 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
6029 TRANSACTION_STMT. */
6031 static inline gimple_seq *
6032 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
6034 return &transaction_stmt->body;
6037 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
6039 static inline gimple_seq
6040 gimple_transaction_body (gtransaction *transaction_stmt)
6042 return transaction_stmt->body;
6045 /* Return the label associated with a GIMPLE_TRANSACTION. */
6047 static inline tree
6048 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
6050 return transaction_stmt->label_norm;
6053 static inline tree *
6054 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
6056 return &transaction_stmt->label_norm;
6059 static inline tree
6060 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
6062 return transaction_stmt->label_uninst;
6065 static inline tree *
6066 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
6068 return &transaction_stmt->label_uninst;
6071 static inline tree
6072 gimple_transaction_label_over (const gtransaction *transaction_stmt)
6074 return transaction_stmt->label_over;
6077 static inline tree *
6078 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
6080 return &transaction_stmt->label_over;
6083 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
6085 static inline unsigned int
6086 gimple_transaction_subcode (const gtransaction *transaction_stmt)
6088 return transaction_stmt->subcode;
6091 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
6092 TRANSACTION_STMT. */
6094 static inline void
6095 gimple_transaction_set_body (gtransaction *transaction_stmt,
6096 gimple_seq body)
6098 transaction_stmt->body = body;
6101 /* Set the label associated with a GIMPLE_TRANSACTION. */
6103 static inline void
6104 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
6106 transaction_stmt->label_norm = label;
6109 static inline void
6110 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6112 transaction_stmt->label_uninst = label;
6115 static inline void
6116 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6118 transaction_stmt->label_over = label;
6121 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6123 static inline void
6124 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6125 unsigned int subcode)
6127 transaction_stmt->subcode = subcode;
6130 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6132 static inline tree *
6133 gimple_return_retval_ptr (greturn *gs)
6135 return &gs->op[0];
6138 /* Return the return value for GIMPLE_RETURN GS. */
6140 static inline tree
6141 gimple_return_retval (const greturn *gs)
6143 return gs->op[0];
6147 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6149 static inline void
6150 gimple_return_set_retval (greturn *gs, tree retval)
6152 gs->op[0] = retval;
6156 /* Return the return bounds for GIMPLE_RETURN GS. */
6158 static inline tree
6159 gimple_return_retbnd (const gimple *gs)
6161 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6162 return gimple_op (gs, 1);
6166 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6168 static inline void
6169 gimple_return_set_retbnd (gimple *gs, tree retval)
6171 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6172 gimple_set_op (gs, 1, retval);
6176 /* Returns true when the gimple statement STMT is any of the OMP types. */
6178 #define CASE_GIMPLE_OMP \
6179 case GIMPLE_OMP_PARALLEL: \
6180 case GIMPLE_OMP_TASK: \
6181 case GIMPLE_OMP_FOR: \
6182 case GIMPLE_OMP_SECTIONS: \
6183 case GIMPLE_OMP_SECTIONS_SWITCH: \
6184 case GIMPLE_OMP_SINGLE: \
6185 case GIMPLE_OMP_TARGET: \
6186 case GIMPLE_OMP_TEAMS: \
6187 case GIMPLE_OMP_SECTION: \
6188 case GIMPLE_OMP_MASTER: \
6189 case GIMPLE_OMP_TASKGROUP: \
6190 case GIMPLE_OMP_ORDERED: \
6191 case GIMPLE_OMP_CRITICAL: \
6192 case GIMPLE_OMP_RETURN: \
6193 case GIMPLE_OMP_ATOMIC_LOAD: \
6194 case GIMPLE_OMP_ATOMIC_STORE: \
6195 case GIMPLE_OMP_CONTINUE: \
6196 case GIMPLE_OMP_GRID_BODY
6198 static inline bool
6199 is_gimple_omp (const gimple *stmt)
6201 switch (gimple_code (stmt))
6203 CASE_GIMPLE_OMP:
6204 return true;
6205 default:
6206 return false;
6210 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6211 specifically. */
6213 static inline bool
6214 is_gimple_omp_oacc (const gimple *stmt)
6216 gcc_assert (is_gimple_omp (stmt));
6217 switch (gimple_code (stmt))
6219 case GIMPLE_OMP_FOR:
6220 switch (gimple_omp_for_kind (stmt))
6222 case GF_OMP_FOR_KIND_OACC_LOOP:
6223 return true;
6224 default:
6225 return false;
6227 case GIMPLE_OMP_TARGET:
6228 switch (gimple_omp_target_kind (stmt))
6230 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6231 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6232 case GF_OMP_TARGET_KIND_OACC_DATA:
6233 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6234 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6235 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6236 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6237 return true;
6238 default:
6239 return false;
6241 default:
6242 return false;
6247 /* Return true if the OMP gimple statement STMT is offloaded. */
6249 static inline bool
6250 is_gimple_omp_offloaded (const gimple *stmt)
6252 gcc_assert (is_gimple_omp (stmt));
6253 switch (gimple_code (stmt))
6255 case GIMPLE_OMP_TARGET:
6256 switch (gimple_omp_target_kind (stmt))
6258 case GF_OMP_TARGET_KIND_REGION:
6259 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6260 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6261 return true;
6262 default:
6263 return false;
6265 default:
6266 return false;
6271 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6273 static inline bool
6274 gimple_nop_p (const gimple *g)
6276 return gimple_code (g) == GIMPLE_NOP;
6280 /* Return true if GS is a GIMPLE_RESX. */
6282 static inline bool
6283 is_gimple_resx (const gimple *gs)
6285 return gimple_code (gs) == GIMPLE_RESX;
6288 /* Return the type of the main expression computed by STMT. Return
6289 void_type_node if the statement computes nothing. */
6291 static inline tree
6292 gimple_expr_type (const gimple *stmt)
6294 enum gimple_code code = gimple_code (stmt);
6295 /* In general we want to pass out a type that can be substituted
6296 for both the RHS and the LHS types if there is a possibly
6297 useless conversion involved. That means returning the
6298 original RHS type as far as we can reconstruct it. */
6299 if (code == GIMPLE_CALL)
6301 const gcall *call_stmt = as_a <const gcall *> (stmt);
6302 if (gimple_call_internal_p (call_stmt)
6303 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6304 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6305 else
6306 return gimple_call_return_type (call_stmt);
6308 else if (code == GIMPLE_ASSIGN)
6310 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6311 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6312 else
6313 /* As fallback use the type of the LHS. */
6314 return TREE_TYPE (gimple_get_lhs (stmt));
6316 else if (code == GIMPLE_COND)
6317 return boolean_type_node;
6318 else
6319 return void_type_node;
6322 /* Enum and arrays used for allocation stats. Keep in sync with
6323 gimple.c:gimple_alloc_kind_names. */
6324 enum gimple_alloc_kind
6326 gimple_alloc_kind_assign, /* Assignments. */
6327 gimple_alloc_kind_phi, /* PHI nodes. */
6328 gimple_alloc_kind_cond, /* Conditionals. */
6329 gimple_alloc_kind_rest, /* Everything else. */
6330 gimple_alloc_kind_all
6333 extern int gimple_alloc_counts[];
6334 extern int gimple_alloc_sizes[];
6336 /* Return the allocation kind for a given stmt CODE. */
6337 static inline enum gimple_alloc_kind
6338 gimple_alloc_kind (enum gimple_code code)
6340 switch (code)
6342 case GIMPLE_ASSIGN:
6343 return gimple_alloc_kind_assign;
6344 case GIMPLE_PHI:
6345 return gimple_alloc_kind_phi;
6346 case GIMPLE_COND:
6347 return gimple_alloc_kind_cond;
6348 default:
6349 return gimple_alloc_kind_rest;
6353 /* Return true if a location should not be emitted for this statement
6354 by annotate_all_with_location. */
6356 static inline bool
6357 gimple_do_not_emit_location_p (gimple *g)
6359 return gimple_plf (g, GF_PLF_1);
6362 /* Mark statement G so a location will not be emitted by
6363 annotate_one_with_location. */
6365 static inline void
6366 gimple_set_do_not_emit_location (gimple *g)
6368 /* The PLF flags are initialized to 0 when a new tuple is created,
6369 so no need to initialize it anywhere. */
6370 gimple_set_plf (g, GF_PLF_1, true);
6374 /* Macros for showing usage statistics. */
6375 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6376 ? (x) \
6377 : ((x) < 1024*1024*10 \
6378 ? (x) / 1024 \
6379 : (x) / (1024*1024))))
6381 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6383 #endif /* GCC_GIMPLE_H */