Implement C _FloatN, _FloatNx types.
[official-gcc.git] / gcc / gimple.h
blob980bdf8314c4481e979178d5a23688dd31d5d966
1 /* Gimple IR definitions.
3 Copyright (C) 2007-2016 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef GCC_GIMPLE_H
23 #define GCC_GIMPLE_H
25 #include "tree-ssa-alias.h"
26 #include "gimple-expr.h"
28 typedef gimple *gimple_seq_node;
30 enum gimple_code {
31 #define DEFGSCODE(SYM, STRING, STRUCT) SYM,
32 #include "gimple.def"
33 #undef DEFGSCODE
34 LAST_AND_UNUSED_GIMPLE_CODE
37 extern const char *const gimple_code_name[];
38 extern const unsigned char gimple_rhs_class_table[];
40 /* Strip the outermost pointer, from tr1/type_traits. */
41 template<typename T> struct remove_pointer { typedef T type; };
42 template<typename T> struct remove_pointer<T *> { typedef T type; };
44 /* Error out if a gimple tuple is addressed incorrectly. */
45 #if defined ENABLE_GIMPLE_CHECKING
46 #define gcc_gimple_checking_assert(EXPR) gcc_assert (EXPR)
47 extern void gimple_check_failed (const gimple *, const char *, int, \
48 const char *, enum gimple_code, \
49 enum tree_code) ATTRIBUTE_NORETURN;
51 #define GIMPLE_CHECK(GS, CODE) \
52 do { \
53 const gimple *__gs = (GS); \
54 if (gimple_code (__gs) != (CODE)) \
55 gimple_check_failed (__gs, __FILE__, __LINE__, __FUNCTION__, \
56 (CODE), ERROR_MARK); \
57 } while (0)
58 template <typename T>
59 static inline T
60 GIMPLE_CHECK2(const gimple *gs,
61 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
62 const char *file = __builtin_FILE (),
63 int line = __builtin_LINE (),
64 const char *fun = __builtin_FUNCTION ())
65 #else
66 const char *file = __FILE__,
67 int line = __LINE__,
68 const char *fun = NULL)
69 #endif
71 T ret = dyn_cast <T> (gs);
72 if (!ret)
73 gimple_check_failed (gs, file, line, fun,
74 remove_pointer<T>::type::code_, ERROR_MARK);
75 return ret;
77 template <typename T>
78 static inline T
79 GIMPLE_CHECK2(gimple *gs,
80 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
81 const char *file = __builtin_FILE (),
82 int line = __builtin_LINE (),
83 const char *fun = __builtin_FUNCTION ())
84 #else
85 const char *file = __FILE__,
86 int line = __LINE__,
87 const char *fun = NULL)
88 #endif
90 T ret = dyn_cast <T> (gs);
91 if (!ret)
92 gimple_check_failed (gs, file, line, fun,
93 remove_pointer<T>::type::code_, ERROR_MARK);
94 return ret;
96 #else /* not ENABLE_GIMPLE_CHECKING */
97 #define gcc_gimple_checking_assert(EXPR) ((void)(0 && (EXPR)))
98 #define GIMPLE_CHECK(GS, CODE) (void)0
99 template <typename T>
100 static inline T
101 GIMPLE_CHECK2(gimple *gs)
103 return as_a <T> (gs);
105 template <typename T>
106 static inline T
107 GIMPLE_CHECK2(const gimple *gs)
109 return as_a <T> (gs);
111 #endif
113 /* Class of GIMPLE expressions suitable for the RHS of assignments. See
114 get_gimple_rhs_class. */
115 enum gimple_rhs_class
117 GIMPLE_INVALID_RHS, /* The expression cannot be used on the RHS. */
118 GIMPLE_TERNARY_RHS, /* The expression is a ternary operation. */
119 GIMPLE_BINARY_RHS, /* The expression is a binary operation. */
120 GIMPLE_UNARY_RHS, /* The expression is a unary operation. */
121 GIMPLE_SINGLE_RHS /* The expression is a single object (an SSA
122 name, a _DECL, a _REF, etc. */
125 /* Specific flags for individual GIMPLE statements. These flags are
126 always stored in gimple.subcode and they may only be
127 defined for statement codes that do not use subcodes.
129 Values for the masks can overlap as long as the overlapping values
130 are never used in the same statement class.
132 The maximum mask value that can be defined is 1 << 15 (i.e., each
133 statement code can hold up to 16 bitflags).
135 Keep this list sorted. */
136 enum gf_mask {
137 GF_ASM_INPUT = 1 << 0,
138 GF_ASM_VOLATILE = 1 << 1,
139 GF_CALL_FROM_THUNK = 1 << 0,
140 GF_CALL_RETURN_SLOT_OPT = 1 << 1,
141 GF_CALL_TAILCALL = 1 << 2,
142 GF_CALL_VA_ARG_PACK = 1 << 3,
143 GF_CALL_NOTHROW = 1 << 4,
144 GF_CALL_ALLOCA_FOR_VAR = 1 << 5,
145 GF_CALL_INTERNAL = 1 << 6,
146 GF_CALL_CTRL_ALTERING = 1 << 7,
147 GF_CALL_WITH_BOUNDS = 1 << 8,
148 GF_CALL_MUST_TAIL_CALL = 1 << 9,
149 GF_OMP_PARALLEL_COMBINED = 1 << 0,
150 GF_OMP_PARALLEL_GRID_PHONY = 1 << 1,
151 GF_OMP_TASK_TASKLOOP = 1 << 0,
152 GF_OMP_FOR_KIND_MASK = (1 << 4) - 1,
153 GF_OMP_FOR_KIND_FOR = 0,
154 GF_OMP_FOR_KIND_DISTRIBUTE = 1,
155 GF_OMP_FOR_KIND_TASKLOOP = 2,
156 GF_OMP_FOR_KIND_CILKFOR = 3,
157 GF_OMP_FOR_KIND_OACC_LOOP = 4,
158 GF_OMP_FOR_KIND_GRID_LOOP = 5,
159 /* Flag for SIMD variants of OMP_FOR kinds. */
160 GF_OMP_FOR_SIMD = 1 << 3,
161 GF_OMP_FOR_KIND_SIMD = GF_OMP_FOR_SIMD | 0,
162 GF_OMP_FOR_KIND_CILKSIMD = GF_OMP_FOR_SIMD | 1,
163 GF_OMP_FOR_COMBINED = 1 << 4,
164 GF_OMP_FOR_COMBINED_INTO = 1 << 5,
165 GF_OMP_FOR_GRID_PHONY = 1 << 6,
166 GF_OMP_TARGET_KIND_MASK = (1 << 4) - 1,
167 GF_OMP_TARGET_KIND_REGION = 0,
168 GF_OMP_TARGET_KIND_DATA = 1,
169 GF_OMP_TARGET_KIND_UPDATE = 2,
170 GF_OMP_TARGET_KIND_ENTER_DATA = 3,
171 GF_OMP_TARGET_KIND_EXIT_DATA = 4,
172 GF_OMP_TARGET_KIND_OACC_PARALLEL = 5,
173 GF_OMP_TARGET_KIND_OACC_KERNELS = 6,
174 GF_OMP_TARGET_KIND_OACC_DATA = 7,
175 GF_OMP_TARGET_KIND_OACC_UPDATE = 8,
176 GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA = 9,
177 GF_OMP_TARGET_KIND_OACC_DECLARE = 10,
178 GF_OMP_TARGET_KIND_OACC_HOST_DATA = 11,
179 GF_OMP_TEAMS_GRID_PHONY = 1 << 0,
181 /* True on an GIMPLE_OMP_RETURN statement if the return does not require
182 a thread synchronization via some sort of barrier. The exact barrier
183 that would otherwise be emitted is dependent on the OMP statement with
184 which this return is associated. */
185 GF_OMP_RETURN_NOWAIT = 1 << 0,
187 GF_OMP_SECTION_LAST = 1 << 0,
188 GF_OMP_ATOMIC_NEED_VALUE = 1 << 0,
189 GF_OMP_ATOMIC_SEQ_CST = 1 << 1,
190 GF_PREDICT_TAKEN = 1 << 15
193 /* Currently, there are only two types of gimple debug stmt. Others are
194 envisioned, for example, to enable the generation of is_stmt notes
195 in line number information, to mark sequence points, etc. This
196 subcode is to be used to tell them apart. */
197 enum gimple_debug_subcode {
198 GIMPLE_DEBUG_BIND = 0,
199 GIMPLE_DEBUG_SOURCE_BIND = 1
202 /* Masks for selecting a pass local flag (PLF) to work on. These
203 masks are used by gimple_set_plf and gimple_plf. */
204 enum plf_mask {
205 GF_PLF_1 = 1 << 0,
206 GF_PLF_2 = 1 << 1
209 /* Data structure definitions for GIMPLE tuples. NOTE: word markers
210 are for 64 bit hosts. */
212 struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
213 chain_next ("%h.next"), variable_size))
214 gimple
216 /* [ WORD 1 ]
217 Main identifying code for a tuple. */
218 ENUM_BITFIELD(gimple_code) code : 8;
220 /* Nonzero if a warning should not be emitted on this tuple. */
221 unsigned int no_warning : 1;
223 /* Nonzero if this tuple has been visited. Passes are responsible
224 for clearing this bit before using it. */
225 unsigned int visited : 1;
227 /* Nonzero if this tuple represents a non-temporal move. */
228 unsigned int nontemporal_move : 1;
230 /* Pass local flags. These flags are free for any pass to use as
231 they see fit. Passes should not assume that these flags contain
232 any useful value when the pass starts. Any initial state that
233 the pass requires should be set on entry to the pass. See
234 gimple_set_plf and gimple_plf for usage. */
235 unsigned int plf : 2;
237 /* Nonzero if this statement has been modified and needs to have its
238 operands rescanned. */
239 unsigned modified : 1;
241 /* Nonzero if this statement contains volatile operands. */
242 unsigned has_volatile_ops : 1;
244 /* Padding to get subcode to 16 bit alignment. */
245 unsigned pad : 1;
247 /* The SUBCODE field can be used for tuple-specific flags for tuples
248 that do not require subcodes. Note that SUBCODE should be at
249 least as wide as tree codes, as several tuples store tree codes
250 in there. */
251 unsigned int subcode : 16;
253 /* UID of this statement. This is used by passes that want to
254 assign IDs to statements. It must be assigned and used by each
255 pass. By default it should be assumed to contain garbage. */
256 unsigned uid;
258 /* [ WORD 2 ]
259 Locus information for debug info. */
260 location_t location;
262 /* Number of operands in this tuple. */
263 unsigned num_ops;
265 /* [ WORD 3 ]
266 Basic block holding this statement. */
267 basic_block bb;
269 /* [ WORD 4-5 ]
270 Linked lists of gimple statements. The next pointers form
271 a NULL terminated list, the prev pointers are a cyclic list.
272 A gimple statement is hence also a double-ended list of
273 statements, with the pointer itself being the first element,
274 and the prev pointer being the last. */
275 gimple *next;
276 gimple *GTY((skip)) prev;
280 /* Base structure for tuples with operands. */
282 /* This gimple subclass has no tag value. */
283 struct GTY(())
284 gimple_statement_with_ops_base : public gimple
286 /* [ WORD 1-6 ] : base class */
288 /* [ WORD 7 ]
289 SSA operand vectors. NOTE: It should be possible to
290 amalgamate these vectors with the operand vector OP. However,
291 the SSA operand vectors are organized differently and contain
292 more information (like immediate use chaining). */
293 struct use_optype_d GTY((skip (""))) *use_ops;
297 /* Statements that take register operands. */
299 struct GTY((tag("GSS_WITH_OPS")))
300 gimple_statement_with_ops : public gimple_statement_with_ops_base
302 /* [ WORD 1-7 ] : base class */
304 /* [ WORD 8 ]
305 Operand vector. NOTE! This must always be the last field
306 of this structure. In particular, this means that this
307 structure cannot be embedded inside another one. */
308 tree GTY((length ("%h.num_ops"))) op[1];
312 /* Base for statements that take both memory and register operands. */
314 struct GTY((tag("GSS_WITH_MEM_OPS_BASE")))
315 gimple_statement_with_memory_ops_base : public gimple_statement_with_ops_base
317 /* [ WORD 1-7 ] : base class */
319 /* [ WORD 8-9 ]
320 Virtual operands for this statement. The GC will pick them
321 up via the ssa_names array. */
322 tree GTY((skip (""))) vdef;
323 tree GTY((skip (""))) vuse;
327 /* Statements that take both memory and register operands. */
329 struct GTY((tag("GSS_WITH_MEM_OPS")))
330 gimple_statement_with_memory_ops :
331 public gimple_statement_with_memory_ops_base
333 /* [ WORD 1-9 ] : base class */
335 /* [ WORD 10 ]
336 Operand vector. NOTE! This must always be the last field
337 of this structure. In particular, this means that this
338 structure cannot be embedded inside another one. */
339 tree GTY((length ("%h.num_ops"))) op[1];
343 /* Call statements that take both memory and register operands. */
345 struct GTY((tag("GSS_CALL")))
346 gcall : public gimple_statement_with_memory_ops_base
348 /* [ WORD 1-9 ] : base class */
350 /* [ WORD 10-13 ] */
351 struct pt_solution call_used;
352 struct pt_solution call_clobbered;
354 /* [ WORD 14 ] */
355 union GTY ((desc ("%1.subcode & GF_CALL_INTERNAL"))) {
356 tree GTY ((tag ("0"))) fntype;
357 enum internal_fn GTY ((tag ("GF_CALL_INTERNAL"))) internal_fn;
358 } u;
360 /* [ WORD 15 ]
361 Operand vector. NOTE! This must always be the last field
362 of this structure. In particular, this means that this
363 structure cannot be embedded inside another one. */
364 tree GTY((length ("%h.num_ops"))) op[1];
366 static const enum gimple_code code_ = GIMPLE_CALL;
370 /* OMP statements. */
372 struct GTY((tag("GSS_OMP")))
373 gimple_statement_omp : public gimple
375 /* [ WORD 1-6 ] : base class */
377 /* [ WORD 7 ] */
378 gimple_seq body;
382 /* GIMPLE_BIND */
384 struct GTY((tag("GSS_BIND")))
385 gbind : public gimple
387 /* [ WORD 1-6 ] : base class */
389 /* [ WORD 7 ]
390 Variables declared in this scope. */
391 tree vars;
393 /* [ WORD 8 ]
394 This is different than the BLOCK field in gimple,
395 which is analogous to TREE_BLOCK (i.e., the lexical block holding
396 this statement). This field is the equivalent of BIND_EXPR_BLOCK
397 in tree land (i.e., the lexical scope defined by this bind). See
398 gimple-low.c. */
399 tree block;
401 /* [ WORD 9 ] */
402 gimple_seq body;
406 /* GIMPLE_CATCH */
408 struct GTY((tag("GSS_CATCH")))
409 gcatch : public gimple
411 /* [ WORD 1-6 ] : base class */
413 /* [ WORD 7 ] */
414 tree types;
416 /* [ WORD 8 ] */
417 gimple_seq handler;
421 /* GIMPLE_EH_FILTER */
423 struct GTY((tag("GSS_EH_FILTER")))
424 geh_filter : public gimple
426 /* [ WORD 1-6 ] : base class */
428 /* [ WORD 7 ]
429 Filter types. */
430 tree types;
432 /* [ WORD 8 ]
433 Failure actions. */
434 gimple_seq failure;
437 /* GIMPLE_EH_ELSE */
439 struct GTY((tag("GSS_EH_ELSE")))
440 geh_else : public gimple
442 /* [ WORD 1-6 ] : base class */
444 /* [ WORD 7,8 ] */
445 gimple_seq n_body, e_body;
448 /* GIMPLE_EH_MUST_NOT_THROW */
450 struct GTY((tag("GSS_EH_MNT")))
451 geh_mnt : public gimple
453 /* [ WORD 1-6 ] : base class */
455 /* [ WORD 7 ] Abort function decl. */
456 tree fndecl;
459 /* GIMPLE_PHI */
461 struct GTY((tag("GSS_PHI")))
462 gphi : public gimple
464 /* [ WORD 1-6 ] : base class */
466 /* [ WORD 7 ] */
467 unsigned capacity;
468 unsigned nargs;
470 /* [ WORD 8 ] */
471 tree result;
473 /* [ WORD 9 ] */
474 struct phi_arg_d GTY ((length ("%h.nargs"))) args[1];
478 /* GIMPLE_RESX, GIMPLE_EH_DISPATCH */
480 struct GTY((tag("GSS_EH_CTRL")))
481 gimple_statement_eh_ctrl : public gimple
483 /* [ WORD 1-6 ] : base class */
485 /* [ WORD 7 ]
486 Exception region number. */
487 int region;
490 struct GTY((tag("GSS_EH_CTRL")))
491 gresx : public gimple_statement_eh_ctrl
493 /* No extra fields; adds invariant:
494 stmt->code == GIMPLE_RESX. */
497 struct GTY((tag("GSS_EH_CTRL")))
498 geh_dispatch : public gimple_statement_eh_ctrl
500 /* No extra fields; adds invariant:
501 stmt->code == GIMPLE_EH_DISPATH. */
505 /* GIMPLE_TRY */
507 struct GTY((tag("GSS_TRY")))
508 gtry : public gimple
510 /* [ WORD 1-6 ] : base class */
512 /* [ WORD 7 ]
513 Expression to evaluate. */
514 gimple_seq eval;
516 /* [ WORD 8 ]
517 Cleanup expression. */
518 gimple_seq cleanup;
521 /* Kind of GIMPLE_TRY statements. */
522 enum gimple_try_flags
524 /* A try/catch. */
525 GIMPLE_TRY_CATCH = 1 << 0,
527 /* A try/finally. */
528 GIMPLE_TRY_FINALLY = 1 << 1,
529 GIMPLE_TRY_KIND = GIMPLE_TRY_CATCH | GIMPLE_TRY_FINALLY,
531 /* Analogous to TRY_CATCH_IS_CLEANUP. */
532 GIMPLE_TRY_CATCH_IS_CLEANUP = 1 << 2
535 /* GIMPLE_WITH_CLEANUP_EXPR */
537 struct GTY((tag("GSS_WCE")))
538 gimple_statement_wce : public gimple
540 /* [ WORD 1-6 ] : base class */
542 /* Subcode: CLEANUP_EH_ONLY. True if the cleanup should only be
543 executed if an exception is thrown, not on normal exit of its
544 scope. This flag is analogous to the CLEANUP_EH_ONLY flag
545 in TARGET_EXPRs. */
547 /* [ WORD 7 ]
548 Cleanup expression. */
549 gimple_seq cleanup;
553 /* GIMPLE_ASM */
555 struct GTY((tag("GSS_ASM")))
556 gasm : public gimple_statement_with_memory_ops_base
558 /* [ WORD 1-9 ] : base class */
560 /* [ WORD 10 ]
561 __asm__ statement. */
562 const char *string;
564 /* [ WORD 11 ]
565 Number of inputs, outputs, clobbers, labels. */
566 unsigned char ni;
567 unsigned char no;
568 unsigned char nc;
569 unsigned char nl;
571 /* [ WORD 12 ]
572 Operand vector. NOTE! This must always be the last field
573 of this structure. In particular, this means that this
574 structure cannot be embedded inside another one. */
575 tree GTY((length ("%h.num_ops"))) op[1];
578 /* GIMPLE_OMP_CRITICAL */
580 struct GTY((tag("GSS_OMP_CRITICAL")))
581 gomp_critical : public gimple_statement_omp
583 /* [ WORD 1-7 ] : base class */
585 /* [ WORD 8 ] */
586 tree clauses;
588 /* [ WORD 9 ]
589 Critical section name. */
590 tree name;
594 struct GTY(()) gimple_omp_for_iter {
595 /* Condition code. */
596 enum tree_code cond;
598 /* Index variable. */
599 tree index;
601 /* Initial value. */
602 tree initial;
604 /* Final value. */
605 tree final;
607 /* Increment. */
608 tree incr;
611 /* GIMPLE_OMP_FOR */
613 struct GTY((tag("GSS_OMP_FOR")))
614 gomp_for : public gimple_statement_omp
616 /* [ WORD 1-7 ] : base class */
618 /* [ WORD 8 ] */
619 tree clauses;
621 /* [ WORD 9 ]
622 Number of elements in iter array. */
623 size_t collapse;
625 /* [ WORD 10 ] */
626 struct gimple_omp_for_iter * GTY((length ("%h.collapse"))) iter;
628 /* [ WORD 11 ]
629 Pre-body evaluated before the loop body begins. */
630 gimple_seq pre_body;
634 /* GIMPLE_OMP_PARALLEL, GIMPLE_OMP_TARGET, GIMPLE_OMP_TASK */
636 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
637 gimple_statement_omp_parallel_layout : public gimple_statement_omp
639 /* [ WORD 1-7 ] : base class */
641 /* [ WORD 8 ]
642 Clauses. */
643 tree clauses;
645 /* [ WORD 9 ]
646 Child function holding the body of the parallel region. */
647 tree child_fn;
649 /* [ WORD 10 ]
650 Shared data argument. */
651 tree data_arg;
654 /* GIMPLE_OMP_PARALLEL or GIMPLE_TASK */
655 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
656 gimple_statement_omp_taskreg : public gimple_statement_omp_parallel_layout
658 /* No extra fields; adds invariant:
659 stmt->code == GIMPLE_OMP_PARALLEL
660 || stmt->code == GIMPLE_OMP_TASK. */
663 /* GIMPLE_OMP_PARALLEL */
664 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
665 gomp_parallel : public gimple_statement_omp_taskreg
667 /* No extra fields; adds invariant:
668 stmt->code == GIMPLE_OMP_PARALLEL. */
671 /* GIMPLE_OMP_TARGET */
672 struct GTY((tag("GSS_OMP_PARALLEL_LAYOUT")))
673 gomp_target : public gimple_statement_omp_parallel_layout
675 /* No extra fields; adds invariant:
676 stmt->code == GIMPLE_OMP_TARGET. */
679 /* GIMPLE_OMP_TASK */
681 struct GTY((tag("GSS_OMP_TASK")))
682 gomp_task : public gimple_statement_omp_taskreg
684 /* [ WORD 1-10 ] : base class */
686 /* [ WORD 11 ]
687 Child function holding firstprivate initialization if needed. */
688 tree copy_fn;
690 /* [ WORD 12-13 ]
691 Size and alignment in bytes of the argument data block. */
692 tree arg_size;
693 tree arg_align;
697 /* GIMPLE_OMP_SECTION */
698 /* Uses struct gimple_statement_omp. */
701 /* GIMPLE_OMP_SECTIONS */
703 struct GTY((tag("GSS_OMP_SECTIONS")))
704 gomp_sections : public gimple_statement_omp
706 /* [ WORD 1-7 ] : base class */
708 /* [ WORD 8 ] */
709 tree clauses;
711 /* [ WORD 9 ]
712 The control variable used for deciding which of the sections to
713 execute. */
714 tree control;
717 /* GIMPLE_OMP_CONTINUE.
719 Note: This does not inherit from gimple_statement_omp, because we
720 do not need the body field. */
722 struct GTY((tag("GSS_OMP_CONTINUE")))
723 gomp_continue : public gimple
725 /* [ WORD 1-6 ] : base class */
727 /* [ WORD 7 ] */
728 tree control_def;
730 /* [ WORD 8 ] */
731 tree control_use;
734 /* GIMPLE_OMP_SINGLE, GIMPLE_OMP_TEAMS, GIMPLE_OMP_ORDERED */
736 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
737 gimple_statement_omp_single_layout : public gimple_statement_omp
739 /* [ WORD 1-7 ] : base class */
741 /* [ WORD 8 ] */
742 tree clauses;
745 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
746 gomp_single : public gimple_statement_omp_single_layout
748 /* No extra fields; adds invariant:
749 stmt->code == GIMPLE_OMP_SINGLE. */
752 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
753 gomp_teams : public gimple_statement_omp_single_layout
755 /* No extra fields; adds invariant:
756 stmt->code == GIMPLE_OMP_TEAMS. */
759 struct GTY((tag("GSS_OMP_SINGLE_LAYOUT")))
760 gomp_ordered : public gimple_statement_omp_single_layout
762 /* No extra fields; adds invariant:
763 stmt->code == GIMPLE_OMP_ORDERED. */
767 /* GIMPLE_OMP_ATOMIC_LOAD.
768 Note: This is based on gimple, not g_s_omp, because g_s_omp
769 contains a sequence, which we don't need here. */
771 struct GTY((tag("GSS_OMP_ATOMIC_LOAD")))
772 gomp_atomic_load : public gimple
774 /* [ WORD 1-6 ] : base class */
776 /* [ WORD 7-8 ] */
777 tree rhs, lhs;
780 /* GIMPLE_OMP_ATOMIC_STORE.
781 See note on GIMPLE_OMP_ATOMIC_LOAD. */
783 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
784 gimple_statement_omp_atomic_store_layout : public gimple
786 /* [ WORD 1-6 ] : base class */
788 /* [ WORD 7 ] */
789 tree val;
792 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
793 gomp_atomic_store :
794 public gimple_statement_omp_atomic_store_layout
796 /* No extra fields; adds invariant:
797 stmt->code == GIMPLE_OMP_ATOMIC_STORE. */
800 struct GTY((tag("GSS_OMP_ATOMIC_STORE_LAYOUT")))
801 gimple_statement_omp_return :
802 public gimple_statement_omp_atomic_store_layout
804 /* No extra fields; adds invariant:
805 stmt->code == GIMPLE_OMP_RETURN. */
808 /* GIMPLE_TRANSACTION. */
810 /* Bits to be stored in the GIMPLE_TRANSACTION subcode. */
812 /* The __transaction_atomic was declared [[outer]] or it is
813 __transaction_relaxed. */
814 #define GTMA_IS_OUTER (1u << 0)
815 #define GTMA_IS_RELAXED (1u << 1)
816 #define GTMA_DECLARATION_MASK (GTMA_IS_OUTER | GTMA_IS_RELAXED)
818 /* The transaction is seen to not have an abort. */
819 #define GTMA_HAVE_ABORT (1u << 2)
820 /* The transaction is seen to have loads or stores. */
821 #define GTMA_HAVE_LOAD (1u << 3)
822 #define GTMA_HAVE_STORE (1u << 4)
823 /* The transaction MAY enter serial irrevocable mode in its dynamic scope. */
824 #define GTMA_MAY_ENTER_IRREVOCABLE (1u << 5)
825 /* The transaction WILL enter serial irrevocable mode.
826 An irrevocable block post-dominates the entire transaction, such
827 that all invocations of the transaction will go serial-irrevocable.
828 In such case, we don't bother instrumenting the transaction, and
829 tell the runtime that it should begin the transaction in
830 serial-irrevocable mode. */
831 #define GTMA_DOES_GO_IRREVOCABLE (1u << 6)
832 /* The transaction contains no instrumentation code whatsover, most
833 likely because it is guaranteed to go irrevocable upon entry. */
834 #define GTMA_HAS_NO_INSTRUMENTATION (1u << 7)
836 struct GTY((tag("GSS_TRANSACTION")))
837 gtransaction : public gimple_statement_with_memory_ops_base
839 /* [ WORD 1-9 ] : base class */
841 /* [ WORD 10 ] */
842 gimple_seq body;
844 /* [ WORD 11-13 ] */
845 tree label_norm;
846 tree label_uninst;
847 tree label_over;
850 #define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) SYM,
851 enum gimple_statement_structure_enum {
852 #include "gsstruct.def"
853 LAST_GSS_ENUM
855 #undef DEFGSSTRUCT
857 /* A statement with the invariant that
858 stmt->code == GIMPLE_COND
859 i.e. a conditional jump statement. */
861 struct GTY((tag("GSS_WITH_OPS")))
862 gcond : public gimple_statement_with_ops
864 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
865 static const enum gimple_code code_ = GIMPLE_COND;
868 /* A statement with the invariant that
869 stmt->code == GIMPLE_DEBUG
870 i.e. a debug statement. */
872 struct GTY((tag("GSS_WITH_OPS")))
873 gdebug : public gimple_statement_with_ops
875 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
878 /* A statement with the invariant that
879 stmt->code == GIMPLE_GOTO
880 i.e. a goto statement. */
882 struct GTY((tag("GSS_WITH_OPS")))
883 ggoto : public gimple_statement_with_ops
885 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
888 /* A statement with the invariant that
889 stmt->code == GIMPLE_LABEL
890 i.e. a label statement. */
892 struct GTY((tag("GSS_WITH_OPS")))
893 glabel : public gimple_statement_with_ops
895 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
898 /* A statement with the invariant that
899 stmt->code == GIMPLE_SWITCH
900 i.e. a switch statement. */
902 struct GTY((tag("GSS_WITH_OPS")))
903 gswitch : public gimple_statement_with_ops
905 /* no additional fields; this uses the layout for GSS_WITH_OPS. */
908 /* A statement with the invariant that
909 stmt->code == GIMPLE_ASSIGN
910 i.e. an assignment statement. */
912 struct GTY((tag("GSS_WITH_MEM_OPS")))
913 gassign : public gimple_statement_with_memory_ops
915 static const enum gimple_code code_ = GIMPLE_ASSIGN;
916 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
919 /* A statement with the invariant that
920 stmt->code == GIMPLE_RETURN
921 i.e. a return statement. */
923 struct GTY((tag("GSS_WITH_MEM_OPS")))
924 greturn : public gimple_statement_with_memory_ops
926 /* no additional fields; this uses the layout for GSS_WITH_MEM_OPS. */
929 template <>
930 template <>
931 inline bool
932 is_a_helper <gasm *>::test (gimple *gs)
934 return gs->code == GIMPLE_ASM;
937 template <>
938 template <>
939 inline bool
940 is_a_helper <gassign *>::test (gimple *gs)
942 return gs->code == GIMPLE_ASSIGN;
945 template <>
946 template <>
947 inline bool
948 is_a_helper <const gassign *>::test (const gimple *gs)
950 return gs->code == GIMPLE_ASSIGN;
953 template <>
954 template <>
955 inline bool
956 is_a_helper <gbind *>::test (gimple *gs)
958 return gs->code == GIMPLE_BIND;
961 template <>
962 template <>
963 inline bool
964 is_a_helper <gcall *>::test (gimple *gs)
966 return gs->code == GIMPLE_CALL;
969 template <>
970 template <>
971 inline bool
972 is_a_helper <gcatch *>::test (gimple *gs)
974 return gs->code == GIMPLE_CATCH;
977 template <>
978 template <>
979 inline bool
980 is_a_helper <gcond *>::test (gimple *gs)
982 return gs->code == GIMPLE_COND;
985 template <>
986 template <>
987 inline bool
988 is_a_helper <const gcond *>::test (const gimple *gs)
990 return gs->code == GIMPLE_COND;
993 template <>
994 template <>
995 inline bool
996 is_a_helper <gdebug *>::test (gimple *gs)
998 return gs->code == GIMPLE_DEBUG;
1001 template <>
1002 template <>
1003 inline bool
1004 is_a_helper <ggoto *>::test (gimple *gs)
1006 return gs->code == GIMPLE_GOTO;
1009 template <>
1010 template <>
1011 inline bool
1012 is_a_helper <glabel *>::test (gimple *gs)
1014 return gs->code == GIMPLE_LABEL;
1017 template <>
1018 template <>
1019 inline bool
1020 is_a_helper <gresx *>::test (gimple *gs)
1022 return gs->code == GIMPLE_RESX;
1025 template <>
1026 template <>
1027 inline bool
1028 is_a_helper <geh_dispatch *>::test (gimple *gs)
1030 return gs->code == GIMPLE_EH_DISPATCH;
1033 template <>
1034 template <>
1035 inline bool
1036 is_a_helper <geh_else *>::test (gimple *gs)
1038 return gs->code == GIMPLE_EH_ELSE;
1041 template <>
1042 template <>
1043 inline bool
1044 is_a_helper <geh_filter *>::test (gimple *gs)
1046 return gs->code == GIMPLE_EH_FILTER;
1049 template <>
1050 template <>
1051 inline bool
1052 is_a_helper <geh_mnt *>::test (gimple *gs)
1054 return gs->code == GIMPLE_EH_MUST_NOT_THROW;
1057 template <>
1058 template <>
1059 inline bool
1060 is_a_helper <gomp_atomic_load *>::test (gimple *gs)
1062 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1065 template <>
1066 template <>
1067 inline bool
1068 is_a_helper <gomp_atomic_store *>::test (gimple *gs)
1070 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1073 template <>
1074 template <>
1075 inline bool
1076 is_a_helper <gimple_statement_omp_return *>::test (gimple *gs)
1078 return gs->code == GIMPLE_OMP_RETURN;
1081 template <>
1082 template <>
1083 inline bool
1084 is_a_helper <gomp_continue *>::test (gimple *gs)
1086 return gs->code == GIMPLE_OMP_CONTINUE;
1089 template <>
1090 template <>
1091 inline bool
1092 is_a_helper <gomp_critical *>::test (gimple *gs)
1094 return gs->code == GIMPLE_OMP_CRITICAL;
1097 template <>
1098 template <>
1099 inline bool
1100 is_a_helper <gomp_ordered *>::test (gimple *gs)
1102 return gs->code == GIMPLE_OMP_ORDERED;
1105 template <>
1106 template <>
1107 inline bool
1108 is_a_helper <gomp_for *>::test (gimple *gs)
1110 return gs->code == GIMPLE_OMP_FOR;
1113 template <>
1114 template <>
1115 inline bool
1116 is_a_helper <gimple_statement_omp_taskreg *>::test (gimple *gs)
1118 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1121 template <>
1122 template <>
1123 inline bool
1124 is_a_helper <gomp_parallel *>::test (gimple *gs)
1126 return gs->code == GIMPLE_OMP_PARALLEL;
1129 template <>
1130 template <>
1131 inline bool
1132 is_a_helper <gomp_target *>::test (gimple *gs)
1134 return gs->code == GIMPLE_OMP_TARGET;
1137 template <>
1138 template <>
1139 inline bool
1140 is_a_helper <gomp_sections *>::test (gimple *gs)
1142 return gs->code == GIMPLE_OMP_SECTIONS;
1145 template <>
1146 template <>
1147 inline bool
1148 is_a_helper <gomp_single *>::test (gimple *gs)
1150 return gs->code == GIMPLE_OMP_SINGLE;
1153 template <>
1154 template <>
1155 inline bool
1156 is_a_helper <gomp_teams *>::test (gimple *gs)
1158 return gs->code == GIMPLE_OMP_TEAMS;
1161 template <>
1162 template <>
1163 inline bool
1164 is_a_helper <gomp_task *>::test (gimple *gs)
1166 return gs->code == GIMPLE_OMP_TASK;
1169 template <>
1170 template <>
1171 inline bool
1172 is_a_helper <gphi *>::test (gimple *gs)
1174 return gs->code == GIMPLE_PHI;
1177 template <>
1178 template <>
1179 inline bool
1180 is_a_helper <greturn *>::test (gimple *gs)
1182 return gs->code == GIMPLE_RETURN;
1185 template <>
1186 template <>
1187 inline bool
1188 is_a_helper <gswitch *>::test (gimple *gs)
1190 return gs->code == GIMPLE_SWITCH;
1193 template <>
1194 template <>
1195 inline bool
1196 is_a_helper <gtransaction *>::test (gimple *gs)
1198 return gs->code == GIMPLE_TRANSACTION;
1201 template <>
1202 template <>
1203 inline bool
1204 is_a_helper <gtry *>::test (gimple *gs)
1206 return gs->code == GIMPLE_TRY;
1209 template <>
1210 template <>
1211 inline bool
1212 is_a_helper <gimple_statement_wce *>::test (gimple *gs)
1214 return gs->code == GIMPLE_WITH_CLEANUP_EXPR;
1217 template <>
1218 template <>
1219 inline bool
1220 is_a_helper <const gasm *>::test (const gimple *gs)
1222 return gs->code == GIMPLE_ASM;
1225 template <>
1226 template <>
1227 inline bool
1228 is_a_helper <const gbind *>::test (const gimple *gs)
1230 return gs->code == GIMPLE_BIND;
1233 template <>
1234 template <>
1235 inline bool
1236 is_a_helper <const gcall *>::test (const gimple *gs)
1238 return gs->code == GIMPLE_CALL;
1241 template <>
1242 template <>
1243 inline bool
1244 is_a_helper <const gcatch *>::test (const gimple *gs)
1246 return gs->code == GIMPLE_CATCH;
1249 template <>
1250 template <>
1251 inline bool
1252 is_a_helper <const gresx *>::test (const gimple *gs)
1254 return gs->code == GIMPLE_RESX;
1257 template <>
1258 template <>
1259 inline bool
1260 is_a_helper <const geh_dispatch *>::test (const gimple *gs)
1262 return gs->code == GIMPLE_EH_DISPATCH;
1265 template <>
1266 template <>
1267 inline bool
1268 is_a_helper <const geh_filter *>::test (const gimple *gs)
1270 return gs->code == GIMPLE_EH_FILTER;
1273 template <>
1274 template <>
1275 inline bool
1276 is_a_helper <const gomp_atomic_load *>::test (const gimple *gs)
1278 return gs->code == GIMPLE_OMP_ATOMIC_LOAD;
1281 template <>
1282 template <>
1283 inline bool
1284 is_a_helper <const gomp_atomic_store *>::test (const gimple *gs)
1286 return gs->code == GIMPLE_OMP_ATOMIC_STORE;
1289 template <>
1290 template <>
1291 inline bool
1292 is_a_helper <const gimple_statement_omp_return *>::test (const gimple *gs)
1294 return gs->code == GIMPLE_OMP_RETURN;
1297 template <>
1298 template <>
1299 inline bool
1300 is_a_helper <const gomp_continue *>::test (const gimple *gs)
1302 return gs->code == GIMPLE_OMP_CONTINUE;
1305 template <>
1306 template <>
1307 inline bool
1308 is_a_helper <const gomp_critical *>::test (const gimple *gs)
1310 return gs->code == GIMPLE_OMP_CRITICAL;
1313 template <>
1314 template <>
1315 inline bool
1316 is_a_helper <const gomp_ordered *>::test (const gimple *gs)
1318 return gs->code == GIMPLE_OMP_ORDERED;
1321 template <>
1322 template <>
1323 inline bool
1324 is_a_helper <const gomp_for *>::test (const gimple *gs)
1326 return gs->code == GIMPLE_OMP_FOR;
1329 template <>
1330 template <>
1331 inline bool
1332 is_a_helper <const gimple_statement_omp_taskreg *>::test (const gimple *gs)
1334 return gs->code == GIMPLE_OMP_PARALLEL || gs->code == GIMPLE_OMP_TASK;
1337 template <>
1338 template <>
1339 inline bool
1340 is_a_helper <const gomp_parallel *>::test (const gimple *gs)
1342 return gs->code == GIMPLE_OMP_PARALLEL;
1345 template <>
1346 template <>
1347 inline bool
1348 is_a_helper <const gomp_target *>::test (const gimple *gs)
1350 return gs->code == GIMPLE_OMP_TARGET;
1353 template <>
1354 template <>
1355 inline bool
1356 is_a_helper <const gomp_sections *>::test (const gimple *gs)
1358 return gs->code == GIMPLE_OMP_SECTIONS;
1361 template <>
1362 template <>
1363 inline bool
1364 is_a_helper <const gomp_single *>::test (const gimple *gs)
1366 return gs->code == GIMPLE_OMP_SINGLE;
1369 template <>
1370 template <>
1371 inline bool
1372 is_a_helper <const gomp_teams *>::test (const gimple *gs)
1374 return gs->code == GIMPLE_OMP_TEAMS;
1377 template <>
1378 template <>
1379 inline bool
1380 is_a_helper <const gomp_task *>::test (const gimple *gs)
1382 return gs->code == GIMPLE_OMP_TASK;
1385 template <>
1386 template <>
1387 inline bool
1388 is_a_helper <const gphi *>::test (const gimple *gs)
1390 return gs->code == GIMPLE_PHI;
1393 template <>
1394 template <>
1395 inline bool
1396 is_a_helper <const gtransaction *>::test (const gimple *gs)
1398 return gs->code == GIMPLE_TRANSACTION;
1401 /* Offset in bytes to the location of the operand vector.
1402 Zero if there is no operand vector for this tuple structure. */
1403 extern size_t const gimple_ops_offset_[];
1405 /* Map GIMPLE codes to GSS codes. */
1406 extern enum gimple_statement_structure_enum const gss_for_code_[];
1408 /* This variable holds the currently expanded gimple statement for purposes
1409 of comminucating the profile info to the builtin expanders. */
1410 extern gimple *currently_expanding_gimple_stmt;
1412 #define gimple_alloc(c, n) gimple_alloc_stat (c, n MEM_STAT_INFO)
1413 gimple *gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
1414 greturn *gimple_build_return (tree);
1415 void gimple_call_reset_alias_info (gcall *);
1416 gcall *gimple_build_call_vec (tree, vec<tree> );
1417 gcall *gimple_build_call (tree, unsigned, ...);
1418 gcall *gimple_build_call_valist (tree, unsigned, va_list);
1419 gcall *gimple_build_call_internal (enum internal_fn, unsigned, ...);
1420 gcall *gimple_build_call_internal_vec (enum internal_fn, vec<tree> );
1421 gcall *gimple_build_call_from_tree (tree);
1422 gassign *gimple_build_assign (tree, tree CXX_MEM_STAT_INFO);
1423 gassign *gimple_build_assign (tree, enum tree_code,
1424 tree, tree, tree CXX_MEM_STAT_INFO);
1425 gassign *gimple_build_assign (tree, enum tree_code,
1426 tree, tree CXX_MEM_STAT_INFO);
1427 gassign *gimple_build_assign (tree, enum tree_code, tree CXX_MEM_STAT_INFO);
1428 gcond *gimple_build_cond (enum tree_code, tree, tree, tree, tree);
1429 gcond *gimple_build_cond_from_tree (tree, tree, tree);
1430 void gimple_cond_set_condition_from_tree (gcond *, tree);
1431 glabel *gimple_build_label (tree label);
1432 ggoto *gimple_build_goto (tree dest);
1433 gimple *gimple_build_nop (void);
1434 gbind *gimple_build_bind (tree, gimple_seq, tree);
1435 gasm *gimple_build_asm_vec (const char *, vec<tree, va_gc> *,
1436 vec<tree, va_gc> *, vec<tree, va_gc> *,
1437 vec<tree, va_gc> *);
1438 gcatch *gimple_build_catch (tree, gimple_seq);
1439 geh_filter *gimple_build_eh_filter (tree, gimple_seq);
1440 geh_mnt *gimple_build_eh_must_not_throw (tree);
1441 geh_else *gimple_build_eh_else (gimple_seq, gimple_seq);
1442 gtry *gimple_build_try (gimple_seq, gimple_seq,
1443 enum gimple_try_flags);
1444 gimple *gimple_build_wce (gimple_seq);
1445 gresx *gimple_build_resx (int);
1446 gswitch *gimple_build_switch_nlabels (unsigned, tree, tree);
1447 gswitch *gimple_build_switch (tree, tree, vec<tree> );
1448 geh_dispatch *gimple_build_eh_dispatch (int);
1449 gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1450 #define gimple_build_debug_bind(var,val,stmt) \
1451 gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1452 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
1453 #define gimple_build_debug_source_bind(var,val,stmt) \
1454 gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
1455 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
1456 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
1457 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
1458 gomp_task *gimple_build_omp_task (gimple_seq, tree, tree, tree, tree,
1459 tree, tree);
1460 gimple *gimple_build_omp_section (gimple_seq);
1461 gimple *gimple_build_omp_master (gimple_seq);
1462 gimple *gimple_build_omp_grid_body (gimple_seq);
1463 gimple *gimple_build_omp_taskgroup (gimple_seq);
1464 gomp_continue *gimple_build_omp_continue (tree, tree);
1465 gomp_ordered *gimple_build_omp_ordered (gimple_seq, tree);
1466 gimple *gimple_build_omp_return (bool);
1467 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
1468 gimple *gimple_build_omp_sections_switch (void);
1469 gomp_single *gimple_build_omp_single (gimple_seq, tree);
1470 gomp_target *gimple_build_omp_target (gimple_seq, int, tree);
1471 gomp_teams *gimple_build_omp_teams (gimple_seq, tree);
1472 gomp_atomic_load *gimple_build_omp_atomic_load (tree, tree);
1473 gomp_atomic_store *gimple_build_omp_atomic_store (tree);
1474 gtransaction *gimple_build_transaction (gimple_seq);
1475 extern void gimple_seq_add_stmt (gimple_seq *, gimple *);
1476 extern void gimple_seq_add_stmt_without_update (gimple_seq *, gimple *);
1477 void gimple_seq_add_seq (gimple_seq *, gimple_seq);
1478 void gimple_seq_add_seq_without_update (gimple_seq *, gimple_seq);
1479 extern void annotate_all_with_location_after (gimple_seq, gimple_stmt_iterator,
1480 location_t);
1481 extern void annotate_all_with_location (gimple_seq, location_t);
1482 bool empty_body_p (gimple_seq);
1483 gimple_seq gimple_seq_copy (gimple_seq);
1484 bool gimple_call_same_target_p (const gimple *, const gimple *);
1485 int gimple_call_flags (const gimple *);
1486 int gimple_call_arg_flags (const gcall *, unsigned);
1487 int gimple_call_return_flags (const gcall *);
1488 bool gimple_assign_copy_p (gimple *);
1489 bool gimple_assign_ssa_name_copy_p (gimple *);
1490 bool gimple_assign_unary_nop_p (gimple *);
1491 void gimple_set_bb (gimple *, basic_block);
1492 void gimple_assign_set_rhs_from_tree (gimple_stmt_iterator *, tree);
1493 void gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *, enum tree_code,
1494 tree, tree, tree);
1495 tree gimple_get_lhs (const gimple *);
1496 void gimple_set_lhs (gimple *, tree);
1497 gimple *gimple_copy (gimple *);
1498 bool gimple_has_side_effects (const gimple *);
1499 bool gimple_could_trap_p_1 (gimple *, bool, bool);
1500 bool gimple_could_trap_p (gimple *);
1501 bool gimple_assign_rhs_could_trap_p (gimple *);
1502 extern void dump_gimple_statistics (void);
1503 unsigned get_gimple_rhs_num_ops (enum tree_code);
1504 extern tree canonicalize_cond_expr_cond (tree);
1505 gcall *gimple_call_copy_skip_args (gcall *, bitmap);
1506 extern bool gimple_compare_field_offset (tree, tree);
1507 extern tree gimple_unsigned_type (tree);
1508 extern tree gimple_signed_type (tree);
1509 extern alias_set_type gimple_get_alias_set (tree);
1510 extern bool gimple_ior_addresses_taken (bitmap, gimple *);
1511 extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
1512 extern combined_fn gimple_call_combined_fn (const gimple *);
1513 extern bool gimple_call_builtin_p (const gimple *);
1514 extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
1515 extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
1516 extern bool gimple_asm_clobbers_memory_p (const gasm *);
1517 extern void dump_decl_set (FILE *, bitmap);
1518 extern bool nonfreeing_call_p (gimple *);
1519 extern bool nonbarrier_call_p (gimple *);
1520 extern bool infer_nonnull_range (gimple *, tree);
1521 extern bool infer_nonnull_range_by_dereference (gimple *, tree);
1522 extern bool infer_nonnull_range_by_attribute (gimple *, tree);
1523 extern void sort_case_labels (vec<tree>);
1524 extern void preprocess_case_label_vec_for_gimple (vec<tree>, tree, tree *);
1525 extern void gimple_seq_set_location (gimple_seq, location_t);
1526 extern void gimple_seq_discard (gimple_seq);
1527 extern void maybe_remove_unused_call_args (struct function *, gimple *);
1528 extern bool gimple_inexpensive_call_p (gcall *);
1529 extern bool stmt_can_terminate_bb_p (gimple *);
1531 /* Formal (expression) temporary table handling: multiple occurrences of
1532 the same scalar expression are evaluated into the same temporary. */
1534 typedef struct gimple_temp_hash_elt
1536 tree val; /* Key */
1537 tree temp; /* Value */
1538 } elt_t;
1540 /* Get the number of the next statement uid to be allocated. */
1541 static inline unsigned int
1542 gimple_stmt_max_uid (struct function *fn)
1544 return fn->last_stmt_uid;
1547 /* Set the number of the next statement uid to be allocated. */
1548 static inline void
1549 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1551 fn->last_stmt_uid = maxid;
1554 /* Set the number of the next statement uid to be allocated. */
1555 static inline unsigned int
1556 inc_gimple_stmt_max_uid (struct function *fn)
1558 return fn->last_stmt_uid++;
1561 /* Return the first node in GIMPLE sequence S. */
1563 static inline gimple_seq_node
1564 gimple_seq_first (gimple_seq s)
1566 return s;
1570 /* Return the first statement in GIMPLE sequence S. */
1572 static inline gimple *
1573 gimple_seq_first_stmt (gimple_seq s)
1575 gimple_seq_node n = gimple_seq_first (s);
1576 return n;
1579 /* Return the first statement in GIMPLE sequence S as a gbind *,
1580 verifying that it has code GIMPLE_BIND in a checked build. */
1582 static inline gbind *
1583 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1585 gimple_seq_node n = gimple_seq_first (s);
1586 return as_a <gbind *> (n);
1590 /* Return the last node in GIMPLE sequence S. */
1592 static inline gimple_seq_node
1593 gimple_seq_last (gimple_seq s)
1595 return s ? s->prev : NULL;
1599 /* Return the last statement in GIMPLE sequence S. */
1601 static inline gimple *
1602 gimple_seq_last_stmt (gimple_seq s)
1604 gimple_seq_node n = gimple_seq_last (s);
1605 return n;
1609 /* Set the last node in GIMPLE sequence *PS to LAST. */
1611 static inline void
1612 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1614 (*ps)->prev = last;
1618 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1620 static inline void
1621 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1623 *ps = first;
1627 /* Return true if GIMPLE sequence S is empty. */
1629 static inline bool
1630 gimple_seq_empty_p (gimple_seq s)
1632 return s == NULL;
1635 /* Allocate a new sequence and initialize its first element with STMT. */
1637 static inline gimple_seq
1638 gimple_seq_alloc_with_stmt (gimple *stmt)
1640 gimple_seq seq = NULL;
1641 gimple_seq_add_stmt (&seq, stmt);
1642 return seq;
1646 /* Returns the sequence of statements in BB. */
1648 static inline gimple_seq
1649 bb_seq (const_basic_block bb)
1651 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1654 static inline gimple_seq *
1655 bb_seq_addr (basic_block bb)
1657 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1660 /* Sets the sequence of statements in BB to SEQ. */
1662 static inline void
1663 set_bb_seq (basic_block bb, gimple_seq seq)
1665 gcc_checking_assert (!(bb->flags & BB_RTL));
1666 bb->il.gimple.seq = seq;
1670 /* Return the code for GIMPLE statement G. */
1672 static inline enum gimple_code
1673 gimple_code (const gimple *g)
1675 return g->code;
1679 /* Return the GSS code used by a GIMPLE code. */
1681 static inline enum gimple_statement_structure_enum
1682 gss_for_code (enum gimple_code code)
1684 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1685 return gss_for_code_[code];
1689 /* Return which GSS code is used by GS. */
1691 static inline enum gimple_statement_structure_enum
1692 gimple_statement_structure (gimple *gs)
1694 return gss_for_code (gimple_code (gs));
1698 /* Return true if statement G has sub-statements. This is only true for
1699 High GIMPLE statements. */
1701 static inline bool
1702 gimple_has_substatements (gimple *g)
1704 switch (gimple_code (g))
1706 case GIMPLE_BIND:
1707 case GIMPLE_CATCH:
1708 case GIMPLE_EH_FILTER:
1709 case GIMPLE_EH_ELSE:
1710 case GIMPLE_TRY:
1711 case GIMPLE_OMP_FOR:
1712 case GIMPLE_OMP_MASTER:
1713 case GIMPLE_OMP_TASKGROUP:
1714 case GIMPLE_OMP_ORDERED:
1715 case GIMPLE_OMP_SECTION:
1716 case GIMPLE_OMP_PARALLEL:
1717 case GIMPLE_OMP_TASK:
1718 case GIMPLE_OMP_SECTIONS:
1719 case GIMPLE_OMP_SINGLE:
1720 case GIMPLE_OMP_TARGET:
1721 case GIMPLE_OMP_TEAMS:
1722 case GIMPLE_OMP_CRITICAL:
1723 case GIMPLE_WITH_CLEANUP_EXPR:
1724 case GIMPLE_TRANSACTION:
1725 case GIMPLE_OMP_GRID_BODY:
1726 return true;
1728 default:
1729 return false;
1734 /* Return the basic block holding statement G. */
1736 static inline basic_block
1737 gimple_bb (const gimple *g)
1739 return g->bb;
1743 /* Return the lexical scope block holding statement G. */
1745 static inline tree
1746 gimple_block (const gimple *g)
1748 return LOCATION_BLOCK (g->location);
1752 /* Set BLOCK to be the lexical scope block holding statement G. */
1754 static inline void
1755 gimple_set_block (gimple *g, tree block)
1757 g->location = set_block (g->location, block);
1761 /* Return location information for statement G. */
1763 static inline location_t
1764 gimple_location (const gimple *g)
1766 return g->location;
1769 /* Return location information for statement G if g is not NULL.
1770 Otherwise, UNKNOWN_LOCATION is returned. */
1772 static inline location_t
1773 gimple_location_safe (const gimple *g)
1775 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1778 /* Set location information for statement G. */
1780 static inline void
1781 gimple_set_location (gimple *g, location_t location)
1783 g->location = location;
1787 /* Return true if G contains location information. */
1789 static inline bool
1790 gimple_has_location (const gimple *g)
1792 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1796 /* Return the file name of the location of STMT. */
1798 static inline const char *
1799 gimple_filename (const gimple *stmt)
1801 return LOCATION_FILE (gimple_location (stmt));
1805 /* Return the line number of the location of STMT. */
1807 static inline int
1808 gimple_lineno (const gimple *stmt)
1810 return LOCATION_LINE (gimple_location (stmt));
1814 /* Determine whether SEQ is a singleton. */
1816 static inline bool
1817 gimple_seq_singleton_p (gimple_seq seq)
1819 return ((gimple_seq_first (seq) != NULL)
1820 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1823 /* Return true if no warnings should be emitted for statement STMT. */
1825 static inline bool
1826 gimple_no_warning_p (const gimple *stmt)
1828 return stmt->no_warning;
1831 /* Set the no_warning flag of STMT to NO_WARNING. */
1833 static inline void
1834 gimple_set_no_warning (gimple *stmt, bool no_warning)
1836 stmt->no_warning = (unsigned) no_warning;
1839 /* Set the visited status on statement STMT to VISITED_P.
1841 Please note that this 'visited' property of the gimple statement is
1842 supposed to be undefined at pass boundaries. This means that a
1843 given pass should not assume it contains any useful value when the
1844 pass starts and thus can set it to any value it sees fit.
1846 You can learn more about the visited property of the gimple
1847 statement by reading the comments of the 'visited' data member of
1848 struct gimple.
1851 static inline void
1852 gimple_set_visited (gimple *stmt, bool visited_p)
1854 stmt->visited = (unsigned) visited_p;
1858 /* Return the visited status for statement STMT.
1860 Please note that this 'visited' property of the gimple statement is
1861 supposed to be undefined at pass boundaries. This means that a
1862 given pass should not assume it contains any useful value when the
1863 pass starts and thus can set it to any value it sees fit.
1865 You can learn more about the visited property of the gimple
1866 statement by reading the comments of the 'visited' data member of
1867 struct gimple. */
1869 static inline bool
1870 gimple_visited_p (gimple *stmt)
1872 return stmt->visited;
1876 /* Set pass local flag PLF on statement STMT to VAL_P.
1878 Please note that this PLF property of the gimple statement is
1879 supposed to be undefined at pass boundaries. This means that a
1880 given pass should not assume it contains any useful value when the
1881 pass starts and thus can set it to any value it sees fit.
1883 You can learn more about the PLF property by reading the comment of
1884 the 'plf' data member of struct gimple_statement_structure. */
1886 static inline void
1887 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1889 if (val_p)
1890 stmt->plf |= (unsigned int) plf;
1891 else
1892 stmt->plf &= ~((unsigned int) plf);
1896 /* Return the value of pass local flag PLF on statement STMT.
1898 Please note that this 'plf' property of the gimple statement is
1899 supposed to be undefined at pass boundaries. This means that a
1900 given pass should not assume it contains any useful value when the
1901 pass starts and thus can set it to any value it sees fit.
1903 You can learn more about the plf property by reading the comment of
1904 the 'plf' data member of struct gimple_statement_structure. */
1906 static inline unsigned int
1907 gimple_plf (gimple *stmt, enum plf_mask plf)
1909 return stmt->plf & ((unsigned int) plf);
1913 /* Set the UID of statement.
1915 Please note that this UID property is supposed to be undefined at
1916 pass boundaries. This means that a given pass should not assume it
1917 contains any useful value when the pass starts and thus can set it
1918 to any value it sees fit. */
1920 static inline void
1921 gimple_set_uid (gimple *g, unsigned uid)
1923 g->uid = uid;
1927 /* Return the UID of statement.
1929 Please note that this UID property is supposed to be undefined at
1930 pass boundaries. This means that a given pass should not assume it
1931 contains any useful value when the pass starts and thus can set it
1932 to any value it sees fit. */
1934 static inline unsigned
1935 gimple_uid (const gimple *g)
1937 return g->uid;
1941 /* Make statement G a singleton sequence. */
1943 static inline void
1944 gimple_init_singleton (gimple *g)
1946 g->next = NULL;
1947 g->prev = g;
1951 /* Return true if GIMPLE statement G has register or memory operands. */
1953 static inline bool
1954 gimple_has_ops (const gimple *g)
1956 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1959 template <>
1960 template <>
1961 inline bool
1962 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1964 return gimple_has_ops (gs);
1967 template <>
1968 template <>
1969 inline bool
1970 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1972 return gimple_has_ops (gs);
1975 /* Return true if GIMPLE statement G has memory operands. */
1977 static inline bool
1978 gimple_has_mem_ops (const gimple *g)
1980 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1983 template <>
1984 template <>
1985 inline bool
1986 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1988 return gimple_has_mem_ops (gs);
1991 template <>
1992 template <>
1993 inline bool
1994 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1996 return gimple_has_mem_ops (gs);
1999 /* Return the set of USE operands for statement G. */
2001 static inline struct use_optype_d *
2002 gimple_use_ops (const gimple *g)
2004 const gimple_statement_with_ops *ops_stmt =
2005 dyn_cast <const gimple_statement_with_ops *> (g);
2006 if (!ops_stmt)
2007 return NULL;
2008 return ops_stmt->use_ops;
2012 /* Set USE to be the set of USE operands for statement G. */
2014 static inline void
2015 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2017 gimple_statement_with_ops *ops_stmt =
2018 as_a <gimple_statement_with_ops *> (g);
2019 ops_stmt->use_ops = use;
2023 /* Return the single VUSE operand of the statement G. */
2025 static inline tree
2026 gimple_vuse (const gimple *g)
2028 const gimple_statement_with_memory_ops *mem_ops_stmt =
2029 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2030 if (!mem_ops_stmt)
2031 return NULL_TREE;
2032 return mem_ops_stmt->vuse;
2035 /* Return the single VDEF operand of the statement G. */
2037 static inline tree
2038 gimple_vdef (const gimple *g)
2040 const gimple_statement_with_memory_ops *mem_ops_stmt =
2041 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2042 if (!mem_ops_stmt)
2043 return NULL_TREE;
2044 return mem_ops_stmt->vdef;
2047 /* Return the single VUSE operand of the statement G. */
2049 static inline tree *
2050 gimple_vuse_ptr (gimple *g)
2052 gimple_statement_with_memory_ops *mem_ops_stmt =
2053 dyn_cast <gimple_statement_with_memory_ops *> (g);
2054 if (!mem_ops_stmt)
2055 return NULL;
2056 return &mem_ops_stmt->vuse;
2059 /* Return the single VDEF operand of the statement G. */
2061 static inline tree *
2062 gimple_vdef_ptr (gimple *g)
2064 gimple_statement_with_memory_ops *mem_ops_stmt =
2065 dyn_cast <gimple_statement_with_memory_ops *> (g);
2066 if (!mem_ops_stmt)
2067 return NULL;
2068 return &mem_ops_stmt->vdef;
2071 /* Set the single VUSE operand of the statement G. */
2073 static inline void
2074 gimple_set_vuse (gimple *g, tree vuse)
2076 gimple_statement_with_memory_ops *mem_ops_stmt =
2077 as_a <gimple_statement_with_memory_ops *> (g);
2078 mem_ops_stmt->vuse = vuse;
2081 /* Set the single VDEF operand of the statement G. */
2083 static inline void
2084 gimple_set_vdef (gimple *g, tree vdef)
2086 gimple_statement_with_memory_ops *mem_ops_stmt =
2087 as_a <gimple_statement_with_memory_ops *> (g);
2088 mem_ops_stmt->vdef = vdef;
2092 /* Return true if statement G has operands and the modified field has
2093 been set. */
2095 static inline bool
2096 gimple_modified_p (const gimple *g)
2098 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2102 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2103 a MODIFIED field. */
2105 static inline void
2106 gimple_set_modified (gimple *s, bool modifiedp)
2108 if (gimple_has_ops (s))
2109 s->modified = (unsigned) modifiedp;
2113 /* Return the tree code for the expression computed by STMT. This is
2114 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2115 GIMPLE_CALL, return CALL_EXPR as the expression code for
2116 consistency. This is useful when the caller needs to deal with the
2117 three kinds of computation that GIMPLE supports. */
2119 static inline enum tree_code
2120 gimple_expr_code (const gimple *stmt)
2122 enum gimple_code code = gimple_code (stmt);
2123 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2124 return (enum tree_code) stmt->subcode;
2125 else
2127 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2128 return CALL_EXPR;
2133 /* Return true if statement STMT contains volatile operands. */
2135 static inline bool
2136 gimple_has_volatile_ops (const gimple *stmt)
2138 if (gimple_has_mem_ops (stmt))
2139 return stmt->has_volatile_ops;
2140 else
2141 return false;
2145 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2147 static inline void
2148 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2150 if (gimple_has_mem_ops (stmt))
2151 stmt->has_volatile_ops = (unsigned) volatilep;
2154 /* Return true if STMT is in a transaction. */
2156 static inline bool
2157 gimple_in_transaction (const gimple *stmt)
2159 return bb_in_transaction (gimple_bb (stmt));
2162 /* Return true if statement STMT may access memory. */
2164 static inline bool
2165 gimple_references_memory_p (gimple *stmt)
2167 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2171 /* Return the subcode for OMP statement S. */
2173 static inline unsigned
2174 gimple_omp_subcode (const gimple *s)
2176 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2177 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2178 return s->subcode;
2181 /* Set the subcode for OMP statement S to SUBCODE. */
2183 static inline void
2184 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2186 /* We only have 16 bits for the subcode. Assert that we are not
2187 overflowing it. */
2188 gcc_gimple_checking_assert (subcode < (1 << 16));
2189 s->subcode = subcode;
2192 /* Set the nowait flag on OMP_RETURN statement S. */
2194 static inline void
2195 gimple_omp_return_set_nowait (gimple *s)
2197 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2198 s->subcode |= GF_OMP_RETURN_NOWAIT;
2202 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2203 flag set. */
2205 static inline bool
2206 gimple_omp_return_nowait_p (const gimple *g)
2208 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2209 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2213 /* Set the LHS of OMP return. */
2215 static inline void
2216 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2218 gimple_statement_omp_return *omp_return_stmt =
2219 as_a <gimple_statement_omp_return *> (g);
2220 omp_return_stmt->val = lhs;
2224 /* Get the LHS of OMP return. */
2226 static inline tree
2227 gimple_omp_return_lhs (const gimple *g)
2229 const gimple_statement_omp_return *omp_return_stmt =
2230 as_a <const gimple_statement_omp_return *> (g);
2231 return omp_return_stmt->val;
2235 /* Return a pointer to the LHS of OMP return. */
2237 static inline tree *
2238 gimple_omp_return_lhs_ptr (gimple *g)
2240 gimple_statement_omp_return *omp_return_stmt =
2241 as_a <gimple_statement_omp_return *> (g);
2242 return &omp_return_stmt->val;
2246 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2247 flag set. */
2249 static inline bool
2250 gimple_omp_section_last_p (const gimple *g)
2252 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2253 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2257 /* Set the GF_OMP_SECTION_LAST flag on G. */
2259 static inline void
2260 gimple_omp_section_set_last (gimple *g)
2262 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2263 g->subcode |= GF_OMP_SECTION_LAST;
2267 /* Return true if OMP parallel statement G has the
2268 GF_OMP_PARALLEL_COMBINED flag set. */
2270 static inline bool
2271 gimple_omp_parallel_combined_p (const gimple *g)
2273 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2274 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2278 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2279 value of COMBINED_P. */
2281 static inline void
2282 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2284 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2285 if (combined_p)
2286 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2287 else
2288 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2292 /* Return true if OMP atomic load/store statement G has the
2293 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2295 static inline bool
2296 gimple_omp_atomic_need_value_p (const gimple *g)
2298 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2299 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2300 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2304 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2306 static inline void
2307 gimple_omp_atomic_set_need_value (gimple *g)
2309 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2310 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2311 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2315 /* Return true if OMP atomic load/store statement G has the
2316 GF_OMP_ATOMIC_SEQ_CST flag set. */
2318 static inline bool
2319 gimple_omp_atomic_seq_cst_p (const gimple *g)
2321 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2322 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2323 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2327 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2329 static inline void
2330 gimple_omp_atomic_set_seq_cst (gimple *g)
2332 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2333 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2334 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2338 /* Return the number of operands for statement GS. */
2340 static inline unsigned
2341 gimple_num_ops (const gimple *gs)
2343 return gs->num_ops;
2347 /* Set the number of operands for statement GS. */
2349 static inline void
2350 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2352 gs->num_ops = num_ops;
2356 /* Return the array of operands for statement GS. */
2358 static inline tree *
2359 gimple_ops (gimple *gs)
2361 size_t off;
2363 /* All the tuples have their operand vector at the very bottom
2364 of the structure. Note that those structures that do not
2365 have an operand vector have a zero offset. */
2366 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2367 gcc_gimple_checking_assert (off != 0);
2369 return (tree *) ((char *) gs + off);
2373 /* Return operand I for statement GS. */
2375 static inline tree
2376 gimple_op (const gimple *gs, unsigned i)
2378 if (gimple_has_ops (gs))
2380 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2381 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2383 else
2384 return NULL_TREE;
2387 /* Return a pointer to operand I for statement GS. */
2389 static inline tree *
2390 gimple_op_ptr (gimple *gs, unsigned i)
2392 if (gimple_has_ops (gs))
2394 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2395 return gimple_ops (gs) + i;
2397 else
2398 return NULL;
2401 /* Set operand I of statement GS to OP. */
2403 static inline void
2404 gimple_set_op (gimple *gs, unsigned i, tree op)
2406 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2408 /* Note. It may be tempting to assert that OP matches
2409 is_gimple_operand, but that would be wrong. Different tuples
2410 accept slightly different sets of tree operands. Each caller
2411 should perform its own validation. */
2412 gimple_ops (gs)[i] = op;
2415 /* Return true if GS is a GIMPLE_ASSIGN. */
2417 static inline bool
2418 is_gimple_assign (const gimple *gs)
2420 return gimple_code (gs) == GIMPLE_ASSIGN;
2423 /* Determine if expression CODE is one of the valid expressions that can
2424 be used on the RHS of GIMPLE assignments. */
2426 static inline enum gimple_rhs_class
2427 get_gimple_rhs_class (enum tree_code code)
2429 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2432 /* Return the LHS of assignment statement GS. */
2434 static inline tree
2435 gimple_assign_lhs (const gassign *gs)
2437 return gs->op[0];
2440 static inline tree
2441 gimple_assign_lhs (const gimple *gs)
2443 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2444 return gimple_assign_lhs (ass);
2448 /* Return a pointer to the LHS of assignment statement GS. */
2450 static inline tree *
2451 gimple_assign_lhs_ptr (gassign *gs)
2453 return &gs->op[0];
2456 static inline tree *
2457 gimple_assign_lhs_ptr (gimple *gs)
2459 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2460 return gimple_assign_lhs_ptr (ass);
2464 /* Set LHS to be the LHS operand of assignment statement GS. */
2466 static inline void
2467 gimple_assign_set_lhs (gassign *gs, tree lhs)
2469 gs->op[0] = lhs;
2471 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2472 SSA_NAME_DEF_STMT (lhs) = gs;
2475 static inline void
2476 gimple_assign_set_lhs (gimple *gs, tree lhs)
2478 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2479 gimple_assign_set_lhs (ass, lhs);
2483 /* Return the first operand on the RHS of assignment statement GS. */
2485 static inline tree
2486 gimple_assign_rhs1 (const gassign *gs)
2488 return gs->op[1];
2491 static inline tree
2492 gimple_assign_rhs1 (const gimple *gs)
2494 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2495 return gimple_assign_rhs1 (ass);
2499 /* Return a pointer to the first operand on the RHS of assignment
2500 statement GS. */
2502 static inline tree *
2503 gimple_assign_rhs1_ptr (gassign *gs)
2505 return &gs->op[1];
2508 static inline tree *
2509 gimple_assign_rhs1_ptr (gimple *gs)
2511 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2512 return gimple_assign_rhs1_ptr (ass);
2515 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2517 static inline void
2518 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2520 gs->op[1] = rhs;
2523 static inline void
2524 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2526 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2527 gimple_assign_set_rhs1 (ass, rhs);
2531 /* Return the second operand on the RHS of assignment statement GS.
2532 If GS does not have two operands, NULL is returned instead. */
2534 static inline tree
2535 gimple_assign_rhs2 (const gassign *gs)
2537 if (gimple_num_ops (gs) >= 3)
2538 return gs->op[2];
2539 else
2540 return NULL_TREE;
2543 static inline tree
2544 gimple_assign_rhs2 (const gimple *gs)
2546 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2547 return gimple_assign_rhs2 (ass);
2551 /* Return a pointer to the second operand on the RHS of assignment
2552 statement GS. */
2554 static inline tree *
2555 gimple_assign_rhs2_ptr (gassign *gs)
2557 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2558 return &gs->op[2];
2561 static inline tree *
2562 gimple_assign_rhs2_ptr (gimple *gs)
2564 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2565 return gimple_assign_rhs2_ptr (ass);
2569 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2571 static inline void
2572 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2574 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2575 gs->op[2] = rhs;
2578 static inline void
2579 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2581 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2582 return gimple_assign_set_rhs2 (ass, rhs);
2585 /* Return the third operand on the RHS of assignment statement GS.
2586 If GS does not have two operands, NULL is returned instead. */
2588 static inline tree
2589 gimple_assign_rhs3 (const gassign *gs)
2591 if (gimple_num_ops (gs) >= 4)
2592 return gs->op[3];
2593 else
2594 return NULL_TREE;
2597 static inline tree
2598 gimple_assign_rhs3 (const gimple *gs)
2600 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2601 return gimple_assign_rhs3 (ass);
2604 /* Return a pointer to the third operand on the RHS of assignment
2605 statement GS. */
2607 static inline tree *
2608 gimple_assign_rhs3_ptr (gimple *gs)
2610 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2611 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2612 return &ass->op[3];
2616 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2618 static inline void
2619 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2621 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2622 gs->op[3] = rhs;
2625 static inline void
2626 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2628 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2629 gimple_assign_set_rhs3 (ass, rhs);
2633 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2634 which expect to see only two operands. */
2636 static inline void
2637 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2638 tree op1, tree op2)
2640 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2643 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2644 which expect to see only one operands. */
2646 static inline void
2647 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2648 tree op1)
2650 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2653 /* Returns true if GS is a nontemporal move. */
2655 static inline bool
2656 gimple_assign_nontemporal_move_p (const gassign *gs)
2658 return gs->nontemporal_move;
2661 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2663 static inline void
2664 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2666 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2667 gs->nontemporal_move = nontemporal;
2671 /* Return the code of the expression computed on the rhs of assignment
2672 statement GS. In case that the RHS is a single object, returns the
2673 tree code of the object. */
2675 static inline enum tree_code
2676 gimple_assign_rhs_code (const gassign *gs)
2678 enum tree_code code = (enum tree_code) gs->subcode;
2679 /* While we initially set subcode to the TREE_CODE of the rhs for
2680 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2681 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2682 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2683 code = TREE_CODE (gs->op[1]);
2685 return code;
2688 static inline enum tree_code
2689 gimple_assign_rhs_code (const gimple *gs)
2691 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2692 return gimple_assign_rhs_code (ass);
2696 /* Set CODE to be the code for the expression computed on the RHS of
2697 assignment S. */
2699 static inline void
2700 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2702 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2703 s->subcode = code;
2707 /* Return the gimple rhs class of the code of the expression computed on
2708 the rhs of assignment statement GS.
2709 This will never return GIMPLE_INVALID_RHS. */
2711 static inline enum gimple_rhs_class
2712 gimple_assign_rhs_class (const gimple *gs)
2714 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2717 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2718 there is no operator associated with the assignment itself.
2719 Unlike gimple_assign_copy_p, this predicate returns true for
2720 any RHS operand, including those that perform an operation
2721 and do not have the semantics of a copy, such as COND_EXPR. */
2723 static inline bool
2724 gimple_assign_single_p (const gimple *gs)
2726 return (is_gimple_assign (gs)
2727 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2730 /* Return true if GS performs a store to its lhs. */
2732 static inline bool
2733 gimple_store_p (const gimple *gs)
2735 tree lhs = gimple_get_lhs (gs);
2736 return lhs && !is_gimple_reg (lhs);
2739 /* Return true if GS is an assignment that loads from its rhs1. */
2741 static inline bool
2742 gimple_assign_load_p (const gimple *gs)
2744 tree rhs;
2745 if (!gimple_assign_single_p (gs))
2746 return false;
2747 rhs = gimple_assign_rhs1 (gs);
2748 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2749 return true;
2750 rhs = get_base_address (rhs);
2751 return (DECL_P (rhs)
2752 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2756 /* Return true if S is a type-cast assignment. */
2758 static inline bool
2759 gimple_assign_cast_p (const gimple *s)
2761 if (is_gimple_assign (s))
2763 enum tree_code sc = gimple_assign_rhs_code (s);
2764 return CONVERT_EXPR_CODE_P (sc)
2765 || sc == VIEW_CONVERT_EXPR
2766 || sc == FIX_TRUNC_EXPR;
2769 return false;
2772 /* Return true if S is a clobber statement. */
2774 static inline bool
2775 gimple_clobber_p (const gimple *s)
2777 return gimple_assign_single_p (s)
2778 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2781 /* Return true if GS is a GIMPLE_CALL. */
2783 static inline bool
2784 is_gimple_call (const gimple *gs)
2786 return gimple_code (gs) == GIMPLE_CALL;
2789 /* Return the LHS of call statement GS. */
2791 static inline tree
2792 gimple_call_lhs (const gcall *gs)
2794 return gs->op[0];
2797 static inline tree
2798 gimple_call_lhs (const gimple *gs)
2800 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2801 return gimple_call_lhs (gc);
2805 /* Return a pointer to the LHS of call statement GS. */
2807 static inline tree *
2808 gimple_call_lhs_ptr (gcall *gs)
2810 return &gs->op[0];
2813 static inline tree *
2814 gimple_call_lhs_ptr (gimple *gs)
2816 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2817 return gimple_call_lhs_ptr (gc);
2821 /* Set LHS to be the LHS operand of call statement GS. */
2823 static inline void
2824 gimple_call_set_lhs (gcall *gs, tree lhs)
2826 gs->op[0] = lhs;
2827 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2828 SSA_NAME_DEF_STMT (lhs) = gs;
2831 static inline void
2832 gimple_call_set_lhs (gimple *gs, tree lhs)
2834 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2835 gimple_call_set_lhs (gc, lhs);
2839 /* Return true if call GS calls an internal-only function, as enumerated
2840 by internal_fn. */
2842 static inline bool
2843 gimple_call_internal_p (const gcall *gs)
2845 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2848 static inline bool
2849 gimple_call_internal_p (const gimple *gs)
2851 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2852 return gimple_call_internal_p (gc);
2856 /* Return true if call GS is marked as instrumented by
2857 Pointer Bounds Checker. */
2859 static inline bool
2860 gimple_call_with_bounds_p (const gcall *gs)
2862 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2865 static inline bool
2866 gimple_call_with_bounds_p (const gimple *gs)
2868 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2869 return gimple_call_with_bounds_p (gc);
2873 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2874 Pointer Bounds Checker. */
2876 static inline void
2877 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2879 if (with_bounds)
2880 gs->subcode |= GF_CALL_WITH_BOUNDS;
2881 else
2882 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2885 static inline void
2886 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2888 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2889 gimple_call_set_with_bounds (gc, with_bounds);
2893 /* Return the target of internal call GS. */
2895 static inline enum internal_fn
2896 gimple_call_internal_fn (const gcall *gs)
2898 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2899 return gs->u.internal_fn;
2902 static inline enum internal_fn
2903 gimple_call_internal_fn (const gimple *gs)
2905 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2906 return gimple_call_internal_fn (gc);
2909 /* Return true, if this internal gimple call is unique. */
2911 static inline bool
2912 gimple_call_internal_unique_p (const gcall *gs)
2914 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2917 static inline bool
2918 gimple_call_internal_unique_p (const gimple *gs)
2920 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2921 return gimple_call_internal_unique_p (gc);
2924 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2925 that could alter control flow. */
2927 static inline void
2928 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2930 if (ctrl_altering_p)
2931 s->subcode |= GF_CALL_CTRL_ALTERING;
2932 else
2933 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2936 static inline void
2937 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2939 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2940 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2943 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2944 flag is set. Such call could not be a stmt in the middle of a bb. */
2946 static inline bool
2947 gimple_call_ctrl_altering_p (const gcall *gs)
2949 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2952 static inline bool
2953 gimple_call_ctrl_altering_p (const gimple *gs)
2955 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2956 return gimple_call_ctrl_altering_p (gc);
2960 /* Return the function type of the function called by GS. */
2962 static inline tree
2963 gimple_call_fntype (const gcall *gs)
2965 if (gimple_call_internal_p (gs))
2966 return NULL_TREE;
2967 return gs->u.fntype;
2970 static inline tree
2971 gimple_call_fntype (const gimple *gs)
2973 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2974 return gimple_call_fntype (call_stmt);
2977 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2979 static inline void
2980 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2982 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2983 call_stmt->u.fntype = fntype;
2987 /* Return the tree node representing the function called by call
2988 statement GS. */
2990 static inline tree
2991 gimple_call_fn (const gcall *gs)
2993 return gs->op[1];
2996 static inline tree
2997 gimple_call_fn (const gimple *gs)
2999 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3000 return gimple_call_fn (gc);
3003 /* Return a pointer to the tree node representing the function called by call
3004 statement GS. */
3006 static inline tree *
3007 gimple_call_fn_ptr (gcall *gs)
3009 return &gs->op[1];
3012 static inline tree *
3013 gimple_call_fn_ptr (gimple *gs)
3015 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3016 return gimple_call_fn_ptr (gc);
3020 /* Set FN to be the function called by call statement GS. */
3022 static inline void
3023 gimple_call_set_fn (gcall *gs, tree fn)
3025 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3026 gs->op[1] = fn;
3030 /* Set FNDECL to be the function called by call statement GS. */
3032 static inline void
3033 gimple_call_set_fndecl (gcall *gs, tree decl)
3035 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3036 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3037 build_pointer_type (TREE_TYPE (decl)), decl);
3040 static inline void
3041 gimple_call_set_fndecl (gimple *gs, tree decl)
3043 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3044 gimple_call_set_fndecl (gc, decl);
3048 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3050 static inline void
3051 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3053 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3054 call_stmt->u.internal_fn = fn;
3058 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3059 Otherwise return NULL. This function is analogous to
3060 get_callee_fndecl in tree land. */
3062 static inline tree
3063 gimple_call_fndecl (const gcall *gs)
3065 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3068 static inline tree
3069 gimple_call_fndecl (const gimple *gs)
3071 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3072 return gimple_call_fndecl (gc);
3076 /* Return the type returned by call statement GS. */
3078 static inline tree
3079 gimple_call_return_type (const gcall *gs)
3081 tree type = gimple_call_fntype (gs);
3083 if (type == NULL_TREE)
3084 return TREE_TYPE (gimple_call_lhs (gs));
3086 /* The type returned by a function is the type of its
3087 function type. */
3088 return TREE_TYPE (type);
3092 /* Return the static chain for call statement GS. */
3094 static inline tree
3095 gimple_call_chain (const gcall *gs)
3097 return gs->op[2];
3100 static inline tree
3101 gimple_call_chain (const gimple *gs)
3103 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3104 return gimple_call_chain (gc);
3108 /* Return a pointer to the static chain for call statement CALL_STMT. */
3110 static inline tree *
3111 gimple_call_chain_ptr (gcall *call_stmt)
3113 return &call_stmt->op[2];
3116 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3118 static inline void
3119 gimple_call_set_chain (gcall *call_stmt, tree chain)
3121 call_stmt->op[2] = chain;
3125 /* Return the number of arguments used by call statement GS. */
3127 static inline unsigned
3128 gimple_call_num_args (const gcall *gs)
3130 return gimple_num_ops (gs) - 3;
3133 static inline unsigned
3134 gimple_call_num_args (const gimple *gs)
3136 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3137 return gimple_call_num_args (gc);
3141 /* Return the argument at position INDEX for call statement GS. */
3143 static inline tree
3144 gimple_call_arg (const gcall *gs, unsigned index)
3146 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3147 return gs->op[index + 3];
3150 static inline tree
3151 gimple_call_arg (const gimple *gs, unsigned index)
3153 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3154 return gimple_call_arg (gc, index);
3158 /* Return a pointer to the argument at position INDEX for call
3159 statement GS. */
3161 static inline tree *
3162 gimple_call_arg_ptr (gcall *gs, unsigned index)
3164 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3165 return &gs->op[index + 3];
3168 static inline tree *
3169 gimple_call_arg_ptr (gimple *gs, unsigned index)
3171 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3172 return gimple_call_arg_ptr (gc, index);
3176 /* Set ARG to be the argument at position INDEX for call statement GS. */
3178 static inline void
3179 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3181 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3182 gs->op[index + 3] = arg;
3185 static inline void
3186 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3188 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3189 gimple_call_set_arg (gc, index, arg);
3193 /* If TAIL_P is true, mark call statement S as being a tail call
3194 (i.e., a call just before the exit of a function). These calls are
3195 candidate for tail call optimization. */
3197 static inline void
3198 gimple_call_set_tail (gcall *s, bool tail_p)
3200 if (tail_p)
3201 s->subcode |= GF_CALL_TAILCALL;
3202 else
3203 s->subcode &= ~GF_CALL_TAILCALL;
3207 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3209 static inline bool
3210 gimple_call_tail_p (gcall *s)
3212 return (s->subcode & GF_CALL_TAILCALL) != 0;
3215 /* Mark (or clear) call statement S as requiring tail call optimization. */
3217 static inline void
3218 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3220 if (must_tail_p)
3221 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3222 else
3223 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3226 /* Return true if call statement has been marked as requiring
3227 tail call optimization. */
3229 static inline bool
3230 gimple_call_must_tail_p (const gcall *s)
3232 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3235 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3236 slot optimization. This transformation uses the target of the call
3237 expansion as the return slot for calls that return in memory. */
3239 static inline void
3240 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3242 if (return_slot_opt_p)
3243 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3244 else
3245 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3249 /* Return true if S is marked for return slot optimization. */
3251 static inline bool
3252 gimple_call_return_slot_opt_p (gcall *s)
3254 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3258 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3259 thunk to the thunked-to function. */
3261 static inline void
3262 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3264 if (from_thunk_p)
3265 s->subcode |= GF_CALL_FROM_THUNK;
3266 else
3267 s->subcode &= ~GF_CALL_FROM_THUNK;
3271 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3273 static inline bool
3274 gimple_call_from_thunk_p (gcall *s)
3276 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3280 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3281 argument pack in its argument list. */
3283 static inline void
3284 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3286 if (pass_arg_pack_p)
3287 s->subcode |= GF_CALL_VA_ARG_PACK;
3288 else
3289 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3293 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3294 argument pack in its argument list. */
3296 static inline bool
3297 gimple_call_va_arg_pack_p (gcall *s)
3299 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3303 /* Return true if S is a noreturn call. */
3305 static inline bool
3306 gimple_call_noreturn_p (const gcall *s)
3308 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3311 static inline bool
3312 gimple_call_noreturn_p (const gimple *s)
3314 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3315 return gimple_call_noreturn_p (gc);
3319 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3320 even if the called function can throw in other cases. */
3322 static inline void
3323 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3325 if (nothrow_p)
3326 s->subcode |= GF_CALL_NOTHROW;
3327 else
3328 s->subcode &= ~GF_CALL_NOTHROW;
3331 /* Return true if S is a nothrow call. */
3333 static inline bool
3334 gimple_call_nothrow_p (gcall *s)
3336 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3339 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3340 is known to be emitted for VLA objects. Those are wrapped by
3341 stack_save/stack_restore calls and hence can't lead to unbounded
3342 stack growth even when they occur in loops. */
3344 static inline void
3345 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3347 if (for_var)
3348 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3349 else
3350 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3353 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3355 static inline bool
3356 gimple_call_alloca_for_var_p (gcall *s)
3358 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3361 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3363 static inline void
3364 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3366 dest_call->subcode = orig_call->subcode;
3370 /* Return a pointer to the points-to solution for the set of call-used
3371 variables of the call CALL_STMT. */
3373 static inline struct pt_solution *
3374 gimple_call_use_set (gcall *call_stmt)
3376 return &call_stmt->call_used;
3380 /* Return a pointer to the points-to solution for the set of call-used
3381 variables of the call CALL_STMT. */
3383 static inline struct pt_solution *
3384 gimple_call_clobber_set (gcall *call_stmt)
3386 return &call_stmt->call_clobbered;
3390 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3391 non-NULL lhs. */
3393 static inline bool
3394 gimple_has_lhs (gimple *stmt)
3396 if (is_gimple_assign (stmt))
3397 return true;
3398 if (gcall *call = dyn_cast <gcall *> (stmt))
3399 return gimple_call_lhs (call) != NULL_TREE;
3400 return false;
3404 /* Return the code of the predicate computed by conditional statement GS. */
3406 static inline enum tree_code
3407 gimple_cond_code (const gcond *gs)
3409 return (enum tree_code) gs->subcode;
3412 static inline enum tree_code
3413 gimple_cond_code (const gimple *gs)
3415 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3416 return gimple_cond_code (gc);
3420 /* Set CODE to be the predicate code for the conditional statement GS. */
3422 static inline void
3423 gimple_cond_set_code (gcond *gs, enum tree_code code)
3425 gs->subcode = code;
3429 /* Return the LHS of the predicate computed by conditional statement GS. */
3431 static inline tree
3432 gimple_cond_lhs (const gcond *gs)
3434 return gs->op[0];
3437 static inline tree
3438 gimple_cond_lhs (const gimple *gs)
3440 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3441 return gimple_cond_lhs (gc);
3444 /* Return the pointer to the LHS of the predicate computed by conditional
3445 statement GS. */
3447 static inline tree *
3448 gimple_cond_lhs_ptr (gcond *gs)
3450 return &gs->op[0];
3453 /* Set LHS to be the LHS operand of the predicate computed by
3454 conditional statement GS. */
3456 static inline void
3457 gimple_cond_set_lhs (gcond *gs, tree lhs)
3459 gs->op[0] = lhs;
3463 /* Return the RHS operand of the predicate computed by conditional GS. */
3465 static inline tree
3466 gimple_cond_rhs (const gcond *gs)
3468 return gs->op[1];
3471 static inline tree
3472 gimple_cond_rhs (const gimple *gs)
3474 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3475 return gimple_cond_rhs (gc);
3478 /* Return the pointer to the RHS operand of the predicate computed by
3479 conditional GS. */
3481 static inline tree *
3482 gimple_cond_rhs_ptr (gcond *gs)
3484 return &gs->op[1];
3488 /* Set RHS to be the RHS operand of the predicate computed by
3489 conditional statement GS. */
3491 static inline void
3492 gimple_cond_set_rhs (gcond *gs, tree rhs)
3494 gs->op[1] = rhs;
3498 /* Return the label used by conditional statement GS when its
3499 predicate evaluates to true. */
3501 static inline tree
3502 gimple_cond_true_label (const gcond *gs)
3504 return gs->op[2];
3508 /* Set LABEL to be the label used by conditional statement GS when its
3509 predicate evaluates to true. */
3511 static inline void
3512 gimple_cond_set_true_label (gcond *gs, tree label)
3514 gs->op[2] = label;
3518 /* Set LABEL to be the label used by conditional statement GS when its
3519 predicate evaluates to false. */
3521 static inline void
3522 gimple_cond_set_false_label (gcond *gs, tree label)
3524 gs->op[3] = label;
3528 /* Return the label used by conditional statement GS when its
3529 predicate evaluates to false. */
3531 static inline tree
3532 gimple_cond_false_label (const gcond *gs)
3534 return gs->op[3];
3538 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3540 static inline void
3541 gimple_cond_make_false (gcond *gs)
3543 gimple_cond_set_lhs (gs, boolean_false_node);
3544 gimple_cond_set_rhs (gs, boolean_false_node);
3545 gs->subcode = NE_EXPR;
3549 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3551 static inline void
3552 gimple_cond_make_true (gcond *gs)
3554 gimple_cond_set_lhs (gs, boolean_true_node);
3555 gimple_cond_set_rhs (gs, boolean_false_node);
3556 gs->subcode = NE_EXPR;
3559 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3560 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3562 static inline bool
3563 gimple_cond_true_p (const gcond *gs)
3565 tree lhs = gimple_cond_lhs (gs);
3566 tree rhs = gimple_cond_rhs (gs);
3567 enum tree_code code = gimple_cond_code (gs);
3569 if (lhs != boolean_true_node && lhs != boolean_false_node)
3570 return false;
3572 if (rhs != boolean_true_node && rhs != boolean_false_node)
3573 return false;
3575 if (code == NE_EXPR && lhs != rhs)
3576 return true;
3578 if (code == EQ_EXPR && lhs == rhs)
3579 return true;
3581 return false;
3584 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3585 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3587 static inline bool
3588 gimple_cond_false_p (const gcond *gs)
3590 tree lhs = gimple_cond_lhs (gs);
3591 tree rhs = gimple_cond_rhs (gs);
3592 enum tree_code code = gimple_cond_code (gs);
3594 if (lhs != boolean_true_node && lhs != boolean_false_node)
3595 return false;
3597 if (rhs != boolean_true_node && rhs != boolean_false_node)
3598 return false;
3600 if (code == NE_EXPR && lhs == rhs)
3601 return true;
3603 if (code == EQ_EXPR && lhs != rhs)
3604 return true;
3606 return false;
3609 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3611 static inline void
3612 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3613 tree rhs)
3615 gimple_cond_set_code (stmt, code);
3616 gimple_cond_set_lhs (stmt, lhs);
3617 gimple_cond_set_rhs (stmt, rhs);
3620 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3622 static inline tree
3623 gimple_label_label (const glabel *gs)
3625 return gs->op[0];
3629 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3630 GS. */
3632 static inline void
3633 gimple_label_set_label (glabel *gs, tree label)
3635 gs->op[0] = label;
3639 /* Return the destination of the unconditional jump GS. */
3641 static inline tree
3642 gimple_goto_dest (const gimple *gs)
3644 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3645 return gimple_op (gs, 0);
3649 /* Set DEST to be the destination of the unconditonal jump GS. */
3651 static inline void
3652 gimple_goto_set_dest (ggoto *gs, tree dest)
3654 gs->op[0] = dest;
3658 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3660 static inline tree
3661 gimple_bind_vars (const gbind *bind_stmt)
3663 return bind_stmt->vars;
3667 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3668 statement GS. */
3670 static inline void
3671 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3673 bind_stmt->vars = vars;
3677 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3678 statement GS. */
3680 static inline void
3681 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3683 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3687 static inline gimple_seq *
3688 gimple_bind_body_ptr (gbind *bind_stmt)
3690 return &bind_stmt->body;
3693 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3695 static inline gimple_seq
3696 gimple_bind_body (gbind *gs)
3698 return *gimple_bind_body_ptr (gs);
3702 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3703 statement GS. */
3705 static inline void
3706 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3708 bind_stmt->body = seq;
3712 /* Append a statement to the end of a GIMPLE_BIND's body. */
3714 static inline void
3715 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3717 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3721 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3723 static inline void
3724 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3726 gimple_seq_add_seq (&bind_stmt->body, seq);
3730 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3731 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3733 static inline tree
3734 gimple_bind_block (const gbind *bind_stmt)
3736 return bind_stmt->block;
3740 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3741 statement GS. */
3743 static inline void
3744 gimple_bind_set_block (gbind *bind_stmt, tree block)
3746 gcc_gimple_checking_assert (block == NULL_TREE
3747 || TREE_CODE (block) == BLOCK);
3748 bind_stmt->block = block;
3752 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3754 static inline unsigned
3755 gimple_asm_ninputs (const gasm *asm_stmt)
3757 return asm_stmt->ni;
3761 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3763 static inline unsigned
3764 gimple_asm_noutputs (const gasm *asm_stmt)
3766 return asm_stmt->no;
3770 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3772 static inline unsigned
3773 gimple_asm_nclobbers (const gasm *asm_stmt)
3775 return asm_stmt->nc;
3778 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3780 static inline unsigned
3781 gimple_asm_nlabels (const gasm *asm_stmt)
3783 return asm_stmt->nl;
3786 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3788 static inline tree
3789 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3791 gcc_gimple_checking_assert (index < asm_stmt->ni);
3792 return asm_stmt->op[index + asm_stmt->no];
3795 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3797 static inline void
3798 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3800 gcc_gimple_checking_assert (index < asm_stmt->ni
3801 && TREE_CODE (in_op) == TREE_LIST);
3802 asm_stmt->op[index + asm_stmt->no] = in_op;
3806 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3808 static inline tree
3809 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3811 gcc_gimple_checking_assert (index < asm_stmt->no);
3812 return asm_stmt->op[index];
3815 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3817 static inline void
3818 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3820 gcc_gimple_checking_assert (index < asm_stmt->no
3821 && TREE_CODE (out_op) == TREE_LIST);
3822 asm_stmt->op[index] = out_op;
3826 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3828 static inline tree
3829 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3831 gcc_gimple_checking_assert (index < asm_stmt->nc);
3832 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3836 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3838 static inline void
3839 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3841 gcc_gimple_checking_assert (index < asm_stmt->nc
3842 && TREE_CODE (clobber_op) == TREE_LIST);
3843 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3846 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3848 static inline tree
3849 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3851 gcc_gimple_checking_assert (index < asm_stmt->nl);
3852 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3855 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3857 static inline void
3858 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3860 gcc_gimple_checking_assert (index < asm_stmt->nl
3861 && TREE_CODE (label_op) == TREE_LIST);
3862 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3865 /* Return the string representing the assembly instruction in
3866 GIMPLE_ASM ASM_STMT. */
3868 static inline const char *
3869 gimple_asm_string (const gasm *asm_stmt)
3871 return asm_stmt->string;
3875 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3877 static inline bool
3878 gimple_asm_volatile_p (const gasm *asm_stmt)
3880 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3884 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3886 static inline void
3887 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3889 if (volatile_p)
3890 asm_stmt->subcode |= GF_ASM_VOLATILE;
3891 else
3892 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3896 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3898 static inline void
3899 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3901 if (input_p)
3902 asm_stmt->subcode |= GF_ASM_INPUT;
3903 else
3904 asm_stmt->subcode &= ~GF_ASM_INPUT;
3908 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3910 static inline bool
3911 gimple_asm_input_p (const gasm *asm_stmt)
3913 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3917 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3919 static inline tree
3920 gimple_catch_types (const gcatch *catch_stmt)
3922 return catch_stmt->types;
3926 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3928 static inline tree *
3929 gimple_catch_types_ptr (gcatch *catch_stmt)
3931 return &catch_stmt->types;
3935 /* Return a pointer to the GIMPLE sequence representing the body of
3936 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3938 static inline gimple_seq *
3939 gimple_catch_handler_ptr (gcatch *catch_stmt)
3941 return &catch_stmt->handler;
3945 /* Return the GIMPLE sequence representing the body of the handler of
3946 GIMPLE_CATCH statement CATCH_STMT. */
3948 static inline gimple_seq
3949 gimple_catch_handler (gcatch *catch_stmt)
3951 return *gimple_catch_handler_ptr (catch_stmt);
3955 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3957 static inline void
3958 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3960 catch_stmt->types = t;
3964 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3966 static inline void
3967 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3969 catch_stmt->handler = handler;
3973 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3975 static inline tree
3976 gimple_eh_filter_types (const gimple *gs)
3978 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3979 return eh_filter_stmt->types;
3983 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3984 GS. */
3986 static inline tree *
3987 gimple_eh_filter_types_ptr (gimple *gs)
3989 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3990 return &eh_filter_stmt->types;
3994 /* Return a pointer to the sequence of statement to execute when
3995 GIMPLE_EH_FILTER statement fails. */
3997 static inline gimple_seq *
3998 gimple_eh_filter_failure_ptr (gimple *gs)
4000 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
4001 return &eh_filter_stmt->failure;
4005 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4006 statement fails. */
4008 static inline gimple_seq
4009 gimple_eh_filter_failure (gimple *gs)
4011 return *gimple_eh_filter_failure_ptr (gs);
4015 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4016 EH_FILTER_STMT. */
4018 static inline void
4019 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4021 eh_filter_stmt->types = types;
4025 /* Set FAILURE to be the sequence of statements to execute on failure
4026 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4028 static inline void
4029 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4030 gimple_seq failure)
4032 eh_filter_stmt->failure = failure;
4035 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4037 static inline tree
4038 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4040 return eh_mnt_stmt->fndecl;
4043 /* Set the function decl to be called by GS to DECL. */
4045 static inline void
4046 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4047 tree decl)
4049 eh_mnt_stmt->fndecl = decl;
4052 /* GIMPLE_EH_ELSE accessors. */
4054 static inline gimple_seq *
4055 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4057 return &eh_else_stmt->n_body;
4060 static inline gimple_seq
4061 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4063 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4066 static inline gimple_seq *
4067 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4069 return &eh_else_stmt->e_body;
4072 static inline gimple_seq
4073 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4075 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4078 static inline void
4079 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4081 eh_else_stmt->n_body = seq;
4084 static inline void
4085 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4087 eh_else_stmt->e_body = seq;
4090 /* GIMPLE_TRY accessors. */
4092 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4093 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4095 static inline enum gimple_try_flags
4096 gimple_try_kind (const gimple *gs)
4098 GIMPLE_CHECK (gs, GIMPLE_TRY);
4099 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4103 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4105 static inline void
4106 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4108 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4109 || kind == GIMPLE_TRY_FINALLY);
4110 if (gimple_try_kind (gs) != kind)
4111 gs->subcode = (unsigned int) kind;
4115 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4117 static inline bool
4118 gimple_try_catch_is_cleanup (const gimple *gs)
4120 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4121 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4125 /* Return a pointer to the sequence of statements used as the
4126 body for GIMPLE_TRY GS. */
4128 static inline gimple_seq *
4129 gimple_try_eval_ptr (gimple *gs)
4131 gtry *try_stmt = as_a <gtry *> (gs);
4132 return &try_stmt->eval;
4136 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4138 static inline gimple_seq
4139 gimple_try_eval (gimple *gs)
4141 return *gimple_try_eval_ptr (gs);
4145 /* Return a pointer to the sequence of statements used as the cleanup body for
4146 GIMPLE_TRY GS. */
4148 static inline gimple_seq *
4149 gimple_try_cleanup_ptr (gimple *gs)
4151 gtry *try_stmt = as_a <gtry *> (gs);
4152 return &try_stmt->cleanup;
4156 /* Return the sequence of statements used as the cleanup body for
4157 GIMPLE_TRY GS. */
4159 static inline gimple_seq
4160 gimple_try_cleanup (gimple *gs)
4162 return *gimple_try_cleanup_ptr (gs);
4166 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4168 static inline void
4169 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4171 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4172 if (catch_is_cleanup)
4173 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4174 else
4175 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4179 /* Set EVAL to be the sequence of statements to use as the body for
4180 GIMPLE_TRY TRY_STMT. */
4182 static inline void
4183 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4185 try_stmt->eval = eval;
4189 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4190 body for GIMPLE_TRY TRY_STMT. */
4192 static inline void
4193 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4195 try_stmt->cleanup = cleanup;
4199 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4201 static inline gimple_seq *
4202 gimple_wce_cleanup_ptr (gimple *gs)
4204 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4205 return &wce_stmt->cleanup;
4209 /* Return the cleanup sequence for cleanup statement GS. */
4211 static inline gimple_seq
4212 gimple_wce_cleanup (gimple *gs)
4214 return *gimple_wce_cleanup_ptr (gs);
4218 /* Set CLEANUP to be the cleanup sequence for GS. */
4220 static inline void
4221 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4223 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4224 wce_stmt->cleanup = cleanup;
4228 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4230 static inline bool
4231 gimple_wce_cleanup_eh_only (const gimple *gs)
4233 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4234 return gs->subcode != 0;
4238 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4240 static inline void
4241 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4243 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4244 gs->subcode = (unsigned int) eh_only_p;
4248 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4250 static inline unsigned
4251 gimple_phi_capacity (const gimple *gs)
4253 const gphi *phi_stmt = as_a <const gphi *> (gs);
4254 return phi_stmt->capacity;
4258 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4259 be exactly the number of incoming edges for the basic block holding
4260 GS. */
4262 static inline unsigned
4263 gimple_phi_num_args (const gimple *gs)
4265 const gphi *phi_stmt = as_a <const gphi *> (gs);
4266 return phi_stmt->nargs;
4270 /* Return the SSA name created by GIMPLE_PHI GS. */
4272 static inline tree
4273 gimple_phi_result (const gimple *gs)
4275 const gphi *phi_stmt = as_a <const gphi *> (gs);
4276 return phi_stmt->result;
4279 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4281 static inline tree *
4282 gimple_phi_result_ptr (gimple *gs)
4284 gphi *phi_stmt = as_a <gphi *> (gs);
4285 return &phi_stmt->result;
4288 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4290 static inline void
4291 gimple_phi_set_result (gphi *phi, tree result)
4293 phi->result = result;
4294 if (result && TREE_CODE (result) == SSA_NAME)
4295 SSA_NAME_DEF_STMT (result) = phi;
4299 /* Return the PHI argument corresponding to incoming edge INDEX for
4300 GIMPLE_PHI GS. */
4302 static inline struct phi_arg_d *
4303 gimple_phi_arg (gimple *gs, unsigned index)
4305 gphi *phi_stmt = as_a <gphi *> (gs);
4306 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4307 return &(phi_stmt->args[index]);
4310 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4311 for GIMPLE_PHI PHI. */
4313 static inline void
4314 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4316 gcc_gimple_checking_assert (index <= phi->nargs);
4317 phi->args[index] = *phiarg;
4320 /* Return the PHI nodes for basic block BB, or NULL if there are no
4321 PHI nodes. */
4323 static inline gimple_seq
4324 phi_nodes (const_basic_block bb)
4326 gcc_checking_assert (!(bb->flags & BB_RTL));
4327 return bb->il.gimple.phi_nodes;
4330 /* Return a pointer to the PHI nodes for basic block BB. */
4332 static inline gimple_seq *
4333 phi_nodes_ptr (basic_block bb)
4335 gcc_checking_assert (!(bb->flags & BB_RTL));
4336 return &bb->il.gimple.phi_nodes;
4339 /* Return the tree operand for argument I of PHI node GS. */
4341 static inline tree
4342 gimple_phi_arg_def (gimple *gs, size_t index)
4344 return gimple_phi_arg (gs, index)->def;
4348 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4350 static inline tree *
4351 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4353 return &gimple_phi_arg (phi, index)->def;
4356 /* Return the edge associated with argument I of phi node PHI. */
4358 static inline edge
4359 gimple_phi_arg_edge (gphi *phi, size_t i)
4361 return EDGE_PRED (gimple_bb (phi), i);
4364 /* Return the source location of gimple argument I of phi node PHI. */
4366 static inline source_location
4367 gimple_phi_arg_location (gphi *phi, size_t i)
4369 return gimple_phi_arg (phi, i)->locus;
4372 /* Return the source location of the argument on edge E of phi node PHI. */
4374 static inline source_location
4375 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4377 return gimple_phi_arg (phi, e->dest_idx)->locus;
4380 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4382 static inline void
4383 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4385 gimple_phi_arg (phi, i)->locus = loc;
4388 /* Return TRUE if argument I of phi node PHI has a location record. */
4390 static inline bool
4391 gimple_phi_arg_has_location (gphi *phi, size_t i)
4393 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4397 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4399 static inline int
4400 gimple_resx_region (const gresx *resx_stmt)
4402 return resx_stmt->region;
4405 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4407 static inline void
4408 gimple_resx_set_region (gresx *resx_stmt, int region)
4410 resx_stmt->region = region;
4413 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4415 static inline int
4416 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4418 return eh_dispatch_stmt->region;
4421 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4422 EH_DISPATCH_STMT. */
4424 static inline void
4425 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4427 eh_dispatch_stmt->region = region;
4430 /* Return the number of labels associated with the switch statement GS. */
4432 static inline unsigned
4433 gimple_switch_num_labels (const gswitch *gs)
4435 unsigned num_ops;
4436 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4437 num_ops = gimple_num_ops (gs);
4438 gcc_gimple_checking_assert (num_ops > 1);
4439 return num_ops - 1;
4443 /* Set NLABELS to be the number of labels for the switch statement GS. */
4445 static inline void
4446 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4448 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4449 gimple_set_num_ops (g, nlabels + 1);
4453 /* Return the index variable used by the switch statement GS. */
4455 static inline tree
4456 gimple_switch_index (const gswitch *gs)
4458 return gs->op[0];
4462 /* Return a pointer to the index variable for the switch statement GS. */
4464 static inline tree *
4465 gimple_switch_index_ptr (gswitch *gs)
4467 return &gs->op[0];
4471 /* Set INDEX to be the index variable for switch statement GS. */
4473 static inline void
4474 gimple_switch_set_index (gswitch *gs, tree index)
4476 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4477 gs->op[0] = index;
4481 /* Return the label numbered INDEX. The default label is 0, followed by any
4482 labels in a switch statement. */
4484 static inline tree
4485 gimple_switch_label (const gswitch *gs, unsigned index)
4487 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4488 return gs->op[index + 1];
4491 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4493 static inline void
4494 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4496 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4497 && (label == NULL_TREE
4498 || TREE_CODE (label) == CASE_LABEL_EXPR));
4499 gs->op[index + 1] = label;
4502 /* Return the default label for a switch statement. */
4504 static inline tree
4505 gimple_switch_default_label (const gswitch *gs)
4507 tree label = gimple_switch_label (gs, 0);
4508 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4509 return label;
4512 /* Set the default label for a switch statement. */
4514 static inline void
4515 gimple_switch_set_default_label (gswitch *gs, tree label)
4517 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4518 gimple_switch_set_label (gs, 0, label);
4521 /* Return true if GS is a GIMPLE_DEBUG statement. */
4523 static inline bool
4524 is_gimple_debug (const gimple *gs)
4526 return gimple_code (gs) == GIMPLE_DEBUG;
4529 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4531 static inline bool
4532 gimple_debug_bind_p (const gimple *s)
4534 if (is_gimple_debug (s))
4535 return s->subcode == GIMPLE_DEBUG_BIND;
4537 return false;
4540 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4542 static inline tree
4543 gimple_debug_bind_get_var (gimple *dbg)
4545 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4546 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4547 return gimple_op (dbg, 0);
4550 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4551 statement. */
4553 static inline tree
4554 gimple_debug_bind_get_value (gimple *dbg)
4556 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4557 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4558 return gimple_op (dbg, 1);
4561 /* Return a pointer to the value bound to the variable in a
4562 GIMPLE_DEBUG bind statement. */
4564 static inline tree *
4565 gimple_debug_bind_get_value_ptr (gimple *dbg)
4567 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4568 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4569 return gimple_op_ptr (dbg, 1);
4572 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4574 static inline void
4575 gimple_debug_bind_set_var (gimple *dbg, tree var)
4577 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4578 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4579 gimple_set_op (dbg, 0, var);
4582 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4583 statement. */
4585 static inline void
4586 gimple_debug_bind_set_value (gimple *dbg, tree value)
4588 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4589 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4590 gimple_set_op (dbg, 1, value);
4593 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4594 optimized away. */
4595 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4597 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4598 statement. */
4600 static inline void
4601 gimple_debug_bind_reset_value (gimple *dbg)
4603 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4604 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4605 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4608 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4609 value. */
4611 static inline bool
4612 gimple_debug_bind_has_value_p (gimple *dbg)
4614 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4615 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4616 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4619 #undef GIMPLE_DEBUG_BIND_NOVALUE
4621 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4623 static inline bool
4624 gimple_debug_source_bind_p (const gimple *s)
4626 if (is_gimple_debug (s))
4627 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4629 return false;
4632 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4634 static inline tree
4635 gimple_debug_source_bind_get_var (gimple *dbg)
4637 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4638 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4639 return gimple_op (dbg, 0);
4642 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4643 statement. */
4645 static inline tree
4646 gimple_debug_source_bind_get_value (gimple *dbg)
4648 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4649 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4650 return gimple_op (dbg, 1);
4653 /* Return a pointer to the value bound to the variable in a
4654 GIMPLE_DEBUG source bind statement. */
4656 static inline tree *
4657 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4659 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4660 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4661 return gimple_op_ptr (dbg, 1);
4664 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4666 static inline void
4667 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4669 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4670 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4671 gimple_set_op (dbg, 0, var);
4674 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4675 statement. */
4677 static inline void
4678 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4680 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4681 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4682 gimple_set_op (dbg, 1, value);
4685 /* Return the line number for EXPR, or return -1 if we have no line
4686 number information for it. */
4687 static inline int
4688 get_lineno (const gimple *stmt)
4690 location_t loc;
4692 if (!stmt)
4693 return -1;
4695 loc = gimple_location (stmt);
4696 if (loc == UNKNOWN_LOCATION)
4697 return -1;
4699 return LOCATION_LINE (loc);
4702 /* Return a pointer to the body for the OMP statement GS. */
4704 static inline gimple_seq *
4705 gimple_omp_body_ptr (gimple *gs)
4707 return &static_cast <gimple_statement_omp *> (gs)->body;
4710 /* Return the body for the OMP statement GS. */
4712 static inline gimple_seq
4713 gimple_omp_body (gimple *gs)
4715 return *gimple_omp_body_ptr (gs);
4718 /* Set BODY to be the body for the OMP statement GS. */
4720 static inline void
4721 gimple_omp_set_body (gimple *gs, gimple_seq body)
4723 static_cast <gimple_statement_omp *> (gs)->body = body;
4727 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4729 static inline tree
4730 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4732 return crit_stmt->name;
4736 /* Return a pointer to the name associated with OMP critical statement
4737 CRIT_STMT. */
4739 static inline tree *
4740 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4742 return &crit_stmt->name;
4746 /* Set NAME to be the name associated with OMP critical statement
4747 CRIT_STMT. */
4749 static inline void
4750 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4752 crit_stmt->name = name;
4756 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4758 static inline tree
4759 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4761 return crit_stmt->clauses;
4765 /* Return a pointer to the clauses associated with OMP critical statement
4766 CRIT_STMT. */
4768 static inline tree *
4769 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4771 return &crit_stmt->clauses;
4775 /* Set CLAUSES to be the clauses associated with OMP critical statement
4776 CRIT_STMT. */
4778 static inline void
4779 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4781 crit_stmt->clauses = clauses;
4785 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4787 static inline tree
4788 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4790 return ord_stmt->clauses;
4794 /* Return a pointer to the clauses associated with OMP ordered statement
4795 ORD_STMT. */
4797 static inline tree *
4798 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4800 return &ord_stmt->clauses;
4804 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4805 ORD_STMT. */
4807 static inline void
4808 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4810 ord_stmt->clauses = clauses;
4814 /* Return the kind of the OMP_FOR statemement G. */
4816 static inline int
4817 gimple_omp_for_kind (const gimple *g)
4819 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4820 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4824 /* Set the kind of the OMP_FOR statement G. */
4826 static inline void
4827 gimple_omp_for_set_kind (gomp_for *g, int kind)
4829 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4830 | (kind & GF_OMP_FOR_KIND_MASK);
4834 /* Return true if OMP_FOR statement G has the
4835 GF_OMP_FOR_COMBINED flag set. */
4837 static inline bool
4838 gimple_omp_for_combined_p (const gimple *g)
4840 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4841 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4845 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4846 the boolean value of COMBINED_P. */
4848 static inline void
4849 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4851 if (combined_p)
4852 g->subcode |= GF_OMP_FOR_COMBINED;
4853 else
4854 g->subcode &= ~GF_OMP_FOR_COMBINED;
4858 /* Return true if the OMP_FOR statement G has the
4859 GF_OMP_FOR_COMBINED_INTO flag set. */
4861 static inline bool
4862 gimple_omp_for_combined_into_p (const gimple *g)
4864 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4865 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4869 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4870 on the boolean value of COMBINED_P. */
4872 static inline void
4873 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4875 if (combined_p)
4876 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4877 else
4878 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4882 /* Return the clauses associated with the OMP_FOR statement GS. */
4884 static inline tree
4885 gimple_omp_for_clauses (const gimple *gs)
4887 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4888 return omp_for_stmt->clauses;
4892 /* Return a pointer to the clauses associated with the OMP_FOR statement
4893 GS. */
4895 static inline tree *
4896 gimple_omp_for_clauses_ptr (gimple *gs)
4898 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4899 return &omp_for_stmt->clauses;
4903 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4904 GS. */
4906 static inline void
4907 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4909 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4910 omp_for_stmt->clauses = clauses;
4914 /* Get the collapse count of the OMP_FOR statement GS. */
4916 static inline size_t
4917 gimple_omp_for_collapse (gimple *gs)
4919 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4920 return omp_for_stmt->collapse;
4924 /* Return the condition code associated with the OMP_FOR statement GS. */
4926 static inline enum tree_code
4927 gimple_omp_for_cond (const gimple *gs, size_t i)
4929 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4930 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4931 return omp_for_stmt->iter[i].cond;
4935 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4937 static inline void
4938 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4940 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4941 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4942 && i < omp_for_stmt->collapse);
4943 omp_for_stmt->iter[i].cond = cond;
4947 /* Return the index variable for the OMP_FOR statement GS. */
4949 static inline tree
4950 gimple_omp_for_index (const gimple *gs, size_t i)
4952 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4953 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4954 return omp_for_stmt->iter[i].index;
4958 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4960 static inline tree *
4961 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4963 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4964 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4965 return &omp_for_stmt->iter[i].index;
4969 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4971 static inline void
4972 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4974 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4975 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4976 omp_for_stmt->iter[i].index = index;
4980 /* Return the initial value for the OMP_FOR statement GS. */
4982 static inline tree
4983 gimple_omp_for_initial (const gimple *gs, size_t i)
4985 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4986 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4987 return omp_for_stmt->iter[i].initial;
4991 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4993 static inline tree *
4994 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4996 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4997 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4998 return &omp_for_stmt->iter[i].initial;
5002 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5004 static inline void
5005 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5007 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5008 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5009 omp_for_stmt->iter[i].initial = initial;
5013 /* Return the final value for the OMP_FOR statement GS. */
5015 static inline tree
5016 gimple_omp_for_final (const gimple *gs, size_t i)
5018 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5019 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5020 return omp_for_stmt->iter[i].final;
5024 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5026 static inline tree *
5027 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5029 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5030 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5031 return &omp_for_stmt->iter[i].final;
5035 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5037 static inline void
5038 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5040 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5041 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5042 omp_for_stmt->iter[i].final = final;
5046 /* Return the increment value for the OMP_FOR statement GS. */
5048 static inline tree
5049 gimple_omp_for_incr (const gimple *gs, size_t i)
5051 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5052 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5053 return omp_for_stmt->iter[i].incr;
5057 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5059 static inline tree *
5060 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5062 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5063 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5064 return &omp_for_stmt->iter[i].incr;
5068 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5070 static inline void
5071 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5073 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5074 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5075 omp_for_stmt->iter[i].incr = incr;
5079 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5080 statement GS starts. */
5082 static inline gimple_seq *
5083 gimple_omp_for_pre_body_ptr (gimple *gs)
5085 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5086 return &omp_for_stmt->pre_body;
5090 /* Return the sequence of statements to execute before the OMP_FOR
5091 statement GS starts. */
5093 static inline gimple_seq
5094 gimple_omp_for_pre_body (gimple *gs)
5096 return *gimple_omp_for_pre_body_ptr (gs);
5100 /* Set PRE_BODY to be the sequence of statements to execute before the
5101 OMP_FOR statement GS starts. */
5103 static inline void
5104 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5106 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5107 omp_for_stmt->pre_body = pre_body;
5110 /* Return the kernel_phony of OMP_FOR statement. */
5112 static inline bool
5113 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5115 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5118 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5120 static inline void
5121 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5123 if (value)
5124 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5125 else
5126 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5129 /* Return the clauses associated with OMP_PARALLEL GS. */
5131 static inline tree
5132 gimple_omp_parallel_clauses (const gimple *gs)
5134 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5135 return omp_parallel_stmt->clauses;
5139 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5141 static inline tree *
5142 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5144 return &omp_parallel_stmt->clauses;
5148 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5150 static inline void
5151 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5152 tree clauses)
5154 omp_parallel_stmt->clauses = clauses;
5158 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5160 static inline tree
5161 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5163 return omp_parallel_stmt->child_fn;
5166 /* Return a pointer to the child function used to hold the body of
5167 OMP_PARALLEL_STMT. */
5169 static inline tree *
5170 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5172 return &omp_parallel_stmt->child_fn;
5176 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5178 static inline void
5179 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5180 tree child_fn)
5182 omp_parallel_stmt->child_fn = child_fn;
5186 /* Return the artificial argument used to send variables and values
5187 from the parent to the children threads in OMP_PARALLEL_STMT. */
5189 static inline tree
5190 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5192 return omp_parallel_stmt->data_arg;
5196 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5198 static inline tree *
5199 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5201 return &omp_parallel_stmt->data_arg;
5205 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5207 static inline void
5208 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5209 tree data_arg)
5211 omp_parallel_stmt->data_arg = data_arg;
5214 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5216 static inline bool
5217 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5219 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5222 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5224 static inline void
5225 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5227 if (value)
5228 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5229 else
5230 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5233 /* Return the clauses associated with OMP_TASK GS. */
5235 static inline tree
5236 gimple_omp_task_clauses (const gimple *gs)
5238 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5239 return omp_task_stmt->clauses;
5243 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5245 static inline tree *
5246 gimple_omp_task_clauses_ptr (gimple *gs)
5248 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5249 return &omp_task_stmt->clauses;
5253 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5254 GS. */
5256 static inline void
5257 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5259 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5260 omp_task_stmt->clauses = clauses;
5264 /* Return true if OMP task statement G has the
5265 GF_OMP_TASK_TASKLOOP flag set. */
5267 static inline bool
5268 gimple_omp_task_taskloop_p (const gimple *g)
5270 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5271 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5275 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5276 value of TASKLOOP_P. */
5278 static inline void
5279 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5281 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5282 if (taskloop_p)
5283 g->subcode |= GF_OMP_TASK_TASKLOOP;
5284 else
5285 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5289 /* Return the child function used to hold the body of OMP_TASK GS. */
5291 static inline tree
5292 gimple_omp_task_child_fn (const gimple *gs)
5294 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5295 return omp_task_stmt->child_fn;
5298 /* Return a pointer to the child function used to hold the body of
5299 OMP_TASK GS. */
5301 static inline tree *
5302 gimple_omp_task_child_fn_ptr (gimple *gs)
5304 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5305 return &omp_task_stmt->child_fn;
5309 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5311 static inline void
5312 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5314 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5315 omp_task_stmt->child_fn = child_fn;
5319 /* Return the artificial argument used to send variables and values
5320 from the parent to the children threads in OMP_TASK GS. */
5322 static inline tree
5323 gimple_omp_task_data_arg (const gimple *gs)
5325 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5326 return omp_task_stmt->data_arg;
5330 /* Return a pointer to the data argument for OMP_TASK GS. */
5332 static inline tree *
5333 gimple_omp_task_data_arg_ptr (gimple *gs)
5335 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5336 return &omp_task_stmt->data_arg;
5340 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5342 static inline void
5343 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5345 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5346 omp_task_stmt->data_arg = data_arg;
5350 /* Return the clauses associated with OMP_TASK GS. */
5352 static inline tree
5353 gimple_omp_taskreg_clauses (const gimple *gs)
5355 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5356 = as_a <const gimple_statement_omp_taskreg *> (gs);
5357 return omp_taskreg_stmt->clauses;
5361 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5363 static inline tree *
5364 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5366 gimple_statement_omp_taskreg *omp_taskreg_stmt
5367 = as_a <gimple_statement_omp_taskreg *> (gs);
5368 return &omp_taskreg_stmt->clauses;
5372 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5373 GS. */
5375 static inline void
5376 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5378 gimple_statement_omp_taskreg *omp_taskreg_stmt
5379 = as_a <gimple_statement_omp_taskreg *> (gs);
5380 omp_taskreg_stmt->clauses = clauses;
5384 /* Return the child function used to hold the body of OMP_TASK GS. */
5386 static inline tree
5387 gimple_omp_taskreg_child_fn (const gimple *gs)
5389 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5390 = as_a <const gimple_statement_omp_taskreg *> (gs);
5391 return omp_taskreg_stmt->child_fn;
5394 /* Return a pointer to the child function used to hold the body of
5395 OMP_TASK GS. */
5397 static inline tree *
5398 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5400 gimple_statement_omp_taskreg *omp_taskreg_stmt
5401 = as_a <gimple_statement_omp_taskreg *> (gs);
5402 return &omp_taskreg_stmt->child_fn;
5406 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5408 static inline void
5409 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5411 gimple_statement_omp_taskreg *omp_taskreg_stmt
5412 = as_a <gimple_statement_omp_taskreg *> (gs);
5413 omp_taskreg_stmt->child_fn = child_fn;
5417 /* Return the artificial argument used to send variables and values
5418 from the parent to the children threads in OMP_TASK GS. */
5420 static inline tree
5421 gimple_omp_taskreg_data_arg (const gimple *gs)
5423 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5424 = as_a <const gimple_statement_omp_taskreg *> (gs);
5425 return omp_taskreg_stmt->data_arg;
5429 /* Return a pointer to the data argument for OMP_TASK GS. */
5431 static inline tree *
5432 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5434 gimple_statement_omp_taskreg *omp_taskreg_stmt
5435 = as_a <gimple_statement_omp_taskreg *> (gs);
5436 return &omp_taskreg_stmt->data_arg;
5440 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5442 static inline void
5443 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5445 gimple_statement_omp_taskreg *omp_taskreg_stmt
5446 = as_a <gimple_statement_omp_taskreg *> (gs);
5447 omp_taskreg_stmt->data_arg = data_arg;
5451 /* Return the copy function used to hold the body of OMP_TASK GS. */
5453 static inline tree
5454 gimple_omp_task_copy_fn (const gimple *gs)
5456 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5457 return omp_task_stmt->copy_fn;
5460 /* Return a pointer to the copy function used to hold the body of
5461 OMP_TASK GS. */
5463 static inline tree *
5464 gimple_omp_task_copy_fn_ptr (gimple *gs)
5466 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5467 return &omp_task_stmt->copy_fn;
5471 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5473 static inline void
5474 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5476 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5477 omp_task_stmt->copy_fn = copy_fn;
5481 /* Return size of the data block in bytes in OMP_TASK GS. */
5483 static inline tree
5484 gimple_omp_task_arg_size (const gimple *gs)
5486 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5487 return omp_task_stmt->arg_size;
5491 /* Return a pointer to the data block size for OMP_TASK GS. */
5493 static inline tree *
5494 gimple_omp_task_arg_size_ptr (gimple *gs)
5496 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5497 return &omp_task_stmt->arg_size;
5501 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5503 static inline void
5504 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5506 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5507 omp_task_stmt->arg_size = arg_size;
5511 /* Return align of the data block in bytes in OMP_TASK GS. */
5513 static inline tree
5514 gimple_omp_task_arg_align (const gimple *gs)
5516 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5517 return omp_task_stmt->arg_align;
5521 /* Return a pointer to the data block align for OMP_TASK GS. */
5523 static inline tree *
5524 gimple_omp_task_arg_align_ptr (gimple *gs)
5526 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5527 return &omp_task_stmt->arg_align;
5531 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5533 static inline void
5534 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5536 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5537 omp_task_stmt->arg_align = arg_align;
5541 /* Return the clauses associated with OMP_SINGLE GS. */
5543 static inline tree
5544 gimple_omp_single_clauses (const gimple *gs)
5546 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5547 return omp_single_stmt->clauses;
5551 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5553 static inline tree *
5554 gimple_omp_single_clauses_ptr (gimple *gs)
5556 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5557 return &omp_single_stmt->clauses;
5561 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5563 static inline void
5564 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5566 omp_single_stmt->clauses = clauses;
5570 /* Return the clauses associated with OMP_TARGET GS. */
5572 static inline tree
5573 gimple_omp_target_clauses (const gimple *gs)
5575 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5576 return omp_target_stmt->clauses;
5580 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5582 static inline tree *
5583 gimple_omp_target_clauses_ptr (gimple *gs)
5585 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5586 return &omp_target_stmt->clauses;
5590 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5592 static inline void
5593 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5594 tree clauses)
5596 omp_target_stmt->clauses = clauses;
5600 /* Return the kind of the OMP_TARGET G. */
5602 static inline int
5603 gimple_omp_target_kind (const gimple *g)
5605 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5606 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5610 /* Set the kind of the OMP_TARGET G. */
5612 static inline void
5613 gimple_omp_target_set_kind (gomp_target *g, int kind)
5615 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5616 | (kind & GF_OMP_TARGET_KIND_MASK);
5620 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5622 static inline tree
5623 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5625 return omp_target_stmt->child_fn;
5628 /* Return a pointer to the child function used to hold the body of
5629 OMP_TARGET_STMT. */
5631 static inline tree *
5632 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5634 return &omp_target_stmt->child_fn;
5638 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5640 static inline void
5641 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5642 tree child_fn)
5644 omp_target_stmt->child_fn = child_fn;
5648 /* Return the artificial argument used to send variables and values
5649 from the parent to the children threads in OMP_TARGET_STMT. */
5651 static inline tree
5652 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5654 return omp_target_stmt->data_arg;
5658 /* Return a pointer to the data argument for OMP_TARGET GS. */
5660 static inline tree *
5661 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5663 return &omp_target_stmt->data_arg;
5667 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5669 static inline void
5670 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5671 tree data_arg)
5673 omp_target_stmt->data_arg = data_arg;
5677 /* Return the clauses associated with OMP_TEAMS GS. */
5679 static inline tree
5680 gimple_omp_teams_clauses (const gimple *gs)
5682 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5683 return omp_teams_stmt->clauses;
5687 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5689 static inline tree *
5690 gimple_omp_teams_clauses_ptr (gimple *gs)
5692 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5693 return &omp_teams_stmt->clauses;
5697 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5699 static inline void
5700 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5702 omp_teams_stmt->clauses = clauses;
5705 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5707 static inline bool
5708 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5710 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5713 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5715 static inline void
5716 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5718 if (value)
5719 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5720 else
5721 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5724 /* Return the clauses associated with OMP_SECTIONS GS. */
5726 static inline tree
5727 gimple_omp_sections_clauses (const gimple *gs)
5729 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5730 return omp_sections_stmt->clauses;
5734 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5736 static inline tree *
5737 gimple_omp_sections_clauses_ptr (gimple *gs)
5739 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5740 return &omp_sections_stmt->clauses;
5744 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5745 GS. */
5747 static inline void
5748 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5750 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5751 omp_sections_stmt->clauses = clauses;
5755 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5756 in GS. */
5758 static inline tree
5759 gimple_omp_sections_control (const gimple *gs)
5761 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5762 return omp_sections_stmt->control;
5766 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5767 GS. */
5769 static inline tree *
5770 gimple_omp_sections_control_ptr (gimple *gs)
5772 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5773 return &omp_sections_stmt->control;
5777 /* Set CONTROL to be the set of clauses associated with the
5778 GIMPLE_OMP_SECTIONS in GS. */
5780 static inline void
5781 gimple_omp_sections_set_control (gimple *gs, tree control)
5783 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5784 omp_sections_stmt->control = control;
5788 /* Set the value being stored in an atomic store. */
5790 static inline void
5791 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5793 store_stmt->val = val;
5797 /* Return the value being stored in an atomic store. */
5799 static inline tree
5800 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5802 return store_stmt->val;
5806 /* Return a pointer to the value being stored in an atomic store. */
5808 static inline tree *
5809 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5811 return &store_stmt->val;
5815 /* Set the LHS of an atomic load. */
5817 static inline void
5818 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5820 load_stmt->lhs = lhs;
5824 /* Get the LHS of an atomic load. */
5826 static inline tree
5827 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5829 return load_stmt->lhs;
5833 /* Return a pointer to the LHS of an atomic load. */
5835 static inline tree *
5836 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5838 return &load_stmt->lhs;
5842 /* Set the RHS of an atomic load. */
5844 static inline void
5845 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5847 load_stmt->rhs = rhs;
5851 /* Get the RHS of an atomic load. */
5853 static inline tree
5854 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5856 return load_stmt->rhs;
5860 /* Return a pointer to the RHS of an atomic load. */
5862 static inline tree *
5863 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5865 return &load_stmt->rhs;
5869 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5871 static inline tree
5872 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5874 return cont_stmt->control_def;
5877 /* The same as above, but return the address. */
5879 static inline tree *
5880 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5882 return &cont_stmt->control_def;
5885 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5887 static inline void
5888 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5890 cont_stmt->control_def = def;
5894 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5896 static inline tree
5897 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5899 return cont_stmt->control_use;
5903 /* The same as above, but return the address. */
5905 static inline tree *
5906 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5908 return &cont_stmt->control_use;
5912 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5914 static inline void
5915 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5917 cont_stmt->control_use = use;
5920 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5921 TRANSACTION_STMT. */
5923 static inline gimple_seq *
5924 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5926 return &transaction_stmt->body;
5929 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5931 static inline gimple_seq
5932 gimple_transaction_body (gtransaction *transaction_stmt)
5934 return transaction_stmt->body;
5937 /* Return the label associated with a GIMPLE_TRANSACTION. */
5939 static inline tree
5940 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
5942 return transaction_stmt->label_norm;
5945 static inline tree *
5946 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
5948 return &transaction_stmt->label_norm;
5951 static inline tree
5952 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
5954 return transaction_stmt->label_uninst;
5957 static inline tree *
5958 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
5960 return &transaction_stmt->label_uninst;
5963 static inline tree
5964 gimple_transaction_label_over (const gtransaction *transaction_stmt)
5966 return transaction_stmt->label_over;
5969 static inline tree *
5970 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
5972 return &transaction_stmt->label_over;
5975 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5977 static inline unsigned int
5978 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5980 return transaction_stmt->subcode;
5983 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5984 TRANSACTION_STMT. */
5986 static inline void
5987 gimple_transaction_set_body (gtransaction *transaction_stmt,
5988 gimple_seq body)
5990 transaction_stmt->body = body;
5993 /* Set the label associated with a GIMPLE_TRANSACTION. */
5995 static inline void
5996 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
5998 transaction_stmt->label_norm = label;
6001 static inline void
6002 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6004 transaction_stmt->label_uninst = label;
6007 static inline void
6008 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6010 transaction_stmt->label_over = label;
6013 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6015 static inline void
6016 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6017 unsigned int subcode)
6019 transaction_stmt->subcode = subcode;
6022 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6024 static inline tree *
6025 gimple_return_retval_ptr (greturn *gs)
6027 return &gs->op[0];
6030 /* Return the return value for GIMPLE_RETURN GS. */
6032 static inline tree
6033 gimple_return_retval (const greturn *gs)
6035 return gs->op[0];
6039 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6041 static inline void
6042 gimple_return_set_retval (greturn *gs, tree retval)
6044 gs->op[0] = retval;
6048 /* Return the return bounds for GIMPLE_RETURN GS. */
6050 static inline tree
6051 gimple_return_retbnd (const gimple *gs)
6053 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6054 return gimple_op (gs, 1);
6058 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6060 static inline void
6061 gimple_return_set_retbnd (gimple *gs, tree retval)
6063 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6064 gimple_set_op (gs, 1, retval);
6068 /* Returns true when the gimple statement STMT is any of the OMP types. */
6070 #define CASE_GIMPLE_OMP \
6071 case GIMPLE_OMP_PARALLEL: \
6072 case GIMPLE_OMP_TASK: \
6073 case GIMPLE_OMP_FOR: \
6074 case GIMPLE_OMP_SECTIONS: \
6075 case GIMPLE_OMP_SECTIONS_SWITCH: \
6076 case GIMPLE_OMP_SINGLE: \
6077 case GIMPLE_OMP_TARGET: \
6078 case GIMPLE_OMP_TEAMS: \
6079 case GIMPLE_OMP_SECTION: \
6080 case GIMPLE_OMP_MASTER: \
6081 case GIMPLE_OMP_TASKGROUP: \
6082 case GIMPLE_OMP_ORDERED: \
6083 case GIMPLE_OMP_CRITICAL: \
6084 case GIMPLE_OMP_RETURN: \
6085 case GIMPLE_OMP_ATOMIC_LOAD: \
6086 case GIMPLE_OMP_ATOMIC_STORE: \
6087 case GIMPLE_OMP_CONTINUE: \
6088 case GIMPLE_OMP_GRID_BODY
6090 static inline bool
6091 is_gimple_omp (const gimple *stmt)
6093 switch (gimple_code (stmt))
6095 CASE_GIMPLE_OMP:
6096 return true;
6097 default:
6098 return false;
6102 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6103 specifically. */
6105 static inline bool
6106 is_gimple_omp_oacc (const gimple *stmt)
6108 gcc_assert (is_gimple_omp (stmt));
6109 switch (gimple_code (stmt))
6111 case GIMPLE_OMP_FOR:
6112 switch (gimple_omp_for_kind (stmt))
6114 case GF_OMP_FOR_KIND_OACC_LOOP:
6115 return true;
6116 default:
6117 return false;
6119 case GIMPLE_OMP_TARGET:
6120 switch (gimple_omp_target_kind (stmt))
6122 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6123 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6124 case GF_OMP_TARGET_KIND_OACC_DATA:
6125 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6126 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6127 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6128 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6129 return true;
6130 default:
6131 return false;
6133 default:
6134 return false;
6139 /* Return true if the OMP gimple statement STMT is offloaded. */
6141 static inline bool
6142 is_gimple_omp_offloaded (const gimple *stmt)
6144 gcc_assert (is_gimple_omp (stmt));
6145 switch (gimple_code (stmt))
6147 case GIMPLE_OMP_TARGET:
6148 switch (gimple_omp_target_kind (stmt))
6150 case GF_OMP_TARGET_KIND_REGION:
6151 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6152 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6153 return true;
6154 default:
6155 return false;
6157 default:
6158 return false;
6163 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6165 static inline bool
6166 gimple_nop_p (const gimple *g)
6168 return gimple_code (g) == GIMPLE_NOP;
6172 /* Return true if GS is a GIMPLE_RESX. */
6174 static inline bool
6175 is_gimple_resx (const gimple *gs)
6177 return gimple_code (gs) == GIMPLE_RESX;
6180 /* Return the type of the main expression computed by STMT. Return
6181 void_type_node if the statement computes nothing. */
6183 static inline tree
6184 gimple_expr_type (const gimple *stmt)
6186 enum gimple_code code = gimple_code (stmt);
6187 /* In general we want to pass out a type that can be substituted
6188 for both the RHS and the LHS types if there is a possibly
6189 useless conversion involved. That means returning the
6190 original RHS type as far as we can reconstruct it. */
6191 if (code == GIMPLE_CALL)
6193 const gcall *call_stmt = as_a <const gcall *> (stmt);
6194 if (gimple_call_internal_p (call_stmt)
6195 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6196 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6197 else
6198 return gimple_call_return_type (call_stmt);
6200 else if (code == GIMPLE_ASSIGN)
6202 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6203 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6204 else
6205 /* As fallback use the type of the LHS. */
6206 return TREE_TYPE (gimple_get_lhs (stmt));
6208 else if (code == GIMPLE_COND)
6209 return boolean_type_node;
6210 else
6211 return void_type_node;
6214 /* Enum and arrays used for allocation stats. Keep in sync with
6215 gimple.c:gimple_alloc_kind_names. */
6216 enum gimple_alloc_kind
6218 gimple_alloc_kind_assign, /* Assignments. */
6219 gimple_alloc_kind_phi, /* PHI nodes. */
6220 gimple_alloc_kind_cond, /* Conditionals. */
6221 gimple_alloc_kind_rest, /* Everything else. */
6222 gimple_alloc_kind_all
6225 extern int gimple_alloc_counts[];
6226 extern int gimple_alloc_sizes[];
6228 /* Return the allocation kind for a given stmt CODE. */
6229 static inline enum gimple_alloc_kind
6230 gimple_alloc_kind (enum gimple_code code)
6232 switch (code)
6234 case GIMPLE_ASSIGN:
6235 return gimple_alloc_kind_assign;
6236 case GIMPLE_PHI:
6237 return gimple_alloc_kind_phi;
6238 case GIMPLE_COND:
6239 return gimple_alloc_kind_cond;
6240 default:
6241 return gimple_alloc_kind_rest;
6245 /* Return true if a location should not be emitted for this statement
6246 by annotate_all_with_location. */
6248 static inline bool
6249 gimple_do_not_emit_location_p (gimple *g)
6251 return gimple_plf (g, GF_PLF_1);
6254 /* Mark statement G so a location will not be emitted by
6255 annotate_one_with_location. */
6257 static inline void
6258 gimple_set_do_not_emit_location (gimple *g)
6260 /* The PLF flags are initialized to 0 when a new tuple is created,
6261 so no need to initialize it anywhere. */
6262 gimple_set_plf (g, GF_PLF_1, true);
6266 /* Macros for showing usage statistics. */
6267 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6268 ? (x) \
6269 : ((x) < 1024*1024*10 \
6270 ? (x) / 1024 \
6271 : (x) / (1024*1024))))
6273 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6275 #endif /* GCC_GIMPLE_H */