match.pd: Relax some tree_nop_conversion_p
[official-gcc.git] / gcc / gimple.h
blob063e29d78978f4dad74db05705be1d10856d8607
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 *);
1529 /* Formal (expression) temporary table handling: multiple occurrences of
1530 the same scalar expression are evaluated into the same temporary. */
1532 typedef struct gimple_temp_hash_elt
1534 tree val; /* Key */
1535 tree temp; /* Value */
1536 } elt_t;
1538 /* Get the number of the next statement uid to be allocated. */
1539 static inline unsigned int
1540 gimple_stmt_max_uid (struct function *fn)
1542 return fn->last_stmt_uid;
1545 /* Set the number of the next statement uid to be allocated. */
1546 static inline void
1547 set_gimple_stmt_max_uid (struct function *fn, unsigned int maxid)
1549 fn->last_stmt_uid = maxid;
1552 /* Set the number of the next statement uid to be allocated. */
1553 static inline unsigned int
1554 inc_gimple_stmt_max_uid (struct function *fn)
1556 return fn->last_stmt_uid++;
1559 /* Return the first node in GIMPLE sequence S. */
1561 static inline gimple_seq_node
1562 gimple_seq_first (gimple_seq s)
1564 return s;
1568 /* Return the first statement in GIMPLE sequence S. */
1570 static inline gimple *
1571 gimple_seq_first_stmt (gimple_seq s)
1573 gimple_seq_node n = gimple_seq_first (s);
1574 return n;
1577 /* Return the first statement in GIMPLE sequence S as a gbind *,
1578 verifying that it has code GIMPLE_BIND in a checked build. */
1580 static inline gbind *
1581 gimple_seq_first_stmt_as_a_bind (gimple_seq s)
1583 gimple_seq_node n = gimple_seq_first (s);
1584 return as_a <gbind *> (n);
1588 /* Return the last node in GIMPLE sequence S. */
1590 static inline gimple_seq_node
1591 gimple_seq_last (gimple_seq s)
1593 return s ? s->prev : NULL;
1597 /* Return the last statement in GIMPLE sequence S. */
1599 static inline gimple *
1600 gimple_seq_last_stmt (gimple_seq s)
1602 gimple_seq_node n = gimple_seq_last (s);
1603 return n;
1607 /* Set the last node in GIMPLE sequence *PS to LAST. */
1609 static inline void
1610 gimple_seq_set_last (gimple_seq *ps, gimple_seq_node last)
1612 (*ps)->prev = last;
1616 /* Set the first node in GIMPLE sequence *PS to FIRST. */
1618 static inline void
1619 gimple_seq_set_first (gimple_seq *ps, gimple_seq_node first)
1621 *ps = first;
1625 /* Return true if GIMPLE sequence S is empty. */
1627 static inline bool
1628 gimple_seq_empty_p (gimple_seq s)
1630 return s == NULL;
1633 /* Allocate a new sequence and initialize its first element with STMT. */
1635 static inline gimple_seq
1636 gimple_seq_alloc_with_stmt (gimple *stmt)
1638 gimple_seq seq = NULL;
1639 gimple_seq_add_stmt (&seq, stmt);
1640 return seq;
1644 /* Returns the sequence of statements in BB. */
1646 static inline gimple_seq
1647 bb_seq (const_basic_block bb)
1649 return (!(bb->flags & BB_RTL)) ? bb->il.gimple.seq : NULL;
1652 static inline gimple_seq *
1653 bb_seq_addr (basic_block bb)
1655 return (!(bb->flags & BB_RTL)) ? &bb->il.gimple.seq : NULL;
1658 /* Sets the sequence of statements in BB to SEQ. */
1660 static inline void
1661 set_bb_seq (basic_block bb, gimple_seq seq)
1663 gcc_checking_assert (!(bb->flags & BB_RTL));
1664 bb->il.gimple.seq = seq;
1668 /* Return the code for GIMPLE statement G. */
1670 static inline enum gimple_code
1671 gimple_code (const gimple *g)
1673 return g->code;
1677 /* Return the GSS code used by a GIMPLE code. */
1679 static inline enum gimple_statement_structure_enum
1680 gss_for_code (enum gimple_code code)
1682 gcc_gimple_checking_assert ((unsigned int)code < LAST_AND_UNUSED_GIMPLE_CODE);
1683 return gss_for_code_[code];
1687 /* Return which GSS code is used by GS. */
1689 static inline enum gimple_statement_structure_enum
1690 gimple_statement_structure (gimple *gs)
1692 return gss_for_code (gimple_code (gs));
1696 /* Return true if statement G has sub-statements. This is only true for
1697 High GIMPLE statements. */
1699 static inline bool
1700 gimple_has_substatements (gimple *g)
1702 switch (gimple_code (g))
1704 case GIMPLE_BIND:
1705 case GIMPLE_CATCH:
1706 case GIMPLE_EH_FILTER:
1707 case GIMPLE_EH_ELSE:
1708 case GIMPLE_TRY:
1709 case GIMPLE_OMP_FOR:
1710 case GIMPLE_OMP_MASTER:
1711 case GIMPLE_OMP_TASKGROUP:
1712 case GIMPLE_OMP_ORDERED:
1713 case GIMPLE_OMP_SECTION:
1714 case GIMPLE_OMP_PARALLEL:
1715 case GIMPLE_OMP_TASK:
1716 case GIMPLE_OMP_SECTIONS:
1717 case GIMPLE_OMP_SINGLE:
1718 case GIMPLE_OMP_TARGET:
1719 case GIMPLE_OMP_TEAMS:
1720 case GIMPLE_OMP_CRITICAL:
1721 case GIMPLE_WITH_CLEANUP_EXPR:
1722 case GIMPLE_TRANSACTION:
1723 case GIMPLE_OMP_GRID_BODY:
1724 return true;
1726 default:
1727 return false;
1732 /* Return the basic block holding statement G. */
1734 static inline basic_block
1735 gimple_bb (const gimple *g)
1737 return g->bb;
1741 /* Return the lexical scope block holding statement G. */
1743 static inline tree
1744 gimple_block (const gimple *g)
1746 return LOCATION_BLOCK (g->location);
1750 /* Set BLOCK to be the lexical scope block holding statement G. */
1752 static inline void
1753 gimple_set_block (gimple *g, tree block)
1755 g->location = set_block (g->location, block);
1759 /* Return location information for statement G. */
1761 static inline location_t
1762 gimple_location (const gimple *g)
1764 return g->location;
1767 /* Return location information for statement G if g is not NULL.
1768 Otherwise, UNKNOWN_LOCATION is returned. */
1770 static inline location_t
1771 gimple_location_safe (const gimple *g)
1773 return g ? gimple_location (g) : UNKNOWN_LOCATION;
1776 /* Set location information for statement G. */
1778 static inline void
1779 gimple_set_location (gimple *g, location_t location)
1781 g->location = location;
1785 /* Return true if G contains location information. */
1787 static inline bool
1788 gimple_has_location (const gimple *g)
1790 return LOCATION_LOCUS (gimple_location (g)) != UNKNOWN_LOCATION;
1794 /* Return the file name of the location of STMT. */
1796 static inline const char *
1797 gimple_filename (const gimple *stmt)
1799 return LOCATION_FILE (gimple_location (stmt));
1803 /* Return the line number of the location of STMT. */
1805 static inline int
1806 gimple_lineno (const gimple *stmt)
1808 return LOCATION_LINE (gimple_location (stmt));
1812 /* Determine whether SEQ is a singleton. */
1814 static inline bool
1815 gimple_seq_singleton_p (gimple_seq seq)
1817 return ((gimple_seq_first (seq) != NULL)
1818 && (gimple_seq_first (seq) == gimple_seq_last (seq)));
1821 /* Return true if no warnings should be emitted for statement STMT. */
1823 static inline bool
1824 gimple_no_warning_p (const gimple *stmt)
1826 return stmt->no_warning;
1829 /* Set the no_warning flag of STMT to NO_WARNING. */
1831 static inline void
1832 gimple_set_no_warning (gimple *stmt, bool no_warning)
1834 stmt->no_warning = (unsigned) no_warning;
1837 /* Set the visited status on statement STMT to VISITED_P.
1839 Please note that this 'visited' property of the gimple statement is
1840 supposed to be undefined at pass boundaries. This means that a
1841 given pass should not assume it contains any useful value when the
1842 pass starts and thus can set it to any value it sees fit.
1844 You can learn more about the visited property of the gimple
1845 statement by reading the comments of the 'visited' data member of
1846 struct gimple.
1849 static inline void
1850 gimple_set_visited (gimple *stmt, bool visited_p)
1852 stmt->visited = (unsigned) visited_p;
1856 /* Return the visited status for statement STMT.
1858 Please note that this 'visited' property of the gimple statement is
1859 supposed to be undefined at pass boundaries. This means that a
1860 given pass should not assume it contains any useful value when the
1861 pass starts and thus can set it to any value it sees fit.
1863 You can learn more about the visited property of the gimple
1864 statement by reading the comments of the 'visited' data member of
1865 struct gimple. */
1867 static inline bool
1868 gimple_visited_p (gimple *stmt)
1870 return stmt->visited;
1874 /* Set pass local flag PLF on statement STMT to VAL_P.
1876 Please note that this PLF property of the gimple statement is
1877 supposed to be undefined at pass boundaries. This means that a
1878 given pass should not assume it contains any useful value when the
1879 pass starts and thus can set it to any value it sees fit.
1881 You can learn more about the PLF property by reading the comment of
1882 the 'plf' data member of struct gimple_statement_structure. */
1884 static inline void
1885 gimple_set_plf (gimple *stmt, enum plf_mask plf, bool val_p)
1887 if (val_p)
1888 stmt->plf |= (unsigned int) plf;
1889 else
1890 stmt->plf &= ~((unsigned int) plf);
1894 /* Return the value of pass local flag PLF on statement STMT.
1896 Please note that this 'plf' property of the gimple statement is
1897 supposed to be undefined at pass boundaries. This means that a
1898 given pass should not assume it contains any useful value when the
1899 pass starts and thus can set it to any value it sees fit.
1901 You can learn more about the plf property by reading the comment of
1902 the 'plf' data member of struct gimple_statement_structure. */
1904 static inline unsigned int
1905 gimple_plf (gimple *stmt, enum plf_mask plf)
1907 return stmt->plf & ((unsigned int) plf);
1911 /* Set the UID of statement.
1913 Please note that this UID property is supposed to be undefined at
1914 pass boundaries. This means that a given pass should not assume it
1915 contains any useful value when the pass starts and thus can set it
1916 to any value it sees fit. */
1918 static inline void
1919 gimple_set_uid (gimple *g, unsigned uid)
1921 g->uid = uid;
1925 /* Return the UID of statement.
1927 Please note that this UID property is supposed to be undefined at
1928 pass boundaries. This means that a given pass should not assume it
1929 contains any useful value when the pass starts and thus can set it
1930 to any value it sees fit. */
1932 static inline unsigned
1933 gimple_uid (const gimple *g)
1935 return g->uid;
1939 /* Make statement G a singleton sequence. */
1941 static inline void
1942 gimple_init_singleton (gimple *g)
1944 g->next = NULL;
1945 g->prev = g;
1949 /* Return true if GIMPLE statement G has register or memory operands. */
1951 static inline bool
1952 gimple_has_ops (const gimple *g)
1954 return gimple_code (g) >= GIMPLE_COND && gimple_code (g) <= GIMPLE_RETURN;
1957 template <>
1958 template <>
1959 inline bool
1960 is_a_helper <const gimple_statement_with_ops *>::test (const gimple *gs)
1962 return gimple_has_ops (gs);
1965 template <>
1966 template <>
1967 inline bool
1968 is_a_helper <gimple_statement_with_ops *>::test (gimple *gs)
1970 return gimple_has_ops (gs);
1973 /* Return true if GIMPLE statement G has memory operands. */
1975 static inline bool
1976 gimple_has_mem_ops (const gimple *g)
1978 return gimple_code (g) >= GIMPLE_ASSIGN && gimple_code (g) <= GIMPLE_RETURN;
1981 template <>
1982 template <>
1983 inline bool
1984 is_a_helper <const gimple_statement_with_memory_ops *>::test (const gimple *gs)
1986 return gimple_has_mem_ops (gs);
1989 template <>
1990 template <>
1991 inline bool
1992 is_a_helper <gimple_statement_with_memory_ops *>::test (gimple *gs)
1994 return gimple_has_mem_ops (gs);
1997 /* Return the set of USE operands for statement G. */
1999 static inline struct use_optype_d *
2000 gimple_use_ops (const gimple *g)
2002 const gimple_statement_with_ops *ops_stmt =
2003 dyn_cast <const gimple_statement_with_ops *> (g);
2004 if (!ops_stmt)
2005 return NULL;
2006 return ops_stmt->use_ops;
2010 /* Set USE to be the set of USE operands for statement G. */
2012 static inline void
2013 gimple_set_use_ops (gimple *g, struct use_optype_d *use)
2015 gimple_statement_with_ops *ops_stmt =
2016 as_a <gimple_statement_with_ops *> (g);
2017 ops_stmt->use_ops = use;
2021 /* Return the single VUSE operand of the statement G. */
2023 static inline tree
2024 gimple_vuse (const gimple *g)
2026 const gimple_statement_with_memory_ops *mem_ops_stmt =
2027 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2028 if (!mem_ops_stmt)
2029 return NULL_TREE;
2030 return mem_ops_stmt->vuse;
2033 /* Return the single VDEF operand of the statement G. */
2035 static inline tree
2036 gimple_vdef (const gimple *g)
2038 const gimple_statement_with_memory_ops *mem_ops_stmt =
2039 dyn_cast <const gimple_statement_with_memory_ops *> (g);
2040 if (!mem_ops_stmt)
2041 return NULL_TREE;
2042 return mem_ops_stmt->vdef;
2045 /* Return the single VUSE operand of the statement G. */
2047 static inline tree *
2048 gimple_vuse_ptr (gimple *g)
2050 gimple_statement_with_memory_ops *mem_ops_stmt =
2051 dyn_cast <gimple_statement_with_memory_ops *> (g);
2052 if (!mem_ops_stmt)
2053 return NULL;
2054 return &mem_ops_stmt->vuse;
2057 /* Return the single VDEF operand of the statement G. */
2059 static inline tree *
2060 gimple_vdef_ptr (gimple *g)
2062 gimple_statement_with_memory_ops *mem_ops_stmt =
2063 dyn_cast <gimple_statement_with_memory_ops *> (g);
2064 if (!mem_ops_stmt)
2065 return NULL;
2066 return &mem_ops_stmt->vdef;
2069 /* Set the single VUSE operand of the statement G. */
2071 static inline void
2072 gimple_set_vuse (gimple *g, tree vuse)
2074 gimple_statement_with_memory_ops *mem_ops_stmt =
2075 as_a <gimple_statement_with_memory_ops *> (g);
2076 mem_ops_stmt->vuse = vuse;
2079 /* Set the single VDEF operand of the statement G. */
2081 static inline void
2082 gimple_set_vdef (gimple *g, tree vdef)
2084 gimple_statement_with_memory_ops *mem_ops_stmt =
2085 as_a <gimple_statement_with_memory_ops *> (g);
2086 mem_ops_stmt->vdef = vdef;
2090 /* Return true if statement G has operands and the modified field has
2091 been set. */
2093 static inline bool
2094 gimple_modified_p (const gimple *g)
2096 return (gimple_has_ops (g)) ? (bool) g->modified : false;
2100 /* Set the MODIFIED flag to MODIFIEDP, iff the gimple statement G has
2101 a MODIFIED field. */
2103 static inline void
2104 gimple_set_modified (gimple *s, bool modifiedp)
2106 if (gimple_has_ops (s))
2107 s->modified = (unsigned) modifiedp;
2111 /* Return the tree code for the expression computed by STMT. This is
2112 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
2113 GIMPLE_CALL, return CALL_EXPR as the expression code for
2114 consistency. This is useful when the caller needs to deal with the
2115 three kinds of computation that GIMPLE supports. */
2117 static inline enum tree_code
2118 gimple_expr_code (const gimple *stmt)
2120 enum gimple_code code = gimple_code (stmt);
2121 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
2122 return (enum tree_code) stmt->subcode;
2123 else
2125 gcc_gimple_checking_assert (code == GIMPLE_CALL);
2126 return CALL_EXPR;
2131 /* Return true if statement STMT contains volatile operands. */
2133 static inline bool
2134 gimple_has_volatile_ops (const gimple *stmt)
2136 if (gimple_has_mem_ops (stmt))
2137 return stmt->has_volatile_ops;
2138 else
2139 return false;
2143 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
2145 static inline void
2146 gimple_set_has_volatile_ops (gimple *stmt, bool volatilep)
2148 if (gimple_has_mem_ops (stmt))
2149 stmt->has_volatile_ops = (unsigned) volatilep;
2152 /* Return true if STMT is in a transaction. */
2154 static inline bool
2155 gimple_in_transaction (const gimple *stmt)
2157 return bb_in_transaction (gimple_bb (stmt));
2160 /* Return true if statement STMT may access memory. */
2162 static inline bool
2163 gimple_references_memory_p (gimple *stmt)
2165 return gimple_has_mem_ops (stmt) && gimple_vuse (stmt);
2169 /* Return the subcode for OMP statement S. */
2171 static inline unsigned
2172 gimple_omp_subcode (const gimple *s)
2174 gcc_gimple_checking_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
2175 && gimple_code (s) <= GIMPLE_OMP_TEAMS);
2176 return s->subcode;
2179 /* Set the subcode for OMP statement S to SUBCODE. */
2181 static inline void
2182 gimple_omp_set_subcode (gimple *s, unsigned int subcode)
2184 /* We only have 16 bits for the subcode. Assert that we are not
2185 overflowing it. */
2186 gcc_gimple_checking_assert (subcode < (1 << 16));
2187 s->subcode = subcode;
2190 /* Set the nowait flag on OMP_RETURN statement S. */
2192 static inline void
2193 gimple_omp_return_set_nowait (gimple *s)
2195 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
2196 s->subcode |= GF_OMP_RETURN_NOWAIT;
2200 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
2201 flag set. */
2203 static inline bool
2204 gimple_omp_return_nowait_p (const gimple *g)
2206 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
2207 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
2211 /* Set the LHS of OMP return. */
2213 static inline void
2214 gimple_omp_return_set_lhs (gimple *g, tree lhs)
2216 gimple_statement_omp_return *omp_return_stmt =
2217 as_a <gimple_statement_omp_return *> (g);
2218 omp_return_stmt->val = lhs;
2222 /* Get the LHS of OMP return. */
2224 static inline tree
2225 gimple_omp_return_lhs (const gimple *g)
2227 const gimple_statement_omp_return *omp_return_stmt =
2228 as_a <const gimple_statement_omp_return *> (g);
2229 return omp_return_stmt->val;
2233 /* Return a pointer to the LHS of OMP return. */
2235 static inline tree *
2236 gimple_omp_return_lhs_ptr (gimple *g)
2238 gimple_statement_omp_return *omp_return_stmt =
2239 as_a <gimple_statement_omp_return *> (g);
2240 return &omp_return_stmt->val;
2244 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
2245 flag set. */
2247 static inline bool
2248 gimple_omp_section_last_p (const gimple *g)
2250 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2251 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
2255 /* Set the GF_OMP_SECTION_LAST flag on G. */
2257 static inline void
2258 gimple_omp_section_set_last (gimple *g)
2260 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
2261 g->subcode |= GF_OMP_SECTION_LAST;
2265 /* Return true if OMP parallel statement G has the
2266 GF_OMP_PARALLEL_COMBINED flag set. */
2268 static inline bool
2269 gimple_omp_parallel_combined_p (const gimple *g)
2271 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2272 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
2276 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
2277 value of COMBINED_P. */
2279 static inline void
2280 gimple_omp_parallel_set_combined_p (gimple *g, bool combined_p)
2282 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
2283 if (combined_p)
2284 g->subcode |= GF_OMP_PARALLEL_COMBINED;
2285 else
2286 g->subcode &= ~GF_OMP_PARALLEL_COMBINED;
2290 /* Return true if OMP atomic load/store statement G has the
2291 GF_OMP_ATOMIC_NEED_VALUE flag set. */
2293 static inline bool
2294 gimple_omp_atomic_need_value_p (const gimple *g)
2296 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2297 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2298 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_NEED_VALUE) != 0;
2302 /* Set the GF_OMP_ATOMIC_NEED_VALUE flag on G. */
2304 static inline void
2305 gimple_omp_atomic_set_need_value (gimple *g)
2307 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2308 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2309 g->subcode |= GF_OMP_ATOMIC_NEED_VALUE;
2313 /* Return true if OMP atomic load/store statement G has the
2314 GF_OMP_ATOMIC_SEQ_CST flag set. */
2316 static inline bool
2317 gimple_omp_atomic_seq_cst_p (const gimple *g)
2319 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2320 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2321 return (gimple_omp_subcode (g) & GF_OMP_ATOMIC_SEQ_CST) != 0;
2325 /* Set the GF_OMP_ATOMIC_SEQ_CST flag on G. */
2327 static inline void
2328 gimple_omp_atomic_set_seq_cst (gimple *g)
2330 if (gimple_code (g) != GIMPLE_OMP_ATOMIC_LOAD)
2331 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
2332 g->subcode |= GF_OMP_ATOMIC_SEQ_CST;
2336 /* Return the number of operands for statement GS. */
2338 static inline unsigned
2339 gimple_num_ops (const gimple *gs)
2341 return gs->num_ops;
2345 /* Set the number of operands for statement GS. */
2347 static inline void
2348 gimple_set_num_ops (gimple *gs, unsigned num_ops)
2350 gs->num_ops = num_ops;
2354 /* Return the array of operands for statement GS. */
2356 static inline tree *
2357 gimple_ops (gimple *gs)
2359 size_t off;
2361 /* All the tuples have their operand vector at the very bottom
2362 of the structure. Note that those structures that do not
2363 have an operand vector have a zero offset. */
2364 off = gimple_ops_offset_[gimple_statement_structure (gs)];
2365 gcc_gimple_checking_assert (off != 0);
2367 return (tree *) ((char *) gs + off);
2371 /* Return operand I for statement GS. */
2373 static inline tree
2374 gimple_op (const gimple *gs, unsigned i)
2376 if (gimple_has_ops (gs))
2378 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2379 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
2381 else
2382 return NULL_TREE;
2385 /* Return a pointer to operand I for statement GS. */
2387 static inline tree *
2388 gimple_op_ptr (gimple *gs, unsigned i)
2390 if (gimple_has_ops (gs))
2392 gcc_gimple_checking_assert (i < gimple_num_ops (gs));
2393 return gimple_ops (gs) + i;
2395 else
2396 return NULL;
2399 /* Set operand I of statement GS to OP. */
2401 static inline void
2402 gimple_set_op (gimple *gs, unsigned i, tree op)
2404 gcc_gimple_checking_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
2406 /* Note. It may be tempting to assert that OP matches
2407 is_gimple_operand, but that would be wrong. Different tuples
2408 accept slightly different sets of tree operands. Each caller
2409 should perform its own validation. */
2410 gimple_ops (gs)[i] = op;
2413 /* Return true if GS is a GIMPLE_ASSIGN. */
2415 static inline bool
2416 is_gimple_assign (const gimple *gs)
2418 return gimple_code (gs) == GIMPLE_ASSIGN;
2421 /* Determine if expression CODE is one of the valid expressions that can
2422 be used on the RHS of GIMPLE assignments. */
2424 static inline enum gimple_rhs_class
2425 get_gimple_rhs_class (enum tree_code code)
2427 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
2430 /* Return the LHS of assignment statement GS. */
2432 static inline tree
2433 gimple_assign_lhs (const gassign *gs)
2435 return gs->op[0];
2438 static inline tree
2439 gimple_assign_lhs (const gimple *gs)
2441 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2442 return gimple_assign_lhs (ass);
2446 /* Return a pointer to the LHS of assignment statement GS. */
2448 static inline tree *
2449 gimple_assign_lhs_ptr (gassign *gs)
2451 return &gs->op[0];
2454 static inline tree *
2455 gimple_assign_lhs_ptr (gimple *gs)
2457 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2458 return gimple_assign_lhs_ptr (ass);
2462 /* Set LHS to be the LHS operand of assignment statement GS. */
2464 static inline void
2465 gimple_assign_set_lhs (gassign *gs, tree lhs)
2467 gs->op[0] = lhs;
2469 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2470 SSA_NAME_DEF_STMT (lhs) = gs;
2473 static inline void
2474 gimple_assign_set_lhs (gimple *gs, tree lhs)
2476 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2477 gimple_assign_set_lhs (ass, lhs);
2481 /* Return the first operand on the RHS of assignment statement GS. */
2483 static inline tree
2484 gimple_assign_rhs1 (const gassign *gs)
2486 return gs->op[1];
2489 static inline tree
2490 gimple_assign_rhs1 (const gimple *gs)
2492 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2493 return gimple_assign_rhs1 (ass);
2497 /* Return a pointer to the first operand on the RHS of assignment
2498 statement GS. */
2500 static inline tree *
2501 gimple_assign_rhs1_ptr (gassign *gs)
2503 return &gs->op[1];
2506 static inline tree *
2507 gimple_assign_rhs1_ptr (gimple *gs)
2509 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2510 return gimple_assign_rhs1_ptr (ass);
2513 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
2515 static inline void
2516 gimple_assign_set_rhs1 (gassign *gs, tree rhs)
2518 gs->op[1] = rhs;
2521 static inline void
2522 gimple_assign_set_rhs1 (gimple *gs, tree rhs)
2524 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2525 gimple_assign_set_rhs1 (ass, rhs);
2529 /* Return the second operand on the RHS of assignment statement GS.
2530 If GS does not have two operands, NULL is returned instead. */
2532 static inline tree
2533 gimple_assign_rhs2 (const gassign *gs)
2535 if (gimple_num_ops (gs) >= 3)
2536 return gs->op[2];
2537 else
2538 return NULL_TREE;
2541 static inline tree
2542 gimple_assign_rhs2 (const gimple *gs)
2544 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2545 return gimple_assign_rhs2 (ass);
2549 /* Return a pointer to the second operand on the RHS of assignment
2550 statement GS. */
2552 static inline tree *
2553 gimple_assign_rhs2_ptr (gassign *gs)
2555 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2556 return &gs->op[2];
2559 static inline tree *
2560 gimple_assign_rhs2_ptr (gimple *gs)
2562 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2563 return gimple_assign_rhs2_ptr (ass);
2567 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
2569 static inline void
2570 gimple_assign_set_rhs2 (gassign *gs, tree rhs)
2572 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 3);
2573 gs->op[2] = rhs;
2576 static inline void
2577 gimple_assign_set_rhs2 (gimple *gs, tree rhs)
2579 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2580 return gimple_assign_set_rhs2 (ass, rhs);
2583 /* Return the third operand on the RHS of assignment statement GS.
2584 If GS does not have two operands, NULL is returned instead. */
2586 static inline tree
2587 gimple_assign_rhs3 (const gassign *gs)
2589 if (gimple_num_ops (gs) >= 4)
2590 return gs->op[3];
2591 else
2592 return NULL_TREE;
2595 static inline tree
2596 gimple_assign_rhs3 (const gimple *gs)
2598 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2599 return gimple_assign_rhs3 (ass);
2602 /* Return a pointer to the third operand on the RHS of assignment
2603 statement GS. */
2605 static inline tree *
2606 gimple_assign_rhs3_ptr (gimple *gs)
2608 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2609 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2610 return &ass->op[3];
2614 /* Set RHS to be the third operand on the RHS of assignment statement GS. */
2616 static inline void
2617 gimple_assign_set_rhs3 (gassign *gs, tree rhs)
2619 gcc_gimple_checking_assert (gimple_num_ops (gs) >= 4);
2620 gs->op[3] = rhs;
2623 static inline void
2624 gimple_assign_set_rhs3 (gimple *gs, tree rhs)
2626 gassign *ass = GIMPLE_CHECK2<gassign *> (gs);
2627 gimple_assign_set_rhs3 (ass, rhs);
2631 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2632 which expect to see only two operands. */
2634 static inline void
2635 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2636 tree op1, tree op2)
2638 gimple_assign_set_rhs_with_ops (gsi, code, op1, op2, NULL);
2641 /* A wrapper around 3 operand gimple_assign_set_rhs_with_ops, for callers
2642 which expect to see only one operands. */
2644 static inline void
2645 gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
2646 tree op1)
2648 gimple_assign_set_rhs_with_ops (gsi, code, op1, NULL, NULL);
2651 /* Returns true if GS is a nontemporal move. */
2653 static inline bool
2654 gimple_assign_nontemporal_move_p (const gassign *gs)
2656 return gs->nontemporal_move;
2659 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
2661 static inline void
2662 gimple_assign_set_nontemporal_move (gimple *gs, bool nontemporal)
2664 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
2665 gs->nontemporal_move = nontemporal;
2669 /* Return the code of the expression computed on the rhs of assignment
2670 statement GS. In case that the RHS is a single object, returns the
2671 tree code of the object. */
2673 static inline enum tree_code
2674 gimple_assign_rhs_code (const gassign *gs)
2676 enum tree_code code = (enum tree_code) gs->subcode;
2677 /* While we initially set subcode to the TREE_CODE of the rhs for
2678 GIMPLE_SINGLE_RHS assigns we do not update that subcode to stay
2679 in sync when we rewrite stmts into SSA form or do SSA propagations. */
2680 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
2681 code = TREE_CODE (gs->op[1]);
2683 return code;
2686 static inline enum tree_code
2687 gimple_assign_rhs_code (const gimple *gs)
2689 const gassign *ass = GIMPLE_CHECK2<const gassign *> (gs);
2690 return gimple_assign_rhs_code (ass);
2694 /* Set CODE to be the code for the expression computed on the RHS of
2695 assignment S. */
2697 static inline void
2698 gimple_assign_set_rhs_code (gimple *s, enum tree_code code)
2700 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
2701 s->subcode = code;
2705 /* Return the gimple rhs class of the code of the expression computed on
2706 the rhs of assignment statement GS.
2707 This will never return GIMPLE_INVALID_RHS. */
2709 static inline enum gimple_rhs_class
2710 gimple_assign_rhs_class (const gimple *gs)
2712 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
2715 /* Return true if GS is an assignment with a singleton RHS, i.e.,
2716 there is no operator associated with the assignment itself.
2717 Unlike gimple_assign_copy_p, this predicate returns true for
2718 any RHS operand, including those that perform an operation
2719 and do not have the semantics of a copy, such as COND_EXPR. */
2721 static inline bool
2722 gimple_assign_single_p (const gimple *gs)
2724 return (is_gimple_assign (gs)
2725 && gimple_assign_rhs_class (gs) == GIMPLE_SINGLE_RHS);
2728 /* Return true if GS performs a store to its lhs. */
2730 static inline bool
2731 gimple_store_p (const gimple *gs)
2733 tree lhs = gimple_get_lhs (gs);
2734 return lhs && !is_gimple_reg (lhs);
2737 /* Return true if GS is an assignment that loads from its rhs1. */
2739 static inline bool
2740 gimple_assign_load_p (const gimple *gs)
2742 tree rhs;
2743 if (!gimple_assign_single_p (gs))
2744 return false;
2745 rhs = gimple_assign_rhs1 (gs);
2746 if (TREE_CODE (rhs) == WITH_SIZE_EXPR)
2747 return true;
2748 rhs = get_base_address (rhs);
2749 return (DECL_P (rhs)
2750 || TREE_CODE (rhs) == MEM_REF || TREE_CODE (rhs) == TARGET_MEM_REF);
2754 /* Return true if S is a type-cast assignment. */
2756 static inline bool
2757 gimple_assign_cast_p (const gimple *s)
2759 if (is_gimple_assign (s))
2761 enum tree_code sc = gimple_assign_rhs_code (s);
2762 return CONVERT_EXPR_CODE_P (sc)
2763 || sc == VIEW_CONVERT_EXPR
2764 || sc == FIX_TRUNC_EXPR;
2767 return false;
2770 /* Return true if S is a clobber statement. */
2772 static inline bool
2773 gimple_clobber_p (const gimple *s)
2775 return gimple_assign_single_p (s)
2776 && TREE_CLOBBER_P (gimple_assign_rhs1 (s));
2779 /* Return true if GS is a GIMPLE_CALL. */
2781 static inline bool
2782 is_gimple_call (const gimple *gs)
2784 return gimple_code (gs) == GIMPLE_CALL;
2787 /* Return the LHS of call statement GS. */
2789 static inline tree
2790 gimple_call_lhs (const gcall *gs)
2792 return gs->op[0];
2795 static inline tree
2796 gimple_call_lhs (const gimple *gs)
2798 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2799 return gimple_call_lhs (gc);
2803 /* Return a pointer to the LHS of call statement GS. */
2805 static inline tree *
2806 gimple_call_lhs_ptr (gcall *gs)
2808 return &gs->op[0];
2811 static inline tree *
2812 gimple_call_lhs_ptr (gimple *gs)
2814 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2815 return gimple_call_lhs_ptr (gc);
2819 /* Set LHS to be the LHS operand of call statement GS. */
2821 static inline void
2822 gimple_call_set_lhs (gcall *gs, tree lhs)
2824 gs->op[0] = lhs;
2825 if (lhs && TREE_CODE (lhs) == SSA_NAME)
2826 SSA_NAME_DEF_STMT (lhs) = gs;
2829 static inline void
2830 gimple_call_set_lhs (gimple *gs, tree lhs)
2832 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2833 gimple_call_set_lhs (gc, lhs);
2837 /* Return true if call GS calls an internal-only function, as enumerated
2838 by internal_fn. */
2840 static inline bool
2841 gimple_call_internal_p (const gcall *gs)
2843 return (gs->subcode & GF_CALL_INTERNAL) != 0;
2846 static inline bool
2847 gimple_call_internal_p (const gimple *gs)
2849 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2850 return gimple_call_internal_p (gc);
2854 /* Return true if call GS is marked as instrumented by
2855 Pointer Bounds Checker. */
2857 static inline bool
2858 gimple_call_with_bounds_p (const gcall *gs)
2860 return (gs->subcode & GF_CALL_WITH_BOUNDS) != 0;
2863 static inline bool
2864 gimple_call_with_bounds_p (const gimple *gs)
2866 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2867 return gimple_call_with_bounds_p (gc);
2871 /* If INSTRUMENTED_P is true, marm statement GS as instrumented by
2872 Pointer Bounds Checker. */
2874 static inline void
2875 gimple_call_set_with_bounds (gcall *gs, bool with_bounds)
2877 if (with_bounds)
2878 gs->subcode |= GF_CALL_WITH_BOUNDS;
2879 else
2880 gs->subcode &= ~GF_CALL_WITH_BOUNDS;
2883 static inline void
2884 gimple_call_set_with_bounds (gimple *gs, bool with_bounds)
2886 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
2887 gimple_call_set_with_bounds (gc, with_bounds);
2891 /* Return the target of internal call GS. */
2893 static inline enum internal_fn
2894 gimple_call_internal_fn (const gcall *gs)
2896 gcc_gimple_checking_assert (gimple_call_internal_p (gs));
2897 return gs->u.internal_fn;
2900 static inline enum internal_fn
2901 gimple_call_internal_fn (const gimple *gs)
2903 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2904 return gimple_call_internal_fn (gc);
2907 /* Return true, if this internal gimple call is unique. */
2909 static inline bool
2910 gimple_call_internal_unique_p (const gcall *gs)
2912 return gimple_call_internal_fn (gs) == IFN_UNIQUE;
2915 static inline bool
2916 gimple_call_internal_unique_p (const gimple *gs)
2918 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2919 return gimple_call_internal_unique_p (gc);
2922 /* If CTRL_ALTERING_P is true, mark GIMPLE_CALL S to be a stmt
2923 that could alter control flow. */
2925 static inline void
2926 gimple_call_set_ctrl_altering (gcall *s, bool ctrl_altering_p)
2928 if (ctrl_altering_p)
2929 s->subcode |= GF_CALL_CTRL_ALTERING;
2930 else
2931 s->subcode &= ~GF_CALL_CTRL_ALTERING;
2934 static inline void
2935 gimple_call_set_ctrl_altering (gimple *s, bool ctrl_altering_p)
2937 gcall *gc = GIMPLE_CHECK2<gcall *> (s);
2938 gimple_call_set_ctrl_altering (gc, ctrl_altering_p);
2941 /* Return true if call GS calls an func whose GF_CALL_CTRL_ALTERING
2942 flag is set. Such call could not be a stmt in the middle of a bb. */
2944 static inline bool
2945 gimple_call_ctrl_altering_p (const gcall *gs)
2947 return (gs->subcode & GF_CALL_CTRL_ALTERING) != 0;
2950 static inline bool
2951 gimple_call_ctrl_altering_p (const gimple *gs)
2953 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2954 return gimple_call_ctrl_altering_p (gc);
2958 /* Return the function type of the function called by GS. */
2960 static inline tree
2961 gimple_call_fntype (const gcall *gs)
2963 if (gimple_call_internal_p (gs))
2964 return NULL_TREE;
2965 return gs->u.fntype;
2968 static inline tree
2969 gimple_call_fntype (const gimple *gs)
2971 const gcall *call_stmt = GIMPLE_CHECK2<const gcall *> (gs);
2972 return gimple_call_fntype (call_stmt);
2975 /* Set the type of the function called by CALL_STMT to FNTYPE. */
2977 static inline void
2978 gimple_call_set_fntype (gcall *call_stmt, tree fntype)
2980 gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
2981 call_stmt->u.fntype = fntype;
2985 /* Return the tree node representing the function called by call
2986 statement GS. */
2988 static inline tree
2989 gimple_call_fn (const gcall *gs)
2991 return gs->op[1];
2994 static inline tree
2995 gimple_call_fn (const gimple *gs)
2997 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
2998 return gimple_call_fn (gc);
3001 /* Return a pointer to the tree node representing the function called by call
3002 statement GS. */
3004 static inline tree *
3005 gimple_call_fn_ptr (gcall *gs)
3007 return &gs->op[1];
3010 static inline tree *
3011 gimple_call_fn_ptr (gimple *gs)
3013 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3014 return gimple_call_fn_ptr (gc);
3018 /* Set FN to be the function called by call statement GS. */
3020 static inline void
3021 gimple_call_set_fn (gcall *gs, tree fn)
3023 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3024 gs->op[1] = fn;
3028 /* Set FNDECL to be the function called by call statement GS. */
3030 static inline void
3031 gimple_call_set_fndecl (gcall *gs, tree decl)
3033 gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
3034 gs->op[1] = build1_loc (gimple_location (gs), ADDR_EXPR,
3035 build_pointer_type (TREE_TYPE (decl)), decl);
3038 static inline void
3039 gimple_call_set_fndecl (gimple *gs, tree decl)
3041 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3042 gimple_call_set_fndecl (gc, decl);
3046 /* Set internal function FN to be the function called by call statement CALL_STMT. */
3048 static inline void
3049 gimple_call_set_internal_fn (gcall *call_stmt, enum internal_fn fn)
3051 gcc_gimple_checking_assert (gimple_call_internal_p (call_stmt));
3052 call_stmt->u.internal_fn = fn;
3056 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
3057 Otherwise return NULL. This function is analogous to
3058 get_callee_fndecl in tree land. */
3060 static inline tree
3061 gimple_call_fndecl (const gcall *gs)
3063 return gimple_call_addr_fndecl (gimple_call_fn (gs));
3066 static inline tree
3067 gimple_call_fndecl (const gimple *gs)
3069 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3070 return gimple_call_fndecl (gc);
3074 /* Return the type returned by call statement GS. */
3076 static inline tree
3077 gimple_call_return_type (const gcall *gs)
3079 tree type = gimple_call_fntype (gs);
3081 if (type == NULL_TREE)
3082 return TREE_TYPE (gimple_call_lhs (gs));
3084 /* The type returned by a function is the type of its
3085 function type. */
3086 return TREE_TYPE (type);
3090 /* Return the static chain for call statement GS. */
3092 static inline tree
3093 gimple_call_chain (const gcall *gs)
3095 return gs->op[2];
3098 static inline tree
3099 gimple_call_chain (const gimple *gs)
3101 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3102 return gimple_call_chain (gc);
3106 /* Return a pointer to the static chain for call statement CALL_STMT. */
3108 static inline tree *
3109 gimple_call_chain_ptr (gcall *call_stmt)
3111 return &call_stmt->op[2];
3114 /* Set CHAIN to be the static chain for call statement CALL_STMT. */
3116 static inline void
3117 gimple_call_set_chain (gcall *call_stmt, tree chain)
3119 call_stmt->op[2] = chain;
3123 /* Return the number of arguments used by call statement GS. */
3125 static inline unsigned
3126 gimple_call_num_args (const gcall *gs)
3128 return gimple_num_ops (gs) - 3;
3131 static inline unsigned
3132 gimple_call_num_args (const gimple *gs)
3134 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3135 return gimple_call_num_args (gc);
3139 /* Return the argument at position INDEX for call statement GS. */
3141 static inline tree
3142 gimple_call_arg (const gcall *gs, unsigned index)
3144 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3145 return gs->op[index + 3];
3148 static inline tree
3149 gimple_call_arg (const gimple *gs, unsigned index)
3151 const gcall *gc = GIMPLE_CHECK2<const gcall *> (gs);
3152 return gimple_call_arg (gc, index);
3156 /* Return a pointer to the argument at position INDEX for call
3157 statement GS. */
3159 static inline tree *
3160 gimple_call_arg_ptr (gcall *gs, unsigned index)
3162 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3163 return &gs->op[index + 3];
3166 static inline tree *
3167 gimple_call_arg_ptr (gimple *gs, unsigned index)
3169 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3170 return gimple_call_arg_ptr (gc, index);
3174 /* Set ARG to be the argument at position INDEX for call statement GS. */
3176 static inline void
3177 gimple_call_set_arg (gcall *gs, unsigned index, tree arg)
3179 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 3);
3180 gs->op[index + 3] = arg;
3183 static inline void
3184 gimple_call_set_arg (gimple *gs, unsigned index, tree arg)
3186 gcall *gc = GIMPLE_CHECK2<gcall *> (gs);
3187 gimple_call_set_arg (gc, index, arg);
3191 /* If TAIL_P is true, mark call statement S as being a tail call
3192 (i.e., a call just before the exit of a function). These calls are
3193 candidate for tail call optimization. */
3195 static inline void
3196 gimple_call_set_tail (gcall *s, bool tail_p)
3198 if (tail_p)
3199 s->subcode |= GF_CALL_TAILCALL;
3200 else
3201 s->subcode &= ~GF_CALL_TAILCALL;
3205 /* Return true if GIMPLE_CALL S is marked as a tail call. */
3207 static inline bool
3208 gimple_call_tail_p (gcall *s)
3210 return (s->subcode & GF_CALL_TAILCALL) != 0;
3213 /* Mark (or clear) call statement S as requiring tail call optimization. */
3215 static inline void
3216 gimple_call_set_must_tail (gcall *s, bool must_tail_p)
3218 if (must_tail_p)
3219 s->subcode |= GF_CALL_MUST_TAIL_CALL;
3220 else
3221 s->subcode &= ~GF_CALL_MUST_TAIL_CALL;
3224 /* Return true if call statement has been marked as requiring
3225 tail call optimization. */
3227 static inline bool
3228 gimple_call_must_tail_p (const gcall *s)
3230 return (s->subcode & GF_CALL_MUST_TAIL_CALL) != 0;
3233 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
3234 slot optimization. This transformation uses the target of the call
3235 expansion as the return slot for calls that return in memory. */
3237 static inline void
3238 gimple_call_set_return_slot_opt (gcall *s, bool return_slot_opt_p)
3240 if (return_slot_opt_p)
3241 s->subcode |= GF_CALL_RETURN_SLOT_OPT;
3242 else
3243 s->subcode &= ~GF_CALL_RETURN_SLOT_OPT;
3247 /* Return true if S is marked for return slot optimization. */
3249 static inline bool
3250 gimple_call_return_slot_opt_p (gcall *s)
3252 return (s->subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
3256 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
3257 thunk to the thunked-to function. */
3259 static inline void
3260 gimple_call_set_from_thunk (gcall *s, bool from_thunk_p)
3262 if (from_thunk_p)
3263 s->subcode |= GF_CALL_FROM_THUNK;
3264 else
3265 s->subcode &= ~GF_CALL_FROM_THUNK;
3269 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
3271 static inline bool
3272 gimple_call_from_thunk_p (gcall *s)
3274 return (s->subcode & GF_CALL_FROM_THUNK) != 0;
3278 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
3279 argument pack in its argument list. */
3281 static inline void
3282 gimple_call_set_va_arg_pack (gcall *s, bool pass_arg_pack_p)
3284 if (pass_arg_pack_p)
3285 s->subcode |= GF_CALL_VA_ARG_PACK;
3286 else
3287 s->subcode &= ~GF_CALL_VA_ARG_PACK;
3291 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
3292 argument pack in its argument list. */
3294 static inline bool
3295 gimple_call_va_arg_pack_p (gcall *s)
3297 return (s->subcode & GF_CALL_VA_ARG_PACK) != 0;
3301 /* Return true if S is a noreturn call. */
3303 static inline bool
3304 gimple_call_noreturn_p (const gcall *s)
3306 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
3309 static inline bool
3310 gimple_call_noreturn_p (const gimple *s)
3312 const gcall *gc = GIMPLE_CHECK2<const gcall *> (s);
3313 return gimple_call_noreturn_p (gc);
3317 /* If NOTHROW_P is true, GIMPLE_CALL S is a call that is known to not throw
3318 even if the called function can throw in other cases. */
3320 static inline void
3321 gimple_call_set_nothrow (gcall *s, bool nothrow_p)
3323 if (nothrow_p)
3324 s->subcode |= GF_CALL_NOTHROW;
3325 else
3326 s->subcode &= ~GF_CALL_NOTHROW;
3329 /* Return true if S is a nothrow call. */
3331 static inline bool
3332 gimple_call_nothrow_p (gcall *s)
3334 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
3337 /* If FOR_VAR is true, GIMPLE_CALL S is a call to builtin_alloca that
3338 is known to be emitted for VLA objects. Those are wrapped by
3339 stack_save/stack_restore calls and hence can't lead to unbounded
3340 stack growth even when they occur in loops. */
3342 static inline void
3343 gimple_call_set_alloca_for_var (gcall *s, bool for_var)
3345 if (for_var)
3346 s->subcode |= GF_CALL_ALLOCA_FOR_VAR;
3347 else
3348 s->subcode &= ~GF_CALL_ALLOCA_FOR_VAR;
3351 /* Return true of S is a call to builtin_alloca emitted for VLA objects. */
3353 static inline bool
3354 gimple_call_alloca_for_var_p (gcall *s)
3356 return (s->subcode & GF_CALL_ALLOCA_FOR_VAR) != 0;
3359 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
3361 static inline void
3362 gimple_call_copy_flags (gcall *dest_call, gcall *orig_call)
3364 dest_call->subcode = orig_call->subcode;
3368 /* Return a pointer to the points-to solution for the set of call-used
3369 variables of the call CALL_STMT. */
3371 static inline struct pt_solution *
3372 gimple_call_use_set (gcall *call_stmt)
3374 return &call_stmt->call_used;
3378 /* Return a pointer to the points-to solution for the set of call-used
3379 variables of the call CALL_STMT. */
3381 static inline struct pt_solution *
3382 gimple_call_clobber_set (gcall *call_stmt)
3384 return &call_stmt->call_clobbered;
3388 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
3389 non-NULL lhs. */
3391 static inline bool
3392 gimple_has_lhs (gimple *stmt)
3394 if (is_gimple_assign (stmt))
3395 return true;
3396 if (gcall *call = dyn_cast <gcall *> (stmt))
3397 return gimple_call_lhs (call) != NULL_TREE;
3398 return false;
3402 /* Return the code of the predicate computed by conditional statement GS. */
3404 static inline enum tree_code
3405 gimple_cond_code (const gcond *gs)
3407 return (enum tree_code) gs->subcode;
3410 static inline enum tree_code
3411 gimple_cond_code (const gimple *gs)
3413 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3414 return gimple_cond_code (gc);
3418 /* Set CODE to be the predicate code for the conditional statement GS. */
3420 static inline void
3421 gimple_cond_set_code (gcond *gs, enum tree_code code)
3423 gs->subcode = code;
3427 /* Return the LHS of the predicate computed by conditional statement GS. */
3429 static inline tree
3430 gimple_cond_lhs (const gcond *gs)
3432 return gs->op[0];
3435 static inline tree
3436 gimple_cond_lhs (const gimple *gs)
3438 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3439 return gimple_cond_lhs (gc);
3442 /* Return the pointer to the LHS of the predicate computed by conditional
3443 statement GS. */
3445 static inline tree *
3446 gimple_cond_lhs_ptr (gcond *gs)
3448 return &gs->op[0];
3451 /* Set LHS to be the LHS operand of the predicate computed by
3452 conditional statement GS. */
3454 static inline void
3455 gimple_cond_set_lhs (gcond *gs, tree lhs)
3457 gs->op[0] = lhs;
3461 /* Return the RHS operand of the predicate computed by conditional GS. */
3463 static inline tree
3464 gimple_cond_rhs (const gcond *gs)
3466 return gs->op[1];
3469 static inline tree
3470 gimple_cond_rhs (const gimple *gs)
3472 const gcond *gc = GIMPLE_CHECK2<const gcond *> (gs);
3473 return gimple_cond_rhs (gc);
3476 /* Return the pointer to the RHS operand of the predicate computed by
3477 conditional GS. */
3479 static inline tree *
3480 gimple_cond_rhs_ptr (gcond *gs)
3482 return &gs->op[1];
3486 /* Set RHS to be the RHS operand of the predicate computed by
3487 conditional statement GS. */
3489 static inline void
3490 gimple_cond_set_rhs (gcond *gs, tree rhs)
3492 gs->op[1] = rhs;
3496 /* Return the label used by conditional statement GS when its
3497 predicate evaluates to true. */
3499 static inline tree
3500 gimple_cond_true_label (const gcond *gs)
3502 return gs->op[2];
3506 /* Set LABEL to be the label used by conditional statement GS when its
3507 predicate evaluates to true. */
3509 static inline void
3510 gimple_cond_set_true_label (gcond *gs, tree label)
3512 gs->op[2] = label;
3516 /* Set LABEL to be the label used by conditional statement GS when its
3517 predicate evaluates to false. */
3519 static inline void
3520 gimple_cond_set_false_label (gcond *gs, tree label)
3522 gs->op[3] = label;
3526 /* Return the label used by conditional statement GS when its
3527 predicate evaluates to false. */
3529 static inline tree
3530 gimple_cond_false_label (const gcond *gs)
3532 return gs->op[3];
3536 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
3538 static inline void
3539 gimple_cond_make_false (gcond *gs)
3541 gimple_cond_set_lhs (gs, boolean_false_node);
3542 gimple_cond_set_rhs (gs, boolean_false_node);
3543 gs->subcode = NE_EXPR;
3547 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
3549 static inline void
3550 gimple_cond_make_true (gcond *gs)
3552 gimple_cond_set_lhs (gs, boolean_true_node);
3553 gimple_cond_set_rhs (gs, boolean_false_node);
3554 gs->subcode = NE_EXPR;
3557 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
3558 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
3560 static inline bool
3561 gimple_cond_true_p (const gcond *gs)
3563 tree lhs = gimple_cond_lhs (gs);
3564 tree rhs = gimple_cond_rhs (gs);
3565 enum tree_code code = gimple_cond_code (gs);
3567 if (lhs != boolean_true_node && lhs != boolean_false_node)
3568 return false;
3570 if (rhs != boolean_true_node && rhs != boolean_false_node)
3571 return false;
3573 if (code == NE_EXPR && lhs != rhs)
3574 return true;
3576 if (code == EQ_EXPR && lhs == rhs)
3577 return true;
3579 return false;
3582 /* Check if conditional statement GS is of the form 'if (1 != 1)',
3583 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
3585 static inline bool
3586 gimple_cond_false_p (const gcond *gs)
3588 tree lhs = gimple_cond_lhs (gs);
3589 tree rhs = gimple_cond_rhs (gs);
3590 enum tree_code code = gimple_cond_code (gs);
3592 if (lhs != boolean_true_node && lhs != boolean_false_node)
3593 return false;
3595 if (rhs != boolean_true_node && rhs != boolean_false_node)
3596 return false;
3598 if (code == NE_EXPR && lhs == rhs)
3599 return true;
3601 if (code == EQ_EXPR && lhs != rhs)
3602 return true;
3604 return false;
3607 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
3609 static inline void
3610 gimple_cond_set_condition (gcond *stmt, enum tree_code code, tree lhs,
3611 tree rhs)
3613 gimple_cond_set_code (stmt, code);
3614 gimple_cond_set_lhs (stmt, lhs);
3615 gimple_cond_set_rhs (stmt, rhs);
3618 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
3620 static inline tree
3621 gimple_label_label (const glabel *gs)
3623 return gs->op[0];
3627 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
3628 GS. */
3630 static inline void
3631 gimple_label_set_label (glabel *gs, tree label)
3633 gs->op[0] = label;
3637 /* Return the destination of the unconditional jump GS. */
3639 static inline tree
3640 gimple_goto_dest (const gimple *gs)
3642 GIMPLE_CHECK (gs, GIMPLE_GOTO);
3643 return gimple_op (gs, 0);
3647 /* Set DEST to be the destination of the unconditonal jump GS. */
3649 static inline void
3650 gimple_goto_set_dest (ggoto *gs, tree dest)
3652 gs->op[0] = dest;
3656 /* Return the variables declared in the GIMPLE_BIND statement GS. */
3658 static inline tree
3659 gimple_bind_vars (const gbind *bind_stmt)
3661 return bind_stmt->vars;
3665 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
3666 statement GS. */
3668 static inline void
3669 gimple_bind_set_vars (gbind *bind_stmt, tree vars)
3671 bind_stmt->vars = vars;
3675 /* Append VARS to the set of variables declared in the GIMPLE_BIND
3676 statement GS. */
3678 static inline void
3679 gimple_bind_append_vars (gbind *bind_stmt, tree vars)
3681 bind_stmt->vars = chainon (bind_stmt->vars, vars);
3685 static inline gimple_seq *
3686 gimple_bind_body_ptr (gbind *bind_stmt)
3688 return &bind_stmt->body;
3691 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
3693 static inline gimple_seq
3694 gimple_bind_body (gbind *gs)
3696 return *gimple_bind_body_ptr (gs);
3700 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
3701 statement GS. */
3703 static inline void
3704 gimple_bind_set_body (gbind *bind_stmt, gimple_seq seq)
3706 bind_stmt->body = seq;
3710 /* Append a statement to the end of a GIMPLE_BIND's body. */
3712 static inline void
3713 gimple_bind_add_stmt (gbind *bind_stmt, gimple *stmt)
3715 gimple_seq_add_stmt (&bind_stmt->body, stmt);
3719 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
3721 static inline void
3722 gimple_bind_add_seq (gbind *bind_stmt, gimple_seq seq)
3724 gimple_seq_add_seq (&bind_stmt->body, seq);
3728 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
3729 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
3731 static inline tree
3732 gimple_bind_block (const gbind *bind_stmt)
3734 return bind_stmt->block;
3738 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
3739 statement GS. */
3741 static inline void
3742 gimple_bind_set_block (gbind *bind_stmt, tree block)
3744 gcc_gimple_checking_assert (block == NULL_TREE
3745 || TREE_CODE (block) == BLOCK);
3746 bind_stmt->block = block;
3750 /* Return the number of input operands for GIMPLE_ASM ASM_STMT. */
3752 static inline unsigned
3753 gimple_asm_ninputs (const gasm *asm_stmt)
3755 return asm_stmt->ni;
3759 /* Return the number of output operands for GIMPLE_ASM ASM_STMT. */
3761 static inline unsigned
3762 gimple_asm_noutputs (const gasm *asm_stmt)
3764 return asm_stmt->no;
3768 /* Return the number of clobber operands for GIMPLE_ASM ASM_STMT. */
3770 static inline unsigned
3771 gimple_asm_nclobbers (const gasm *asm_stmt)
3773 return asm_stmt->nc;
3776 /* Return the number of label operands for GIMPLE_ASM ASM_STMT. */
3778 static inline unsigned
3779 gimple_asm_nlabels (const gasm *asm_stmt)
3781 return asm_stmt->nl;
3784 /* Return input operand INDEX of GIMPLE_ASM ASM_STMT. */
3786 static inline tree
3787 gimple_asm_input_op (const gasm *asm_stmt, unsigned index)
3789 gcc_gimple_checking_assert (index < asm_stmt->ni);
3790 return asm_stmt->op[index + asm_stmt->no];
3793 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM ASM_STMT. */
3795 static inline void
3796 gimple_asm_set_input_op (gasm *asm_stmt, unsigned index, tree in_op)
3798 gcc_gimple_checking_assert (index < asm_stmt->ni
3799 && TREE_CODE (in_op) == TREE_LIST);
3800 asm_stmt->op[index + asm_stmt->no] = in_op;
3804 /* Return output operand INDEX of GIMPLE_ASM ASM_STMT. */
3806 static inline tree
3807 gimple_asm_output_op (const gasm *asm_stmt, unsigned index)
3809 gcc_gimple_checking_assert (index < asm_stmt->no);
3810 return asm_stmt->op[index];
3813 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM ASM_STMT. */
3815 static inline void
3816 gimple_asm_set_output_op (gasm *asm_stmt, unsigned index, tree out_op)
3818 gcc_gimple_checking_assert (index < asm_stmt->no
3819 && TREE_CODE (out_op) == TREE_LIST);
3820 asm_stmt->op[index] = out_op;
3824 /* Return clobber operand INDEX of GIMPLE_ASM ASM_STMT. */
3826 static inline tree
3827 gimple_asm_clobber_op (const gasm *asm_stmt, unsigned index)
3829 gcc_gimple_checking_assert (index < asm_stmt->nc);
3830 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->no];
3834 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM ASM_STMT. */
3836 static inline void
3837 gimple_asm_set_clobber_op (gasm *asm_stmt, unsigned index, tree clobber_op)
3839 gcc_gimple_checking_assert (index < asm_stmt->nc
3840 && TREE_CODE (clobber_op) == TREE_LIST);
3841 asm_stmt->op[index + asm_stmt->ni + asm_stmt->no] = clobber_op;
3844 /* Return label operand INDEX of GIMPLE_ASM ASM_STMT. */
3846 static inline tree
3847 gimple_asm_label_op (const gasm *asm_stmt, unsigned index)
3849 gcc_gimple_checking_assert (index < asm_stmt->nl);
3850 return asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc];
3853 /* Set LABEL_OP to be label operand INDEX in GIMPLE_ASM ASM_STMT. */
3855 static inline void
3856 gimple_asm_set_label_op (gasm *asm_stmt, unsigned index, tree label_op)
3858 gcc_gimple_checking_assert (index < asm_stmt->nl
3859 && TREE_CODE (label_op) == TREE_LIST);
3860 asm_stmt->op[index + asm_stmt->ni + asm_stmt->nc] = label_op;
3863 /* Return the string representing the assembly instruction in
3864 GIMPLE_ASM ASM_STMT. */
3866 static inline const char *
3867 gimple_asm_string (const gasm *asm_stmt)
3869 return asm_stmt->string;
3873 /* Return true ASM_STMT ASM_STMT is an asm statement marked volatile. */
3875 static inline bool
3876 gimple_asm_volatile_p (const gasm *asm_stmt)
3878 return (asm_stmt->subcode & GF_ASM_VOLATILE) != 0;
3882 /* If VOLATLE_P is true, mark asm statement ASM_STMT as volatile. */
3884 static inline void
3885 gimple_asm_set_volatile (gasm *asm_stmt, bool volatile_p)
3887 if (volatile_p)
3888 asm_stmt->subcode |= GF_ASM_VOLATILE;
3889 else
3890 asm_stmt->subcode &= ~GF_ASM_VOLATILE;
3894 /* If INPUT_P is true, mark asm ASM_STMT as an ASM_INPUT. */
3896 static inline void
3897 gimple_asm_set_input (gasm *asm_stmt, bool input_p)
3899 if (input_p)
3900 asm_stmt->subcode |= GF_ASM_INPUT;
3901 else
3902 asm_stmt->subcode &= ~GF_ASM_INPUT;
3906 /* Return true if asm ASM_STMT is an ASM_INPUT. */
3908 static inline bool
3909 gimple_asm_input_p (const gasm *asm_stmt)
3911 return (asm_stmt->subcode & GF_ASM_INPUT) != 0;
3915 /* Return the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3917 static inline tree
3918 gimple_catch_types (const gcatch *catch_stmt)
3920 return catch_stmt->types;
3924 /* Return a pointer to the types handled by GIMPLE_CATCH statement CATCH_STMT. */
3926 static inline tree *
3927 gimple_catch_types_ptr (gcatch *catch_stmt)
3929 return &catch_stmt->types;
3933 /* Return a pointer to the GIMPLE sequence representing the body of
3934 the handler of GIMPLE_CATCH statement CATCH_STMT. */
3936 static inline gimple_seq *
3937 gimple_catch_handler_ptr (gcatch *catch_stmt)
3939 return &catch_stmt->handler;
3943 /* Return the GIMPLE sequence representing the body of the handler of
3944 GIMPLE_CATCH statement CATCH_STMT. */
3946 static inline gimple_seq
3947 gimple_catch_handler (gcatch *catch_stmt)
3949 return *gimple_catch_handler_ptr (catch_stmt);
3953 /* Set T to be the set of types handled by GIMPLE_CATCH CATCH_STMT. */
3955 static inline void
3956 gimple_catch_set_types (gcatch *catch_stmt, tree t)
3958 catch_stmt->types = t;
3962 /* Set HANDLER to be the body of GIMPLE_CATCH CATCH_STMT. */
3964 static inline void
3965 gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
3967 catch_stmt->handler = handler;
3971 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
3973 static inline tree
3974 gimple_eh_filter_types (const gimple *gs)
3976 const geh_filter *eh_filter_stmt = as_a <const geh_filter *> (gs);
3977 return eh_filter_stmt->types;
3981 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
3982 GS. */
3984 static inline tree *
3985 gimple_eh_filter_types_ptr (gimple *gs)
3987 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3988 return &eh_filter_stmt->types;
3992 /* Return a pointer to the sequence of statement to execute when
3993 GIMPLE_EH_FILTER statement fails. */
3995 static inline gimple_seq *
3996 gimple_eh_filter_failure_ptr (gimple *gs)
3998 geh_filter *eh_filter_stmt = as_a <geh_filter *> (gs);
3999 return &eh_filter_stmt->failure;
4003 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
4004 statement fails. */
4006 static inline gimple_seq
4007 gimple_eh_filter_failure (gimple *gs)
4009 return *gimple_eh_filter_failure_ptr (gs);
4013 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER
4014 EH_FILTER_STMT. */
4016 static inline void
4017 gimple_eh_filter_set_types (geh_filter *eh_filter_stmt, tree types)
4019 eh_filter_stmt->types = types;
4023 /* Set FAILURE to be the sequence of statements to execute on failure
4024 for GIMPLE_EH_FILTER EH_FILTER_STMT. */
4026 static inline void
4027 gimple_eh_filter_set_failure (geh_filter *eh_filter_stmt,
4028 gimple_seq failure)
4030 eh_filter_stmt->failure = failure;
4033 /* Get the function decl to be called by the MUST_NOT_THROW region. */
4035 static inline tree
4036 gimple_eh_must_not_throw_fndecl (geh_mnt *eh_mnt_stmt)
4038 return eh_mnt_stmt->fndecl;
4041 /* Set the function decl to be called by GS to DECL. */
4043 static inline void
4044 gimple_eh_must_not_throw_set_fndecl (geh_mnt *eh_mnt_stmt,
4045 tree decl)
4047 eh_mnt_stmt->fndecl = decl;
4050 /* GIMPLE_EH_ELSE accessors. */
4052 static inline gimple_seq *
4053 gimple_eh_else_n_body_ptr (geh_else *eh_else_stmt)
4055 return &eh_else_stmt->n_body;
4058 static inline gimple_seq
4059 gimple_eh_else_n_body (geh_else *eh_else_stmt)
4061 return *gimple_eh_else_n_body_ptr (eh_else_stmt);
4064 static inline gimple_seq *
4065 gimple_eh_else_e_body_ptr (geh_else *eh_else_stmt)
4067 return &eh_else_stmt->e_body;
4070 static inline gimple_seq
4071 gimple_eh_else_e_body (geh_else *eh_else_stmt)
4073 return *gimple_eh_else_e_body_ptr (eh_else_stmt);
4076 static inline void
4077 gimple_eh_else_set_n_body (geh_else *eh_else_stmt, gimple_seq seq)
4079 eh_else_stmt->n_body = seq;
4082 static inline void
4083 gimple_eh_else_set_e_body (geh_else *eh_else_stmt, gimple_seq seq)
4085 eh_else_stmt->e_body = seq;
4088 /* GIMPLE_TRY accessors. */
4090 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
4091 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
4093 static inline enum gimple_try_flags
4094 gimple_try_kind (const gimple *gs)
4096 GIMPLE_CHECK (gs, GIMPLE_TRY);
4097 return (enum gimple_try_flags) (gs->subcode & GIMPLE_TRY_KIND);
4101 /* Set the kind of try block represented by GIMPLE_TRY GS. */
4103 static inline void
4104 gimple_try_set_kind (gtry *gs, enum gimple_try_flags kind)
4106 gcc_gimple_checking_assert (kind == GIMPLE_TRY_CATCH
4107 || kind == GIMPLE_TRY_FINALLY);
4108 if (gimple_try_kind (gs) != kind)
4109 gs->subcode = (unsigned int) kind;
4113 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4115 static inline bool
4116 gimple_try_catch_is_cleanup (const gimple *gs)
4118 gcc_gimple_checking_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
4119 return (gs->subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
4123 /* Return a pointer to the sequence of statements used as the
4124 body for GIMPLE_TRY GS. */
4126 static inline gimple_seq *
4127 gimple_try_eval_ptr (gimple *gs)
4129 gtry *try_stmt = as_a <gtry *> (gs);
4130 return &try_stmt->eval;
4134 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
4136 static inline gimple_seq
4137 gimple_try_eval (gimple *gs)
4139 return *gimple_try_eval_ptr (gs);
4143 /* Return a pointer to the sequence of statements used as the cleanup body for
4144 GIMPLE_TRY GS. */
4146 static inline gimple_seq *
4147 gimple_try_cleanup_ptr (gimple *gs)
4149 gtry *try_stmt = as_a <gtry *> (gs);
4150 return &try_stmt->cleanup;
4154 /* Return the sequence of statements used as the cleanup body for
4155 GIMPLE_TRY GS. */
4157 static inline gimple_seq
4158 gimple_try_cleanup (gimple *gs)
4160 return *gimple_try_cleanup_ptr (gs);
4164 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
4166 static inline void
4167 gimple_try_set_catch_is_cleanup (gtry *g, bool catch_is_cleanup)
4169 gcc_gimple_checking_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
4170 if (catch_is_cleanup)
4171 g->subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
4172 else
4173 g->subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
4177 /* Set EVAL to be the sequence of statements to use as the body for
4178 GIMPLE_TRY TRY_STMT. */
4180 static inline void
4181 gimple_try_set_eval (gtry *try_stmt, gimple_seq eval)
4183 try_stmt->eval = eval;
4187 /* Set CLEANUP to be the sequence of statements to use as the cleanup
4188 body for GIMPLE_TRY TRY_STMT. */
4190 static inline void
4191 gimple_try_set_cleanup (gtry *try_stmt, gimple_seq cleanup)
4193 try_stmt->cleanup = cleanup;
4197 /* Return a pointer to the cleanup sequence for cleanup statement GS. */
4199 static inline gimple_seq *
4200 gimple_wce_cleanup_ptr (gimple *gs)
4202 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4203 return &wce_stmt->cleanup;
4207 /* Return the cleanup sequence for cleanup statement GS. */
4209 static inline gimple_seq
4210 gimple_wce_cleanup (gimple *gs)
4212 return *gimple_wce_cleanup_ptr (gs);
4216 /* Set CLEANUP to be the cleanup sequence for GS. */
4218 static inline void
4219 gimple_wce_set_cleanup (gimple *gs, gimple_seq cleanup)
4221 gimple_statement_wce *wce_stmt = as_a <gimple_statement_wce *> (gs);
4222 wce_stmt->cleanup = cleanup;
4226 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
4228 static inline bool
4229 gimple_wce_cleanup_eh_only (const gimple *gs)
4231 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4232 return gs->subcode != 0;
4236 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
4238 static inline void
4239 gimple_wce_set_cleanup_eh_only (gimple *gs, bool eh_only_p)
4241 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
4242 gs->subcode = (unsigned int) eh_only_p;
4246 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
4248 static inline unsigned
4249 gimple_phi_capacity (const gimple *gs)
4251 const gphi *phi_stmt = as_a <const gphi *> (gs);
4252 return phi_stmt->capacity;
4256 /* Return the number of arguments in GIMPLE_PHI GS. This must always
4257 be exactly the number of incoming edges for the basic block holding
4258 GS. */
4260 static inline unsigned
4261 gimple_phi_num_args (const gimple *gs)
4263 const gphi *phi_stmt = as_a <const gphi *> (gs);
4264 return phi_stmt->nargs;
4268 /* Return the SSA name created by GIMPLE_PHI GS. */
4270 static inline tree
4271 gimple_phi_result (const gimple *gs)
4273 const gphi *phi_stmt = as_a <const gphi *> (gs);
4274 return phi_stmt->result;
4277 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
4279 static inline tree *
4280 gimple_phi_result_ptr (gimple *gs)
4282 gphi *phi_stmt = as_a <gphi *> (gs);
4283 return &phi_stmt->result;
4286 /* Set RESULT to be the SSA name created by GIMPLE_PHI PHI. */
4288 static inline void
4289 gimple_phi_set_result (gphi *phi, tree result)
4291 phi->result = result;
4292 if (result && TREE_CODE (result) == SSA_NAME)
4293 SSA_NAME_DEF_STMT (result) = phi;
4297 /* Return the PHI argument corresponding to incoming edge INDEX for
4298 GIMPLE_PHI GS. */
4300 static inline struct phi_arg_d *
4301 gimple_phi_arg (gimple *gs, unsigned index)
4303 gphi *phi_stmt = as_a <gphi *> (gs);
4304 gcc_gimple_checking_assert (index <= phi_stmt->capacity);
4305 return &(phi_stmt->args[index]);
4308 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
4309 for GIMPLE_PHI PHI. */
4311 static inline void
4312 gimple_phi_set_arg (gphi *phi, unsigned index, struct phi_arg_d * phiarg)
4314 gcc_gimple_checking_assert (index <= phi->nargs);
4315 phi->args[index] = *phiarg;
4318 /* Return the PHI nodes for basic block BB, or NULL if there are no
4319 PHI nodes. */
4321 static inline gimple_seq
4322 phi_nodes (const_basic_block bb)
4324 gcc_checking_assert (!(bb->flags & BB_RTL));
4325 return bb->il.gimple.phi_nodes;
4328 /* Return a pointer to the PHI nodes for basic block BB. */
4330 static inline gimple_seq *
4331 phi_nodes_ptr (basic_block bb)
4333 gcc_checking_assert (!(bb->flags & BB_RTL));
4334 return &bb->il.gimple.phi_nodes;
4337 /* Return the tree operand for argument I of PHI node GS. */
4339 static inline tree
4340 gimple_phi_arg_def (gimple *gs, size_t index)
4342 return gimple_phi_arg (gs, index)->def;
4346 /* Return a pointer to the tree operand for argument I of phi node PHI. */
4348 static inline tree *
4349 gimple_phi_arg_def_ptr (gphi *phi, size_t index)
4351 return &gimple_phi_arg (phi, index)->def;
4354 /* Return the edge associated with argument I of phi node PHI. */
4356 static inline edge
4357 gimple_phi_arg_edge (gphi *phi, size_t i)
4359 return EDGE_PRED (gimple_bb (phi), i);
4362 /* Return the source location of gimple argument I of phi node PHI. */
4364 static inline source_location
4365 gimple_phi_arg_location (gphi *phi, size_t i)
4367 return gimple_phi_arg (phi, i)->locus;
4370 /* Return the source location of the argument on edge E of phi node PHI. */
4372 static inline source_location
4373 gimple_phi_arg_location_from_edge (gphi *phi, edge e)
4375 return gimple_phi_arg (phi, e->dest_idx)->locus;
4378 /* Set the source location of gimple argument I of phi node PHI to LOC. */
4380 static inline void
4381 gimple_phi_arg_set_location (gphi *phi, size_t i, source_location loc)
4383 gimple_phi_arg (phi, i)->locus = loc;
4386 /* Return TRUE if argument I of phi node PHI has a location record. */
4388 static inline bool
4389 gimple_phi_arg_has_location (gphi *phi, size_t i)
4391 return gimple_phi_arg_location (phi, i) != UNKNOWN_LOCATION;
4395 /* Return the region number for GIMPLE_RESX RESX_STMT. */
4397 static inline int
4398 gimple_resx_region (const gresx *resx_stmt)
4400 return resx_stmt->region;
4403 /* Set REGION to be the region number for GIMPLE_RESX RESX_STMT. */
4405 static inline void
4406 gimple_resx_set_region (gresx *resx_stmt, int region)
4408 resx_stmt->region = region;
4411 /* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
4413 static inline int
4414 gimple_eh_dispatch_region (const geh_dispatch *eh_dispatch_stmt)
4416 return eh_dispatch_stmt->region;
4419 /* Set REGION to be the region number for GIMPLE_EH_DISPATCH
4420 EH_DISPATCH_STMT. */
4422 static inline void
4423 gimple_eh_dispatch_set_region (geh_dispatch *eh_dispatch_stmt, int region)
4425 eh_dispatch_stmt->region = region;
4428 /* Return the number of labels associated with the switch statement GS. */
4430 static inline unsigned
4431 gimple_switch_num_labels (const gswitch *gs)
4433 unsigned num_ops;
4434 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
4435 num_ops = gimple_num_ops (gs);
4436 gcc_gimple_checking_assert (num_ops > 1);
4437 return num_ops - 1;
4441 /* Set NLABELS to be the number of labels for the switch statement GS. */
4443 static inline void
4444 gimple_switch_set_num_labels (gswitch *g, unsigned nlabels)
4446 GIMPLE_CHECK (g, GIMPLE_SWITCH);
4447 gimple_set_num_ops (g, nlabels + 1);
4451 /* Return the index variable used by the switch statement GS. */
4453 static inline tree
4454 gimple_switch_index (const gswitch *gs)
4456 return gs->op[0];
4460 /* Return a pointer to the index variable for the switch statement GS. */
4462 static inline tree *
4463 gimple_switch_index_ptr (gswitch *gs)
4465 return &gs->op[0];
4469 /* Set INDEX to be the index variable for switch statement GS. */
4471 static inline void
4472 gimple_switch_set_index (gswitch *gs, tree index)
4474 gcc_gimple_checking_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
4475 gs->op[0] = index;
4479 /* Return the label numbered INDEX. The default label is 0, followed by any
4480 labels in a switch statement. */
4482 static inline tree
4483 gimple_switch_label (const gswitch *gs, unsigned index)
4485 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1);
4486 return gs->op[index + 1];
4489 /* Set the label number INDEX to LABEL. 0 is always the default label. */
4491 static inline void
4492 gimple_switch_set_label (gswitch *gs, unsigned index, tree label)
4494 gcc_gimple_checking_assert (gimple_num_ops (gs) > index + 1
4495 && (label == NULL_TREE
4496 || TREE_CODE (label) == CASE_LABEL_EXPR));
4497 gs->op[index + 1] = label;
4500 /* Return the default label for a switch statement. */
4502 static inline tree
4503 gimple_switch_default_label (const gswitch *gs)
4505 tree label = gimple_switch_label (gs, 0);
4506 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4507 return label;
4510 /* Set the default label for a switch statement. */
4512 static inline void
4513 gimple_switch_set_default_label (gswitch *gs, tree label)
4515 gcc_checking_assert (!CASE_LOW (label) && !CASE_HIGH (label));
4516 gimple_switch_set_label (gs, 0, label);
4519 /* Return true if GS is a GIMPLE_DEBUG statement. */
4521 static inline bool
4522 is_gimple_debug (const gimple *gs)
4524 return gimple_code (gs) == GIMPLE_DEBUG;
4527 /* Return true if S is a GIMPLE_DEBUG BIND statement. */
4529 static inline bool
4530 gimple_debug_bind_p (const gimple *s)
4532 if (is_gimple_debug (s))
4533 return s->subcode == GIMPLE_DEBUG_BIND;
4535 return false;
4538 /* Return the variable bound in a GIMPLE_DEBUG bind statement. */
4540 static inline tree
4541 gimple_debug_bind_get_var (gimple *dbg)
4543 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4544 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4545 return gimple_op (dbg, 0);
4548 /* Return the value bound to the variable in a GIMPLE_DEBUG bind
4549 statement. */
4551 static inline tree
4552 gimple_debug_bind_get_value (gimple *dbg)
4554 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4555 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4556 return gimple_op (dbg, 1);
4559 /* Return a pointer to the value bound to the variable in a
4560 GIMPLE_DEBUG bind statement. */
4562 static inline tree *
4563 gimple_debug_bind_get_value_ptr (gimple *dbg)
4565 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4566 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4567 return gimple_op_ptr (dbg, 1);
4570 /* Set the variable bound in a GIMPLE_DEBUG bind statement. */
4572 static inline void
4573 gimple_debug_bind_set_var (gimple *dbg, tree var)
4575 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4576 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4577 gimple_set_op (dbg, 0, var);
4580 /* Set the value bound to the variable in a GIMPLE_DEBUG bind
4581 statement. */
4583 static inline void
4584 gimple_debug_bind_set_value (gimple *dbg, tree value)
4586 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4587 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4588 gimple_set_op (dbg, 1, value);
4591 /* The second operand of a GIMPLE_DEBUG_BIND, when the value was
4592 optimized away. */
4593 #define GIMPLE_DEBUG_BIND_NOVALUE NULL_TREE /* error_mark_node */
4595 /* Remove the value bound to the variable in a GIMPLE_DEBUG bind
4596 statement. */
4598 static inline void
4599 gimple_debug_bind_reset_value (gimple *dbg)
4601 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4602 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4603 gimple_set_op (dbg, 1, GIMPLE_DEBUG_BIND_NOVALUE);
4606 /* Return true if the GIMPLE_DEBUG bind statement is bound to a
4607 value. */
4609 static inline bool
4610 gimple_debug_bind_has_value_p (gimple *dbg)
4612 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4613 gcc_gimple_checking_assert (gimple_debug_bind_p (dbg));
4614 return gimple_op (dbg, 1) != GIMPLE_DEBUG_BIND_NOVALUE;
4617 #undef GIMPLE_DEBUG_BIND_NOVALUE
4619 /* Return true if S is a GIMPLE_DEBUG SOURCE BIND statement. */
4621 static inline bool
4622 gimple_debug_source_bind_p (const gimple *s)
4624 if (is_gimple_debug (s))
4625 return s->subcode == GIMPLE_DEBUG_SOURCE_BIND;
4627 return false;
4630 /* Return the variable bound in a GIMPLE_DEBUG source bind statement. */
4632 static inline tree
4633 gimple_debug_source_bind_get_var (gimple *dbg)
4635 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4636 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4637 return gimple_op (dbg, 0);
4640 /* Return the value bound to the variable in a GIMPLE_DEBUG source bind
4641 statement. */
4643 static inline tree
4644 gimple_debug_source_bind_get_value (gimple *dbg)
4646 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4647 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4648 return gimple_op (dbg, 1);
4651 /* Return a pointer to the value bound to the variable in a
4652 GIMPLE_DEBUG source bind statement. */
4654 static inline tree *
4655 gimple_debug_source_bind_get_value_ptr (gimple *dbg)
4657 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4658 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4659 return gimple_op_ptr (dbg, 1);
4662 /* Set the variable bound in a GIMPLE_DEBUG source bind statement. */
4664 static inline void
4665 gimple_debug_source_bind_set_var (gimple *dbg, tree var)
4667 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4668 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4669 gimple_set_op (dbg, 0, var);
4672 /* Set the value bound to the variable in a GIMPLE_DEBUG source bind
4673 statement. */
4675 static inline void
4676 gimple_debug_source_bind_set_value (gimple *dbg, tree value)
4678 GIMPLE_CHECK (dbg, GIMPLE_DEBUG);
4679 gcc_gimple_checking_assert (gimple_debug_source_bind_p (dbg));
4680 gimple_set_op (dbg, 1, value);
4683 /* Return the line number for EXPR, or return -1 if we have no line
4684 number information for it. */
4685 static inline int
4686 get_lineno (const gimple *stmt)
4688 location_t loc;
4690 if (!stmt)
4691 return -1;
4693 loc = gimple_location (stmt);
4694 if (loc == UNKNOWN_LOCATION)
4695 return -1;
4697 return LOCATION_LINE (loc);
4700 /* Return a pointer to the body for the OMP statement GS. */
4702 static inline gimple_seq *
4703 gimple_omp_body_ptr (gimple *gs)
4705 return &static_cast <gimple_statement_omp *> (gs)->body;
4708 /* Return the body for the OMP statement GS. */
4710 static inline gimple_seq
4711 gimple_omp_body (gimple *gs)
4713 return *gimple_omp_body_ptr (gs);
4716 /* Set BODY to be the body for the OMP statement GS. */
4718 static inline void
4719 gimple_omp_set_body (gimple *gs, gimple_seq body)
4721 static_cast <gimple_statement_omp *> (gs)->body = body;
4725 /* Return the name associated with OMP_CRITICAL statement CRIT_STMT. */
4727 static inline tree
4728 gimple_omp_critical_name (const gomp_critical *crit_stmt)
4730 return crit_stmt->name;
4734 /* Return a pointer to the name associated with OMP critical statement
4735 CRIT_STMT. */
4737 static inline tree *
4738 gimple_omp_critical_name_ptr (gomp_critical *crit_stmt)
4740 return &crit_stmt->name;
4744 /* Set NAME to be the name associated with OMP critical statement
4745 CRIT_STMT. */
4747 static inline void
4748 gimple_omp_critical_set_name (gomp_critical *crit_stmt, tree name)
4750 crit_stmt->name = name;
4754 /* Return the clauses associated with OMP_CRITICAL statement CRIT_STMT. */
4756 static inline tree
4757 gimple_omp_critical_clauses (const gomp_critical *crit_stmt)
4759 return crit_stmt->clauses;
4763 /* Return a pointer to the clauses associated with OMP critical statement
4764 CRIT_STMT. */
4766 static inline tree *
4767 gimple_omp_critical_clauses_ptr (gomp_critical *crit_stmt)
4769 return &crit_stmt->clauses;
4773 /* Set CLAUSES to be the clauses associated with OMP critical statement
4774 CRIT_STMT. */
4776 static inline void
4777 gimple_omp_critical_set_clauses (gomp_critical *crit_stmt, tree clauses)
4779 crit_stmt->clauses = clauses;
4783 /* Return the clauses associated with OMP_ORDERED statement ORD_STMT. */
4785 static inline tree
4786 gimple_omp_ordered_clauses (const gomp_ordered *ord_stmt)
4788 return ord_stmt->clauses;
4792 /* Return a pointer to the clauses associated with OMP ordered statement
4793 ORD_STMT. */
4795 static inline tree *
4796 gimple_omp_ordered_clauses_ptr (gomp_ordered *ord_stmt)
4798 return &ord_stmt->clauses;
4802 /* Set CLAUSES to be the clauses associated with OMP ordered statement
4803 ORD_STMT. */
4805 static inline void
4806 gimple_omp_ordered_set_clauses (gomp_ordered *ord_stmt, tree clauses)
4808 ord_stmt->clauses = clauses;
4812 /* Return the kind of the OMP_FOR statemement G. */
4814 static inline int
4815 gimple_omp_for_kind (const gimple *g)
4817 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4818 return (gimple_omp_subcode (g) & GF_OMP_FOR_KIND_MASK);
4822 /* Set the kind of the OMP_FOR statement G. */
4824 static inline void
4825 gimple_omp_for_set_kind (gomp_for *g, int kind)
4827 g->subcode = (g->subcode & ~GF_OMP_FOR_KIND_MASK)
4828 | (kind & GF_OMP_FOR_KIND_MASK);
4832 /* Return true if OMP_FOR statement G has the
4833 GF_OMP_FOR_COMBINED flag set. */
4835 static inline bool
4836 gimple_omp_for_combined_p (const gimple *g)
4838 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4839 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED) != 0;
4843 /* Set the GF_OMP_FOR_COMBINED field in the OMP_FOR statement G depending on
4844 the boolean value of COMBINED_P. */
4846 static inline void
4847 gimple_omp_for_set_combined_p (gomp_for *g, bool combined_p)
4849 if (combined_p)
4850 g->subcode |= GF_OMP_FOR_COMBINED;
4851 else
4852 g->subcode &= ~GF_OMP_FOR_COMBINED;
4856 /* Return true if the OMP_FOR statement G has the
4857 GF_OMP_FOR_COMBINED_INTO flag set. */
4859 static inline bool
4860 gimple_omp_for_combined_into_p (const gimple *g)
4862 GIMPLE_CHECK (g, GIMPLE_OMP_FOR);
4863 return (gimple_omp_subcode (g) & GF_OMP_FOR_COMBINED_INTO) != 0;
4867 /* Set the GF_OMP_FOR_COMBINED_INTO field in the OMP_FOR statement G depending
4868 on the boolean value of COMBINED_P. */
4870 static inline void
4871 gimple_omp_for_set_combined_into_p (gomp_for *g, bool combined_p)
4873 if (combined_p)
4874 g->subcode |= GF_OMP_FOR_COMBINED_INTO;
4875 else
4876 g->subcode &= ~GF_OMP_FOR_COMBINED_INTO;
4880 /* Return the clauses associated with the OMP_FOR statement GS. */
4882 static inline tree
4883 gimple_omp_for_clauses (const gimple *gs)
4885 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4886 return omp_for_stmt->clauses;
4890 /* Return a pointer to the clauses associated with the OMP_FOR statement
4891 GS. */
4893 static inline tree *
4894 gimple_omp_for_clauses_ptr (gimple *gs)
4896 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4897 return &omp_for_stmt->clauses;
4901 /* Set CLAUSES to be the list of clauses associated with the OMP_FOR statement
4902 GS. */
4904 static inline void
4905 gimple_omp_for_set_clauses (gimple *gs, tree clauses)
4907 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4908 omp_for_stmt->clauses = clauses;
4912 /* Get the collapse count of the OMP_FOR statement GS. */
4914 static inline size_t
4915 gimple_omp_for_collapse (gimple *gs)
4917 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4918 return omp_for_stmt->collapse;
4922 /* Return the condition code associated with the OMP_FOR statement GS. */
4924 static inline enum tree_code
4925 gimple_omp_for_cond (const gimple *gs, size_t i)
4927 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4928 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4929 return omp_for_stmt->iter[i].cond;
4933 /* Set COND to be the condition code for the OMP_FOR statement GS. */
4935 static inline void
4936 gimple_omp_for_set_cond (gimple *gs, size_t i, enum tree_code cond)
4938 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4939 gcc_gimple_checking_assert (TREE_CODE_CLASS (cond) == tcc_comparison
4940 && i < omp_for_stmt->collapse);
4941 omp_for_stmt->iter[i].cond = cond;
4945 /* Return the index variable for the OMP_FOR statement GS. */
4947 static inline tree
4948 gimple_omp_for_index (const gimple *gs, size_t i)
4950 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4951 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4952 return omp_for_stmt->iter[i].index;
4956 /* Return a pointer to the index variable for the OMP_FOR statement GS. */
4958 static inline tree *
4959 gimple_omp_for_index_ptr (gimple *gs, size_t i)
4961 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4962 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4963 return &omp_for_stmt->iter[i].index;
4967 /* Set INDEX to be the index variable for the OMP_FOR statement GS. */
4969 static inline void
4970 gimple_omp_for_set_index (gimple *gs, size_t i, tree index)
4972 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4973 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4974 omp_for_stmt->iter[i].index = index;
4978 /* Return the initial value for the OMP_FOR statement GS. */
4980 static inline tree
4981 gimple_omp_for_initial (const gimple *gs, size_t i)
4983 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
4984 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4985 return omp_for_stmt->iter[i].initial;
4989 /* Return a pointer to the initial value for the OMP_FOR statement GS. */
4991 static inline tree *
4992 gimple_omp_for_initial_ptr (gimple *gs, size_t i)
4994 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
4995 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
4996 return &omp_for_stmt->iter[i].initial;
5000 /* Set INITIAL to be the initial value for the OMP_FOR statement GS. */
5002 static inline void
5003 gimple_omp_for_set_initial (gimple *gs, size_t i, tree initial)
5005 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5006 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5007 omp_for_stmt->iter[i].initial = initial;
5011 /* Return the final value for the OMP_FOR statement GS. */
5013 static inline tree
5014 gimple_omp_for_final (const gimple *gs, size_t i)
5016 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5017 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5018 return omp_for_stmt->iter[i].final;
5022 /* Return a pointer to the final value for the OMP_FOR statement GS. */
5024 static inline tree *
5025 gimple_omp_for_final_ptr (gimple *gs, size_t i)
5027 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5028 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5029 return &omp_for_stmt->iter[i].final;
5033 /* Set FINAL to be the final value for the OMP_FOR statement GS. */
5035 static inline void
5036 gimple_omp_for_set_final (gimple *gs, size_t i, tree final)
5038 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5039 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5040 omp_for_stmt->iter[i].final = final;
5044 /* Return the increment value for the OMP_FOR statement GS. */
5046 static inline tree
5047 gimple_omp_for_incr (const gimple *gs, size_t i)
5049 const gomp_for *omp_for_stmt = as_a <const gomp_for *> (gs);
5050 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5051 return omp_for_stmt->iter[i].incr;
5055 /* Return a pointer to the increment value for the OMP_FOR statement GS. */
5057 static inline tree *
5058 gimple_omp_for_incr_ptr (gimple *gs, size_t i)
5060 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5061 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5062 return &omp_for_stmt->iter[i].incr;
5066 /* Set INCR to be the increment value for the OMP_FOR statement GS. */
5068 static inline void
5069 gimple_omp_for_set_incr (gimple *gs, size_t i, tree incr)
5071 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5072 gcc_gimple_checking_assert (i < omp_for_stmt->collapse);
5073 omp_for_stmt->iter[i].incr = incr;
5077 /* Return a pointer to the sequence of statements to execute before the OMP_FOR
5078 statement GS starts. */
5080 static inline gimple_seq *
5081 gimple_omp_for_pre_body_ptr (gimple *gs)
5083 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5084 return &omp_for_stmt->pre_body;
5088 /* Return the sequence of statements to execute before the OMP_FOR
5089 statement GS starts. */
5091 static inline gimple_seq
5092 gimple_omp_for_pre_body (gimple *gs)
5094 return *gimple_omp_for_pre_body_ptr (gs);
5098 /* Set PRE_BODY to be the sequence of statements to execute before the
5099 OMP_FOR statement GS starts. */
5101 static inline void
5102 gimple_omp_for_set_pre_body (gimple *gs, gimple_seq pre_body)
5104 gomp_for *omp_for_stmt = as_a <gomp_for *> (gs);
5105 omp_for_stmt->pre_body = pre_body;
5108 /* Return the kernel_phony of OMP_FOR statement. */
5110 static inline bool
5111 gimple_omp_for_grid_phony (const gomp_for *omp_for)
5113 return (gimple_omp_subcode (omp_for) & GF_OMP_FOR_GRID_PHONY) != 0;
5116 /* Set kernel_phony flag of OMP_FOR to VALUE. */
5118 static inline void
5119 gimple_omp_for_set_grid_phony (gomp_for *omp_for, bool value)
5121 if (value)
5122 omp_for->subcode |= GF_OMP_FOR_GRID_PHONY;
5123 else
5124 omp_for->subcode &= ~GF_OMP_FOR_GRID_PHONY;
5127 /* Return the clauses associated with OMP_PARALLEL GS. */
5129 static inline tree
5130 gimple_omp_parallel_clauses (const gimple *gs)
5132 const gomp_parallel *omp_parallel_stmt = as_a <const gomp_parallel *> (gs);
5133 return omp_parallel_stmt->clauses;
5137 /* Return a pointer to the clauses associated with OMP_PARALLEL_STMT. */
5139 static inline tree *
5140 gimple_omp_parallel_clauses_ptr (gomp_parallel *omp_parallel_stmt)
5142 return &omp_parallel_stmt->clauses;
5146 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL_STMT. */
5148 static inline void
5149 gimple_omp_parallel_set_clauses (gomp_parallel *omp_parallel_stmt,
5150 tree clauses)
5152 omp_parallel_stmt->clauses = clauses;
5156 /* Return the child function used to hold the body of OMP_PARALLEL_STMT. */
5158 static inline tree
5159 gimple_omp_parallel_child_fn (const gomp_parallel *omp_parallel_stmt)
5161 return omp_parallel_stmt->child_fn;
5164 /* Return a pointer to the child function used to hold the body of
5165 OMP_PARALLEL_STMT. */
5167 static inline tree *
5168 gimple_omp_parallel_child_fn_ptr (gomp_parallel *omp_parallel_stmt)
5170 return &omp_parallel_stmt->child_fn;
5174 /* Set CHILD_FN to be the child function for OMP_PARALLEL_STMT. */
5176 static inline void
5177 gimple_omp_parallel_set_child_fn (gomp_parallel *omp_parallel_stmt,
5178 tree child_fn)
5180 omp_parallel_stmt->child_fn = child_fn;
5184 /* Return the artificial argument used to send variables and values
5185 from the parent to the children threads in OMP_PARALLEL_STMT. */
5187 static inline tree
5188 gimple_omp_parallel_data_arg (const gomp_parallel *omp_parallel_stmt)
5190 return omp_parallel_stmt->data_arg;
5194 /* Return a pointer to the data argument for OMP_PARALLEL_STMT. */
5196 static inline tree *
5197 gimple_omp_parallel_data_arg_ptr (gomp_parallel *omp_parallel_stmt)
5199 return &omp_parallel_stmt->data_arg;
5203 /* Set DATA_ARG to be the data argument for OMP_PARALLEL_STMT. */
5205 static inline void
5206 gimple_omp_parallel_set_data_arg (gomp_parallel *omp_parallel_stmt,
5207 tree data_arg)
5209 omp_parallel_stmt->data_arg = data_arg;
5212 /* Return the kernel_phony flag of OMP_PARALLEL_STMT. */
5214 static inline bool
5215 gimple_omp_parallel_grid_phony (const gomp_parallel *stmt)
5217 return (gimple_omp_subcode (stmt) & GF_OMP_PARALLEL_GRID_PHONY) != 0;
5220 /* Set kernel_phony flag of OMP_PARALLEL_STMT to VALUE. */
5222 static inline void
5223 gimple_omp_parallel_set_grid_phony (gomp_parallel *stmt, bool value)
5225 if (value)
5226 stmt->subcode |= GF_OMP_PARALLEL_GRID_PHONY;
5227 else
5228 stmt->subcode &= ~GF_OMP_PARALLEL_GRID_PHONY;
5231 /* Return the clauses associated with OMP_TASK GS. */
5233 static inline tree
5234 gimple_omp_task_clauses (const gimple *gs)
5236 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5237 return omp_task_stmt->clauses;
5241 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5243 static inline tree *
5244 gimple_omp_task_clauses_ptr (gimple *gs)
5246 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5247 return &omp_task_stmt->clauses;
5251 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5252 GS. */
5254 static inline void
5255 gimple_omp_task_set_clauses (gimple *gs, tree clauses)
5257 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5258 omp_task_stmt->clauses = clauses;
5262 /* Return true if OMP task statement G has the
5263 GF_OMP_TASK_TASKLOOP flag set. */
5265 static inline bool
5266 gimple_omp_task_taskloop_p (const gimple *g)
5268 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5269 return (gimple_omp_subcode (g) & GF_OMP_TASK_TASKLOOP) != 0;
5273 /* Set the GF_OMP_TASK_TASKLOOP field in G depending on the boolean
5274 value of TASKLOOP_P. */
5276 static inline void
5277 gimple_omp_task_set_taskloop_p (gimple *g, bool taskloop_p)
5279 GIMPLE_CHECK (g, GIMPLE_OMP_TASK);
5280 if (taskloop_p)
5281 g->subcode |= GF_OMP_TASK_TASKLOOP;
5282 else
5283 g->subcode &= ~GF_OMP_TASK_TASKLOOP;
5287 /* Return the child function used to hold the body of OMP_TASK GS. */
5289 static inline tree
5290 gimple_omp_task_child_fn (const gimple *gs)
5292 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5293 return omp_task_stmt->child_fn;
5296 /* Return a pointer to the child function used to hold the body of
5297 OMP_TASK GS. */
5299 static inline tree *
5300 gimple_omp_task_child_fn_ptr (gimple *gs)
5302 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5303 return &omp_task_stmt->child_fn;
5307 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5309 static inline void
5310 gimple_omp_task_set_child_fn (gimple *gs, tree child_fn)
5312 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5313 omp_task_stmt->child_fn = child_fn;
5317 /* Return the artificial argument used to send variables and values
5318 from the parent to the children threads in OMP_TASK GS. */
5320 static inline tree
5321 gimple_omp_task_data_arg (const gimple *gs)
5323 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5324 return omp_task_stmt->data_arg;
5328 /* Return a pointer to the data argument for OMP_TASK GS. */
5330 static inline tree *
5331 gimple_omp_task_data_arg_ptr (gimple *gs)
5333 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5334 return &omp_task_stmt->data_arg;
5338 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5340 static inline void
5341 gimple_omp_task_set_data_arg (gimple *gs, tree data_arg)
5343 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5344 omp_task_stmt->data_arg = data_arg;
5348 /* Return the clauses associated with OMP_TASK GS. */
5350 static inline tree
5351 gimple_omp_taskreg_clauses (const gimple *gs)
5353 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5354 = as_a <const gimple_statement_omp_taskreg *> (gs);
5355 return omp_taskreg_stmt->clauses;
5359 /* Return a pointer to the clauses associated with OMP_TASK GS. */
5361 static inline tree *
5362 gimple_omp_taskreg_clauses_ptr (gimple *gs)
5364 gimple_statement_omp_taskreg *omp_taskreg_stmt
5365 = as_a <gimple_statement_omp_taskreg *> (gs);
5366 return &omp_taskreg_stmt->clauses;
5370 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
5371 GS. */
5373 static inline void
5374 gimple_omp_taskreg_set_clauses (gimple *gs, tree clauses)
5376 gimple_statement_omp_taskreg *omp_taskreg_stmt
5377 = as_a <gimple_statement_omp_taskreg *> (gs);
5378 omp_taskreg_stmt->clauses = clauses;
5382 /* Return the child function used to hold the body of OMP_TASK GS. */
5384 static inline tree
5385 gimple_omp_taskreg_child_fn (const gimple *gs)
5387 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5388 = as_a <const gimple_statement_omp_taskreg *> (gs);
5389 return omp_taskreg_stmt->child_fn;
5392 /* Return a pointer to the child function used to hold the body of
5393 OMP_TASK GS. */
5395 static inline tree *
5396 gimple_omp_taskreg_child_fn_ptr (gimple *gs)
5398 gimple_statement_omp_taskreg *omp_taskreg_stmt
5399 = as_a <gimple_statement_omp_taskreg *> (gs);
5400 return &omp_taskreg_stmt->child_fn;
5404 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
5406 static inline void
5407 gimple_omp_taskreg_set_child_fn (gimple *gs, tree child_fn)
5409 gimple_statement_omp_taskreg *omp_taskreg_stmt
5410 = as_a <gimple_statement_omp_taskreg *> (gs);
5411 omp_taskreg_stmt->child_fn = child_fn;
5415 /* Return the artificial argument used to send variables and values
5416 from the parent to the children threads in OMP_TASK GS. */
5418 static inline tree
5419 gimple_omp_taskreg_data_arg (const gimple *gs)
5421 const gimple_statement_omp_taskreg *omp_taskreg_stmt
5422 = as_a <const gimple_statement_omp_taskreg *> (gs);
5423 return omp_taskreg_stmt->data_arg;
5427 /* Return a pointer to the data argument for OMP_TASK GS. */
5429 static inline tree *
5430 gimple_omp_taskreg_data_arg_ptr (gimple *gs)
5432 gimple_statement_omp_taskreg *omp_taskreg_stmt
5433 = as_a <gimple_statement_omp_taskreg *> (gs);
5434 return &omp_taskreg_stmt->data_arg;
5438 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
5440 static inline void
5441 gimple_omp_taskreg_set_data_arg (gimple *gs, tree data_arg)
5443 gimple_statement_omp_taskreg *omp_taskreg_stmt
5444 = as_a <gimple_statement_omp_taskreg *> (gs);
5445 omp_taskreg_stmt->data_arg = data_arg;
5449 /* Return the copy function used to hold the body of OMP_TASK GS. */
5451 static inline tree
5452 gimple_omp_task_copy_fn (const gimple *gs)
5454 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5455 return omp_task_stmt->copy_fn;
5458 /* Return a pointer to the copy function used to hold the body of
5459 OMP_TASK GS. */
5461 static inline tree *
5462 gimple_omp_task_copy_fn_ptr (gimple *gs)
5464 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5465 return &omp_task_stmt->copy_fn;
5469 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
5471 static inline void
5472 gimple_omp_task_set_copy_fn (gimple *gs, tree copy_fn)
5474 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5475 omp_task_stmt->copy_fn = copy_fn;
5479 /* Return size of the data block in bytes in OMP_TASK GS. */
5481 static inline tree
5482 gimple_omp_task_arg_size (const gimple *gs)
5484 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5485 return omp_task_stmt->arg_size;
5489 /* Return a pointer to the data block size for OMP_TASK GS. */
5491 static inline tree *
5492 gimple_omp_task_arg_size_ptr (gimple *gs)
5494 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5495 return &omp_task_stmt->arg_size;
5499 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
5501 static inline void
5502 gimple_omp_task_set_arg_size (gimple *gs, tree arg_size)
5504 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5505 omp_task_stmt->arg_size = arg_size;
5509 /* Return align of the data block in bytes in OMP_TASK GS. */
5511 static inline tree
5512 gimple_omp_task_arg_align (const gimple *gs)
5514 const gomp_task *omp_task_stmt = as_a <const gomp_task *> (gs);
5515 return omp_task_stmt->arg_align;
5519 /* Return a pointer to the data block align for OMP_TASK GS. */
5521 static inline tree *
5522 gimple_omp_task_arg_align_ptr (gimple *gs)
5524 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5525 return &omp_task_stmt->arg_align;
5529 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
5531 static inline void
5532 gimple_omp_task_set_arg_align (gimple *gs, tree arg_align)
5534 gomp_task *omp_task_stmt = as_a <gomp_task *> (gs);
5535 omp_task_stmt->arg_align = arg_align;
5539 /* Return the clauses associated with OMP_SINGLE GS. */
5541 static inline tree
5542 gimple_omp_single_clauses (const gimple *gs)
5544 const gomp_single *omp_single_stmt = as_a <const gomp_single *> (gs);
5545 return omp_single_stmt->clauses;
5549 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
5551 static inline tree *
5552 gimple_omp_single_clauses_ptr (gimple *gs)
5554 gomp_single *omp_single_stmt = as_a <gomp_single *> (gs);
5555 return &omp_single_stmt->clauses;
5559 /* Set CLAUSES to be the clauses associated with OMP_SINGLE_STMT. */
5561 static inline void
5562 gimple_omp_single_set_clauses (gomp_single *omp_single_stmt, tree clauses)
5564 omp_single_stmt->clauses = clauses;
5568 /* Return the clauses associated with OMP_TARGET GS. */
5570 static inline tree
5571 gimple_omp_target_clauses (const gimple *gs)
5573 const gomp_target *omp_target_stmt = as_a <const gomp_target *> (gs);
5574 return omp_target_stmt->clauses;
5578 /* Return a pointer to the clauses associated with OMP_TARGET GS. */
5580 static inline tree *
5581 gimple_omp_target_clauses_ptr (gimple *gs)
5583 gomp_target *omp_target_stmt = as_a <gomp_target *> (gs);
5584 return &omp_target_stmt->clauses;
5588 /* Set CLAUSES to be the clauses associated with OMP_TARGET_STMT. */
5590 static inline void
5591 gimple_omp_target_set_clauses (gomp_target *omp_target_stmt,
5592 tree clauses)
5594 omp_target_stmt->clauses = clauses;
5598 /* Return the kind of the OMP_TARGET G. */
5600 static inline int
5601 gimple_omp_target_kind (const gimple *g)
5603 GIMPLE_CHECK (g, GIMPLE_OMP_TARGET);
5604 return (gimple_omp_subcode (g) & GF_OMP_TARGET_KIND_MASK);
5608 /* Set the kind of the OMP_TARGET G. */
5610 static inline void
5611 gimple_omp_target_set_kind (gomp_target *g, int kind)
5613 g->subcode = (g->subcode & ~GF_OMP_TARGET_KIND_MASK)
5614 | (kind & GF_OMP_TARGET_KIND_MASK);
5618 /* Return the child function used to hold the body of OMP_TARGET_STMT. */
5620 static inline tree
5621 gimple_omp_target_child_fn (const gomp_target *omp_target_stmt)
5623 return omp_target_stmt->child_fn;
5626 /* Return a pointer to the child function used to hold the body of
5627 OMP_TARGET_STMT. */
5629 static inline tree *
5630 gimple_omp_target_child_fn_ptr (gomp_target *omp_target_stmt)
5632 return &omp_target_stmt->child_fn;
5636 /* Set CHILD_FN to be the child function for OMP_TARGET_STMT. */
5638 static inline void
5639 gimple_omp_target_set_child_fn (gomp_target *omp_target_stmt,
5640 tree child_fn)
5642 omp_target_stmt->child_fn = child_fn;
5646 /* Return the artificial argument used to send variables and values
5647 from the parent to the children threads in OMP_TARGET_STMT. */
5649 static inline tree
5650 gimple_omp_target_data_arg (const gomp_target *omp_target_stmt)
5652 return omp_target_stmt->data_arg;
5656 /* Return a pointer to the data argument for OMP_TARGET GS. */
5658 static inline tree *
5659 gimple_omp_target_data_arg_ptr (gomp_target *omp_target_stmt)
5661 return &omp_target_stmt->data_arg;
5665 /* Set DATA_ARG to be the data argument for OMP_TARGET_STMT. */
5667 static inline void
5668 gimple_omp_target_set_data_arg (gomp_target *omp_target_stmt,
5669 tree data_arg)
5671 omp_target_stmt->data_arg = data_arg;
5675 /* Return the clauses associated with OMP_TEAMS GS. */
5677 static inline tree
5678 gimple_omp_teams_clauses (const gimple *gs)
5680 const gomp_teams *omp_teams_stmt = as_a <const gomp_teams *> (gs);
5681 return omp_teams_stmt->clauses;
5685 /* Return a pointer to the clauses associated with OMP_TEAMS GS. */
5687 static inline tree *
5688 gimple_omp_teams_clauses_ptr (gimple *gs)
5690 gomp_teams *omp_teams_stmt = as_a <gomp_teams *> (gs);
5691 return &omp_teams_stmt->clauses;
5695 /* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT. */
5697 static inline void
5698 gimple_omp_teams_set_clauses (gomp_teams *omp_teams_stmt, tree clauses)
5700 omp_teams_stmt->clauses = clauses;
5703 /* Return the kernel_phony flag of an OMP_TEAMS_STMT. */
5705 static inline bool
5706 gimple_omp_teams_grid_phony (const gomp_teams *omp_teams_stmt)
5708 return (gimple_omp_subcode (omp_teams_stmt) & GF_OMP_TEAMS_GRID_PHONY) != 0;
5711 /* Set kernel_phony flag of an OMP_TEAMS_STMT to VALUE. */
5713 static inline void
5714 gimple_omp_teams_set_grid_phony (gomp_teams *omp_teams_stmt, bool value)
5716 if (value)
5717 omp_teams_stmt->subcode |= GF_OMP_TEAMS_GRID_PHONY;
5718 else
5719 omp_teams_stmt->subcode &= ~GF_OMP_TEAMS_GRID_PHONY;
5722 /* Return the clauses associated with OMP_SECTIONS GS. */
5724 static inline tree
5725 gimple_omp_sections_clauses (const gimple *gs)
5727 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5728 return omp_sections_stmt->clauses;
5732 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
5734 static inline tree *
5735 gimple_omp_sections_clauses_ptr (gimple *gs)
5737 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5738 return &omp_sections_stmt->clauses;
5742 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
5743 GS. */
5745 static inline void
5746 gimple_omp_sections_set_clauses (gimple *gs, tree clauses)
5748 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5749 omp_sections_stmt->clauses = clauses;
5753 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
5754 in GS. */
5756 static inline tree
5757 gimple_omp_sections_control (const gimple *gs)
5759 const gomp_sections *omp_sections_stmt = as_a <const gomp_sections *> (gs);
5760 return omp_sections_stmt->control;
5764 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
5765 GS. */
5767 static inline tree *
5768 gimple_omp_sections_control_ptr (gimple *gs)
5770 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5771 return &omp_sections_stmt->control;
5775 /* Set CONTROL to be the set of clauses associated with the
5776 GIMPLE_OMP_SECTIONS in GS. */
5778 static inline void
5779 gimple_omp_sections_set_control (gimple *gs, tree control)
5781 gomp_sections *omp_sections_stmt = as_a <gomp_sections *> (gs);
5782 omp_sections_stmt->control = control;
5786 /* Set the value being stored in an atomic store. */
5788 static inline void
5789 gimple_omp_atomic_store_set_val (gomp_atomic_store *store_stmt, tree val)
5791 store_stmt->val = val;
5795 /* Return the value being stored in an atomic store. */
5797 static inline tree
5798 gimple_omp_atomic_store_val (const gomp_atomic_store *store_stmt)
5800 return store_stmt->val;
5804 /* Return a pointer to the value being stored in an atomic store. */
5806 static inline tree *
5807 gimple_omp_atomic_store_val_ptr (gomp_atomic_store *store_stmt)
5809 return &store_stmt->val;
5813 /* Set the LHS of an atomic load. */
5815 static inline void
5816 gimple_omp_atomic_load_set_lhs (gomp_atomic_load *load_stmt, tree lhs)
5818 load_stmt->lhs = lhs;
5822 /* Get the LHS of an atomic load. */
5824 static inline tree
5825 gimple_omp_atomic_load_lhs (const gomp_atomic_load *load_stmt)
5827 return load_stmt->lhs;
5831 /* Return a pointer to the LHS of an atomic load. */
5833 static inline tree *
5834 gimple_omp_atomic_load_lhs_ptr (gomp_atomic_load *load_stmt)
5836 return &load_stmt->lhs;
5840 /* Set the RHS of an atomic load. */
5842 static inline void
5843 gimple_omp_atomic_load_set_rhs (gomp_atomic_load *load_stmt, tree rhs)
5845 load_stmt->rhs = rhs;
5849 /* Get the RHS of an atomic load. */
5851 static inline tree
5852 gimple_omp_atomic_load_rhs (const gomp_atomic_load *load_stmt)
5854 return load_stmt->rhs;
5858 /* Return a pointer to the RHS of an atomic load. */
5860 static inline tree *
5861 gimple_omp_atomic_load_rhs_ptr (gomp_atomic_load *load_stmt)
5863 return &load_stmt->rhs;
5867 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5869 static inline tree
5870 gimple_omp_continue_control_def (const gomp_continue *cont_stmt)
5872 return cont_stmt->control_def;
5875 /* The same as above, but return the address. */
5877 static inline tree *
5878 gimple_omp_continue_control_def_ptr (gomp_continue *cont_stmt)
5880 return &cont_stmt->control_def;
5883 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
5885 static inline void
5886 gimple_omp_continue_set_control_def (gomp_continue *cont_stmt, tree def)
5888 cont_stmt->control_def = def;
5892 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5894 static inline tree
5895 gimple_omp_continue_control_use (const gomp_continue *cont_stmt)
5897 return cont_stmt->control_use;
5901 /* The same as above, but return the address. */
5903 static inline tree *
5904 gimple_omp_continue_control_use_ptr (gomp_continue *cont_stmt)
5906 return &cont_stmt->control_use;
5910 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
5912 static inline void
5913 gimple_omp_continue_set_control_use (gomp_continue *cont_stmt, tree use)
5915 cont_stmt->control_use = use;
5918 /* Return a pointer to the body for the GIMPLE_TRANSACTION statement
5919 TRANSACTION_STMT. */
5921 static inline gimple_seq *
5922 gimple_transaction_body_ptr (gtransaction *transaction_stmt)
5924 return &transaction_stmt->body;
5927 /* Return the body for the GIMPLE_TRANSACTION statement TRANSACTION_STMT. */
5929 static inline gimple_seq
5930 gimple_transaction_body (gtransaction *transaction_stmt)
5932 return transaction_stmt->body;
5935 /* Return the label associated with a GIMPLE_TRANSACTION. */
5937 static inline tree
5938 gimple_transaction_label_norm (const gtransaction *transaction_stmt)
5940 return transaction_stmt->label_norm;
5943 static inline tree *
5944 gimple_transaction_label_norm_ptr (gtransaction *transaction_stmt)
5946 return &transaction_stmt->label_norm;
5949 static inline tree
5950 gimple_transaction_label_uninst (const gtransaction *transaction_stmt)
5952 return transaction_stmt->label_uninst;
5955 static inline tree *
5956 gimple_transaction_label_uninst_ptr (gtransaction *transaction_stmt)
5958 return &transaction_stmt->label_uninst;
5961 static inline tree
5962 gimple_transaction_label_over (const gtransaction *transaction_stmt)
5964 return transaction_stmt->label_over;
5967 static inline tree *
5968 gimple_transaction_label_over_ptr (gtransaction *transaction_stmt)
5970 return &transaction_stmt->label_over;
5973 /* Return the subcode associated with a GIMPLE_TRANSACTION. */
5975 static inline unsigned int
5976 gimple_transaction_subcode (const gtransaction *transaction_stmt)
5978 return transaction_stmt->subcode;
5981 /* Set BODY to be the body for the GIMPLE_TRANSACTION statement
5982 TRANSACTION_STMT. */
5984 static inline void
5985 gimple_transaction_set_body (gtransaction *transaction_stmt,
5986 gimple_seq body)
5988 transaction_stmt->body = body;
5991 /* Set the label associated with a GIMPLE_TRANSACTION. */
5993 static inline void
5994 gimple_transaction_set_label_norm (gtransaction *transaction_stmt, tree label)
5996 transaction_stmt->label_norm = label;
5999 static inline void
6000 gimple_transaction_set_label_uninst (gtransaction *transaction_stmt, tree label)
6002 transaction_stmt->label_uninst = label;
6005 static inline void
6006 gimple_transaction_set_label_over (gtransaction *transaction_stmt, tree label)
6008 transaction_stmt->label_over = label;
6011 /* Set the subcode associated with a GIMPLE_TRANSACTION. */
6013 static inline void
6014 gimple_transaction_set_subcode (gtransaction *transaction_stmt,
6015 unsigned int subcode)
6017 transaction_stmt->subcode = subcode;
6020 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
6022 static inline tree *
6023 gimple_return_retval_ptr (greturn *gs)
6025 return &gs->op[0];
6028 /* Return the return value for GIMPLE_RETURN GS. */
6030 static inline tree
6031 gimple_return_retval (const greturn *gs)
6033 return gs->op[0];
6037 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
6039 static inline void
6040 gimple_return_set_retval (greturn *gs, tree retval)
6042 gs->op[0] = retval;
6046 /* Return the return bounds for GIMPLE_RETURN GS. */
6048 static inline tree
6049 gimple_return_retbnd (const gimple *gs)
6051 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6052 return gimple_op (gs, 1);
6056 /* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */
6058 static inline void
6059 gimple_return_set_retbnd (gimple *gs, tree retval)
6061 GIMPLE_CHECK (gs, GIMPLE_RETURN);
6062 gimple_set_op (gs, 1, retval);
6066 /* Returns true when the gimple statement STMT is any of the OMP types. */
6068 #define CASE_GIMPLE_OMP \
6069 case GIMPLE_OMP_PARALLEL: \
6070 case GIMPLE_OMP_TASK: \
6071 case GIMPLE_OMP_FOR: \
6072 case GIMPLE_OMP_SECTIONS: \
6073 case GIMPLE_OMP_SECTIONS_SWITCH: \
6074 case GIMPLE_OMP_SINGLE: \
6075 case GIMPLE_OMP_TARGET: \
6076 case GIMPLE_OMP_TEAMS: \
6077 case GIMPLE_OMP_SECTION: \
6078 case GIMPLE_OMP_MASTER: \
6079 case GIMPLE_OMP_TASKGROUP: \
6080 case GIMPLE_OMP_ORDERED: \
6081 case GIMPLE_OMP_CRITICAL: \
6082 case GIMPLE_OMP_RETURN: \
6083 case GIMPLE_OMP_ATOMIC_LOAD: \
6084 case GIMPLE_OMP_ATOMIC_STORE: \
6085 case GIMPLE_OMP_CONTINUE: \
6086 case GIMPLE_OMP_GRID_BODY
6088 static inline bool
6089 is_gimple_omp (const gimple *stmt)
6091 switch (gimple_code (stmt))
6093 CASE_GIMPLE_OMP:
6094 return true;
6095 default:
6096 return false;
6100 /* Return true if the OMP gimple statement STMT is any of the OpenACC types
6101 specifically. */
6103 static inline bool
6104 is_gimple_omp_oacc (const gimple *stmt)
6106 gcc_assert (is_gimple_omp (stmt));
6107 switch (gimple_code (stmt))
6109 case GIMPLE_OMP_FOR:
6110 switch (gimple_omp_for_kind (stmt))
6112 case GF_OMP_FOR_KIND_OACC_LOOP:
6113 return true;
6114 default:
6115 return false;
6117 case GIMPLE_OMP_TARGET:
6118 switch (gimple_omp_target_kind (stmt))
6120 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6121 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6122 case GF_OMP_TARGET_KIND_OACC_DATA:
6123 case GF_OMP_TARGET_KIND_OACC_UPDATE:
6124 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
6125 case GF_OMP_TARGET_KIND_OACC_DECLARE:
6126 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
6127 return true;
6128 default:
6129 return false;
6131 default:
6132 return false;
6137 /* Return true if the OMP gimple statement STMT is offloaded. */
6139 static inline bool
6140 is_gimple_omp_offloaded (const gimple *stmt)
6142 gcc_assert (is_gimple_omp (stmt));
6143 switch (gimple_code (stmt))
6145 case GIMPLE_OMP_TARGET:
6146 switch (gimple_omp_target_kind (stmt))
6148 case GF_OMP_TARGET_KIND_REGION:
6149 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
6150 case GF_OMP_TARGET_KIND_OACC_KERNELS:
6151 return true;
6152 default:
6153 return false;
6155 default:
6156 return false;
6161 /* Returns TRUE if statement G is a GIMPLE_NOP. */
6163 static inline bool
6164 gimple_nop_p (const gimple *g)
6166 return gimple_code (g) == GIMPLE_NOP;
6170 /* Return true if GS is a GIMPLE_RESX. */
6172 static inline bool
6173 is_gimple_resx (const gimple *gs)
6175 return gimple_code (gs) == GIMPLE_RESX;
6178 /* Return the type of the main expression computed by STMT. Return
6179 void_type_node if the statement computes nothing. */
6181 static inline tree
6182 gimple_expr_type (const gimple *stmt)
6184 enum gimple_code code = gimple_code (stmt);
6185 /* In general we want to pass out a type that can be substituted
6186 for both the RHS and the LHS types if there is a possibly
6187 useless conversion involved. That means returning the
6188 original RHS type as far as we can reconstruct it. */
6189 if (code == GIMPLE_CALL)
6191 const gcall *call_stmt = as_a <const gcall *> (stmt);
6192 if (gimple_call_internal_p (call_stmt)
6193 && gimple_call_internal_fn (call_stmt) == IFN_MASK_STORE)
6194 return TREE_TYPE (gimple_call_arg (call_stmt, 3));
6195 else
6196 return gimple_call_return_type (call_stmt);
6198 else if (code == GIMPLE_ASSIGN)
6200 if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR)
6201 return TREE_TYPE (gimple_assign_rhs1 (stmt));
6202 else
6203 /* As fallback use the type of the LHS. */
6204 return TREE_TYPE (gimple_get_lhs (stmt));
6206 else if (code == GIMPLE_COND)
6207 return boolean_type_node;
6208 else
6209 return void_type_node;
6212 /* Enum and arrays used for allocation stats. Keep in sync with
6213 gimple.c:gimple_alloc_kind_names. */
6214 enum gimple_alloc_kind
6216 gimple_alloc_kind_assign, /* Assignments. */
6217 gimple_alloc_kind_phi, /* PHI nodes. */
6218 gimple_alloc_kind_cond, /* Conditionals. */
6219 gimple_alloc_kind_rest, /* Everything else. */
6220 gimple_alloc_kind_all
6223 extern int gimple_alloc_counts[];
6224 extern int gimple_alloc_sizes[];
6226 /* Return the allocation kind for a given stmt CODE. */
6227 static inline enum gimple_alloc_kind
6228 gimple_alloc_kind (enum gimple_code code)
6230 switch (code)
6232 case GIMPLE_ASSIGN:
6233 return gimple_alloc_kind_assign;
6234 case GIMPLE_PHI:
6235 return gimple_alloc_kind_phi;
6236 case GIMPLE_COND:
6237 return gimple_alloc_kind_cond;
6238 default:
6239 return gimple_alloc_kind_rest;
6243 /* Return true if a location should not be emitted for this statement
6244 by annotate_all_with_location. */
6246 static inline bool
6247 gimple_do_not_emit_location_p (gimple *g)
6249 return gimple_plf (g, GF_PLF_1);
6252 /* Mark statement G so a location will not be emitted by
6253 annotate_one_with_location. */
6255 static inline void
6256 gimple_set_do_not_emit_location (gimple *g)
6258 /* The PLF flags are initialized to 0 when a new tuple is created,
6259 so no need to initialize it anywhere. */
6260 gimple_set_plf (g, GF_PLF_1, true);
6264 /* Macros for showing usage statistics. */
6265 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
6266 ? (x) \
6267 : ((x) < 1024*1024*10 \
6268 ? (x) / 1024 \
6269 : (x) / (1024*1024))))
6271 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
6273 #endif /* GCC_GIMPLE_H */